[Datalist] Add button to TextFieldInputs with a datalist
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-07-26  Aditya Keerthi  <akeerthi@apple.com>
2
3         [Datalist] Add button to TextFieldInputs with a datalist
4         https://bugs.webkit.org/show_bug.cgi?id=187741
5
6         Reviewed by Tim Horton.
7
8         TextFieldInputs that have an associated datalist element should be drawn as
9         combo boxes. However, we cannot use NSComboBox for this control, as NSComboBox
10         is not height-resizable. Furthermore, the input should also be able to contain
11         additional elements, such as the stepper for type=number and the cancel button
12         for type=search. For these reasons, we draw a button at the end of the input,
13         mimicking appearance of a combo box.
14
15         The list-button -webkit-appearance value was added to display the new button.
16
17         Tests: fast/forms/datalist/datalist-searchinput-appearance.html
18                fast/forms/datalist/datalist-textinput-appearance.html
19
20         * Resources/ListButtonArrow.png: Added.
21         * Resources/ListButtonArrow@2x.png: Added.
22         * WebCore.xcodeproj/project.pbxproj:
23         * css/CSSPrimitiveValueMappings.h:
24         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
25         * css/CSSProperties.json:
26         * css/CSSValueKeywords.in:
27         * css/html.css:
28         (input::-webkit-list-button):
29         * html/HTMLInputElement.cpp:
30         (WebCore::HTMLInputElement::dataListButtonElement const):
31         (WebCore::HTMLInputElement::isShowingList const):
32         * html/HTMLInputElement.h:
33         * html/InputType.h:
34         (WebCore::InputType::dataListButtonElement const):
35         (WebCore::InputType::isShowingList const):
36         * html/TextFieldInputType.cpp:
37         (WebCore::TextFieldInputType::needsContainer const):
38         (WebCore::TextFieldInputType::createShadowSubtree):
39         (WebCore::TextFieldInputType::destroyShadowSubtree):
40         (WebCore::TextFieldInputType::listAttributeTargetChanged):
41         (WebCore::TextFieldInputType::dataListButtonElement const):
42         (WebCore::TextFieldInputType::dataListButtonElementWasClicked):
43         (WebCore::TextFieldInputType::didCloseSuggestions):
44         (WebCore::TextFieldInputType::isShowingList const):
45         * html/TextFieldInputType.h:
46         * html/shadow/DataListButtonElement.cpp: Added.
47         (WebCore::DataListButtonElement::create):
48         (WebCore::DataListButtonElement::DataListButtonElement):
49         (WebCore::DataListButtonElement::~DataListButtonElement):
50         (WebCore::DataListButtonElement::defaultEventHandler):
51         * html/shadow/DataListButtonElement.h: Added.
52         * platform/ThemeTypes.h:
53         * rendering/RenderTheme.cpp:
54         (WebCore::RenderTheme::adjustStyle):
55         (WebCore::RenderTheme::adjustListButtonStyle const):
56         * rendering/RenderTheme.h:
57         * rendering/RenderThemeMac.h:
58         * rendering/RenderThemeMac.mm:
59         (-[WebListButtonCell drawWithFrame:inView:]):
60         (WebCore::RenderThemeMac::paintListButtonForInput):
61         (WebCore::RenderThemeMac::adjustListButtonStyle const):
62         (WebCore::RenderThemeMac::paintTextField):
63         (WebCore::RenderThemeMac::paintSearchField):
64         (WebCore::RenderThemeMac::paintSearchFieldCancelButton):
65         (WebCore::RenderThemeMac::listButton const):
66
67 2018-07-26  Antoine Quint  <graouts@apple.com>
68
69         [Web Animations] Accelerated animations don't respect a positive delay value
70         https://bugs.webkit.org/show_bug.cgi?id=186930
71         <rdar://problem/41393393>
72
73         Reviewed by Dean Jackson.
74
75         Test: webanimations/accelerated-animation-with-delay.html
76
77         We would mistakenly clear the list of pending accelerated actions in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
78         even if we failed to proceed because of the target element's renderer not being composited yet. Now, we clear the list after
79         we've established we can apply them, and if we can't we inform the animation with a call to acceleratedStateDidChange() which
80         will in turn call into the document timeline so that we may consider these animations on the next tick.
81
82         For this to work correctly we must make a change to DocumentTimeline::applyPendingAcceleratedAnimations() which only cleared
83         its list of pending accelerated animations _after_ iterating through them, which would be problematic since we would now add
84         animations to this list. That list is now copied and cleared prior to iterating through its members.
85
86         We also fix the naming of the m_pendingAcceleratedActions copy in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
87         to have a more similar name.
88
89         * animation/DocumentTimeline.cpp:
90         (WebCore::DocumentTimeline::applyPendingAcceleratedAnimations):
91         * animation/KeyframeEffectReadOnly.cpp:
92         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
93
94 2018-07-26  Ross Kirsling  <ross.kirsling@sony.com>
95
96         String(View) should have a splitAllowingEmptyEntries function instead of a flag parameter
97         https://bugs.webkit.org/show_bug.cgi?id=187963
98
99         Reviewed by Alex Christensen.
100
101         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
102         (WebCore::convert):
103         * Modules/cache/DOMCache.cpp:
104         (WebCore::hasResponseVaryStarHeaderValue):
105         * Modules/cache/DOMCacheEngine.cpp:
106         (WebCore::DOMCacheEngine::queryCacheMatch):
107         * Modules/mediastream/PeerConnectionBackend.cpp:
108         (WebCore::filterICECandidate):
109         (WebCore::PeerConnectionBackend::filterSDP const):
110         * Modules/websockets/WebSocketHandshake.cpp:
111         (WebCore::WebSocketHandshake::checkResponseHeaders):
112         * accessibility/AccessibilityObject.h:
113         (WebCore::AccessibilityObject::determineARIADropEffects):
114         * accessibility/AccessibilityRenderObject.cpp:
115         (WebCore::AccessibilityRenderObject::determineARIADropEffects):
116         * accessibility/AccessibilityRenderObject.h:
117         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
118         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
119         * editing/cocoa/DataDetection.mm:
120         (WebCore::DataDetection::shouldCancelDefaultAction):
121         * editing/markup.cpp:
122         (WebCore::fillContainerFromString):
123         (WebCore::createFragmentFromText):
124         * html/EmailInputType.cpp:
125         (WebCore::EmailInputType::typeMismatchFor const):
126         (WebCore::EmailInputType::sanitizeValue const):
127         * html/HTMLInputElement.cpp:
128         (WebCore::parseAcceptAttribute):
129         * html/ValidationMessage.cpp:
130         (WebCore::ValidationMessage::setMessageDOMAndStartTimer):
131         * html/canvas/WebGLRenderingContextBase.cpp:
132         (WebCore::WebGLRenderingContextBase::compileShader):
133         * inspector/agents/InspectorDOMAgent.cpp:
134         (WebCore::InspectorDOMAgent::nodeForPath):
135         * loader/FormSubmission.cpp:
136         (WebCore::encodingFromAcceptCharset):
137         * loader/ResourceTiming.cpp:
138         (WebCore::passesTimingAllowCheck):
139         * page/WindowFeatures.cpp:
140         (WebCore::parseDisabledAdaptations):
141         (WebCore::parseDialogFeaturesMap):
142         * platform/URL.cpp:
143         (WebCore::isIPv4Address):
144         (WebCore::isIPv6Address):
145         * platform/graphics/GLContext.cpp:
146         (WebCore::GLContext::version):
147         * platform/graphics/freetype/FontCacheFreeType.cpp:
148         (WebCore::patternToFamilies):
149         * platform/graphics/gstreamer/GStreamerCommon.cpp:
150         (WebCore::extractGStreamerOptionsFromCommandLine):
151         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
152         (WebCore::Extensions3DOpenGLCommon::Extensions3DOpenGLCommon):
153         (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions):
154         * platform/gtk/PasteboardHelper.cpp:
155         (WebCore::PasteboardHelper::fillSelectionData):
156         * platform/gtk/SelectionData.cpp:
157         (WebCore::SelectionData::setURIList):
158         * platform/network/CacheValidation.cpp:
159         (WebCore::collectVaryingRequestHeaders):
160         * platform/network/HTTPParsers.cpp:
161         (WebCore::filenameFromHTTPContentDisposition):
162         (WebCore::parseXFrameOptionsHeader):
163         (WebCore::parseAccessControlExposeHeadersAllowList):
164         * platform/network/curl/CookieUtil.cpp:
165         (WebCore::CookieUtil::parseCookieHeader):
166         * platform/network/curl/CurlCacheEntry.cpp:
167         (WebCore::CurlCacheEntry::loadResponseHeaders):
168         * platform/network/curl/CurlCacheManager.cpp:
169         (WebCore::CurlCacheManager::loadIndex):
170         * platform/network/soup/CookieJarSoup.cpp:
171         (WebCore::setCookiesFromDOM):
172         * svg/SVGAnimationElement.cpp:
173         (WebCore::SVGAnimationElement::parseAttribute):
174         * svg/SVGToOTFFontConversion.cpp:
175         (WebCore::SVGToOTFFontConverter::appendOS2Table):
176         * svg/animation/SVGSMILElement.cpp:
177         (WebCore::SVGSMILElement::parseBeginOrEnd):
178         * testing/MockCDMFactory.cpp:
179         (WebCore::MockCDM::sanitizeResponse const):
180         (WebCore::MockCDMInstance::updateLicense):
181         Update split/splitAllowingEmptyEntries usage.
182
183 2018-07-26  Nan Wang  <n_wang@apple.com>
184
185         AX: nothing returned for various previous text marker APIs from one div/p node to another
186         https://bugs.webkit.org/show_bug.cgi?id=188071
187
188         Reviewed by Chris Fleizach.
189
190         TextIterator is emitting an extra '\n' at the end of the <p> node and there's no
191         corresponding text node in the DOM tree, so we are not able to handle that for 
192         text markers. Fixed it by ignoring the extra '\n' and anchor the text marker to 
193         the previous child text node.
194
195         Test: accessibility/mac/text-marker-p-tags.html
196
197         * accessibility/AXObjectCache.cpp:
198         (WebCore::AXObjectCache::traverseToOffsetInRange):
199
200 2018-07-26  Commit Queue  <commit-queue@webkit.org>
201
202         Unreviewed, rolling out r234181 and r234189.
203         https://bugs.webkit.org/show_bug.cgi?id=188075
204
205         These are not needed right now (Requested by thorton on
206         #webkit).
207
208         Reverted changesets:
209
210         "Enable Web Content Filtering on watchOS"
211         https://bugs.webkit.org/show_bug.cgi?id=187979
212         https://trac.webkit.org/changeset/234181
213
214         "HAVE(PARENTAL_CONTROLS) should be true on watchOS"
215         https://bugs.webkit.org/show_bug.cgi?id=187985
216         https://trac.webkit.org/changeset/234189
217
218 2018-07-26  Timothy Hatcher  <timothy@apple.com>
219
220         Use the Page's appearance when converting pasteboard attributed strings.
221         https://bugs.webkit.org/show_bug.cgi?id=188067
222         rdar://problem/42632246
223
224         Reviewed by Wenson Hsieh.
225
226         * editing/cocoa/WebContentReaderCocoa.mm:
227         (WebCore::createFragment): Create a LocalDefaultSystemAppearance based on the Page.
228
229 2018-07-26  Eric Carlson  <eric.carlson@apple.com>
230
231         Switching tabs should not close PiP window
232         https://bugs.webkit.org/show_bug.cgi?id=188054
233         <rdar://problem/41212379>
234
235         Reviewed by Jon Lee.
236
237         No new tests, fixes an existing test.
238         
239         Prior to r233926, calling VideoFullscreenInterfaceMac::requestHideAndExitFullscreen was a noop.
240         In r233926 it was updated to close the PiP window and was called from the PIPViewControllerDelegate
241         selectors to close the PiP window. requestHideAndExitFullscreen is also called from 
242         WebPageProxy::viewDidLeaveWindow when the web view is removed from it window, so switching
243         tabs also closed the PiP window. Revert the changes to requestHideAndExitFullscreen, and add
244         a new method that is only used by the delegate to exit PiP.
245
246         * platform/mac/VideoFullscreenInterfaceMac.h:
247         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Make this an empty,
248         do-nothing method.
249         * platform/mac/VideoFullscreenInterfaceMac.mm:
250         (-[WebVideoFullscreenInterfaceMacObjC pipShouldClose:]): Call requestHideAndExitPiP.
251         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]): Ditto.
252         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitPiP): Renamed from requestHideAndExitFullscreen.
253         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Deleted.
254
255 2018-07-04  Darin Adler  <darin@apple.com>
256
257         Improve WebGPU implementation, including using Metal Objective-C protocols more simply and correctly
258         https://bugs.webkit.org/show_bug.cgi?id=187333
259
260         Reviewed by Sam Weinig.
261
262         - Used a new OBJC_PROTOCOL macro to handle things in the Metal API that are protocols.
263           The code previously had used OBJC_CLASS, but that created unrelated classes.
264           Fixing this allows removing many typecasts that were in the existing code, makes it
265           ARC-compatible, and also allowed the compiler to detect a couple mistakes where we
266           were calling methods that don't exist.
267
268         - Eliminated use of separate heap-allocated, reference-counted objects to
269           hold pointers to Metal objects.
270
271         - Reduced the use of the WebGPU wrappers to pass around arguments inside the code.
272           They are now used only as part of the DOM binding; the inner GPU objects are used
273           whenever possible. This cuts down the number of separate functions needed a bit,
274           since we don't always need accessors for the things inside the wrappers.
275
276         - Used references rather than pointers in many cases.
277
278         - Took out three kinds of null checks: 1) Unneeded ones since Objective-C has the
279           "do nothing and return 0" behavior for methods without return values and that return
280           integer scalars. 2) Checks that aren't needed because the code has clear, invariant
281           guarantees that the pointer won't be null. 3) The simplest variant of (2), checks
282           that can be obviated by using reference types instead of pointer types.
283
284         - For Metal-specific functions and data members, used the function name metal() and
285           the data member name m_metal rather than longer wordier names with the word "platform"
286           in them. We could use "platform" if these objects were platform-specific objects used
287           in a cross-platform way that needed a common name. But in this case it's clearer to
288           call them "metal" since we are dropping down to the metal with Metal API, and
289           shared platform-independent code will not be accessing these.
290
291         - Fixed the common mistake of using "unsigned long" in our C++ code to match IDL.
292           The "unsigned long" type in IDL correponds to the "unsigned" type in WebKit code.
293
294         - Used "const" more in the GPU functions that are wrappers around Metal objects to
295           reflect the fact that these have semantics of smart pointers; most operations can be
296           done without changing which object is pointed to. This allows us to use const
297           references to pass things around without reference count churn.
298
299         - Reduced includes.
300
301         - Added "explicit" keywords where appropriate.
302
303         - Removed unused functions. In particular, removed non-Metal stub versions of the
304           functions in the GPU classes: the right way to start a new port is to clone the
305           Metal-specific files and turn the into stubs if needed, it does not make it
306           significantly more convenient to have stubs in the platform independent files,
307           especially ones that are not compiled for any platform.
308
309         - Removed most the WEBCORE_EXPORT in the GPU headers; left only what's needed to
310           support testing with TestWebKitAPI.
311
312         - Fixed two storage leaks in GPUDevice by adding missing adoptNS.
313
314         * PlatformMac.cmake: Moved files from platform/graphics/cocoa to platform/graphics/metal.
315         * SourcesCocoa.txt: Ditto.
316         * WebCore.xcodeproj/project.pbxproj: Ditto. Fixed paths on some files and groups/directories.
317         Made the platform files that abstract GPU all be "project" visible, not "private", since
318         they don't need to be visible outside WebCore. Removed reference to FontSelectionKeywordValues.h,
319         which does not seem to be a source file, a derived source file, or mentioned in any change log.
320
321         * bindings/js/JSWebGPURenderPassAttachmentDescriptorCustom.cpp:
322         (WebCore::toJSNewlyCreated): Create the correct wrapper for a
323         WebGPURenderPassDepthAttachmentDescriptor. The old code would instead
324         create a WebGPURenderPassAttachmentDescriptor wrapper, which can't be
325         used to access the clearDepth attribute.
326
327         * html/canvas/WebGPUBuffer.cpp:
328         (WebCore::WebGPUBuffer::create): Use more references rather than pointers for things
329         that are never null. Added comment about possibly returning null on failure in future.
330         (WebCore::WebGPUBuffer::WebGPUBuffer): Updated to store the GPUBuffer inside the class
331         instead of in a separate reference counted object.
332         * html/canvas/WebGPUBuffer.h: Ditto.
333
334         * html/canvas/WebGPUCommandBuffer.cpp:
335         (WebCore::WebGPUCommandBuffer::create): Use references and lower level types.
336         (WebCore::WebGPUCommandBuffer::WebGPUCommandBuffer): Store the GPUCommandBuffer
337         inside the class.
338         (WebCore::WebGPUCommandBuffer::commit): Removed unneeded null checks.
339         (WebCore::WebGPUCommandBuffer::presentDrawable): Ditto.
340         (WebCore::WebGPUCommandBuffer::createRenderCommandEncoderWithDescriptor):
341         Removed unneeded local variable.
342         (WebCore::WebGPUCommandBuffer::createComputeCommandEncoder): Ditto.
343         (WebCore::WebGPUCommandBuffer::completed): Store the DOMPromiseProxy in this
344         class, not in GPUCommandBuffer.
345         * html/canvas/WebGPUCommandBuffer.h: Ditto.
346
347         * html/canvas/WebGPUCommandQueue.cpp:
348         (WebCore::WebGPUCommandQueue::create): Use references and lower level types.
349         (WebCore::WebGPUCommandQueue::WebGPUCommandQueue): Store the GPUCommandQueue
350         inside the class.
351         (WebCore::WebGPUCommandQueue::createCommandBuffer): Ditto.
352         * html/canvas/WebGPUCommandQueue.h: Ditto.
353         * html/canvas/WebGPUCommandQueue.idl: The return value of createCommandBuffer
354         is no longer nullable.
355
356         * html/canvas/WebGPUComputeCommandEncoder.cpp:
357         (WebCore::WebGPUComputeCommandEncoder::create): More of the same.
358         (WebCore::WebGPUComputeCommandEncoder::WebGPUComputeCommandEncoder): Ditto.
359         (WebCore::WebGPUComputeCommandEncoder::setComputePipelineState): Ditto.
360         (WebCore::WebGPUComputeCommandEncoder::setBuffer): Ditto.
361         (WebCore::WebGPUComputeCommandEncoder::dispatch): Ditto.
362         (WebCore::WebGPUComputeCommandEncoder::endEncoding): Ditto.
363         * html/canvas/WebGPUComputeCommandEncoder.h: Ditto.
364
365         * html/canvas/WebGPUComputePipelineState.cpp:
366         (WebCore::WebGPUComputePipelineState::create): More of the same.
367         (WebCore::WebGPUComputePipelineState::WebGPUComputePipelineState): Ditto.
368         * html/canvas/WebGPUComputePipelineState.h: Ditto.
369
370         * html/canvas/WebGPUDepthStencilDescriptor.cpp:
371         (WebCore::WebGPUDepthStencilDescriptor::create): More of the same.
372         (WebCore::WebGPUDepthStencilDescriptor::depthWriteEnabled const): Ditto.
373         (WebCore::WebGPUDepthStencilDescriptor::setDepthWriteEnabled): Ditto.
374         (WebCore::WebGPUDepthStencilDescriptor::depthCompareFunction const): Ditto.
375         (WebCore::WebGPUDepthStencilDescriptor::setDepthCompareFunction): Ditto.
376         * html/canvas/WebGPUDepthStencilDescriptor.h: Ditto. Also fixed a bug
377         where m_depthCompareFunction was uninitialized in newly created objects.
378
379         * html/canvas/WebGPUDepthStencilState.cpp:
380         (WebCore::WebGPUDepthStencilState::create): More of the same.
381         (WebCore::WebGPUDepthStencilState::WebGPUDepthStencilState): Ditto.
382         (WebCore::WebGPUDepthStencilState::label const): Ditto.
383         (WebCore::WebGPUDepthStencilState::setLabel): Ditto.
384         * html/canvas/WebGPUDepthStencilState.h: Ditto.
385
386         * html/canvas/WebGPUDrawable.cpp:
387         (WebCore::WebGPUDrawable::create): More of the same.
388         (WebCore::WebGPUDrawable::WebGPUDrawable): Ditto.
389         * html/canvas/WebGPUDrawable.h: Ditto.
390
391         * html/canvas/WebGPUEnums.cpp: Removed some stray const.
392         * html/canvas/WebGPUEnums.h: Ditto.
393
394         * html/canvas/WebGPUFunction.cpp:
395         (WebCore::WebGPUFunction::create): More of the same.
396         (WebCore::WebGPUFunction::WebGPUFunction): Ditto.
397         * html/canvas/WebGPUFunction.h: Ditto.
398
399         * html/canvas/WebGPULibrary.cpp:
400         (WebCore::WebGPULibrary::create): More of the same.
401         (WebCore::WebGPULibrary::WebGPULibrary): Ditto.
402         (WebCore::WebGPULibrary::functionNames const): Ditto.
403         (WebCore::WebGPULibrary::functionWithName const): Ditto.
404         * html/canvas/WebGPULibrary.h: Ditto.
405
406         * html/canvas/WebGPUObject.cpp:
407         (WebCore::WebGPUObject::WebGPUObject):
408         (WebCore::WebGPUObject::deleteObject): Deleted this unused function.
409         We can bring it back later if we find we need it the way we did with the
410         WebGL implementation, but currently it's a never-called stub. Also
411         deleted the isDeleted and m_deleted for the same reason.
412         * html/canvas/WebGPUObject.h: Ditto.
413
414         * html/canvas/WebGPURenderCommandEncoder.cpp:
415         (WebCore::WebGPURenderCommandEncoder::create): More of the same.
416         (WebCore::WebGPURenderCommandEncoder::WebGPURenderCommandEncoder): Ditto.
417         (WebCore::WebGPURenderCommandEncoder::setRenderPipelineState): Ditto.
418         (WebCore::WebGPURenderCommandEncoder::setDepthStencilState): Ditto.
419         (WebCore::WebGPURenderCommandEncoder::setVertexBuffer): Ditto.
420         (WebCore::WebGPURenderCommandEncoder::setFragmentBuffer): Ditto.
421         (WebCore::WebGPURenderCommandEncoder::drawPrimitives): Ditto.
422         (WebCore::WebGPURenderCommandEncoder::endEncoding): Ditto.
423         * html/canvas/WebGPURenderCommandEncoder.h: Ditto.
424
425         * html/canvas/WebGPURenderPassAttachmentDescriptor.cpp:
426         (WebCore::WebGPURenderPassAttachmentDescriptor::WebGPURenderPassAttachmentDescriptor):
427         More of the same.
428         (WebCore::WebGPURenderPassAttachmentDescriptor::loadAction const): Ditto.
429         (WebCore::WebGPURenderPassAttachmentDescriptor::setLoadAction): Ditto.
430         (WebCore::WebGPURenderPassAttachmentDescriptor::storeAction const): Ditto.
431         (WebCore::WebGPURenderPassAttachmentDescriptor::setStoreAction): Ditto.
432         (WebCore::WebGPURenderPassAttachmentDescriptor::texture const): Ditto.
433         (WebCore::WebGPURenderPassAttachmentDescriptor::setTexture): Ditto.
434         * html/canvas/WebGPURenderPassAttachmentDescriptor.h: Ditto.
435
436         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp:
437         (WebCore::WebGPURenderPassColorAttachmentDescriptor::create): More of the same.
438         (WebCore::WebGPURenderPassColorAttachmentDescriptor::WebGPURenderPassColorAttachmentDescriptor): Ditto.
439         (WebCore::WebGPURenderPassColorAttachmentDescriptor::descriptor const): Ditto.
440         (WebCore::WebGPURenderPassColorAttachmentDescriptor::clearColor const): Ditto.
441         (WebCore::WebGPURenderPassColorAttachmentDescriptor::setClearColor): Ditto.
442         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.h: Ditto.
443
444         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp:
445         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::create): More of the same.
446         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::WebGPURenderPassDepthAttachmentDescriptor): Ditto.
447         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::clearDepth const): Ditto.
448         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::setClearDepth): Ditto.
449         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::descriptor const): Ditto.
450         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.h: Ditto.
451
452         * html/canvas/WebGPURenderPassDescriptor.cpp:
453         (WebCore::WebGPURenderPassDescriptor::create): More of the same.
454         (WebCore::WebGPURenderPassDescriptor::depthAttachment): Ditto.
455         (WebCore::WebGPURenderPassDescriptor::colorAttachments): Ditto.
456         * html/canvas/WebGPURenderPassDescriptor.h: Ditto.
457
458         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.cpp:
459         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::create): More of the same.
460         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::WebGPURenderPipelineColorAttachmentDescriptor): Ditto.
461         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::pixelFormat const): Ditto.
462         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::setPixelFormat): Ditto.
463         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.h: Ditto.
464
465         * html/canvas/WebGPURenderPipelineDescriptor.cpp:
466         (WebCore::WebGPURenderPipelineDescriptor::create): More of the same.
467         (WebCore::WebGPURenderPipelineDescriptor::vertexFunction const): Ditto.
468         (WebCore::WebGPURenderPipelineDescriptor::setVertexFunction): Ditto.
469         (WebCore::WebGPURenderPipelineDescriptor::fragmentFunction const): Ditto.
470         (WebCore::WebGPURenderPipelineDescriptor::setFragmentFunction): Ditto.
471         (WebCore::WebGPURenderPipelineDescriptor::colorAttachments): Ditto.
472         (WebCore::WebGPURenderPipelineDescriptor::depthAttachmentPixelFormat const): Ditto.
473         (WebCore::WebGPURenderPipelineDescriptor::setDepthAttachmentPixelFormat): Ditto.
474         (WebCore::WebGPURenderPipelineDescriptor::reset): Ditto.
475         * html/canvas/WebGPURenderPipelineDescriptor.h: Ditto.
476
477         * html/canvas/WebGPURenderPipelineState.cpp:
478         (WebCore::WebGPURenderPipelineState::create): More of the same.
479         (WebCore::WebGPURenderPipelineState::WebGPURenderPipelineState): Ditto.
480         (WebCore::WebGPURenderPipelineState::label const): Ditto.
481         (WebCore::WebGPURenderPipelineState::setLabel): Ditto.
482         * html/canvas/WebGPURenderPipelineState.h: Ditto.
483
484         * html/canvas/WebGPURenderingContext.cpp:
485         (WebCore::WebGPURenderingContext::create): More of the same.
486         (WebCore::WebGPURenderingContext::WebGPURenderingContext): Ditto.
487         (WebCore::WebGPURenderingContext::initializeNewContext): Ditto.
488         (WebCore::WebGPURenderingContext::platformLayer const): Ditto.
489         (WebCore::WebGPURenderingContext::markLayerComposited): Ditto.
490         (WebCore::WebGPURenderingContext::reshape): Ditto.
491         (WebCore::WebGPURenderingContext::createLibrary): Ditto.
492         (WebCore::WebGPURenderingContext::createRenderPipelineState): Ditto.
493         (WebCore::WebGPURenderingContext::createDepthStencilState): Ditto.
494         (WebCore::WebGPURenderingContext::createComputePipelineState): Ditto.
495         (WebCore::WebGPURenderingContext::createCommandQueue): Ditto.
496         (WebCore::WebGPURenderingContext::nextDrawable): Ditto.
497         (WebCore::WebGPURenderingContext::createBuffer): Ditto.
498         (WebCore::WebGPURenderingContext::createTexture): Ditto.
499         * html/canvas/WebGPURenderingContext.h: Made many functions final and
500         private.
501         * html/canvas/WebGPURenderingContext.idl: The return value of most of
502         the create functions are no longer nullable.
503
504         * html/canvas/WebGPUSize.h: Use "unsigned" instead of "unsigned long".
505
506         * html/canvas/WebGPUTexture.cpp:
507         (WebCore::WebGPUTexture::createFromDrawableTexture): More of the same.
508         (WebCore::WebGPUTexture::create): Ditto.
509         (WebCore::WebGPUTexture::WebGPUTexture): Ditto.
510         * html/canvas/WebGPUTexture.h: Ditto.
511
512         * html/canvas/WebGPUTextureDescriptor.cpp:
513         (WebCore::WebGPUTextureDescriptor::create): More of the same.
514         (WebCore::WebGPUTextureDescriptor::WebGPUTextureDescriptor): Ditto.
515         (WebCore::WebGPUTextureDescriptor::width const): Ditto.
516         (WebCore::WebGPUTextureDescriptor::setWidth): Ditto.
517         (WebCore::WebGPUTextureDescriptor::height const): Ditto.
518         (WebCore::WebGPUTextureDescriptor::setHeight): Ditto.
519         (WebCore::WebGPUTextureDescriptor::sampleCount const): Ditto.
520         (WebCore::WebGPUTextureDescriptor::setSampleCount): Ditto.
521         (WebCore::WebGPUTextureDescriptor::textureType const): Ditto.
522         (WebCore::WebGPUTextureDescriptor::setTextureType): Ditto.
523         (WebCore::WebGPUTextureDescriptor::storageMode const): Ditto.
524         (WebCore::WebGPUTextureDescriptor::setStorageMode): Ditto.
525         (WebCore::WebGPUTextureDescriptor::usage const): Ditto.
526         (WebCore::WebGPUTextureDescriptor::setUsage): Ditto.
527         * html/canvas/WebGPUTextureDescriptor.h: Ditto.
528
529         * platform/graphics/metal/GPUBufferMetal.mm: Moved from "cocoa" directory.
530         (WebCore::GPUBuffer::GPUBuffer): Simplify code using references and the
531         "metal" naming.
532
533         * platform/graphics/metal/GPUCommandBufferMetal.mm:
534         (WebCore::GPUCommandBuffer::GPUCommandBuffer): Take a function to be called as the
535         completed handler and set it up.
536         (WebCore::GPUCommandBuffer::presentDrawable const): Ditto.
537         (WebCore::GPUCommandBuffer::commit const): Ditto.
538         (WebCore::GPUCommandBuffer::addCompletedHandler): Deleted.
539
540         * platform/graphics/metal/GPUCommandQueueMetal.mm:
541         (WebCore::GPUCommandQueue::GPUCommandQueue): Ditto. Also rewrote label handling a bit.
542         (WebCore::GPUCommandQueue::label const): Ditto.
543         (WebCore::GPUCommandQueue::setLabel const): Ditto.
544
545         * platform/graphics/metal/GPUComputeCommandEncoderMetal.mm:
546         (WebCore::GPUComputeCommandEncoder::GPUComputeCommandEncoder): Ditto.
547         (WebCore::GPUComputeCommandEncoder::setComputePipelineState const): Ditto.
548         (WebCore::GPUComputeCommandEncoder::setBuffer const): Ditto.
549         (WebCore::GPUComputeCommandEncoder::dispatch const): Ditto.
550         (WebCore::GPUComputeCommandEncoder::endEncoding const): Ditto.
551
552         * platform/graphics/metal/GPUComputePipelineStateMetal.mm:
553         (WebCore::GPUComputePipelineState::GPUComputePipelineState): Ditto.
554
555         * platform/graphics/metal/GPUDepthStencilDescriptorMetal.mm:
556         (WebCore::GPUDepthStencilDescriptor::GPUDepthStencilDescriptor): Ditto.
557         (WebCore::GPUDepthStencilDescriptor::depthWriteEnabled const): Ditto.
558         (WebCore::GPUDepthStencilDescriptor::setDepthWriteEnabled const): Ditto.
559         (WebCore::GPUDepthStencilDescriptor::depthCompareFunction const): Ditto.
560         (WebCore::GPUDepthStencilDescriptor::setDepthCompareFunction const): Ditto.
561
562         * platform/graphics/metal/GPUDepthStencilStateMetal.mm:
563         (WebCore::GPUDepthStencilState::GPUDepthStencilState): Ditto.
564         (WebCore::GPUDepthStencilState::label const): Ditto.
565         (WebCore::GPUDepthStencilState::setLabel const): Ditto. This is one of the
566         functions that was calling a method that does not exist. Added a comment.
567
568         * platform/graphics/metal/GPUDeviceMetal.mm:
569         (WebCore::GPUDevice::GPUDevice): Ditto. Also fixed two storage leaks where
570         we neglected to do adoptNS on the result of MTLCreateSystemDefaultDevice and
571         on the result of -[[WebGPULayer alloc] initWithGPUDevice:].
572         (WebCore::GPUDevice::reshape const): Ditto.
573         (WebCore::GPUDevice::platformLayer const): Ditto.
574         (WebCore::GPUDevice::operator! const): Ditto.
575
576         * platform/graphics/metal/GPUDrawableMetal.mm:
577         (WebCore::GPUDrawable::GPUDrawable): Ditto.
578         (WebCore::GPUDrawable::release): Ditto.
579         (WebCore::GPUDrawable::metal const): Ditto.
580         (WebCore::GPUDrawable::texture const): Ditto.
581
582         * platform/graphics/metal/GPUFunctionMetal.mm:
583         (WebCore::GPUFunction::GPUFunction): Ditto.
584         (WebCore::GPUFunction::name const): Ditto.
585         (WebCore::GPUFunction::metal const): Ditto.
586         (WebCore::GPUFunction::operator! const): Ditto.
587
588         * platform/graphics/metal/GPULibraryMetal.mm:
589         (WebCore::GPULibrary::GPULibrary): Ditto.
590         (WebCore::GPULibrary::label const): Ditto.
591         (WebCore::GPULibrary::setLabel const): Ditto.
592         (WebCore::GPULibrary::functionNames const): Ditto.
593         (WebCore::GPULibrary::metal const): Ditto.
594
595         * platform/graphics/metal/GPURenderCommandEncoderMetal.mm:
596         (WebCore::GPURenderCommandEncoder::GPURenderCommandEncoder): Ditto.
597         (WebCore::GPURenderCommandEncoder::setRenderPipelineState const): Ditto.
598         (WebCore::GPURenderCommandEncoder::setDepthStencilState const): Ditto.
599         (WebCore::GPURenderCommandEncoder::setVertexBuffer const): Ditto.
600         (WebCore::GPURenderCommandEncoder::setFragmentBuffer const): Ditto.
601         (WebCore::GPURenderCommandEncoder::drawPrimitives const): Ditto.
602         (WebCore::GPURenderCommandEncoder::endEncoding const): Ditto.
603
604         * platform/graphics/metal/GPURenderPassAttachmentDescriptorMetal.mm:
605         (WebCore::GPURenderPassAttachmentDescriptor::GPURenderPassAttachmentDescriptor): Ditto.
606         (WebCore::GPURenderPassAttachmentDescriptor::loadAction const): Ditto.
607         (WebCore::GPURenderPassAttachmentDescriptor::setLoadAction const): Ditto.
608         (WebCore::GPURenderPassAttachmentDescriptor::storeAction const): Ditto.
609         (WebCore::GPURenderPassAttachmentDescriptor::setStoreAction const): Ditto.
610         (WebCore::GPURenderPassAttachmentDescriptor::setTexture const): Ditto.
611
612         * platform/graphics/metal/GPURenderPassColorAttachmentDescriptorMetal.mm:
613         (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor): Ditto.
614         (WebCore::GPURenderPassColorAttachmentDescriptor::clearColor const): Ditto.
615         (WebCore::GPURenderPassColorAttachmentDescriptor::setClearColor const): Ditto.
616         (WebCore::GPURenderPassColorAttachmentDescriptor::metal const): Ditto.
617
618         * platform/graphics/metal/GPURenderPassDepthAttachmentDescriptorMetal.mm:
619         (WebCore::GPURenderPassDepthAttachmentDescriptor::GPURenderPassDepthAttachmentDescriptor): Ditto.
620         (WebCore::GPURenderPassDepthAttachmentDescriptor::clearDepth const): Ditto.
621         (WebCore::GPURenderPassDepthAttachmentDescriptor::setClearDepth const): Ditto.
622         (WebCore::GPURenderPassDepthAttachmentDescriptor::metal const): Ditto.
623
624         * platform/graphics/metal/GPURenderPassDescriptorMetal.mm:
625         (WebCore::GPURenderPassDescriptor::GPURenderPassDescriptor): Ditto.
626         (WebCore::GPURenderPassDescriptor::colorAttachments const): Ditto.
627         (WebCore::GPURenderPassDescriptor::depthAttachment const): Ditto.
628         (WebCore::GPURenderPassDescriptor::metal const): Ditto.
629
630         * platform/graphics/metal/GPURenderPipelineColorAttachmentDescriptorMetal.mm:
631         (WebCore::GPURenderPipelineColorAttachmentDescriptor::GPURenderPipelineColorAttachmentDescriptor): Ditto.
632         (WebCore::GPURenderPipelineColorAttachmentDescriptor::pixelFormat const): Ditto.
633         (WebCore::GPURenderPipelineColorAttachmentDescriptor::setPixelFormat const): Ditto.
634         (WebCore::GPURenderPipelineColorAttachmentDescriptor::metal const): Ditto.
635
636         * platform/graphics/metal/GPURenderPipelineDescriptorMetal.mm:
637         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor): Ditto.
638         (WebCore::GPURenderPipelineDescriptor::depthAttachmentPixelFormat const): Ditto.
639         (WebCore::GPURenderPipelineDescriptor::setDepthAttachmentPixelFormat const): Ditto.
640         (WebCore::GPURenderPipelineDescriptor::setVertexFunction const): Ditto.
641         (WebCore::GPURenderPipelineDescriptor::setFragmentFunction const): Ditto.
642         (WebCore::GPURenderPipelineDescriptor::colorAttachments const): Ditto.
643         (WebCore::GPURenderPipelineDescriptor::reset const): Ditto.
644         (WebCore::GPURenderPipelineDescriptor::metal const): Ditto.
645
646         * platform/graphics/metal/GPURenderPipelineStateMetal.mm:
647         (WebCore::GPURenderPipelineState::GPURenderPipelineState): Ditto.
648         (WebCore::GPURenderPipelineState::label const): Ditto.
649         (WebCore::GPURenderPipelineState::setLabel const): Ditto. This is one of the
650         functions that was calling a method that does not exist. Added a comment.
651         (WebCore::GPURenderPipelineState::metal const): Ditto.
652
653         * platform/graphics/metal/GPUTextureDescriptorMetal.mm:
654         (WebCore::GPUTextureDescriptor::GPUTextureDescriptor): Ditto.
655         (WebCore::GPUTextureDescriptor::width const): Ditto.
656         (WebCore::GPUTextureDescriptor::setWidth const): Ditto.
657         (WebCore::GPUTextureDescriptor::height const): Ditto.
658         (WebCore::GPUTextureDescriptor::setHeight const): Ditto.
659         (WebCore::GPUTextureDescriptor::sampleCount const): Ditto.
660         (WebCore::GPUTextureDescriptor::setSampleCount const): Ditto.
661         (WebCore::GPUTextureDescriptor::textureType const): Ditto.
662         (WebCore::GPUTextureDescriptor::setTextureType const): Ditto.
663         (WebCore::GPUTextureDescriptor::storageMode const): Ditto.
664         (WebCore::GPUTextureDescriptor::setStorageMode const): Ditto.
665         (WebCore::GPUTextureDescriptor::usage const): Ditto.
666         (WebCore::GPUTextureDescriptor::setUsage const): Ditto.
667         (WebCore::GPUTextureDescriptor::metal const): Ditto.
668
669         * platform/graphics/metal/GPUTextureMetal.mm:
670         (WebCore::GPUTexture::GPUTexture): Ditto.
671         (WebCore::GPUTexture::width const): Ditto.
672         (WebCore::GPUTexture::height const): Ditto.
673         (WebCore::GPUTexture::metal const): Ditto.
674
675         * platform/graphics/gpu/GPUBuffer.cpp: Removed unused stubs.
676         (WebCore::GPUBuffer::length const): Moved this function here since it has
677         a useful platform-independent implementation.
678
679         * platform/graphics/gpu/GPUBuffer.h: Use OBJC_PROTOCOL for MTLBuffer.
680         Did the other thigs mentioned above: USE(METAL), remove WEBCORE_EXPORT,
681         no longer be RefCounted, etc.
682
683         * platform/graphics/gpu/GPUCommandBuffer.cpp: Ditto.
684         * platform/graphics/gpu/GPUCommandBuffer.h: Ditto. Use OBJC_PROTOCOL
685         for MTLCommandBuffer.
686
687         * platform/graphics/gpu/GPUCommandQueue.cpp: Ditto.
688         * platform/graphics/gpu/GPUCommandQueue.h: Ditto. Use OBJC_PROTOCOL for
689         MTLCommandQueue.
690
691         * platform/graphics/gpu/GPUComputeCommandEncoder.cpp: Ditto.
692         * platform/graphics/gpu/GPUComputeCommandEncoder.h: Ditto. Use OBJC_PROTOCOL for
693         MTLComputeCommandEncoder.
694
695         * platform/graphics/gpu/GPUComputePipelineState.cpp: Ditto.
696         * platform/graphics/gpu/GPUComputePipelineState.h: Ditto. Use OBJC_PROTOCOL for
697         MTLComputePipelineState.
698
699         * platform/graphics/gpu/GPUDepthStencilDescriptor.cpp: Ditto.
700         * platform/graphics/gpu/GPUDepthStencilDescriptor.h: Ditto.
701
702         * platform/graphics/gpu/GPUDepthStencilState.cpp: Ditto.
703         * platform/graphics/gpu/GPUDepthStencilState.h: Ditto. Use OBJC_PROTOCOL for
704         MTLDepthStencilState.
705
706         * platform/graphics/gpu/GPUDevice.cpp: Ditto.
707         * platform/graphics/gpu/GPUDevice.h: Ditto. Use OBJC_PROTOCOL for MTLDevice.
708
709         * platform/graphics/gpu/GPUDrawable.cpp: Ditto.
710         * platform/graphics/gpu/GPUDrawable.h: Ditto. Use OBJC_PROTOCOL for
711         MTLDrawable and MTLTexture.
712
713         * platform/graphics/gpu/GPUEnums.h: Tweaked formatting.
714
715         * platform/graphics/gpu/GPUFunction.cpp: Ditto.
716         * platform/graphics/gpu/GPUFunction.h: Ditto. Use OBJC_PROTOCOL for
717         MTLFunction.
718
719         * platform/graphics/gpu/GPULibrary.cpp: Ditto.
720         * platform/graphics/gpu/GPULibrary.h: Ditto. Use OBJC_PROTOCOL for
721         MTLLibrary.
722
723         * platform/graphics/gpu/GPURenderCommandEncoder.cpp: Ditto.
724         * platform/graphics/gpu/GPURenderCommandEncoder.h: Ditto.
725         Use OBJC_PROTOCOL for MTLRenderCommandEncoder.
726
727         * platform/graphics/gpu/GPURenderPassAttachmentDescriptor.cpp: Ditto.
728         * platform/graphics/gpu/GPURenderPassAttachmentDescriptor.h: Ditto.
729
730         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.cpp: Ditto.
731         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.h: Ditto.
732
733         * platform/graphics/gpu/GPURenderPassDepthAttachmentDescriptor.cpp: Ditto.
734         * platform/graphics/gpu/GPURenderPassDepthAttachmentDescriptor.h: Ditto.
735
736         * platform/graphics/gpu/GPURenderPassDescriptor.cpp: Ditto.
737         * platform/graphics/gpu/GPURenderPassDescriptor.h: Ditto.
738
739         * platform/graphics/gpu/GPURenderPipelineColorAttachmentDescriptor.cpp: Ditto.
740         * platform/graphics/gpu/GPURenderPipelineColorAttachmentDescriptor.h: Ditto.
741
742         * platform/graphics/gpu/GPURenderPipelineDescriptor.cpp: Ditto.
743         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Ditto.
744
745         * platform/graphics/gpu/GPURenderPipelineState.cpp: Ditto.
746         * platform/graphics/gpu/GPURenderPipelineState.h: Ditto. Use OBJC_PROTOCOL
747         for MTLRenderPipelineState.
748
749         * platform/graphics/gpu/GPUSize.h: Use "unsigned" instead of "unsigned long".
750
751         * platform/graphics/gpu/GPUTexture.cpp: Ditto.
752         * platform/graphics/gpu/GPUTexture.h: Ditto. Use OBJC_PROTOCOL for
753         MTLTexture.
754
755         * platform/graphics/gpu/GPUTextureDescriptor.cpp: Ditto.
756         * platform/graphics/gpu/GPUTextureDescriptor.h: Ditto.
757
758 2018-07-26  Zalan Bujtas  <zalan@apple.com>
759
760         [LFC][Floating] Add skeleton for basic positioning.
761         https://bugs.webkit.org/show_bug.cgi?id=187974
762
763         Reviewed by Antti Koivisto.
764
765         Add floating boxes to an empty floating context.
766
767         * layout/FloatingContext.cpp:
768         (WebCore::Layout::FloatingContext::FloatingContext):
769         (WebCore::Layout::FloatingContext::computePosition):
770         * layout/FloatingContext.h:
771         (WebCore::Layout::FloatingContext::floatingState const):
772         (WebCore::Layout::FloatingContext::layoutContext const):
773         * layout/FloatingState.cpp:
774         (WebCore::Layout::FloatingState::FloatingState):
775         (WebCore::Layout::FloatingState::append):
776         * layout/FloatingState.h:
777         (WebCore::Layout::FloatingState::create):
778         (WebCore::Layout::FloatingState::isEmpty const):
779         (WebCore::Layout::FloatingState::layoutContext const):
780         * layout/FormattingState.h:
781         * layout/LayoutContext.cpp:
782         (WebCore::Layout::LayoutContext::establishedFormattingState):
783         * layout/LayoutContext.h:
784         * layout/blockformatting/BlockFormattingContext.cpp:
785         (WebCore::Layout::BlockFormattingContext::layout const):
786         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
787         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
788         * layout/blockformatting/BlockFormattingContext.h:
789         * layout/blockformatting/BlockInvalidation.cpp:
790         (WebCore::Layout::invalidationStopsAtFormattingContextBoundary):
791         * layout/layouttree/LayoutBox.cpp:
792         (WebCore::Layout::Box::isLeftFloatingPositioned const):
793         (WebCore::Layout::Box::isRightFloatingPositioned const):
794         * layout/layouttree/LayoutBox.h:
795
796 2018-07-26  Zalan Bujtas  <zalan@apple.com>
797
798         [LFC][BFC] Do not try to access containing block's height during descendant height computation
799         https://bugs.webkit.org/show_bug.cgi?id=187970
800
801         Reviewed by Antti Koivisto.
802
803         Mostly becasue in BFC, we compute the descendents' height first so the containing block's height is probably not computed yet.
804
805         * layout/FormattingContextGeometry.cpp:
806         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
807         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
808         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
809
810 2018-07-26  Frederic Wang  <fwang@igalia.com>
811
812         Unreviewed, add bug references into FIXME comments for CSSOM View API
813
814         * dom/Element.idl:
815         * page/ScrollToOptions.idl:
816
817 2018-07-26  Zalan Bujtas  <zalan@apple.com>
818
819         [LFC][BFC] assert-not-implemented-yet on inflow non-replaced height when style is not fixed/auto.
820         https://bugs.webkit.org/show_bug.cgi?id=187969
821
822         Reviewed by Antti Koivisto.
823
824         Assert on unsupported height types when computing inflow non-replaced height.
825
826         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
827         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
828
829 2018-07-26  Antoine Quint  <graouts@apple.com>
830
831         [Web Animations] REGRESSION: transition added immediately after element creation doesn't work
832         https://bugs.webkit.org/show_bug.cgi?id=187942
833
834         Reviewed by Dean Jackson.
835
836         Tests: webanimations/accelerated-transition-by-removing-property.html
837                webanimations/partly-accelerated-transition-by-removing-property.html
838
839         The Style::TreeResolver::createAnimatedElementUpdate() function expected a flag to be set that indicates that
840         running animations on an element should yield a change in composited state for that element's layer. We did not
841         have code accounting for this flag in the Web Animations engine. We now have a resolveAnimationsForElement()
842         method on DocumentTimeline which looks at all animations resolved on the element and see if all of them are
843         running accelerated and whether at least one of them is pending. In that case, we set the shouldRecompositeLayer
844         flag in createAnimatedElementUpdate() to true which guarantees the element's layer will have a backing when
845         we attempt to start the animation in KeyframeEffectReadOnly::applyPendingAcceleratedActions() where we would
846         have previously failed to have layer-backed renderer to perform an accelerated animation on (under certain
847         circumstances, see test).
848
849         * animation/DocumentTimeline.cpp:
850         (WebCore::DocumentTimeline::resolveAnimationsForElement):
851         * animation/DocumentTimeline.h:
852         * animation/KeyframeEffectReadOnly.h:
853         (WebCore::KeyframeEffectReadOnly::hasPendingAcceleratedAction const):
854         * style/StyleTreeResolver.cpp:
855         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
856
857 2018-07-25  Chris Dumez  <cdumez@apple.com>
858
859         Allow ActiveDOMObject's canSuspend / suspend / resume overrides to destroy ActiveDOMObjects
860         https://bugs.webkit.org/show_bug.cgi?id=188025
861
862         Reviewed by Alex Christensen.
863
864         Apply the same logic as in ScriptExecutionContext::stopActiveDOMObjects() to support destruction of
865         ActiveDOMObjects while we're calling ActiveDOMObject's canSuspend / suspend / resume overrides.
866
867         We copy m_activeDOMObjects into a Vector and iterate over the copy instead of m_activeDOMObjects.
868         Since ActiveDOMObject is not RefCounted or CanMakeWeakPtr, we verify that the raw pointer is still
869         valid by checking if m_activeDOMObjects still contains it, as we iterate. This is safe as the
870         ActiveDOMObject destructor removes the object from ScriptExecutionContext::m_activeDOMObjects.
871         New ActiveDOMObjects with the same pointer value cannot be created while we iterate as we already
872         prevent the construction of new ActiveDOMObjects while we iterate via RELEASE_ASSERT().
873
874         * dom/ScriptExecutionContext.cpp:
875         (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension):
876         (WebCore::ScriptExecutionContext::forEachActiveDOMObject const):
877         (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
878         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
879         (WebCore::ScriptExecutionContext::stopActiveDOMObjects):
880         (WebCore::ScriptExecutionContext::willDestroyActiveDOMObject):
881         * dom/ScriptExecutionContext.h:
882
883 2018-07-25  Justin Fan  <justin_fan@apple.com>
884
885         Systems with no NSScreens hitting assertion in rendererIDForDisplay when creating WebGL context
886         https://bugs.webkit.org/show_bug.cgi?id=188023
887         <rdar://problem/42476622>
888
889         Reviewed by Simon Fraser.
890
891         On systems with no NSScreens, PlatformScreenMac's screenData map is not populated; rendererIDForDisplay
892         will thus hit an assertion rather than returning 0. Removing the assertion for now. 
893
894         Covered by existing tests.
895
896         * platform/mac/PlatformScreenMac.mm:
897         (WebCore::rendererIDForDisplay):
898
899 2018-07-25  Zalan Bujtas  <zalan@apple.com>
900
901         Build fix after r234215. Unreviewed.
902
903         * rendering/RenderTheme.cpp:
904
905 2018-07-25  Zalan Bujtas  <zalan@apple.com>
906
907         REGRESSION(r227577) Text on TV & Movies page doesn't wrap properly in iTunes
908         https://bugs.webkit.org/show_bug.cgi?id=188018
909         <rdar://problem/42517520>
910
911         Reviewed by Dean Jackson.
912
913         Manual rollout of r227577.
914
915         Test: fast/overflow/line-clamp-with-text-shadow.html
916
917         * Sources.txt:
918         * WebCore.xcodeproj/project.pbxproj:
919         * css/CSSComputedStyleDeclaration.cpp:
920         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
921         * css/CSSProperties.json:
922         * css/StyleBuilderCustom.h:
923         (WebCore::StyleBuilderCustom::applyValueWebkitLinesClamp): Deleted.
924         * css/parser/CSSParserContext.cpp:
925         (WebCore::CSSParserContext::CSSParserContext):
926         * css/parser/CSSParserContext.h:
927         (WebCore::CSSParserContextHash::hash):
928         * css/parser/CSSPropertyParser.cpp:
929         (WebCore::CSSPropertyParser::parseSingleValue):
930         (WebCore::consumeLinesClamp): Deleted.
931         * page/Settings.yaml:
932         * rendering/RenderBlockFlow.cpp:
933         (WebCore::RenderBlockFlow::willCreateColumns const):
934         (WebCore::getHeightForLineCount):
935         (WebCore::RenderBlockFlow::heightForLineCount):
936         (WebCore::RenderBlockFlow::layoutExcludedChildren):
937         (WebCore::RenderBlockFlow::logicalHeightForLineCount): Deleted.
938         (WebCore::RenderBlockFlow::logicalHeightExcludingLineCount): Deleted.
939         * rendering/RenderBlockFlow.h:
940         * rendering/RenderDeprecatedFlexibleBox.cpp:
941         (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
942         * rendering/RenderFragmentContainer.cpp:
943         (WebCore::RenderFragmentContainer::pageLogicalHeightForOffset const): Deleted.
944         * rendering/RenderFragmentContainer.h:
945         * rendering/RenderFragmentedFlow.cpp:
946         (WebCore::RenderFragmentedFlow::validateFragments):
947         (WebCore::RenderFragmentedFlow::pageLogicalHeightForOffset const):
948         (WebCore::RenderFragmentedFlow::pageRemainingLogicalHeightForOffset const):
949         * rendering/RenderFragmentedFlow.h:
950         * rendering/RenderLinesClampFlow.cpp: Removed.
951         * rendering/RenderLinesClampFlow.h: Removed.
952         * rendering/RenderLinesClampSet.cpp: Removed.
953         * rendering/RenderLinesClampSet.h: Removed.
954         * rendering/RenderMultiColumnFlow.cpp:
955         (WebCore::RenderMultiColumnFlow::isColumnSpanningDescendant const): Deleted.
956         (WebCore::RenderMultiColumnFlow::createMultiColumnSet): Deleted.
957         * rendering/RenderMultiColumnFlow.h:
958         (WebCore::RenderMultiColumnFlow::multiColumnBlockFlow const): Deleted.
959         (WebCore::RenderMultiColumnFlow::hasColumnSpanner const): Deleted.
960         (WebCore::RenderMultiColumnFlow::findColumnSpannerPlaceholder const): Deleted.
961         (WebCore::RenderMultiColumnFlow::columnCount const): Deleted.
962         (WebCore::RenderMultiColumnFlow::columnWidth const): Deleted.
963         (WebCore::RenderMultiColumnFlow::columnHeightAvailable const): Deleted.
964         (WebCore::RenderMultiColumnFlow::setColumnHeightAvailable): Deleted.
965         (WebCore::RenderMultiColumnFlow::inBalancingPass const): Deleted.
966         (WebCore::RenderMultiColumnFlow::setInBalancingPass): Deleted.
967         (WebCore::RenderMultiColumnFlow::needsHeightsRecalculation const): Deleted.
968         (WebCore::RenderMultiColumnFlow::setNeedsHeightsRecalculation): Deleted.
969         (WebCore::RenderMultiColumnFlow::shouldRelayoutForPagination const): Deleted.
970         (WebCore::RenderMultiColumnFlow::setColumnCountAndWidth): Deleted.
971         (WebCore::RenderMultiColumnFlow::progressionIsInline const): Deleted.
972         (WebCore::RenderMultiColumnFlow::setProgressionIsInline): Deleted.
973         (WebCore::RenderMultiColumnFlow::progressionIsReversed const): Deleted.
974         (WebCore::RenderMultiColumnFlow::setProgressionIsReversed): Deleted.
975         (WebCore::RenderMultiColumnFlow::spannerMap): Deleted.
976         * rendering/RenderMultiColumnSet.cpp:
977         (WebCore::RenderMultiColumnSet::collectLayerFragments):
978         (WebCore::RenderMultiColumnSet::columnTranslationForOffset const):
979         * rendering/RenderMultiColumnSet.h:
980         (WebCore::RenderMultiColumnSet::multiColumnBlockFlow const): Deleted.
981         (WebCore::RenderMultiColumnSet::multiColumnFlow const): Deleted.
982         (WebCore::RenderMultiColumnSet::logicalTopInFragmentedFlow const): Deleted.
983         (WebCore::RenderMultiColumnSet::logicalBottomInFragmentedFlow const): Deleted.
984         (WebCore::RenderMultiColumnSet::logicalHeightInFragmentedFlow const): Deleted.
985         (WebCore::RenderMultiColumnSet::computedColumnCount const): Deleted.
986         (WebCore::RenderMultiColumnSet::computedColumnWidth const): Deleted.
987         (WebCore::RenderMultiColumnSet::computedColumnHeight const): Deleted.
988         (WebCore::RenderMultiColumnSet::columnHeightComputed const): Deleted.
989         (WebCore::RenderMultiColumnSet::setComputedColumnWidthAndCount): Deleted.
990         (WebCore::RenderMultiColumnSet::updateMinimumColumnHeight): Deleted.
991         (WebCore::RenderMultiColumnSet::minimumColumnHeight const): Deleted.
992         (WebCore::RenderMultiColumnSet::forcedBreaksCount const): Deleted.
993         (WebCore::RenderMultiColumnSet::hasBeenFlowed const): Deleted.
994         (WebCore::RenderMultiColumnSet::skipLayerFragmentCollectionForColumn const): Deleted.
995         (WebCore::RenderMultiColumnSet::customBlockProgressionAdjustmentForColumn const): Deleted.
996         (WebCore::RenderMultiColumnSet::ContentRun::ContentRun): Deleted.
997         (WebCore::RenderMultiColumnSet::ContentRun::assumedImplicitBreaks const): Deleted.
998         (WebCore::RenderMultiColumnSet::ContentRun::assumeAnotherImplicitBreak): Deleted.
999         (WebCore::RenderMultiColumnSet::ContentRun::breakOffset const): Deleted.
1000         (WebCore::RenderMultiColumnSet::ContentRun::columnLogicalHeight const): Deleted.
1001         * rendering/RenderObject.h:
1002         (WebCore::RenderObject::isRenderLinesClampFlow const): Deleted.
1003         (WebCore::RenderObject::isRenderLinesClampSet const): Deleted.
1004         * rendering/style/LineClampValue.h:
1005         (WebCore::LinesClampValue::LinesClampValue): Deleted.
1006         (WebCore::LinesClampValue::isNone const): Deleted.
1007         (WebCore::LinesClampValue::operator== const): Deleted.
1008         (WebCore::LinesClampValue::operator!= const): Deleted.
1009         (WebCore::LinesClampValue::start const): Deleted.
1010         (WebCore::LinesClampValue::end const): Deleted.
1011         (WebCore::LinesClampValue::center const): Deleted.
1012         * rendering/style/RenderStyle.h:
1013         (WebCore::RenderStyle::lineClamp const):
1014         (WebCore::RenderStyle::setLineClamp):
1015         (WebCore::RenderStyle::initialLineClamp):
1016         (WebCore::RenderStyle::hasInlineColumnAxis const):
1017         (WebCore::RenderStyle::linesClamp const): Deleted.
1018         (WebCore::RenderStyle::hasLinesClamp const): Deleted.
1019         (WebCore::RenderStyle::setLinesClamp): Deleted.
1020         (WebCore::RenderStyle::initialLinesClamp): Deleted.
1021         * rendering/style/StyleRareNonInheritedData.cpp:
1022         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
1023         (WebCore::StyleRareNonInheritedData::operator== const):
1024         * rendering/style/StyleRareNonInheritedData.h:
1025         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
1026         (WebCore::isValidColumnSpanner):
1027         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
1028         (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant):
1029
1030 2018-07-25  Chris Dumez  <cdumez@apple.com>
1031
1032         navigator.userAgent may return outdated value after webView.customUserAgent is set
1033         https://bugs.webkit.org/show_bug.cgi?id=188009
1034         <rdar://problem/42566456>
1035
1036         Reviewed by Alex Christensen.
1037
1038         Invalidate the navigator.userAgent cache whenever the user agent gets changed to avoid exposing
1039         outdated values to JavaScript.
1040
1041         * page/Navigator.cpp:
1042         (WebCore::Navigator::userAgentChanged):
1043         * page/Navigator.h:
1044         * page/NavigatorID.idl:
1045         * page/Page.cpp:
1046         (WebCore::Page::userAgentChanged):
1047         * page/Page.h:
1048
1049 2018-07-25  David Fenton  <david_fenton@apple.com>
1050
1051         Unreviewed, rolling out r234187.
1052
1053         the layout test added with this change is flaky on the bots
1054
1055         Reverted changeset:
1056
1057         "Animation stops with object-fit:contain on an animated 2d
1058         canvas"
1059         https://bugs.webkit.org/show_bug.cgi?id=187840
1060         https://trac.webkit.org/changeset/234187
1061
1062 2018-07-25  Chris Dumez  <cdumez@apple.com>
1063
1064         Turn assertion preventing removal of ActiveDOMObjects while we iterate over them into a RELEASE_ASSERT
1065         https://bugs.webkit.org/show_bug.cgi?id=187978
1066
1067         Reviewed by Eric Carlson.
1068
1069         Turn assertion preventing removal of ActiveDOMObjects while we iterate over them into a RELEASE_ASSERT.
1070         If code does this, this leads to hard to investigate crashes such as rdar://problem/42160890. With a
1071         release assertion, we would find the culprits right away. The assertion guarding against addition of
1072         ActiveDOMObjects while we iterate is already a RELEASE_ASSERT.
1073
1074         * dom/ScriptExecutionContext.cpp:
1075         (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension):
1076         (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
1077         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
1078         (WebCore::ScriptExecutionContext::willDestroyActiveDOMObject):
1079         * dom/ScriptExecutionContext.h:
1080
1081 2018-07-24  Chris Dumez  <cdumez@apple.com>
1082
1083         REGRESSION (r219757): Accessing response getter of XHR instance from IFRAME sets constructor to Object from the IFRAME
1084         https://bugs.webkit.org/show_bug.cgi?id=187411
1085         <rdar://problem/41920593>
1086
1087         Reviewed by Sam Weinig.
1088
1089         Update JSXMLHttpRequest::response() to use the XMLHttpRequest's global object exec when constructing a JSONObject
1090         for the response instead of the caller's exec.
1091
1092         Test: http/tests/xmlhttprequest/xhr-response-constructor-subframe.html
1093
1094         * bindings/js/JSXMLHttpRequestCustom.cpp:
1095         (WebCore::JSXMLHttpRequest::response const):
1096
1097 2018-07-24  Simon Fraser  <simon.fraser@apple.com>
1098
1099         Animation stops with object-fit:contain on an animated 2d canvas
1100         https://bugs.webkit.org/show_bug.cgi?id=187840
1101
1102         Reviewed by Zalan Bujtas.
1103         
1104         If a canvas has object-fit: cover or contain, repaints need to mapped through
1105         the rect that is used to position the canvas in the element bounds, which is replacedContentRect().
1106         
1107         Add a version of replacedContentRect() that doesn't require passing the intrinsicSize() since
1108         all but RenderVideo just pass the RenderReplaced's intrinsicSize.
1109
1110         Test: fast/repaint/canvas-object-fit.html
1111
1112         * html/HTMLCanvasElement.cpp:
1113         (WebCore::HTMLCanvasElement::didDraw):
1114         * rendering/RenderHTMLCanvas.cpp:
1115         (WebCore::RenderHTMLCanvas::paintReplaced):
1116         * rendering/RenderImage.cpp:
1117         (WebCore::RenderImage::updateInnerContentRect):
1118         (WebCore::RenderImage::paintReplaced):
1119         * rendering/RenderLayerBacking.cpp:
1120         (WebCore::RenderLayerBacking::contentsBox const):
1121         * rendering/RenderReplaced.h:
1122         (WebCore::RenderReplaced::replacedContentRect const):
1123         * rendering/shapes/ShapeOutsideInfo.cpp:
1124         (WebCore::ShapeOutsideInfo::createShapeForImage const):
1125
1126 2018-07-24  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1127
1128         [Curl] Add support for wss:// websockets
1129         https://bugs.webkit.org/show_bug.cgi?id=172630
1130
1131         Reviewed by Fujii Hironori.
1132
1133         To support secure WebSocket connection, it is almost rewritten by using existing
1134         backend for CurlHandle to handle TLS connection and proxy support.
1135
1136         Test: http/tests/websocket/tests/hybi/simple-wss.html
1137
1138         * platform/network/curl/CurlContext.cpp:
1139         (WebCore::CurlSocketHandle::CurlSocketHandle):
1140         (WebCore::CurlSocketHandle::connect):
1141         (WebCore::CurlSocketHandle::send):
1142         (WebCore::CurlSocketHandle::receive):
1143         (WebCore::CurlSocketHandle::wait):
1144         * platform/network/curl/CurlContext.h:
1145         * platform/network/curl/SocketStreamHandleImpl.h:
1146         (WebCore::SocketStreamHandleImpl::SocketData::SocketData): Deleted.
1147         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
1148         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
1149         (WebCore::SocketStreamHandleImpl::~SocketStreamHandleImpl):
1150         (WebCore::SocketStreamHandleImpl::platformSendInternal):
1151         (WebCore::SocketStreamHandleImpl::platformClose):
1152         (WebCore::SocketStreamHandleImpl::threadEntryPoint):
1153         (WebCore::SocketStreamHandleImpl::handleError):
1154         (WebCore::SocketStreamHandleImpl::stopThread):
1155         (WebCore::createCopy): Deleted.
1156         (WebCore::SocketStreamHandleImpl::readData): Deleted.
1157         (WebCore::SocketStreamHandleImpl::sendData): Deleted.
1158         (WebCore::SocketStreamHandleImpl::waitForAvailableData): Deleted.
1159         (WebCore::SocketStreamHandleImpl::startThread): Deleted.
1160         (WebCore::SocketStreamHandleImpl::didReceiveData): Deleted.
1161         (WebCore::SocketStreamHandleImpl::didOpenSocket): Deleted.
1162
1163 2018-07-24  Tim Horton  <timothy_horton@apple.com>
1164
1165         Enable Web Content Filtering on watchOS
1166         https://bugs.webkit.org/show_bug.cgi?id=187979
1167         <rdar://problem/42559346>
1168
1169         Reviewed by Wenson Hsieh.
1170
1171         * Configurations/FeatureDefines.xcconfig:
1172
1173 2018-07-24  Chris Dumez  <cdumez@apple.com>
1174
1175         Unreviewed, rolling out r233496 and r233571.
1176
1177         Likely cause of <rdar://problem/42160890> and
1178         <rdar://problem/42329658> as ActiveDOMObjects can now be
1179         constructed / destroyed while we are iterating over them.
1180
1181         Reverted changesets:
1182
1183         "Nullptr crash accessing Document in
1184         GenericEventQueue::dispatchOneEvent()"
1185         https://bugs.webkit.org/show_bug.cgi?id=187284
1186         https://trac.webkit.org/changeset/233496
1187
1188         "REGRESSION(r233496): macOS Sierra hits debug assertions in
1189         TrackListBase::suspend"
1190         https://bugs.webkit.org/show_bug.cgi?id=187378
1191         https://trac.webkit.org/changeset/233571
1192
1193 2018-07-24  Aditya Keerthi  <akeerthi@apple.com>
1194
1195         [Datalist][macOS] Display suggestions for input[type=color]
1196         https://bugs.webkit.org/show_bug.cgi?id=187794
1197
1198         Reviewed by Tim Horton.
1199
1200         * html/ColorInputType.cpp:
1201         (WebCore::ColorInputType::shouldRespectListAttribute):
1202
1203 2018-07-24  Ryan Haddad  <ryanhaddad@apple.com>
1204
1205         Unreviewed, rolling out r234121.
1206
1207         Caused perf test failures.
1208
1209         Reverted changeset:
1210
1211         "We should cache the compiled sandbox profile in a data vault"
1212         https://bugs.webkit.org/show_bug.cgi?id=184991
1213         https://trac.webkit.org/changeset/234121
1214
1215 2018-07-24  Antoine Quint  <graouts@apple.com>
1216
1217         [Web Animations] Add an ASSERT() to check the contract that a CSSTransition has a valid effect in setTimingProperties()
1218         https://bugs.webkit.org/show_bug.cgi?id=187954
1219
1220         Reviewed by Dean Jackson.
1221
1222         * animation/CSSTransition.cpp:
1223         (WebCore::CSSTransition::setTimingProperties):
1224
1225 2018-07-24  Antoine Quint  <graouts@apple.com>
1226
1227         [Web Animations] Crash when setting an animation style on an existing animation that had its effect set to null
1228         https://bugs.webkit.org/show_bug.cgi?id=187953
1229
1230         Reviewed by Dean Jackson.
1231
1232         Test: webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect.html
1233
1234         Ensure that we have a valid effect before proceeding to update its timing. 
1235
1236         * animation/CSSAnimation.cpp:
1237         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
1238
1239 2018-07-24  Eric Carlson  <eric.carlson@apple.com>
1240
1241         [MediaStream] Restructure getDisplayMedia classes
1242         https://bugs.webkit.org/show_bug.cgi?id=187905
1243         <rdar://problem/42500215>
1244
1245         Unreviewed build fix.
1246
1247         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp: 
1248
1249 2018-07-24  Antoine Quint  <graouts@apple.com>
1250
1251         [Web Animations] Crash when setting "animation: none" after clearing an animation's effect
1252         https://bugs.webkit.org/show_bug.cgi?id=187952
1253
1254         Reviewed by Dean Jackson.
1255
1256         Test: webanimations/setting-css-animation-none-after-clearing-effect.html
1257
1258         We need to ensure that the animation we're trying to remove has not had its effect cleared via the
1259         Web Animations API since its creation before trying to check its phase.
1260
1261         * animation/AnimationTimeline.cpp:
1262         (WebCore::AnimationTimeline::cancelOrRemoveDeclarativeAnimation):
1263
1264 2018-07-24  Antoine Quint  <graouts@apple.com>
1265
1266         [Web Animations] Crash accessing CSSAnimation::bindingsCurrentTime when effect has been set to null
1267         https://bugs.webkit.org/show_bug.cgi?id=187950
1268         <rdar://problem/42515747>
1269
1270         Reviewed by Dean Jackson.
1271
1272         Test: webanimations/accessing-current-time-after-clearing-css-animation-effect.html
1273
1274         While a CSSAnimation has an effect created for it by the implementation, the developer may yet manipulate
1275         its effect via the Web Animations API and set it to null. As such, we must not assume it's always non-null.
1276
1277         * animation/CSSAnimation.cpp:
1278         (WebCore::CSSAnimation::bindingsCurrentTime const):
1279
1280 2018-07-24  Zalan Bujtas  <zalan@apple.com>
1281
1282         [LFC][IFC] BlockContainer::establishesInlineFormattingContext should only check the first inflow child.
1283         https://bugs.webkit.org/show_bug.cgi?id=187965
1284
1285         Reviewed by Antti Koivisto.
1286
1287         * layout/layouttree/LayoutBlockContainer.cpp:
1288         (WebCore::Layout::BlockContainer::establishesInlineFormattingContext const):
1289
1290 2018-07-24  Myles C. Maxfield  <mmaxfield@apple.com>
1291
1292         [Cocoa] Stop crashing in lastResortFallbackFont()
1293         https://bugs.webkit.org/show_bug.cgi?id=187936
1294
1295         Reviewed by Jon Lee.
1296
1297         CoreText can get into a state where both Times and Lucida Grande are inaccessible.
1298         Instead of crashing, we should use the real LastResort, which is backed by a section
1299         in the .rodata of the CoreText dylib, and as such should always exist.
1300
1301         * platform/graphics/FontCache.cpp:
1302         (WebCore::FontCache::fontForFamily):
1303         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1304         (WebCore::FontCache::lastResortFallbackFont):
1305
1306 2018-07-24  Daniel Bates  <dabates@apple.com>
1307
1308         Cannot view PDF's on my.gov.au: "Refused to load https://my.gov.au/attachment/viewAttachment because it
1309         appears in neither the object-src directive nor the default-src directive of the Content Security Policy"
1310         https://bugs.webkit.org/show_bug.cgi?id=187870
1311         <rdar://problem/41190880>
1312
1313         Reviewed by Dean Jackson.
1314
1315         Fixes an issue where opening attachments on my.gov.au would show a "Blocked Plug-in" message.
1316
1317         Opening an attachment on my.gov.au opens a same-origin plugin document in a child window. Currently
1318         same-origin plugin documents inherit their CSP policy from their opener. If the opener's CSP policy
1319         disallows embedding plugins then the plugin document would be blocked from loading a plugin. For now
1320         we relax the inheritance model such that we only inherit the plugin-types and report-uri directives
1321         from the opener.
1322
1323         Developers that want to block plugin content from being loaded in a same-origin child window must now
1324         serve such plugin content with a CSP policy that includes "object-src 'none'". This matches the behavior
1325         described in the second Note in section object-src of the CSP 3 spec: <https://w3c.github.io/webappsec-csp/#directive-object-src>
1326         (Editor's Draft, 10 July 2018). It also makes the behavior in WebKit more closely aligned with the
1327         behavior of Chrome and Firefox.
1328
1329         Tests: http/tests/security/contentSecurityPolicy/same-origin-plugin-document-allowed-in-child-window.html
1330                http/tests/security/contentSecurityPolicy/same-origin-plugin-document-blocked-in-child-window-report.php
1331                http/tests/security/contentSecurityPolicy/same-origin-plugin-document-with-csp-blocked-in-child-window.html
1332
1333         * dom/Document.cpp:
1334         (WebCore::Document::initContentSecurityPolicy): For plugin documents that have an opener call ContentSecurityPolicy::createPolicyForPluginDocumentFrom()
1335         to only inherit the plugin-types and report-uri directives from its opener's CSP policy. Otherwise, call ContentSecurityPolicy::copyStateFrom()
1336         to inherit all directives from the owner frame as we do now.
1337         * page/csp/ContentSecurityPolicy.cpp:
1338         (WebCore::ContentSecurityPolicy::createPolicyForPluginDocumentFrom): Create a new policy from the specified policy
1339         inheriting only the plugin-types and report-uri directives.
1340         * page/csp/ContentSecurityPolicy.h: Define a new PolicyFrom enumerator, InheritedForPluginDocument, for plugin documents
1341         loaded in a child window.
1342         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
1343         (WebCore::ContentSecurityPolicyDirectiveList::parse): When policyFrom is InheritedForPluginDocument then only
1344         recognize the plugin-types and report-uri directives when parsing the policy.
1345
1346 2018-07-24  Daniel Bates  <dabates@apple.com>
1347
1348         Rename Document::firstPartyForSameSiteCookies() to siteForCookies()
1349         https://bugs.webkit.org/show_bug.cgi?id=187892
1350
1351         Reviewed by Dean Jackson.
1352
1353         Standardize on the spec. language "site for cookies" for the names of the setter and getter
1354         on Document. The latest description of Same-Site cookies is in <https://httpwg.org/http-extensions/rfc6265bis.html>.
1355
1356         No functionality changed. So, no new tests.
1357
1358         * dom/Document.h:
1359         (WebCore::Document::siteForCookies const):
1360         (WebCore::Document::setSiteForCookies):
1361         (WebCore::Document::firstPartyForSameSiteCookies const): Deleted.
1362         (WebCore::Document::setFirstPartyForSameSiteCookies): Deleted.
1363         * loader/FrameLoader.cpp:
1364         (WebCore::FrameLoader::setFirstPartyForCookies):
1365         (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded):
1366         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1367         (WebCore::createPageForServiceWorker):
1368         * xml/XSLTProcessor.cpp:
1369         (WebCore::XSLTProcessor::createDocumentFromSource):
1370
1371 2018-07-24  Ross Kirsling  <ross.kirsling@sony.com>
1372
1373         WebCore::URL::hostIsIPAddress needs a Windows implementation
1374         https://bugs.webkit.org/show_bug.cgi?id=187859
1375
1376         Reviewed by Fujii Hironori.
1377
1378         * platform/URL.cpp:
1379         (WebCore::isIPv4Address): Added.
1380         (WebCore::isIPv6Address): Added.
1381         (WebCore::URL::hostIsIPAddress):
1382         Turn this stub into a platform-agnostic default implementation.
1383
1384 2018-07-24  Eric Carlson  <eric.carlson@apple.com>
1385
1386         [MediaStream] Restructure getDisplayMedia classes
1387         https://bugs.webkit.org/show_bug.cgi?id=187905
1388
1389         Reviewed by Dean Jackson.
1390
1391         No new tests, no functional changes.
1392
1393         * platform/mediastream/CaptureDeviceManager.h:
1394         (WebCore::CaptureDeviceManager::refreshCaptureDevices): Deleted, no need for it to be a 
1395         virtual method.
1396         * platform/mediastream/mac/AVCaptureDeviceManager.h:
1397
1398         * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h: refreshCaptureDevices is
1399         no longer virtual.
1400
1401         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
1402         (WebCore::DisplayCaptureManagerCocoa::captureDevices):
1403         (WebCore::DisplayCaptureManagerCocoa::updateDisplayCaptureDevices): Moved functionality 
1404         to ScreenDisplayCaptureSourceMac.
1405         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): Ditto.
1406         (WebCore::displayReconfigurationCallBack): Deleted, moved to ScreenDisplayCaptureSourceMac.
1407         (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa): Deleted.
1408         (WebCore::DisplayCaptureManagerCocoa::refreshCaptureDevices): Deleted.
1409         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
1410
1411         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
1412         (WebCore::roundUpToMacroblockMultiple): Moved from ScreenDisplayCaptureSourceMac.
1413         (WebCore::DisplayCaptureSourceCocoa::applySize): Ditto.
1414         (WebCore::DisplayCaptureSourceCocoa::sampleBufferFromPixelBuffer): Ditto.
1415         (WebCore::DisplayCaptureSourceCocoa::pixelBufferFromIOSurface): Ditto.
1416         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
1417
1418         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
1419         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
1420         (WebCore::updateDisplayID):
1421         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Fix log message.
1422         (WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream): Ditto.
1423         (WebCore::ScreenDisplayCaptureSourceMac::applySize): Update for base class changes.
1424         (WebCore::ScreenDisplayCaptureSourceMac::applyFrameRate): Ditto.
1425         (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable): Ditto.
1426         (WebCore::ScreenDisplayCaptureSourceMac::screenCaptureDeviceWithPersistentID): Moved from
1427         DisplayCaptureManagerCocoa.
1428         (WebCore::ScreenDisplayCaptureSourceMac::screenCaptureDevices): Ditto.
1429         (WebCore::roundUpToMacroblockMultiple): Moved to DisplayCaptureSourceCocoa.
1430         (WebCore::ScreenDisplayCaptureSourceMac::updateDisplayID): Ditto.
1431         (WebCore::ScreenDisplayCaptureSourceMac::sampleBufferFromPixelBuffer): Ditto.
1432         (WebCore::ScreenDisplayCaptureSourceMac::pixelBufferFromIOSurface): Ditto.
1433
1434 2018-07-24  Zalan Bujtas  <zalan@apple.com>
1435
1436         [LFC] Move geometry data structures to a dedicated file
1437         https://bugs.webkit.org/show_bug.cgi?id=187939
1438
1439         Reviewed by Antti Koivisto.
1440
1441         * WebCore.xcodeproj/project.pbxproj:
1442         * layout/FormattingContext.h:
1443         (WebCore::Layout::FormattingContext::Geometry::Position::operator LayoutPoint const): Deleted.
1444         * layout/FormattingContextGeometry.cpp:
1445         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
1446         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1447         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1448         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1449         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
1450         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1451         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
1452         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
1453         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
1454         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
1455         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
1456         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
1457         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1458         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1459         (WebCore::Layout::FormattingContext::Geometry::computedBorder):
1460         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
1461         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
1462         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
1463         * layout/blockformatting/BlockFormattingContext.h:
1464         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1465         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1466         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1467         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
1468         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
1469         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
1470         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
1471         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
1472         * layout/displaytree/DisplayBox.h:
1473         (WebCore::Display::Box::setHorizontalMargin):
1474         (WebCore::Display::Box::setVerticalMargin):
1475         (WebCore::Display::Box::setVerticalNonCollapsedMargin):
1476         (WebCore::Display::Box::setBorder):
1477         (WebCore::Display::Box::setPadding):
1478
1479 2018-07-24  Thibault Saunier  <tsaunier@igalia.com>
1480
1481         [GStreamer] Implement bitrate modulation support in GStreamer based libwebrtc Encoders
1482         https://bugs.webkit.org/show_bug.cgi?id=187643
1483
1484         Reviewed by Philippe Normand.
1485
1486         Problem being that we do not have a proper unified encoder API in GStreamer, some work
1487         started at https://bugzilla.gnome.org/show_bug.cgi?id=796716 but it is quite controversial
1488         and meanwhile we should just move forward working around that limitation.
1489
1490         Source/WebCore:
1491         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
1492         (WebCore::GStreamerVideoEncoder::GStreamerVideoEncoder):
1493         (WebCore::GStreamerVideoEncoder::InitEncode):
1494         (WebCore::GStreamerVideoEncoder::getBitrateSetter):
1495         (WebCore::GStreamerVideoEncoder::createEncoder):
1496         (WebCore::GStreamerVideoEncoder::AddCodecIfSupported):
1497         (WebCore::GStreamerVideoEncoder::SetRestrictionCaps):
1498         (WebCore::GStreamerVideoEncoder::CreateEncoder): Deleted.
1499
1500 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
1501
1502         REGRESSION(r234055): inverted return values in MediaPlayer::wouldTaintOrigin()
1503         https://bugs.webkit.org/show_bug.cgi?id=187944
1504
1505         Reviewed by Carlos Garcia Campos.
1506
1507         The MediaPlayer::wouldTaintOrigin(), as introduced in r234055, should
1508         return false when the URL protocol is `data:`, and should return true
1509         when the given SecurityOrigin cannot access the media URL.
1510
1511         This matches behavior of CanvasRenderingContext::wouldTaintOrigin()
1512         which the new method falls back to when the MediaPlayerPrivate
1513         implementation doesn't or can't determine the would-taint result.
1514
1515         This fixes a bunch of failing and timing-out WebGL test cases on ports
1516         using GStreamer (on which the MediaPlayerPrivate derivate doesn't
1517         implement the wouldTaintOrigin() method).
1518
1519         * platform/graphics/MediaPlayer.cpp:
1520         (WebCore::MediaPlayer::wouldTaintOrigin const):
1521
1522 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
1523
1524         [TextureMapper] Separate repaint counter state from debug visuals
1525         https://bugs.webkit.org/show_bug.cgi?id=187946
1526
1527         Reviewed by Carlos Garcia Campos.
1528
1529         Instead of managing the repaint counter visibility along with the
1530         debug border visuals, do that together with the repaint count value.
1531
1532         TextureMapperLayer::setRepaintCount() is renamed to setRepaintCounter()
1533         and now also sets the repaint counter visibility state instead of the
1534         setDebugVisuals() method.
1535
1536         GraphicsLayerTextureMapper implementation is adjusted appropriately.
1537         The unused setRepaintCount() method is also removed.
1538
1539         CoordinatedGraphicsLayerState now holds repaint counter state (both
1540         visibility and count value) in a struct that's separate from debug
1541         border state. CoordinatedGraphicsLayer implementation now updates
1542         that state accordingly.
1543
1544         No new tests -- no change in behavior.
1545
1546         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
1547         (WebCore::GraphicsLayerTextureMapper::setShowRepaintCounter):
1548         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
1549         (WebCore::GraphicsLayerTextureMapper::setRepaintCount): Deleted.
1550         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
1551         * platform/graphics/texmap/TextureMapperLayer.cpp:
1552         (WebCore::TextureMapperLayer::setDebugVisuals):
1553         (WebCore::TextureMapperLayer::setRepaintCounter):
1554         (WebCore::TextureMapperLayer::setRepaintCount): Deleted.
1555         * platform/graphics/texmap/TextureMapperLayer.h:
1556         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1557         (WebCore::CoordinatedGraphicsLayer::didUpdateTileBuffers):
1558         (WebCore::CoordinatedGraphicsLayer::setShowRepaintCounter):
1559         (WebCore::CoordinatedGraphicsLayer::syncLayerState):
1560         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
1561         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
1562         (WebCore::DebugVisuals::DebugVisuals): Deleted.
1563
1564 2018-07-24  Thibault Saunier  <tsaunier@igalia.com>
1565
1566         [WPE][GTK] Implement PeerConnection API on top of libwebrtc
1567         https://bugs.webkit.org/show_bug.cgi?id=186932
1568
1569         Reviewed by Philippe Normand.
1570
1571         Enabled many webrtc tests.
1572
1573         * platform/GStreamer.cmake: Build new files
1574         * platform/graphics/gstreamer/GStreamerCommon.cpp: Fix minor style issues
1575         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: Add a way to give precise name to pipelines
1576         and give useful names to pipelines with sources comming from a PeerConnection
1577         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Ditto.
1578         * platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.cpp: Added. Implement a subclass of webrtc::VideoFrame
1579         to represent a kNative GStreamer video frame.
1580         * platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.h: Added. Ditto.
1581         * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp: Handle incoming audio samples from libwebrtc.
1582         * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.h: Ditto.
1583         * platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp: Handle incoming video frames from libwebrtc.
1584         * platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h: Ditto.
1585         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp: Handle passing locally captured audio sample to libwebrtc.
1586         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h: Ditto.
1587         * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.cpp: Handle passing locally captured vidoe frames to libwebrtc.
1588         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp: Added. Implement a video decoder factory and LibWebRTC Video decoders based on GStreamer.
1589         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.h: Added. Ditto.
1590         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp: Added. Implement a video encoder factory and LibWebRTC H264/VP8 Video encoders based on GStreamer.
1591         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.h: Added. Ditto.
1592         * platform/mediastream/libwebrtc/LibWebRTCAudioFormat.h: Add information about signness of the LibWebRTC audio format.
1593         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp: Add support for newly added Encoder/Decoder factories.
1594         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.h: Ditto.
1595
1596 2018-07-24  Dirk Schulze  <krit@webkit.org>
1597
1598         [css-masking] Black backdrop on -webkit-clip-path on SVG root
1599         https://bugs.webkit.org/show_bug.cgi?id=187880
1600
1601         Reviewed by Simon Fraser.
1602
1603         For SVG document root elements, we currently clip twice:
1604         In RenderLayer and SVGRenderSupport.
1605         Avoid clipping in RenderLayer which currently clips before we established a
1606         backdrop for an SVG document.
1607
1608         Tests: svg/clip-path/clip-path-on-svg-005-expected.svg
1609                svg/clip-path/clip-path-on-svg-005.svg
1610
1611         * rendering/RenderLayer.cpp:
1612         (WebCore::RenderLayer::setupClipPath): Skip actual clipping.
1613
1614 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
1615
1616         [Nicosia] Add TextureMapperAnimations member to CompositingLayer::LayerState
1617         https://bugs.webkit.org/show_bug.cgi?id=187941
1618
1619         Reviewed by Carlos Garcia Campos.
1620
1621         Nicosia::CompositingLayer::LayerState gains a TextureMapperAnimations
1622         member that will be assigned a list of all active animations during each
1623         layer flush. Despite the name, TextureMapperAnimations doesn't depend on
1624         any other TextureMapper class. It might be renamed and moved in the
1625         future, but for now it's used as-is.
1626
1627         In CoordinatedGraphicsLayer, the syncAnimations() method now flips on
1628         the animationsChanged flag in the LayerState::Delta struct. This causes
1629         all the active animations to be copied over into the layer state in
1630         flushCompositingStateForThisLayerOnly().
1631
1632         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
1633         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1634         (WebCore::CoordinatedGraphicsLayer::syncAnimations):
1635         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
1636
1637 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
1638
1639         [Nicosia] Add FilterOperations member to CompositionLayer::LayerState
1640         https://bugs.webkit.org/show_bug.cgi?id=187901
1641
1642         Reviewed by Carlos Garcia Campos.
1643
1644         Nicosia::CompositionLayer::LayerState gains a FilterOperations member
1645         that can be assigned the list of filter operations for a given layer.
1646         The corresponding filtersChanged boolean is added to LayerState::Delta.
1647
1648         CoordinatedGraphicsLayer::syncFilters() flips on that delta member,
1649         which in turn causes the FilterOperations value to be updated during
1650         the layer flush, in flushCompositingStateForThisLayerOnly().
1651
1652         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
1653         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1654         (WebCore::CoordinatedGraphicsLayer::syncFilters):
1655         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
1656
1657 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
1658
1659         [CoordGraphics] Use adjusted position, anchor point, size values for Nicosia::CompositionLayer state
1660         https://bugs.webkit.org/show_bug.cgi?id=187899
1661
1662         Reviewed by Carlos Garcia Campos.
1663
1664         As is done for the CoordinatedGraphicsLayerState, the scale-adjusted
1665         position, anchor point and size values should be used when updating the
1666         corresponding Nicosia::CompositionLayer::LayerState members.
1667
1668         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1669         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
1670
1671 2018-07-23  Manuel Rego Casasnovas  <rego@igalia.com>
1672
1673         [css-grid] Add support for calc() in gutter properties
1674         https://bugs.webkit.org/show_bug.cgi?id=187902
1675
1676         Reviewed by Simon Fraser.
1677
1678         The parsing was already accepting calc() in grid row and column gaps,
1679         however the code was not taking that into account properly.
1680         If the calc() had a percentage it was ignored and that's wrong.
1681
1682         The fix is just a change in the ceck at RenderGrid::availableSpaceForGutters().
1683
1684         Tests: imported/w3c/web-platform-tests/css/css-grid/abspos/grid-positioned-items-gaps-002-rtl.html
1685                imported/w3c/web-platform-tests/css/css-grid/abspos/grid-positioned-items-gaps-002.html
1686                imported/w3c/web-platform-tests/css/css-grid/alignment/grid-gutters-011.html
1687                imported/w3c/web-platform-tests/css/css-grid/alignment/grid-gutters-012.html
1688
1689         * rendering/RenderGrid.cpp:
1690         (WebCore::RenderGrid::availableSpaceForGutters const):
1691
1692 2018-07-23  Aditya Keerthi  <akeerthi@apple.com>
1693
1694         Remove extraneous #endif in html.css
1695         https://bugs.webkit.org/show_bug.cgi?id=187934
1696
1697         Reviewed by Tim Horton.
1698
1699         * css/html.css: Remove extraneous #endif.
1700
1701 2018-07-23  Sihui Liu  <sihui_liu@apple.com>
1702
1703         CrashTracer: com.apple.WebKit.Storage at WebCore: WebCore::encodeKey
1704         https://bugs.webkit.org/show_bug.cgi?id=187927
1705
1706         Reviewed by Chris Dumez.
1707
1708         IDBKeyData is valid only when each key of it is valid.
1709
1710         Test: LayoutTests/storage/indexeddb/index-multientry.html
1711
1712         * Modules/indexeddb/IDBKeyData.cpp:
1713         (WebCore::IDBKeyData::isValid const):
1714         * Modules/indexeddb/IDBKeyData.h:
1715         (WebCore::IDBKeyData::isValid const): Deleted.
1716
1717 2018-07-23  Ben Richards  <benton_richards@apple.com>
1718
1719         We should cache the compiled sandbox profile in a data vault
1720         https://bugs.webkit.org/show_bug.cgi?id=184991
1721
1722         Reviewed by Ryosuke Niwa.
1723
1724         Added functionality to FileHandle so that it can lock a file while open.
1725         Added a function to FileSystem to delete non empty directories.
1726
1727         * platform/FileHandle.cpp:
1728         (WebCore::FileHandle::FileHandle):
1729         (WebCore::FileHandle::open):
1730         (WebCore::FileHandle::close):
1731         * platform/FileHandle.h:
1732         * platform/FileSystem.h:
1733         * platform/cocoa/FileSystemCocoa.mm:
1734         (WebCore::FileSystem::deleteNonEmptyDirectory):
1735
1736 2018-07-23  Justin Fan  <justin_fan@apple.com>
1737
1738         [macOS] Ensure that WebGL contexts are always set to an accelerated virtual screen
1739         https://bugs.webkit.org/show_bug.cgi?id=187923
1740
1741         Reviewed by Dean Jackson.
1742
1743         On eGPU displays, it is possible that CGL does not match the preferred renderer. 
1744         In this case, and when the web process is blocked from accessing the window server, 
1745         3D contexts *may* default to the software renderer. Ensure that even if this occurs,
1746         we set the context to use a hardware-accelerated renderer/virtual screen.
1747
1748         No new tests. Existing behavior covered by existing tests.
1749         Requires multiple screens, at least one attached to an eGPU, to stress. 
1750
1751         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
1752         (WebCore::identifyAndSetCurrentGPU):
1753
1754 2018-07-23  Sam Weinig  <sam@webkit.org>
1755
1756         Convert some obvious never-null pointers to references in the editing code
1757         https://bugs.webkit.org/show_bug.cgi?id=187914
1758
1759         Reviewed by Dean Jackson.
1760
1761         Fixup trivial cases of never-null pointers that really should be references.
1762
1763         * editing/ApplyStyleCommand.cpp:
1764         (WebCore::ApplyStyleCommand::shouldApplyInlineStyleToRun):
1765         (WebCore::ApplyStyleCommand::removeInlineStyleFromElement):
1766         (WebCore::ApplyStyleCommand::removeImplicitlyStyledElement):
1767         (WebCore::ApplyStyleCommand::removeCSSStyle):
1768         (WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
1769         (WebCore::ApplyStyleCommand::applyInlineStyleChange):
1770         * editing/EditingStyle.cpp:
1771         (WebCore::EditingStyle::overrideWithStyle):
1772         (WebCore::EditingStyle::conflictsWithInlineStyleOfElement const):
1773         (WebCore::EditingStyle::conflictsWithImplicitStyleOfElement const):
1774         (WebCore::EditingStyle::conflictsWithImplicitStyleOfAttributes const):
1775         (WebCore::EditingStyle::extractConflictingImplicitStyleOfAttributes const):
1776         (WebCore::EditingStyle::styleIsPresentInComputedStyleOfNode const):
1777         (WebCore::EditingStyle::elementIsStyledSpanOrHTMLEquivalent):
1778         (WebCore::EditingStyle::mergeInlineStyleOfElement):
1779         (WebCore::EditingStyle::wrappingStyleForSerialization):
1780         (WebCore::EditingStyle::legacyFontSize const):
1781         (WebCore::StyleChange::StyleChange):
1782         (WebCore::StyleChange::extractTextStyles):
1783         (WebCore::legacyFontSizeFromCSSValue):
1784         * editing/EditingStyle.h:
1785         (WebCore::EditingStyle::conflictsWithInlineStyleOfElement const):
1786         * editing/Editor.cpp:
1787         (WebCore::Editor::selectionStartCSSPropertyValue):
1788         * editing/ReplaceSelectionCommand.cpp:
1789         (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
1790         (WebCore::isInlineNodeWithStyle):
1791         * editing/markup.cpp:
1792         (WebCore::StyledMarkupAccumulator::appendElement):
1793         (WebCore::StyledMarkupAccumulator::serializeNodes):
1794
1795 2018-07-23  Per Arne Vollan  <pvollan@apple.com>
1796
1797         WebCore::primaryScreenDisplayID() always return 0
1798         https://bugs.webkit.org/show_bug.cgi?id=187922
1799         <rdar://problem/42286933>
1800
1801         Reviewed by Geoffrey Garen.
1802
1803         This function should return a valid display ID.
1804
1805         No new tests. Testing this requires a dual monitor setup.
1806
1807         * platform/mac/PlatformScreenMac.mm:
1808         (WebCore::primaryScreenDisplayID):
1809
1810 2018-07-23  Nan Wang  <n_wang@apple.com>
1811
1812         AX: Press tab to highlight items on a webpage is not working with voiceover enabled
1813         https://bugs.webkit.org/show_bug.cgi?id=187824
1814
1815         Reviewed by Zalan Bujtas.
1816
1817         We are deferring posting focused element change notification when the document needs a
1818         style recalculation. However, we only perform the cache update after a layout is completed.
1819         Added a timer to perform the cache update in the next runloop when non-layout type of mutation
1820         happens.
1821         
1822         Test: accessibility/mac/tab-focus-post-notification.html
1823
1824         * accessibility/AXObjectCache.cpp:
1825         (WebCore::AXObjectCache::AXObjectCache):
1826         (WebCore::AXObjectCache::~AXObjectCache):
1827         (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded):
1828         (WebCore::AXObjectCache::performCacheUpdateTimerFired):
1829         * accessibility/AXObjectCache.h:
1830         (WebCore::AXObjectCache::AXObjectCache):
1831         (WebCore::AXObjectCache::performCacheUpdateTimerFired):
1832
1833 2018-07-23  Chris Dumez  <cdumez@apple.com>
1834
1835         WebResourceLoadStatisticsStore fails to unregister itself as a MessageReceiver in its destructor
1836         https://bugs.webkit.org/show_bug.cgi?id=187910
1837         <rdar://problem/42356526>
1838
1839         Reviewed by Brent Fulgham.
1840
1841         Add internals API that causes the ResourceLoadObserver to notify its observer, and avoid waiting
1842         for the 5 second delay.
1843
1844         * testing/Internals.cpp:
1845         (WebCore::Internals::notifyResourceLoadObserver):
1846         * testing/Internals.h:
1847         * testing/Internals.idl:
1848
1849 2018-07-23  Zalan Bujtas  <zalan@apple.com>
1850
1851         [LCF][IFC] Add support for hyphenation.
1852         https://bugs.webkit.org/show_bug.cgi?id=187913
1853
1854         Reviewed by Antti Koivisto.
1855
1856         Move the hyphenation logic over from SimpleLineLayout::TextFragmentIterator.
1857
1858         * layout/inlineformatting/textlayout/Runs.h:
1859         (WebCore::Layout::TextRun::hasHyphen const):
1860         (WebCore::Layout::LayoutRun::setHasHyphen):
1861         (WebCore::Layout::LayoutRun::hasHyphen const):
1862         (WebCore::Layout::LayoutRun::LayoutRun):
1863         (WebCore::Layout::TextRun::createNonWhitespaceRunWithHyphen):
1864         (WebCore::Layout::TextRun::TextRun):
1865         * layout/inlineformatting/textlayout/TextContentProvider.cpp:
1866         (WebCore::Layout::TextContentProvider::findTextItemSlow const):
1867         (WebCore::Layout::TextContentProvider::width const):
1868         (WebCore::Layout::TextContentProvider::hyphenPositionBefore const):
1869         * layout/inlineformatting/textlayout/TextContentProvider.h:
1870         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.cpp:
1871         (WebCore::Layout::SimpleLineBreaker::Line::setTextAlign):
1872         (WebCore::Layout::SimpleLineBreaker::Line::justifyRuns):
1873         (WebCore::Layout::SimpleLineBreaker::Line::adjustRunsForTextAlign):
1874         (WebCore::Layout::SimpleLineBreaker::Line::collectExpansionOpportunities):
1875         (WebCore::Layout::SimpleLineBreaker::Line::closeLastRun):
1876         (WebCore::Layout::SimpleLineBreaker::Line::append):
1877         (WebCore::Layout::SimpleLineBreaker::Line::reset):
1878         (WebCore::Layout::SimpleLineBreaker::Style::Style):
1879         (WebCore::Layout::SimpleLineBreaker::handleLineEnd):
1880         (WebCore::Layout::SimpleLineBreaker::createRunsForLine):
1881         (WebCore::Layout::SimpleLineBreaker::hyphenPositionBefore const):
1882         (WebCore::Layout::SimpleLineBreaker::adjustSplitPositionWithHyphenation const):
1883         (WebCore::Layout::SimpleLineBreaker::split const):
1884         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.h:
1885
1886 2018-07-23  Antoine Quint  <graouts@apple.com>
1887
1888         [Web Animations] Querying the current time of a finished CSSAnimation after removing its target leads to a crash
1889         https://bugs.webkit.org/show_bug.cgi?id=187906
1890
1891         Reviewed by Dean Jackson.
1892
1893         Test: webanimations/accessing-current-time-after-finished-css-animation-target-removal.html
1894
1895         Because we carelessly look at a CSSAnimation's effect's timing in DeclarativeAnimation::bindingsCurrentTime
1896         without checking that the effect is non-null, we can crash in the case where the animation is finished and
1897         its target element has been removed, which caused the effect to be set to null.
1898
1899         We do not actually fix the lack of a null check, which will be the scope of a different patch, but instead
1900         ensure that we do _not_ set the animation's effect to null when its target is removed, which used to be
1901         performed via a call to WebAnimation::remove(). Instead, we introduce AnimationTimeline::elementWasRemoved()
1902         which notifies the timeline of an element being removed such that we may stop referencing any animation
1903         targeting this element from the various data structures holding strong references to the animation in question,
1904         and we then cancel the animation silently, which is a new option that ensures promises aren't resolved or
1905         rejected as a result.
1906
1907         Finally, the WebAnimation and AnimationEffectReadOnly classes established a ref-cycle as WebAnimation has
1908         `RefPtr<AnimationEffectReadOnly> m_effect` and AnimationEffectReadOnly has `RefPtr<WebAnimation> m_animation`.
1909         While it is correct that WebAnimation owns its effect, which is established by the DOM API, the
1910         reverse is not correct since we only hold the reverse internally for the benefit of our implementation.
1911         As such, we change AnimationEffectReadOnly's m_animation to be a WeakPtr<WebAnimation>. This means not
1912         calling WebAnimation::remove() and simply removing the animation from the animation maps on the timeline
1913         is sufficient to guarantee that the document timeline will not leak (and with it the document).
1914
1915         * animation/AnimationEffectReadOnly.h:
1916         (WebCore::AnimationEffectReadOnly::setAnimation):
1917         * animation/AnimationTimeline.cpp:
1918         (WebCore::AnimationTimeline::elementWasRemoved):
1919         * animation/AnimationTimeline.h:
1920         * animation/WebAnimation.cpp:
1921         (WebCore::WebAnimation::cancel):
1922         (WebCore::WebAnimation::resetPendingTasks):
1923         * animation/WebAnimation.h:
1924         * dom/Element.cpp:
1925         (WebCore::Element::removedFromAncestor):
1926         * rendering/updating/RenderTreeUpdater.cpp:
1927         (WebCore::RenderTreeUpdater::tearDownRenderers):
1928
1929 2018-07-23  Aditya Keerthi  <akeerthi@apple.com>
1930
1931         [iOS] Add support for input[type=color]
1932         https://bugs.webkit.org/show_bug.cgi?id=187871
1933
1934         Reviewed by Tim Horton.
1935
1936         * css/html.css: Remove unwanted styling for color inputs with a list attribute.
1937         * html/ColorInputType.cpp: Make the element focusable.
1938         (WebCore::ColorInputType::isMouseFocusable const):
1939         (WebCore::ColorInputType::isKeyboardFocusable const):
1940         * html/ColorInputType.h:
1941         * html/HTMLInputElement.h: Expose isColorControl() to WebKit.
1942         * page/Chrome.cpp:
1943         (WebCore::Chrome::createColorChooser):
1944
1945 2018-07-22  Dean Jackson  <dino@apple.com>
1946
1947         fullscreen env() variables should have initial values
1948         https://bugs.webkit.org/show_bug.cgi?id=187897
1949         <rdar://problem/42485682>
1950
1951         Reviewed by Sam Weinig.
1952
1953         The env() values for fullscreen properties need to be
1954         initialized, rather than wait for values to be set from WebKit.
1955         Without this, feature detection doesn't work, and properties
1956         won't parse correctly.
1957
1958         Test: fullscreen/fullscreen-env-initial.html
1959
1960         * dom/ConstantPropertyMap.cpp:
1961         (WebCore::ConstantPropertyMap::buildValues): Initialize the fullscreen values.
1962         (WebCore::ConstantPropertyMap::updateConstantsForFullscreen): Renamed function, because it
1963         also updates the duration value.
1964         (WebCore::ConstantPropertyMap::didChangeFullscreenInsets): Call new name.
1965         (WebCore::ConstantPropertyMap::updateConstantsForFullscreenInsets): Deleted.
1966         * dom/ConstantPropertyMap.h:
1967         * page/Page.cpp:
1968         (WebCore::Page::setFullscreenAutoHideDuration): Don't change the value if it doesn't need it.
1969         * page/Page.h: Add accessor for fullscreenAutoHideDuration. Also add a member variable.
1970         (WebCore::Page::fullscreenAutoHideDuration const):
1971
1972 2018-07-22  Zalan Bujtas  <zalan@apple.com>
1973
1974         [LFC][IFC] Add center/right/justify line alignment support.
1975         https://bugs.webkit.org/show_bug.cgi?id=187890
1976
1977         Reviewed by Antti Koivisto.
1978
1979         Move over some more code from simple line layout.
1980         (though text-align: justify is more preformant as now expansion opportunities are added as we process the text runs
1981         -as opposed to iterting through the runs again when we reach the end of the line.) 
1982
1983         * layout/inlineformatting/textlayout/Runs.h:
1984         (WebCore::Layout::LayoutRun::setLeft):
1985         (WebCore::Layout::LayoutRun::setExpansion):
1986         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.cpp:
1987         (WebCore::Layout::SimpleLineBreaker::Line::Line):
1988         (WebCore::Layout::SimpleLineBreaker::Line::setTextAlign):
1989         (WebCore::Layout::SimpleLineBreaker::Line::adjustedLeftForTextAlign const):
1990         (WebCore::Layout::SimpleLineBreaker::Line::justifyRuns):
1991         (WebCore::Layout::SimpleLineBreaker::Line::adjustRunsForTextAlign):
1992         (WebCore::Layout::expansionOpportunity):
1993         (WebCore::Layout::expansionBehavior):
1994         (WebCore::Layout::SimpleLineBreaker::Line::collectExpansionOpportunities):
1995         (WebCore::Layout::SimpleLineBreaker::Line::closeLastRun):
1996         (WebCore::Layout::SimpleLineBreaker::Line::append):
1997         (WebCore::Layout::SimpleLineBreaker::Line::collapseTrailingWhitespace):
1998         (WebCore::Layout::SimpleLineBreaker::Line::reset):
1999         (WebCore::Layout::SimpleLineBreaker::Style::Style):
2000         (WebCore::Layout::SimpleLineBreaker::handleLineEnd):
2001         (WebCore::Layout::SimpleLineBreaker::handleLineStart):
2002         (WebCore::Layout::isTextAlignRight):
2003         (WebCore::Layout::SimpleLineBreaker::createRunsForLine):
2004         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.h:
2005         (WebCore::Layout::SimpleLineBreaker::Line::setAvailableWidth):
2006         (WebCore::Layout::SimpleLineBreaker::Line::setCollapseWhitespace):
2007
2008 2018-07-21  Zalan Bujtas  <zalan@apple.com>
2009
2010         [LFC][IFC] Add verification for inline text runs.
2011         https://bugs.webkit.org/show_bug.cgi?id=187879
2012
2013         Reviewed by Antti Koivisto.
2014
2015         * layout/Verification.cpp:
2016         (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
2017         (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
2018         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
2019         (WebCore::Layout::verifyAndOutputSubtree):
2020         (WebCore::Layout::outputMismatchingBoxInformationIfNeeded): Deleted.
2021         * layout/inlineformatting/InlineFormattingContext.cpp:
2022         (WebCore::Layout::InlineFormattingContext::layout const):
2023         * layout/inlineformatting/InlineFormattingState.h:
2024         (WebCore::Layout::InlineFormattingState::addLayoutRuns):
2025         (WebCore::Layout::InlineFormattingState::layoutRuns const):
2026         * layout/layouttree/LayoutTreeBuilder.cpp:
2027         (WebCore::Layout::outputLayoutBox):
2028         (WebCore::Layout::outputLayoutTree):
2029         (WebCore::Layout::TreeBuilder::showLayoutTree):
2030
2031 2018-07-21  Zalan Bujtas  <zalan@apple.com>
2032
2033         [LFC] Do not use virtual methods to construct floating/formatting states.
2034         https://bugs.webkit.org/show_bug.cgi?id=187875
2035
2036         Reviewed by Antti Koivisto.
2037
2038         LayoutContext::establishedFormattingState() does not require FormattingContext anymore only the root of the context.
2039
2040         * layout/FormattingContext.cpp:
2041         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
2042         * layout/FormattingContext.h:
2043         * layout/LayoutContext.cpp:
2044         (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
2045         (WebCore::Layout::LayoutContext::formattingStateForBox const):
2046         (WebCore::Layout::LayoutContext::establishedFormattingState):
2047         * layout/LayoutContext.h:
2048         * layout/blockformatting/BlockFormattingContext.cpp:
2049         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
2050         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
2051         (WebCore::Layout::BlockFormattingContext::createFormattingState const): Deleted.
2052         (WebCore::Layout::BlockFormattingContext::createOrFindFloatingState const): Deleted.
2053         * layout/blockformatting/BlockFormattingContext.h:
2054         * layout/inlineformatting/InlineFormattingContext.cpp:
2055         (WebCore::Layout::InlineFormattingContext::createFormattingState const): Deleted.
2056         (WebCore::Layout::InlineFormattingContext::createOrFindFloatingState const): Deleted.
2057         * layout/inlineformatting/InlineFormattingContext.h:
2058
2059 2018-07-21  Zalan Bujtas  <zalan@apple.com>
2060
2061         [LFC][BFC] Do not collapse top/bottom margin with first/last inflow child from a non-block formatting context.
2062         https://bugs.webkit.org/show_bug.cgi?id=187867
2063
2064         Reviewed by Antti Koivisto.
2065
2066         The box's top/bottom margin never collapses with a non-block inflow child.
2067
2068         * layout/blockformatting/BlockMarginCollapse.cpp:
2069         (WebCore::Layout::isMarginTopCollapsedWithSibling):
2070         (WebCore::Layout::isMarginBottomCollapsedWithSibling):
2071         (WebCore::Layout::isMarginTopCollapsedWithParent):
2072         (WebCore::Layout::isMarginBottomCollapsedThrough):
2073         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild):
2074         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginTop):
2075         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginTop):
2076         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBottom):
2077         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop):
2078         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom):
2079         (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
2080         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild):
2081         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBottom):
2082         * layout/layouttree/LayoutBox.cpp:
2083         (WebCore::Layout::Box::establishesBlockFormattingContextOnly const): <div style="overflow: hidden">foobar</div> establishes both inline and block formatting context (inline wins though).
2084         * layout/layouttree/LayoutBox.h: establishesBlockFormattingContext() does not need to be virtual since we can determine it by looking at the box's style. -while in case
2085         of inline formatting context, it is about the content.
2086
2087 2018-07-20  Jer Noble  <jer.noble@apple.com>
2088
2089         REGRESSION (r233974): Cannot close pip'd video; pops back into PiP.
2090         https://bugs.webkit.org/show_bug.cgi?id=187873
2091
2092         Reviewed by Jon Lee.
2093
2094         When the PIP machinery on Mac wants to close the PIP window (due to the close button being clicked), it does
2095         not consult our -shouldClosePiP handler; it just tells us that we're going to close. So we never setup the 
2096         necessary state on the WebProcess side and still think that our "targetIsFullscreen". When we get the "stop"
2097         action, just request exit fullscreen, but set up the _pipState to think we're already exiting (because we are).
2098
2099         * platform/mac/VideoFullscreenInterfaceMac.mm:
2100         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]):
2101
2102 2018-07-20  Justin Fan  <justin_fan@apple.com>
2103
2104         Safari WebGL does not consistently provide correct GPU context on eGPU systems
2105         https://bugs.webkit.org/show_bug.cgi?id=187750
2106         <rdar://problem/39531436>
2107
2108         Reviewed by Dean Jackson.
2109
2110         Move GraphicsContext3DManager into its own class, and notify it when page/Chrome receives a 
2111         windowScreenDidChange message. Add a private data struct to track which hostWindow created each context.
2112         Upon notification, Manager updates the contexts that match the hostWindow with the
2113         provided displayID. Each context matches displayID to rendererID (set during process creation 
2114         if window server is blocked), which is matched to a virtual screen, and updates its GPU accordingly.
2115
2116         No new tests. This requires multiple GPUs or eGPUs, each with attached display(s), to test.
2117
2118         * WebCore.xcodeproj/project.pbxproj:
2119         * page/Chrome.cpp:
2120         (WebCore::Chrome::windowScreenDidChange): Now calls GraphicsContext3DManager::screenDidChange().
2121         * platform/PlatformScreen.h:
2122         * platform/ScreenProperties.h: Add rendererID to struct.
2123         (WebCore::ScreenData::encode const):
2124         (WebCore::ScreenData::decode):
2125         * platform/graphics/GraphicsContext3D.h:
2126         * platform/graphics/GraphicsContext3DManager.cpp: Added (copied out of GraphicsContext3DCocoa.mm).
2127         (WebCore::attachToAppleGraphicsControl):
2128         (WebCore::hasMuxCapability):
2129         (WebCore::hasMuxableGPU):
2130         (WebCore::GraphicsContext3DManager::sharedManager):
2131         (WebCore::displayWasReconfigured):
2132         (WebCore::GraphicsContext3DManager::updateAllContexts):
2133         (WebCore::GraphicsContext3DManager::screenDidChange):
2134         (WebCore::GraphicsContext3DManager::addContext):
2135         (WebCore::GraphicsContext3DManager::removeContext):
2136         (WebCore::GraphicsContext3DManager::hostWindowForContext const):
2137         (WebCore::GraphicsContext3DManager::addContextRequiringHighPerformance):
2138         (WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance):
2139         (WebCore::GraphicsContext3DManager::updateHighPerformanceState):
2140         (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired):
2141         (WebCore::GraphicsContext3DManager::recycleContextIfNecessary):
2142         * platform/graphics/GraphicsContext3DManager.h: Added (copied out of GraphicsContext3DCocoa.mm).
2143         (WebCore::GraphicsContext3DManager::hasTooManyContexts const):
2144         (WebCore::GraphicsContext3DManager::GraphicsContext3DManager):
2145         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
2146         (WebCore::GraphicsContext3D::create):
2147         (WebCore::GraphicsContext3D::createShared):
2148         (WebCore::identifyAndSetCurrentGPU): Now matches rendererIDs to determine virtual screen. 
2149         (WebCore::GraphicsContext3D::GraphicsContext3D):
2150         (WebCore::GraphicsContext3D::~GraphicsContext3D):
2151         (WebCore::GraphicsContext3D::setContextVisibility):
2152         (WebCore::GraphicsContext3D::simulateContextChanged):
2153         (WebCore::GraphicsContext3D::screenDidChange):
2154         (WebCore::attachToAppleGraphicsControl): Deleted.
2155         (WebCore::hasMuxCapability): Deleted.
2156         (WebCore::hasMuxableGPU): Deleted.
2157         (WebCore::GraphicsContext3DManager::GraphicsContext3DManager): Deleted.
2158         (WebCore::GraphicsContext3DManager::hasTooManyContexts const): Deleted.
2159         (WebCore::manager): Deleted.
2160         (WebCore::displayWasReconfigured): Deleted.
2161         (WebCore::GraphicsContext3DManager::updateAllContexts): Deleted.
2162         (WebCore::GraphicsContext3DManager::addContext): Deleted.
2163         (WebCore::GraphicsContext3DManager::removeContext): Deleted.
2164         (WebCore::GraphicsContext3DManager::addContextRequiringHighPerformance): Deleted.
2165         (WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance): Deleted.
2166         (WebCore::GraphicsContext3DManager::updateHighPerformanceState): Deleted.
2167         (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired): Deleted.
2168         (WebCore::GraphicsContext3DManager::recycleContextIfNecessary): Deleted.
2169         * platform/mac/PlatformScreenMac.mm: Provide a display's rendererID.
2170         (WebCore::rendererIDForDisplayMask):
2171         (WebCore::collectScreenProperties):
2172         (WebCore::rendererIDForDisplay):
2173         (WebCore::primaryRendererID):
2174
2175 2018-07-19  Simon Fraser  <simon.fraser@apple.com>
2176
2177         Remove completed animations from GraphicsLayer, thus avoiding excessive backing store allocation
2178         https://bugs.webkit.org/show_bug.cgi?id=187844
2179         rdar://problem/40387294
2180
2181         Reviewed by Dean Jackson.
2182         
2183         A keyframe animation which animates 3D transforms, and is fill-forwards, currently
2184         leaves the GraphicsLayer in a state where it has a "running" animation. However, the
2185         logic that computes animation extent in RenderLayerBacking::updateGeometry() only does
2186         so for running or paused animations. GraphicsLayer then thinks that it has an active
2187         transform animation with unknown extent, and refuses to detach its backing store.
2188         
2189         This triggers excessive layer creation on some sites (e.g. https://www.kqed.org).
2190         
2191         Fix by always removing animations from the GraphicsLayer when they finish, whether
2192         or not they fill forwards. This is done by having KeyframeAnimation::onAnimationEnd()
2193         always call endAnimation().
2194         
2195         This change only fixes the non-Web Animation code path. webkit.org/b/187845 exists
2196         to fix the other code path.
2197         
2198         Also improve some logging that would have revealed this problem sooner.
2199
2200         Test: compositing/backing/backing-store-attachment-fill-forwards-animation.html
2201
2202         * page/animation/AnimationBase.h:
2203         (WebCore::AnimationBase::endAnimation):
2204         * page/animation/ImplicitAnimation.cpp:
2205         (WebCore::ImplicitAnimation::endAnimation):
2206         * page/animation/ImplicitAnimation.h:
2207         * page/animation/KeyframeAnimation.cpp:
2208         (WebCore::KeyframeAnimation::endAnimation):
2209         (WebCore::KeyframeAnimation::onAnimationEnd):
2210         * page/animation/KeyframeAnimation.h:
2211         * platform/graphics/ca/GraphicsLayerCA.cpp:
2212         (WebCore::GraphicsLayerCA::addAnimation):
2213         (WebCore::GraphicsLayerCA::updateCoverage):
2214
2215 2018-07-20  Ryosuke Niwa  <rniwa@apple.com>
2216
2217         Picking a color from the color panel for typing attributes needs to inverse transform through color-filter
2218         https://bugs.webkit.org/show_bug.cgi?id=187846
2219
2220         Reviewed by Simon Fraser.
2221
2222         This patch refines the color inversion for editing introduced in r234005 so that font panels and WebKit embedders
2223         can get and set inverted colors using attributed strings for a selected text in an editable region.
2224
2225         More specifically, when font panels or WebKit embedders set a font color or a background color via WebView's
2226         _applyStyleToSelection and _applyEditingStyleToSelection, WebKit would automatically invert the color before inserting
2227         into DOM so that the color visible to the user matches that's given to WebKit. Conversely,
2228         [WebView attributedSubstringFromRange:nsRange] now return the color visible to the user, i.e. the color after
2229         the color filter had been applied, so that some WebKit embedders can present the visually identical color to the user.
2230
2231         Because DOM never sees the color filter's effect in the computed style, etc... this patch reverts the change made to
2232         StyleChange in r234005 to avoid inverting the color passed to execCommand. This makes editing apps which is unaware
2233         of the dark mode or -apple-color-filter continue to function (because the color picker implemented in DOM will be
2234         applied of the same color filter before being presented to the user).
2235
2236         Finally, this patch introduces a testing hook in applyCommandToFrame so that executing foreColor or backColor with
2237         the soruce of CommandFromMenuOrKeyBinding would trigger the same code path as the one taken by Objective-C 
2238
2239         Tests: editing/execCommand/set-backColor-with-color-filter-from-scripts.html
2240                editing/execCommand/set-foreColor-with-color-filter-from-scripts.html
2241                editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html
2242                editing/style/set-backColor-with-color-filter.html
2243                editing/style/set-foreColor-with-color-filter.html
2244
2245         * editing/EditingStyle.cpp:
2246         (WebCore::EditingStyle::inverseTransformColorIfNeeded): Added.
2247         (WebCore::StyleChange::StyleChange): Revert the change made in r234005 since this code is also used by execCommand
2248         which is not desirable, and won't work for background color.
2249         (WebCore::StyleChange::extractTextStyles): Ditto.
2250         * editing/EditingStyle.h:
2251         * editing/Editor.cpp:
2252         (WebCore::Editor::applyStyle):
2253         (WebCore::Editor::applyStyleToSelection): Call EditingStyle::inverseTransformColorIfNeeded when ColorFilterMode is
2254         set to InvertColor.
2255         * editing/Editor.h:
2256         * editing/EditorCommand.cpp:
2257         (WebCore::applyCommandToFrame): Added the aforementioned testing hook.
2258         * editing/cocoa/HTMLConverter.mm:
2259         (WebCore::editingAttributedStringFromRange): Take the color filtr into account. Some WebKit embedders use this
2260         function to compute the font color in the selected text. Note that this function is mostly used for input methods
2261         so the color doesn't really matter, and its implementation is distinct from that of HTMLConverter.
2262
2263 2018-07-19  Jer Noble  <jer.noble@apple.com>
2264
2265         HLS resources with remote subresources will not taint canvasses.
2266         https://bugs.webkit.org/show_bug.cgi?id=187731
2267         <rdar://problem/42290703>
2268
2269         Reviewed by Brady Eidson.
2270
2271         Test: http/tests/security/canvas-remote-read-remote-video-hls.html
2272
2273         Most media sources are single-resource; they are accessed from a single origin. HLS manifests can contain many
2274         subresources from arbitrary origins, and canvases should be tainted when painted from media elements whose
2275         subresources were retrieved from tainting origins.
2276
2277         Add a new method to HTMLMediaElement, wouldTaintOrigin(), taking a SecurityOrigin, and returning whether the
2278         media element would taint that origin. This gets piped all the way down to MediaPlayerPrivateAVFoundationObjC
2279         which uses WebCoreNSURLSession to track all the origins of all the responses which resulted from the media
2280         element's load.
2281
2282         Drive-by fix: also fix this issue for media elements which render to an AudioContext.
2283
2284         Drive-by fix #2: CanvasRenderingContext2DBase::createPattern() needs to check the return value of
2285         ImageBuffer::create() before using it.
2286
2287         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
2288         (WebCore::MediaElementAudioSourceNode::wouldTaintOrigin):
2289         * html/HTMLMediaElement.cpp:
2290         (WebCore::HTMLMediaElement::didAttachRenderers):
2291         (WebCore::HTMLMediaElement::didDetachRenderers):
2292         (WebCore::HTMLMediaElement::scheduleUpdateShouldAutoplay):
2293         * html/HTMLMediaElement.h:
2294         (WebCore::HTMLMediaElement::wouldTaintOrigin const):
2295         * html/canvas/CanvasRenderingContext.cpp:
2296         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
2297         * html/canvas/CanvasRenderingContext2DBase.cpp:
2298         (WebCore::CanvasRenderingContext2DBase::createPattern):
2299         * platform/graphics/MediaPlayer.cpp:
2300         (WebCore::MediaPlayer::wouldTaintOrigin const):
2301         * platform/graphics/MediaPlayer.h:
2302         * platform/graphics/MediaPlayerPrivate.h:
2303         (WebCore::MediaPlayerPrivateInterface::hasSingleSecurityOrigin const):
2304         (WebCore::MediaPlayerPrivateInterface::wouldTaintOrigin const):
2305         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
2306         (WebCore::CDMSessionAVContentKeySession::update):
2307         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2308         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2309         (WebCore::MediaPlayerPrivateAVFoundationObjC::wouldTaintOrigin const):
2310         * platform/network/cocoa/WebCoreNSURLSession.h:
2311         * platform/network/cocoa/WebCoreNSURLSession.mm:
2312         (-[WebCoreNSURLSession task:didReceiveResponseFromOrigin:]):
2313         (-[WebCoreNSURLSession wouldTaintOrigin:]):
2314         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
2315
2316 2018-07-20  Zalan Bujtas  <zalan@apple.com>
2317
2318         Update FrameView::paintContents to use release logging.
2319         https://bugs.webkit.org/show_bug.cgi?id=187854
2320         <rdar://problem/42432371>
2321
2322         Reviewed by Simon Fraser.
2323
2324         Adding release logging helps identifying blank content cases. 
2325
2326         * page/FrameView.cpp:
2327         (WebCore::FrameView::paintContents):
2328
2329 2018-07-20  Jer Noble  <jer.noble@apple.com>
2330
2331         First Auto-PiP from Fullscreen too small & animation blocks
2332         https://bugs.webkit.org/show_bug.cgi?id=187745
2333         <rdar://problem/42316583>
2334
2335         Reviewed by Jon Lee.
2336
2337         1) When Auto-PiPing, we don't have the luxury of setting up the fullscreen state
2338         ahead of time; we get notified that PiP has already started. The area of the code
2339         which does this just-in-time setup needs to set the video layer's frame so that the
2340         transform within the PiP window is correct.
2341
2342         2) We generate a placeholder image when going into fullscreen, but we need to do
2343         so synchronously. Create the AVPlayerItemVideoOutput up front at AVPlayerItem creation
2344         time wherever AVPIVO is available.
2345
2346         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2347         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
2348         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2349         (VideoFullscreenInterfaceAVKit::doSetup):
2350
2351 2018-07-20  Antoine Quint  <graouts@apple.com>
2352
2353         DeclarativeAnimation should suspend, resume, & stop m_eventQueue
2354         https://bugs.webkit.org/show_bug.cgi?id=187216
2355         <rdar://problem/41669739>
2356
2357         Reviewed by Ryosuke Niwa.
2358
2359         Suspend, resume and close the GenericEventQueue for DeclarativeAnimation as instructed through the DOMActiveObject protocol.
2360
2361         * animation/DeclarativeAnimation.cpp:
2362         (WebCore::DeclarativeAnimation::stop):
2363         (WebCore::DeclarativeAnimation::suspend):
2364         (WebCore::DeclarativeAnimation::resume):
2365         * animation/DeclarativeAnimation.h:
2366         * animation/WebAnimation.h:
2367
2368 2018-07-20  Zalan Bujtas  <zalan@apple.com>
2369
2370         [LFC][Inline formatting context] Add basic text content handling.
2371         https://bugs.webkit.org/show_bug.cgi?id=187860
2372
2373         Reviewed by Antti Koivisto.
2374
2375         InlineFormattingContext::layout() walks through the formatting root's descendant list in a post-order fashion and
2376         feeds the TextContentProvider.
2377         Eventually this would turn into a more generic loop where we stop and process the text content when finding a non-text content box (float, inline-box etc), but right now
2378         this is about text content only.
2379
2380         * layout/displaytree/DisplayBox.h:
2381         (WebCore::Display::Box::contentBoxBottom const):
2382         (WebCore::Display::Box::contentBoxRight const):
2383         * layout/inlineformatting/InlineFormattingContext.cpp:
2384         (WebCore::Layout::InlineFormattingContext::layout const):
2385         * layout/inlineformatting/textlayout/TextContentProvider.cpp:
2386         (WebCore::Layout::TextContentProvider::textRuns): Add a helper function to support the case when all we need is just the run list in one go.
2387         * layout/inlineformatting/textlayout/TextContentProvider.h:
2388         * layout/layouttree/LayoutBox.cpp:
2389         (WebCore::Layout::Box::isDescendantOf const):
2390         * layout/layouttree/LayoutBox.h:
2391         * layout/layouttree/LayoutInlineBox.h:
2392         (WebCore::Layout::InlineBox::textContent const):
2393
2394 2018-07-20  Youenn Fablet  <youenn@apple.com>
2395
2396         FetchResponse should close its stream when loading finishes
2397         https://bugs.webkit.org/show_bug.cgi?id=187790
2398
2399         Reviewed by Chris Dumez.
2400
2401         It simplifies for a FetchResponse to push all its data into its stream if already created at end of load time.
2402         Did some refactoring in FetchBodyOwner to have a cleaner relationship with the stream source.
2403         Did a minor refactoring to expose the error description when loading fails as part of the rejected promise.
2404         This is consistent to errors sent back through callbacks.
2405
2406         Covered by existing tests.
2407
2408         * Modules/fetch/FetchBodyOwner.cpp:
2409         (WebCore::FetchBodyOwner::~FetchBodyOwner):
2410         * Modules/fetch/FetchBodyOwner.h:
2411         * Modules/fetch/FetchBodySource.cpp:
2412         (WebCore::FetchBodySource::FetchBodySource):
2413         (WebCore::FetchBodySource::setActive):
2414         (WebCore::FetchBodySource::setInactive):
2415         (WebCore::FetchBodySource::doStart):
2416         (WebCore::FetchBodySource::doPull):
2417         (WebCore::FetchBodySource::doCancel):
2418         (WebCore::FetchBodySource::cleanBodyOwner):
2419         * Modules/fetch/FetchBodySource.h:
2420         * Modules/fetch/FetchResponse.cpp:
2421         (WebCore::FetchResponse::BodyLoader::didSucceed):
2422         (WebCore::FetchResponse::BodyLoader::didFail):
2423
2424 2018-07-20  Jer Noble  <jer.noble@apple.com>
2425
2426         REGRESSION(r233969): ASSERT in -[WebAVPlayerLayer setVideoGravity:]
2427         https://bugs.webkit.org/show_bug.cgi?id=187814
2428         <rdar://problem/42391869>
2429
2430         Reviewed by Eric Carlson.
2431
2432         After r233969 caused models to disassociate themselves from interfaces, it is now possible that an
2433         VideoFullscreenInterfaceAVKit can have a nil model. We should null-check, not ASSERT, now that the
2434         assertion no longer holds true.
2435
2436         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2437         (-[WebAVPlayerLayer layoutSublayers]):
2438         (-[WebAVPlayerLayer resolveBounds]):
2439         (-[WebAVPlayerLayer setVideoGravity:]):
2440
2441 2018-07-19  Antoine Quint  <graouts@apple.com>
2442
2443         Flaky crash in AnimationTimeline::cancelOrRemoveDeclarativeAnimation
2444         https://bugs.webkit.org/show_bug.cgi?id=187530
2445         <rdar://problem/42095186>
2446
2447         Reviewed by Dean Jackson.
2448
2449         We would crash in cancelOrRemoveDeclarativeAnimation() because updateCSSAnimationsForElement() would pass
2450         nullptr values due to the return value of cssAnimationsByName.take(nameOfAnimationToRemove). This is because
2451         we would create animations for animation names that may be empty or not match an existing @keyframes rule.
2452         Not only was that wasteful, but it was also non-compliant, and as a result of fixing this we're actually
2453         seeing a progression in the CSS Animations WPT tests.
2454
2455         * animation/AnimationTimeline.cpp:
2456         (WebCore::shouldConsiderAnimation): New function that performs all required steps to see if a provided animation
2457         is valid and has a name that is not "none", not the empty string and matches the name of a @keyframes rule.
2458         (WebCore::AnimationTimeline::updateCSSAnimationsForElement):
2459         * animation/KeyframeEffectReadOnly.cpp:
2460         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): We no longer need to check whether we have
2461         an empty animation name since we're no longer creating CSSAnimation objects in that circumstance.
2462         * css/StyleResolver.cpp:
2463         (WebCore::StyleResolver::isAnimationNameValid): Add a new method that checks whether the provided animation name
2464         a known @keyframes rule.
2465         * css/StyleResolver.h:
2466
2467 2018-07-19  Chris Dumez  <cdumez@apple.com>
2468
2469         Crash under WebCore::DocumentWriter::addData()
2470         https://bugs.webkit.org/show_bug.cgi?id=187819
2471         <rdar://problem/41328743>
2472
2473         Reviewed by Brady Eidson.
2474
2475         When AppCache is used a DocumentLoader may start a NetworkLoad even though it has substitute data.
2476         In DocumentLoader::continueAfterContentPolicy(), if we have substitute data we commit this data
2477         and call finishLoad(). However, if the case where there was a NetworkLoad started, we'll send the
2478         ContinueDidReceiveResponse IPC back to the network process and it will start sending us data for
2479         the load. This could lead to crashes such as <rdar://problem/41328743> since the DocumentLoader
2480         has already committed data and finished loading when it gets the data from the network process.
2481
2482         To address the issue, we now call clearMainResource() in continueAfterContentPolicy(), after we've
2483         decided to commit the substitute data. This effectively removes the DocumentLoader as a client of
2484         the CachedResource so that its will not be notified of following load progress. We do not cancel
2485         the load as other CachedResourceClients may be interested in the load (ApplicationCacheResourceLoader
2486         in particular, in order to update its cached data).
2487
2488         * loader/DocumentLoader.cpp:
2489         (WebCore::DocumentLoader::continueAfterContentPolicy):
2490
2491 2018-07-19  Dean Jackson  <dino@apple.com>
2492
2493         CrashTracer: com.apple.WebKit.WebContent.Development at com.apple.WebCore: std::optional<WTF::Vector<WebCore::PluginInfo, 0ul, WTF::CrashOnOverflow, 16ul> >::operator* & + 73
2494         https://bugs.webkit.org/show_bug.cgi?id=187820
2495         <rdar://problem/42017759>
2496
2497         Reviewed by Antoine Quint.
2498
2499         Speculative fix for this crash, which is accessing an optional without checking
2500         if it exists. The crash logs didn't point to a reproducible test case.
2501
2502         * plugins/PluginData.cpp:
2503         (WebCore::PluginData::supportsWebVisibleMimeTypeForURL const): Return false if
2504         the optional doesn't exist.
2505
2506 2018-07-19  Antoine Quint  <graouts@apple.com>
2507
2508         Ensure DocumentTimeline is kept alive until the VM::whenIdle callback is called
2509         https://bugs.webkit.org/show_bug.cgi?id=187692
2510
2511         Reviewed by Ryosuke Niwa.
2512
2513         Ensure we keep the DocumentTimeline alive until the VM::whenIdle callback is called.
2514
2515         * animation/DocumentTimeline.cpp:
2516         (WebCore::DocumentTimeline::currentTime):
2517
2518 2018-07-18  Simon Fraser  <simon.fraser@apple.com>
2519
2520         Setting foreground color when editing should take color-filter into account, and report the correct foreground color for collapsed selections
2521         https://bugs.webkit.org/show_bug.cgi?id=187778
2522
2523         Reviewed by Ryosuke Niwa.
2524         
2525         Fix two aspects of editing with color-filter:
2526
2527         1. When setting foreground color, inverse-transform the color through -apple-color-filter so that the user gets the color
2528            they chose when in Dark Mode. Tested by editing/style/exec-command-foreColor-with-color-filter.html.
2529
2530         2. When retrieving the style of the collapsed selection, take color filter into account so that color picker
2531            reflects the color the users sees, instead of the content color. Tested by editing/mac/attributed-string/attributed-string-for-typing-with-color-filter.html
2532
2533         Add two additional tests that ensure that -apple-color-filter does not impact the NSAttributedString code
2534         path, since -apple-color-filter should not affect the behavior of Copy.
2535
2536         Tests: editing/mac/attributed-string/attrib-string-colors-with-color-filter.html
2537                editing/mac/attributed-string/attrib-string-range-with-color-filter.html
2538                editing/mac/attributed-string/attributed-string-for-typing-with-color-filter.html
2539                editing/style/exec-command-foreColor-with-color-filter.html
2540
2541         * editing/EditingStyle.cpp:
2542         (WebCore::StyleChange::StyleChange):
2543         (WebCore::StyleChange::extractTextStyles):
2544         * editing/EditingStyle.h:
2545         * editing/cocoa/EditorCocoa.mm:
2546         (WebCore::Editor::fontAttributesForSelectionStart const):
2547         * platform/graphics/filters/FilterOperation.cpp:
2548         (WebCore::InvertLightnessFilterOperation::inverseTransformColor const):
2549         * platform/graphics/filters/FilterOperation.h:
2550         (WebCore::FilterOperation::inverseTransformColor const):
2551         * platform/graphics/filters/FilterOperations.cpp:
2552         (WebCore::FilterOperations::transformColor const):
2553         (WebCore::FilterOperations::inverseTransformColor const):
2554         * platform/graphics/filters/FilterOperations.h:
2555
2556 2018-07-19  David Fenton  <david_fenton@apple.com>
2557
2558         Unreviewed, rolling out r233994.
2559
2560         Caused EWS and bot failures due to assertions added
2561
2562         Reverted changeset:
2563
2564         "FetchResponse should close its stream when loading finishes"
2565         https://bugs.webkit.org/show_bug.cgi?id=187790
2566         https://trac.webkit.org/changeset/233994
2567
2568 2018-07-19  Jer Noble  <jer.noble@apple.com>
2569
2570         REGRESSION(r233926): media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline.html is a TIMEOUT failure
2571         https://bugs.webkit.org/show_bug.cgi?id=187813
2572
2573         Reviewed by Jon Lee.
2574
2575         In r233926, we changed the behavior of entering PiP to exit fullscreen only after entering PiP completes. The
2576         test in question will immediately request "inline" presentation mode once the PiP animation begins, and thus
2577         it's asking to "exit fullscreen" when both in standard fullscreen and also in PiP. The fix is not to bail out
2578         early if we're in standard (element) fullscreen, but to allow the remaining steps to complete and exit PiP as
2579         well.
2580
2581         * html/HTMLMediaElement.cpp:
2582         (WebCore::HTMLMediaElement::exitFullscreen):
2583
2584 2018-07-19  Zalan Bujtas  <zalan@apple.com>
2585
2586         [LFC] Introduce simple line breaker.
2587         https://bugs.webkit.org/show_bug.cgi?id=187688
2588
2589         Reviewed by Antti Koivisto.
2590
2591         This patch takes the simple line layout implementation and refactors it in a way it is no longer requires a RenderBlockFlow object to run on.
2592         Also this patch decouples text run generation and line breaking (and this implementation is going to replace the current simple line layout codebase)
2593
2594         TextContentProvider: Acts both as the container for all the text content (including hard line breaks) and as an iterator for the generated text runs.
2595         SimpleTextRunGenerator: TextContentProvider uses it as the text run generator for simple content (in the future we'll have a ComplexTextRunGenerator).
2596         SimpleLineBreaker: Input -> text runs + line constraints; Output -> layout runs after line breaking.
2597
2598         * Sources.txt:
2599         * WebCore.xcodeproj/project.pbxproj:
2600         * layout/inlineformatting/textlayout/ContentProvider.cpp: Added.
2601         (WebCore::Layout::TextContentProvider::TextItem::Style::Style):
2602         (WebCore::Layout::TextContentProvider::ContentProvider):
2603         (WebCore::Layout::TextContentProvider::~ContentProvider):
2604         (WebCore::Layout::TextContentProvider::appendText):
2605         (WebCore::Layout::TextContentProvider::appendLineBreak):
2606         (WebCore::Layout::TextContentProvider::width const):
2607         (WebCore::Layout::TextContentProvider::textWidth const):
2608         (WebCore::Layout::TextContentProvider::fixedPitchWidth const):
2609         (WebCore::Layout::TextContentProvider::toTextItemIndex const):
2610         (WebCore::Layout::TextContentProvider::length const):
2611         (WebCore::Layout::TextContentProvider::iterator):
2612         (WebCore::Layout::TextContentProvider::findNextRun):
2613         (WebCore::Layout::TextContentProvider::current const):
2614         * layout/inlineformatting/textlayout/ContentProvider.h: Added.
2615         (WebCore::Layout::TextContentProvider::textContent const):
2616         (WebCore::Layout::TextContentProvider::hardLineBreaks const):
2617         (WebCore::Layout::TextContentProvider::Iterator::current const):
2618         (WebCore::Layout::TextContentProvider::contains const):
2619         (WebCore::Layout::TextContentProvider::Iterator::Iterator):
2620         (WebCore::Layout::TextContentProvider::Iterator::operator++):
2621         * layout/inlineformatting/textlayout/Runs.h: Added.
2622         (WebCore::Layout::TextRun::isWhitespace const):
2623         (WebCore::Layout::TextRun::isNonWhitespace const):
2624         (WebCore::Layout::TextRun::isLineBreak const):
2625         (WebCore::Layout::TextRun::isSoftLineBreak const):
2626         (WebCore::Layout::TextRun::isHardLineBreak const):
2627         (WebCore::Layout::TextRun::isValid const):
2628         (WebCore::Layout::TextRun::isCollapsed const):
2629         (WebCore::Layout::TextRun::type const):
2630         (WebCore::Layout::TextRun::setIsCollapsed):
2631         (WebCore::Layout::TextRun::setWidth):
2632         (WebCore::Layout::LayoutRun::start const):
2633         (WebCore::Layout::LayoutRun::end const):
2634         (WebCore::Layout::LayoutRun::length const):
2635         (WebCore::Layout::LayoutRun::left const):
2636         (WebCore::Layout::LayoutRun::right const):
2637         (WebCore::Layout::LayoutRun::width const):
2638         (WebCore::Layout::LayoutRun::isEndOfLine const):
2639         (WebCore::Layout::LayoutRun::setEnd):
2640         (WebCore::Layout::LayoutRun::setRight):
2641         (WebCore::Layout::LayoutRun::setIsEndOfLine):
2642         (WebCore::Layout::LayoutRun::LayoutRun):
2643         (WebCore::Layout::TextRun::createWhitespaceRun):
2644         (WebCore::Layout::TextRun::createNonWhitespaceRun):
2645         (WebCore::Layout::TextRun::createSoftLineBreakRun):
2646         (WebCore::Layout::TextRun::createHardLineBreakRun):
2647         (WebCore::Layout::TextRun::TextRun):
2648         (WebCore::Layout::TextRun::start const):
2649         (WebCore::Layout::TextRun::end const):
2650         (WebCore::Layout::TextRun::length const):
2651         (WebCore::Layout::TextRun::width const):
2652         * layout/inlineformatting/textlayout/simple/SimpleContentProvider.cpp: Added.
2653         (WebCore::Layout::SimpleContentProvider::SimpleContentProvider):
2654         (WebCore::Layout::SimpleContentProvider::current const):
2655         (WebCore::Layout::SimpleContentProvider::reset):
2656         (WebCore::Layout::SimpleContentProvider::findNextRun):
2657         (WebCore::Layout::SimpleContentProvider::moveToNextBreakablePosition):
2658         (WebCore::Layout::SimpleContentProvider::moveToNextNonWhitespacePosition):
2659         (WebCore::Layout::SimpleContentProvider::isAtLineBreak const):
2660         (WebCore::Layout::SimpleContentProvider::isAtSoftLineBreak const):
2661         * layout/inlineformatting/textlayout/simple/SimpleContentProvider.h: Added.
2662         (WebCore::Layout::SimpleContentProvider::Iterator::reset):
2663         (WebCore::Layout::SimpleContentProvider::Position::operator== const):
2664         (WebCore::Layout::SimpleContentProvider::Position::operator< const):
2665         (WebCore::Layout::SimpleContentProvider::Position::operator ContentPosition const):
2666         (WebCore::Layout::SimpleContentProvider::Position::resetItemPosition):
2667         (WebCore::Layout::SimpleContentProvider::Position::contentPosition const):
2668         (WebCore::Layout::SimpleContentProvider::Position::itemPosition const):
2669         (WebCore::Layout::SimpleContentProvider::Iterator<T>::Iterator):
2670         (WebCore::Layout::SimpleContentProvider::Iterator<T>::current const):
2671         (WebCore::Layout::SimpleContentProvider::Iterator<T>::operator):
2672         (WebCore::Layout::SimpleContentProvider::Position::operator++):
2673         (WebCore::Layout::SimpleContentProvider::Position::operator+=):
2674         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.cpp: Added.
2675         (WebCore::Layout::SimpleLineBreaker::TextRunList::TextRunList):
2676         (WebCore::Layout::SimpleLineBreaker::Line::Line):
2677         (WebCore::Layout::adjustedEndPosition):
2678         (WebCore::Layout::SimpleLineBreaker::Line::append):
2679         (WebCore::Layout::SimpleLineBreaker::Line::collapseTrailingWhitespace):
2680         (WebCore::Layout::SimpleLineBreaker::Line::reset):
2681         (WebCore::Layout::SimpleLineBreaker::Style::Style):
2682         (WebCore::Layout::SimpleLineBreaker::SimpleLineBreaker):
2683         (WebCore::Layout::SimpleLineBreaker::runs):
2684         (WebCore::Layout::SimpleLineBreaker::createRunsForLine):
2685         (WebCore::Layout::SimpleLineBreaker::handleOverflownRun):
2686         (WebCore::Layout::SimpleLineBreaker::collapseLeadingWhitespace):
2687         (WebCore::Layout::SimpleLineBreaker::collapseTrailingWhitespace):
2688         (WebCore::Layout::SimpleLineBreaker::splitTextRun):
2689         (WebCore::Layout::SimpleLineBreaker::split const):
2690         (WebCore::Layout::SimpleLineBreaker::availableWidth const):
2691         (WebCore::Layout::SimpleLineBreaker::verticalPosition const):
2692         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.h: Added.
2693         (WebCore::Layout::SimpleLineBreaker::TextRunList::overrideCurrent):
2694         (WebCore::Layout::SimpleLineBreaker::TextRunList::isCurrentOverridden const):
2695         (WebCore::Layout::SimpleLineBreaker::Line::availableWidth const):
2696         (WebCore::Layout::SimpleLineBreaker::Line::hasContent const):
2697         (WebCore::Layout::SimpleLineBreaker::Line::setAvailableWidth):
2698         (WebCore::Layout::SimpleLineBreaker::Line::hasTrailingWhitespace const):
2699         (WebCore::Layout::SimpleLineBreaker::Line::isWhitespaceOnly const):
2700         (WebCore::Layout::SimpleLineBreaker::wrapContentOnOverflow const):
2701         (WebCore::Layout::SimpleLineBreaker::TextRunList::current const):
2702         (WebCore::Layout::SimpleLineBreaker::TextRunList::operator++):
2703
2704 2018-07-19  Keith Rollin  <krollin@apple.com>
2705
2706         Remove duplicate compilation of WebKitNSImageExtras.mm
2707         https://bugs.webkit.org/show_bug.cgi?id=187782
2708
2709         Reviewed by Alex Christensen.
2710
2711         WebKitNSImageExtras.mm gets compiled twice, once because it's in
2712         WebCore.xcodeproj/project.pbxproj and once because it's in
2713         Webcore/SourcesCocoa.txt. This can lead to duplicate definition
2714         errors, particularly when building with LTO enabled. Fix this by
2715         removing the entry from the Xcode project.
2716
2717         No new tests -- no change in WebKit functionality.
2718
2719         * WebCore.xcodeproj/project.pbxproj:
2720
2721 2018-07-19  Youenn Fablet  <youenn@apple.com>
2722
2723         FetchResponse should close its stream when loading finishes
2724         https://bugs.webkit.org/show_bug.cgi?id=187790
2725
2726         Reviewed by Chris Dumez.
2727
2728         It simplifies for a FetchResponse to push all its data into its stream if already created at end of load time.
2729         Did some refactoring in FetchBodyOwner to have a cleaner relationship with the stream source.
2730         Did a minor refactoring to expose the error description when loading fails as part of the rejected promise.
2731         This is consistent to errors sent back through callbacks.
2732
2733         Covered by existing tests.
2734
2735         * Modules/fetch/FetchBodyOwner.cpp:
2736         (WebCore::FetchBodyOwner::~FetchBodyOwner):
2737         * Modules/fetch/FetchBodyOwner.h:
2738         * Modules/fetch/FetchBodySource.cpp:
2739         (WebCore::FetchBodySource::FetchBodySource):
2740         (WebCore::FetchBodySource::setActive):
2741         (WebCore::FetchBodySource::setInactive):
2742         (WebCore::FetchBodySource::doStart):
2743         (WebCore::FetchBodySource::doPull):
2744         (WebCore::FetchBodySource::doCancel):
2745         (WebCore::FetchBodySource::cleanBodyOwner):
2746         * Modules/fetch/FetchBodySource.h:
2747         * Modules/fetch/FetchResponse.cpp:
2748         (WebCore::FetchResponse::BodyLoader::didSucceed):
2749         (WebCore::FetchResponse::BodyLoader::didFail):
2750
2751 2018-07-19  Jon Lee  <jonlee@apple.com>
2752
2753         Update iOS fullscreen alert text again
2754         https://bugs.webkit.org/show_bug.cgi?id=187797
2755         rdar://problem/42373783
2756
2757         Reviewed by Jer Noble.
2758
2759         * English.lproj/Localizable.strings:
2760
2761 2018-07-19  Keith Rollin  <krollin@apple.com>
2762
2763         Adjust WEBCORE_EXPORT annotations for LTO
2764         https://bugs.webkit.org/show_bug.cgi?id=187781
2765         <rdar://problem/42351124>
2766
2767         Reviewed by Alex Christensen.
2768
2769         Continuation of Bug 186944. This bug addresses issues not caught
2770         during the first pass of adjustments. The initial work focussed on
2771         macOS; this one addresses issues found when building for iOS. From
2772         186944:
2773
2774         Adjust a number of places that result in WebKit's
2775         'check-for-weak-vtables-and-externals' script reporting weak external
2776         symbols:
2777
2778             ERROR: WebCore has a weak external symbol in it (/Volumes/Data/dev/webkit/OpenSource/WebKitBuild/Release/WebCore.framework/Versions/A/WebCore)
2779             ERROR: A weak external symbol is generated when a symbol is defined in multiple compilation units and is also marked as being exported from the library.
2780             ERROR: A common cause of weak external symbols is when an inline function is listed in the linker export file.
2781             ...
2782
2783         These cases are caused by inline methods being marked with WTF_EXPORT
2784         (or related macro) or with an inline function being in a class marked
2785         as such, and when enabling LTO builds.
2786
2787         For the most part, address these by removing the WEBCORE_EXPORT
2788         annotation from inline methods. In some cases, move the implementation
2789         out-of-line because it's the class that has the WEBCORE_EXPORT on it
2790         and removing the annotation from the class would be too disruptive.
2791         Finally, in other cases, move the implementation out-of-line because
2792         check-for-weak-vtables-and-externals still complains when keeping the
2793         implementation inline and removing the annotation; this seems to
2794         typically (but not always) happen with destructors.
2795
2796         No new tests. There is no changed functionality. Only the annotation
2797         and treatment of inline methods are altered.
2798
2799         * platform/graphics/FourCC.h:
2800         (WebCore::FourCC::FourCC):
2801         * platform/graphics/IntPoint.h:
2802         (WebCore::IntPoint::IntPoint):
2803         * platform/mediastream/RealtimeMediaSource.cpp:
2804         (WebCore::RealtimeMediaSource::Observer::~Observer):
2805         (WebCore::RealtimeMediaSource::AudioCaptureFactory::~AudioCaptureFactory):
2806         (WebCore::RealtimeMediaSource::VideoCaptureFactory::~VideoCaptureFactory):
2807         * platform/mediastream/RealtimeMediaSource.h:
2808         * workers/service/ServiceWorkerProvider.cpp:
2809         (WebCore::ServiceWorkerProvider::~ServiceWorkerProvider):
2810         * workers/service/ServiceWorkerProvider.h:
2811
2812 2018-07-19  Charlie Turner  <cturner@igalia.com>
2813
2814         [GStreamer] Return a valid time values in unprerolled states
2815         https://bugs.webkit.org/show_bug.cgi?id=187111
2816
2817         Reviewed by Xabier Rodriguez-Calvar.
2818
2819         After r230584 in bug 180253, asserts were added in
2820         PlatformTimeRanges::add to check that both ends of the range were
2821         valid times. In the non-MSE GStreamer player, this assert was
2822         firing on https://www.w3.org/2010/05/video/mediaevents.html due to
2823         seekable being called in nonprerolled states. In this case
2824         MediaPlayerPrivateInterface::seekable was calling GStreamer's
2825         maxTimeSeekable, which calls in durationMediaTime. The guard
2826         against calling gst_element_query_duration when not prerolled was
2827         returning a different time value than when the duration query
2828         itself failed. Hence the assert firing.
2829
2830         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2831         (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime const):
2832
2833 2018-07-19  Antoine Quint  <graouts@apple.com>
2834
2835         Hitting RELEASE_ASSERT(!m_activeDOMObjectAdditionForbidden) under HTMLMediaElement::resume()
2836         https://bugs.webkit.org/show_bug.cgi?id=187793
2837         <rdar://problem/42308469>
2838
2839         Reviewed by Chris Dumez.
2840
2841         Ensure we do not call JS under resume(), which would happen as a result of calling configureMediaControls() in prepareForLoad().
2842
2843         * html/HTMLMediaElement.cpp:
2844         (WebCore::HTMLMediaElement::~HTMLMediaElement):
2845         (WebCore::HTMLMediaElement::contextDestroyed):
2846         (WebCore::HTMLMediaElement::stop):
2847         (WebCore::HTMLMediaElement::suspend):
2848         (WebCore::HTMLMediaElement::resume):
2849         * html/HTMLMediaElement.h:
2850
2851 2018-07-19  Philippe Normand  <pnormand@igalia.com>
2852
2853         [GStreamer][MSE] imported/w3c/web-platform-tests/media-source/mediasource-is-type-supported.html crashes
2854         https://bugs.webkit.org/show_bug.cgi?id=187469
2855
2856         Reviewed by Žan Doberšek.
2857
2858         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
2859         (webKitMediaSrcFreeStream): Fix critical warning. The appsrc
2860         element is created only when a valid sourcebuffer is in use.
2861
2862 2018-07-19  Frederic Wang  <fwang@igalia.com>
2863
2864         Fix message of NotSupportedError exception thrown during custom element creation
2865         https://bugs.webkit.org/show_bug.cgi?id=187757
2866
2867         Reviewed by Yusuke Suzuki.
2868
2869         In bug 161528, some new exceptions were introduced for custom element creation [1] but the
2870         actual text has some issues. This patch fixes one typo and one wrong message.
2871
2872         [1] https://dom.spec.whatwg.org/#concept-create-element
2873
2874         Test: fast/custom-elements/exceptions-for-synchronous-custom-element-creation.html
2875
2876         * bindings/js/JSCustomElementInterface.cpp:
2877         (WebCore::constructCustomElementSynchronously):
2878
2879 2018-07-18  Jer Noble  <jer.noble@apple.com>
2880
2881         Unreviewed API Test fix; restored a line inadventantly removed in r233926.
2882
2883         * platform/mac/VideoFullscreenInterfaceMac.mm:
2884         (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]):
2885
2886 2018-07-18  Antoine Quint  <graouts@apple.com>
2887
2888         [Web Animations] Interpolation between font-styles with a keyword value should be discrete
2889         https://bugs.webkit.org/show_bug.cgi?id=187722
2890
2891         Reviewed by Myles Maxfield.
2892
2893         Animating between "font-style: normal" or "font-style: oblique" and any another value should yield a discrete
2894         interpolation where the from-value is used from 0 and up to (but excluding) 0.5, and the to-value from 0.5 to 1.
2895
2896         In order to be able to detect the "normal" value, we make the "slope" of a FontSelectionRequest an optional type
2897         where the std::nullopt value indicates "normal" and other values an "oblique" value. Since we also need to
2898         distinguish the "italic" value from an "oblique" value, we implement a custom PropertyWrapper for the "font-style"
2899         property where we ensure the fontStyleAxis property of the font description matches the value we're blending to.
2900         Indeed, in the case where we may animate from "normal" to "italic", the fontStyleAxis on the blended style would
2901         remain "slnt" since it is the base value for "normal".
2902
2903         * accessibility/AccessibilityRenderObject.cpp:
2904         (WebCore::AccessibilityRenderObject::hasPlainText const):
2905         * css/CSSComputedStyleDeclaration.cpp:
2906         (WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
2907         * css/CSSComputedStyleDeclaration.h:
2908         * css/CSSFontFace.cpp:
2909         (WebCore::calculateItalicRange):
2910         * css/CSSFontFaceSet.cpp:
2911         (WebCore::computeFontSelectionRequest):
2912         * css/FontSelectionValueInlines.h:
2913         (WebCore::fontStyleKeyword):
2914         (WebCore::fontStyleValue): Deleted.
2915         * css/StyleBuilderConverter.h:
2916         (WebCore::StyleBuilderConverter::convertFontStyleFromValue):
2917         * page/animation/CSSPropertyAnimation.cpp:
2918         (WebCore::blendFunc):
2919         (WebCore::PropertyWrapperFontStyle::PropertyWrapperFontStyle):
2920         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
2921         * platform/graphics/FontCache.h:
2922         (WebCore::FontDescriptionKey::computeHash const):
2923         * platform/graphics/FontCascade.h:
2924         (WebCore::FontCascade::italic const):
2925         * platform/graphics/FontDescription.h:
2926         (WebCore::FontDescription::italic const):
2927         (WebCore::FontDescription::setItalic):
2928         (WebCore::FontDescription::setIsItalic):
2929         (WebCore::FontCascadeDescription::initialItalic):
2930         * platform/graphics/FontSelectionAlgorithm.cpp:
2931         (WebCore::FontSelectionAlgorithm::styleDistance const):
2932         * platform/graphics/FontSelectionAlgorithm.h:
2933         (WebCore::isItalic):
2934         (WebCore::FontSelectionRequest::tied const):
2935         (WebCore::operator<<): Implement the required stream operator.
2936         (WebCore::operator==): Mark this function as inline instead of constexpr since tied() is no longer constexpr
2937         due to taking an std::optional<>.
2938         (WebCore::operator!=):
2939         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2940         (WebCore::preparePlatformFont):
2941         * platform/graphics/win/FontCacheWin.cpp:
2942         (WebCore::FontCache::createFontPlatformData):
2943         * rendering/style/RenderStyle.cpp:
2944         (WebCore::RenderStyle::setFontItalic):
2945         * rendering/style/RenderStyle.h:
2946         (WebCore::RenderStyle::fontItalic const):
2947
2948 2018-07-18  Jer Noble  <jer.noble@apple.com>
2949
2950         Unreviewed build fix after r233926; BOOL !== bool.
2951
2952         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2953         (VideoFullscreenInterfaceAVKit::pictureInPictureWasStartedWhenEnteringBackground const):
2954
2955 2018-07-18  Jer Noble  <jer.noble@apple.com>
2956
2957         PiP from Element Fullscreen should match AVKit's behavior
2958         https://bugs.webkit.org/show_bug.cgi?id=187623
2959
2960         Reviewed by Jon Lee.
2961
2962         PiP behavior should be defined at the WebKit2 level, and not in HTMLMediaElement:
2963
2964         * html/HTMLMediaElement.cpp:
2965         (WebCore::HTMLMediaElement::enterFullscreen):
2966
2967         Add an accessor for pictureInPictureWasStartedWhenEnteringBackground():
2968
2969         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
2970         (VideoFullscreenInterfaceAVKit::pictureInPictureWasStartedWhenEnteringBackground const):
2971
2972         Add VideoFullscreenModelClient virutal methods for PiP change notifications:
2973
2974         * platform/cocoa/VideoFullscreenModel.h:
2975         (WebCore::VideoFullscreenModelClient::hasVideoChanged):
2976         (WebCore::VideoFullscreenModelClient::videoDimensionsChanged):
2977         (WebCore::VideoFullscreenModelClient::willEnterPictureInPicture):
2978         (WebCore::VideoFullscreenModelClient::didEnterPictureInPicture):
2979         (WebCore::VideoFullscreenModelClient::failedToEnterPictureInPicture):
2980         (WebCore::VideoFullscreenModelClient::willExitPictureInPicture):
2981         (WebCore::VideoFullscreenModelClient::didExitPictureInPicture):
2982         (WebCore::VideoFullscreenModelClient::failedToExitPictureInPicture):
2983         * platform/cocoa/VideoFullscreenModelVideoElement.h:
2984         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
2985         (VideoFullscreenModelVideoElement::willEnterPictureInPicture):
2986         (VideoFullscreenModelVideoElement::didEnterPictureInPicture):
2987         (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture):
2988         (VideoFullscreenModelVideoElement::willExitPictureInPicture):
2989         (VideoFullscreenModelVideoElement::didExitPictureInPicture):
2990         (VideoFullscreenModelVideoElement::failedToExitPictureInPicture):
2991         * platform/ios/VideoFullscreenInterfaceAVKit.h:
2992         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2993         (-[WebAVPlayerLayer layoutSublayers]):
2994         (-[WebAVPlayerLayer resolveBounds]):
2995         (-[WebAVPlayerLayer setVideoGravity:]):
2996         (VideoFullscreenInterfaceAVKit::setupFullscreen):
2997         (VideoFullscreenInterfaceAVKit::presentingViewController):
2998         (VideoFullscreenInterfaceAVKit::willStartPictureInPicture):
2999         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
3000         (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture):
3001         (VideoFullscreenInterfaceAVKit::willStopPictureInPicture):
3002         (VideoFullscreenInterfaceAVKit::didStopPictureInPicture):
3003         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
3004         (VideoFullscreenInterfaceAVKit::doSetup):
3005         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3006         (VideoFullscreenControllerContext::willEnterPictureInPicture):
3007         (VideoFullscreenControllerContext::didEnterPictureInPicture):
3008         (VideoFullscreenControllerContext::failedToEnterPictureInPicture):
3009         (VideoFullscreenControllerContext::willExitPictureInPicture):
3010         (VideoFullscreenControllerContext::didExitPictureInPicture):
3011         (VideoFullscreenControllerContext::failedToExitPictureInPicture):
3012         * platform/mac/VideoFullscreenInterfaceMac.h:
3013         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Deleted.
3014         * platform/mac/VideoFullscreenInterfaceMac.mm:
3015         (-[WebVideoFullscreenInterfaceMacObjC invalidateFullscreenState]):
3016         (-[WebVideoFullscreenInterfaceMacObjC exitPIP]):
3017         (-[WebVideoFullscreenInterfaceMacObjC exitPIPAnimatingToRect:inWindow:]):
3018         (-[WebVideoFullscreenInterfaceMacObjC pipShouldClose:]):
3019         (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]):
3020         (WebCore::VideoFullscreenInterfaceMac::enterFullscreen):
3021         (WebCore::VideoFullscreenInterfaceMac::exitFullscreen):
3022         (WebCore::VideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode):
3023         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen):
3024
3025 2018-07-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3026
3027         [Curl] Disable CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST specified by setAllowsAnyHTTPSCertificate.
3028         https://bugs.webkit.org/show_bug.cgi?id=187611
3029
3030         Reviewed by Fujii Hironori.
3031
3032         Current interface for TLS certificate validation for Curl port are as follows:
3033
3034         - WEBCORE_EXPORT void setHostAllowsAnyHTTPSCertificate(const String&);
3035         - bool isAllowedHTTPSCertificateHost(const String&);
3036         - bool canIgnoredHTTPSCertificate(const String&, const Vector<CertificateInfo::Certificate>&);
3037
3038         First one registers a host to be ignored for any certificate check. Once it is registered, no
3039         further certificate validation check is executed.
3040         Second one checks the host is registered in the list above.
3041         Third one is weird. The method signature implies it checks the certificate for the host and detect
3042         whether we can ignore this certificate for the host, but actually it  just check only the host and
3043         register the certificate into the vector. Then in the next request for the host, the certificate
3044         will be checked with the previously stored certificate.
3045
3046         It's hard to understand, but in short,
3047         - We can register a host as an exception for any TLS certificate validation.
3048         - But only certificate arrived first is ignored, not any certificates for the host
3049           (which is rare, but possible for mis configured web cluster).
3050
3051         This behavior is incomplete. To ignore any certificates of the host, these two methods are enough:
3052
3053         - void allowAnyHTTPSCertificatesForHost(const String&)
3054         - bool canIgnoreAnyHTTPSCertificatesForHost(const String&)
3055
3056         No new tests. Covered by existing tests.
3057
3058         * platform/network/curl/CertificateInfo.h:
3059         * platform/network/curl/CurlContext.cpp:
3060         (WebCore::CurlHandle::enableSSLForHost): Ignore TLS verification for registered host.
3061         * platform/network/curl/CurlSSLHandle.cpp:
3062         (WebCore::CurlSSLHandle::allowAnyHTTPSCertificatesForHost): Added.
3063         (WebCore::CurlSSLHandle::canIgnoreAnyHTTPSCertificatesForHost const): Ditto.
3064         (WebCore::CurlSSLHandle::setClientCertificateInfo): Separate lock.
3065         (WebCore::CurlSSLHandle::getSSLClientCertificate const): Ditto and add const.
3066         (WebCore::CurlSSLHandle::setHostAllowsAnyHTTPSCertificate): Deleted.
3067         (WebCore::CurlSSLHandle::isAllowedHTTPSCertificateHost): Deleted.
3068         (WebCore::CurlSSLHandle::canIgnoredHTTPSCertificate): Deleted.
3069         (WebCore::CurlSSLHandle::getSSLClientCertificate): Deleted.
3070         * platform/network/curl/CurlSSLHandle.h:
3071         * platform/network/curl/CurlSSLVerifier.cpp:
3072         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
3073         (WebCore::CurlSSLVerifier::collectInfo): Renamed from verify.
3074         (WebCore::CurlSSLVerifier::verifyCallback):
3075         (WebCore::CurlSSLVerifier::verify): Renamed to collectInfo.
3076         * platform/network/curl/CurlSSLVerifier.h:
3077         * platform/network/curl/ResourceHandleCurl.cpp:
3078         (WebCore::ResourceHandle::setHostAllowsAnyHTTPSCertificate): Rename calling method.
3079
3080 2018-07-18  Myles C. Maxfield  <mmaxfield@apple.com>
3081
3082         Rename WordBreak::Break to WordBreak::BreakWord
3083         https://bugs.webkit.org/show_bug.cgi?id=187767
3084
3085         Reviewed by Simon Fraser.
3086
3087         These breaking properties are very confusing. There are:
3088
3089         1. word-break: break-all, a standard value that allows breaking after every
3090         character.
3091         2. word-break: break-word, a non-standard value which allows for breaking after
3092         every character, but only if the word is too long for the available width (otherwise
3093         it works the same as word-break: normal). This affects the min-content-size of the
3094         text (and makes it equal to what it would be if word-break: break-all was
3095         specified).
3096         3. word-wrap: break-word, which is the same as word-break: break-word, but doesn't
3097         affect the min-content-size of the text.
3098         4. overflow-wrap: break-word, which is the same as word-wrap: break-word.
3099
3100         Because this is so confusing it's valuable for our internal enums to match the names
3101         of the official CSS properties/values.
3102
3103         No new tests because there is no behavior change.
3104
3105         * css/CSSPrimitiveValueMappings.h:
3106         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3107         (WebCore::CSSPrimitiveValue::operator WordBreak const):
3108         * rendering/RenderText.cpp:
3109         (WebCore::RenderText::computePreferredLogicalWidths):
3110         * rendering/style/RenderStyle.h:
3111         (WebCore::RenderStyle::breakWords const):
3112         * rendering/style/RenderStyleConstants.h:
3113
3114 2018-07-18  Wenson Hsieh  <wenson_hsieh@apple.com>
3115
3116         Add SPI to defer running async script until after document load
3117         https://bugs.webkit.org/show_bug.cgi?id=187748
3118         <rdar://problem/42317378>
3119
3120         Reviewed by Ryosuke Niwa and Tim Horton.
3121
3122         On watchOS, we currently observe that time-consuming async scripts can block the first paint of Reader, leaving
3123         the user with a blank screen for tens of seconds. One way to mitigate this is to defer async script execution
3124         until after document load (i.e. the same timing as DOMContentLoaded).
3125
3126         This patch introduces an SPI configuration allowing internal clients to defer execution of asynchronous script
3127         until after document load; this, in combination with the parser yielding token introduced in r233891, allows
3128         Safari on watchOS to avoid being blocked on slow script execution before the first paint of the Reader page on
3129         most article-like pages. See below for more details.
3130
3131         Test: RunScriptAfterDocumentLoad.ExecutionOrderOfScriptsInDocument
3132
3133         * dom/Document.cpp:
3134         (WebCore::Document::shouldDeferAsynchronousScriptsUntilParsingFinishes const):
3135         (WebCore::Document::finishedParsing):
3136
3137         Notify ScriptRunner when the Document has finished parsing, and is about to fire DOMContentLoaded.
3138
3139         * dom/Document.h:
3140         * dom/ScriptRunner.cpp:
3141         (WebCore::ScriptRunner::documentFinishedParsing):
3142
3143         When the document is finished parsing, kick off the script execution timer if needed to run any async script
3144         that has been deferred.
3145
3146         (WebCore::ScriptRunner::notifyFinished):
3147         (WebCore::ScriptRunner::timerFired):
3148
3149         Instead of always taking from the list of async scripts to execute, check our document to see whether we should
3150         defer this until after document load. If so, ignore `m_scriptsToExecuteSoon`.
3151
3152         * dom/ScriptRunner.h:
3153         * page/Settings.yaml:
3154
3155         Add a WebCore setting for this behavior.
3156
3157 2018-07-18  Zan Dobersek  <zdobersek@igalia.com>
3158
3159         [Nicosia] Add debug border, repaint counter state tracking to Nicosia::CompositionLayer
3160         https://bugs.webkit.org/show_bug.cgi?id=187749
3161
3162         Reviewed by Carlos Garcia Campos.
3163
3164         Add the RepaintCounter and DebugBorder structs to
3165         Nicosia::CompositionLayer::LayerState, tracking visibility as well as
3166         repaint count or debug color and width.
3167
3168         Instances of RepaintCounter and DebugBorder types are kept in each
3169         CoordinatedGraphicsLayer object, updating the relevant data as it is
3170         changed (since the GraphicsLayer object isn't tracking these values on
3171         its own). During layer flush these values (if changed) are then copied
3172         over into the CompositionLayer state.
3173
3174         * platform/graphics/nicosia/NicosiaPlatformLayer.cpp:
3175         Also fix the year in the license header.
3176         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
3177         Also fix the year in the license header.
3178         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3179         (WebCore::CoordinatedGraphicsLayer::didUpdateTileBuffers):
3180         (WebCore::CoordinatedGraphicsLayer::setShowDebugBorder):
3181         (WebCore::CoordinatedGraphicsLayer::setShowRepaintCounter):
3182         (WebCore::CoordinatedGraphicsLayer::setDebugBorder):
3183         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
3184         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3185
3186 2018-07-18  Zan Dobersek  <zdobersek@igalia.com>
3187
3188         [CoordGraphics] Start tracking Nicosia layers in CoordinatedGraphicsState
3189         https://bugs.webkit.org/show_bug.cgi?id=187751
3190
3191         Reviewed by Carlos Garcia Campos.
3192
3193         Start including the Nicosia::CompositionLayer objects in the
3194         CoordinatedGraphicsState struct, under a separate NicosiaState struct.
3195         References to all the layers in a given scene are kept in a HashSet,
3196         and a separate reference to the root layer kept in a separate member
3197         variable.
3198
3199         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3200         (WebCore::CoordinatedGraphicsLayer::compositionLayer const):
3201         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3202         Add the getter method that returns internal Nicosia::CompositionLayer
3203         object. This can't be defined in the class definition because of
3204         WEBCORE_EXPORT used on the CoordinatedGraphicsLayer class.
3205         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
3206
3207 2018-07-18  Simon Fraser  <simon.fraser@apple.com>
3208
3209         Shrink CompositeAnimation and AnimationBase
3210         https://bugs.webkit.org/show_bug.cgi?id=187683
3211
3212         Reviewed by Daniel Bates.
3213
3214         Reduce the size of CompositeAnimation and AnimationBase.
3215
3216         * page/animation/AnimationBase.h:
3217         * page/animation/CompositeAnimation.h:
3218
3219 2018-07-17  Antoine Quint  <graouts@apple.com>
3220
3221         Ensure timingFunctionForKeyframeAtIndex() can be used from setAnimatedPropertiesInStyle().
3222         https://bugs.webkit.org/show_bug.cgi?id=187637
3223         <rdar://problem/42157915>
3224
3225         Reviewed by Dean Jackson.
3226
3227         Test: webanimations/empty-keyframes-crash.html
3228
3229         Unlike what we assumed, it is possible to have a non-declarative animation without any parsed keyframes.
3230         This can happen as a result of calling `Element.animate({}, …)`. In this case, we want to return a null
3231         value in timingFunctionForKeyframeAtIndex() so we update the call site in setAnimatedPropertiesInStyle()
3232         which is the only place where we didn't check for a null value and didn't know for sure that there would
3233         be parsed keyframes to rely on in the case of a WebAnimation instance.
3234
3235         * animation/KeyframeEffectReadOnly.cpp:
3236         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle):
3237         (WebCore::KeyframeEffectReadOnly::timingFunctionForKeyframeAtIndex):
3238
3239 2018-07-15  Jiewen Tan  <jiewen_tan@apple.com>
3240
3241         [WebCrypto] Crypto operations should copy their parameters before hoping to another thread
3242         https://bugs.webkit.org/show_bug.cgi?id=187501
3243         <rdar://problem/41438160>
3244
3245         Reviewed by Youenn Fablet.
3246
3247         This patch aims at making all captured variables in all crypto lambdas that need to be passed
3248         to a worker thread thread safe, which includes:
3249         1) changing ref counted objects to thread safe ref counted object.
3250         2) adding isolatedCopy methods to non ref counted classes, so they can be called by CrossThreadCopy().
3251
3252         In addition to above changes, this patch also does the following things:
3253         1) change the name CryptoAlgorithm::dispatchOperation => CryptoAlgorithm::dispatchOperationInWorkQueue
3254         to make it clear that lambdas will be passed to a secondary thread.
3255         2) make CryptoAlgorithmParameters as const parameters for all methods.
3256         3) add null checks on BufferSource.length() and .data().
3257
3258         Tests: crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html
3259                http/wpt/crypto/aes-cbc-crash.any.html
3260                http/wpt/crypto/aes-cbc-crash.any.worker.html
3261                http/wpt/crypto/aes-ctr-crash.any.html
3262                http/wpt/crypto/aes-ctr-crash.any.worker.html
3263                http/wpt/crypto/aes-gcm-crash.any.html
3264                http/wpt/crypto/aes-gcm-crash.any.worker.html
3265                http/wpt/crypto/derive-hmac-key-crash.any.html
3266                http/wpt/crypto/derive-hmac-key-crash.any.worker.html
3267                http/wpt/crypto/ecdsa-crash.any.html
3268                http/wpt/crypto/ecdsa-crash.any.worker.html
3269                http/wpt/crypto/hkdf-crash.any.html
3270                http/wpt/crypto/hkdf-crash.any.worker.html
3271                http/wpt/crypto/pbkdf2-crash.any.html
3272                http/wpt/crypto/pbkdf2-crash.any.worker.html
3273                http/wpt/crypto/rsa-oaep-crash.any.html
3274                http/wpt/crypto/rsa-oaep-crash.any.worker.html
3275                http/wpt/crypto/rsa-pss-crash.any.html
3276                http/wpt/crypto/rsa-pss-crash.any.worker.html
3277                http/wpt/crypto/unwrap-ec-key-crash.any.html
3278                http/wpt/crypto/unwrap-ec-key-crash.any.worker.html
3279                http/wpt/crypto/unwrap-rsa-key-crash.any.html
3280                http/wpt/crypto/unwrap-rsa-key-crash.any.worker.html
3281
3282         * bindings/js/BufferSource.h:
3283         (WebCore::BufferSource::data const):
3284         (WebCore::BufferSource::length const):
3285         * crypto/CryptoAlgorithm.cpp:
3286         (WebCore::CryptoAlgorithm::encrypt):
3287         (WebCore::CryptoAlgorithm::decrypt):
3288         (WebCore::CryptoAlgorithm::sign):
3289         (WebCore::CryptoAlgorithm::verify):
3290         (WebCore::CryptoAlgorithm::deriveBits):
3291         (WebCore::CryptoAlgorithm::importKey):
3292         (WebCore::dispatchAlgorithmOperation):
3293         (WebCore::CryptoAlgorithm::dispatchOperationInWorkQueue):
3294         (WebCore::CryptoAlgorithm::dispatchOperation): Deleted.
3295         * crypto/CryptoAlgorithm.h:
3296         * crypto/SubtleCrypto.cpp:
3297         (WebCore::crossThreadCopyImportParams):
3298         (WebCore::SubtleCrypto::encrypt):
3299         (WebCore::SubtleCrypto::decrypt):
3300         (WebCore::SubtleCrypto::sign):
3301         (WebCore::SubtleCrypto::verify):
3302         (WebCore::SubtleCrypto::deriveKey):
3303         (WebCore::SubtleCrypto::deriveBits):
3304         (WebCore::SubtleCrypto::importKey):
3305         (WebCore::SubtleCrypto::wrapKey):
3306         (WebCore::SubtleCrypto::unwrapKey):
3307         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
3308         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
3309         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
3310         (WebCore::CryptoAlgorithmAES_CBC::importKey):
3311         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
3312         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
3313         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
3314         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
3315         (WebCore::CryptoAlgorithmAES_CFB::importKey):
3316         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
3317         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
3318         (WebCore::parametersAreValid):
3319         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
3320         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
3321         (WebCore::CryptoAlgorithmAES_CTR::importKey):
3322         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
3323         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
3324         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
3325         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
3326         (WebCore::CryptoAlgorithmAES_GCM::importKey):
3327         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
3328         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
3329         (WebCore::CryptoAlgorithmAES_KW::importKey):
3330         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
3331         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
3332         (WebCore::CryptoAlgorithmECDH::deriveBits):
3333         (WebCore::CryptoAlgorithmECDH::importKey):
3334         * crypto/algorithms/CryptoAlgorithmECDH.h:
3335         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
3336         (WebCore::CryptoAlgorithmECDSA::sign):