Remove remnants of iOS WK1 scrolling tree code
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-02-23  Simon Fraser  <simon.fraser@apple.com>
2
3         Remove remnants of iOS WK1 scrolling tree code
4         https://bugs.webkit.org/show_bug.cgi?id=194980
5
6         Reviewed by Sam Weinig.
7
8         Remove ScrollingTreeIOS and ScrollingCoordinatorIOS which were never instantiated,
9         to reduce maintenance costs and simplify.
10
11         Merge ScrollingTreeFrameScrollingNodeIOS into ScrollingTreeFrameScrollingNodeRemoteIOS
12         since that was the only concrete subclass, removing code which never applies to iOS WK2
13         (e.g. the synchronous scrolling code path).
14
15         * SourcesCocoa.txt:
16         * WebCore.xcodeproj/project.pbxproj:
17         * page/FrameView.h:
18         * page/scrolling/ScrollingCoordinator.cpp:
19         * page/scrolling/ScrollingTree.h:
20         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
21         * page/scrolling/ScrollingTreeNode.h:
22         * page/scrolling/ScrollingTreeScrollingNode.cpp:
23         (WebCore::ScrollingTreeScrollingNode::handleWheelEvent):
24         * page/scrolling/ScrollingTreeScrollingNode.h:
25         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterDelegatedScroll): Deleted.
26         (WebCore::ScrollingTreeScrollingNode::scrollableAreaSize const): Deleted.
27         (WebCore::ScrollingTreeScrollingNode::totalContentsSize const): Deleted.
28         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsets const): Deleted.
29         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsets const): Deleted.
30         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsetRanges const): Deleted.
31         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsetRanges const): Deleted.
32         (WebCore::ScrollingTreeScrollingNode::currentHorizontalSnapPointIndex const): Deleted.
33         (WebCore::ScrollingTreeScrollingNode::currentVerticalSnapPointIndex const): Deleted.
34         (WebCore::ScrollingTreeScrollingNode::setCurrentHorizontalSnapPointIndex): Deleted.
35         (WebCore::ScrollingTreeScrollingNode::setCurrentVerticalSnapPointIndex): Deleted.
36         (WebCore::ScrollingTreeScrollingNode::useDarkAppearanceForScrollbars const): Deleted.
37         (WebCore::ScrollingTreeScrollingNode::lastCommittedScrollPosition const): Deleted.
38         (WebCore::ScrollingTreeScrollingNode::reachableContentsSize const): Deleted.
39         (WebCore::ScrollingTreeScrollingNode::parentRelativeScrollableRect const): Deleted.
40         (WebCore::ScrollingTreeScrollingNode::scrollOrigin const): Deleted.
41         (WebCore::ScrollingTreeScrollingNode::totalContentsSizeForRubberBand const): Deleted.
42         (WebCore::ScrollingTreeScrollingNode::setTotalContentsSizeForRubberBand): Deleted.
43         (WebCore::ScrollingTreeScrollingNode::horizontalScrollElasticity const): Deleted.
44         (WebCore::ScrollingTreeScrollingNode::verticalScrollElasticity const): Deleted.
45         (WebCore::ScrollingTreeScrollingNode::hasEnabledHorizontalScrollbar const): Deleted.
46         (WebCore::ScrollingTreeScrollingNode::hasEnabledVerticalScrollbar const): Deleted.
47         (WebCore::ScrollingTreeScrollingNode::canHaveScrollbars const): Deleted.
48         (WebCore::ScrollingTreeScrollingNode::expectsWheelEventTestTrigger const): Deleted.
49         (WebCore::ScrollingTreeScrollingNode::scrollContainerLayer const): Deleted.
50         (WebCore::ScrollingTreeScrollingNode::scrolledContentsLayer const): Deleted.
51         * page/scrolling/ios/ScrollingCoordinatorIOS.h: Removed.
52         * page/scrolling/ios/ScrollingCoordinatorIOS.mm: Removed.
53         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h: Removed.
54         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: Removed.
55         * page/scrolling/ios/ScrollingTreeIOS.cpp: Removed.
56         * page/scrolling/ios/ScrollingTreeIOS.h: Removed.
57         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
58         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
59
60 2019-02-23  Justin Fan  <justin_fan@apple.com>
61
62         [WebGPU] Buffer updates part 1: async mapping functions, unmap, and destroy
63         https://bugs.webkit.org/show_bug.cgi?id=194665
64
65         Reviewed by Dean Jackson.
66
67         Test: map-write-buffers.html. Other tests updated to match new API.
68
69         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp: Added.
70         (WebCore::validateBufferBindingType): Ensure buffer binding usages match the binding type.
71         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Logic moved out from WebGPUDevice.cpp.
72         * Modules/webgpu/WebGPUBindGroupDescriptor.h:
73         * Modules/webgpu/WebGPUBuffer.cpp: Added GPUBuffer functionality.
74         (WebCore::WebGPUBuffer::create):
75         (WebCore::WebGPUBuffer::WebGPUBuffer):
76         (WebCore::WebGPUBuffer::mapReadAsync):
77         (WebCore::WebGPUBuffer::mapWriteAsync):
78         (WebCore::WebGPUBuffer::unmap):
79         (WebCore::WebGPUBuffer::destroy):
80         (WebCore::WebGPUBuffer::rejectOrRegisterPromiseCallback): Register a mapping request on the GPUBuffer, if valid.
81         * Modules/webgpu/WebGPUBuffer.h:
82         (WebCore::WebGPUBuffer::buffer const):
83         (WebCore::WebGPUBuffer::mapping const): Deleted.
84         * Modules/webgpu/WebGPUBuffer.idl: Update to latest API and enable every function except setSubData.
85         * Modules/webgpu/WebGPUCommandBuffer.cpp:
86         (WebCore::WebGPUCommandBuffer::beginRenderPass): Renamed descriptor conversion method.
87         * Modules/webgpu/WebGPUDevice.cpp:
88         (WebCore::WebGPUDevice::createBuffer const): Update to non-nullable return type.
89         (WebCore::WebGPUDevice::createBindGroup const): Move descriptor validation logic to descriptor implementation.
90         * Modules/webgpu/WebGPUDevice.h:
91         * Modules/webgpu/WebGPURenderPassDescriptor.cpp:
92         (WebCore::WebGPURenderPassDescriptor::asGPURenderPassDescriptor const): Renamed from validateAndConvertToGPUVersion.
93         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
94         (WebCore::WebGPURenderPassEncoder::setVertexBuffers): Add validation for submitted buffers.
95         * platform/graphics/gpu/GPUBuffer.cpp: Added.
96         (WebCore::GPUBuffer::PendingMappingCallback::PendingMappingCallback): New struct for retaining a reference to mapping callbacks.
97         * platform/graphics/gpu/GPUBuffer.h: Add functionality to retain callbacks and usage bits.
98         (WebCore::GPUBuffer::isVertex const):
99         (WebCore::GPUBuffer::isUniform const):
100         (WebCore::GPUBuffer::isStorage const):
101         (WebCore::GPUBuffer::isReadOnly const):
102         (WebCore::GPUBuffer::PendingMapPromise::create):
103         (WebCore::GPUBuffer::isMappable const):
104         (WebCore::GPUBuffer::isMapWriteable const):
105         (WebCore::GPUBuffer::isMapReadable const):
106         (WebCore::GPUBuffer::mapping const): Deleted.
107         * platform/graphics/gpu/GPUBufferUsage.h: enum class cannot be logical ORed together.
108         * platform/graphics/gpu/GPUDevice.cpp:
109         (WebCore::GPUDevice::tryCreateBuffer const): Renamed from createBuffer. 
110         (WebCore::GPUDevice::createBuffer const): Deleted.
111         * platform/graphics/gpu/GPUDevice.h:
112         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
113         (WebCore::GPUBuffer::tryCreateSharedBuffer): Attempt to create a MTLBuffer with shared memory.
114         (WebCore::GPUBuffer::tryCreate): No longer use Gigacage-allocated memory for MTLBuffer.
115         (WebCore::GPUBuffer::GPUBuffer):
116         (WebCore::GPUBuffer::~GPUBuffer):
117         (WebCore::GPUBuffer::registerMappingCallback): Register the provided callback to be executed when the staging buffer can be safely exposed.
118         (WebCore::GPUBuffer::stagingBufferForRead): Prepare the arrayBuffer for reading and run the mapping callback.
119         (WebCore::GPUBuffer::stagingBufferForWrite): Ditto, but for writing.
120         (WebCore::GPUBuffer::unmap): If needed, copy the staging ArrayBuffer to the MTLBuffer. Unregister any mapping callback.
121         (WebCore::GPUBuffer::destroy): Stub implementation for now. Frees the MTLBuffer as soon as possible.
122         (WebCore::GPUBuffer::create): Deleted.
123         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
124         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder): Ensure only read-only GPUBuffers are used as read-only on the GPU.
125
126         Add symbols for new files:
127         * Sources.txt:
128         * WebCore.xcodeproj/project.pbxproj:
129
130 2019-02-23  Keith Miller  <keith_miller@apple.com>
131
132         Add new mac target numbers
133         https://bugs.webkit.org/show_bug.cgi?id=194955
134
135         Reviewed by Tim Horton.
136
137         * Configurations/Base.xcconfig:
138         * Configurations/DebugRelease.xcconfig:
139
140 2019-02-23  chris fleizach  <cfleizach@apple.com>
141
142         AX: WebKit is incorrectly mapping the <meter> element to progressbar
143         https://bugs.webkit.org/show_bug.cgi?id=164051
144         <rdar://problem/29055615>
145
146         Reviewed by Joanmarie Diggs.
147
148         Add a specific role for meter and map that to the appropriate mac role. 
149
150         * accessibility/AccessibilityNodeObject.cpp:
151         (WebCore::AccessibilityNodeObject::canHaveChildren const):
152         (WebCore::AccessibilityNodeObject::isProgressIndicator const):
153         * accessibility/AccessibilityObject.cpp:
154         (WebCore::AccessibilityObject::accessibleNameDerivesFromContent const):
155         (WebCore::AccessibilityObject::isRangeControl const):
156         (WebCore::AccessibilityObject::computedRoleString const):
157         * accessibility/AccessibilityObjectInterface.h:
158         * accessibility/AccessibilityProgressIndicator.cpp:
159         (WebCore::AccessibilityProgressIndicator::roleValue const):
160         * accessibility/AccessibilityProgressIndicator.h:
161         * accessibility/AccessibilityRenderObject.cpp:
162         (WebCore::AccessibilityRenderObject::shouldFocusActiveDescendant const):
163         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
164         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
165         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
166         (createAccessibilityRoleMap):
167
168 2019-02-22  Ryosuke Niwa  <rniwa@webkit.org>
169
170         Crash in SWServerJobQueue::runNextJobSynchronously
171         https://bugs.webkit.org/show_bug.cgi?id=194974
172
173         Reviewed by Geoffrey Garen.
174
175         We suspect the crash is happening due to m_jobQueue being empty in runNextJobSynchronously
176         or there is a timer heap corruption again :(
177
178         Exit early when m_jobQueue is empty. Also add a debug assert that this should never happen
179         but convert an existing release assert to a debug assert since this appears to be hitting
180         too frequently in wild.
181
182         * workers/service/server/SWServerJobQueue.cpp:
183         (WebCore::SWServerJobQueue::runNextJobSynchronously):
184
185 2019-02-22  Simon Fraser  <simon.fraser@apple.com>
186
187         Clean up the setScrollPosition/setScrollPositionWithoutContentEdgeConstraints confusion in the scrolling tree nodes
188         https://bugs.webkit.org/show_bug.cgi?id=194968
189
190         Reviewed by Antti Koivisto.
191
192         Having both setScrollPosition() and setScrollPositionWithoutContentEdgeConstraints() is confusing because
193         you can't tell which is the bottleneck. So add a 'clamp' parameter to setScrollPosition() and merge them.
194
195         ScrollingTreeFrameScrollingNodeMac::setScrollPosition() replicates a bit of code but future cleanups will
196         reduce that.
197
198         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
199         (WebCore::ScrollingTreeFrameScrollingNode::setScrollPosition): Deleted. This was the same as the base class method.
200         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
201         * page/scrolling/ScrollingTreeScrollingNode.cpp:
202         (WebCore::ScrollingTreeScrollingNode::setScrollPosition):
203         (WebCore::ScrollingTreeScrollingNode::clampScrollPosition const):
204         (WebCore::ScrollingTreeScrollingNode::scrollBy):
205         (WebCore::ScrollingTreeScrollingNode::setScrollPositionWithoutContentEdgeConstraints): Deleted.
206         (WebCore::ScrollingTreeScrollingNode::scrollByWithoutContentEdgeConstraints): Deleted.
207         * page/scrolling/ScrollingTreeScrollingNode.h:
208         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
209         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
210         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPosition):
211         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints): Deleted. Did nothing.
212         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
213         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
214         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
215         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
216         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
217         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): Deleted.
218         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
219         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
220         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition):
221         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): Deleted.
222         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
223         (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollByWithoutContentEdgeConstraints):
224         * platform/PlatformWheelEvent.h:
225         (WebCore::PlatformWheelEvent::delta const):
226         * platform/ScrollTypes.h:
227
228 2019-02-22  Eric Liang  <ericliang@apple.com>
229
230         AX: Treat AXChildrenInNavigationOrder as AXChildren before adding support for aria-flowto
231         https://bugs.webkit.org/show_bug.cgi?id=194923
232
233         Reviewed by Chris Fleizach.
234
235         Added AXChildrenInNavigationOrder attribute that returns the same array as from AXChildren. It prevents AppKit from reordering elements from the fallback AXChildren attribute.
236
237         Test: accessibility/mac/children-in-navigation-order-returns-children.html
238
239         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
240         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
241
242 2019-02-22  Tim Horton  <timothy_horton@apple.com>
243
244         ProcessSwap.PageOverlayLayerPersistence fails on iOS and in debug builds
245         https://bugs.webkit.org/show_bug.cgi?id=194963
246
247         Reviewed by Dean Jackson.
248
249         Tested by existing failing API test.
250
251         * page/Page.cpp:
252         (WebCore::Page::installedPageOverlaysChanged): Deleted.
253         * page/Page.h:
254         (WebCore::Page::pageOverlayController):
255         * page/PageOverlayController.cpp:
256         (WebCore::PageOverlayController::installedPageOverlaysChanged):
257         (WebCore::PageOverlayController::detachViewOverlayLayers):
258         (WebCore::PageOverlayController::installPageOverlay):
259         (WebCore::PageOverlayController::uninstallPageOverlay):
260         (WebCore::PageOverlayController::willDetachRootLayer): Deleted.
261         * page/PageOverlayController.h:
262         As intended by r240940, move installedPageOverlaysChanged to PageOverlayController.
263         Also, make it ignore isInWindow state; otherwise, if you install a overlay
264         and then come into window, nothing installs the root layer. There is no
265         need for this code to follow in-window state manually anymore since
266         the DrawingArea and RenderLayerCompositor just hook the layers up when needed.
267
268         Make some methods private, and make detachViewOverlayLayers only touch
269         *view* overlays, so that we don't detach the document-relative root
270         layer when you drop to having no view overlays. This maintains
271         existing behavior because nothing was calling PageOverlayController::detachViewOverlayLayers.
272
273         Now there are no callers of willDetachRootLayer, so remove it.
274
275 2019-02-22  Andy Estes  <aestes@apple.com>
276
277         [iOS] Break a reference cycle between PreviewLoader and ResourceLoader
278         https://bugs.webkit.org/show_bug.cgi?id=194964
279         <rdar://problem/48279441>
280
281         Reviewed by Alex Christensen.
282
283         When a document's QuickLook preview is loaded, a reference cycle is created between
284         PreviewLoader and ResourceLoader. Break the cycle by clearing m_previewLoader in
285         ResourceLoader::releaseResources().
286
287         Fixes leaks detected by `run-webkit-tests --leaks LayoutTests/quicklook`.
288
289         * loader/ResourceLoader.cpp:
290         (WebCore::ResourceLoader::releaseResources):
291
292 2019-02-22  Sihui Liu  <sihui_liu@apple.com>
293
294         Crash under IDBServer::IDBConnectionToClient::identifier() const
295         https://bugs.webkit.org/show_bug.cgi?id=194843
296         <rdar://problem/48203102>
297
298         Reviewed by Geoffrey Garen.
299
300         UniqueIDBDatabase should ignore requests from connections that are already closed.
301
302         Tests are hard to create without some tricks on UniqueIDBDatabase so this fix is verified manually. 
303         One test is created by adding delay to UniqueIDBDatabase::openBackingStore on the background thread to make sure
304         disconnection of web process happens before UniqueIDBDatabase::didOpenBackingStore, because didOpenBackingStore
305         may start a version change transaction and ask for identifier from the connection that is already gone.
306
307         * Modules/indexeddb/server/IDBConnectionToClient.cpp:
308         (WebCore::IDBServer::IDBConnectionToClient::connectionToClientClosed):
309         * Modules/indexeddb/server/IDBConnectionToClient.h:
310         (WebCore::IDBServer::IDBConnectionToClient::isClosed):
311         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
312         (WebCore::IDBServer::UniqueIDBDatabase::clearStalePendingOpenDBRequests):
313         (WebCore::IDBServer::UniqueIDBDatabase::handleDatabaseOperations):
314         (WebCore::IDBServer::UniqueIDBDatabase::operationAndTransactionTimerFired):
315         * Modules/indexeddb/server/UniqueIDBDatabase.h:
316
317 2019-02-22  Wenson Hsieh  <wenson_hsieh@apple.com>
318
319         Input type "formatSetInlineTextDirection" is dispatched when changing paragraph-level text direction
320         https://bugs.webkit.org/show_bug.cgi?id=194703
321         <rdar://problem/48111775>
322
323         Reviewed by Ryosuke Niwa.
324
325         Currently, when changing text direction, WebKit always sends input events of type formatSetInlineTextDirection,
326         even when changing paragraph text direction. Instead, we should be emitting formatSetBlockTextDirection in this
327         scenario. This is problematic when using the context menus on macOS to change writing direction, since changing
328         "Selection Direction" is currently indistinguishable from changing "Paragraph Direction".
329
330         To fix this, we split EditAction::SetWritingDirection into EditAction::SetInlineWritingDirection and
331         EditAction::SetBlockWritingDirection, which emit inline and block text direction input events, respectively.
332
333         Tests: fast/events/before-input-events-prevent-block-text-direction.html
334                fast/events/before-input-events-prevent-inline-text-direction.html
335
336         * editing/CompositeEditCommand.cpp:
337         (WebCore::CompositeEditCommand::apply):
338         * editing/EditAction.cpp:
339         (WebCore::undoRedoLabel):
340         * editing/EditAction.h:
341         * editing/EditCommand.cpp:
342         (WebCore::inputTypeNameForEditingAction):
343         * editing/Editor.cpp:
344         (WebCore::inputEventDataForEditingStyleAndAction):
345         (WebCore::Editor::setBaseWritingDirection):
346         * editing/EditorCommand.cpp:
347         (WebCore::executeMakeTextWritingDirectionLeftToRight):
348         (WebCore::executeMakeTextWritingDirectionNatural):
349         (WebCore::executeMakeTextWritingDirectionRightToLeft):
350
351 2019-02-22  Rob Buis  <rbuis@igalia.com>
352
353         Remove stripLeadingAndTrailingWhitespace from MathMLElement.cpp
354         https://bugs.webkit.org/show_bug.cgi?id=160172
355
356         Reviewed by Frédéric Wang.
357
358         Remove stripLeadingAndTrailingWhitespace and use stripLeadingAndTrailingHTTPSpaces
359         from HTTPParsers instead.
360
361         No new tests, already covered by MathML tests.
362
363         * mathml/MathMLElement.cpp:
364         (WebCore::MathMLElement::stripLeadingAndTrailingWhitespace): Deleted.
365         * mathml/MathMLElement.h:
366         * mathml/MathMLPresentationElement.cpp:
367         (WebCore::MathMLPresentationElement::parseMathMLLength):
368         * mathml/MathMLTokenElement.cpp:
369         (WebCore::MathMLTokenElement::convertToSingleCodePoint):
370
371 2019-02-22  Eric Carlson  <eric.carlson@apple.com>
372
373         Update some media logging
374         https://bugs.webkit.org/show_bug.cgi?id=194915
375
376         Reviewed by Jer Noble.
377
378         No new tests, no functional change.
379
380         * Modules/mediasource/SourceBuffer.cpp:
381         (WebCore::SourceBuffer::evictCodedFrames):
382         (WebCore::SourceBuffer::provideMediaData):
383         (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued):
384
385         * html/HTMLMediaElement.cpp:
386         (WebCore::HTMLMediaElement::checkPlaybackTargetCompatablity):
387         (WebCore::HTMLMediaElement::loadResource):
388         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
389         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const):
390         (WebCore::HTMLMediaElement::seekTask):
391         (WebCore::HTMLMediaElement::playInternal):
392         (WebCore::HTMLMediaElement::pauseInternal):
393         (WebCore::HTMLMediaElement::setLoop):
394         (WebCore::HTMLMediaElement::setControls):
395         (WebCore::HTMLMediaElement::sourceWasRemoved):
396
397         * html/MediaElementSession.cpp:
398         (WebCore::convertEnumerationToString):
399
400         * html/MediaElementSession.h:
401         (WTF::LogArgument<WebCore::MediaPlaybackDenialReason>::toString):
402
403         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
404         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
405
406 2019-02-22  Rob Buis  <rbuis@igalia.com>
407
408         Fix unitless usage of mathsize
409         https://bugs.webkit.org/show_bug.cgi?id=194940
410
411         Reviewed by Frédéric Wang.
412
413         Convert unitless lengths to percentage values to correct the computed
414         font size.
415
416         * mathml/MathMLElement.cpp:
417         (WebCore::convertToPercentageIfNeeded):
418         (WebCore::MathMLElement::collectStyleForPresentationAttribute):
419
420 2019-02-21  Simon Fraser  <simon.fraser@apple.com>
421
422         Hardcode Visual Viewports on everywhere except iOS WK1
423         https://bugs.webkit.org/show_bug.cgi?id=194928
424
425         Reviewed by Zalan Bujtas.
426
427         Remove the WK1 and WK2 preferences and MiniBrowser menu item for "visual viewports",
428         change the default value of the Setting to 'true', and hardcode WebView on iOS to
429         set it to false. The setting has shipped for several years and there's no need to turn
430         it off now.
431
432         Similarly, disable the "Visual Viewport API" on iOS WK1, since it makes no sense if
433         Visual Viewports are not enabled.
434         
435         Remove the "visualViewportEnabled" flag and unused code paths from scrolling tree code
436         that only runs in WK2
437
438         * page/Settings.yaml:
439         * page/scrolling/AsyncScrollingCoordinator.cpp:
440         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
441         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
442         (WebCore::AsyncScrollingCoordinator::visualViewportEnabled const): Deleted.
443         * page/scrolling/AsyncScrollingCoordinator.h:
444         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
445         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
446         (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged):
447         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties const):
448         (WebCore::ScrollingStateFrameScrollingNode::setVisualViewportEnabled): Deleted.
449         * page/scrolling/ScrollingStateFrameScrollingNode.h:
450         * page/scrolling/ScrollingTree.cpp:
451         (WebCore::ScrollingTree::commitTreeState):
452         * page/scrolling/ScrollingTree.h:
453         (WebCore::ScrollingTree::visualViewportEnabled const): Deleted.
454         (WebCore::ScrollingTree::setVisualViewportEnabled): Deleted.
455         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
456         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition const):
457         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
458         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
459         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
460
461 2019-02-21  Darin Adler  <darin@apple.com>
462
463         Some refinements for Node and Document
464         https://bugs.webkit.org/show_bug.cgi?id=194764
465
466         Reviewed by Ryosuke Niwa.
467
468         * accessibility/AccessibilityObject.cpp:
469         (WebCore::AccessibilityObject::press): Use shadowHost instead of
470         deprecatedShadowAncestorNode.
471         (WebCore::AccessibilityObject::axObjectCache const): Tweak coding style.
472         (WebCore::AccessibilityObject::focusedUIElement const): Use existing page
473         function to streamline.
474
475         * accessibility/AccessibilityRenderObject.cpp:
476         (WebCore::AccessibilityRenderObject::accessKey const): Use
477         attributeWithoutSynchronization for efficiency and consistency with other
478         code working with the accesskey attribute.
479
480         * dom/ContainerNode.cpp:
481         (WebCore::ContainerNode::childrenChanged): Added call to
482         invalidateAccessKeyCache, replacing old scheme tied to style recalculation.
483
484         * dom/DecodedDataDocumentParser.cpp:
485         (WebCore::DecodedDataDocumentParser::appendBytes): Update for name and return
486         type change of createDecoderIfNeeded to decoder.
487         (WebCore::DecodedDataDocumentParser::flush): Ditto.
488
489         * dom/Document.cpp:
490         (WebCore::Document::elementForAccessKey): Renamed from getElementForAccessKey
491         to match WebKit coding style. Changed to use unique_ptr instead of separate
492         boolean to keep track of map validity status.
493         (WebCore::Document::buildAccessKeyCache): Renamed from buildAccessKeyMap to
494         clarify that this is a cache. Changed to use composedTreeDescendants rather
495         than explicit calls to shadowRoot. Use add instead of set so that first element
496         in document order wins, instead of last element in document order. Updated
497         to make a new map in a new unique_ptr instead of populating a map.
498         (WebCore::Document::invalidateAccessKeyCacheSlowCase): Renamed from
499         invalidateAccessKeyMap, and left an inline part in the header so the fast case
500         of quickly checking for a null pointer can be inlined.
501         (WebCore::Document::doctype const): Use downcast instead of static_cast.
502         (WebCore::Document::scheduleStyleRecalc): Moved call to invalidateAccessKeyMap
503         from here to childrenChanged and accesskey attribute change handling.
504         (WebCore::Document::processFormatDetection): Set m_isTelephoneNumberParsingAllowed
505         directly since this is the only place that does it and we don't need to factor
506         that one line of code into a function.
507         (WebCore::Document::getOverrideStyle): Moved to header since it's just a stub
508         that always returns nullptr and can be inlined.
509         (WebCore::Document::setIsTelephoneNumberParsingAllowed): Deleted.
510         (WebCore::Document::ensureTemplateDocument): Removed nullptr frame argument to
511         the create function, since Document::create now always involves no frame.
512         (WebCore::Document::didAssociateFormControl): Changed argument type to a reference
513         and simplified the logic with a local variable.
514         (WebCore::Document::didAssociateFormControlsTimerFired): Simplified the null
515         checks and rearranged things so that m_associatedFormControls will always
516         get cleared even if the document is no longer associated with a page.
517
518         * dom/Document.h: Removed unnnecessary explicit values for enumerations (first
519         value is always zero, etc.) and formatted simple enumerations in a single line
520         for easier reading. Moved Document::create fucntion bodies out of line, removed
521         the frame argument from the simple "create with URL" overload and made the frame
522         argument for createNonRenderedPlaceholder be a reference rather than a pointer.
523         Renamed getElementByAccessKey to elementForAccessKey, invalidateAccessKeyMap to
524         invalidateAccessKeyCache, buildAccessKeyMap to buildAccessKeCache,
525         m_elementsByAccessKey to m_accessKeyCache and changed its type.
526         Removed bogus "DOM methods" comment, unused setParserFeature friend declaration,
527         setIsTelephoneNumberParsingAllowed function, and m_accessKeyMapValid flag.
528
529         * dom/Document.idl: Added comment highlighting that getOverrideStyle is just a
530         placeholder returning null.
531
532         * dom/Element.cpp:
533         (WebCore::Element::attributeChanged): Call invalidateAccessKeyCache when the
534         value of the accesskey attribute is changed. Also moved the class attribute code
535         so the attributes here are in alphabetical order (only class and id were out of
536         alphabetical order).
537
538         * dom/Node.cpp:
539         (WebCore::Node::isDescendantOrShadowDescendantOf const): Rewrote to no longer
540         use deprecatedShadowAncestorNode and used boolean operators to make it a
541         single line and easier to understand. Also added a FIXME since the
542         containsIncludingShadowDOM function is so similar, yet differently written.
543         (WebCore::Node::contains const): Rewrote as a single line to make this easier
544         to read and to *slightly* improve the speed in the "this == node" case.
545         (WebCore::Node::containsIncludingHostElements const): Use downcast.
546         (WebCore::Node::deprecatedShadowAncestorNode const): Deleted.
547
548         * dom/Node.h: Deleted now-unused deprecatedShadowAncestorNode.
549
550         * editing/ReplaceSelectionCommand.cpp:
551         (WebCore::ReplacementFragment::ReplacementFragment): Rewrote to use shadowHost
552         instead of deprecatedShadowAncestorNode.
553
554         * html/FormAssociatedElement.cpp:
555         (WebCore::FormAssociatedElement::resetFormOwner): Pass reference to
556         didAssociateFormControl.
557         (WebCore::FormAssociatedElement::formAttributeChanged): Ditto.
558
559         * html/HTMLAreaElement.cpp:
560         (WebCore::HTMLAreaElement::parseAttribute): Removed special case for accesskey
561         attribute, because we want to call the base class parseAttribute in that case.
562
563         * html/HTMLFormElement.cpp:
564         (WebCore::HTMLFormElement::insertedIntoAncestor): Pass reference to
565         didAssociateFormControl.
566
567         * html/HTMLSelectElement.cpp:
568         (WebCore::HTMLSelectElement::parseAttribute): Removed special case for accesskey
569         attribute with mysterious FIXME, because we want to call the base class
570         parseAttribute in that case. The old code had no effect before; the access key
571         logic would still find the attribute; if the goal is to ignore the attribute
572         for these elements we will need a different solution.
573         * html/HTMLTextAreaElement.cpp:
574         (WebCore::HTMLTextAreaElement::parseAttribute): Ditto.
575
576         * loader/DocumentLoader.cpp:
577         (WebCore::DocumentLoader::DocumentLoader): Removed code that was always passing
578         nullptr as the frame for the newly created DocumentWriter. It used m_frame, but
579         m_frame was always null.
580         (WebCore::DocumentLoader::attachToFrame): Pass reference to DocumentWriter::setFrame.
581
582         * loader/DocumentWriter.cpp:
583         (WebCore::DocumentWriter::DocumentWriter): Deleted. The old version set m_frame to
584         the passed in frame, which was always nullptr, and initialized some booleans and an
585         enumeration, which are now initialized in the class definition.
586         (WebCore::DocumentWriter::createDocument): Pass a reference for the frame.
587         (WebCore::DocumentWriter::begin): Updated now that State is an enum class.
588         (WebCore::DocumentWriter::decoder): Renamed from createDecoderIfNeeded and changed
589         to return a reference.
590         (WebCore::DocumentWriter::addData): Use RELEASE_ASSERT instead of if/CRASH and
591         updated now that State is an enum class.
592         (WebCore::DocumentWriter::insertDataSynchronously): Updated now that State is an
593         enum class.
594         (WebCore::DocumentWriter::end): Ditto.
595
596         * loader/DocumentWriter.h: Removed unneeded include and forward declaration.
597         Removed the frame pointer argument to the constructor, caller was always passing a
598         nullptr. Changed argument to setFrame to be a reference. Renamed createDecoderIfNeeded
599         to decoder and changed it to return a reference. Initialized m_frame,
600         m_hasReceivedSomeData, m_encodingWasChosenByUser, and m_state here so we don't need
601         to initialize them in a constructor. Renamed the enum from WriterState to State since
602         it's a member of DocumentWriter already, and made it an enum class rather than ending
603         each enumeration value with WritingState.
604
605         * page/DragController.cpp:
606         (WebCore::isEnabledColorInput): Removed boolean argument setToShadowAncestor. The
607         one caller that formerly passed true now calls the new hasEnabledColorInputAsShadowHost
608         function instead.
609         (WebCore::hasEnabledColorInputAsShadowHost): Added.
610         (WebCore::elementUnderMouse): Use shadowHost instead of deprecatedShadowAncestorNode.
611         Also added FIXME since it seems this should instead be using parentElementInComposedTree.
612         (WebCore::DragController::concludeEditDrag): Removed "false" argument to isEnabledColorInput.
613         (WebCore::DragController::canProcessDrag): Removed "true" argument to isEnabledColorInput
614         and added call to hasEnabledColorInputAsShadowHost. Also put the value of the node to drag
615         into a local variable to simplify code.
616         (WebCore::DragController::draggableElement const): Removed "false" argument to isEnabledColorInput.
617
618         * page/EventHandler.cpp:
619         (WebCore::EventHandler::handleAccessKey): Update name of elementForAccessKey.
620
621         * page/FocusController.cpp:
622         (WebCore::clearSelectionIfNeeded): Use shadowHost instead of deprecatedShadowAncestorNode.
623
624         * workers/service/context/ServiceWorkerThreadProxy.cpp:
625         (WebCore::createPageForServiceWorker): Pass reference instead of pointer for frame to
626         Document::createNonRenderedPlaceholder.
627
628 2019-02-21  Daniel Bates  <dabates@apple.com>
629
630         Same Site Lax cookies are not sent with cross-site redirect from client-initiated load
631         https://bugs.webkit.org/show_bug.cgi?id=194906
632         <rdar://problem/44305947>
633
634         Reviewed by Brent Fulgham.
635
636         Ensure that a request for a top-level navigation is annotated as such regardless of whether
637         the request has a computed Same Site policy.
638
639         "New loads" initiated by a the client (Safari) either by API or a human either explicitly
640         typing a URL in the address bar or Command + clicking a hyperlink to open it in a new window/tab
641         are always considered Same Site. This is by definition from the spec. [1] as we aren't navigating
642         from an existing page. (Command + click should be thought of as a convenience to the user from
643         having to copy the hyperlink's URL, create a new window, and paste the URL into the address bar).
644         Currently the frame loader marks a request as a top-level navigation if and only if the request
645         does not have a pre-computed Same Site policy. However, "New loads" have a pre-computed Same Site
646         policy. So, these loads would never be marked as a top-level navigation by the frame loading code.
647         Therefore, if the "new load" turned out to be a cross-site redirect then WebKit would incorrectly
648         tell the networking stack that the load was a cross-site, non-top-level navigation, and per the
649         Same Site spec [2], the networking stack would not send Same Site Lax cookies. Instead,
650         WebKit should unconditionally ensure that requests are marked as a top-level navigation, if applicable.
651
652         [1] See Note for (1) in  <https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-5.2>
653         [2] <https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-5.3.7.1>
654
655         Test: http/tests/cookies/same-site/user-load-cross-site-redirect.php
656
657         * loader/FrameLoader.cpp:
658         (WebCore::FrameLoader::addExtraFieldsToRequest): Unconditionally update the request's top-
659         level navigation bit.
660         * platform/network/ResourceRequestBase.cpp:
661         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Unconditionally copy a request's top-
662         level navigation bit.
663
664 2019-02-21  Per Arne Vollan  <pvollan@apple.com>
665
666         Layout Test fast/text/international/khmer-selection.html is crashing
667         https://bugs.webkit.org/show_bug.cgi?id=191368
668
669         Reviewed by Brent Fulgham.
670
671         GlyphBuffer's offset array wasn't getting filled by UniscribeController.
672         Our underlining code requires this array.
673
674         Uniscribe gives us a character -> glyph mapping, so we just have to compute
675         the inverse and give it to the GlyphBuffer.
676
677         This patch is written by Myles C. Maxfield.
678
679         Test: fast/text/international/khmer-selection.html.
680
681         * platform/graphics/GlyphBuffer.h:
682         (WebCore::GlyphBuffer::add):
683         * platform/graphics/displaylists/DisplayListItems.cpp:
684         (WebCore::DisplayList::DrawGlyphs::generateGlyphBuffer const):
685         * platform/graphics/win/UniscribeController.cpp:
686         (WebCore::UniscribeController::advance):
687         (WebCore::UniscribeController::itemizeShapeAndPlace):
688         (WebCore::UniscribeController::shapeAndPlaceItem):
689         * platform/graphics/win/UniscribeController.h:
690
691 2019-02-21  Sihui Liu  <sihui_liu@apple.com>
692
693         IndexedDB: leak UniqueIDBDatabase in layout tests
694         https://bugs.webkit.org/show_bug.cgi?id=194870
695         <rdar://problem/48163812>
696
697         Reviewed by Geoffrey Garen.
698
699         UniqueIDBDatabase owns a pointer to itself after it is hard closed. It should release the pointer when it 
700         receives confirmation from clients and all pending tasks are done. UniqueIDBDatabase already checks whether the
701         pointer should be released when a database task finishes, but it didn't perform a check when a confirm message 
702         is received. 
703
704         No new test as the order of task completion and confirmation arrival is uncertain.
705
706         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
707         (WebCore::IDBServer::UniqueIDBDatabase::confirmDidCloseFromServer):
708
709 2019-02-21  Andy Estes  <aestes@apple.com>
710
711         contentfiltering tests leak documents
712         https://bugs.webkit.org/show_bug.cgi?id=189434
713         <rdar://44239943>
714
715         Reviewed by Simon Fraser.
716
717         Changed ContentFilter to capture the blocked Frame as a WeakPtr to break a reference cycle.
718
719         This fixes world leaks in several tests in LayoutTests/contentfiltering/.
720
721         * bindings/js/ScriptController.h:
722         * loader/ContentFilter.cpp:
723         (WebCore::ContentFilter::didDecide):
724
725 2019-02-21  Don Olmstead  <don.olmstead@sony.com>
726
727         [CMake][Win] Fix !USE(CF) build of WebCore
728         https://bugs.webkit.org/show_bug.cgi?id=194879
729
730         Reviewed by Konstantin Tokarev.
731
732         * PlatformAppleWin.cmake:
733         * PlatformWin.cmake:
734         * PlatformWinCairo.cmake:
735
736 2019-02-21  Zalan Bujtas  <zalan@apple.com>
737
738         [LFC][Floats] Add support for placing formatting roots in-between floats.
739         https://bugs.webkit.org/show_bug.cgi?id=194902
740
741         Reviewed by Antti Koivisto.
742
743         This patch add support for placing a formatting root box in-between existing floats.
744         The initial vertical position of a formatting root is its static position which can make the box
745         placed above exsiting floats (whereas we can never place a regular float above existing floats.)
746
747         Test: fast/block/block-only/floats-and-block-formatting-roots.html
748
749         * layout/blockformatting/BlockFormattingContext.cpp:
750         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
751         * layout/floats/FloatingContext.cpp:
752         (WebCore::Layout::FloatPair::LeftRightIndex::isEmpty const):
753         (WebCore::Layout::FloatPair::isEmpty const):
754         (WebCore::Layout::FloatPair::operator* const):
755         (WebCore::Layout::Iterator::operator* const):
756         (WebCore::Layout::begin):
757         (WebCore::Layout::end):
758         (WebCore::Layout::FloatingContext::positionForFloat const):
759         (WebCore::Layout::FloatingContext::positionForFormattingContextRoot const):
760         (WebCore::Layout::findAvailablePosition):
761         (WebCore::Layout::FloatingContext::findPositionForFloatBox const):
762         (WebCore::Layout::FloatingContext::findPositionForFormattingContextRoot const):
763         (WebCore::Layout::FloatPair::FloatPair):
764         (WebCore::Layout::FloatPair::left const):
765         (WebCore::Layout::FloatPair::right const):
766         (WebCore::Layout::FloatPair::intersects const):
767         (WebCore::Layout::FloatPair::operator == const):
768         (WebCore::Layout::FloatPair::horizontalConstraints const):
769         (WebCore::Layout::FloatPair::bottom const):
770         (WebCore::Layout::Iterator::operator++):
771         (WebCore::Layout::Iterator::set):
772         (WebCore::Layout::FloatingPair::isEmpty const): Deleted.
773         (WebCore::Layout::FloatingPair::verticalConstraint const): Deleted.
774         (WebCore::Layout::FloatingContext::positionForFloatAvoiding const): Deleted.
775         (WebCore::Layout::FloatingContext::floatingPosition const): Deleted.
776         (WebCore::Layout::FloatingPair::FloatingPair): Deleted.
777         (WebCore::Layout::FloatingPair::left const): Deleted.
778         (WebCore::Layout::FloatingPair::right const): Deleted.
779         (WebCore::Layout::FloatingPair::intersects const): Deleted.
780         (WebCore::Layout::FloatingPair::operator == const): Deleted.
781         (WebCore::Layout::FloatingPair::horizontalConstraints const): Deleted.
782         (WebCore::Layout::FloatingPair::bottom const): Deleted.
783         * layout/floats/FloatingContext.h:
784
785 2019-02-21  Rob Buis  <rbuis@igalia.com>
786
787         Update MIME type parser
788         https://bugs.webkit.org/show_bug.cgi?id=180526
789
790         Reviewed by Darin Adler.
791
792         Further testing showed the MIME parser needs these fixes:
793         - stripWhitespace is wrong for removing HTTP whitespace, use
794           stripLeadingAndTrailingHTTPSpaces instead.
795         - HTTP Token code points checking for Rfc2045 and Mimesniff were
796           mixed up, use the dedicated isValidHTTPToken for Mimesniff mode.
797         - Quoted Strings were not unescaped/escaped, this seems ok for
798           serializing but is wrong when gettings individual parameter values.
799           Implement [1] and [2] Step 2.4 to properly unescape and escape.
800
801         This change also tries to avoid hard to read uses of find.
802
803         Test: ParsedContentType.Serialize
804
805         [1] https://fetch.spec.whatwg.org/#collect-an-http-quoted-string
806         [2] https://mimesniff.spec.whatwg.org/#serializing-a-mime-type
807
808         * platform/network/ParsedContentType.cpp:
809         (WebCore::skipSpaces):
810         (WebCore::parseToken):
811         (WebCore::isNotQuoteOrBackslash):
812         (WebCore::collectHTTPQuotedString):
813         (WebCore::containsNonTokenCharacters):
814         (WebCore::parseQuotedString):
815         (WebCore::ParsedContentType::parseContentType):
816         (WebCore::ParsedContentType::create):
817         (WebCore::ParsedContentType::setContentType):
818         (WebCore::containsNonQuoteStringTokenCharacters):
819         (WebCore::ParsedContentType::setContentTypeParameter):
820         (WebCore::ParsedContentType::serialize const):
821         (WebCore::substringForRange): Deleted.
822         (WebCore::isNonTokenCharacter): Deleted.
823         (WebCore::isNonQuotedStringTokenCharacter): Deleted.
824         * platform/network/ParsedContentType.h:
825
826 2019-02-20  Simon Fraser  <simon.fraser@apple.com>
827
828         REGRESSION (240698): Fixed position banners flicker and move when scrolling on iOS
829         https://bugs.webkit.org/show_bug.cgi?id=194889
830         rdar://problem/47755552
831
832         Reviewed by Tim Horton.
833         
834         After r240698 we could commit scrolling changes for a fixed node where the "viewportRectAtLastLayout" and the layer
835         position were mismatched; this happened when AsyncScrollingCoordinator::reconcileScrollingState() came back from the UI process
836         with an unstable update and set a new layoutViewport, then some other layout triggered a compositing tree update. During the tree
837         update, we'd update the fixed scrolling node with the new viewport, and an old layer position.
838         
839         Fix by ensuring that we only update the geometry info for a scrolling tree node when we update layer geometry for the corresponding
840         layer.
841
842         Not currently testable.
843
844         * rendering/RenderLayerCompositor.cpp:
845         (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
846
847 2019-02-20  Dean Jackson  <dino@apple.com>
848
849         Rotation animations sometimes use the wrong origin (affects apple.com)
850         https://bugs.webkit.org/show_bug.cgi?id=194878
851         <rdar://problem/43908047>
852
853         Reviewed by Simon Fraser.
854
855         Some versions of CoreAnimation apply additive animations in reverse
856         order. Detect this and reverse the list of animations we provide.
857
858         Update the existing animations/additive-transform-animations.html test to
859         be a ref-test that would identify this failure. Previously it relied on
860         a pixel test.
861
862         * platform/graphics/ca/GraphicsLayerCA.cpp: Use 
863             HAVE_CA_WHERE_ADDITIVE_TRANSFORMS_ARE_REVERSED to decide whether or
864             not to flip the list of animations (and mark the correct ones as
865             additive).
866         (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
867         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
868
869 2019-02-20  Don Olmstead  <don.olmstead@sony.com>
870
871         [Win] Guard CF usage in RenderThemeWin
872         https://bugs.webkit.org/show_bug.cgi?id=194875
873
874         Reviewed by Alex Christensen.
875
876         No new tests. No change in behavior.
877
878         Add #if USE(CF) checks to RenderThemeWin so it can compile without CF support.
879
880         * rendering/RenderThemeWin.cpp:
881         (WebCore::RenderThemeWin::stringWithContentsOfFile):
882         (WebCore::RenderThemeWin::mediaControlsStyleSheet):
883         (WebCore::RenderThemeWin::mediaControlsScript):
884         * rendering/RenderThemeWin.h:
885
886 2019-02-20  Ryosuke Niwa  <rniwa@webkit.org>
887
888         Crash in DOMWindowExtension::suspendForPageCache
889         https://bugs.webkit.org/show_bug.cgi?id=194871
890
891         Reviewed by Chris Dumez.
892
893         This is a speculative fix for a crash in DOMWindowExtension::suspendForPageCache.
894
895         We think it's possible for DOMWindowExtension::suspendForPageCache notifying the clients via
896         dispatchWillDisconnectDOMWindowExtensionFromGlobalObject to remove other DOMWindowExtension's.
897         Check that each DOMWindowProperty is still in m_properties before invoking suspendForPageCache
898         to avoid the crash.
899
900         * page/DOMWindow.cpp:
901         (WebCore::DOMWindow::willDestroyCachedFrame):
902         (WebCore::DOMWindow::willDestroyDocumentInFrame):
903         (WebCore::DOMWindow::willDetachDocumentFromFrame):
904         (WebCore::DOMWindow::suspendForPageCache):
905         (WebCore::DOMWindow::resumeFromPageCache):
906         * page/DOMWindowExtension.cpp:
907         (WebCore::DOMWindowExtension::suspendForPageCache):
908
909 2019-02-20  Alex Christensen  <achristensen@webkit.org>
910
911         Always call CompletionHandlers after r240909
912         https://bugs.webkit.org/show_bug.cgi?id=194823
913
914         Reviewed by Ryosuke Niwa.
915
916         * loader/PolicyChecker.cpp:
917         (WebCore::PolicyChecker::checkNavigationPolicy):
918         (WebCore::PolicyChecker::checkNewWindowPolicy):
919
920 2019-02-20  Andy Estes  <aestes@apple.com>
921
922         [Xcode] Add SDKVariant.xcconfig to various Xcode projects
923         https://bugs.webkit.org/show_bug.cgi?id=194869
924
925         Rubber-stamped by Jer Noble.
926
927         * WebCore.xcodeproj/project.pbxproj:
928
929 2019-02-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
930
931         drawImage() clears the canvas if it's the source of the image and globalCompositeOperation is "copy"
932         https://bugs.webkit.org/show_bug.cgi?id=194746
933
934         Reviewed by Dean Jackson.
935
936         Test: fast/canvas/canvas-drawImage-composite-copy.html
937
938         If the source canvas of drawImage() is the same as the destination and
939         globalCompositeOperation is set to "copy", copy the srcRect from the 
940         canvas to a temporary buffer before calling clearCanvas() then drawImage
941         from this temporary buffer.
942
943         * html/canvas/CanvasRenderingContext2DBase.cpp:
944         (WebCore::CanvasRenderingContext2DBase::drawImage):
945         * platform/graphics/ImageBuffer.cpp:
946         (WebCore::ImageBuffer::copyRectToBuffer):
947         * platform/graphics/ImageBuffer.h:
948
949 2019-02-20  Simon Fraser  <simon.fraser@apple.com>
950
951         REGRESSION (r241788>): ASSERTION FAILED: !m_normalFlowListDirty in TestWebKitAPI.WebKit.ResizeReversePaginatedWebView test
952         https://bugs.webkit.org/show_bug.cgi?id=194866
953
954         Reviewed by Antti Koivisto.
955
956         r241788 removed some calls that updated layer lists (normal flow and z-order) during compositing updates, causing
957         a later call to RenderLayerCompositor::recursiveRepaintLayer() to assert when the lists were dirty. Fix by updating
958         the lists in RenderLayerCompositor::recursiveRepaintLayer(), as we do in various other places.
959
960         * rendering/RenderLayerCompositor.cpp:
961         (WebCore::RenderLayerCompositor::recursiveRepaintLayer):
962
963 2019-02-20  Daniel Bates  <dabates@apple.com>
964
965         [iOS] Tweak UI for focus rings
966         https://bugs.webkit.org/show_bug.cgi?id=194864
967         <rdar://problem/47831886>
968
969         Reviewed by Brent Fulgham.
970
971         Make use of UIKit constants to make focus rings pretty.
972
973         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
974         (WebCore::drawFocusRingAtTime):
975
976 2019-02-20  Timothy Hatcher  <timothy@apple.com>
977
978         RenderThemeIOS should use RenderTheme's color cache instead of its own.
979         https://bugs.webkit.org/show_bug.cgi?id=194822
980         rdar://problem/48208296
981
982         Reviewed by Tim Horton.
983
984         Tested by fast/css/apple-system-colors.html.
985
986         * css/CSSValueKeywords.in:
987         * css/parser/CSSPropertyParser.cpp:
988         (WebCore::isAppleLegacyCssValueKeyword):
989         * platform/graphics/Color.h:
990         * platform/graphics/cg/ColorCG.cpp:
991         (WebCore::makeRGBAFromCGColor):
992         (WebCore::Color::Color):
993         * rendering/RenderThemeIOS.h:
994         * rendering/RenderThemeIOS.mm:
995         (WebCore::RenderThemeIOS::systemColor const):
996         * rendering/RenderThemeMac.mm:
997         (WebCore::RenderThemeMac::systemColor const):
998
999 2019-02-20  Loïc Yhuel  <loic.yhuel@softathome.com>
1000
1001         Fix crash when opening Web Inspector after a WebSocket was blocked by content extensions
1002         https://bugs.webkit.org/show_bug.cgi?id=194819
1003
1004         Reviewed by Joseph Pecoraro.
1005
1006         Test: http/tests/inspector/network/contentextensions/blocked-websocket-crash.html
1007
1008         * Modules/websockets/WebSocketChannel.h:
1009         (WebCore::WebSocketChannel::hasCreatedHandshake):
1010         * inspector/agents/page/PageNetworkAgent.cpp:
1011         Ignore WebSocketChannel without an WebSocketHandshake, which would crash in InspectorNetworkAgent::enable.
1012
1013 2019-02-20  Zalan Bujtas  <zalan@apple.com>
1014
1015         [LFC][Floats] Make FloatAvoider::resetPosition implicit
1016         https://bugs.webkit.org/show_bug.cgi?id=194855
1017
1018         Reviewed by Antti Koivisto.
1019
1020         Let's compute the initial top/left position during c'tor time.
1021         This is in preparation for fixing formatting root box placement in a float context.
1022
1023         * layout/floats/FloatAvoider.cpp:
1024         (WebCore::Layout::FloatAvoider::resetPosition): Deleted.
1025         * layout/floats/FloatAvoider.h:
1026         (WebCore::Layout::FloatAvoider::displayBox):
1027         (WebCore::Layout::FloatAvoider::initialVerticalPosition const): Deleted.
1028         * layout/floats/FloatBox.cpp:
1029         (WebCore::Layout::FloatBox::FloatBox):
1030         (WebCore::Layout::FloatBox::initialVerticalPosition const):
1031         * layout/floats/FloatBox.h:
1032         * layout/floats/FloatingContext.cpp:
1033         (WebCore::Layout::FloatingContext::floatingPosition const):
1034
1035 2019-02-20  Don Olmstead  <don.olmstead@sony.com>
1036
1037         [MSVC] Fix compilation errors with lambdas in Service Workers
1038         https://bugs.webkit.org/show_bug.cgi?id=194841
1039
1040         Reviewed by Alex Christensen.
1041
1042         No new tests. No change in behavior.
1043
1044         MSVC has problems with the scoping of `this` within a nested lambda. In these cases `this` is
1045         referring to the enclosing lambda according to MSVC. This patch works around this behavior
1046         through by using the `protectedThis` pattern in WebKit code.
1047
1048         * workers/service/server/RegistrationDatabase.cpp:
1049         (WebCore::RegistrationDatabase::openSQLiteDatabase):
1050
1051 2019-02-20  Adrian Perez de Castro  <aperez@igalia.com>
1052
1053         [WPE][GTK] Enable support for CONTENT_EXTENSIONS
1054         https://bugs.webkit.org/show_bug.cgi?id=167941
1055
1056         Reviewed by Carlos Garcia Campos.
1057
1058         * platform/gtk/po/POTFILES.in: Added WebKitUserContentFilterStore.cpp
1059         to the list of files with translatable strings.
1060
1061 2019-02-19  Simon Fraser  <simon.fraser@apple.com>
1062
1063         REGRESSION (r238090): Toggling visibility on the <html> element can result in a blank web view
1064         https://bugs.webkit.org/show_bug.cgi?id=194827
1065         rdar://problem/47620594
1066
1067         Reviewed by Antti Koivisto.
1068
1069         Incremental compositing updates, added in rr238090, use repaints as a trigger for re-evaluating
1070         layer configurations, since a repaint implies that a layer gains painted content. This is done
1071         via the call to setNeedsCompositingConfigurationUpdate() in RenderLayerBacking::setContentsNeedDisplay{InRect}.
1072         The RenderView's layer is opted out of this to avoid doing lots of redundant layer config recomputation
1073         for the root. The configuration state that matters here is whether the layer contains painted content,
1074         and therefore needs backing store; this is computed by RenderLayerBacking::isSimpleContainerCompositingLayer(),
1075         and feeds into GraphicsLayer::drawsContent().
1076
1077         However, if <html> starts as "visibility:hidden" or "opacity:0", as some sites do to hide incremental loading,
1078         then we'll fail to recompute 'drawsContent' for the root and leave the root with drawsContent=false, which
1079         causes RenderLayerBacking::setContentsNeedDisplay{InRect} to short-circuit, and then we paint nothing.
1080
1081         Ironically, 'drawsContent' doesn't actually save any backing store for the root, since it has no affect on
1082         the root tile caches; we always make tiles. So the simple fix here is to change RenderLayerBacking::isSimpleContainerCompositingLayer()
1083         to always return false for the RenderView's layer (the root).
1084         
1085         Testing this was tricky; ref testing doesn't work because we force repaint, and we normally skip
1086         properties of the root in layer tree dumps to hide WK1/WK2 differences. Therefore I had to add
1087         LAYER_TREE_INCLUDES_ROOT_LAYER_PROPERTIES and fix RenderLayerBacking::shouldDumpPropertyForLayer to
1088         respect it.
1089
1090         Test: compositing/visibility/root-visibility-toggle.html
1091
1092         * page/Frame.h:
1093         * platform/graphics/GraphicsLayer.cpp:
1094         (WebCore::GraphicsLayer::dumpProperties const):
1095         * platform/graphics/GraphicsLayerClient.h:
1096         (WebCore::GraphicsLayerClient::shouldDumpPropertyForLayer const):
1097         * rendering/RenderLayerBacking.cpp:
1098         (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer const):
1099         (WebCore::RenderLayerBacking::shouldDumpPropertyForLayer const):
1100         * rendering/RenderLayerBacking.h:
1101         * rendering/RenderLayerCompositor.cpp:
1102         (WebCore::RenderLayerCompositor::layerTreeAsText):
1103         * testing/Internals.cpp:
1104         (WebCore::toLayerTreeFlags):
1105         * testing/Internals.h:
1106         * testing/Internals.idl:
1107
1108 2019-02-19  Ryosuke Niwa  <rniwa@webkit.org>
1109
1110         REGRESSION(r240909): Release assertion in FrameLoader::loadPostRequest when opening new window
1111         https://bugs.webkit.org/show_bug.cgi?id=194820
1112
1113         Reviewed by Geoffrey Garen.
1114
1115         This release assertion was wrong. The invocation of PolicyChecker::checkNewWindowPolicy in FrameLoader
1116         doesn’t require PolicyChecker's load type to be set in PolicyChecker because FrameLoader's
1117         continueLoadAfterNewWindowPolicy invokes loadWithNavigationAction which sets the load type later,
1118         and we don't rely on PolicyChecker's load type until then.
1119
1120         Fixed the crash by removing relese asserts before invoking checkNewWindowPolicy accordingly.
1121
1122         This patch reverts r241015 since it too was asserting that PolicyChecker's load type is set before
1123         invoking checkNewWindowPolicy which is not the right assumption.
1124
1125         Test: fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation.html
1126
1127         * loader/FrameLoader.cpp:
1128         (WebCore::FrameLoader::loadURL):
1129         (WebCore::FrameLoader::load):
1130         (WebCore::FrameLoader::loadPostRequest):
1131
1132 2019-02-19  Zalan Bujtas  <zalan@apple.com>
1133
1134         Fix post-commit feedback.
1135
1136         Unreviewed. 
1137
1138         * layout/floats/FloatingContext.cpp:
1139         (WebCore::Layout::FloatingPair::intersects const):
1140
1141 2019-02-19  Zalan Bujtas  <zalan@apple.com>
1142
1143         [LFC][Floats] Remove redundant intersecting logic
1144         https://bugs.webkit.org/show_bug.cgi?id=194804
1145
1146         Reviewed by Antti Koivisto.
1147
1148         floatAvoider.overflowsContainingBlock() check already (and properly) takes care of the far left/right case (see comment).
1149
1150         * layout/floats/FloatingContext.cpp:
1151         (WebCore::Layout::FloatingContext::floatingPosition const):
1152         (WebCore::Layout::FloatingPair::intersects const):
1153
1154 2019-02-19  Commit Queue  <commit-queue@webkit.org>
1155
1156         Unreviewed, rolling out r241722.
1157         https://bugs.webkit.org/show_bug.cgi?id=194801
1158
1159         Causing time outs and EWS failures after expectation file was
1160         added. (Requested by ShawnRoberts on #webkit).
1161
1162         Reverted changeset:
1163
1164         "IndexedDB: leak IDBDatabase and IDBTransacstion in layout
1165         tests"
1166         https://bugs.webkit.org/show_bug.cgi?id=194709
1167         https://trac.webkit.org/changeset/241722
1168
1169 2019-02-16  Darin Adler  <darin@apple.com>
1170
1171         Continue reducing use of String::format, now focusing on hex: "%p", "%x", etc.
1172         https://bugs.webkit.org/show_bug.cgi?id=194752
1173
1174         Reviewed by Daniel Bates.
1175
1176         * Modules/websockets/WebSocket.cpp: Added an include of HexNumber.h. This previously
1177         got included because of Logger.h, but that no longer pulls in HexNumber.h.
1178
1179         * css/CSSMarkup.cpp: Removed unneeded include of StringBuffer.h.
1180         * css/CSSPrimitiveValue.cpp: Ditto.
1181
1182         * css/CSSUnicodeRangeValue.cpp:
1183         (WebCore::CSSUnicodeRangeValue::customCSSText const): Use makeString and hex instead
1184         of String::format and "%x".
1185
1186         * html/HTMLMediaElement.h:
1187         (WTF::ValueToString<WebCore::TextTrackCue::string): Use a non-template function,
1188         TextTrackCure::debugString, so we don't need to use HextNumber.h in a header.
1189
1190         * html/canvas/WebGLRenderingContextBase.cpp:
1191         (GetErrorString): Use makeString and hex instead of String::format and "%04x".
1192
1193         * html/track/TextTrackCue.cpp:
1194         (WebCore::TextTrackCue::debugString const): Added. Moved string conversion here
1195         from HTMLMediaElement.h and use makeString instead of String::format. Also use
1196         the word "debug" to make it clear that it's not OK to use this string, with a
1197         pointer value serialized into it, outside of debugging.
1198         * html/track/TextTrackCue.h: Added TextTrackCue::debugString.
1199
1200         * page/linux/ResourceUsageOverlayLinux.cpp:
1201         (WebCore::formatByteNumber): Use makeString and FormattedNumber::fixedWidth
1202         instead of String::format and "%.1f" etc.
1203
1204         * platform/cocoa/KeyEventCocoa.mm:
1205         (WebCore::keyIdentifierForCharCode): Use the new hex function here instead of
1206         the old code that did each of the four characters explicitly.
1207
1208         * platform/gamepad/mac/HIDGamepad.cpp:
1209         (WebCore::HIDGamepad::HIDGamepad): Use makeString instead of String::format.
1210
1211         * platform/graphics/Color.cpp:
1212         (WebCore::Color::nameForRenderTreeAsText const): Use hex instead of doing each
1213         digit separately.
1214
1215         * platform/graphics/FloatPolygon.cpp:
1216         (WebCore::FloatPolygonEdge::debugString const): Added. Moved string conversion here
1217         from the header and use makeString instead of String::format. Also use
1218         the word "debug" to make it clear that it's not OK to use this string, with a
1219         pointer value serialized into it, outside of debugging.
1220         * platform/graphics/FloatPolygon.h: Updated for the above.
1221
1222         * platform/graphics/ca/GraphicsLayerCA.cpp:
1223         (WebCore::GraphicsLayerCA::setName): Use makeString instead of String::format.
1224         (WebCore::GraphicsLayerCA::recursiveCommitChanges): DItto.
1225         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1226         (WebCore::MediaPlayerPrivateGStreamer::load): Ditto.
1227         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Ditto.
1228         * platform/gtk/PlatformKeyboardEventGtk.cpp:
1229         (WebCore::PlatformKeyboardEvent::keyIdentifierForGdkKeyCode): Ditto.
1230         * platform/libwpe/PlatformKeyboardEventLibWPE.cpp:
1231         (WebCore::PlatformKeyboardEvent::keyIdentifierForWPEKeyCode): Ditto.
1232         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
1233         (WebCore::GStreamerVideoEncoder::makeElement): Ditto.
1234         (WebCore::GStreamerVideoEncoder::InitEncode): Ditto.
1235
1236         * platform/text/TextCodecLatin1.cpp: Removed unneeded include of StringBuffer.h
1237         and "using namespace WTF".
1238
1239         * platform/win/GDIObjectCounter.cpp:
1240         (WebCore::GDIObjectCounter::GDIObjectCounter): Use makeString instead of String::format.
1241         * platform/win/KeyEventWin.cpp:
1242         (WebCore::keyIdentifierForWindowsKeyCode): Ditto.
1243
1244         * rendering/FloatingObjects.cpp:
1245         (WebCore::FloatingObject::debugString const): Added. Moved string conversion here
1246         from the header and use makeString instead of String::format. Also use
1247         the word "debug" to make it clear that it's not OK to use this string, with a
1248         pointer value serialized into it, outside of debugging.
1249         * rendering/FloatingObjects.h: Updated for the above.
1250
1251         * rendering/RenderFragmentContainer.cpp:
1252         (WebCore::RenderFragmentContainer::debugString const): Added. Moved string
1253         conversion here from the header and use makeString instead of String::format.
1254         Also use the word "debug" to make it clear that it's not OK to use this string,
1255         with a pointer value serialized into it, outside of debugging.
1256         * rendering/RenderFragmentContainer.h: Updated for the above.
1257         * rendering/RenderFragmentedFlow.h: Ditto.
1258
1259         * testing/Internals.cpp:
1260         (WebCore::Internals::address): Use makeString instead of String::format.
1261
1262 2019-02-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1263
1264         [iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements
1265         https://bugs.webkit.org/show_bug.cgi?id=194670
1266         <rdar://problem/39066529>
1267
1268         Reviewed by Tim Horton.
1269
1270         Adds support for pasting files on the pasteboard as attachment elements, if the attachment element runtime
1271         switch is enabled. Currently, the only types of data that can be pasted as attachments are images, which take a
1272         special codepath in WebContentReader::readImage.
1273
1274         This patch adds a readDataBuffer method that converts a given blob of data from the pasteboard into an
1275         attachment-element-backed representation in the DOM (i.e. either an attachment element or image element that
1276         contains an attachment element). In the case where the given pasteboard item has been explicitly marked as an
1277         attachment (via the preferredPresentationStyle hint) and the item has at least one type representation that
1278         conforms to "public.content", we take this codepath instead of first attempting the web content reading types
1279         supported by default in WebKit.
1280
1281         See below for more detail.
1282
1283         Test: WKAttachmentTestsIOS.InsertPastedFilesAsAttachments
1284
1285         * editing/Editor.cpp:
1286         (WebCore::Editor::clientReplacementURLForResource): Deleted.
1287         * editing/Editor.h:
1288         * editing/WebContentReader.h:
1289         * editing/cocoa/WebContentReaderCocoa.mm:
1290         (WebCore::mimeTypeFromContentType):
1291         (WebCore::contentTypeIsSuitableForInlineImageRepresentation):
1292         (WebCore::createFragmentAndAddResources):
1293         (WebCore::sanitizeMarkupWithArchive):
1294
1295         Remove all logic for handling subresource URL replacement. See WebKit ChangeLog for more details on this.
1296
1297         (WebCore::WebContentReader::readImage):
1298         (WebCore::attachmentForFilePath):
1299         (WebCore::attachmentForData):
1300
1301         Add a helper that creates an attachment element for a given blob of data and content type. The logic here is
1302         quite similar to that of attachmentForFilePath, and we should find a way to either merge them, or pull out more
1303         of their similarities into helper functions.
1304
1305         (WebCore::WebContentReader::readDataBuffer):
1306         (WebCore::replaceSubresourceURLsWithURLsFromClient): Deleted.
1307
1308         Remove more logic for handling subresource URL replacement. See WebKit ChangeLog for more details on this.
1309
1310         * loader/EmptyClients.cpp:
1311         * page/EditorClient.h:
1312         * platform/Pasteboard.h:
1313         * platform/PasteboardItemInfo.h:
1314         (WebCore::PasteboardItemInfo::contentTypeForHighestFidelityItem const):
1315         (WebCore::PasteboardItemInfo::pathForHighestFidelityItem const):
1316         (WebCore::PasteboardItemInfo::encode const):
1317         (WebCore::PasteboardItemInfo::decode):
1318
1319         Add contentTypesByFidelity to PasteboardItemInfo, instead of requesting this information using a separate IPC
1320         message. This means we can also remove getTypesByFidelityForItemAtIndex, and just use the item's types in
1321         fidelity order instead.
1322
1323         * platform/PasteboardStrategy.h:
1324         * platform/PlatformPasteboard.h:
1325         * platform/ios/AbstractPasteboard.h:
1326         * platform/ios/PasteboardIOS.mm:
1327         (WebCore::Pasteboard::read):
1328
1329         Shave off (potentially many) sync IPC messages to the UI process by pulling each call to
1330         informationForItemAtIndex out of the inner loop when reading web content.
1331
1332         (WebCore::Pasteboard::readRespectingUTIFidelities):
1333
1334         Shave off one extraneous sync IPC message by rolling the types in fidelity order into the request for
1335         PasteboardItemInfo, instead of being sent in a separate message.
1336
1337         * platform/ios/PlatformPasteboardIOS.mm:
1338         (WebCore::PlatformPasteboard::informationForItemAtIndex):
1339
1340         Populate contentTypesForFileUpload in the case where UIPasteboard is used (i.e. copy and paste).
1341
1342         (WebCore::PlatformPasteboard::getTypesByFidelityForItemAtIndex): Deleted.
1343         * platform/ios/WebItemProviderPasteboard.h:
1344         * platform/ios/WebItemProviderPasteboard.mm:
1345         (-[WebItemProviderPasteboard pasteboardTypesByFidelityForItemAtIndex:]): Deleted.
1346
1347 2019-02-18  Daniel Bates  <dabates@apple.com>
1348
1349         Clean up and modernize RenderThemeIOS::paintCheckboxDecorations()
1350         https://bugs.webkit.org/show_bug.cgi?id=194785
1351
1352         Reviewed by Simon Fraser.
1353
1354         Change from early return to else-clause to make the states clearer and make it more straightforward
1355         to share more common code. Use constexpr, allocate temporary vectors with inline capacity, and
1356         switch to uniform initializer syntax.
1357
1358         * rendering/RenderThemeIOS.mm:
1359         (WebCore::RenderThemeIOS::paintCheckboxDecorations):
1360
1361 2019-02-18  Daniel Bates  <dabates@apple.com>
1362
1363         [iOS] Focus ring for checkboxes, radio buttons, buttons and search fields should hug tighter to the contour
1364         https://bugs.webkit.org/show_bug.cgi?id=193599
1365         <rdar://problem/47399602>
1366
1367         Reviewed by Simon Fraser.
1368
1369         For now, iOS uses a 3px outline width for its focus rings. Do not inset the focus ring on iOS
1370         for text fields, textareas, keygens, and selects so as to match the visual appearance of all
1371         the other controls.
1372
1373         Tests: fast/forms/ios/focus-button.html
1374                fast/forms/ios/focus-checkbox.html
1375                fast/forms/ios/focus-checked-checkbox.html
1376                fast/forms/ios/focus-checked-radio.html
1377                fast/forms/ios/focus-radio.html
1378                fast/forms/ios/focus-reset-button.html
1379                fast/forms/ios/focus-search-field.html
1380                fast/forms/ios/focus-submit-button.html
1381                fast/forms/ios/focus-text-field.html
1382                fast/forms/ios/focus-textarea.html
1383
1384         * css/html.css:
1385         (:focus): Use 3px outline width.
1386         (input:focus, textarea:focus, keygen:focus, select:focus): Guard this code to exclude it when building for iOS.
1387         * rendering/RenderBox.cpp:
1388         (WebCore::RenderBox::paintBoxDecorations): Add FIXME comment.
1389         * rendering/RenderElement.cpp:
1390         (WebCore::RenderElement::paintOutline): Call RenderTheme::adjustPaintRect() to adjust the paint rect.
1391         Otherwise, the focus rings for radios and checkboxes are drawn at the wrong y-coordinate and are not snug.
1392
1393 2019-02-18  Oriol Brufau  <obrufau@igalia.com>
1394
1395         [css-grid] Handle indefinite percentages in fit-content()
1396         https://bugs.webkit.org/show_bug.cgi?id=194509
1397
1398         Reviewed by Javier Fernandez.
1399
1400         Test: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-fit-content-percentage.html
1401
1402         If the size of the grid container depends on the size of its tracks,
1403         a percentage in fit-content() is indefinite. Without this patch, some
1404         places treated this case as fit-content(0), which prevented the grid
1405         container from growing enough to contain the max-content contribution
1406         of its grid items.
1407
1408         This patch treats such fit-content() as minmax(auto, max-content),
1409         but once the size of the grid container is known and it is laid out
1410         "for real", then the percentage is definite and it's used.
1411
1412         * rendering/GridTrackSizingAlgorithm.cpp:
1413         (WebCore::GridTrackSizingAlgorithm::gridTrackSize const):
1414         (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes):
1415
1416 2019-02-18  John Wilander  <wilander@apple.com>
1417
1418         Check the existence of the frame in Document::hasFrameSpecificStorageAccess() and Document::setHasFrameSpecificStorageAccess()
1419         https://bugs.webkit.org/show_bug.cgi?id=194777
1420         <rdar://problem/47731945>
1421
1422         Reviewed by Geoffrey Garen and Chris Dumez.
1423
1424         Test: http/tests/storageAccess/remove-requesting-iframe.html
1425
1426         * dom/Document.cpp:
1427         (WebCore::Document::hasFrameSpecificStorageAccess const):
1428             Now checks for the existence of the frame.
1429         (WebCore::Document::setHasFrameSpecificStorageAccess):
1430             Now checks for the existence of the frame.
1431         * loader/ResourceLoadObserver.cpp:
1432         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1433             Now checks that the session ID is valid.
1434
1435 2019-02-18  Jer Noble  <jer.noble@apple.com>
1436
1437         -[AVSampleBufferDisplayLayer player]: Unrecognized selector crash
1438         https://bugs.webkit.org/show_bug.cgi?id=194790
1439         <rdar://problem/33866742>
1440
1441         Reviewed by Jon Lee.
1442
1443         Ensure that a WebVideoContainerLayer's sole sublayer is actually an AVPlayerLayer (and not
1444         an AVSampleBufferDisplayLayer) before reporting that the layer type is LayerTypeAVPlayerLayer.
1445
1446         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
1447         (WebCore::PlatformCALayerCocoa::layerTypeForPlatformLayer):
1448
1449 2019-02-18  Joseph Pecoraro  <pecoraro@apple.com>
1450
1451         Web Inspector: Better categorize CPU usage per-thread / worker
1452         https://bugs.webkit.org/show_bug.cgi?id=194564
1453
1454         Reviewed by Devin Rousso.
1455
1456         Test: inspector/cpu-profiler/threads.html
1457
1458         * workers/WorkerThread.cpp:
1459         (WebCore::WorkerThread::workerThreadsMutex):
1460         (WebCore::WorkerThread::workerThreadCount):
1461         (WebCore::WorkerThread::WorkerThread):
1462         (WebCore::WorkerThread::~WorkerThread):
1463         (WebCore::WorkerThread::workerThread):
1464         (WebCore::WorkerThread::releaseFastMallocFreeMemoryInAllThreads):
1465         * workers/WorkerThread.h:
1466         (WebCore::WorkerThread::identifier const):
1467         Expose the set of all WorkerThreads.
1468
1469         * inspector/agents/InspectorCPUProfilerAgent.cpp:
1470         (WebCore::InspectorCPUProfilerAgent::collectSample):
1471         Send inspector additional per-thread data.
1472
1473         * page/ResourceUsageData.h:
1474         (WebCore::WorkerCPUInfo::WorkerCPUInfo):
1475         * page/cocoa/ResourceUsageThreadCocoa.mm:
1476         (WebCore::ThreadInfo::ThreadInfo):
1477         (WebCore::threadInfos):
1478         (WebCore::ResourceUsageThread::platformCollectCPUData):
1479         (WebCore::threadSendRights): Deleted.
1480         (WebCore::cpuUsage): Deleted.
1481         Compute per-thread values on cocoa ports.
1482
1483         * page/linux/ResourceUsageThreadLinux.cpp:
1484         (WebCore::ResourceUsageThread::platformCollectCPUData):
1485         Stub per-thread values on linux ports.
1486
1487 2019-02-18  Jer Noble  <jer.noble@apple.com>
1488
1489         Uncaught Exception crash in MediaPlayerPrivateAVFoundationObjC::setShouldObserveTimeControlStatus()
1490         https://bugs.webkit.org/show_bug.cgi?id=194786
1491
1492         Reviewed by Eric Carlson.
1493
1494         Convert a runtime crash to a debug assert by wrapping the call to -[AVPlayer removeObserver:forKeyPath:]
1495         in an exception handler.
1496
1497         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1498         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldObserveTimeControlStatus):
1499
1500 2019-02-18  Daniel Bates  <dabates@apple.com>
1501
1502         [iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content-editable element
1503         https://bugs.webkit.org/show_bug.cgi?id=192824
1504         <rdar://problem/47100332>
1505
1506         Reviewed by Wenson Hsieh.
1507
1508         When building with USE(UIKIT_KEYBOARD_ADDITIONS) enabled, normalize input strings for some more key codes
1509         now that hardware key events to non-editable elements use the same code path as for editable elements. 
1510
1511         * platform/ios/KeyEventIOS.mm:
1512         (WebCore::windowsKeyCodeForCharCode): Demarcate mappings that are only needed when building with
1513         !USE(UIKIT_KEYBOARD_ADDITIONS) in the hope that one day we can remove this code.
1514         (WebCore::isFunctionKey): Ditto.
1515         * platform/ios/WebEvent.mm:
1516         (normalizedStringWithAppKitCompatibilityMapping): Normalize some more input strings when building with
1517         USE(UIKIT_KEYBOARD_ADDITIONS) enabled.
1518
1519 2019-02-18  Eric Carlson  <eric.carlson@apple.com>
1520
1521         Add MSE logging configuration
1522         https://bugs.webkit.org/show_bug.cgi?id=194719
1523         <rdar://problem/48122151>
1524
1525         Reviewed by Joseph Pecoraro.
1526
1527         No new tests, updated inspector/console/webcore-logging.html.
1528
1529         * dom/Document.cpp:
1530         (WebCore::messageSourceForWTFLogChannel): Recognize the MSE logging channel.
1531
1532         * inspector/agents/WebConsoleAgent.cpp:
1533         (WebCore::WebConsoleAgent::getLoggingChannels): Ditto.
1534
1535 2019-02-18  Antoine Quint  <graouts@apple.com>
1536
1537         [iOS] Dispatch additional events along with pointerdown and pointerup
1538         https://bugs.webkit.org/show_bug.cgi?id=194776
1539         <rdar://problem/48164284>
1540
1541         Reviewed by Brent Fulgham.
1542
1543         The Pointer Events specification mandates that "pointerover" and "pointerenter" events precede a "pointerdown" event and that "pointerout"
1544         and "pointerleave" events follow a "pointerup" event. We remove the EventHandler::dispatchPointerEventForTouchAtIndex() method and replace
1545         it with a PointerCaptureController::dispatchEventForTouchAtIndex() that can handle the dispatch of such additional events correctly, also
1546         allowing for two PointerCaptureController methods (pointerEventWillBeDispatched and pointerEventWasDispatched) to become private.
1547
1548         Test: pointerevents/ios/over-enter-out-leave.html
1549
1550         * dom/EventNames.h: Add the new "pointerover", "pointerenter", "pointerout" and "pointerleave" event types.
1551         * dom/PointerEvent.h:
1552         * dom/ios/PointerEventIOS.cpp:
1553         (WebCore::PointerEvent::create):
1554         * page/EventHandler.cpp:
1555         (WebCore::EventHandler::dispatchPointerEventForTouchAtIndex): Deleted.
1556         * page/EventHandler.h:
1557         * page/PointerCaptureController.cpp:
1558         (WebCore::PointerCaptureController::dispatchEventForTouchAtIndex): Take the existing code from EventHandler::dispatchPointerEventForTouchAtIndex()
1559         and extend it to dispatch additional events as mandated. Since several events may be dispatched we check whether the dispatch of any of those events
1560         had defaultPrevented() or defaultHanded() return true and return those values as a pair.
1561         (WebCore::PointerCaptureController::pointerEventWasDispatched):
1562         * page/PointerCaptureController.h:
1563
1564 2019-02-18  Sihui Liu  <sihui_liu@apple.com>
1565
1566         IndexedDB: leak IDBDatabase and IDBTransacstion in layout tests
1567         https://bugs.webkit.org/show_bug.cgi?id=194709
1568
1569         Reviewed by Geoffrey Garen.
1570
1571         When connection to IDB server is closed, IDBTransaction would abort without notifying IDBDatabase, so 
1572         IDBDatabase didn't clear its reference to IDBTransaction which created a reference cycle. 
1573
1574         Also IDBTransaction didn't clear its reference to IDBRequest in this case and it led to another reference cycle
1575         between IDBOpenDBRequest and IDBTransaction.
1576
1577         Test: storage/indexeddb/IDBObject-leak.html
1578
1579         * Modules/indexeddb/IDBDatabase.cpp:
1580         (WebCore::IDBDatabase::connectionToServerLost):
1581         * Modules/indexeddb/IDBTransaction.cpp:
1582         (WebCore::IDBTransaction::IDBTransaction):
1583         (WebCore::IDBTransaction::~IDBTransaction):
1584         (WebCore::IDBTransaction::finishedDispatchEventForRequest):
1585         (WebCore::IDBTransaction::connectionClosedFromServer):
1586         * Modules/indexeddb/IDBTransaction.h:
1587         * testing/Internals.cpp:
1588         (WebCore::Internals::numberOfIDBTransactions const):
1589         * testing/Internals.h:
1590         * testing/Internals.idl:
1591
1592 2019-02-18  Chris Fleizach  <cfleizach@apple.com>
1593
1594         AX: PSON: Going back from apple.com to search results, cannot interact with HTML content. Disabling Swap Processes on Cross-Site Navigation resolves the issue.
1595         https://bugs.webkit.org/show_bug.cgi?id=194742
1596
1597         Reviewed by Chris Dumez.
1598
1599         With the new process model, WebProcess hits a case where it tries to send the "page loaded" notification before VoiceOver
1600         had a chance to register for any notifications. This leads to those notifications being dropped (and thus this bug).
1601
1602         This change instead asks the UIProcess to send the notification, which we know VoiceOver has registered for, and can reliably
1603         receive notifications.
1604
1605         It also sends the notification for "load failures," which to the VO users' perspective amounts to the same thing as a successful
1606         page load.
1607
1608         * accessibility/mac/AXObjectCacheMac.mm:
1609         (WebCore::AXObjectCache::frameLoadingEventPlatformNotification):
1610
1611 2019-02-18  Megan Gardner  <megan_gardner@apple.com>
1612
1613         Turn On Smart Delete
1614         https://bugs.webkit.org/show_bug.cgi?id=194320
1615
1616         Reviewed by Ryosuke Niwa.
1617
1618         Updated the following tests to work with iOS:
1619         * editing/deleting/smart-delete-001.html:
1620         * editing/deleting/smart-delete-002.html:
1621         * editing/deleting/smart-delete-003.html:
1622         * editing/deleting/smart-delete-004.html:
1623         * editing/deleting/smart-delete-across-editable-boundaries-2.html:
1624         * editing/selection/delete-word-granularity-text-control.html:
1625
1626         Turn on Smart delete for iOS at all times. Modify checks to allow Mac and iOS and other 
1627         platforms to turn on smart delete when desired.
1628
1629         * editing/Editor.cpp:
1630         (WebCore::Editor::shouldSmartDelete):
1631         Allow platfroms to determine if smart delete should be on.
1632         On mac, this is via word granularity, on iOS this is just on all the time.
1633         (WebCore::Editor::canSmartCopyOrDelete):
1634         (WebCore::Editor::performCutOrCopy):
1635         * editing/Editor.h:
1636         * editing/EditorCommand.cpp:
1637         (WebCore::executeDelete):
1638         * editing/ios/EditorIOS.mm:
1639         (WebCore::Editor::shouldSmartDelete):
1640         * editing/mac/EditorMac.mm:
1641         (WebCore::Editor::shouldSmartDelete):
1642
1643 2019-02-17  David Kilzer  <ddkilzer@apple.com>
1644
1645         Unreviewed, rolling out r241620.
1646
1647         "Causes use-after-free crashes running layout tests with ASan and GuardMalloc."
1648         (Requested by ddkilzer on #webkit.)
1649
1650         Reverted changeset:
1651
1652         "[WTF] Add environment variable helpers"
1653         https://bugs.webkit.org/show_bug.cgi?id=192405
1654         https://trac.webkit.org/changeset/241620
1655
1656 2019-02-16  Zalan Bujtas  <zalan@apple.com>
1657
1658         [LFC] RenderImage's default intrinsic size is 0.
1659         https://bugs.webkit.org/show_bug.cgi?id=194745
1660
1661         Reviewed by Antti Koivisto.
1662
1663         While the images are being loaded, their intrinsic size is set to 0 (RenderImage c'tor). Note that this code is temporary.
1664         * layout/layouttree/LayoutTreeBuilder.cpp:
1665         (WebCore::Layout::TreeBuilder::createSubTree):
1666
1667 2019-02-16  Zalan Bujtas  <zalan@apple.com>
1668
1669         [LFC][BFC] Add support for block replaced intrinsic width.
1670         https://bugs.webkit.org/show_bug.cgi?id=194705
1671
1672         Reviewed by Simon Fraser.
1673
1674         Replaced boxes should report their intrinsic width as preferred widths.
1675
1676         Test: fast/block/block-only/replaced-intrinsic-width-simple.html
1677
1678         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1679         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
1680
1681 2019-02-16  Zalan Bujtas  <zalan@apple.com>
1682
1683         [LFC] Apply min/max width constraints to preferred width computation
1684         https://bugs.webkit.org/show_bug.cgi?id=194739
1685
1686         Reviewed by Simon Fraser.
1687
1688         Ensure that both min-height and max-height are taken into account while computing the preferred width.
1689
1690         Test: fast/block/block-only/min-max-and-preferred-width-simple.html
1691
1692         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1693         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
1694
1695 2019-02-15  Yusuke Suzuki  <ysuzuki@apple.com>
1696
1697         [JSC] Make builtin objects more lazily initialized under non-JIT mode
1698         https://bugs.webkit.org/show_bug.cgi?id=194727
1699
1700         Reviewed by Saam Barati.
1701
1702         * Modules/streams/ReadableByteStreamInternals.js:
1703         (privateInitializeReadableByteStreamController):
1704         (readableByteStreamControllerRespond):
1705
1706 2019-02-15  Dean Jackson  <dino@apple.com>
1707
1708         Allow emulation of user gestures from Web Inspector console
1709         https://bugs.webkit.org/show_bug.cgi?id=194725
1710         <rdar://problem/48126604>
1711
1712         Reviewed by Joseph Pecoraro and Devin Rousso.
1713
1714         Test: inspector/runtime/evaluate-userGestureEmulation.html
1715
1716         * inspector/agents/page/PageRuntimeAgent.cpp: Override the emulate method and create
1717         a UserGestureIndicator based on the emulateUserGesture option.
1718         (WebCore::PageRuntimeAgent::evaluate):
1719         * inspector/agents/page/PageRuntimeAgent.h:
1720
1721 2019-02-15  Chris Dumez  <cdumez@apple.com>
1722
1723         Sample domainsVisited diagnostic logging
1724         https://bugs.webkit.org/show_bug.cgi?id=194657
1725
1726         Reviewed by Ryosuke Niwa.
1727
1728         Sample domainsVisited diagnostic logging, we are getting a lot of data from
1729         this key and this is hurting our other keys.
1730
1731         * page/Page.cpp:
1732         (WebCore::Page::logNavigation):
1733
1734 2019-02-15  Ryosuke Niwa  <rniwa@webkit.org>
1735
1736         Crash in the hit testing code via HTMLPlugInElement::isReplacementObscured()
1737         https://bugs.webkit.org/show_bug.cgi?id=194691
1738
1739         Reviewed by Simon Fraser.
1740
1741         The crash was caused by HTMLPlugInElement::isReplacementObscured updating the document
1742         without updating the layout of ancestor documents (i.e. documents in which frame owner
1743         elements appear) even though it hit-tests against the top-level document's RenderView.
1744
1745         Fixed the bug by updating the layout of the top-level document as needed.
1746
1747         Test: plugins/unsupported-plugin-with-replacement-in-iframe-crash.html
1748
1749         * html/HTMLPlugInElement.cpp:
1750         (WebCore::HTMLPlugInElement::isReplacementObscured):
1751
1752 2019-02-15  Ross Kirsling  <ross.kirsling@sony.com>
1753
1754         [WTF] Add environment variable helpers
1755         https://bugs.webkit.org/show_bug.cgi?id=192405
1756
1757         Reviewed by Michael Catanzaro.
1758
1759         * platform/NotImplemented.h:
1760         * platform/cocoa/SystemVersion.mm:
1761         (WebCore::createSystemMarketingVersion):
1762         * platform/graphics/gstreamer/GStreamerCommon.cpp:
1763         (WebCore::initializeGStreamer):
1764         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1765         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
1766         * platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
1767         (Nicosia::PaintingEngine::create):
1768         * platform/graphics/texmap/TextureMapperFPSCounter.cpp:
1769         (WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
1770         * platform/graphics/x11/PlatformDisplayX11.cpp:
1771         (WebCore::PlatformDisplayX11::create):
1772         * platform/gtk/RenderThemeWidget.cpp:
1773         (WebCore::RenderThemeScrollbar::RenderThemeScrollbar):
1774         * platform/gtk/ScrollbarThemeGtk.cpp:
1775         (WebCore::ScrollbarThemeGtk::ScrollbarThemeGtk):
1776         * platform/network/curl/CurlContext.cpp:
1777         (WebCore::CurlContext::CurlContext):
1778         (WebCore::EnvironmentVariableReader::read): Deleted.
1779         (WebCore::EnvironmentVariableReader::defined): Deleted.
1780         (WebCore::EnvironmentVariableReader::readAs): Deleted.
1781         (WebCore::EnvironmentVariableReader::sscanTemplate): Deleted.
1782         (WebCore::EnvironmentVariableReader::sscanTemplate<signed>): Deleted.
1783         (WebCore::EnvironmentVariableReader::sscanTemplate<unsigned>): Deleted.
1784         * platform/network/curl/NetworkStorageSessionCurl.cpp:
1785         (WebCore::defaultCookieJarPath):
1786         * platform/network/playstation/CurlSSLHandlePlayStation.cpp:
1787         (WebCore::getCACertPathEnv):
1788         * platform/network/win/CurlSSLHandleWin.cpp:
1789         (WebCore::getCACertPathEnv):
1790         * platform/text/hyphen/HyphenationLibHyphen.cpp:
1791         (WebCore::topLevelPath):
1792         (WebCore::webkitBuildDirectory):
1793         * platform/unix/LoggingUnix.cpp:
1794         (WebCore::logLevelString):
1795         * platform/win/LoggingWin.cpp:
1796         (WebCore::logLevelString):
1797         Utilize WTF::Environment where possible.
1798
1799 2019-02-15  Antoine Quint  <graouts@apple.com>
1800
1801         Add a method to dispatch a PointerEvent based on a PlatformTouchEvent
1802         https://bugs.webkit.org/show_bug.cgi?id=194702
1803         <rdar://problem/48109355>
1804
1805         Reviewed by Dean Jackson.
1806
1807         * page/EventHandler.cpp:
1808         (WebCore::EventHandler::dispatchPointerEventForTouchAtIndex):
1809         * page/EventHandler.h:
1810
1811 2019-02-15  Per Arne Vollan  <pvollan@apple.com>
1812
1813         [WebVTT] Inline WebVTT styles should start with '::cue'
1814         https://bugs.webkit.org/show_bug.cgi?id=194227
1815
1816         Reviewed by Eric Carlson.
1817
1818         The original fix in r241203 is not sufficient, since it only checks if the CSS string starts
1819         with '::cue'. Before accepting a CSS string from a WebVTT file, it should be checked that
1820         all selectors starts with '::cue'.
1821
1822         Test: media/track/track-cue-css.html
1823
1824         * html/track/WebVTTParser.cpp:
1825         (WebCore::WebVTTParser::checkAndStoreStyleSheet):
1826
1827 2019-02-15  Youenn Fablet  <youenn@apple.com>
1828
1829         Add binding tests for ContextAllowsMediaDevices and ContextHasServiceWorkerScheme
1830         https://bugs.webkit.org/show_bug.cgi?id=194713
1831
1832         Reviewed by Eric Carlson.
1833
1834         Binding tests covering mediaDevices and serviceWorker attributes.
1835
1836         * bindings/scripts/test/JS/JSTestObj.cpp:
1837         (WebCore::JSTestObjPrototype::finishCreation):
1838         (WebCore::jsTestObjMediaDevices1Getter):
1839         (WebCore::jsTestObjMediaDevices1):
1840         (WebCore::jsTestObjMediaDevices2Getter):
1841         (WebCore::jsTestObjMediaDevices2):
1842         (WebCore::jsTestObjServiceWorkers1Getter):
1843         (WebCore::jsTestObjServiceWorkers1):
1844         (WebCore::jsTestObjServiceWorkers2Getter):
1845         (WebCore::jsTestObjServiceWorkers2):
1846         * bindings/scripts/test/TestObj.idl:
1847
1848 2019-02-15  Beth Dakin  <bdakin@apple.com>
1849
1850         Build fix.
1851
1852         * rendering/RenderThemeIOS.mm:
1853         (WebCore::iconForAttachment):
1854
1855 2019-02-15  Youenn Fablet  <youenn@apple.com>
1856
1857         Make ServiceWorkerClientFetch closer to WebResourceLoader
1858         https://bugs.webkit.org/show_bug.cgi?id=194651
1859
1860         Reviewed by Alex Christensen.
1861
1862         Check for redirection response and if so call a specific client API.
1863         Ensure ServiceWorkerFetch::Client gets called in the service worker thread proxy
1864         so that its m_connection is only accessed on that thread.
1865
1866         Covered by existing tests.
1867
1868         * platform/network/FormData.h:
1869         * platform/network/ResourceErrorBase.h:
1870         * workers/service/context/ServiceWorkerFetch.cpp:
1871         (WebCore::ServiceWorkerFetch::processResponse):
1872         * workers/service/context/ServiceWorkerFetch.h:
1873         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1874         (WebCore::ServiceWorkerThreadProxy::cancelFetch):
1875         (WebCore::ServiceWorkerThreadProxy::continueDidReceiveFetchResponse):
1876         * workers/service/context/ServiceWorkerThreadProxy.h:
1877
1878 2019-02-15  Youenn Fablet  <youenn@apple.com>
1879
1880         Make navigator.mediaDevices SecureContext
1881         https://bugs.webkit.org/show_bug.cgi?id=194666
1882
1883         Reviewed by Eric Carlson.
1884
1885         Make navigator.mediaDevices SecureContext.
1886         This can still be enabled for unsecure context using the existing page settings.
1887         To cover that case, introduce ContextHasMediaDevices custom IDL keyword.
1888
1889         Covered by API test.
1890
1891         * Modules/mediastream/NavigatorMediaDevices.idl:
1892         * bindings/scripts/CodeGeneratorJS.pm:
1893         (GenerateRuntimeEnableConditionalString):
1894         * bindings/scripts/IDLAttributes.json:
1895         * dom/ScriptExecutionContext.cpp:
1896         (WebCore::ScriptExecutionContext::hasMediaDevices const):
1897         (WebCore::ScriptExecutionContext::hasServiceWorkerScheme const):
1898         * dom/ScriptExecutionContext.h:
1899
1900 2019-02-15  Youenn Fablet  <youenn@apple.com>
1901
1902         WebSocket should not fire events after being stopped
1903         https://bugs.webkit.org/show_bug.cgi?id=194690
1904
1905         Reviewed by Geoffrey Garen.
1906
1907         dispatchOrQueueErrorEvent is scheduled using RunLoop::main().dispatch or dispatch_async.
1908         This makes it possible to dispatch an event while WebSocket is already stopped.
1909         Instead, use Document::postTask so that the task is only executed if WebSocket is not stopped.
1910
1911         As a refactoring, make use of PendingActivity to keep track of setPendingActivity/unsetPendingActivity more easily.
1912
1913         * Modules/websockets/WebSocket.cpp:
1914         (WebCore::WebSocket::stop):
1915         (WebCore::WebSocket::connect):
1916         * Modules/websockets/WebSocket.h:
1917
1918 2019-02-15  Youenn Fablet  <youenn@apple.com>
1919
1920         Performance should not fire events when its context is stopped
1921         https://bugs.webkit.org/show_bug.cgi?id=194689
1922
1923         Reviewed by Alex Christensen.
1924
1925         Stop the timer when its context is destroyed.
1926         Add an assertion to ensure the timer does not fire after context is destroyed.
1927
1928         * page/Performance.cpp:
1929         (WebCore::Performance::stop):
1930
1931 2019-02-15  Alex Christensen  <achristensen@webkit.org>
1932
1933         REGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm is crashing
1934         https://bugs.webkit.org/show_bug.cgi?id=194523
1935
1936         Reviewed by Geoffrey Garen.
1937
1938         The scope of the FormCreationContext was limited to the scope of createHTTPBodyCFReadStream,
1939         so when it was used in formCreate it was lucky to get the same context if the stack hadn't been overwritten
1940         and if the FormData hadn't been freed.  Instead, keep it alive with new/delete like we do the FormStreamFields.
1941         A younger me should've noticed this when reviewing r218517.
1942
1943         * platform/network/cf/FormDataStreamCFNet.cpp:
1944         (WebCore::formCreate):
1945         (WebCore::createHTTPBodyCFReadStream):
1946
1947 2019-02-15  Commit Queue  <commit-queue@webkit.org>
1948
1949         Unreviewed, rolling out r241559 and r241566.
1950         https://bugs.webkit.org/show_bug.cgi?id=194710
1951
1952         Causes layout test crashes under GuardMalloc (Requested by
1953         ryanhaddad on #webkit).
1954
1955         Reverted changesets:
1956
1957         "[WTF] Add environment variable helpers"
1958         https://bugs.webkit.org/show_bug.cgi?id=192405
1959         https://trac.webkit.org/changeset/241559
1960
1961         "Unreviewed build fix for WinCairo Debug after r241559."
1962         https://trac.webkit.org/changeset/241566
1963
1964 2019-02-15  Youenn Fablet  <youenn@apple.com>
1965
1966         Stop the endpoint synchronously in RTCPeerConnection::close
1967         https://bugs.webkit.org/show_bug.cgi?id=194688
1968
1969         Reviewed by Eric Carlson.
1970
1971         In the case where the peer connection is being closed, it was asynchronously stopping the endpoint.
1972         But the endpoint, before being stopped, could try to fire an event.
1973         If the context is gone in between, we end up with a null pointer dereference.
1974
1975         * Modules/mediastream/RTCPeerConnection.cpp:
1976         (WebCore::RTCPeerConnection::close):
1977
1978 2019-02-15  Zalan Bujtas  <zalan@apple.com>
1979
1980         [LFC] Out-of-flow box is never a float box
1981         https://bugs.webkit.org/show_bug.cgi?id=194704
1982
1983         Reviewed by Antti Koivisto.
1984
1985         We can't have it both ways. Absolute positioning wins.
1986
1987         Test: fast/block/block-only/out-of-flow-is-never-float-box.html
1988
1989         * layout/layouttree/LayoutBox.cpp:
1990         (WebCore::Layout::Box::isFloatingPositioned const):
1991         (WebCore::Layout::Box::isLeftFloatingPositioned const):
1992         (WebCore::Layout::Box::isRightFloatingPositioned const):
1993
1994 2019-02-15  Philippe Normand  <pnormand@igalia.com>
1995
1996         [GStreamer] Simplify GObject class name check
1997         https://bugs.webkit.org/show_bug.cgi?id=194537
1998
1999         Reviewed by Michael Catanzaro.
2000
2001         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2002         (WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback):
2003         Use G_OBJECT_TYPE_NAME() to filter out uridecodebin child
2004         elements.
2005
2006 2019-02-15  Wenson Hsieh  <wenson_hsieh@apple.com>
2007
2008         Refactor EditingStyle::textDirection to return an Optional<WritingDirection> instead of a bool
2009         https://bugs.webkit.org/show_bug.cgi?id=194686
2010
2011         Reviewed by Ryosuke Niwa.
2012
2013         Changes EditingStyle::textDirection to return an Optional<WritingDirection>, instead of taking a reference to
2014         the resulting WritingDirection. No change in behavior.
2015
2016         * editing/ApplyStyleCommand.cpp:
2017         (WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi):
2018         (WebCore::ApplyStyleCommand::applyInlineStyle):
2019         * editing/EditingStyle.cpp:
2020         (WebCore::EditingStyle::textDirection const):
2021         (WebCore::EditingStyle::textDirectionForSelection):
2022         * editing/EditingStyle.h:
2023
2024 2019-02-10  Darin Adler  <darin@apple.com>
2025
2026         Replace more uses of String::format with StringConcatenate (mostly non-Apple platform-specific cases)
2027         https://bugs.webkit.org/show_bug.cgi?id=194487
2028
2029         Reviewed by Daniel Bates.
2030
2031         * accessibility/win/AccessibilityObjectWrapperWin.cpp:
2032         (WebCore::AccessibilityObjectWrapper::accessibilityAttributeValue): Use makeString
2033         instead of String::format.
2034
2035         * page/linux/ResourceUsageOverlayLinux.cpp:
2036         (WebCore::formatByteNumber): Use String::number instead of String::format.
2037
2038         * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
2039         (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
2040         Use makeString instead of String::format.
2041         * platform/glib/UserAgentGLib.cpp:
2042         (WebCore::platformVersionForUAString): Ditto.
2043         * platform/graphics/gstreamer/GStreamerCommon.cpp:
2044         (WebCore::simpleBusMessageCallback): Ditto.
2045         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2046         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Ditto.
2047         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2048         (WebCore::AppendPipeline::AppendPipeline): Ditto.
2049         (WebCore::AppendPipeline::handleStateChangeMessage): Ditto.
2050         (WebCore::AppendPipeline::resetParserState): Ditto.
2051         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2052         (WebCore::MediaPlayerPrivateGStreamerMSE::load): Ditto.
2053         (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek): Ditto.
2054
2055         * platform/graphics/gtk/ImageBufferGtk.cpp:
2056         (WebCore::encodeImage): Use String::number instead of String::format.
2057
2058         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
2059         (WebCore::GStreamerAudioCaptureSource::create): Use makeString instead of
2060         String::format.
2061         * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:
2062         (WebCore::GStreamerCaptureDeviceManager::addDevice): Ditto.
2063         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
2064         (WebCore::webkitMediaStreamSrcAddPad): Ditto.
2065         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
2066         (WebCore::GStreamerVideoCaptureSource::create): Ditto.
2067         * platform/network/curl/CookieJarDB.cpp:
2068         (WebCore::CookieJarDB::verifySchemaVersion): Ditto.
2069         * platform/win/SearchPopupMenuDB.cpp:
2070         (WebCore::SearchPopupMenuDB::verifySchemaVersion): Ditto.
2071
2072 2019-02-15  Philippe Normand  <pnormand@igalia.com>
2073
2074         [GStreamer] Decoding media-capabilities configuration initial support
2075         https://bugs.webkit.org/show_bug.cgi?id=191191
2076
2077         Reviewed by Xabier Rodriguez-Calvar.
2078
2079         This patch enables basic platform probing for GStreamer decoders,
2080         optionally using Hardware decoding capabilities. The previous code
2081         for decoders/demuxers probing partially duplicated between the MSE
2082         player and its parent class was moved to a new module called
2083         GStreamerRegistryScanner. There is one instance of it for the MSE player
2084         and one for the parent class.
2085
2086         The scanner can check for the presence of the GstElement Hardware
2087         metadata classifier in decoders and thus advise the
2088         MediaEngineConfigurationFactoryGStreamer that hardware decoding is
2089         supported or not. This is only a first step though. The scanner
2090         should also probably attempt a NULL->READY transition on decoders
2091         to validate specific input caps are supported. As this might
2092         require changes in GStreamer, this part of the patch wasn't
2093         included.
2094
2095         This patch is covered by the existing media tests.
2096
2097         * platform/GStreamer.cmake: New files.
2098         * platform/graphics/MediaPlayer.cpp: Add support for converting
2099         SupportsType enum to string.
2100         (WebCore::convertEnumerationToString):
2101         * platform/graphics/MediaPlayer.h: Ditto.
2102         * platform/graphics/MediaPlayerEnums.h: Ditto.
2103         * platform/graphics/gstreamer/GStreamerCommon.cpp: Move
2104         gstRegistryHasElementForMediaType to GStreamerRegistryScanner.
2105         * platform/graphics/gstreamer/GStreamerCommon.h: Ditto.
2106         * platform/graphics/gstreamer/GStreamerRegistryScanner.cpp: Added.
2107         (WebCore::GStreamerRegistryScanner::singleton):
2108         (WebCore::GStreamerRegistryScanner::GStreamerRegistryScanner): Initialize
2109         supported mime-types and codecs from the GStreamer registry.
2110         (WebCore::GStreamerRegistryScanner::~GStreamerRegistryScanner): Free the element factories.
2111         (WebCore::GStreamerRegistryScanner::gstRegistryHasElementForMediaType):
2112         Check the input caps are supported, optionally using hardware
2113         device.
2114         (WebCore::GStreamerRegistryScanner::fillMimeTypeSetFromCapsMapping):
2115         Moved from MediaPlayerPrivateGStreamer{,MSE}.
2116         (WebCore::GStreamerRegistryScanner::initialize): Ditto.
2117         (WebCore::GStreamerRegistryScanner::supportsCodec const): Ditto.
2118         (WebCore::GStreamerRegistryScanner::supportsAllCodecs const): Ditto.
2119         (WebCore::GStreamerRegistryScanner::isDecodingSupported const): Check
2120         the given configuration is supported. For now hardware support is
2121         checked for video configurations only as it is quite uncommon
2122         anyway to have hardware-enabled audio decoders.
2123         * platform/graphics/gstreamer/GStreamerRegistryScanner.h: Added.
2124         (WebCore::GStreamerRegistryScanner::mimeTypeSet):
2125         (WebCore::GStreamerRegistryScanner::supportsContainerType const):
2126         (WebCore::GStreamerRegistryScanner::RegistryLookupResult::operator bool const):
2127         * platform/graphics/gstreamer/MediaEngineConfigurationFactoryGStreamer.cpp: Added.
2128         (WebCore::createMediaPlayerDecodingConfigurationGStreamer):
2129         * platform/graphics/gstreamer/MediaEngineConfigurationFactoryGStreamer.h: Added.
2130         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2131         Rely on new GStreamerRegistryScanner and add some debugging macros.
2132         (WebCore::MediaPlayerPrivateGStreamer::getSupportedTypes):
2133         (WebCore::MediaPlayerPrivateGStreamer::supportsType):
2134         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Ditto. Also
2135         plug qtdemux for AAC containers, this is an explicit consequence
2136         of finer-grained codecs probing.
2137         (WebCore::AppendPipeline::AppendPipeline):
2138         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
2139         * platform/graphics/gstreamer/mse/GStreamerRegistryScannerMSE.cpp: Added.
2140         (WebCore::GStreamerRegistryScannerMSE::singleton):
2141         (WebCore::GStreamerRegistryScannerMSE::GStreamerRegistryScannerMSE):
2142         * platform/graphics/gstreamer/mse/GStreamerRegistryScannerMSE.h: Added.
2143         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2144         Rely on new GStreamerRegistryScanner and add some debugging macros.
2145         (WebCore::MediaPlayerPrivateGStreamerMSE::getSupportedTypes):
2146         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType):
2147         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
2148         * platform/mediacapabilities/MediaEngineConfigurationFactory.cpp:
2149         (WebCore::factories): GStreamer support.
2150
2151 2019-02-14  Joseph Pecoraro  <pecoraro@apple.com>
2152
2153         Web Inspector: Occasional crash under WebCore::CSSStyleSheet::item called from Inspector
2154         https://bugs.webkit.org/show_bug.cgi?id=194671
2155         <rdar://problem/47628191>
2156
2157         Reviewed by Devin Rousso.
2158
2159         * css/CSSStyleSheet.cpp:
2160         (WebCore::CSSStyleSheet::item):
2161         A crash may happen if the m_childRuleCSSOMWrappers Vector gets out of
2162         sync with the m_contents list of rules. In particular if the wrappers
2163         vector is shorter than the rule list. We tried exercising code paths
2164         that modify these lists but were not able to reproduce the crash.
2165         To avoid a crash we can make this access safer and avoid the original
2166         overflow. At the same time we will keep and promote the assertion that
2167         would catch the lists getting out of sync in debug builds.
2168
2169 2019-02-14  Ross Kirsling  <ross.kirsling@sony.com>
2170
2171         Unreviewed build fix for WinCairo Debug after r241559.
2172
2173         * platform/network/curl/CurlContext.cpp:
2174         (WebCore::CurlContext::CurlContext):
2175
2176 2019-02-14  Ross Kirsling  <ross.kirsling@sony.com>
2177
2178         [WTF] Add environment variable helpers
2179         https://bugs.webkit.org/show_bug.cgi?id=192405
2180
2181         Reviewed by Michael Catanzaro.
2182
2183         * platform/NotImplemented.h:
2184         * platform/cocoa/SystemVersion.mm:
2185         (WebCore::createSystemMarketingVersion):
2186         * platform/graphics/gstreamer/GStreamerCommon.cpp:
2187         (WebCore::initializeGStreamer):
2188         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2189         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
2190         * platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
2191         (Nicosia::PaintingEngine::create):
2192         * platform/graphics/texmap/TextureMapperFPSCounter.cpp:
2193         (WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
2194         * platform/graphics/x11/PlatformDisplayX11.cpp:
2195         (WebCore::PlatformDisplayX11::create):
2196         * platform/gtk/RenderThemeWidget.cpp:
2197         (WebCore::RenderThemeScrollbar::RenderThemeScrollbar):
2198         * platform/gtk/ScrollbarThemeGtk.cpp:
2199         (WebCore::ScrollbarThemeGtk::ScrollbarThemeGtk):
2200         * platform/network/curl/CurlContext.cpp:
2201         (WebCore::CurlContext::CurlContext):
2202         (WebCore::EnvironmentVariableReader::read): Deleted.
2203         (WebCore::EnvironmentVariableReader::defined): Deleted.
2204         (WebCore::EnvironmentVariableReader::readAs): Deleted.
2205         (WebCore::EnvironmentVariableReader::sscanTemplate): Deleted.
2206         (WebCore::EnvironmentVariableReader::sscanTemplate<signed>): Deleted.
2207         (WebCore::EnvironmentVariableReader::sscanTemplate<unsigned>): Deleted.
2208         * platform/network/curl/NetworkStorageSessionCurl.cpp:
2209         (WebCore::defaultCookieJarPath):
2210         * platform/network/playstation/CurlSSLHandlePlayStation.cpp:
2211         (WebCore::getCACertPathEnv):
2212         * platform/network/win/CurlSSLHandleWin.cpp:
2213         (WebCore::getCACertPathEnv):
2214         * platform/text/hyphen/HyphenationLibHyphen.cpp:
2215         (WebCore::topLevelPath):
2216         (WebCore::webkitBuildDirectory):
2217         * platform/unix/LoggingUnix.cpp:
2218         (WebCore::logLevelString):
2219         * platform/win/LoggingWin.cpp:
2220         (WebCore::logLevelString):
2221         Utilize WTF::Environment where possible.
2222
2223 2019-02-14  Chris Dumez  <cdumez@apple.com>
2224
2225         [PSON] Introduce a WebContent Process cache
2226         https://bugs.webkit.org/show_bug.cgi?id=194594
2227         <rdar://problem/46793397>
2228
2229         Reviewed by Geoff Garen.
2230
2231         Update localizable strings.
2232
2233         * en.lproj/Localizable.strings:
2234
2235 2019-02-14  Commit Queue  <commit-queue@webkit.org>
2236
2237         Unreviewed, rolling out r241486.
2238         https://bugs.webkit.org/show_bug.cgi?id=194655
2239
2240         causing API failures in builds (Requested by ShawnRoberts on
2241         #webkit).
2242
2243         Reverted changeset:
2244
2245         "[Cocoa] Media elements will restart network buffering just
2246         before suspending"
2247         https://bugs.webkit.org/show_bug.cgi?id=193691
2248         https://trac.webkit.org/changeset/241486
2249
2250 2019-02-13  Brian Burg  <bburg@apple.com>
2251
2252         Web Inspector: don't include accessibility role in DOM.Node object payloads
2253         https://bugs.webkit.org/show_bug.cgi?id=194623
2254         <rdar://problem/36384037>
2255
2256         Reviewed by Devin Rousso.
2257
2258         Accessibility properties are complicated to fetch at all the points where we want to build and push nodes immediately.
2259         Turning on AX often indirectly causes style recalc and layout. This is bad because we are often building nodes in the
2260         first place due to a DOM node tree update (i.e., NodeInserted).
2261
2262         It turns out that DOM.getAccessibilityPropertiesForNode is called every time we display
2263         the computed role in the Elements Tab > Nodes Sidebar > Accessibility Section. So it is not
2264         necessary to collect this information in a problematic way when initially pushing the node, as
2265         it will be updated anyway.
2266
2267         No new tests, no change in behavior.
2268
2269         * inspector/agents/InspectorDOMAgent.cpp:
2270         (WebCore::InspectorDOMAgent::buildObjectForNode):
2271
2272 2019-02-14  Zalan Bujtas  <zalan@apple.com>
2273
2274         [LFC][BFC][MarginCollapse] Replaced boxes don't collapse through their margins
2275         https://bugs.webkit.org/show_bug.cgi?id=194622
2276
2277         Reviewed by Antti Koivisto.
2278
2279         Ensure that block replaced boxes don't collapse through their vertical margins. 
2280
2281         Test: fast/block/block-only/block-replaced-with-vertical-margins.html
2282
2283         * layout/blockformatting/BlockMarginCollapse.cpp:
2284         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
2285         * page/FrameViewLayoutContext.cpp:
2286         (WebCore::layoutUsingFormattingContext):
2287
2288 2019-02-14  Zalan Bujtas  <zalan@apple.com>
2289
2290         [LFC] Shrink-to-fit-width should be constrained by min/max width
2291         https://bugs.webkit.org/show_bug.cgi?id=194653
2292
2293         Reviewed by Antti Koivisto.
2294
2295         Use the fixed value of min-width/max-width to constrain the computed preferred width.
2296
2297         * layout/FormattingContext.h:
2298         * layout/FormattingContextGeometry.cpp:
2299         (WebCore::Layout::FormattingContext::Geometry::constrainByMinMaxWidth):
2300         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2301         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
2302         * layout/inlineformatting/InlineFormattingContext.cpp:
2303         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
2304
2305 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
2306
2307         Crash in DOMTimer::fired
2308         https://bugs.webkit.org/show_bug.cgi?id=194638
2309
2310         Reviewed by Brent Fulgham.
2311
2312         This patch continues the saga of hunting down timer related crashes after r239814, r225985, r227934.
2313
2314         The crash was caused by the bug that we don't remove a DOMTimer from NestedTimersMap if a DOMTimer
2315         is created & installed inside another DOMTimer's callback (via execute call in DOMTimer::fired).
2316
2317         Fixed the crash by using a Ref in NestedTimersMap. This will keep the timer alive until we exit
2318         from DOMTimer::fired. Because DOMTimer::fired always calls stopTracking() which clears the map
2319         we would not leak these DOM timers.
2320
2321         We could, alternatively, use WeakPtr in NestedTimersMap but that would unnecessarily increase the
2322         size of DOMTimer for a very marginal benefit of DOMTimer objcets being deleted slightly earlier.
2323         Deleting itself in DOMTimer's destructor involves more logic & house keeping in the timer code,
2324         and is no longer the preferred approach when dealing with these classes of bugs in WebKit.
2325
2326         Test: fast/dom/timer-destruction-during-firing.html
2327
2328         * page/DOMTimer.cpp:
2329         (WebCore::NestedTimersMap::add):
2330         (WebCore::DOMTimer::install):
2331         (WebCore::DOMTimer::fired):
2332
2333 2019-02-13  Joseph Pecoraro  <pecoraro@apple.com>
2334
2335         Web Inspector: Crash when inspecting an element that constantly changes visibility
2336         https://bugs.webkit.org/show_bug.cgi?id=194632
2337         <rdar://problem/48060258>
2338
2339         Reviewed by Matt Baker and Devin Rousso.
2340
2341         * inspector/agents/InspectorDOMAgent.h:
2342         * inspector/agents/InspectorDOMAgent.cpp:
2343         (WebCore::InspectorDOMAgent::processAccessibilityChildren):
2344         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
2345         Don't use rvalue-references as that was taking ownership and deleting
2346         the object we want to keep around. Instead simplify this to just use
2347         references so no ref counting changes happen.
2348
2349 2019-02-13  Chris Fleizach  <cfleizach@apple.com>
2350
2351         AX: Crash in handleMenuOpen
2352         https://bugs.webkit.org/show_bug.cgi?id=194627
2353
2354         Reviewed by Zalan Bujtas.
2355
2356         Tests run under libGuardMalloc will cause crashes.
2357
2358         This list of objects is a Node list, not an Element list, so we were
2359         not removing some nodes when they were being deallocated.
2360
2361         * accessibility/AXObjectCache.cpp:
2362         (WebCore::AXObjectCache::remove):
2363
2364 2019-02-13  Jer Noble  <jer.noble@apple.com>
2365
2366         [Mac] PiP window can get "stuck" if PiP is closed while Safari window is minimized.
2367         https://bugs.webkit.org/show_bug.cgi?id=194621
2368         <rdar://problem/48002560>
2369
2370         Reviewed by Eric Carlson.
2371
2372         When Safari is minimized, no rAF() requests are executed. Don't gate responding to presentation
2373         change events in the media-controller.js on rAF().
2374
2375         * Modules/modern-media-controls/media/media-controller.js:
2376         (MediaController.prototype._returnMediaLayerToInlineIfNeeded):
2377
2378 2019-02-13  John Wilander  <wilander@apple.com>
2379
2380         Ignore Ad Click Attribution where source and destination are same-site
2381         https://bugs.webkit.org/show_bug.cgi?id=194620
2382         <rdar://problem/47890018>
2383
2384         Reviewed by Jiewen Tan.
2385
2386         Updated the existing test.
2387
2388         We should not accept Ad Click Attribution requests where the site of the
2389         anchor tag and its addestination attribute are same-site. Such attributions
2390         don’t make sense (the site can track intra-site clicks through better means)
2391         and would just lead to increased memory use where are the pending
2392         attributions are stored.
2393
2394         For ports that don't have access to the Public Suffix List, this patch
2395         only checks that the hosts don't match, i.e. not just eTLD+1.
2396
2397         * html/HTMLAnchorElement.cpp:
2398         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
2399             Now returns WTF::nullopt if the current document and the
2400             addestination are same site. Also fixed a console message
2401             typo.
2402
2403 2019-02-13  Eric Carlson  <eric.carlson@apple.com> and Youenn Fablet  <youenn@apple.com>
2404
2405         getUserMedia with an ideal deviceId constraint doesn't always select the correct device
2406         https://bugs.webkit.org/show_bug.cgi?id=193614
2407
2408         Reviewed by Eric Carlson.
2409
2410         Compute a fitness score based on constraints.
2411         For each constraint, a fitness score is computed from the distance.
2412         The smaller the distance, the higher the score.
2413         Fitness scores are then summed to give a device fitness score.
2414         Matching devices are then sorted according the fitness score.
2415
2416         For important constraints, deviceId and facingMode, add a more important weight.
2417         This ensures that should any of these ideal constraints are set, they will be respected.
2418
2419         Restrict our automatic setting of default constraints to not add a default ideal facingMode in case of existing deviceId constraint.
2420         Do not set a default ideal frameRate if width and height are already set.
2421
2422         Covered by updated test.
2423
2424         * platform/mediastream/MediaConstraints.cpp:
2425         (WebCore::FlattenedConstraint::set):
2426         (WebCore::MediaConstraints::setDefaultVideoConstraints):
2427         * platform/mediastream/RealtimeMediaSource.cpp:
2428         (WebCore::RealtimeMediaSource::fitnessDistance):
2429         (WebCore::RealtimeMediaSource::selectSettings):
2430         (WebCore::RealtimeMediaSource::supportsConstraints):
2431         (WebCore::RealtimeMediaSource::applyConstraints):
2432         * platform/mediastream/RealtimeMediaSource.h:
2433         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2434         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
2435
2436 2019-02-13  Eric Carlson  <eric.carlson@apple.com>
2437
2438         [iOS] Add a hack to work around buggy video control library
2439         https://bugs.webkit.org/show_bug.cgi?id=194615
2440         <rdar://problem/46146946>
2441
2442         Reviewed by Jer Noble.
2443
2444         Test: media/ios/video-volume-ios-quirk.html
2445
2446         * html/HTMLMediaElement.cpp:
2447         (WebCore::HTMLMediaElement::setVolume): Change m_volume for one turn of the runloop.
2448         (WebCore::HTMLMediaElement::cancelPendingTasks): Clear the task queue used to restore m_volume.
2449         (WebCore::HTMLMediaElement::closeTaskQueues): Close it.
2450         * html/HTMLMediaElement.h:
2451
2452 2019-02-13  Jer Noble  <jer.noble@apple.com>
2453
2454         [Cocoa] Media elements will restart network buffering just before suspending
2455         https://bugs.webkit.org/show_bug.cgi?id=193691
2456
2457         Reviewed by Eric Carlson.
2458
2459         API Test: WebKit.ProcessSuspendMediaBuffering
2460
2461         Allow the Page to suspend all media buffering in its child Documents.
2462
2463         * dom/Document.cpp:
2464         (WebCore::Document::suspendAllMediaBuffering):
2465         (WebCore::Document::resumeAllMediaBuffering):
2466         * dom/Document.h:
2467         * html/MediaElementSession.cpp:
2468         (WebCore::MediaElementSession::dataBufferingPermitted const):
2469         (WebCore::MediaElementSession::suspendBuffering):
2470         (WebCore::MediaElementSession::resumeBuffering):
2471         (WebCore::MediaElementSession::bufferingSuspended const):
2472         * html/MediaElementSession.h:
2473         * page/Page.cpp:
2474         (WebCore::Page::suspendAllMediaBuffering):
2475         (WebCore::Page::resumeAllMediaBuffering):
2476         * page/Page.h:
2477         (WebCore::Page::mediaPlaybackIsSuspended const):
2478         (WebCore::Page::mediaBufferingIsSuspended const):
2479         (WebCore::Page::mediaPlaybackIsSuspended): Deleted.
2480         * platform/audio/PlatformMediaSession.h:
2481         (WebCore::PlatformMediaSession::suspendBuffering):
2482         (WebCore::PlatformMediaSession::resumeBuffering):
2483         * platform/audio/PlatformMediaSessionManager.cpp:
2484         (WebCore::PlatformMediaSessionManager::suspendAllMediaBufferingForDocument):
2485         (WebCore::PlatformMediaSessionManager::resumeAllMediaBufferingForDocument):
2486         * platform/audio/PlatformMediaSessionManager.h:
2487
2488 2019-02-13  Jer Noble  <jer.noble@apple.com>
2489
2490         Entering fullscreen inside a shadow root will not set fullscreen pseudoclasses outside of root
2491         https://bugs.webkit.org/show_bug.cgi?id=194516
2492         <rdar://problem/44678353>
2493
2494         Reviewed by Antoine Quint.
2495
2496         Test: fast/shadow-dom/fullscreen-in-shadow-full-screen-ancestor.html
2497
2498         When walking up the element ancestor chain, use parentElementInComposedTree() to
2499         walk past the shadow root boundary.
2500
2501         * dom/Element.cpp:
2502         (WebCore::parentCrossingFrameBoundaries):
2503
2504 2019-02-13  Chris Dumez  <cdumez@apple.com>
2505
2506         Unreviewed, update localizable strings.
2507
2508         * en.lproj/Localizable.strings:
2509
2510 2019-02-12  Jiewen Tan  <jiewen_tan@apple.com>
2511
2512         Further restricting webarchive loads
2513         https://bugs.webkit.org/show_bug.cgi?id=194567
2514         <rdar://problem/47610130>
2515
2516         Reviewed by Youenn Fablet.
2517
2518         This patch futher restricts main frame webarchive loads to the followings:
2519         1) loaded by clients;
2520         2) loaded by drag;
2521         3) reloaded from any of the previous two.
2522
2523         It moves setAlwaysAllowLocalWebarchive, which is used for testing only, from Document
2524         to FrameLoader such that the option is remembered during redirections.
2525
2526         Covered by API tests.
2527
2528         * dom/Document.h:
2529         (WebCore::Document::setAlwaysAllowLocalWebarchive): Deleted.
2530         (WebCore::Document::alwaysAllowLocalWebarchive const): Deleted.
2531         * loader/DocumentLoader.cpp:
2532         (WebCore::DocumentLoader::disallowWebArchive const):
2533         * loader/DocumentLoader.h:
2534         (WebCore::DocumentLoader::setAllowsWebArchiveForMainFrame):
2535         (WebCore::DocumentLoader::allowsWebArchiveForMainFrame):
2536         * loader/FrameLoadRequest.h:
2537         (WebCore::FrameLoadRequest::setIsRequestFromClientOrUserInput):
2538         (WebCore::FrameLoadRequest::isRequestFromClientOrUserInput):
2539         * loader/FrameLoader.cpp:
2540         (WebCore::FrameLoader::load):
2541         (WebCore::FrameLoader::reload):
2542         * loader/FrameLoader.h:
2543         (WebCore::FrameLoader::setAlwaysAllowLocalWebarchive):
2544         (WebCore::FrameLoader::alwaysAllowLocalWebarchive const):
2545         * page/DragController.cpp:
2546         (WebCore::DragController::performDragOperation):
2547         * testing/Internals.cpp:
2548         (WebCore::Internals::setAlwaysAllowLocalWebarchive const):
2549         * testing/Internals.h:
2550         * testing/Internals.idl:
2551
2552 2019-02-13  Jer Noble  <jer.noble@apple.com>
2553
2554         Null-deref crash at SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged()
2555         https://bugs.webkit.org/show_bug.cgi?id=194613
2556         <rdar://problem/48023912>
2557
2558         Reviewed by Eric Carlson.
2559
2560         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2561         (WebCore::SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
2562
2563 2019-02-13  Michael Catanzaro  <mcatanzaro@igalia.com>
2564
2565         Unreviewed, fix unused variable warnings after r241148/r241251
2566         https://bugs.webkit.org/show_bug.cgi?id=194348
2567         <rdar://problem/47566449>
2568
2569         * Modules/mediasource/SourceBuffer.cpp:
2570         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError):
2571         (WebCore::SourceBuffer::evictCodedFrames):
2572         (WebCore::SourceBuffer::provideMediaData):
2573
2574 2019-02-13  Sihui Liu  <sihui_liu@apple.com>
2575
2576         REGRESSION: [ Mac Debug WK2 ] Layout Test storage/indexeddb/key-type-infinity-private.html is a flaky crash
2577         https://bugs.webkit.org/show_bug.cgi?id=194413
2578         <rdar://problem/47897254>
2579
2580         Reviewed by Brady Eidson.
2581
2582         IDB clients expected transaction operations to be executed in order, but in 
2583         UniqueIDBDatabase::immediateCloseForUserDelete, callbacks in callback map were errored out randomly.
2584         This patch added a callback queue to UniqueIDBDatabase to make sure callbacks will be called in the same order
2585         as IDB Server receives the request.
2586
2587         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2588         (WebCore::IDBServer::UniqueIDBDatabase::storeCallbackOrFireError):
2589         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
2590         (WebCore::IDBServer::UniqueIDBDatabase::performErrorCallback):
2591         (WebCore::IDBServer::UniqueIDBDatabase::performKeyDataCallback):
2592         (WebCore::IDBServer::UniqueIDBDatabase::performGetResultCallback):
2593         (WebCore::IDBServer::UniqueIDBDatabase::performGetAllResultsCallback):
2594         (WebCore::IDBServer::UniqueIDBDatabase::performCountCallback):
2595         (WebCore::IDBServer::UniqueIDBDatabase::forgetErrorCallback):
2596         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2597
2598 2019-02-13  John Wilander  <wilander@apple.com>
2599
2600         Store Ad Click Attribution requests in the network process
2601         https://bugs.webkit.org/show_bug.cgi?id=194510
2602         <rdar://problem/47650118>
2603
2604         Reviewed by Alex Christensen and Daniel Bates.
2605
2606         Test: http/tests/adClickAttribution/store-ad-click-attribution.html
2607
2608         This patch adds support functions for validation and storage of
2609         WebCore::AdClickAttribution objects. It also adds WTF::HashTraits so that
2610         WebCore::AdClickAttribution::Source and WebCore::AdClickAttribution::Destination
2611         can be used in a HashMap.
2612
2613         * loader/AdClickAttribution.cpp:
2614         (WebCore::AdClickAttribution::toString const):
2615         * loader/AdClickAttribution.h:
2616         (WebCore::AdClickAttribution::Source::operator== const):
2617         (WebCore::AdClickAttribution::Source::deletedValue):
2618         (WebCore::AdClickAttribution::Source::constructDeletedValue):
2619         (WebCore::AdClickAttribution::Source::deleteValue):
2620         (WebCore::AdClickAttribution::Source::isDeletedValue const):
2621         (WebCore::AdClickAttribution::SourceHash::hash):
2622         (WebCore::AdClickAttribution::SourceHash::equal):
2623         (WebCore::AdClickAttribution::Destination::operator== const):
2624         (WebCore::AdClickAttribution::Destination::matches const):
2625             This convenience function allows matching of a WTF::URL object.
2626         (WebCore::AdClickAttribution::Destination::deletedValue):
2627         (WebCore::AdClickAttribution::Destination::constructDeletedValue):
2628         (WebCore::AdClickAttribution::Destination::deleteValue):
2629         (WebCore::AdClickAttribution::Destination::isDeletedValue const):
2630         (WebCore::AdClickAttribution::DestinationHash::hash):
2631         (WebCore::AdClickAttribution::DestinationHash::equal):
2632         (WebCore::AdClickAttribution::source const):
2633         (WebCore::AdClickAttribution::destination const):
2634             Getters added to support mapped storage based on source and destination.
2635         (WTF::HashTraits<WebCore::AdClickAttribution::Source>::emptyValue):
2636         (WTF::HashTraits<WebCore::AdClickAttribution::Source>::constructDeletedValue):
2637         (WTF::HashTraits<WebCore::AdClickAttribution::Source>::isDeletedValue):
2638         (WTF::HashTraits<WebCore::AdClickAttribution::Destination>::emptyValue):
2639         (WTF::HashTraits<WebCore::AdClickAttribution::Destination>::constructDeletedValue):
2640         (WTF::HashTraits<WebCore::AdClickAttribution::Destination>::isDeletedValue):
2641         * loader/NavigationAction.h:
2642         (WebCore::NavigationAction::adClickAttribution const):
2643         (WebCore::NavigationAction::adClickAttribution): Deleted.
2644             Corrected the constness of this function.
2645
2646 2019-02-13  Eric Carlson  <eric.carlson@apple.com>
2647
2648         Revert r240434
2649         https://bugs.webkit.org/show_bug.cgi?id=194600
2650         <rdar://problem/48044566>
2651
2652         Reviewed by Brent Fulgham.
2653
2654         * html/HTMLMediaElement.cpp:
2655         (WebCore::HTMLMediaElement::setVolume):
2656         (WebCore::HTMLMediaElement::mediaPlayerVolumeChanged):
2657         (WebCore::HTMLMediaElement::updateVolume):
2658         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2659         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVolume):
2660
2661 2019-02-13  Alex Christensen  <achristensen@webkit.org>
2662
2663         Stop using setDefersLoading from WebCore
2664         https://bugs.webkit.org/show_bug.cgi?id=194315
2665
2666         Reviewed by Jer Noble.
2667
2668         That is what CompletionHandlers are for.
2669
2670         * loader/MediaResourceLoader.cpp:
2671         (WebCore::MediaResource::responseReceived):
2672         (WebCore::MediaResource::setDefersLoading): Deleted.
2673         * loader/MediaResourceLoader.h:
2674         * platform/graphics/PlatformMediaResourceLoader.h:
2675         (WebCore::PlatformMediaResourceClient::responseReceived):
2676         (WebCore::PlatformMediaResource::stop):
2677         (WebCore::PlatformMediaResource::setDefersLoading): Deleted.
2678         * platform/network/cocoa/WebCoreNSURLSession.mm:
2679         (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived):
2680         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:completionHandler:]):
2681         (-[WebCoreNSURLSessionDataTask _setDefersLoading:]): Deleted.
2682         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]): Deleted.
2683
2684 2019-02-13  Jer Noble  <jer.noble@apple.com>
2685
2686         [Cocoa] Switch to CVPixelBufferGetBytesPerRow() for calculating CVPixelBuffer base address size.
2687         https://bugs.webkit.org/show_bug.cgi?id=194580
2688         <rdar://problem/42727739>
2689
2690         Reviewed by Eric Carlson.
2691
2692         * platform/cocoa/CoreVideoSoftLink.cpp:
2693         * platform/cocoa/CoreVideoSoftLink.h:
2694         * platform/graphics/cv/PixelBufferConformerCV.cpp:
2695         (WebCore::CVPixelBufferGetBytePointerCallback):
2696         (WebCore::PixelBufferConformerCV::createImageFromPixelBuffer):
2697
2698 2019-02-13  Antoine Quint  <graouts@apple.com>
2699
2700         Support simulated mouse events on iOS based on a PlatformTouchEvent
2701         https://bugs.webkit.org/show_bug.cgi?id=194501
2702         <rdar://problem/46910790>
2703
2704         Reviewed by Dean Jackson.
2705
2706         Add support for two new internal runtime flags to control whether simulated mouse events should be dipatched along with touch events and
2707         whether simulated mousemove events dispatched should automatically trigger the behavior preventDefault() would also trigger. To facilitate
2708         that, we allow for a MouseEvent to be created, much like a PointerEvent, based on a PlatformTouchEvent. Then, we set a flag on Event within
2709         EventTarget::innerInvokeEventListeners() to see whether any page code has been evaluated as a result of a mousemove event being dispatched.
2710         Finally, we also track mouse events when invalidating touch regions provided the required internal runtime flag is on.
2711
2712         Test: fast/events/touch/ios/mouse-events-dispatch-with-touch.html
2713
2714         * SourcesCocoa.txt:
2715         * WebCore.xcodeproj/project.pbxproj:
2716         * dom/Event.cpp:
2717         * dom/Event.h:
2718         (WebCore::Event::hasEncounteredListener const):
2719         (WebCore::Event::setHasEncounteredListener):
2720         * dom/EventNames.h:
2721         (WebCore::EventNames::isTouchRelatedEventType const):
2722         (WebCore::EventNames::touchRelatedEventNames const):
2723         (WebCore::EventNames::extendedTouchRelatedEventNames const):
2724         (WebCore::EventNames::isTouchEventType const): Deleted.
2725         (WebCore::EventNames::touchAndPointerEventNames const): Deleted.
2726         * dom/EventTarget.cpp:
2727         (WebCore::EventTarget::innerInvokeEventListeners):
2728         * dom/MouseEvent.h:
2729         * dom/Node.cpp:
2730         (WebCore::Node::moveNodeToNewDocument):
2731         (WebCore::tryAddEventListener):
2732         (WebCore::tryRemoveEventListener):
2733         (WebCore::Node::defaultEventHandler):
2734         * dom/ios/MouseEventIOS.cpp: Added.
2735         (WebCore::mouseEventType):
2736         (WebCore::MouseEvent::create):
2737         * dom/ios/PointerEventIOS.cpp:
2738         (WebCore::pointerEventType):
2739         (WebCore::PointerEvent::create):
2740         (WebCore::eventType): Deleted.
2741         * page/DOMWindow.cpp:
2742         (WebCore::DOMWindow::addEventListener):
2743         (WebCore::DOMWindow::removeEventListener):
2744         * page/EventHandler.h:
2745         * page/RuntimeEnabledFeatures.h:
2746         (WebCore::RuntimeEnabledFeatures::mouseEventsSimulationEnabled const):
2747         (WebCore::RuntimeEnabledFeatures::setMouseEventsSimulationEnabled):
2748         (WebCore::RuntimeEnabledFeatures::mousemoveEventHandlingPreventsDefaultEnabled const):
2749         (WebCore::RuntimeEnabledFeatures::setMousemoveEventHandlingPreventsDefaultEnabled):
2750
2751 2019-02-13  Carlos Garcia Campos  <cgarcia@igalia.com>
2752
2753         [FreeType] Unable to render some Hebrew characters
2754         https://bugs.webkit.org/show_bug.cgi?id=194498
2755
2756         Reviewed by Michael Catanzaro.
2757
2758         We are failing to find a font for some of the combining character sequences because normalization is failing due
2759         to overflow error. In case of overflow, normalize returns the required length for the normalized characters, so
2760         we should handle that case to resize the output buffer and try again.
2761
2762         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
2763         (WebCore::FontCascade::fontForCombiningCharacterSequence const):
2764
2765 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
2766
2767         Release assert in PolicyCheckIdentifier::isValidFor via WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction
2768         https://bugs.webkit.org/show_bug.cgi?id=194582
2769
2770         Reviewed by Antti Koivisto.
2771
2772         Check the zero-ness of m_policyCheck first so that we can differentiate process ID being wrong
2773         from the non-generated identifier being sent to us as it was the case in this failure.
2774
2775         * loader/PolicyChecker.cpp:
2776         (WebCore::PolicyCheckIdentifier::isValidFor):
2777
2778 2019-02-13  Commit Queue  <commit-queue@webkit.org>
2779
2780         Unreviewed, rolling out r241273.
2781         https://bugs.webkit.org/show_bug.cgi?id=194579
2782
2783         This change is causing a flaky assertion failure crash in High
2784         Sierra Debug (Requested by ShawnRoberts on #webkit).
2785
2786         Reverted changeset:
2787
2788         "Stop using setDefersLoading from WebCore"
2789         https://bugs.webkit.org/show_bug.cgi?id=194315
2790         https://trac.webkit.org/changeset/241273
2791
2792 2019-02-12  Mark Lam  <mark.lam@apple.com>
2793
2794         Remove unnecessary null check in bindings.
2795         https://bugs.webkit.org/show_bug.cgi?id=194581
2796
2797         Reviewed by Yusuke Suzuki.
2798
2799         It is always safe to call visitor.containsOpaqueRoot(root) with a null root pointer.
2800         It will just return false.  Since we don't expect the root pointer to be null in
2801         the common case, having a null check here is also not optimal.  We'll remove this
2802         unneeded null check.
2803
2804         * bindings/scripts/CodeGeneratorJS.pm:
2805         (GenerateImplementation):
2806         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2807         (WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots):
2808
2809 2019-02-12  Rob Buis  <rbuis@igalia.com>
2810
2811         Align with Fetch on data: URLs
2812         https://bugs.webkit.org/show_bug.cgi?id=182325
2813
2814         Reviewed by Alex Christensen.
2815
2816         The MIME type part of the data url should be serialized as
2817         specified in step 3 under "data" [1].
2818
2819         Test: web-platform-tests/fetch/data-urls/processing.any.js
2820
2821         [1] https://fetch.spec.whatwg.org/#concept-scheme-fetch 
2822
2823         * platform/network/DataURLDecoder.cpp:
2824         (WebCore::DataURLDecoder::parseMediaType):
2825
2826 2019-02-12  Alex Christensen  <achristensen@webkit.org>
2827
2828         Build fix after r241320
2829         https://bugs.webkit.org/show_bug.cgi?id=194271
2830
2831         * page/Frame.cpp:
2832         (WebCore::Frame::requestDOMPasteAccess):
2833
2834 2019-02-12  Justin Fan  <justin_fan@apple.com>
2835
2836         [WebGPU] Remove WebGPUBufferDescriptor/Usage and use GPU versions
2837         https://bugs.webkit.org/show_bug.cgi?id=194552
2838
2839         Reviewed by Dean Jackson.
2840
2841         WebGPUBufferDescriptor/Usage have been renamed to GPUBufferDescriptor/Usage in the Web GPU API.
2842         Consolidate the two versions of these classes in our implementation.
2843
2844         Affected layout tests updated with new names. No change in behavior.
2845
2846         * CMakeLists.txt:
2847         * DerivedSources-input.xcfilelist:
2848         * DerivedSources-output.xcfilelist:
2849         * DerivedSources.make:
2850         * Modules/webgpu/GPUBufferDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBufferDescriptor.idl.
2851         * Modules/webgpu/GPUBufferUsage.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBufferUsage.idl.
2852         * Modules/webgpu/WebGPUBufferUsage.h: Removed.
2853         * Modules/webgpu/WebGPUDevice.cpp:
2854         (WebCore::WebGPUDevice::createBuffer const):
2855         * Modules/webgpu/WebGPUDevice.h:
2856         * Modules/webgpu/WebGPUDevice.idl:
2857         * Sources.txt:
2858         * WebCore.xcodeproj/project.pbxproj:
2859         * bindings/js/WebCoreBuiltinNames.h:
2860         * platform/graphics/gpu/GPUBufferDescriptor.h: Moved out GPUBufferUsage.
2861         * platform/graphics/gpu/GPUBufferUsage.h: Moved from GPUBufferDescriptor.h.
2862
2863 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2864
2865         Unreviewed, try to fix the internal iOS build after r241321
2866
2867         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
2868
2869 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2870
2871         Allow pages to trigger programmatic paste from script on iOS
2872         https://bugs.webkit.org/show_bug.cgi?id=194271
2873         <rdar://problem/47808810>
2874
2875         Reviewed by Tim Horton.
2876
2877         Tests: editing/pasteboard/ios/dom-paste-confirmation.html
2878                editing/pasteboard/ios/dom-paste-consecutive-confirmations.html
2879                editing/pasteboard/ios/dom-paste-rejection.html
2880                editing/pasteboard/ios/dom-paste-requires-user-gesture.html
2881
2882         * dom/UserGestureIndicator.cpp:
2883         (WebCore::UserGestureIndicator::~UserGestureIndicator):
2884
2885         Reset a gesture token's DOM paste access when exiting the scope of a user gesture. This prevents DOM paste
2886         access permissions from leaking into `setTimeout()` callbacks when we forward user gesture tokens.
2887
2888         * dom/UserGestureIndicator.h:
2889         (WebCore::UserGestureToken::resetDOMPasteAccess):
2890
2891 2019-02-12  Chris Fleizach  <cfleizach@apple.com>
2892
2893         AX: IsolatedTree: Implement more attributes
2894         https://bugs.webkit.org/show_bug.cgi?id=193911
2895         <rdar://problem/47599217>
2896
2897         Reviewed by Daniel Bates.
2898
2899         Make use of new HIServices SPI to use a secondary AX thread.
2900         Store root node/focused node status in IsolatedTree rather than on the element.
2901         Implement the following attributes: children, parent, isIgnored, isTree, isTreeItem, relativeFrame, speechHint, title, description.
2902         Implement hit-testing using relative-frames.
2903         Ensure that WKAccessibilityWebPageObject queries happen on main thread when they need to.
2904
2905         * SourcesCocoa.txt:
2906         * WebCore.xcodeproj/project.pbxproj:
2907         * accessibility/AXObjectCache.cpp:
2908         (WebCore::AXObjectCache::generateIsolatedAccessibilityTree):
2909         * accessibility/AXObjectCache.h:
2910         (WebCore::AXObjectCache::focusedUIElementForPage):
2911         * accessibility/AccessibilityAttachment.cpp:
2912         (WebCore::AccessibilityAttachment::accessibilityText const):
2913         (WebCore::AccessibilityAttachment::accessibilityText): Deleted.
2914         * accessibility/AccessibilityAttachment.h:
2915         * accessibility/AccessibilityImageMapLink.cpp:
2916         (WebCore::AccessibilityImageMapLink::accessibilityText const):
2917         (WebCore::AccessibilityImageMapLink::accessibilityText): Deleted.
2918         * accessibility/AccessibilityImageMapLink.h:
2919         * accessibility/AccessibilityMediaControls.cpp:
2920         (WebCore::AccessibilityMediaControl::accessibilityText const):
2921         (WebCore::AccessibilityMediaControl::accessibilityText): Deleted.
2922         * accessibility/AccessibilityMediaControls.h:
2923         * accessibility/AccessibilityNodeObject.cpp:
2924         (WebCore::AccessibilityNodeObject::accessibilityText const):
2925         (WebCore::AccessibilityNodeObject::accessibilityText): Deleted.
2926         * accessibility/AccessibilityNodeObject.h:
2927         * accessibility/AccessibilityObject.cpp:
2928         (WebCore::AccessibilityObject::convertFrameToSpace const):
2929         (WebCore::AccessibilityObject::relativeFrame const):
2930         (WebCore::AccessibilityObject::elementAccessibilityHitTest const):
2931         (WebCore::AccessibilityObject::focusedUIElement const):
2932         * accessibility/AccessibilityObject.h:
2933         (WebCore::AccessibilityObject::accessibilityText const):
2934         (WebCore::AccessibilityObject::isLink const): Deleted.
2935         (WebCore::AccessibilityObject::isImage const): Deleted.
2936         (WebCore::AccessibilityObject::isAttachment const): Deleted.
2937         (WebCore::AccessibilityObject::isFileUploadButton const): Deleted.
2938         (WebCore::AccessibilityObject::isImageMapLink const): Deleted.
2939         (WebCore::AccessibilityObject::isMediaControlLabel const): Deleted.
2940         (WebCore::AccessibilityObject::isTree const): Deleted.
2941         (WebCore::AccessibilityObject::isTreeItem const): Deleted.
2942         (WebCore::AccessibilityObject::isScrollbar const): Deleted.
2943         (WebCore::AccessibilityObject::accessibilityHitTest const): Deleted.
2944         (WebCore::AccessibilityObject::accessibilityText): Deleted.
2945         (WebCore::AccessibilityObject::roleValue const): Deleted.
2946         (WebCore::AccessibilityObject::wrapper const): Deleted.
2947         * accessibility/AccessibilityObjectInterface.h: Replaced.
2948         * accessibility/AccessibilityRenderObject.cpp:
2949         (WebCore::AccessibilityRenderObject::isTabItemSelected const):
2950         (WebCore::AccessibilityRenderObject::remoteSVGElementHitTest const):
2951         (WebCore::AccessibilityRenderObject::elementAccessibilityHitTest const):
2952         (WebCore::AccessibilityRenderObject::accessibilityHitTest const):
2953         (WebCore::AccessibilityRenderObject::selectedChildren):
2954         * accessibility/AccessibilityRenderObject.h:
2955         * accessibility/AccessibilitySVGElement.cpp:
2956         (WebCore::AccessibilitySVGElement::accessibilityText const):
2957         (WebCore::AccessibilitySVGElement::accessibilityText): Deleted.
2958         * accessibility/AccessibilitySVGElement.h:
2959         * accessibility/AccessibilityScrollView.cpp:
2960         (WebCore::AccessibilityScrollView::accessibilityHitTest const):
2961         * accessibility/AccessibilityScrollView.h:
2962         * accessibility/ios/AccessibilityObjectIOS.mm:
2963         (WebCore::AccessibilityObject::fileUploadButtonReturnsValueInTitle const):
2964         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2965         (-[WebAccessibilityObjectWrapper fileUploadButtonReturnsValueInTitle]): Deleted.
2966         * accessibility/isolatedtree: Replaced.
2967         * accessibility/isolatedtree/AXIsolatedTree.cpp: Added.
2968         (WebCore::AXIsolatedTree::treePageCache):
2969         (WebCore::AXIsolatedTree::AXIsolatedTree):
2970         (WebCore::AXIsolatedTree::nodeInTreeForID):
2971         (WebCore::AXIsolatedTree::nodeForID const):
2972         (WebCore::AXIsolatedTree::focusedUIElement):
2973         (WebCore::AXIsolatedTree::setRootNodeID):
2974         (WebCore::AXIsolatedTree::setFocusedNodeID):
2975         (WebCore::AXIsolatedTree::setInitialRequestInProgress):
2976         (WebCore::AXIsolatedTree::applyPendingChanges):
2977         * accessibility/isolatedtree/AXIsolatedTree.h: Added.
2978         * accessibility/isolatedtree/AXIsolatedTreeNode.cpp: Added.
2979         (WebCore::AXIsolatedTreeNode::AXIsolatedTreeNode):
2980         (WebCore::AXIsolatedTreeNode::~AXIsolatedTreeNode):
2981         (WebCore::AXIsolatedTreeNode::initializeAttributeData):
2982         (WebCore::AXIsolatedTreeNode::setProperty):
2983         (WebCore::AXIsolatedTreeNode::setParent):
2984         (WebCore::AXIsolatedTreeNode::setTreeIdentifier):
2985         (WebCore::AXIsolatedTreeNode::focusedUIElement const):
2986         (WebCore::AXIsolatedTreeNode::parentObjectInterfaceUnignored const):
2987         (WebCore::AXIsolatedTreeNode::accessibilityHitTest const):
2988         (WebCore::AXIsolatedTreeNode::tree const):
2989         (WebCore::AXIsolatedTreeNode::rectAttributeValue const):
2990         (WebCore::AXIsolatedTreeNode::stringAttributeValue const):
2991         * accessibility/isolatedtree/AXIsolatedTreeNode.h: Added.
2992         * accessibility/mac/AXObjectCacheMac.mm:
2993         (WebCore::AXObjectCache::associateIsolatedTreeNode):
2994         * accessibility/mac/AccessibilityObjectBase.mm: Added.
2995         (WebCore::AccessibilityObject::speechHintAttributeValue const):
2996         (WebCore::AccessibilityObject::descriptionAttributeValue const):
2997         (WebCore::AccessibilityObject::titleAttributeValue const):
2998         (WebCore::AccessibilityObject::helpTextAttributeValue const):
2999         * accessibility/mac/AccessibilityObjectMac.mm:
3000         (WebCore::AccessibilityObject::fileUploadButtonReturnsValueInTitle const):
3001         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
3002         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
3003         (addChildToArray):
3004         (convertToNSArray):
3005         (-[WebAccessibilityObjectWrapperBase isolatedTreeNode]):
3006         (-[WebAccessibilityObjectWrapperBase detach]):
3007         (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):
3008         (-[WebAccessibilityObjectWrapperBase accessibilityObject]):
3009         (-[WebAccessibilityObjectWrapperBase baseAccessibilityTitle]):
3010         (-[WebAccessibilityObjectWrapperBase axBackingObject]):
3011         (-[WebAccessibilityObjectWrapperBase baseAccessibilityDescription]):
3012         (-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]):
3013         (-[WebAccessibilityObjectWrapperBase baseAccessibilityHelpText]):
3014         (convertPathToScreenSpaceFunction):
3015         (-[WebAccessibilityObjectWrapperBase convertRectToSpace:space:]):
3016         (-[WebAccessibilityObjectWrapperBase ariaLandmarkRoleDescription]):
3017         (-[WebAccessibilityObjectWrapperBase titleTagShouldBeUsedInDescriptionField]): Deleted.
3018         (-[WebAccessibilityObjectWrapperBase fileUploadButtonReturnsValueInTitle]): Deleted.
3019         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3020         (-[WebAccessibilityObjectWrapper IGNORE_WARNINGS_END]):
3021         (-[WebAccessibilityObjectWrapper childrenVectorSize]):
3022         (-[WebAccessibilityObjectWrapper childrenVectorArray]):
3023         (-[WebAccessibilityObjectWrapper position]):
3024         (-[WebAccessibilityObjectWrapper subrole]):
3025         (-[WebAccessibilityObjectWrapper roleDescription]):
3026         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3027         (-[WebAccessibilityObjectWrapper accessibilityFocusedUIElement]):
3028         (-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
3029         (-[WebAccessibilityObjectWrapper accessibilityIndexOfChild:]):
3030         (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeCount:]):
3031         (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]):
3032
3033 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
3034
3035         Allow pages to trigger programmatic paste from script on iOS
3036         https://bugs.webkit.org/show_bug.cgi?id=194271
3037         <rdar://problem/47808810>
3038
3039         Reviewed by Ryosuke Niwa.
3040
3041         Add support for allowing script to trigger programmatic paste commands. Currently on macOS and iOS, the ability
3042         to trigger programmatic paste (i.e. `document.execCommand('Paste');`) is disabled by default, such that
3043         execCommand is simply a no-op that returns false. This policy is a privacy measure (common among other major
3044         browsers) that prevents untrusted web content from sniffing content from the system pasteboard (even on user
3045         interaction, since unintended user interaction occasionally happens as well!).
3046
3047         In order to make it possible for web pages to programmatically paste without opening the door to privacy and
3048         security issues, we make paste commands triggered from bindings present platform UI on iOS, in the form of a
3049         callout bar with the single option to paste. This UI is dismissed upon any user interaction; furthermore, any
3050         user interaction short of explicitly triggering the "Paste" action subsequently prevents the page from executing
3051         the paste (and causes execCommand to return false). However, if the paste action is chosen by the user, we
3052         instead follow through with the programmatic paste command.
3053
3054         New tests to come in a followup patch.
3055
3056         * WebCore.xcodeproj/project.pbxproj:
3057         * dom/DOMPasteAccessPolicy.h: Added.
3058         * dom/UserGestureIndicator.h:
3059         (WebCore::UserGestureToken::domPasteAccessPolicy const):
3060         (WebCore::UserGestureToken::didRequestDOMPasteAccess):
3061
3062         Add helpers on UserGestureToken to update and query the current DOM paste access policy. The access policies are
3063         "NotRequestedYet" (i.e. pending a response from the user), "Granted" (the user has granted DOM paste access to
3064         the page), or "Denied" (the user has prevented the page from reading the contents of the clipboard). When DOM
3065         paste access is granted or rejected, make this decision sticky until the end of the current user gesture.
3066
3067         * editing/EditorCommand.cpp:
3068         (WebCore::executePaste):
3069         (WebCore::executePasteAndMatchStyle):
3070         (WebCore::executePasteAsPlainText):
3071         (WebCore::executePasteAsQuotation):
3072
3073         When executing a paste command where the source is DOM bindings, request DOM paste if needed before proceeding
3074         with the paste.
3075
3076         (WebCore::supportedPaste):
3077         * loader/EmptyClients.cpp:
3078         * page/EditorClient.h:
3079         * page/Frame.cpp:
3080         (WebCore::Frame::requestDOMPasteAccess):
3081
3082         Add a helper method that requests access to the clipboard on behalf of script when pasting.
3083
3084         * page/Frame.h:
3085         * page/Settings.yaml:
3086
3087         Introduce a new WebCore setting, used to gate DOM paste access requests.
3088
3089 2019-02-12  Alex Christensen  <achristensen@webkit.org>
3090
3091         Remove setDefersLoading infrastructure from WebKit2
3092         https://bugs.webkit.org/show_bug.cgi?id=194506
3093
3094         Reviewed by Brady Eidson.
3095
3096         setDefersLoading is inherently racy from WebCore to the NetworkProcess,
3097         it adds unwanted complexity to the initialization and use of network objects,
3098         and it has led to many unrecoverable hang bugs over the years.
3099         We needed to force it into WebKit2 to transition some existing clients who relied on it,
3100         but we have recently finished transitioning those clients to other solutions, mostly
3101         completion handlers.
3102
3103         * inspector/PageScriptDebugServer.cpp:
3104         (WebCore::PageScriptDebugServer::setJavaScriptPaused):
3105
3106 2019-02-12  Michael Catanzaro  <mcatanzaro@igalia.com>
3107
3108         Unreviewed, fix build warnings after content extensions enablement
3109         https://bugs.webkit.org/show_bug.cgi?id=193622
3110         <rdar://problem/47982850>
3111
3112         * contentextensions/DFABytecode.h:
3113         (WebCore::ContentExtensions::instructionSizeWithArguments):
3114         * contentextensions/DFABytecodeCompiler.h:
3115         * contentextensions/URLFilterParser.cpp:
3116         (WebCore::ContentExtensions::URLFilterParser::statusString):
3117
3118 2019-02-12  Justin Fan  <justin_fan@apple.com>
3119
3120         [Web GPU] DepthStencilAttachment implementation
3121         https://bugs.webkit.org/show_bug.cgi?id=194458
3122         <rdar://problem/47932446>
3123
3124         Reviewed by Dean Jackson.
3125
3126         Implement ability to provide a depth attachment to the render pass encoder. Also implement
3127         GPULoad/StoreOp and update color attachments' implementation for full functionality.
3128
3129         Test: webgpu/depth-enabled-triangle-strip.html
3130
3131         Update project files for new symbols:
3132         * CMakeLists.txt:
3133         * DerivedSources-input.xcfilelist:
3134         * DerivedSources-output.xcfilelist:
3135         * DerivedSources.make:
3136         * Sources.txt:
3137         * WebCore.xcodeproj/project.pbxproj:
3138
3139         * Modules/webgpu/GPUColor.idl: Renamed from WebGPUColor.idl
3140         * Modules/webgpu/GPULoadOp.idl: Added. Interface for attachment operation enum.
3141         * Modules/webgpu/GPUStoreOp.idl: Ditto.
3142         * Modules/webpug/WebGPUColor.h: Removed.
3143         * Modules/webgpu/WebGPUCommandBuffer.cpp: Refactored descriptor validation logic out of this file.
3144         (WebCore::WebGPUCommandBuffer::beginRenderPass):
3145         * Modules/webgpu/WebGPURenderPassDescriptor.cpp: Added. Now owns code for validating descriptors.
3146         (WebCore::WebGPURenderPassDescriptor::validateAndConvertToGPUVersion const):
3147         * Modules/webgpu/WebGPURenderPassColorAttachmentDescriptor.h/idl: Removed. Code moved into WebGPURenderPassDescriptor.
3148         * Modules/webgpu/WebGPURenderPassDescriptor.h: Move sub-descriptor definitions into this file.
3149         * Modules/webgpu/WebGPURenderPassDescriptor.idl: Ditto.
3150         * Modules/webgpu/WebGPURenderPipelineDescriptor.h: Make depthStencilState optional to match API update.
3151         * Modules/webgpu/WebGPURenderPipelineDescriptor.idl: Ditto.
3152         * Modules/webgpu/WebGPUTextureView.h:
3153         * platform/graphics/gpu/GPULoadOp.h: Added.
3154         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.h: Removed (moved into GPURenderPassDescriptor).
3155         * platform/graphics/gpu/GPURenderPassDescriptor.h: Mirror WebGPU* changes.
3156         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Make depthStencilState optional.
3157         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
3158         * platform/graphics/gpu/GPUStoreOp.h: Added.
3159         * platform/graphics/gpu/GPUTexture.h:
3160         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
3161         (WebCore::loadActionForGPULoadOp): Added.
3162         (WebCore::storeActionForGPUStoreOp): Added.
3163         (WebCore::populateMtlColorAttachmentsArray): Added. Create all expected color attachments, rather than just the first.
3164         (WebCore::populateMtlDepthStencilAttachment): Added.
3165         (WebCore::GPURenderPassEncoder::create):
3166         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm: Make depthStencilState optional.
3167         (WebCore::GPURenderPipeline::create):
3168
3169 2019-02-12  David Kilzer  <ddkilzer@apple.com>
3170
3171         REGRESSION (r238955, r240494): Soft-linking optional Lookup.framework triggers release assertion when missing
3172         <https://webkit.org/b/194529>
3173         <rdar://problem/47924449>
3174
3175         Reviewed by Eric Carlson.
3176
3177         * SourcesCocoa.txt:
3178         - Do not include DataDetectorsCoreSoftLink.mm in unified
3179           sources.
3180         * WebCore.xcodeproj/project.pbxproj:
3181         - Add DataDetectorsCoreSoftLink.mm to the WebCore target now
3182           that it isn't part of the unifed sources.
3183         * platform/cocoa/DataDetectorsCoreSoftLink.mm:
3184         - Switch from using SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL() to
3185           SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE() when linking
3186           DataDetectorsCore.framework. None of the other macros assume
3187           this framework is optional, and it was likely made optional
3188           originally because the framework was new to iOS and thus
3189           didn't exist on older versions.
3190         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3191         - Change use of SOFT_LINK_CLASS_FOR_SOURCE() macros to
3192           SOFT_LINK_CLASS() since the latter can only be used with
3193           SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation).  This broke after
3194           the fix for <wtf/SoftLinking.h> was applied.
3195
3196 2019-02-12  Youenn Fablet  <youenn@apple.com>
3197
3198         Make use of is<SubresourceLoader>
3199         https://bugs.webkit.org/show_bug.cgi?id=194541
3200
3201         Reviewed by Alex Christensen.
3202
3203         No change of behavior.
3204
3205         * inspector/agents/InspectorNetworkAgent.cpp:
3206         (WebCore::InspectorNetworkAgent::didReceiveResponse):
3207         * loader/SubresourceLoader.h:
3208         (isType):
3209
3210 2019-02-12  Mark Lam  <mark.lam@apple.com>
3211
3212         Add some null checks in JSNodeCustom.h's root() and generated isReachableFromOpaqueRoots() functions.
3213         https://bugs.webkit.org/show_bug.cgi?id=194530
3214         <rdar://problem/47973274>
3215
3216         Reviewed by Chris Dumez.
3217
3218         This is needed to fix a null pointer dereference that arises from the following scenario:
3219         1. a Document detaches from its StyleSheetList.
3220         2. the JSStyleSheetList that is associated with the detached StyleSheetList has yet
3221            to be scanned and collected by the GC.
3222         3. the GC eventually looks for the opaque root of the StyleSheetList's owner, and
3223            discovers a null owner pointer.
3224
3225         This patch fixes this issue by applying the following null checks:
3226
3227         1. Add a null check in JSNodeCustom.h's root().
3228
3229            root() is called from a isReachableFromOpaqueRoots() generated by CodeGeneratorJS.pm.
3230            isReachableFromOpaqueRoots() calls a ownerNode() method and passes its result
3231            to root().  However, depending on which class the ownerNode() method belongs to,
3232            it can either return a pointer or a reference.  The null check only makes sense
3233            in the pointer case.
3234
3235            To accommodate the 2 forms, root() itself is has an overload that takes a
3236            reference instead of a pointer.
3237
3238            Since CodeGeneratorJS.pm can't tell what the generated class' ownerNode()
3239            returns, it can't discern when the result is a pointer and apply the null check.
3240            Instead, we just add the null check to the version of root() that takes a
3241            pointer.  If the node pointer is null, we'll return a null opaque root.
3242
3243         2. Fix CodeGeneratorJS.pm to null check the opaque root before using it.
3244
3245         * bindings/js/JSNodeCustom.h:
3246         (WebCore::root):
3247         * bindings/scripts/CodeGeneratorJS.pm:
3248         (GenerateImplementation):
3249         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
3250         (WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots):
3251
3252 2019-02-12  Andy Estes  <aestes@apple.com>
3253
3254         [iOSMac] Enable Parental Controls Content Filtering
3255         https://bugs.webkit.org/show_bug.cgi?id=194521
3256         <rdar://39732376>
3257
3258         Reviewed by Tim Horton.
3259
3260         * Configurations/FeatureDefines.xcconfig:
3261         * platform/ContentFilterUnblockHandler.h:
3262         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
3263         * platform/cocoa/ParentalControlsContentFilter.mm:
3264
3265 2019-02-11  Jer Noble  <jer.noble@apple.com>
3266
3267         Unreviewed build fix; add a HAVE_CELESTIAL guard around Celestial framework usage.
3268
3269         * platform/audio/ios/MediaSessionManagerIOS.h:
3270         * platform/audio/ios/MediaSessionManagerIOS.mm:
3271         (WebCore::MediaSessionManageriOS::providePresentingApplicationPIDIfNecessary):
3272
3273 2019-02-12  Antti Koivisto  <antti@apple.com>
3274
3275         Crash in WebCore::ScrollingTree::updateTreeFromStateNode
3276         https://bugs.webkit.org/show_bug.cgi?id=194538
3277         <rdar://problem/47841926>
3278
3279         Reviewed by Zalan Bujtas.
3280
3281         * page/scrolling/ScrollingTree.cpp:
3282         (WebCore::ScrollingTree::updateTreeFromStateNode):
3283
3284         Make sure we don't leave node entry behind in m_nodeMap in case we failed to add it to the parent.
3285
3286 2019-02-12  Zalan Bujtas  <zalan@apple.com>
3287
3288         [LFC] Remove redundant InlineFormattingContext::computeBorderAndPadding
3289         https://bugs.webkit.org/show_bug.cgi?id=194540
3290
3291         Reviewed by Antti Koivisto.
3292
3293         Use FormattingContext::computeBorderAndPadding instead.
3294
3295         * layout/FormattingContext.cpp:
3296         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
3297         * layout/FormattingContext.h:
3298         * layout/inlineformatting/InlineFormattingContext.cpp:
3299         (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const): Deleted.
3300         * layout/inlineformatting/InlineFormattingContext.h:
3301
3302 2019-02-12  Zalan Bujtas  <zalan@apple.com>
3303
3304         [LFC][IFC] Add intrinsic width support for float boxes.
3305         https://bugs.webkit.org/show_bug.cgi?id=194528
3306
3307         Reviewed by Antti Koivisto.
3308
3309         This patch implements a very simple float box support for intrinsic width.
3310
3311         * layout/inlineformatting/InlineFormattingContext.cpp:
3312         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
3313         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFloatBox const):
3314         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForInlineBlock const):
3315         (WebCore::Layout::InlineFormattingContext::computeMargin const):
3316         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const): Deleted.
3317         * layout/inlineformatting/InlineFormattingContext.h:
3318
3319 2019-02-12  Rob Buis  <rbuis@igalia.com>
3320
3321         Implement serializing in MIME type parser
3322         https://bugs.webkit.org/show_bug.cgi?id=193909
3323
3324         Reviewed by Darin Adler.
3325
3326         Implement serializing in MIME type parser [1], to preserve the parameter
3327         order the Vector m_parameterNames is introduced, since HashMaps do not
3328         guarantee any order.
3329
3330         Test: ParsedContentType.Serialize
3331
3332         [1] https://mimesniff.spec.whatwg.org/#serializing-a-mime-type
3333
3334         * platform/network/ParsedContentType.cpp:
3335         (WebCore::skipSpaces):
3336         (WebCore::parseQuotedString):
3337         (WebCore::ParsedContentType::parseContentType):
3338         (WebCore::ParsedContentType::parameterValueForName const):
3339         (WebCore::ParsedContentType::parameterCount const):
3340         (WebCore::ParsedContentType::setContentType):
3341         (WebCore::ParsedContentType::setContentTypeParameter):
3342         (WebCore::ParsedContentType::serialize const):
3343         * platform/network/ParsedContentType.h:
3344
3345 2019-02-08  Chris Fleizach  <cfleizach@apple.com>
3346
3347         AXObjectCache::childrenChanged shouldn't update layout or style during another style recalc
3348         https://bugs.webkit.org/show_bug.cgi?id=182280
3349         <rdar://problem/37018386>
3350
3351         Reviewed by Alan Bujtas.
3352
3353         Remove the possibility that changing children calls back into updating layout by
3354         handling children changes in a deferred manner.
3355
3356         This follows the same architecture as many other deferred changes, but also requires us to check deferred changes
3357         in updateBackingStore, because things like aria-hidden changes won't trigger a layout, but will require us to update children.
3358
3359         A few tests had to be modified to no longer change the tree and then check the children immediately. 
3360
3361         * accessibility/AXObjectCache.cpp:
3362         (WebCore::AXObjectCache::remove):
3363         (WebCore::AXObjectCache::childrenChanged):
3364         (WebCore::AXObjectCache::prepareForDocumentDestruction):
3365         (WebCore::AXObjectCache::performDeferredCacheUpdate):
3366         * accessibility/AXObjectCache.h:
3367         * accessibility/AccessibilityObject.cpp:
3368         (WebCore::AccessibilityObject::updateBackingStore):
3369         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
3370         (convertToNSArray):
3371         (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):
3372
3373 2019-02-11  Myles C. Maxfield  <mmaxfield@apple.com>
3374
3375         [Cocoa] Ask platform for generic font family mappings
3376         https://bugs.webkit.org/show_bug.cgi?id=187723
3377         <rdar://problem/41892438>
3378
3379         Reviewed by Brent Fulgham.
3380
3381         WebKit API allows setting the generic font families for the USCRIPT_COMMON script.
3382         When trying to style a character with a generic font family, we first look to see if
3383         we have a mapping for the particular script the character is rendered with, and if we
3384         don't find a match, we then check USCRIPT_COMMON.
3385
3386         In the Cocoa ports, the only way families get set for non-USCRIPT_COMMON scripts (aka
3387         the only scripts which won't use the API families) is in
3388         SettingsBase::initializeDefaultFontFamilies(). That function only sets the families
3389         for the CJK scripts.
3390
3391         The mappings inside SettingsBase are incorrect and conflict with our policy regarding
3392         user-installed fonts. Instead, we should be consulting with the platform for some of
3393         these mappings, by calling CTFontDescriptorCreateForCSSFamily(). However, the WebKit
3394         API still has to work to set the mappings for untagged content. Therefore, we use the
3395         system mappings for language-tagged content, and the API mappings for non-language-tagged
3396         content. This is a good balance that makes sure we always have a good mapping for every
3397         language, but API clients can still set the mappings, too.
3398
3399         Test: fast/text/ja-sans-serif.html
3400
3401         * css/CSSComputedStyleDeclaration.cpp:
3402         * css/CSSFontSelector.cpp:
3403         (WebCore::resolveGenericFamily):
3404         * css/parser/CSSPropertyParser.cpp:
3405         (WebCore::consumeFontFamily):
3406         * page/cocoa/SettingsBaseCocoa.mm:
3407         (WebCore::SettingsBase::initializeDefaultFontFamilies):
3408         (WebCore::osakaMonoIsInstalled): Deleted.
3409         * platform/graphics/FontDescription.cpp:
3410         (WebCore::FontDescription::platformResolveGenericFamily):
3411         * platform/graphics/FontDescription.h:
3412         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
3413         (WebCore::computeSpecializedChineseLocale):
3414         (WebCore::cachedSpecializedChineseLocale):
3415         (WebCore::languageChanged):
3416         (WebCore::FontDescription::platformResolveGenericFamily):
3417         * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
3418         (WebCore::SystemFontDatabaseCoreText::clear):
3419         (WebCore::genericFamily):
3420         (WebCore::SystemFontDatabaseCoreText::serifFamily):
3421         (WebCore::SystemFontDatabaseCoreText::sansSerifFamily):
3422         (WebCore::SystemFontDatabaseCoreText::cursiveFamily):
3423         (WebCore::SystemFontDatabaseCoreText::fantasyFamily):
3424         (WebCore::SystemFontDatabaseCoreText::monospaceFamily):
3425         * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
3426
3427 2019-02-11  Adrian Perez de Castro  <aperez@igalia.com>
3428
3429         [GTK][WPE] Add content extensions support in WKTR and unskip layout tests
3430         https://bugs.webkit.org/show_bug.cgi?id=193622
3431
3432         Reviewed by Michael Catanzaro.
3433
3434         No new tests needed.
3435
3436         * SourcesCocoa.txt: Remove loader/ResourceLoadInfo.cpp, it's not Cocoa-specific anymore.
3437         * Sources.txt: Add loader/ResourceLoadInfo.cpp, all ports use it now.
3438
3439 2019-02-11  Daniel Bates  <dabates@apple.com>
3440
3441         [iOS] Mouse/Touch/Pointer events are missing modifier keys
3442         https://bugs.webkit.org/show_bug.cgi?id=191446
3443         <rdar://problem/45929460>
3444
3445         Reviewed by Tim Horton.
3446
3447         Extract the modifier flags from the WebEvent. This code is only used by Legacy WebKit
3448         on iOS and we will need to fix <rdar://problem/47929759> in order for modifier flags
3449         to be passed to WebKit.
3450
3451         Tests: fast/events/touch/ios/mouse-events-with-modifiers.html
3452                fast/events/touch/ios/pointer-events-with-modifiers.html
3453                fast/events/touch/ios/touch-events-with-modifiers.html
3454
3455         * platform/ios/PlatformEventFactoryIOS.mm:
3456         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
3457         * platform/ios/WebEvent.h:
3458         * platform/ios/WebEvent.mm:
3459         (-[WebEvent initWithMouseEventType:timeStamp:location:]):
3460         (-[WebEvent initWithMouseEventType:timeStamp:location:modifiers:]):
3461
3462 2019-02-11  Jer Noble  <jer.noble@apple.com>
3463
3464         [Cocoa] Notify AVSystemController of our presenting PID before registering as a Now Playing app.
3465         https://bugs.webkit.org/show_bug.cgi?id=194504
3466
3467         Reviewed by Eric Carlson.
3468
3469         This allows the MediaRemote framework to associate the WebContent process with its host application.
3470
3471         * Modules/mediastream/UserMediaRequest.cpp:
3472         (WebCore::UserMediaRequest::start):
3473         * platform/audio/PlatformMediaSessionManager.h:
3474         (WebCore::PlatformMediaSessionManager::prepareToSendUserMediaPermissionRequest):
3475         * platform/audio/cocoa/MediaSessionManagerCocoa.h:
3476         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
3477         (MediaSessionManagerCocoa::prepareToSendUserMediaPermissionRequest):
3478         (MediaSessionManagerCocoa::providePresentingApplicationPIDIfNecessary):
3479         (MediaSessionManagerCocoa::updateNowPlayingInfo):
3480
3481 2019-02-11  Commit Queue  <commit-queue@webkit.org>
3482
3483         Unreviewed, rolling out r241272 and r241276.
3484         https://bugs.webkit.org/show_bug.cgi?id=194514
3485
3486         Broke the Apple Internal build and the fix requires human
3487         intervention :( (Requested by dydz on #webkit).
3488
3489         Reverted changesets:
3490
3491         "[iOS] Mouse/Touch/Pointer events are missing modifier keys"
3492         https://bugs.webkit.org/show_bug.cgi?id=191446
3493         https://trac.webkit.org/changeset/241272
3494
3495         "Fix internal iOS build after r241272"
3496         https://bugs.webkit.org/show_bug.cgi?id=191446
3497         https://trac.webkit.org/changeset/241276
3498
3499 2019-02-11  Alex Christensen  <achristensen@webkit.org>
3500
3501         Stop using setDefersLoading from WebCore
3502         https://bugs.webkit.org/show_bug.cgi?id=194315
3503
3504         Reviewed by Jer Noble.
3505
3506         That is what CompletionHandlers are for.
3507
3508         * loader/MediaResourceLoader.cpp:
3509         (WebCore::MediaResource::responseReceived):
3510         (WebCore::MediaResource::setDefersLoading): Deleted.
3511         * loader/MediaResourceLoader.h:
3512         * platform/graphics/PlatformMediaResourceLoader.h:
3513         (WebCore::PlatformMediaResourceClient::responseReceived):
3514         (WebCore::PlatformMediaResource::stop):
3515         (WebCore::PlatformMediaResource::setDefersLoading): Deleted.
3516         * platform/network/cocoa/WebCoreNSURLSession.mm:
3517         (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived):
3518         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:completionHandler:]):
3519         (-[WebCoreNSURLSessionDataTask _setDefersLoading:]): Deleted.
3520         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]): Deleted.
3521
3522 2019-02-11  Daniel Bates  <dabates@apple.com>
3523
3524         [iOS] Mouse/Touch/Pointer events are missing modifier keys
3525         https://bugs.webkit.org/show_bug.cgi?id=191446
3526         <rdar://problem/45929460>
3527
3528         Reviewed by Tim Horton.
3529
3530         Extract the modifier flags from the WebEvent. This code is only used by Legacy WebKit
3531         on iOS and we will need to fix <rdar://problem/47929759> in order for modifier flags
3532         to be passed to WebKit.
3533
3534         Tests: fast/events/touch/ios/mouse-events-with-modifiers.html
3535                fast/events/touch/ios/pointer-events-with-modifiers.html
3536                fast/events/touch/ios/touch-events-with-modifiers.html
3537
3538         * platform/ios/PlatformEventFactoryIOS.mm:
3539         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
3540         * platform/ios/WebEvent.h:
3541         * platform/ios/WebEvent.mm:
3542         (-[WebEvent initWithMouseEventType:timeStamp:location:]):
3543         (-[WebEvent initWithMouseEventType:timeStamp:location:modifiers:]):
3544
3545 2019-02-11  Daniel Bates  <dabates@apple.com>
3546
3547         Separate out outline-style: auto user-agent appearance from Mac animated focus ring drawing
3548         https://bugs.webkit.org/show_bug.cgi?id=193591
3549
3550         Reviewed by Simon Fraser.
3551
3552         Untangle the Mac-specific concept of animated focus ring drawing from the concepts of using
3553         the fancy shrink-wrapped focus ring appearance and using the platform focus ring color when
3554         outline-style: auto.
3555
3556         No functionality changed. So, no new tests.
3557
3558         * platform/graphics/GraphicsContext.h:
3559         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
3560         (WebCore::drawFocusRing):
3561         (WebCore::drawFocusRingToContextAtTime):
3562         Change some macro guards.
3563
3564         * rendering/RenderElement.cpp:
3565         (WebCore::usePlatformFocusRingColorForOutlineStyleAuto): Added.
3566         (WebCore::useShrinkWrappedFocusRingForOutlineStyleAuto): Added.
3567         (WebCore::drawFocusRing): Added.
3568         (WebCore::RenderElement::paintFocusRing): Write in terms of drawFocusRing().
3569
3570 2019-02-11  Truitt Savell  <tsavell@apple.com>
3571
3572         Unreviewed, rolling out r241229.
3573
3574         Revision broke internal builds for watchOS.
3575
3576         Reverted changeset:
3577
3578         "[Cocoa] Ask platform for generic font family mappings"
3579         https://bugs.webkit.org/show_bug.cgi?id=187723
3580         https://trac.webkit.org/changeset/241229
3581
3582 2019-02-11  Youenn Fablet  <youenn@apple.com>
3583
3584         Make Request constructor throw if FetchRequestInit.signal is not undefined, null or an AbortSignal object
3585         https://bugs.webkit.org/show_bug.cgi?id=194404
3586         <rdar://problem/47891915>
3587
3588         Reviewed by Geoffrey Garen.
3589
3590         Align with the spec, except for known problematic web sites.
3591         Covered by updated test.
3592
3593         * Modules/fetch/FetchRequest.cpp:
3594         (WebCore::needsSignalQuirk):
3595         (WebCore::processInvalidSignal):
3596         (WebCore::FetchRequest::initializeWith):
3597
3598 2019-02-11  Zalan Bujtas  <zalan@apple.com>
3599
3600         [LFC] FormattingContext::Geometry::floatingHeightAndMargin should take UsedHorizontalValues
3601         https://bugs.webkit.org/show_bug.cgi?id=194490
3602
3603         Reviewed by Antti Koivisto.
3604
3605         This is in preparation for adding floating preferred width computation support. It requires height computaiton
3606         which uses containing block width to resolve vertical margins.
3607
3608         * layout/FormattingContext.cpp:
3609         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
3610         * layout/FormattingContext.h:
3611         * layout/FormattingContextGeometry.cpp:
3612         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
3613         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
3614         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
3615         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
3616         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
3617         (WebCore::Layout::FormattingContext::Geometry::computedVerticalMargin):
3618         * layout/FormattingContextQuirks.cpp:
3619         (WebCore::Layout::FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight):
3620         * layout/LayoutUnits.h:
3621         (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):
3622         * layout/blockformatting/BlockFormattingContext.cpp:
3623         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
3624         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3625         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
3626         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
3627         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
3628         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
3629         * layout/blockformatting/BlockMarginCollapse.cpp:
3630         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues):
3631         (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore):
3632         * layout/inlineformatting/InlineFormattingContext.cpp:
3633         (WebCore::Layout::InlineFormattingContext::layout const):
3634         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
3635         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
3636         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin):
3637
3638 2019-02-11  Zalan Bujtas  <zalan@apple.com>
3639
3640         [LFC] FormattingContext::intrinsicWidthConstraints should compute and save the intrinsic widths consistently.
3641         https://bugs.webkit.org/show_bug.cgi?id=194483
3642
3643         Reviewed by Antti Koivisto.
3644
3645         Rename intrinsicWidthConstraints to computeIntrinsicWidthConstraints (it does not return the width values anymore).
3646
3647         * layout/FormattingContext.h:
3648         * layout/FormattingContextGeometry.cpp:
3649         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
3650         * layout/blockformatting/BlockFormattingContext.cpp:
3651         (WebCore::Layout::BlockFormattingContext::computeIntrinsicWidthConstraints const):
3652         (WebCore::Layout::BlockFormattingContext::intrinsicWidthConstraints const): Deleted.
3653         * layout/blockformatting/BlockFormattingContext.h:
3654         * layout/inlineformatting/InlineFormattingContext.cpp:
3655         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
3656         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const):
3657         (WebCore::Layout::InlineFormattingContext::intrinsicWidthConstraints const): Deleted.
3658         * layout/inlineformatting/InlineFormattingContext.h:
3659
3660 2019-02-10  Zalan Bujtas  <zalan@apple.com>
3661
3662         [LFC] Fix spelling error.
3663         https://bugs.webkit.org/show_bug.cgi?id=194489
3664
3665         Reviewed by Simon Fraser.
3666
3667         instrinsic -> intrinsic
3668
3669         * layout/FormattingContext.h:
3670         * layout/FormattingContextGeometry.cpp:
3671         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
3672         * layout/FormattingState.h:
3673         (WebCore::Layout::FormattingState::setIntrinsicWidthConstraints):
3674         (WebCore::Layout::FormattingState::clearIntrinsicWidthConstraints):
3675         (WebCore::Layout::FormattingState::intrinsicWidthConstraints const):
3676         (WebCore::Layout::FormattingState::setInstrinsicWidthConstraints): Deleted.
3677         (WebCore::Layout::FormattingState::clearInstrinsicWidthConstraints): Deleted.
3678         (WebCore::Layout::FormattingState::instrinsicWidthConstraints const): Deleted.
3679         * layout/blockformatting/BlockFormattingContext.cpp:
3680         (WebCore::Layout::BlockFormattingContext::intrinsicWidthConstraints const):
3681         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const): Deleted.
3682         * layout/blockformatting/BlockFormattingContext.h:
3683         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3684         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraintsNeedChildrenWidth):
3685         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
3686         (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraintsNeedChildrenWidth): Deleted.
3687         (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraints): Deleted.
3688         * layout/inlineformatting/InlineFormattingContext.cpp:
3689         (WebCore::Layout::InlineFormattingContext::intrinsicWidthConstraints const):
3690         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const):
3691         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const): Deleted.
3692         * layout/inlineformatting/InlineFormattingContext.h:
3693
3694 2019-02-10  Darin Adler  <darin@apple.com>
3695
3696         Switch uses of StringBuilder with String::format for hex numbers to use HexNumber.h instead
3697         https://bugs.webkit.org/show_bug.cgi?id=194485
3698
3699         Reviewed by Daniel Bates.
3700
3701         * Modules/websockets/WebSocket.cpp:
3702         (WebCore::encodeProtocolString): Use appendUnsignedAsHexFixedSize instead of String::format.
3703
3704         * css/parser/CSSParserToken.cpp:
3705         (WebCore::CSSParserToken::serialize const): Fixed style of many return statements
3706         that called a function returning void; doesn't match WebKit's prevailing style.
3707         Also use break instead of return. Used appendLiteral instead of append in many
3708         cases, and append character instead of single-character literal in others.
3709         Use appendUnsignedAsHex instead of String::format.
3710
3711         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
3712         (WebCore::generateHashedName): Use appendUnsignedAsHex instad of appendUnsigned64AsHex.
3713         Should come back here and use makeString once we make HexNumber.h work with that.
3714
3715         * platform/mac/WebCoreNSURLExtras.mm: Removed unnecessary include of HexNumber.h.
3716
3717         * rendering/RenderTreeAsText.cpp:
3718         (WebCore::quoteAndEscapeNonPrintables): Use appendLiteral instead of multiple calls
3719         to character append. Touched because it was next to a call to appendUnsignedAsHex.
3720
3721 2019-02-10  Pablo Saavedra  <psaavedra@igalia.com>
3722
3723         libWPEWebKit-0.1.so: undefined reference to `JSC::JSValue::asCell() const
3724         https://bugs.webkit.org/show_bug.cgi?id=194484
3725
3726         Reviewed by Darin Adler.
3727
3728         * bindings/js/JSUndoItemCustom.cpp:
3729
3730 2019-02-10  Philippe Normand  <pnormand@igalia.com>
3731
3732         Unreviewed, GTK Debug build fix after r241148.
3733
3734         * Modules/mediasource/SourceBuffer.cpp:
3735         (WebCore::removeSamplesFromTrackBuffer):
3736         SourceBuffer::logClassName and friends are declared for
3737         !RELEASE_LOG_DISABLED builds so adapt calling sites accordingly.
3738
3739 2019-02-10  Zalan Bujtas  <zalan@apple.com>
3740
3741         [LFC][IFC] Add intrinsic width support for inline-block boxes
3742         https://bugs.webkit.org/show_bug.cgi?id=194479
3743
3744         Reviewed by Antti Koivisto.
3745
3746         Compute the intrinsic width for the inline-block (formatting context root) and set it as the content box width while
3747         laying out the content for the min/max width.
3748
3749         <div style="position: absolute">before<span id=inline-block style="display: inline-block">inline_block content<span>after</div>
3750
3751         The "inline-block" formatting root returns "inline_block" width for the minimum and "inline_block width" for
3752         the maximum width. These min/max values are used to figure out the intrinsic width for the parent <div>.
3753
3754         * layout/inlineformatting/InlineFormattingContext.cpp:
3755         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
3756         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingContextRoot const):
3757         (WebCore::Layout::InlineFormattingContext::computeMargin const):
3758         * layout/inlineformatting/InlineFormattingContext.h:
3759         * page/FrameViewLayoutContext.cpp:
3760         (WebCore::layoutUsingFormattingContext):
3761
3762 2019-02-10  Zalan Bujtas  <zalan@apple.com>
3763
3764         [LFC][IFC] Add intrinsic width support for replaced boxes
3765         https://bugs.webkit.org/show_bug.cgi?id=194478
3766
3767         Reviewed by Antti Koivisto.
3768
3769         * layout/inlineformatting/InlineFormattingContext.cpp:
3770         (WebCore::Layout::InlineFormattingContext::layout const):
3771         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
3772         (WebCore::Layout::InlineFormattingContext::computeMargin const):
3773         (WebCore::Layout::InlineFormattingContext::computeBorderAndPadding const):
3774         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
3775         (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForReplacedInlineBox const):
3776         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPadding const): Deleted.
3777         * layout/inlineformatting/InlineFormattingContext.h:
3778
3779 2019-02-10  Alicia Boya García  <aboya@igalia.com>
3780
3781         [MSE][GStreamer] Add missing return type to lambda
3782         https://bugs.webkit.org/show_bug.cgi?id=194414
3783
3784         Reviewed by Darin Adler.
3785
3786         Since g_signal_connect() is untyped, a compiler error was not
3787         generated when a lambda with a missing GstFlowReturn return type was
3788         provided for a signal that expects it.
3789
3790         This used to work before r240784 because a recent function call had
3791         set GST_FLOW_OK in the return value register and it happened to
3792         survive until the lambda function call ended. Starting on that commit
3793         such return value was removed and it stopped working on debug.
3794
3795         Of course, the actual problem is in the signature of the lambda
3796         function, and this patch fixes that.
3797
3798         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3799         (WebCore::AppendPipeline::AppendPipeline):
3800
3801 2019-02-09  Darin Adler  <darin@apple.com>
3802
3803         Eliminate unnecessary String temporaries by using StringConcatenateNumbers
3804         https://bugs.webkit.org/show_bug.cgi?id=194021
3805
3806         Reviewed by Geoffrey Garen.
3807
3808         For floating point numbers, String::number gives a fixed precision result,
3809         stripping trailing zeroes. When possible, I changed the code to instead use the
3810         equivalent of String::numberToStringECMAScript, which is what makeString does by
3811         default for floating point, gives the same results for many cases, and gives
3812         better results in many others. However, for floats, we do not yet have a good
3813         implementation, so instead I used FormattedNumber::fixedPrecision to match
3814         the old behavior.
3815
3816         * Modules/indexeddb/shared/IDBTransactionInfo.cpp:
3817         (WebCore::IDBTransactionInfo::loggingString const): Remove String::number and let
3818         makeString do the conversion without allocating/destroying a String.
3819         * Modules/websockets/ThreadableWebSocketChannel.cpp:
3820         (WebCore::ThreadableWebSocketChannel::create): Ditto.
3821         * Modules/websockets/WebSocket.cpp:
3822         (WebCore::WebSocket::connect): Ditto. Added a cast to "unsigned" to sidestep the
3823         ambiguity with 16-bit unsigned types that are sometimes used for numbers (uint16_t)
3824         and sometimes used for UTF-16 code units (UChar) and can be the same type.
3825
3826         * Modules/websockets/WebSocketChannel.cpp:
3827         (WebCore::WebSocketChannel::didFailSocketStream): Use ASCIILiteral when intializing
3828         a string instead of just a normal C literal. Switched to makeString so we could
3829         remove String::number and do the conversion without allocating/destroying a String.
3830         (WebCore::WebSocketChannel::didFail): Ditto.
3831         (WebCore::WebSocketChannel::processFrame): Ditto.
3832         * Modules/websockets/WebSocketFrame.cpp:
3833         (WebCore::WebSocketFrame::parseFrame): Ditto.
3834         * Modules/websockets/WebSocketHandshake.cpp:
3835         (WebCore::WebSocketHandshake::readServerHandshake): Ditto.
3836         * accessibility/AccessibilityRenderObject.cpp:
3837         (WebCore::AccessibilityRenderObject::positionalDescriptionForMSAA const): Ditto.
3838         * bindings/js/JSDOMConvertNumbers.cpp:
3839         (WebCore::rangeErrorString): Ditto.
3840         * css/CSSAspectRatioValue.cpp:
3841         (WebCore::CSSAspectRatioValue::customCSSText const): Ditto. Used
3842         FormattedNumber::fixedPrecision since these are floats.
3843
3844         * css/DOMMatrixReadOnly.cpp:
3845         (WebCore::DOMMatrixReadOnly::toString const): Use
3846         StringBuilder::builder.appendECMAScriptNumber instead of
3847         String::numberToStringECMAScript so we can do it without allocating/destroying
3848         a String.
3849         * css/WebKitCSSMatrix.cpp:
3850         (WebCore::WebKitCSSMatrix::toString const): Ditto.
3851
3852         * dom/MessagePortIdentifier.h:
3853         (WebCore::MessagePortIdentifier::logString const): Remove String::number and let
3854         makeString do the conversion without allocating/destroying a String.
3855
3856         * editing/cocoa/DataDetection.mm:
3857         (WebCore::dataDetectorStringForPath): Remove unnecessary type casts on values
3858         passed to String::number and to StringBuilder::appendNumber. These could do
3859         harm if the values were out of range, and should not be necessary.
3860
3861         * history/BackForwardItemIdentifier.h:
3862         (WebCore::BackForwardItemIdentifier::logString const): Remove String::number
3863         and let makeString do the conversion without allocating/destroying a String.
3864         * html/FTPDirectoryDocument.cpp:
3865         (WebCore::processFileDateString): Ditto.
3866         * html/canvas/WebGLRenderingContextBase.cpp:
3867         (WebCore::WebGLRenderingContextBase::getUniformLocation): Ditto.
3868         (WebCore::WebGLRenderingContextBase::checkTextureCompleteness): Ditto.
3869         * inspector/agents/WebConsoleAgent.cpp:
3870         (WebCore::WebConsoleAgent::didReceiveResponse): Ditto.
3871         * loader/WorkerThreadableLoader.cpp:
3872         (WebCore::WorkerThreadableLoader::loadResourceSynchronously): Ditto.
3873         * loader/appcache/ApplicationCacheGroup.cpp:
3874         (WebCore::ApplicationCacheGroup::didFailLoadingManifest): Ditto.
3875         * page/PageSerializer.cpp:
3876         (WebCore::PageSerializer::urlForBlankFrame): Ditto.
3877         * page/PrintContext.cpp:
3878         (WebCore::PrintContext::pageProperty): Ditto.
3879         (WebCore::PrintContext::pageSizeAndMarginsInPixels): Ditto.
3880
3881         * page/WheelEventTestTrigger.cpp:
3882         (WebCore::dumpState): Use StringBuilder::appendNumber instead of
3883         String::number so we can do it without allocating/destroying a String.
3884         Also use StringBuilder::appendLiteral on a literal.
3885
3886         * page/cocoa/ResourceUsageOverlayCocoa.mm:
3887         (WebCore::ResourceUsageOverlay::platformDraw): Pass explicit
3888         KeepTrailingZeros to FormattedNumber::fixedPrecision to preserve behavior,
3889         since default is now to truncate trailing zeros.
3890
3891         * platform/graphics/Color.cpp:
3892         (WebCore::Color::cssText): Use StringBuilder::appendNumber instead of
3893         calling numberToFixedPrecisionString to do the same thing.
3894         * platform/graphics/ExtendedColor.cpp:
3895         (WebCore::ExtendedColor::cssText): Ditto.
3896
3897         * platform/graphics/ca/GraphicsLayerCA.cpp:
3898         (WebCore::animationIdentifier): Remove String::number and let makeString
3899         do the conversion without allocating/destroying a String. Had to add
3900         a typecast to convert the enumeration into an integer.
3901         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
3902         (WebCore::PlatformCAFilters::setFiltersOnLayer): Ditto.
3903         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
3904         (WebCore::FontPlatformData::description const): Ditto.
3905
3906         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
3907         (WebCore::MockMediaSample::MockMediaSample): Use AtomicString::number
3908         instead of String::number to avoid unneccessarily allocating an additional
3909         temporary String when an AtomicString already exists.
3910
3911         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
3912         (WebCore::SocketStreamHandleImpl::reportErrorToClient): Remove String::number
3913         and let makeString do the conversion without allocating/destroying a String.
3914         * platform/sql/SQLiteDatabase.cpp:
3915         (WebCore::SQLiteDatabase::setMaximumSize): Ditto.
3916         (WebCore::SQLiteDatabase::setSynchronous): Ditto. Had to add a typecast to
3917         convert the enumeration into an integer.
3918         * svg/SVGAngleValue.cpp:
3919         (WebCore::SVGAngleValue::valueAsString const): Ditto.
3920         * svg/SVGLengthValue.cpp:
3921         (WebCore::SVGLengthValue::valueAsString const): Ditto.
3922         * testing/Internals.cpp:
3923         (WebCore::Internals::configurationForViewport): Ditto. Used
3924         FormattedNumber::fixedPrecision since these are floats.
3925         (WebCore::Internals::getCurrentCursorInfo): Use StringBuilder::appendNumber
3926         instead of calling numberToFixedPrecisionString to do the same thing.
3927         (WebCore::Internals::queueMicroTask): Remove String::number and let makeString
3928         do the conversion without allocating/destroying a String.
3929         (WebCore::appendOffsets): Use StringBuilder::appendNumber instead of
3930         String::number so we can do it without allocating/destroying a String.
3931
3932         * workers/service/ServiceWorkerClientIdentifier.h:
3933         (WebCore::ServiceWorkerClientIdentifier::toString const): Remove String::number
3934         and let makeString do the conversion without allocating/destroying a String.
3935         * workers/service/server/RegistrationDatabase.cpp:
3936         (WebCore::databaseFilenameFromVersion): Ditto.
3937
3938 2019-02-09  Zalan Bujtas  <zalan@apple.com>
3939
3940         [LFC][IFC] Add intrinsic width support for basic inline containers
3941         https://bugs.webkit.org/show_bug.cgi?id=194473
3942
3943         Reviewed by Antti Koivisto.
3944
3945         Preferred width computation logic is very similar to normal layout.
3946         One of the main difference is that the preferred width codepath does not provide valid containing block width.
3947         This patch implement basic inline container support by passing nullopt containing block width in UsedHorizontalValues.