b6b5f17e4c88eaf725bc3d06babfb10aea23d348
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-08-01  Timothy Hatcher  <timothy@apple.com>
2
3         Hardcode some system colors to avoid fingerprinting exposure.
4         https://bugs.webkit.org/show_bug.cgi?id=188203
5         rdar://problem/42781630
6
7         Reviewed by Tim Horton.
8
9         Passes existing tests with the hardcoded blue system appearance.
10
11         * rendering/RenderTheme.h:
12         * rendering/RenderThemeMac.mm:
13         (WebCore::RenderThemeMac::systemColor const):
14         Adds special handling for some system colors. Fixes -apple-system-selected-text-background
15         to match the real selection color by using blendWithWhite().
16
17 2018-08-01  Eric Carlson  <eric.carlson@apple.com>
18
19         [iOS] Remove the delay before setting audio session category added in r233535
20         https://bugs.webkit.org/show_bug.cgi?id=188225
21
22         Reviewed by Jer Noble.
23
24         * platform/audio/PlatformMediaSessionManager.cpp:
25         (WebCore::PlatformMediaSessionManager::beginInterruption): scheduleUpdateSessionState -> updateSessionState.
26         (WebCore::PlatformMediaSessionManager::addSession): Ditto.
27         (WebCore::PlatformMediaSessionManager::removeSession): Ditto.
28         (WebCore::PlatformMediaSessionManager::sessionStateChanged): Ditto.
29         (WebCore::PlatformMediaSessionManager::sessionCanProduceAudioChanged): Ditto.
30         (WebCore::PlatformMediaSessionManager::updateSessionState): Ditto.
31         (WebCore::PlatformMediaSessionManager::audioOutputDeviceChanged): Ditto.
32         (WebCore::PlatformMediaSessionManager::scheduleUpdateSessionState): Deleted.
33         * platform/audio/PlatformMediaSessionManager.h:
34
35         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
36         (PlatformMediaSessionManager::updateSessionState):
37         (PlatformMediaSessionManager::scheduleUpdateSessionState): Deleted.
38         * rendering/RenderLayer.cpp:
39         (WebCore::RenderLayer::updateClipRects):
40
41 2018-08-01  Yusuke Suzuki  <utatane.tea@gmail.com>
42
43         Add TransformationMatrix::Identity
44         https://bugs.webkit.org/show_bug.cgi?id=188204
45
46         Reviewed by Simon Fraser.
47
48         This patch adds TransformationMatrix::Identity, which is a static const variable holding an identity matrix.
49
50         No behavior change.
51
52         * platform/graphics/GraphicsLayer.cpp:
53         (WebCore::GraphicsLayer::transform const):
54         (WebCore::GraphicsLayer::childrenTransform const):
55         (): Deleted.
56         * platform/graphics/transforms/TransformationMatrix.cpp:
57         * platform/graphics/transforms/TransformationMatrix.h:
58
59 2018-08-01  Thibault Saunier  <tsaunier@igalia.com>
60
61         [GStreamer] Make sure that first buffer running time is 0 in GStreamerMediaStreamSource
62         https://bugs.webkit.org/show_bug.cgi?id=188210
63
64         This is a live source and the first frame is the beginning of the stream,
65         but that doesn't mean that the incoming stream from the camera didn't start
66         before. We need to set a pad offset on each srcpad of the source to compensate
67         for that. This is the exact same logic as in webrtc GStreamerVideo/Enc/Dec/oder.
68
69         Reviewed by Alejandro G. Castro.
70
71         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
72         (WebCore::webkit_media_stream_src_init):
73         (WebCore::webkitMediaStreamSrcPushVideoSample):
74         (WebCore::webkitMediaStreamSrcPushAudioSample):
75
76 2018-08-01  Zan Dobersek  <zdobersek@igalia.com>
77
78         [CoordGraphics] Move CoordinatedBackingStore to WebCore
79         https://bugs.webkit.org/show_bug.cgi?id=188158
80
81         Reviewed by Carlos Garcia Campos.
82
83         Move the CoordinatedBackingStore class from WebKit to WebCore. It has no
84         dependency on anything in the WebKit layer, and it's more suitable to
85         future needs to keep it in the WebCore layer.
86
87         * platform/TextureMapper.cmake:
88         * platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp: Renamed from Source/WebKit/Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp.
89         * platform/graphics/texmap/coordinated/CoordinatedBackingStore.h: Renamed from Source/WebKit/Shared/CoordinatedGraphics/CoordinatedBackingStore.h.
90         (WebCore::CoordinatedBackingStoreTile::CoordinatedBackingStoreTile):
91         (WebCore::CoordinatedBackingStore::rect const):
92
93 2018-07-31  Myles C. Maxfield  <mmaxfield@apple.com>
94
95         [WIN] Fix tests for text with initial advances
96         https://bugs.webkit.org/show_bug.cgi?id=188099
97
98         Reviewed by Darin Adler.
99
100         Fixup after r234318.
101
102         Tests: fast/text/complex-first-glyph-with-initial-advance.html
103                fast/text/initial-advance-in-intermediate-run-complex.html
104
105         * platform/graphics/ComplexTextController.cpp:
106         * platform/graphics/FontCascade.cpp:
107         (WebCore::FontCascade::drawGlyphBuffer const):
108
109 2018-07-31  Alex Christensen  <achristensen@webkit.org>
110
111         REGRESSION (r231107): MoviStar+ launches to a blank black screen
112         https://bugs.webkit.org/show_bug.cgi?id=188139
113
114         Reviewed by Brent Fulgham.
115
116         For this app, revert behavior to how it was before r231107 with a linked-on-or-before check.
117         r231107 increased our fetch spec conformance, which we intend to keep.  This makes a low-risk
118         targeted fix that will fix the affected app until they update.  
119
120         I manually verified this fixes the app.
121
122         * loader/DocumentThreadableLoader.cpp:
123         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
124         * platform/RuntimeApplicationChecks.h:
125         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
126         (WebCore::applicationSDKVersionOverride):
127         (WebCore::setApplicationSDKVersion):
128         (WebCore::applicationSDKVersion):
129         (WebCore::IOSApplication::isMoviStarPlus):
130
131 2018-07-31  Myles C. Maxfield  <mmaxfield@apple.com>
132
133         [Cocoa] Addressing post-review comments on r234158
134         https://bugs.webkit.org/show_bug.cgi?id=188202
135
136         Reviewed by Darin Adler.
137
138         * platform/graphics/cocoa/FontCacheCoreText.cpp:
139         (WebCore::FontCache::lastResortFallbackFont):
140
141 2018-07-31  John Wilander  <wilander@apple.com>
142
143         Resource Load Statistics: Remove partitioned cookies for reduced complexity, lower memory footprint, and ability to support more platforms
144         https://bugs.webkit.org/show_bug.cgi?id=188109
145         <rdar://problem/42664391>
146
147         Reviewed by Brent Fulgham, Chris Dumez, and Alex Christensen.
148
149         Tests: http/tests/resourceLoadStatistics/cookie-deletion.html
150                http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html
151                http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html
152                http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window.html
153                http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe.html
154                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html
155                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame.html
156                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction.html
157                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html
158                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe.html
159                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe.html
160
161         This patch removes cookie partitioning which reduces the model to just
162         blocked cookies (in third-party contexts) and first-party cookie access.
163
164         Several of the changes are renaming to reflect that there are no more
165         cookie partitions. However, the compile-time check remains for now since
166         this change is not ready to ship.
167
168         The test cases mentioned about are not new. They are just renamed to
169         reflect the code changes and to shorten their names (as requested by
170         non-Cocoa platforms).
171
172         * loader/ResourceLoadStatistics.cpp:
173         (WebCore::ResourceLoadStatistics::toString const):
174         (WebCore::ResourceLoadStatistics::merge):
175             Removed the use of isMarkedForCookiePartitioning.
176         * loader/ResourceLoadStatistics.h:
177             Removed isMarkedForCookiePartitioning.
178         * platform/network/NetworkStorageSession.h:
179         * platform/network/ResourceHandle.h:
180             Renamed applySniffingPoliciesAndStoragePartitionIfNeeded() to
181             applySniffingPoliciesIfNeeded().
182         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
183         (WebCore::getPartitioningDomain):
184         (WebCore::NetworkStorageSession::shouldBlockCookies const):
185             Now takes a frame ID and a page ID to be able to support
186             the Storage Access API. This was previously handled by
187             shouldPartitionCookies() which is now deleted.
188         (WebCore::NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor):
189             Renamed from setPrevalentDomainsToPartitionOrBlockCookies().
190         (WebCore::NetworkStorageSession::removePrevalentDomains):
191             No longer needs to clear the member variable for partitioned cookie domains.
192         (WebCore::NetworkStorageSession::setCookieStoragePartitioningEnabled): Deleted.
193         (WebCore::NetworkStorageSession::cookieStoragePartition const): Deleted.
194         (WebCore::NetworkStorageSession::shouldPartitionCookies const): Deleted.
195         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies): Deleted.
196             Renamed to setPrevalentDomainsToBlockCookiesFor().
197         * platform/network/mac/CookieJarMac.mm:
198         (WebCore::cookiesForURL):
199             Now calls session.shouldBlockCookies() instead of the
200             wrapper cookiesAreBlockedForURL().
201         (WebCore::setCookiesFromDOM):
202             No longer checks for partition.
203         (WebCore::applyPartitionToCookies): Deleted.
204         (WebCore::cookiesAreBlockedForURL): Deleted.
205             This was just a wrapper for session.shouldBlockCookies().
206         (WebCore::cookiesInPartitionForURL): Deleted.
207         * platform/network/mac/ResourceHandleMac.mm:
208         (WebCore::ResourceHandle::applySniffingPoliciesIfNeeded):
209             Renamed from applySniffingPoliciesAndStoragePartitionIfNeeded().
210         (WebCore::ResourceHandle::createNSURLConnection):
211             Consequence of function name change.
212         (WebCore::ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded): Deleted.
213             Renamed to applySniffingPoliciesIfNeeded().
214
215 2018-07-31  Wenson Hsieh  <wenson_hsieh@apple.com>
216
217         [iOS] Spelling suggestions cannot be selected in focused form controls when zoomed in
218         https://bugs.webkit.org/show_bug.cgi?id=188107
219         <rdar://problem/42354250>
220
221         Reviewed by Tim Horton.
222
223         After r232040, the synthetic click gesture recognizer was enabled when tapping inside of the focused element,
224         which allows the page to handle click events inside editable content. However, this means that codepaths in
225         EventHandler that are responsible for changing selection due to default click event behaviors on macOS are now
226         active on iOS; this conflicts with selection changes due to text interaction gestures, which are the existing
227         mechanism for modifying the selection on iOS.
228
229         To address this, we defer selection changes when clicking to text interaction gestures on iOS by tweaking the
230         default behavior of a click on iOS to /not/ change selection when moving within the same editable root. This is
231         similar to r233311, but in a different codepath that specifically handles selection changes when clicking on
232         content that is already selected.
233
234         Test: fast/forms/ios/click-should-not-suppress-misspelling.html
235
236         * page/EventHandler.cpp:
237         (WebCore::EventHandler::handleMouseReleaseEvent):
238
239 2018-07-31  Yusuke Suzuki  <utatane.tea@gmail.com>
240
241         Clean up TransformationMatrix implementation
242         https://bugs.webkit.org/show_bug.cgi?id=188197
243
244         Reviewed by Simon Fraser.
245
246         We perform cleaning up of TransformationMatrix.
247
248         1. We drop user-defined operator= and copy constructor. Default ones works well for TransformationMatrix.
249         2. Remove unused setMatrix. We explicitly use memcpy in TransformationMatrix.cpp (only one place).
250         3. Use memcmp for implementing operator==.
251
252         In (2) and (3), we use `memcpy(&matrix[0][0], &tmp[0][0], sizeof(Matrix4))` instead of `memcpy(matrix, tmp, sizeof(Matrix4))`,
253         since they both are non nullptr and the former is easier to understand.
254
255         * platform/graphics/transforms/TransformationMatrix.cpp:
256         (WebCore::TransformationMatrix::multiply):
257         * platform/graphics/transforms/TransformationMatrix.h:
258         (WebCore::TransformationMatrix::setMatrix):
259         (WebCore::TransformationMatrix::operator== const):
260         (WebCore::TransformationMatrix::operator =): Deleted.
261
262 2018-07-31  Timothy Hatcher  <timothy@apple.com>
263
264         Don't call RenderTheme::platformColorsDidChange() during printing.
265         https://bugs.webkit.org/show_bug.cgi?id=188181
266         rdar://problem/42360070
267
268         Reviewed by Tim Horton.
269
270         * inspector/agents/InspectorPageAgent.cpp:
271         (WebCore::InspectorPageAgent::setEmulatedMedia): Call m_page.updateStyleAfterChangeInEnvironment()
272         instead of going to styleStope() and remove call to RenderTheme::platformColorsDidChange().
273         * page/FrameView.cpp:
274         (WebCore::FrameView::adjustMediaTypeForPrinting): Remove call RenderTheme::platformColorsDidChange().
275
276 2018-07-31  Yusuke Suzuki  <utatane.tea@gmail.com>
277
278         Use static const global variable for TransformationMatrix instead of NeverDestroyed
279         https://bugs.webkit.org/show_bug.cgi?id=188195
280
281         Reviewed by Darin Adler.
282
283         Since TransformationMatrix does not have a non-trivial destructor, we can put it
284         as static const global variable if its constructor is constexpr. This patch makes
285         some of constructors constexpr and makes identityTransform static const global variable
286         instead of NeverDestroyed<> + static function. This removes unnecessary static function
287         and lazy initialization.
288
289         No behavior change.
290
291         * platform/graphics/GraphicsLayer.cpp:
292         (WebCore::GraphicsLayer::transform const):
293         (WebCore::GraphicsLayer::childrenTransform const):
294         (WebCore::identityTransform): Deleted.
295         * platform/graphics/transforms/TransformationMatrix.h:
296         (WebCore::TransformationMatrix::TransformationMatrix):
297
298 2018-07-31  Zalan Bujtas  <zalan@apple.com>
299
300         [LFC][Floating] Add basic left/right floating positioning.
301         https://bugs.webkit.org/show_bug.cgi?id=188148
302
303         Reviewed by Antti Koivisto.
304
305         This patch implements simple floating positioning.
306         (Floatings with different containing blocks do not work yet.)
307
308         * layout/FloatingContext.cpp:
309         (WebCore::Layout::FloatingPair::isEmpty const):
310         (WebCore::Layout::Iterator::current const):
311         (WebCore::Layout::Iterator::verticalPosition const):
312         (WebCore::Layout::FloatingContext::FloatingContext):
313         (WebCore::Layout::FloatingContext::computePosition const):
314         (WebCore::Layout::FloatingContext::floatingPosition const):
315         (WebCore::Layout::FloatingContext::initialVerticalPosition const):
316         (WebCore::Layout::FloatingContext::alignWithContainingBlock const):
317         (WebCore::Layout::FloatingContext::alignWithFloatings const):
318         (WebCore::Layout::floatingDisplayBox):
319         (WebCore::Layout::FloatingPair::FloatingPair):
320         (WebCore::Layout::FloatingPair::left const):
321         (WebCore::Layout::FloatingPair::right const):
322         (WebCore::Layout::FloatingPair::intersects const):
323         (WebCore::Layout::Iterator::Iterator):
324         (WebCore::Layout::Iterator::operator++):
325         (WebCore::Layout::Iterator::set):
326         (WebCore::Layout::FloatingContext::computePosition): Deleted.
327         * layout/FloatingContext.h:
328         * layout/FloatingState.cpp:
329         (WebCore::Layout::FloatingState::append):
330         * layout/FloatingState.h:
331         (WebCore::Layout::FloatingState::floatings const):
332         (WebCore::Layout::FloatingState::last const):
333         * layout/blockformatting/BlockFormattingContext.cpp:
334         (WebCore::Layout::BlockFormattingContext::layout const):
335         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
336         * layout/displaytree/DisplayBox.cpp:
337         (WebCore::Display::Box::Rect::Rect):
338         * layout/displaytree/DisplayBox.h:
339         (WebCore::Display::Box::Rect::intersects const):
340         (WebCore::Display::Box::rect const):
341
342 2018-07-31  Rob Buis  <rbuis@igalia.com>
343
344         Remove ResourceResponse::cacheBodyKey API
345         https://bugs.webkit.org/show_bug.cgi?id=188192
346
347         Reviewed by Frédéric Wang.
348
349         Removed unused API.
350
351         No new tests needed since this API is not used.
352
353         * platform/network/ResourceResponseBase.h:
354         (WebCore::ResourceResponseBase::encode const):
355         (WebCore::ResourceResponseBase::decode):
356         (WebCore::ResourceResponseBase::cacheBodyKey const): Deleted.
357         (WebCore::ResourceResponseBase::setCacheBodyKey): Deleted.
358
359 2018-07-30  Simon Fraser  <simon.fraser@apple.com>
360
361         Shrink GraphicsLayerCA
362         https://bugs.webkit.org/show_bug.cgi?id=188141
363
364         Reviewed by Zalan Bujtas.
365         
366         Shrink GraphicsLayerCA from 1040 to 880 bytes by:
367         * moving all the clone-related stuff into the lazily-allocated m_layerClones
368         * moving all the animation-related stuff into the lazily-allocated m_animations
369         * making enums be 8-bit
370         * re-ordering data members
371
372         * page/cocoa/ResourceUsageOverlayCocoa.mm:
373         (WebCore::ResourceUsageOverlay::platformInitialize):
374         * platform/graphics/GraphicsLayer.cpp:
375         (WebCore::GraphicsLayer::GraphicsLayer):
376         (WebCore::operator<<):
377         * platform/graphics/GraphicsLayer.h:
378         * platform/graphics/GraphicsLayerClient.h:
379         * platform/graphics/WindRule.h:
380         * platform/graphics/ca/GraphicsLayerCA.cpp:
381         (WebCore::GraphicsLayerCA::GraphicsLayerCA):
382         (WebCore::GraphicsLayerCA::moveOrCopyAnimations):
383         (WebCore::GraphicsLayerCA::addProcessingActionForAnimation):
384         (WebCore::GraphicsLayerCA::setContentsToSolidColor):
385         (WebCore::GraphicsLayerCA::setContentsToImage):
386         (WebCore::GraphicsLayerCA::setContentsToPlatformLayer):
387         (WebCore::GraphicsLayerCA::contentsLayerForMedia const):
388         (WebCore::GraphicsLayerCA::layerDidDisplay):
389         (WebCore::layerTypeForCustomBackdropAppearance):
390         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
391         (WebCore::GraphicsLayerCA::updateGeometry):
392         (WebCore::GraphicsLayerCA::updateMasksToBounds):
393         (WebCore::GraphicsLayerCA::updateContentsVisibility):
394         (WebCore::GraphicsLayerCA::updateContentsOpaque):
395         (WebCore::GraphicsLayerCA::updateBackfaceVisibility):
396         (WebCore::GraphicsLayerCA::updateFilters):
397         (WebCore::GraphicsLayerCA::updateBackdropFilters):
398         (WebCore::GraphicsLayerCA::updateBackdropFiltersRect):
399         (WebCore::GraphicsLayerCA::ensureStructuralLayer):
400         (WebCore::GraphicsLayerCA::updateDrawsContent):
401         (WebCore::GraphicsLayerCA::updateCoverage):
402         (WebCore::GraphicsLayerCA::updateDebugIndicators):
403         (WebCore::GraphicsLayerCA::updateContentsImage):
404         (WebCore::GraphicsLayerCA::updateContentsPlatformLayer):
405         (WebCore::GraphicsLayerCA::updateContentsColorLayer):
406         (WebCore::GraphicsLayerCA::updateContentsRects):
407         (WebCore::GraphicsLayerCA::updateMasksToBoundsRect):
408         (WebCore::GraphicsLayerCA::updateMaskLayer):
409         (WebCore::GraphicsLayerCA::updateAnimations):
410         (WebCore::GraphicsLayerCA::isRunningTransformAnimation const):
411         (WebCore::GraphicsLayerCA::ensureLayerAnimations):
412         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
413         * platform/graphics/ca/GraphicsLayerCA.h:
414         (WebCore::GraphicsLayerCA::animationIsRunning const):
415         (WebCore::GraphicsLayerCA::primaryLayerClones const): Deleted.
416         * platform/graphics/ca/PlatformCALayerClient.h:
417         (WebCore::PlatformCALayerClient::platformCALayerContentsOrientation const):
418         * platform/graphics/ca/TileCoverageMap.h:
419         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
420         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
421         (PlatformCALayerCocoa::PlatformCALayerCocoa):
422         (PlatformCALayerCocoa::requiresCustomAppearanceUpdateOnBoundsChange const):
423         (PlatformCALayerCocoa::updateCustomAppearance):
424         (PlatformCALayer::drawLayerContents):
425         * rendering/RenderLayerBacking.cpp:
426         (WebCore::RenderLayerBacking::updateCustomAppearance):
427         (WebCore::RenderLayerBacking::updateConfiguration):
428         * rendering/RenderLayerCompositor.cpp:
429         (WebCore::RenderLayerCompositor::rootBackgroundColorOrTransparencyChanged):
430         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
431
432 2018-07-30  Justin Fan  <justin_fan@apple.com>
433
434         [WebGL2] Support compilation of GLSL ES version 300 shaders
435         https://bugs.webkit.org/show_bug.cgi?id=187982
436         <rdar://problem/42564229>
437
438         Reviewed by Dean Jackson.
439
440         Test: fast/canvas/webgl/webgl2-glsl3-compile.html
441
442         * html/canvas/WebGLRenderingContextBase.cpp:
443         (WebCore::WebGLRenderingContextBase::create): Rename 'useGLES3' to 'isWebGL2' (everywhere) to make more sense.
444         * platform/graphics/GraphicsContext3DAttributes.h: Rename 'useGLES3' to 'isWebGL2'.
445         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
446         (WebCore::setPixelFormat): Back WebGL2 contexts with OpenGL 4 for full OpenGL ES 3 support. 
447         (WebCore::GraphicsContext3D::GraphicsContext3D): Request correct GLSL output version and WebGL 2 for ANGLE shader compilation.
448         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
449         (WebCore::GraphicsContext3D::checkVaryingsPacking const): MAX_VARYING_FLOATS is deprecated in OpenGL 3+.
450         * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp: Rename 'useGLES3' to 'isWebGL2'.
451         (WebCore::GraphicsContext3D::create):
452         (WebCore::GraphicsContext3D::GraphicsContext3D):
453
454 2018-07-30  Justin Fan  <justin_fan@apple.com>
455
456         Match GraphicsContext3D with correct virtual screen using registryID
457         https://bugs.webkit.org/show_bug.cgi?id=188072
458         <rdar://problem/42634940>
459
460         Reviewed by Dean Jackson.
461
462         Follow up to https://bugs.webkit.org/show_bug.cgi?id=187750. Rather than matching rendererIDs, 
463         which can vary between processes, match GPU to display using registryID that is unique to a GPU, 
464         which was added to CGL in MacOS 10.13. 
465
466         No new tests. Manually tested on MacBookPro13,3 and iMacPro1,1 with Apple DisplayPort Cinema Display
467         and RX 580 external GPU. 
468
469         * platform/PlatformScreen.h:
470         * platform/ScreenProperties.h:
471         (WebCore::ScreenData::encode const):
472         (WebCore::ScreenData::decode):
473         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
474         (WebCore::setGPUByRegistryID):
475         (WebCore::setGPUByDisplayMask):
476         (WebCore::GraphicsContext3D::GraphicsContext3D):
477         (WebCore::GraphicsContext3D::screenDidChange):
478         (WebCore::identifyAndSetCurrentGPU): Deleted.
479         * platform/mac/PlatformScreenMac.mm:
480         (WebCore::collectScreenProperties):
481         (WebCore::primaryRegistryID):
482         (WebCore::registryIDForDisplay):
483         (WebCore::registryIDForDisplayMask):
484         (WebCore::rendererIDForDisplayMask): Deleted.
485         (WebCore::rendererIDForDisplay): Deleted.
486         (WebCore::primaryRendererID): Deleted.
487
488 2018-07-30  Rob Buis  <rbuis@igalia.com>
489
490         Merge PlatformCookieJar functions into NetworkStorageSession
491         https://bugs.webkit.org/show_bug.cgi?id=188137
492
493         Reviewed by Alex Christensen.
494
495         No new tests -- no change in WebKit functionality.
496
497         * PlatformMac.cmake: Remove CookieJarMac.mm reference
498         * SourcesCocoa.txt: Remove CookieJarMac.mm reference
499         * WebCore.xcodeproj/project.pbxproj:
500         * loader/CookieJar.cpp: Remove PlatformCookieJar.h reference.
501         * platform/Curl.cmake: Remove CookieJarCurl.cpp reference.
502         * platform/SourcesSoup.txt: Remove CookieJarSoup.cpp reference.
503         * platform/network/CacheValidation.cpp: Adapt callsites to use
504         NetworkStorageSession instead of CookieJar functions.
505
506         (WebCore::headerValueForVary):
507         * platform/network/NetworkStorageSession.h: Add PlatformCookieJar
508         functions.
509
510         * platform/network/PlatformCookieJar.h: Removed.
511         * platform/network/SocketStreamHandleImpl.cpp: Adapt callsites to
512         use NetworkStorageSession instead of CookieJar functions.
513         (WebCore::cookieDataForHandshake):
514         * platform/network/cf/CookieJarCFNet.cpp: Removed.
515         * platform/network/cf/NetworkStorageSessionCFNet.cpp: Move functions
516         from CookieJarCFNet.cpp.
517         (WebCore::cookieDomain):
518         (WebCore::canonicalCookieTime):
519         (WebCore::cookieCreatedTime):
520         (WebCore::cookieExpirationTime):
521         (WebCore::cookieName):
522         (WebCore::cookiePath):
523         (WebCore::cookieValue):
524         (WebCore::filterCookies):
525         (WebCore::copyCookiesForURLWithFirstPartyURL):
526         (WebCore::createCookies):
527         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
528         (WebCore::containsSecureCookies):
529         (WebCore::NetworkStorageSession::cookiesForDOM const):
530         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
531         (WebCore::NetworkStorageSession::cookiesEnabled const):
532         (WebCore::NetworkStorageSession::getRawCookies const):
533         (WebCore::NetworkStorageSession::deleteCookie const):
534         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
535         (WebCore::NetworkStorageSession::deleteAllCookies):
536         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
537         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
538         * platform/network/cocoa/NetworkStorageSessionCocoa.mm: Move functions
539         from CookieJarMac.mm.
540         (WebCore::httpCookies):
541         (WebCore::deleteHTTPCookie):
542         (WebCore::policyProperties):
543         (WebCore::cookiesForURL):
544         (WebCore::setHTTPCookiesForURL):
545         (WebCore::httpCookiesForURL):
546         (WebCore::filterCookies):
547         (WebCore::applyPartitionToCookies):
548         (WebCore::cookiesAreBlockedForURL):
549         (WebCore::cookiesInPartitionForURL):
550         (WebCore::cookiesForSession):
551         (WebCore::deleteAllHTTPCookies):
552         (WebCore::NetworkStorageSession::cookiesForDOM const):
553         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
554         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
555         (WebCore::httpCookieAcceptPolicy):
556         (WebCore::NetworkStorageSession::cookiesEnabled const):
557         (WebCore::NetworkStorageSession::getRawCookies const):
558         (WebCore::NetworkStorageSession::deleteCookie const):
559         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
560         (WebCore::NetworkStorageSession::deleteAllCookies):
561         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
562         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
563         * platform/network/curl/CookieJarCurl.cpp: Removed.
564         * platform/network/curl/CookieJarCurl.h:
565         * platform/network/curl/NetworkStorageSessionCurl.cpp: Merge functions
566         from CookieJarCurl.cpp.
567         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
568         (WebCore::NetworkStorageSession::cookiesEnabled const):
569         (WebCore::NetworkStorageSession::cookiesForDOM const):
570         (WebCore::NetworkStorageSession::deleteCookie const):
571         (WebCore::NetworkStorageSession::deleteAllCookies):
572         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
573         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
574         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
575         (WebCore::NetworkStorageSession::getRawCookies const):
576         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
577         * platform/network/mac/CookieJarMac.mm: Removed.
578         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
579         * platform/network/soup/CookieJarSoup.cpp: Removed.
580         * platform/network/soup/NetworkStorageSessionSoup.cpp: Merge functions
581         from CookieJarSoup.cpp.
582         (WebCore::NetworkStorageSession::cookiesEnabled const):
583         (WebCore::httpOnlyCookieExists):
584         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
585         (WebCore::NetworkStorageSession::deleteCookie const):
586         (WebCore::NetworkStorageSession::deleteAllCookies):
587         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
588         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
589         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
590         (WebCore::NetworkStorageSession::getRawCookies const):
591         (WebCore::cookiesForSession):
592         (WebCore::NetworkStorageSession::cookiesForDOM const):
593         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
594
595 2018-07-30  Chris Dumez  <cdumez@apple.com>
596
597         Nullptr crash accessing Document in GenericEventQueue::dispatchOneEvent()
598         https://bugs.webkit.org/show_bug.cgi?id=187284
599
600         Unreviewed, roll r233496 and r233571 now that all known issues have been fixed via
601         dependency bugs.
602
603         Test: media/track/video-track-addition-and-frame-removal.html
604
605         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
606         (WebCore::WebKitMediaKeySession::suspend):
607         (WebCore::WebKitMediaKeySession::resume):
608         (WebCore::WebKitMediaKeySession::stop):
609         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h:
610         * Modules/mediasource/MediaSource.cpp:
611         (WebCore::MediaSource::removeSourceBuffer):
612         (WebCore::MediaSource::suspend):
613         (WebCore::MediaSource::resume):
614         * Modules/mediasource/MediaSource.h:
615         * Modules/mediasource/SourceBuffer.cpp:
616         (WebCore::SourceBuffer::suspend):
617         (WebCore::SourceBuffer::resume):
618         (WebCore::SourceBuffer::stop):
619         * Modules/mediasource/SourceBuffer.h:
620         * Modules/mediasource/SourceBufferList.cpp:
621         (WebCore::SourceBufferList::SourceBufferList):
622         (WebCore::SourceBufferList::canSuspendForDocumentSuspension const):
623         (WebCore::SourceBufferList::suspend):
624         (WebCore::SourceBufferList::resume):
625         (WebCore::SourceBufferList::stop):
626         (WebCore::SourceBufferList::activeDOMObjectName const):
627         * Modules/mediasource/SourceBufferList.h:
628         * Modules/mediasource/SourceBufferList.idl:
629         * dom/Document.h:
630         (WebCore::Document::hasBrowsingContext const):
631         * dom/GenericEventQueue.cpp:
632         (WebCore::GenericEventQueue::dispatchOneEvent):
633         * html/HTMLMediaElement.cpp:
634         (WebCore::HTMLMediaElement::prepareForLoad):
635         (WebCore::HTMLMediaElement::selectMediaResource):
636         (WebCore::HTMLMediaElement::prepareToPlay):
637         (WebCore::HTMLMediaElement::playInternal):
638         (WebCore::HTMLMediaElement::pauseInternal):
639         (WebCore::HTMLMediaElement::sourceWasAdded):
640         * html/track/AudioTrackList.cpp:
641         (AudioTrackList::activeDOMObjectName const):
642         * html/track/AudioTrackList.h:
643         * html/track/AudioTrackList.idl:
644         * html/track/TextTrackList.cpp:
645         (TextTrackList::activeDOMObjectName const):
646         * html/track/TextTrackList.h:
647         * html/track/TextTrackList.idl:
648         * html/track/TrackListBase.cpp:
649         (WebCore::TrackListBase::TrackListBase):
650         (WebCore::TrackListBase::canSuspendForDocumentSuspension const):
651         (WebCore::TrackListBase::suspend):
652         (WebCore::TrackListBase::resume):
653         (WebCore::TrackListBase::stop):
654         * html/track/TrackListBase.h:
655         * html/track/VideoTrackList.cpp:
656         (VideoTrackList::activeDOMObjectName const):
657         * html/track/VideoTrackList.h:
658         * html/track/VideoTrackList.idl:
659
660 2018-07-30  Chris Dumez  <cdumez@apple.com>
661
662         Unreviewed internal build fix after r234347.
663
664         * html/StepRange.cpp:
665         (WebCore::StepRange::StepRange):
666
667 2018-07-29  Simon Fraser  <simon.fraser@apple.com>
668
669         Shrink GraphicsLayer by making m_transform and m_childrenTransform be unique_ptrs
670         https://bugs.webkit.org/show_bug.cgi?id=188143
671
672         Reviewed by Zalan Bujtas.
673
674         m_transform and m_childrenTransform are usually identity; save space by making
675         these unique_ptrs. The getters still return references by returning a reference
676         to a NeverDestroyed<TransformationMatrix> if necessary.
677         
678         Shrinks GraphicsLayerCA from 840 to 640 bytes.
679
680         * platform/graphics/GraphicsLayer.cpp:
681         (WebCore::identityTransform):
682         (WebCore::GraphicsLayer::transform const):
683         (WebCore::GraphicsLayer::setTransform):
684         (WebCore::GraphicsLayer::childrenTransform const):
685         (WebCore::GraphicsLayer::setChildrenTransform):
686         (WebCore::GraphicsLayer::dumpProperties const):
687         * platform/graphics/GraphicsLayer.h:
688         (WebCore::GraphicsLayer::hasNonIdentityTransform const):
689         (WebCore::GraphicsLayer::hasNonIdentityChildrenTransform const):
690         (WebCore::GraphicsLayer::transform const): Deleted.
691         (WebCore::GraphicsLayer::setTransform): Deleted.
692         (WebCore::GraphicsLayer::childrenTransform const): Deleted.
693         (WebCore::GraphicsLayer::setChildrenTransform): Deleted.
694         (WebCore::GraphicsLayer::hasFlattenedPerspectiveTransform): Deleted. It was unused.
695         * platform/graphics/ca/GraphicsLayerCA.cpp:
696         (WebCore::GraphicsLayerCA::setTransform):
697         (WebCore::GraphicsLayerCA::setChildrenTransform):
698         (WebCore::GraphicsLayerCA::layerTransform const):
699         (WebCore::GraphicsLayerCA::updateTransform):
700         (WebCore::GraphicsLayerCA::updateChildrenTransform):
701         (WebCore::GraphicsLayerCA::removeCAAnimationFromLayer):
702
703 2018-07-30  Thibault Saunier  <tsaunier@igalia.com>
704
705         [GStreamer] Make codecparsers optionnal
706         https://bugs.webkit.org/show_bug.cgi?id=188010
707
708         And avoid building libWebRTC if it won't be used. While there is no other
709         WebRTC backend, it makes no sense to expose an option.
710
711         Error out when WEBRTC or MEDIA_STREAM is enabled but GStreamer < 1.10
712
713         Reviewed by Alejandro G. Castro.
714
715         * platform/GStreamer.cmake:
716
717 2018-07-28  Darin Adler  <darin@apple.com>
718
719         [Cocoa] Update more WebCore Objective-C code to be ARC compatible
720         https://bugs.webkit.org/show_bug.cgi?id=188140
721
722         Reviewed by Sam Weinig.
723
724         This make sure we don't put any Objective-C objects into HashMap/Set
725         data structures, which doesn't work under ARC at this time. We could
726         fix that some day, but it's pretty simple to change code not to rely
727         on it, for now, and not as simple to support it in HashMap/Set.
728
729         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
730         (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):
731         Use CFRetain/CFAutorelease instead of retain/autorelease.
732
733         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
734         (createAccessibilityRoleMap): Use CFStringRef in a HashMap rather than
735         NSString * for string constants.
736         (roleValueToNSString): Updated for above change.
737
738         * bridge/objc/WebScriptObject.mm:
739         (-[WebScriptObject stringRepresentation]): Updated since objectValue
740         is now CFTypeRef rather than NSObject *.
741
742         * bridge/objc/objc_instance.mm:
743         (ObjcInstance::create): Use CFTypeRef instead of id for the key types
744         in a HashMap.
745         (ObjcInstance::~ObjcInstance): Updated for the above change.
746         (ObjcInstance::invokeObjcMethod): Updated since objectValue is now
747         CFTypeRef.
748         (ObjcInstance::invokeDefaultMethod): Ditto.
749         (ObjcInstance::setValueOfUndefinedField): Ditto.
750         * bridge/objc/objc_runtime.mm:
751         (JSC::Bindings::ObjcArray::setValueAt const): Ditto.
752
753         * bridge/objc/objc_utility.h: Use #pragma once. Use CFTypeRef instead
754         of NSObject * for objectValue, since it's in a union and ARC does not
755         support strong Objective-C object pointers in a union.
756
757         * bridge/objc/objc_utility.mm:
758         (JSC::Bindings::convertValueToObjcValue): Updated since objectValue is
759         now CFTypeRef.
760
761         * editing/cocoa/HTMLConverter.mm:
762         (HTMLConverter::_processElement): Use CFTypeRef rather than NSTextTable
763         for a HashMap.
764         (HTMLConverter::_exitElement): Ditto.
765
766         * editing/cocoa/WebContentReaderCocoa.mm:
767         (WebCore::attributesForAttributedStringConversion): Use CFRetain rather
768         than -[NSObject retain] in a workaround for an overrelease.
769
770         * editing/mac/DictionaryLookup.h: Removed code to make this usable from
771         non-Objective-C source files. Use tuples rather than out arguments
772         for the results of the various functions.
773
774         * editing/mac/DictionaryLookup.mm:
775         (WebCore::DictionaryLookup::rangeForSelection): Return a tuple rather
776         than using an out argument for options.
777         (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto.
778         (WebCore::DictionaryLookup::stringForPDFSelection): Ditto.
779         (WebCore::showPopupOrCreateAnimationController): Removed use of typedef
780         PlatformAnimationController.
781         (WebCore::DictionaryLookup::animationControllerForPopup): Ditto.
782
783         * html/HTMLMediaElement.h: Put the videoFullscreenLayer function inside
784         an __OBJC__ ifdef since we can't do the type conversion without the
785         full Objective-C type.
786
787         * page/mac/EventHandlerMac.mm:
788         (WebCore::selfRetainingNSScrollViewScrollWheel): Use CFRetain/CFRelease
789         instead of retain/release.
790         (WebCore::EventHandler::selectClosestWordFromHitTestResultBasedOnLookup):
791         Updated to use tuple return value from DictionaryLookup.
792
793         * page/scrolling/ScrollingStateNode.h: Replaced direct use of PlatformLayer*
794         in a union with use of a "typless" void* pointer and added helper functions
795         to convert in both directions.
796         * page/scrolling/cocoa/ScrollingStateNode.mm:
797         (WebCore::LayerRepresentation::retainPlatformLayer): Use CFRetain instead
798         of retain.
799         (WebCore::LayerRepresentation::releasePlatformLayer): Use CFRelease instead
800         of release.
801         (WebCore::LayerRepresentation::makePlatformLayerTyped): Added.
802         (WebCore::LayerRepresentation::makePlatformLayerTypeless): Ditto.
803         * page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp:
804         (WebCore::LayerRepresentation::retainPlatformLayer): Updated argument type.
805         (WebCore::LayerRepresentation::releasePlatformLayer): Ditto.
806         (WebCore::LayerRepresentation::makePlatformLayerTyped): Added.
807         (WebCore::LayerRepresentation::makePlatformLayerTypeless): Ditto.
808
809         * platform/gamepad/cocoa/GameControllerGamepadProvider.h: Use CFTypeRef
810         instad of GCController * for key type of HashMap.
811         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
812         (WebCore::GameControllerGamepadProvider::controllerDidConnect): Updated
813         for the above change.
814         (WebCore::GameControllerGamepadProvider::controllerDidDisconnect): Ditto.
815
816         * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
817         Use SOFT_LINK_CONSTANT_MAY_FAIL instead of SOFT_LINK_POINTER_OPTIONAL for
818         strings, since SOFT_LINK_POINTER_OPTIONAL does not work for Objective-C
819         types under ARC.
820         (WebCore::AVTrackPrivateAVFObjCImpl::audioKind const): Added checks
821         for the constants.
822         (WebCore::AVTrackPrivateAVFObjCImpl::videoKind const): Ditto.
823         (WebCore::AVTrackPrivateAVFObjCImpl::label const): Ditto.
824
825         * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h:
826         Use #pragma once and use CFTypeRef instead of AVMediaSelectionOption *
827         in the key to a HashMap.
828         * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm:
829         (WebCore::MediaSelectionGroupAVFObjC::updateOptions): Updated for
830         the above change.
831
832         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
833         Use SOFT_LINK_CONSTANT_MAY_FAIL instead of SOFT_LINK_POINTER_OPTIONAL for
834         strings, since SOFT_LINK_POINTER_OPTIONAL does not work for Objective-C
835         types under ARC.
836         (WebCore::customSchemeURL): Removed unnecessary use of
837         NeverDestroyed<RetainPtr>. Can just use a straight pointer without calling
838         release, and that works with or without ARC.
839         (WebCore::imageDecoderAssetOptions): Ditto. Here, had to add a retain,
840         which we'll remove when we turn on ARC. Added canLoad checks, needed
841         because of SOFT_LINK_CONSTANT_MAY_FAIL.
842         (WebCore::ImageDecoderAVFObjC::firstEnabledTrack): Added canLoad check,
843         needed because of SOFT_LINK_CONSTANT_MAY_FAIL.
844
845         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
846         Use CFTypeRef instead of AVAssetResourceLoadingRequest in HashMap.
847         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
848         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
849         Updated for above.
850         (WebCore::MediaPlayerPrivateAVFoundationObjC::didCancelLoadingRequest): Ditto.
851         (WebCore::MediaPlayerPrivateAVFoundationObjC::didStopLoadingRequest): Ditto.
852
853         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
854         Use CFTypeRef instead of AVSampleBufferAudioRenderer in HashMap.
855         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
856         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVolume): Updated for above.
857         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setMuted): Ditto.
858         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPreservesPitch): Ditto.
859         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableAudioSample): Ditto.
860         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addAudioRenderer): Ditto.
861         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeAudioRenderer): Ditto.
862
863         * platform/graphics/metal/GPUDrawableMetal.mm: Updated include; under ARC, it's
864         not safe to call a method on a class without seeing its interface.
865
866         * platform/mac/VideoFullscreenInterfaceMac.mm: Added an explicit
867         __unsafe_unretained for a delegate. Could consider moving to weak, but for now
868         this preserves the current behavior and compiles under ARC.
869
870         * platform/mac/WebCoreFullScreenPlaceholderView.h: Use strong for the contents,
871         weak for the target, and changed the action to be hard-coded instead of an
872         arbitrary selector. If we find we need the flexibility again later, we can do
873         it with a block, which is more ARC-friendly than calling an arbitrary selector.
874         * platform/mac/WebCoreFullScreenPlaceholderView.mm:
875         (-[WebCoreFullScreenPlaceholderView initWithFrame:]): Call function directly
876         instead of taking advantage of "using".
877         (-[WebCoreFullScreenPlaceholderView mouseDown:]): Call cancelOperation: on the
878         target rather than performing an arbitrary selector.
879
880         * platform/mac/WebCoreObjCExtras.mm:
881         (WebCoreObjCScheduleDeallocateOnMainThread): Use sel_registerName instead of
882         @selector, since @selector is not supported under ARC.
883
884         * platform/network/ResourceHandle.h: Use a return value rather than using an
885         inout argument in applySniffingPoliciesAndStoragePartitionIfNeeded.
886
887         * platform/network/cocoa/CookieStorageObserver.mm:
888         (WebCore::CookieStorageObserver::startObserving): Removed unnecessary
889         assertion of repondsToSelector since we are about to dispatch it immediately
890         after. Call the selector in the conventional way instead of using performSelector.
891
892         * platform/network/cocoa/WebCoreNSURLSession.h: Use #pragma once and use
893         CFTypeRef instead of an Objective-C type. Also use an explicit __unsafe_unretained
894         for the session in the data task.
895         * platform/network/cocoa/WebCoreNSURLSession.mm:
896         (-[WebCoreNSURLSession dealloc]): Updated for the above.
897         (-[WebCoreNSURLSession taskCompleted:]): Ditto.
898         (-[WebCoreNSURLSession invalidateAndCancel]): Ditto.
899         (-[WebCoreNSURLSession getTasksWithCompletionHandler:]): Ditto.
900         (-[WebCoreNSURLSession getAllTasksWithCompletionHandler:]): Ditto.
901         (-[WebCoreNSURLSession dataTaskWithRequest:]): Ditto.
902         (-[WebCoreNSURLSession dataTaskWithURL:]): Ditto.
903
904         * platform/network/mac/ResourceHandleMac.mm:
905         (WebCore::ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded):
906         Use a return value instead of an inout argument. Also use bridging casts.
907         (WebCore::ResourceHandle::createNSURLConnection): Updated for the change above.
908         Also use a bridging cast.
909         (WebCore::ResourceHandle::schedule): Use a bridging cast.
910         (WebCore::ResourceHandle::unschedule): Ditto.
911
912         * platform/network/mac/WebCoreURLResponse.mm:
913         (WebCore::adjustMIMETypeIfNecessary): Use a bridging cast.
914
915         * testing/Internals.cpp:
916         (WebCore::Internals::rangeForDictionaryLookupAtLocation): Moved the macOS
917         version of this function out of this file ...
918         * testing/Internals.mm:
919         (WebCore::Internals::rangeForDictionaryLookupAtLocation): ... to here.
920
921 2018-07-29  Yusuke Suzuki  <utatane.tea@gmail.com>
922
923         Use static global variables instead of static NeverDestroyed inside function if possible
924         https://bugs.webkit.org/show_bug.cgi?id=188146
925
926         Reviewed by Darin Adler.
927
928         This patch leverages constexpr constructors / trivial destructors more to remove unnecessary `static NeverDestroyed`
929         inside a function. It simplifies the code, removes the unnecessary function, and ensures the initialization at
930         a program loader phase.
931
932         We make StepRange::StepDescription constructor constexpr to remove bunch of `static NeverDestroyed<const StepRange::StepDescription>`.
933         And we use `static Lock` since WTF::Lock has constexpr constructor.
934
935         No behavior change.
936
937         * dom/MessagePort.cpp:
938         (WebCore::MessagePort::deref const):
939         (WebCore::MessagePort::isExistingMessagePortLocallyReachable):
940         (WebCore::MessagePort::notifyMessageAvailable):
941         (WebCore::MessagePort::MessagePort):
942         (WebCore::MessagePort::~MessagePort):
943         (WebCore::allMessagePortsLock): Deleted.
944         * dom/ScriptExecutionContext.cpp:
945         (WebCore::ScriptExecutionContext::contextIdentifier const):
946         (WebCore::ScriptExecutionContext::removeFromContextsMap):
947         (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
948         (WebCore::ScriptExecutionContext::postTaskTo):
949         (WebCore::allScriptExecutionContextsMapLock): Deleted.
950         * html/DateInputType.cpp:
951         (WebCore::DateInputType::createStepRange const):
952         * html/DateTimeInputType.cpp:
953         (WebCore::DateTimeInputType::createStepRange const):
954         * html/DateTimeLocalInputType.cpp:
955         (WebCore::DateTimeLocalInputType::createStepRange const):
956         * html/MonthInputType.cpp:
957         (WebCore::MonthInputType::createStepRange const):
958         * html/RangeInputType.cpp:
959         (WebCore::RangeInputType::createStepRange const):
960         * html/StepRange.h:
961         (WebCore::StepRange::StepDescription::StepDescription):
962         * html/TimeInputType.cpp:
963         (WebCore::TimeInputType::createStepRange const):
964         * html/WeekInputType.cpp:
965         (WebCore::WeekInputType::createStepRange const):
966         * page/SecurityPolicy.cpp:
967         (WebCore::originAccessMap):
968         (WebCore::SecurityPolicy::isAccessWhiteListed):
969         (WebCore::SecurityPolicy::addOriginAccessWhitelistEntry):
970         (WebCore::SecurityPolicy::removeOriginAccessWhitelistEntry):
971         (WebCore::SecurityPolicy::resetOriginAccessWhitelists):
972         (WebCore::originAccessMapLock): Deleted.
973         * platform/SchemeRegistry.cpp:
974         (WebCore::allBuiltinSchemes):
975         (WebCore::builtinLocalURLSchemes):
976         (WebCore::localURLSchemes):
977         (WebCore::displayIsolatedURLSchemes):
978         (WebCore::builtinSecureSchemes):
979         (WebCore::secureSchemes):
980         (WebCore::builtinSchemesWithUniqueOrigins):
981         (WebCore::schemesWithUniqueOrigins):
982         (WebCore::builtinCanDisplayOnlyIfCanRequestSchemes):
983         (WebCore::canDisplayOnlyIfCanRequestSchemes):
984         (WebCore::SchemeRegistry::registerURLSchemeAsLocal):
985         (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsLocal):
986         (WebCore::ContentSecurityPolicyBypassingSchemes):
987         (WebCore::cachePartitioningSchemes):
988         (WebCore::serviceWorkerSchemes):
989         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal):
990         (WebCore::SchemeRegistry::registerURLSchemeAsNoAccess):
991         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsNoAccess):
992         (WebCore::SchemeRegistry::registerURLSchemeAsDisplayIsolated):
993         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated):
994         (WebCore::SchemeRegistry::registerURLSchemeAsSecure):
995         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsSecure):
996         (WebCore::SchemeRegistry::canDisplayOnlyIfCanRequest):
997         (WebCore::SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest):
998         (WebCore::SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy):
999         (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy):
1000         (WebCore::SchemeRegistry::schemeShouldBypassContentSecurityPolicy):
1001         (WebCore::SchemeRegistry::registerURLSchemeAsCachePartitioned):
1002         (WebCore::SchemeRegistry::shouldPartitionCacheForURLScheme):
1003         (WebCore::SchemeRegistry::registerURLSchemeServiceWorkersCanHandle):
1004         (WebCore::SchemeRegistry::canServiceWorkersHandleURLScheme):
1005         (WebCore::SchemeRegistry::isServiceWorkerContainerCustomScheme):
1006         (WebCore::schemeRegistryLock): Deleted.
1007
1008 2018-07-29  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1009
1010         [Curl] Fix the bug when client reject the redirect on WebKitLegacy.
1011         https://bugs.webkit.org/show_bug.cgi?id=188130
1012
1013         Reviewed by Darin Adler.
1014
1015         ResourceHandle for Curl port has a bug when a client returns en empty request which
1016         indicates the redirecti is rejected by the client. It should be quit the task immediately,
1017         but it kept doing the job. Fixed.
1018         NetworkDataTask implementation did the right thing and there's no bug for them. 
1019
1020         Test: http/tests/xmlhttprequest/xmlhttprequest-unsafe-redirect-expected.txt
1021
1022         * platform/network/curl/ResourceHandleCurl.cpp:
1023         (WebCore::ResourceHandle::continueAfterWillSendRequest):
1024
1025 2018-07-28  Simon Fraser  <simon.fraser@apple.com>
1026
1027         Reset CompositingPolicyOverride between tests
1028         https://bugs.webkit.org/show_bug.cgi?id=188138
1029
1030         Reviewed by Zalan Bujtas.
1031
1032         WK1 tests were failing after r234330 because the compositing policy override optional
1033         was left set on the Page (WK1 has injected bundle SPI to clear it). Fix by having 
1034         Internals::resetToConsistentState clear this state.
1035
1036         * testing/Internals.cpp:
1037         (WebCore::Internals::resetToConsistentState):
1038
1039 2018-07-24  Simon Fraser  <simon.fraser@apple.com>
1040
1041         Animation stops with object-fit:contain on an animated 2d canvas
1042         https://bugs.webkit.org/show_bug.cgi?id=187840
1043
1044         Reviewed by Zalan Bujtas.
1045         
1046         If a canvas has object-fit: cover or contain, repaints need to mapped through
1047         the rect that is used to position the canvas in the element bounds, which is replacedContentRect().
1048         
1049         Add a version of replacedContentRect() that doesn't require passing the intrinsicSize() since
1050         all but RenderVideo just pass the RenderReplaced's intrinsicSize.
1051
1052         Test: fast/repaint/canvas-object-fit.html
1053
1054         * html/HTMLCanvasElement.cpp:
1055         (WebCore::HTMLCanvasElement::didDraw):
1056         * rendering/RenderHTMLCanvas.cpp:
1057         (WebCore::RenderHTMLCanvas::paintReplaced):
1058         * rendering/RenderImage.cpp:
1059         (WebCore::RenderImage::updateInnerContentRect):
1060         (WebCore::RenderImage::paintReplaced):
1061         * rendering/RenderLayerBacking.cpp:
1062         (WebCore::RenderLayerBacking::contentsBox const):
1063         * rendering/RenderReplaced.h:
1064         (WebCore::RenderReplaced::replacedContentRect const):
1065         * rendering/shapes/ShapeOutsideInfo.cpp:
1066         (WebCore::ShapeOutsideInfo::createShapeForImage const):
1067
1068 2018-07-27  Simon Fraser  <simon.fraser@apple.com>
1069
1070         Adjust the color matrix for the inverse apple-invert-lightness() transformation
1071         https://bugs.webkit.org/show_bug.cgi?id=188131
1072         rdar://problem/42673070
1073
1074         Reviewed by Zalan Bujtas.
1075
1076         Use the correct inverse matrix values.
1077
1078         Test: editing/style/inverse-color-filter.html
1079
1080         * platform/graphics/filters/FilterOperation.cpp:
1081         (WebCore::InvertLightnessFilterOperation::inverseTransformColor const):
1082
1083 2018-07-27  Eric Carlson  <eric.carlson@apple.com>
1084
1085         [iOS] Don't deactivate audio session
1086         https://bugs.webkit.org/show_bug.cgi?id=188127
1087         <rdar://problem/42544143>
1088
1089         Reviewed by Jon Lee.
1090         
1091         r233435 includes a change that deactivates the shared audio session when there are no more
1092         active media sessions. This is a good in WK2 because it allows other applications to resume
1093         playing audio when WebKit stops playing, but it is potentially bad in WK1 where the host
1094         app may also be playing audio.
1095
1096         * platform/audio/PlatformMediaSessionManager.cpp:
1097         (WebCore::PlatformMediaSessionManager::removeSession): Don't deactivate the audio session.
1098
1099 2018-07-27  Chris Dumez  <cdumez@apple.com>
1100
1101         Fix thread-safety issues related to RealtimeMediaSource::audioSamplesAvailable()
1102         https://bugs.webkit.org/show_bug.cgi?id=188097
1103         <rdar://problem/42558823>
1104
1105         Reviewed by Eric Carlson.
1106
1107         Fix thread-safety issues related to RealtimeMediaSource::audioSamplesAvailable(). RealtimeMediaSource::audioSamplesAvailable()
1108         is called on a background thread but iterates over observers that may get destroyed concurrently on the main thread.
1109
1110         To address the issue:
1111         - Introduce a Lock to protect m_observer accesses
1112         - Copy observers to a Vector before iterating over them
1113
1114         * platform/mediastream/MediaStreamTrackPrivate.cpp:
1115         (WebCore::MediaStreamTrackPrivate::forEachObserver const):
1116         (WebCore::MediaStreamTrackPrivate::addObserver):
1117         (WebCore::MediaStreamTrackPrivate::removeObserver):
1118         (WebCore::MediaStreamTrackPrivate::setEnabled):
1119         (WebCore::MediaStreamTrackPrivate::endTrack):
1120         (WebCore::MediaStreamTrackPrivate::sourceStarted):
1121         (WebCore::MediaStreamTrackPrivate::sourceStopped):
1122         (WebCore::MediaStreamTrackPrivate::sourceMutedChanged):
1123         (WebCore::MediaStreamTrackPrivate::sourceSettingsChanged):
1124         (WebCore::MediaStreamTrackPrivate::videoSampleAvailable):
1125         (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
1126         (WebCore::MediaStreamTrackPrivate::updateReadyState):
1127         * platform/mediastream/MediaStreamTrackPrivate.h:
1128         (WebCore::MediaStreamTrackPrivate::Observer::sampleBufferUpdated):
1129         (WebCore::MediaStreamTrackPrivate::Observer::audioSamplesAvailable):
1130         * platform/mediastream/RealtimeMediaSource.cpp:
1131         (WebCore::RealtimeMediaSource::addObserver):
1132         (WebCore::RealtimeMediaSource::removeObserver):
1133         (WebCore::RealtimeMediaSource::forEachObserver const):
1134         (WebCore::RealtimeMediaSource::notifyMutedObservers const):
1135         (WebCore::RealtimeMediaSource::settingsDidChange):
1136         (WebCore::RealtimeMediaSource::videoSampleAvailable):
1137         (WebCore::RealtimeMediaSource::audioSamplesAvailable):
1138         (WebCore::RealtimeMediaSource::start):
1139         (WebCore::RealtimeMediaSource::requestStop):
1140         (WebCore::RealtimeMediaSource::captureFailed):
1141         * platform/mediastream/RealtimeMediaSource.h:
1142         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
1143         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
1144         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp:
1145         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
1146
1147 2018-07-27  Alex Christensen  <achristensen@webkit.org>
1148
1149         Don't include WebPageProxy.h just for UndoOrRedo
1150         https://bugs.webkit.org/show_bug.cgi?id=188086
1151
1152         Reviewed by Saam Barati.
1153
1154         * platform/DragItem.h:
1155
1156 2018-07-27  Alex Christensen  <achristensen@webkit.org>
1157
1158         Make CompletionHandler more const correct
1159         https://bugs.webkit.org/show_bug.cgi?id=186543
1160
1161         Reviewed by Saam Barati.
1162
1163         * dom/messageports/MessagePortChannel.cpp:
1164         (WebCore::MessagePortChannel::checkRemotePortForActivity):
1165         * dom/messageports/MessagePortChannelProviderImpl.cpp:
1166         (WebCore::MessagePortChannelProviderImpl::checkRemotePortForActivity):
1167         * loader/DocumentLoader.cpp:
1168         (WebCore::DocumentLoader::responseReceived):
1169         * loader/FrameLoader.cpp:
1170         (WebCore::FrameLoader::loadURL):
1171         (WebCore::FrameLoader::loadWithDocumentLoader):
1172         (WebCore::FrameLoader::loadPostRequest):
1173         * platform/network/cocoa/WebCoreNSURLSession.mm:
1174         (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived):
1175         * workers/service/server/RegistrationDatabase.cpp:
1176         (WebCore::RegistrationDatabase::pushChanges):
1177         (WebCore::RegistrationDatabase::clearAll):
1178         * workers/service/server/SWServer.cpp:
1179         (WebCore::SWServer::matchAll):
1180         * workers/service/server/SWServer.h:
1181         * workers/service/server/SWServerWorker.cpp:
1182         (WebCore::SWServerWorker::matchAll):
1183         * workers/service/server/SWServerWorker.h:
1184
1185 2018-07-27  Simon Fraser  <simon.fraser@apple.com>
1186
1187         Be more conservative with compositing layer creation when memory is low
1188         https://bugs.webkit.org/show_bug.cgi?id=187866
1189         rdar://problem/42366345
1190
1191         Reviewed by Zalan Bujtas.
1192         
1193         When process physical footprint is above a fraction of the jetsam limit, be more conservative in making
1194         compositing layers. We avoid compositing for these situations:
1195         1. Layers with 3D transforms which are affine (like translateZ(0)).
1196         2. Layers with will-change
1197         3. Layers for canvases (other than WebGL/WebGPU)
1198         
1199         We reuse some macOS code in MemoryPressureHandler() but choose different thresholds for iOS,
1200         falling into "conservative mode" at 50% of jetsam limit, and "strict mode" at 65%.
1201         Compositing chooses to be more conservative in either "conservative" or "strict" memory modes.
1202         
1203         Plumb through a "compositingPolicyOverride" both so that on-device testing isn't
1204         flakily falling into a different mode, and so that we can impose the conservative
1205         mode for testing.
1206
1207         Test: compositing/layer-creation/compositing-policy.html
1208
1209         * page/Page.h:
1210         (WebCore::Page::compositingPolicyOverride const):
1211         (WebCore::Page::setCompositingPolicyOverride):
1212         * platform/graphics/transforms/Matrix3DTransformOperation.cpp:
1213         (WebCore::Matrix3DTransformOperation::isRepresentableIn2D const):
1214         * platform/graphics/transforms/Matrix3DTransformOperation.h:
1215         * platform/graphics/transforms/PerspectiveTransformOperation.h:
1216         * platform/graphics/transforms/RotateTransformOperation.h:
1217         * platform/graphics/transforms/ScaleTransformOperation.h:
1218         * platform/graphics/transforms/TransformOperation.h:
1219         (WebCore::TransformOperation::isRepresentableIn2D const):
1220         * platform/graphics/transforms/TransformOperations.h:
1221         (WebCore::TransformOperations::has3DOperation const):
1222         (WebCore::TransformOperations::isRepresentableIn2D const):
1223         * platform/graphics/transforms/TranslateTransformOperation.h:
1224         * rendering/RenderLayerBacking.cpp:
1225         (WebCore::RenderLayerBacking::updateGeometry):
1226         * rendering/RenderLayerCompositor.cpp:
1227         (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
1228         (WebCore::RenderLayerCompositor::updateCompositingPolicy):
1229         (WebCore::RenderLayerCompositor::updateCompositingLayers):
1230         (WebCore::RenderLayerCompositor::requiresCompositingForTransform const):
1231         (WebCore::RenderLayerCompositor::requiresCompositingForVideo const):
1232         (WebCore::RenderLayerCompositor::requiresCompositingForCanvas const):
1233         (WebCore::RenderLayerCompositor::requiresCompositingForPlugin const):
1234         (WebCore::RenderLayerCompositor::requiresCompositingForWillChange const):
1235         (WebCore::RenderLayerCompositor::needsFixedRootBackgroundLayer const):
1236         (WebCore::operator<<):
1237         * rendering/RenderLayerCompositor.h:
1238         * testing/Internals.cpp:
1239         (WebCore::Internals::setCompositingPolicyOverride):
1240         (WebCore::Internals::compositingPolicyOverride const):
1241         * testing/Internals.h:
1242         * testing/Internals.idl:
1243
1244 2018-07-27  Zalan Bujtas  <zalan@apple.com>
1245
1246         [WK1] ASSERTION FAILED: renderer().repaintLayoutRects().m_repaintRect == renderer().clippedOverflowRectForRepaint(renderer().containerForRepaint()) in WebCore::RenderLayer::updateLayerPositionsAfterScroll
1247         https://bugs.webkit.org/show_bug.cgi?id=188122
1248         <rdar://problem/42584790>
1249
1250         Reviewed by Simon Fraser.
1251
1252         When ScrollView's m_paintsEntireContents flag flips due to layer backing changes, the repaint area transitions from
1253         visual to layout overflow. When this happens the cached repaint rects become invalid and they need to be recomputed.
1254         Currently there's no mechanism to trigger repaint cache invalidation from ScrollView.
1255         Skip assertion for now on WK1 (see webkit.org/b/188121)
1256
1257         * rendering/RenderLayer.cpp:
1258         (WebCore::RenderLayer::updateLayerPositionsAfterScroll):
1259
1260 2018-07-27  Myles C. Maxfield  <mmaxfield@apple.com>
1261
1262         [WIN] Crash when trying to access store pages
1263         https://bugs.webkit.org/show_bug.cgi?id=188032
1264         <rdar://problem/42467016>
1265
1266         Reviewed by Brent Fulgham.
1267
1268         The Windows implementation of GlyphBuffer has an additional member, m_offsets, which represents
1269         an additional offset to the position to paint each glyph. It also has two add() functions, one
1270         which appends to this vector, and one which doesn't. The one that doesn't append to the vector
1271         should never be called on Windows (because Windows requires this vector to be full).
1272
1273         There were two situations where it was getting called:
1274         1) Inside ComplexTextController
1275         2) Inside display list playback
1276
1277         Windows shouldn't be using ComplexTextController because the Windows implementation of this 
1278         class isn't ready yet; instead it should be using UniscribeController. The display list playback
1279         code should be used on Windows.
1280
1281         Rather than fix the function to append an offset, we actually don't need the m_offsets vector
1282         in the first place. Instead, we can do it the same way that the Cocoa ports do it, which is to
1283         bake the offsets into the glyph advances. This is possible because the GlyphBuffer doesn't need
1284         to distinguish between layout advances and paint advances, so we can bake them together and
1285         just put paint advances in the GlyphBuffer. This should be a small (probably within-the-noise)
1286         performance and memory improvement.
1287
1288         * platform/graphics/ComplexTextController.cpp:
1289         (WebCore::ComplexTextController::ComplexTextController): Make sure that ComplexTextController
1290         isn't used on Windows.
1291         * platform/graphics/FontCascade.cpp:
1292         (WebCore::FontCascade::widthOfTextRange const): Switch from ComplexTextController to
1293         UniscribeController on Windows.
1294         (WebCore::FontCascade::drawGlyphBuffer const): After deleting the m_offsets vector, there's
1295         no reason to consult it when drawing.
1296         * platform/graphics/GlyphBuffer.h: Remove m_offsets
1297         (WebCore::GlyphBuffer::clear):
1298         (WebCore::GlyphBuffer::advanceAt const):
1299         (WebCore::GlyphBuffer::add):
1300         (WebCore::GlyphBuffer::expandLastAdvance):
1301         (WebCore::GlyphBuffer::shrink):
1302         (WebCore::GlyphBuffer::swap):
1303         (WebCore::GlyphBuffer::offsetAt const): Deleted.
1304         * platform/graphics/win/FontCGWin.cpp:
1305         (WebCore::FontCascade::drawGlyphs): After deleting the m_offsets vector, there's no reason
1306         to consult it when drawing.
1307         * platform/graphics/win/FontCascadeDirect2D.cpp:
1308         (WebCore::FontCascade::drawGlyphs): Ditto.
1309         * platform/graphics/win/UniscribeController.cpp:
1310         (WebCore::UniscribeController::shapeAndPlaceItem): Bake in the offsets into the glyph advances.
1311
1312 2018-07-27  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1313
1314         [Curl] Crash on synchronous request via ResourceHandle.
1315         https://bugs.webkit.org/show_bug.cgi?id=188033
1316
1317         Reviewed by Alex Christensen.
1318
1319         The timing of instantiation of delegate was wrong. Move it inside `delegate` getter().
1320         This bug was introduced at r228577.
1321
1322         Test: http/tests/xmlhttprequest/simple-sync.html
1323
1324         * platform/network/curl/ResourceHandleCurl.cpp:
1325         (WebCore::ResourceHandle::start):
1326         (WebCore::ResourceHandle::delegate):
1327
1328 2018-07-03  David Fenton  <david_fenton@apple.com>
1329
1330         Unreviewed, rolling out r233461.
1331
1332         assertions triggered on ios11 Debug wk2
1333
1334         Reverted changeset:
1335
1336         "[iOS] Add assert to catch improper use of WebCore::Timer in
1337         UI Process"
1338         https://bugs.webkit.org/show_bug.cgi?id=185330
1339         https://trac.webkit.org/changeset/233461
1340
1341 2018-07-27  Chris Dumez  <cdumez@apple.com>
1342
1343         [Media] Avoid unnecessarily constructing *TrackList objects
1344         https://bugs.webkit.org/show_bug.cgi?id=188094
1345
1346         Reviewed by Eric Carlson.
1347
1348         Avoid unnecessarily constructing *TrackList objects as this is preventing us from making them
1349         ActiveDOMObjects.
1350
1351         * Modules/mediasource/MediaSource.cpp:
1352         (WebCore::MediaSource::removeSourceBuffer):
1353         * Modules/mediasource/SourceBuffer.cpp:
1354         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment):
1355         * html/HTMLMediaElement.cpp:
1356         (WebCore::HTMLMediaElement::addAudioTrack):
1357         (WebCore::HTMLMediaElement::addTextTrack):
1358         (WebCore::HTMLMediaElement::addVideoTrack):
1359         (WebCore::HTMLMediaElement::ensureAudioTracks):
1360         (WebCore::HTMLMediaElement::ensureTextTracks):
1361         (WebCore::HTMLMediaElement::ensureVideoTracks):
1362         (WebCore::HTMLMediaElement::setSelectedTextTrack):
1363         (WebCore::HTMLMediaElement::audioTracks): Deleted.
1364         (WebCore::HTMLMediaElement::textTracks): Deleted.
1365         (WebCore::HTMLMediaElement::videoTracks): Deleted.
1366         * html/HTMLMediaElement.h:
1367         (WebCore::HTMLMediaElement::audioTracks const):
1368         (WebCore::HTMLMediaElement::textTracks const):
1369         (WebCore::HTMLMediaElement::videoTracks const):
1370         * html/HTMLMediaElement.idl:
1371         * html/shadow/MediaControlElements.cpp:
1372         (WebCore::MediaControlClosedCaptionsTrackListElement::updateDisplay):
1373         (WebCore::MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu):
1374         (WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
1375         * html/track/TextTrack.cpp:
1376         (WebCore::TextTrack::setKind):
1377         (WebCore::TextTrack::trackIndex):
1378         (WebCore::TextTrack::trackIndexRelativeToRenderedTracks):
1379         (WebCore::TextTrack::setLanguage):
1380         * html/track/VideoTrack.cpp:
1381         (WebCore::VideoTrack::setKind):
1382         (WebCore::VideoTrack::setLanguage):
1383         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
1384         (WebCore::PlaybackSessionModelMediaElement::setMediaElement):
1385         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionOptions):
1386
1387 2018-07-27  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1388
1389         [Curl] Set correct source info to ResourceResponse.
1390         https://bugs.webkit.org/show_bug.cgi?id=188069
1391
1392         Reviewed by Fujii Hironori.
1393
1394         ResourceResponseBase::Source::Network must be set by each ports. Curl port
1395         didn't set this.
1396
1397         Test: http/tests/cache/disk-cache/disk-cache-302-status-code.html
1398
1399         * platform/network/curl/ResourceResponseCurl.cpp:
1400         (WebCore::ResourceResponse::ResourceResponse):
1401
1402 2018-07-26  Andy VanWagoner  <andy@vanwagoner.family>
1403
1404         [INTL] Remove INTL sub-feature compile flags
1405         https://bugs.webkit.org/show_bug.cgi?id=188081
1406
1407         Reviewed by Michael Catanzaro.
1408
1409         Compile time feature flags for INTL sub features were removed, and are covered by existing tests.
1410
1411         * Configurations/FeatureDefines.xcconfig:
1412
1413 2018-07-26  Zalan Bujtas  <zalan@apple.com>
1414
1415         [Fullscreen] Do not create composited layers for renderers unless they are part of the fullscreen subtree.
1416         https://bugs.webkit.org/show_bug.cgi?id=188087
1417         <rdar://problem/42632124>
1418
1419         Reviewed by Simon Fraser.
1420
1421         Sibling composited layers prevent battery lifetime optimizations when in fullscreen.
1422
1423         Test: compositing/no-compositing-when-fulll-screen-is-present.html
1424
1425         * rendering/RenderLayer.cpp:
1426         (WebCore::RenderLayer::isDescendantOf const):
1427         * rendering/RenderLayer.h:
1428         * rendering/RenderLayerCompositor.cpp:
1429         (WebCore::isDescendantOfFullScreenLayer):
1430         (WebCore::RenderLayerCompositor::requiresCompositingForWillChange const):
1431         (WebCore::RenderLayerCompositor::requiresCompositingForPosition const):
1432
1433 2018-07-26  Ryan Haddad  <ryanhaddad@apple.com>
1434
1435         Unreviewed, rolling out r234281.
1436
1437         Broke internal builds.
1438
1439         Reverted changeset:
1440
1441         "[Datalist] Add button to TextFieldInputs with a datalist"
1442         https://bugs.webkit.org/show_bug.cgi?id=187741
1443         https://trac.webkit.org/changeset/234281
1444
1445 2018-07-26  Aditya Keerthi  <akeerthi@apple.com>
1446
1447         [Datalist] Add button to TextFieldInputs with a datalist
1448         https://bugs.webkit.org/show_bug.cgi?id=187741
1449
1450         Reviewed by Tim Horton.
1451
1452         TextFieldInputs that have an associated datalist element should be drawn as
1453         combo boxes. However, we cannot use NSComboBox for this control, as NSComboBox
1454         is not height-resizable. Furthermore, the input should also be able to contain
1455         additional elements, such as the stepper for type=number and the cancel button
1456         for type=search. For these reasons, we draw a button at the end of the input,
1457         mimicking appearance of a combo box.
1458
1459         The list-button -webkit-appearance value was added to display the new button.
1460
1461         Tests: fast/forms/datalist/datalist-searchinput-appearance.html
1462                fast/forms/datalist/datalist-textinput-appearance.html
1463
1464         * Resources/ListButtonArrow.png: Added.
1465         * Resources/ListButtonArrow@2x.png: Added.
1466         * WebCore.xcodeproj/project.pbxproj:
1467         * css/CSSPrimitiveValueMappings.h:
1468         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1469         * css/CSSProperties.json:
1470         * css/CSSValueKeywords.in:
1471         * css/html.css:
1472         (input::-webkit-list-button):
1473         * html/HTMLInputElement.cpp:
1474         (WebCore::HTMLInputElement::dataListButtonElement const):
1475         (WebCore::HTMLInputElement::isShowingList const):
1476         * html/HTMLInputElement.h:
1477         * html/InputType.h:
1478         (WebCore::InputType::dataListButtonElement const):
1479         (WebCore::InputType::isShowingList const):
1480         * html/TextFieldInputType.cpp:
1481         (WebCore::TextFieldInputType::needsContainer const):
1482         (WebCore::TextFieldInputType::createShadowSubtree):
1483         (WebCore::TextFieldInputType::destroyShadowSubtree):
1484         (WebCore::TextFieldInputType::listAttributeTargetChanged):
1485         (WebCore::TextFieldInputType::dataListButtonElement const):
1486         (WebCore::TextFieldInputType::dataListButtonElementWasClicked):
1487         (WebCore::TextFieldInputType::didCloseSuggestions):
1488         (WebCore::TextFieldInputType::isShowingList const):
1489         * html/TextFieldInputType.h:
1490         * html/shadow/DataListButtonElement.cpp: Added.
1491         (WebCore::DataListButtonElement::create):
1492         (WebCore::DataListButtonElement::DataListButtonElement):
1493         (WebCore::DataListButtonElement::~DataListButtonElement):
1494         (WebCore::DataListButtonElement::defaultEventHandler):
1495         * html/shadow/DataListButtonElement.h: Added.
1496         * platform/ThemeTypes.h:
1497         * rendering/RenderTheme.cpp:
1498         (WebCore::RenderTheme::adjustStyle):
1499         (WebCore::RenderTheme::adjustListButtonStyle const):
1500         * rendering/RenderTheme.h:
1501         * rendering/RenderThemeMac.h:
1502         * rendering/RenderThemeMac.mm:
1503         (-[WebListButtonCell drawWithFrame:inView:]):
1504         (WebCore::RenderThemeMac::paintListButtonForInput):
1505         (WebCore::RenderThemeMac::adjustListButtonStyle const):
1506         (WebCore::RenderThemeMac::paintTextField):
1507         (WebCore::RenderThemeMac::paintSearchField):
1508         (WebCore::RenderThemeMac::paintSearchFieldCancelButton):
1509         (WebCore::RenderThemeMac::listButton const):
1510
1511 2018-07-26  Antoine Quint  <graouts@apple.com>
1512
1513         [Web Animations] Accelerated animations don't respect a positive delay value
1514         https://bugs.webkit.org/show_bug.cgi?id=186930
1515         <rdar://problem/41393393>
1516
1517         Reviewed by Dean Jackson.
1518
1519         Test: webanimations/accelerated-animation-with-delay.html
1520
1521         We would mistakenly clear the list of pending accelerated actions in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
1522         even if we failed to proceed because of the target element's renderer not being composited yet. Now, we clear the list after
1523         we've established we can apply them, and if we can't we inform the animation with a call to acceleratedStateDidChange() which
1524         will in turn call into the document timeline so that we may consider these animations on the next tick.
1525
1526         For this to work correctly we must make a change to DocumentTimeline::applyPendingAcceleratedAnimations() which only cleared
1527         its list of pending accelerated animations _after_ iterating through them, which would be problematic since we would now add
1528         animations to this list. That list is now copied and cleared prior to iterating through its members.
1529
1530         We also fix the naming of the m_pendingAcceleratedActions copy in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
1531         to have a more similar name.
1532
1533         * animation/DocumentTimeline.cpp:
1534         (WebCore::DocumentTimeline::applyPendingAcceleratedAnimations):
1535         * animation/KeyframeEffectReadOnly.cpp:
1536         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
1537
1538 2018-07-26  Ross Kirsling  <ross.kirsling@sony.com>
1539
1540         String(View) should have a splitAllowingEmptyEntries function instead of a flag parameter
1541         https://bugs.webkit.org/show_bug.cgi?id=187963
1542
1543         Reviewed by Alex Christensen.
1544
1545         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
1546         (WebCore::convert):
1547         * Modules/cache/DOMCache.cpp:
1548         (WebCore::hasResponseVaryStarHeaderValue):
1549         * Modules/cache/DOMCacheEngine.cpp:
1550         (WebCore::DOMCacheEngine::queryCacheMatch):
1551         * Modules/mediastream/PeerConnectionBackend.cpp:
1552         (WebCore::filterICECandidate):
1553         (WebCore::PeerConnectionBackend::filterSDP const):
1554         * Modules/websockets/WebSocketHandshake.cpp:
1555         (WebCore::WebSocketHandshake::checkResponseHeaders):
1556         * accessibility/AccessibilityObject.h:
1557         (WebCore::AccessibilityObject::determineARIADropEffects):
1558         * accessibility/AccessibilityRenderObject.cpp:
1559         (WebCore::AccessibilityRenderObject::determineARIADropEffects):
1560         * accessibility/AccessibilityRenderObject.h:
1561         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1562         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1563         * editing/cocoa/DataDetection.mm:
1564         (WebCore::DataDetection::shouldCancelDefaultAction):
1565         * editing/markup.cpp:
1566         (WebCore::fillContainerFromString):
1567         (WebCore::createFragmentFromText):
1568         * html/EmailInputType.cpp:
1569         (WebCore::EmailInputType::typeMismatchFor const):
1570         (WebCore::EmailInputType::sanitizeValue const):
1571         * html/HTMLInputElement.cpp:
1572         (WebCore::parseAcceptAttribute):
1573         * html/ValidationMessage.cpp:
1574         (WebCore::ValidationMessage::setMessageDOMAndStartTimer):
1575         * html/canvas/WebGLRenderingContextBase.cpp:
1576         (WebCore::WebGLRenderingContextBase::compileShader):
1577         * inspector/agents/InspectorDOMAgent.cpp:
1578         (WebCore::InspectorDOMAgent::nodeForPath):
1579         * loader/FormSubmission.cpp:
1580         (WebCore::encodingFromAcceptCharset):
1581         * loader/ResourceTiming.cpp:
1582         (WebCore::passesTimingAllowCheck):
1583         * page/WindowFeatures.cpp:
1584         (WebCore::parseDisabledAdaptations):
1585         (WebCore::parseDialogFeaturesMap):
1586         * platform/URL.cpp:
1587         (WebCore::isIPv4Address):
1588         (WebCore::isIPv6Address):
1589         * platform/graphics/GLContext.cpp:
1590         (WebCore::GLContext::version):
1591         * platform/graphics/freetype/FontCacheFreeType.cpp:
1592         (WebCore::patternToFamilies):
1593         * platform/graphics/gstreamer/GStreamerCommon.cpp:
1594         (WebCore::extractGStreamerOptionsFromCommandLine):
1595         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
1596         (WebCore::Extensions3DOpenGLCommon::Extensions3DOpenGLCommon):
1597         (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions):
1598         * platform/gtk/PasteboardHelper.cpp:
1599         (WebCore::PasteboardHelper::fillSelectionData):
1600         * platform/gtk/SelectionData.cpp:
1601         (WebCore::SelectionData::setURIList):
1602         * platform/network/CacheValidation.cpp:
1603         (WebCore::collectVaryingRequestHeaders):
1604         * platform/network/HTTPParsers.cpp:
1605         (WebCore::filenameFromHTTPContentDisposition):
1606         (WebCore::parseXFrameOptionsHeader):
1607         (WebCore::parseAccessControlExposeHeadersAllowList):
1608         * platform/network/curl/CookieUtil.cpp:
1609         (WebCore::CookieUtil::parseCookieHeader):
1610         * platform/network/curl/CurlCacheEntry.cpp:
1611         (WebCore::CurlCacheEntry::loadResponseHeaders):
1612         * platform/network/curl/CurlCacheManager.cpp:
1613         (WebCore::CurlCacheManager::loadIndex):
1614         * platform/network/soup/CookieJarSoup.cpp:
1615         (WebCore::setCookiesFromDOM):
1616         * svg/SVGAnimationElement.cpp:
1617         (WebCore::SVGAnimationElement::parseAttribute):
1618         * svg/SVGToOTFFontConversion.cpp:
1619         (WebCore::SVGToOTFFontConverter::appendOS2Table):
1620         * svg/animation/SVGSMILElement.cpp:
1621         (WebCore::SVGSMILElement::parseBeginOrEnd):
1622         * testing/MockCDMFactory.cpp:
1623         (WebCore::MockCDM::sanitizeResponse const):
1624         (WebCore::MockCDMInstance::updateLicense):
1625         Update split/splitAllowingEmptyEntries usage.
1626
1627 2018-07-26  Nan Wang  <n_wang@apple.com>
1628
1629         AX: nothing returned for various previous text marker APIs from one div/p node to another
1630         https://bugs.webkit.org/show_bug.cgi?id=188071
1631
1632         Reviewed by Chris Fleizach.
1633
1634         TextIterator is emitting an extra '\n' at the end of the <p> node and there's no
1635         corresponding text node in the DOM tree, so we are not able to handle that for 
1636         text markers. Fixed it by ignoring the extra '\n' and anchor the text marker to 
1637         the previous child text node.
1638
1639         Test: accessibility/mac/text-marker-p-tags.html
1640
1641         * accessibility/AXObjectCache.cpp:
1642         (WebCore::AXObjectCache::traverseToOffsetInRange):
1643
1644 2018-07-26  Commit Queue  <commit-queue@webkit.org>
1645
1646         Unreviewed, rolling out r234181 and r234189.
1647         https://bugs.webkit.org/show_bug.cgi?id=188075
1648
1649         These are not needed right now (Requested by thorton on
1650         #webkit).
1651
1652         Reverted changesets:
1653
1654         "Enable Web Content Filtering on watchOS"
1655         https://bugs.webkit.org/show_bug.cgi?id=187979
1656         https://trac.webkit.org/changeset/234181
1657
1658         "HAVE(PARENTAL_CONTROLS) should be true on watchOS"
1659         https://bugs.webkit.org/show_bug.cgi?id=187985
1660         https://trac.webkit.org/changeset/234189
1661
1662 2018-07-26  Timothy Hatcher  <timothy@apple.com>
1663
1664         Use the Page's appearance when converting pasteboard attributed strings.
1665         https://bugs.webkit.org/show_bug.cgi?id=188067
1666         rdar://problem/42632246
1667
1668         Reviewed by Wenson Hsieh.
1669
1670         * editing/cocoa/WebContentReaderCocoa.mm:
1671         (WebCore::createFragment): Create a LocalDefaultSystemAppearance based on the Page.
1672
1673 2018-07-26  Eric Carlson  <eric.carlson@apple.com>
1674
1675         Switching tabs should not close PiP window
1676         https://bugs.webkit.org/show_bug.cgi?id=188054
1677         <rdar://problem/41212379>
1678
1679         Reviewed by Jon Lee.
1680
1681         No new tests, fixes an existing test.
1682         
1683         Prior to r233926, calling VideoFullscreenInterfaceMac::requestHideAndExitFullscreen was a noop.
1684         In r233926 it was updated to close the PiP window and was called from the PIPViewControllerDelegate
1685         selectors to close the PiP window. requestHideAndExitFullscreen is also called from 
1686         WebPageProxy::viewDidLeaveWindow when the web view is removed from it window, so switching
1687         tabs also closed the PiP window. Revert the changes to requestHideAndExitFullscreen, and add
1688         a new method that is only used by the delegate to exit PiP.
1689
1690         * platform/mac/VideoFullscreenInterfaceMac.h:
1691         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Make this an empty,
1692         do-nothing method.
1693         * platform/mac/VideoFullscreenInterfaceMac.mm:
1694         (-[WebVideoFullscreenInterfaceMacObjC pipShouldClose:]): Call requestHideAndExitPiP.
1695         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]): Ditto.
1696         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitPiP): Renamed from requestHideAndExitFullscreen.
1697         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Deleted.
1698
1699 2018-07-04  Darin Adler  <darin@apple.com>
1700
1701         Improve WebGPU implementation, including using Metal Objective-C protocols more simply and correctly
1702         https://bugs.webkit.org/show_bug.cgi?id=187333
1703
1704         Reviewed by Sam Weinig.
1705
1706         - Used a new OBJC_PROTOCOL macro to handle things in the Metal API that are protocols.
1707           The code previously had used OBJC_CLASS, but that created unrelated classes.
1708           Fixing this allows removing many typecasts that were in the existing code, makes it
1709           ARC-compatible, and also allowed the compiler to detect a couple mistakes where we
1710           were calling methods that don't exist.
1711
1712         - Eliminated use of separate heap-allocated, reference-counted objects to
1713           hold pointers to Metal objects.
1714
1715         - Reduced the use of the WebGPU wrappers to pass around arguments inside the code.
1716           They are now used only as part of the DOM binding; the inner GPU objects are used
1717           whenever possible. This cuts down the number of separate functions needed a bit,
1718           since we don't always need accessors for the things inside the wrappers.
1719
1720         - Used references rather than pointers in many cases.
1721
1722         - Took out three kinds of null checks: 1) Unneeded ones since Objective-C has the
1723           "do nothing and return 0" behavior for methods without return values and that return
1724           integer scalars. 2) Checks that aren't needed because the code has clear, invariant
1725           guarantees that the pointer won't be null. 3) The simplest variant of (2), checks
1726           that can be obviated by using reference types instead of pointer types.
1727
1728         - For Metal-specific functions and data members, used the function name metal() and
1729           the data member name m_metal rather than longer wordier names with the word "platform"
1730           in them. We could use "platform" if these objects were platform-specific objects used
1731           in a cross-platform way that needed a common name. But in this case it's clearer to
1732           call them "metal" since we are dropping down to the metal with Metal API, and
1733           shared platform-independent code will not be accessing these.
1734
1735         - Fixed the common mistake of using "unsigned long" in our C++ code to match IDL.
1736           The "unsigned long" type in IDL correponds to the "unsigned" type in WebKit code.
1737
1738         - Used "const" more in the GPU functions that are wrappers around Metal objects to
1739           reflect the fact that these have semantics of smart pointers; most operations can be
1740           done without changing which object is pointed to. This allows us to use const
1741           references to pass things around without reference count churn.
1742
1743         - Reduced includes.
1744
1745         - Added "explicit" keywords where appropriate.
1746
1747         - Removed unused functions. In particular, removed non-Metal stub versions of the
1748           functions in the GPU classes: the right way to start a new port is to clone the
1749           Metal-specific files and turn the into stubs if needed, it does not make it
1750           significantly more convenient to have stubs in the platform independent files,
1751           especially ones that are not compiled for any platform.
1752
1753         - Removed most the WEBCORE_EXPORT in the GPU headers; left only what's needed to
1754           support testing with TestWebKitAPI.
1755
1756         - Fixed two storage leaks in GPUDevice by adding missing adoptNS.
1757
1758         * PlatformMac.cmake: Moved files from platform/graphics/cocoa to platform/graphics/metal.
1759         * SourcesCocoa.txt: Ditto.
1760         * WebCore.xcodeproj/project.pbxproj: Ditto. Fixed paths on some files and groups/directories.
1761         Made the platform files that abstract GPU all be "project" visible, not "private", since
1762         they don't need to be visible outside WebCore. Removed reference to FontSelectionKeywordValues.h,
1763         which does not seem to be a source file, a derived source file, or mentioned in any change log.
1764
1765         * bindings/js/JSWebGPURenderPassAttachmentDescriptorCustom.cpp:
1766         (WebCore::toJSNewlyCreated): Create the correct wrapper for a
1767         WebGPURenderPassDepthAttachmentDescriptor. The old code would instead
1768         create a WebGPURenderPassAttachmentDescriptor wrapper, which can't be
1769         used to access the clearDepth attribute.
1770
1771         * html/canvas/WebGPUBuffer.cpp:
1772         (WebCore::WebGPUBuffer::create): Use more references rather than pointers for things
1773         that are never null. Added comment about possibly returning null on failure in future.
1774         (WebCore::WebGPUBuffer::WebGPUBuffer): Updated to store the GPUBuffer inside the class
1775         instead of in a separate reference counted object.
1776         * html/canvas/WebGPUBuffer.h: Ditto.
1777
1778         * html/canvas/WebGPUCommandBuffer.cpp:
1779         (WebCore::WebGPUCommandBuffer::create): Use references and lower level types.
1780         (WebCore::WebGPUCommandBuffer::WebGPUCommandBuffer): Store the GPUCommandBuffer
1781         inside the class.
1782         (WebCore::WebGPUCommandBuffer::commit): Removed unneeded null checks.
1783         (WebCore::WebGPUCommandBuffer::presentDrawable): Ditto.
1784         (WebCore::WebGPUCommandBuffer::createRenderCommandEncoderWithDescriptor):
1785         Removed unneeded local variable.
1786         (WebCore::WebGPUCommandBuffer::createComputeCommandEncoder): Ditto.
1787         (WebCore::WebGPUCommandBuffer::completed): Store the DOMPromiseProxy in this
1788         class, not in GPUCommandBuffer.
1789         * html/canvas/WebGPUCommandBuffer.h: Ditto.
1790
1791         * html/canvas/WebGPUCommandQueue.cpp:
1792         (WebCore::WebGPUCommandQueue::create): Use references and lower level types.
1793         (WebCore::WebGPUCommandQueue::WebGPUCommandQueue): Store the GPUCommandQueue
1794         inside the class.
1795         (WebCore::WebGPUCommandQueue::createCommandBuffer): Ditto.
1796         * html/canvas/WebGPUCommandQueue.h: Ditto.
1797         * html/canvas/WebGPUCommandQueue.idl: The return value of createCommandBuffer
1798         is no longer nullable.
1799
1800         * html/canvas/WebGPUComputeCommandEncoder.cpp:
1801         (WebCore::WebGPUComputeCommandEncoder::create): More of the same.
1802         (WebCore::WebGPUComputeCommandEncoder::WebGPUComputeCommandEncoder): Ditto.
1803         (WebCore::WebGPUComputeCommandEncoder::setComputePipelineState): Ditto.
1804         (WebCore::WebGPUComputeCommandEncoder::setBuffer): Ditto.
1805         (WebCore::WebGPUComputeCommandEncoder::dispatch): Ditto.
1806         (WebCore::WebGPUComputeCommandEncoder::endEncoding): Ditto.
1807         * html/canvas/WebGPUComputeCommandEncoder.h: Ditto.
1808
1809         * html/canvas/WebGPUComputePipelineState.cpp:
1810         (WebCore::WebGPUComputePipelineState::create): More of the same.
1811         (WebCore::WebGPUComputePipelineState::WebGPUComputePipelineState): Ditto.
1812         * html/canvas/WebGPUComputePipelineState.h: Ditto.
1813
1814         * html/canvas/WebGPUDepthStencilDescriptor.cpp:
1815         (WebCore::WebGPUDepthStencilDescriptor::create): More of the same.
1816         (WebCore::WebGPUDepthStencilDescriptor::depthWriteEnabled const): Ditto.
1817         (WebCore::WebGPUDepthStencilDescriptor::setDepthWriteEnabled): Ditto.
1818         (WebCore::WebGPUDepthStencilDescriptor::depthCompareFunction const): Ditto.
1819         (WebCore::WebGPUDepthStencilDescriptor::setDepthCompareFunction): Ditto.
1820         * html/canvas/WebGPUDepthStencilDescriptor.h: Ditto. Also fixed a bug
1821         where m_depthCompareFunction was uninitialized in newly created objects.
1822
1823         * html/canvas/WebGPUDepthStencilState.cpp:
1824         (WebCore::WebGPUDepthStencilState::create): More of the same.
1825         (WebCore::WebGPUDepthStencilState::WebGPUDepthStencilState): Ditto.
1826         (WebCore::WebGPUDepthStencilState::label const): Ditto.
1827         (WebCore::WebGPUDepthStencilState::setLabel): Ditto.
1828         * html/canvas/WebGPUDepthStencilState.h: Ditto.
1829
1830         * html/canvas/WebGPUDrawable.cpp:
1831         (WebCore::WebGPUDrawable::create): More of the same.
1832         (WebCore::WebGPUDrawable::WebGPUDrawable): Ditto.
1833         * html/canvas/WebGPUDrawable.h: Ditto.
1834
1835         * html/canvas/WebGPUEnums.cpp: Removed some stray const.
1836         * html/canvas/WebGPUEnums.h: Ditto.
1837
1838         * html/canvas/WebGPUFunction.cpp:
1839         (WebCore::WebGPUFunction::create): More of the same.
1840         (WebCore::WebGPUFunction::WebGPUFunction): Ditto.
1841         * html/canvas/WebGPUFunction.h: Ditto.
1842
1843         * html/canvas/WebGPULibrary.cpp:
1844         (WebCore::WebGPULibrary::create): More of the same.
1845         (WebCore::WebGPULibrary::WebGPULibrary): Ditto.
1846         (WebCore::WebGPULibrary::functionNames const): Ditto.
1847         (WebCore::WebGPULibrary::functionWithName const): Ditto.
1848         * html/canvas/WebGPULibrary.h: Ditto.
1849
1850         * html/canvas/WebGPUObject.cpp:
1851         (WebCore::WebGPUObject::WebGPUObject):
1852         (WebCore::WebGPUObject::deleteObject): Deleted this unused function.
1853         We can bring it back later if we find we need it the way we did with the
1854         WebGL implementation, but currently it's a never-called stub. Also
1855         deleted the isDeleted and m_deleted for the same reason.
1856         * html/canvas/WebGPUObject.h: Ditto.
1857
1858         * html/canvas/WebGPURenderCommandEncoder.cpp:
1859         (WebCore::WebGPURenderCommandEncoder::create): More of the same.
1860         (WebCore::WebGPURenderCommandEncoder::WebGPURenderCommandEncoder): Ditto.
1861         (WebCore::WebGPURenderCommandEncoder::setRenderPipelineState): Ditto.
1862         (WebCore::WebGPURenderCommandEncoder::setDepthStencilState): Ditto.
1863         (WebCore::WebGPURenderCommandEncoder::setVertexBuffer): Ditto.
1864         (WebCore::WebGPURenderCommandEncoder::setFragmentBuffer): Ditto.
1865         (WebCore::WebGPURenderCommandEncoder::drawPrimitives): Ditto.
1866         (WebCore::WebGPURenderCommandEncoder::endEncoding): Ditto.
1867         * html/canvas/WebGPURenderCommandEncoder.h: Ditto.
1868
1869         * html/canvas/WebGPURenderPassAttachmentDescriptor.cpp:
1870         (WebCore::WebGPURenderPassAttachmentDescriptor::WebGPURenderPassAttachmentDescriptor):
1871         More of the same.
1872         (WebCore::WebGPURenderPassAttachmentDescriptor::loadAction const): Ditto.
1873         (WebCore::WebGPURenderPassAttachmentDescriptor::setLoadAction): Ditto.
1874         (WebCore::WebGPURenderPassAttachmentDescriptor::storeAction const): Ditto.
1875         (WebCore::WebGPURenderPassAttachmentDescriptor::setStoreAction): Ditto.
1876         (WebCore::WebGPURenderPassAttachmentDescriptor::texture const): Ditto.
1877         (WebCore::WebGPURenderPassAttachmentDescriptor::setTexture): Ditto.
1878         * html/canvas/WebGPURenderPassAttachmentDescriptor.h: Ditto.
1879
1880         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp:
1881         (WebCore::WebGPURenderPassColorAttachmentDescriptor::create): More of the same.
1882         (WebCore::WebGPURenderPassColorAttachmentDescriptor::WebGPURenderPassColorAttachmentDescriptor): Ditto.
1883         (WebCore::WebGPURenderPassColorAttachmentDescriptor::descriptor const): Ditto.
1884         (WebCore::WebGPURenderPassColorAttachmentDescriptor::clearColor const): Ditto.
1885         (WebCore::WebGPURenderPassColorAttachmentDescriptor::setClearColor): Ditto.
1886         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.h: Ditto.
1887
1888         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp:
1889         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::create): More of the same.
1890         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::WebGPURenderPassDepthAttachmentDescriptor): Ditto.
1891         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::clearDepth const): Ditto.
1892         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::setClearDepth): Ditto.
1893         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::descriptor const): Ditto.
1894         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.h: Ditto.
1895
1896         * html/canvas/WebGPURenderPassDescriptor.cpp:
1897         (WebCore::WebGPURenderPassDescriptor::create): More of the same.
1898         (WebCore::WebGPURenderPassDescriptor::depthAttachment): Ditto.
1899         (WebCore::WebGPURenderPassDescriptor::colorAttachments): Ditto.
1900         * html/canvas/WebGPURenderPassDescriptor.h: Ditto.
1901
1902         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.cpp:
1903         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::create): More of the same.
1904         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::WebGPURenderPipelineColorAttachmentDescriptor): Ditto.
1905         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::pixelFormat const): Ditto.
1906         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::setPixelFormat): Ditto.
1907         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.h: Ditto.
1908
1909         * html/canvas/WebGPURenderPipelineDescriptor.cpp:
1910         (WebCore::WebGPURenderPipelineDescriptor::create): More of the same.
1911         (WebCore::WebGPURenderPipelineDescriptor::vertexFunction const): Ditto.
1912         (WebCore::WebGPURenderPipelineDescriptor::setVertexFunction): Ditto.
1913         (WebCore::WebGPURenderPipelineDescriptor::fragmentFunction const): Ditto.
1914         (WebCore::WebGPURenderPipelineDescriptor::setFragmentFunction): Ditto.
1915         (WebCore::WebGPURenderPipelineDescriptor::colorAttachments): Ditto.
1916         (WebCore::WebGPURenderPipelineDescriptor::depthAttachmentPixelFormat const): Ditto.
1917         (WebCore::WebGPURenderPipelineDescriptor::setDepthAttachmentPixelFormat): Ditto.
1918         (WebCore::WebGPURenderPipelineDescriptor::reset): Ditto.
1919         * html/canvas/WebGPURenderPipelineDescriptor.h: Ditto.
1920
1921         * html/canvas/WebGPURenderPipelineState.cpp:
1922         (WebCore::WebGPURenderPipelineState::create): More of the same.
1923         (WebCore::WebGPURenderPipelineState::WebGPURenderPipelineState): Ditto.
1924         (WebCore::WebGPURenderPipelineState::label const): Ditto.
1925         (WebCore::WebGPURenderPipelineState::setLabel): Ditto.
1926         * html/canvas/WebGPURenderPipelineState.h: Ditto.
1927
1928         * html/canvas/WebGPURenderingContext.cpp:
1929         (WebCore::WebGPURenderingContext::create): More of the same.
1930         (WebCore::WebGPURenderingContext::WebGPURenderingContext): Ditto.
1931         (WebCore::WebGPURenderingContext::initializeNewContext): Ditto.
1932         (WebCore::WebGPURenderingContext::platformLayer const): Ditto.
1933         (WebCore::WebGPURenderingContext::markLayerComposited): Ditto.
1934         (WebCore::WebGPURenderingContext::reshape): Ditto.
1935         (WebCore::WebGPURenderingContext::createLibrary): Ditto.
1936         (WebCore::WebGPURenderingContext::createRenderPipelineState): Ditto.
1937         (WebCore::WebGPURenderingContext::createDepthStencilState): Ditto.
1938         (WebCore::WebGPURenderingContext::createComputePipelineState): Ditto.
1939         (WebCore::WebGPURenderingContext::createCommandQueue): Ditto.
1940         (WebCore::WebGPURenderingContext::nextDrawable): Ditto.
1941         (WebCore::WebGPURenderingContext::createBuffer): Ditto.
1942         (WebCore::WebGPURenderingContext::createTexture): Ditto.
1943         * html/canvas/WebGPURenderingContext.h: Made many functions final and
1944         private.
1945         * html/canvas/WebGPURenderingContext.idl: The return value of most of
1946         the create functions are no longer nullable.
1947
1948         * html/canvas/WebGPUSize.h: Use "unsigned" instead of "unsigned long".
1949
1950         * html/canvas/WebGPUTexture.cpp:
1951         (WebCore::WebGPUTexture::createFromDrawableTexture): More of the same.
1952         (WebCore::WebGPUTexture::create): Ditto.
1953         (WebCore::WebGPUTexture::WebGPUTexture): Ditto.
1954         * html/canvas/WebGPUTexture.h: Ditto.
1955
1956         * html/canvas/WebGPUTextureDescriptor.cpp:
1957         (WebCore::WebGPUTextureDescriptor::create): More of the same.
1958         (WebCore::WebGPUTextureDescriptor::WebGPUTextureDescriptor): Ditto.
1959         (WebCore::WebGPUTextureDescriptor::width const): Ditto.
1960         (WebCore::WebGPUTextureDescriptor::setWidth): Ditto.
1961         (WebCore::WebGPUTextureDescriptor::height const): Ditto.
1962         (WebCore::WebGPUTextureDescriptor::setHeight): Ditto.
1963         (WebCore::WebGPUTextureDescriptor::sampleCount const): Ditto.
1964         (WebCore::WebGPUTextureDescriptor::setSampleCount): Ditto.
1965         (WebCore::WebGPUTextureDescriptor::textureType const): Ditto.
1966         (WebCore::WebGPUTextureDescriptor::setTextureType): Ditto.
1967         (WebCore::WebGPUTextureDescriptor::storageMode const): Ditto.
1968         (WebCore::WebGPUTextureDescriptor::setStorageMode): Ditto.
1969         (WebCore::WebGPUTextureDescriptor::usage const): Ditto.
1970         (WebCore::WebGPUTextureDescriptor::setUsage): Ditto.
1971         * html/canvas/WebGPUTextureDescriptor.h: Ditto.
1972
1973         * platform/graphics/metal/GPUBufferMetal.mm: Moved from "cocoa" directory.
1974         (WebCore::GPUBuffer::GPUBuffer): Simplify code using references and the
1975         "metal" naming.
1976
1977         * platform/graphics/metal/GPUCommandBufferMetal.mm:
1978         (WebCore::GPUCommandBuffer::GPUCommandBuffer): Take a function to be called as the
1979         completed handler and set it up.
1980         (WebCore::GPUCommandBuffer::presentDrawable const): Ditto.
1981         (WebCore::GPUCommandBuffer::commit const): Ditto.
1982         (WebCore::GPUCommandBuffer::addCompletedHandler): Deleted.
1983
1984         * platform/graphics/metal/GPUCommandQueueMetal.mm:
1985         (WebCore::GPUCommandQueue::GPUCommandQueue): Ditto. Also rewrote label handling a bit.
1986         (WebCore::GPUCommandQueue::label const): Ditto.
1987         (WebCore::GPUCommandQueue::setLabel const): Ditto.
1988
1989         * platform/graphics/metal/GPUComputeCommandEncoderMetal.mm:
1990         (WebCore::GPUComputeCommandEncoder::GPUComputeCommandEncoder): Ditto.
1991         (WebCore::GPUComputeCommandEncoder::setComputePipelineState const): Ditto.
1992         (WebCore::GPUComputeCommandEncoder::setBuffer const): Ditto.
1993         (WebCore::GPUComputeCommandEncoder::dispatch const): Ditto.
1994         (WebCore::GPUComputeCommandEncoder::endEncoding const): Ditto.
1995
1996         * platform/graphics/metal/GPUComputePipelineStateMetal.mm:
1997         (WebCore::GPUComputePipelineState::GPUComputePipelineState): Ditto.
1998
1999         * platform/graphics/metal/GPUDepthStencilDescriptorMetal.mm:
2000         (WebCore::GPUDepthStencilDescriptor::GPUDepthStencilDescriptor): Ditto.
2001         (WebCore::GPUDepthStencilDescriptor::depthWriteEnabled const): Ditto.
2002         (WebCore::GPUDepthStencilDescriptor::setDepthWriteEnabled const): Ditto.
2003         (WebCore::GPUDepthStencilDescriptor::depthCompareFunction const): Ditto.
2004         (WebCore::GPUDepthStencilDescriptor::setDepthCompareFunction const): Ditto.
2005
2006         * platform/graphics/metal/GPUDepthStencilStateMetal.mm:
2007         (WebCore::GPUDepthStencilState::GPUDepthStencilState): Ditto.
2008         (WebCore::GPUDepthStencilState::label const): Ditto.
2009         (WebCore::GPUDepthStencilState::setLabel const): Ditto. This is one of the
2010         functions that was calling a method that does not exist. Added a comment.
2011
2012         * platform/graphics/metal/GPUDeviceMetal.mm:
2013         (WebCore::GPUDevice::GPUDevice): Ditto. Also fixed two storage leaks where
2014         we neglected to do adoptNS on the result of MTLCreateSystemDefaultDevice and
2015         on the result of -[[WebGPULayer alloc] initWithGPUDevice:].
2016         (WebCore::GPUDevice::reshape const): Ditto.
2017         (WebCore::GPUDevice::platformLayer const): Ditto.
2018         (WebCore::GPUDevice::operator! const): Ditto.
2019
2020         * platform/graphics/metal/GPUDrawableMetal.mm:
2021         (WebCore::GPUDrawable::GPUDrawable): Ditto.
2022         (WebCore::GPUDrawable::release): Ditto.
2023         (WebCore::GPUDrawable::metal const): Ditto.
2024         (WebCore::GPUDrawable::texture const): Ditto.
2025
2026         * platform/graphics/metal/GPUFunctionMetal.mm:
2027         (WebCore::GPUFunction::GPUFunction): Ditto.
2028         (WebCore::GPUFunction::name const): Ditto.
2029         (WebCore::GPUFunction::metal const): Ditto.
2030         (WebCore::GPUFunction::operator! const): Ditto.
2031
2032         * platform/graphics/metal/GPULibraryMetal.mm:
2033         (WebCore::GPULibrary::GPULibrary): Ditto.
2034         (WebCore::GPULibrary::label const): Ditto.
2035         (WebCore::GPULibrary::setLabel const): Ditto.
2036         (WebCore::GPULibrary::functionNames const): Ditto.
2037         (WebCore::GPULibrary::metal const): Ditto.
2038
2039         * platform/graphics/metal/GPURenderCommandEncoderMetal.mm:
2040         (WebCore::GPURenderCommandEncoder::GPURenderCommandEncoder): Ditto.
2041         (WebCore::GPURenderCommandEncoder::setRenderPipelineState const): Ditto.
2042         (WebCore::GPURenderCommandEncoder::setDepthStencilState const): Ditto.
2043         (WebCore::GPURenderCommandEncoder::setVertexBuffer const): Ditto.
2044         (WebCore::GPURenderCommandEncoder::setFragmentBuffer const): Ditto.
2045         (WebCore::GPURenderCommandEncoder::drawPrimitives const): Ditto.
2046         (WebCore::GPURenderCommandEncoder::endEncoding const): Ditto.
2047
2048         * platform/graphics/metal/GPURenderPassAttachmentDescriptorMetal.mm:
2049         (WebCore::GPURenderPassAttachmentDescriptor::GPURenderPassAttachmentDescriptor): Ditto.
2050         (WebCore::GPURenderPassAttachmentDescriptor::loadAction const): Ditto.
2051         (WebCore::GPURenderPassAttachmentDescriptor::setLoadAction const): Ditto.
2052         (WebCore::GPURenderPassAttachmentDescriptor::storeAction const): Ditto.
2053         (WebCore::GPURenderPassAttachmentDescriptor::setStoreAction const): Ditto.
2054         (WebCore::GPURenderPassAttachmentDescriptor::setTexture const): Ditto.
2055
2056         * platform/graphics/metal/GPURenderPassColorAttachmentDescriptorMetal.mm:
2057         (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor): Ditto.
2058         (WebCore::GPURenderPassColorAttachmentDescriptor::clearColor const): Ditto.
2059         (WebCore::GPURenderPassColorAttachmentDescriptor::setClearColor const): Ditto.
2060         (WebCore::GPURenderPassColorAttachmentDescriptor::metal const): Ditto.
2061
2062         * platform/graphics/metal/GPURenderPassDepthAttachmentDescriptorMetal.mm:
2063         (WebCore::GPURenderPassDepthAttachmentDescriptor::GPURenderPassDepthAttachmentDescriptor): Ditto.
2064         (WebCore::GPURenderPassDepthAttachmentDescriptor::clearDepth const): Ditto.
2065         (WebCore::GPURenderPassDepthAttachmentDescriptor::setClearDepth const): Ditto.
2066         (WebCore::GPURenderPassDepthAttachmentDescriptor::metal const): Ditto.
2067
2068         * platform/graphics/metal/GPURenderPassDescriptorMetal.mm:
2069         (WebCore::GPURenderPassDescriptor::GPURenderPassDescriptor): Ditto.
2070         (WebCore::GPURenderPassDescriptor::colorAttachments const): Ditto.
2071         (WebCore::GPURenderPassDescriptor::depthAttachment const): Ditto.
2072         (WebCore::GPURenderPassDescriptor::metal const): Ditto.
2073
2074         * platform/graphics/metal/GPURenderPipelineColorAttachmentDescriptorMetal.mm:
2075         (WebCore::GPURenderPipelineColorAttachmentDescriptor::GPURenderPipelineColorAttachmentDescriptor): Ditto.
2076         (WebCore::GPURenderPipelineColorAttachmentDescriptor::pixelFormat const): Ditto.
2077         (WebCore::GPURenderPipelineColorAttachmentDescriptor::setPixelFormat const): Ditto.
2078         (WebCore::GPURenderPipelineColorAttachmentDescriptor::metal const): Ditto.
2079
2080         * platform/graphics/metal/GPURenderPipelineDescriptorMetal.mm:
2081         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor): Ditto.
2082         (WebCore::GPURenderPipelineDescriptor::depthAttachmentPixelFormat const): Ditto.
2083         (WebCore::GPURenderPipelineDescriptor::setDepthAttachmentPixelFormat const): Ditto.
2084         (WebCore::GPURenderPipelineDescriptor::setVertexFunction const): Ditto.
2085         (WebCore::GPURenderPipelineDescriptor::setFragmentFunction const): Ditto.
2086         (WebCore::GPURenderPipelineDescriptor::colorAttachments const): Ditto.
2087         (WebCore::GPURenderPipelineDescriptor::reset const): Ditto.
2088         (WebCore::GPURenderPipelineDescriptor::metal const): Ditto.
2089
2090         * platform/graphics/metal/GPURenderPipelineStateMetal.mm:
2091         (WebCore::GPURenderPipelineState::GPURenderPipelineState): Ditto.
2092         (WebCore::GPURenderPipelineState::label const): Ditto.
2093         (WebCore::GPURenderPipelineState::setLabel const): Ditto. This is one of the
2094         functions that was calling a method that does not exist. Added a comment.
2095         (WebCore::GPURenderPipelineState::metal const): Ditto.
2096
2097         * platform/graphics/metal/GPUTextureDescriptorMetal.mm:
2098         (WebCore::GPUTextureDescriptor::GPUTextureDescriptor): Ditto.
2099         (WebCore::GPUTextureDescriptor::width const): Ditto.
2100         (WebCore::GPUTextureDescriptor::setWidth const): Ditto.
2101         (WebCore::GPUTextureDescriptor::height const): Ditto.
2102         (WebCore::GPUTextureDescriptor::setHeight const): Ditto.
2103         (WebCore::GPUTextureDescriptor::sampleCount const): Ditto.
2104         (WebCore::GPUTextureDescriptor::setSampleCount const): Ditto.
2105         (WebCore::GPUTextureDescriptor::textureType const): Ditto.
2106         (WebCore::GPUTextureDescriptor::setTextureType const): Ditto.
2107         (WebCore::GPUTextureDescriptor::storageMode const): Ditto.
2108         (WebCore::GPUTextureDescriptor::setStorageMode const): Ditto.
2109         (WebCore::GPUTextureDescriptor::usage const): Ditto.
2110         (WebCore::GPUTextureDescriptor::setUsage const): Ditto.
2111         (WebCore::GPUTextureDescriptor::metal const): Ditto.
2112
2113         * platform/graphics/metal/GPUTextureMetal.mm:
2114         (WebCore::GPUTexture::GPUTexture): Ditto.
2115         (WebCore::GPUTexture::width const): Ditto.
2116         (WebCore::GPUTexture::height const): Ditto.
2117         (WebCore::GPUTexture::metal const): Ditto.
2118
2119         * platform/graphics/gpu/GPUBuffer.cpp: Removed unused stubs.
2120         (WebCore::GPUBuffer::length const): Moved this function here since it has
2121         a useful platform-independent implementation.
2122
2123         * platform/graphics/gpu/GPUBuffer.h: Use OBJC_PROTOCOL for MTLBuffer.
2124         Did the other thigs mentioned above: USE(METAL), remove WEBCORE_EXPORT,
2125         no longer be RefCounted, etc.
2126
2127         * platform/graphics/gpu/GPUCommandBuffer.cpp: Ditto.
2128         * platform/graphics/gpu/GPUCommandBuffer.h: Ditto. Use OBJC_PROTOCOL
2129         for MTLCommandBuffer.
2130
2131         * platform/graphics/gpu/GPUCommandQueue.cpp: Ditto.
2132         * platform/graphics/gpu/GPUCommandQueue.h: Ditto. Use OBJC_PROTOCOL for
2133         MTLCommandQueue.
2134
2135         * platform/graphics/gpu/GPUComputeCommandEncoder.cpp: Ditto.
2136         * platform/graphics/gpu/GPUComputeCommandEncoder.h: Ditto. Use OBJC_PROTOCOL for
2137         MTLComputeCommandEncoder.
2138
2139         * platform/graphics/gpu/GPUComputePipelineState.cpp: Ditto.
2140         * platform/graphics/gpu/GPUComputePipelineState.h: Ditto. Use OBJC_PROTOCOL for
2141         MTLComputePipelineState.
2142
2143         * platform/graphics/gpu/GPUDepthStencilDescriptor.cpp: Ditto.
2144         * platform/graphics/gpu/GPUDepthStencilDescriptor.h: Ditto.
2145
2146         * platform/graphics/gpu/GPUDepthStencilState.cpp: Ditto.
2147         * platform/graphics/gpu/GPUDepthStencilState.h: Ditto. Use OBJC_PROTOCOL for
2148         MTLDepthStencilState.
2149
2150         * platform/graphics/gpu/GPUDevice.cpp: Ditto.
2151         * platform/graphics/gpu/GPUDevice.h: Ditto. Use OBJC_PROTOCOL for MTLDevice.
2152
2153         * platform/graphics/gpu/GPUDrawable.cpp: Ditto.
2154         * platform/graphics/gpu/GPUDrawable.h: Ditto. Use OBJC_PROTOCOL for
2155         MTLDrawable and MTLTexture.
2156
2157         * platform/graphics/gpu/GPUEnums.h: Tweaked formatting.
2158
2159         * platform/graphics/gpu/GPUFunction.cpp: Ditto.
2160         * platform/graphics/gpu/GPUFunction.h: Ditto. Use OBJC_PROTOCOL for
2161         MTLFunction.
2162
2163         * platform/graphics/gpu/GPULibrary.cpp: Ditto.
2164         * platform/graphics/gpu/GPULibrary.h: Ditto. Use OBJC_PROTOCOL for
2165         MTLLibrary.
2166
2167         * platform/graphics/gpu/GPURenderCommandEncoder.cpp: Ditto.
2168         * platform/graphics/gpu/GPURenderCommandEncoder.h: Ditto.
2169         Use OBJC_PROTOCOL for MTLRenderCommandEncoder.
2170
2171         * platform/graphics/gpu/GPURenderPassAttachmentDescriptor.cpp: Ditto.
2172         * platform/graphics/gpu/GPURenderPassAttachmentDescriptor.h: Ditto.
2173
2174         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.cpp: Ditto.
2175         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.h: Ditto.
2176
2177         * platform/graphics/gpu/GPURenderPassDepthAttachmentDescriptor.cpp: Ditto.
2178         * platform/graphics/gpu/GPURenderPassDepthAttachmentDescriptor.h: Ditto.
2179
2180         * platform/graphics/gpu/GPURenderPassDescriptor.cpp: Ditto.
2181         * platform/graphics/gpu/GPURenderPassDescriptor.h: Ditto.
2182
2183         * platform/graphics/gpu/GPURenderPipelineColorAttachmentDescriptor.cpp: Ditto.
2184         * platform/graphics/gpu/GPURenderPipelineColorAttachmentDescriptor.h: Ditto.
2185
2186         * platform/graphics/gpu/GPURenderPipelineDescriptor.cpp: Ditto.
2187         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Ditto.
2188
2189         * platform/graphics/gpu/GPURenderPipelineState.cpp: Ditto.
2190         * platform/graphics/gpu/GPURenderPipelineState.h: Ditto. Use OBJC_PROTOCOL
2191         for MTLRenderPipelineState.
2192
2193         * platform/graphics/gpu/GPUSize.h: Use "unsigned" instead of "unsigned long".
2194
2195         * platform/graphics/gpu/GPUTexture.cpp: Ditto.
2196         * platform/graphics/gpu/GPUTexture.h: Ditto. Use OBJC_PROTOCOL for
2197         MTLTexture.
2198
2199         * platform/graphics/gpu/GPUTextureDescriptor.cpp: Ditto.
2200         * platform/graphics/gpu/GPUTextureDescriptor.h: Ditto.
2201
2202 2018-07-26  Zalan Bujtas  <zalan@apple.com>
2203
2204         [LFC][Floating] Add skeleton for basic positioning.
2205         https://bugs.webkit.org/show_bug.cgi?id=187974
2206
2207         Reviewed by Antti Koivisto.
2208
2209         Add floating boxes to an empty floating context.
2210
2211         * layout/FloatingContext.cpp:
2212         (WebCore::Layout::FloatingContext::FloatingContext):
2213         (WebCore::Layout::FloatingContext::computePosition):
2214         * layout/FloatingContext.h:
2215         (WebCore::Layout::FloatingContext::floatingState const):
2216         (WebCore::Layout::FloatingContext::layoutContext const):
2217         * layout/FloatingState.cpp:
2218         (WebCore::Layout::FloatingState::FloatingState):
2219         (WebCore::Layout::FloatingState::append):
2220         * layout/FloatingState.h:
2221         (WebCore::Layout::FloatingState::create):
2222         (WebCore::Layout::FloatingState::isEmpty const):
2223         (WebCore::Layout::FloatingState::layoutContext const):
2224         * layout/FormattingState.h:
2225         * layout/LayoutContext.cpp:
2226         (WebCore::Layout::LayoutContext::establishedFormattingState):
2227         * layout/LayoutContext.h:
2228         * layout/blockformatting/BlockFormattingContext.cpp:
2229         (WebCore::Layout::BlockFormattingContext::layout const):
2230         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
2231         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
2232         * layout/blockformatting/BlockFormattingContext.h:
2233         * layout/blockformatting/BlockInvalidation.cpp:
2234         (WebCore::Layout::invalidationStopsAtFormattingContextBoundary):
2235         * layout/layouttree/LayoutBox.cpp:
2236         (WebCore::Layout::Box::isLeftFloatingPositioned const):
2237         (WebCore::Layout::Box::isRightFloatingPositioned const):
2238         * layout/layouttree/LayoutBox.h:
2239
2240 2018-07-26  Zalan Bujtas  <zalan@apple.com>
2241
2242         [LFC][BFC] Do not try to access containing block's height during descendant height computation
2243         https://bugs.webkit.org/show_bug.cgi?id=187970
2244
2245         Reviewed by Antti Koivisto.
2246
2247         Mostly becasue in BFC, we compute the descendents' height first so the containing block's height is probably not computed yet.
2248
2249         * layout/FormattingContextGeometry.cpp:
2250         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
2251         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
2252         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
2253
2254 2018-07-26  Frederic Wang  <fwang@igalia.com>
2255
2256         Unreviewed, add bug references into FIXME comments for CSSOM View API
2257
2258         * dom/Element.idl:
2259         * page/ScrollToOptions.idl:
2260
2261 2018-07-26  Zalan Bujtas  <zalan@apple.com>
2262
2263         [LFC][BFC] assert-not-implemented-yet on inflow non-replaced height when style is not fixed/auto.
2264         https://bugs.webkit.org/show_bug.cgi?id=187969
2265
2266         Reviewed by Antti Koivisto.
2267
2268         Assert on unsupported height types when computing inflow non-replaced height.
2269
2270         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2271         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2272
2273 2018-07-26  Antoine Quint  <graouts@apple.com>
2274
2275         [Web Animations] REGRESSION: transition added immediately after element creation doesn't work
2276         https://bugs.webkit.org/show_bug.cgi?id=187942
2277
2278         Reviewed by Dean Jackson.
2279
2280         Tests: webanimations/accelerated-transition-by-removing-property.html
2281                webanimations/partly-accelerated-transition-by-removing-property.html
2282
2283         The Style::TreeResolver::createAnimatedElementUpdate() function expected a flag to be set that indicates that
2284         running animations on an element should yield a change in composited state for that element's layer. We did not
2285         have code accounting for this flag in the Web Animations engine. We now have a resolveAnimationsForElement()
2286         method on DocumentTimeline which looks at all animations resolved on the element and see if all of them are
2287         running accelerated and whether at least one of them is pending. In that case, we set the shouldRecompositeLayer
2288         flag in createAnimatedElementUpdate() to true which guarantees the element's layer will have a backing when
2289         we attempt to start the animation in KeyframeEffectReadOnly::applyPendingAcceleratedActions() where we would
2290         have previously failed to have layer-backed renderer to perform an accelerated animation on (under certain
2291         circumstances, see test).
2292
2293         * animation/DocumentTimeline.cpp:
2294         (WebCore::DocumentTimeline::resolveAnimationsForElement):
2295         * animation/DocumentTimeline.h:
2296         * animation/KeyframeEffectReadOnly.h:
2297         (WebCore::KeyframeEffectReadOnly::hasPendingAcceleratedAction const):
2298         * style/StyleTreeResolver.cpp:
2299         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
2300
2301 2018-07-25  Chris Dumez  <cdumez@apple.com>
2302
2303         Allow ActiveDOMObject's canSuspend / suspend / resume overrides to destroy ActiveDOMObjects
2304         https://bugs.webkit.org/show_bug.cgi?id=188025
2305
2306         Reviewed by Alex Christensen.
2307
2308         Apply the same logic as in ScriptExecutionContext::stopActiveDOMObjects() to support destruction of
2309         ActiveDOMObjects while we're calling ActiveDOMObject's canSuspend / suspend / resume overrides.
2310
2311         We copy m_activeDOMObjects into a Vector and iterate over the copy instead of m_activeDOMObjects.
2312         Since ActiveDOMObject is not RefCounted or CanMakeWeakPtr, we verify that the raw pointer is still
2313         valid by checking if m_activeDOMObjects still contains it, as we iterate. This is safe as the
2314         ActiveDOMObject destructor removes the object from ScriptExecutionContext::m_activeDOMObjects.
2315         New ActiveDOMObjects with the same pointer value cannot be created while we iterate as we already
2316         prevent the construction of new ActiveDOMObjects while we iterate via RELEASE_ASSERT().
2317
2318         * dom/ScriptExecutionContext.cpp:
2319         (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension):
2320         (WebCore::ScriptExecutionContext::forEachActiveDOMObject const):
2321         (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
2322         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
2323         (WebCore::ScriptExecutionContext::stopActiveDOMObjects):
2324         (WebCore::ScriptExecutionContext::willDestroyActiveDOMObject):
2325         * dom/ScriptExecutionContext.h:
2326
2327 2018-07-25  Justin Fan  <justin_fan@apple.com>
2328
2329         Systems with no NSScreens hitting assertion in rendererIDForDisplay when creating WebGL context
2330         https://bugs.webkit.org/show_bug.cgi?id=188023
2331         <rdar://problem/42476622>
2332
2333         Reviewed by Simon Fraser.
2334
2335         On systems with no NSScreens, PlatformScreenMac's screenData map is not populated; rendererIDForDisplay
2336         will thus hit an assertion rather than returning 0. Removing the assertion for now. 
2337
2338         Covered by existing tests.
2339
2340         * platform/mac/PlatformScreenMac.mm:
2341         (WebCore::rendererIDForDisplay):
2342
2343 2018-07-25  Zalan Bujtas  <zalan@apple.com>
2344
2345         Build fix after r234215. Unreviewed.
2346
2347         * rendering/RenderTheme.cpp:
2348
2349 2018-07-25  Zalan Bujtas  <zalan@apple.com>
2350
2351         REGRESSION(r227577) Text on TV & Movies page doesn't wrap properly in iTunes
2352         https://bugs.webkit.org/show_bug.cgi?id=188018
2353         <rdar://problem/42517520>
2354
2355         Reviewed by Dean Jackson.
2356
2357         Manual rollout of r227577.
2358
2359         Test: fast/overflow/line-clamp-with-text-shadow.html
2360
2361         * Sources.txt:
2362         * WebCore.xcodeproj/project.pbxproj:
2363         * css/CSSComputedStyleDeclaration.cpp:
2364         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
2365         * css/CSSProperties.json:
2366         * css/StyleBuilderCustom.h:
2367         (WebCore::StyleBuilderCustom::applyValueWebkitLinesClamp): Deleted.
2368         * css/parser/CSSParserContext.cpp:
2369         (WebCore::CSSParserContext::CSSParserContext):
2370         * css/parser/CSSParserContext.h:
2371         (WebCore::CSSParserContextHash::hash):
2372         * css/parser/CSSPropertyParser.cpp:
2373         (WebCore::CSSPropertyParser::parseSingleValue):
2374         (WebCore::consumeLinesClamp): Deleted.
2375         * page/Settings.yaml:
2376         * rendering/RenderBlockFlow.cpp:
2377         (WebCore::RenderBlockFlow::willCreateColumns const):
2378         (WebCore::getHeightForLineCount):
2379         (WebCore::RenderBlockFlow::heightForLineCount):
2380         (WebCore::RenderBlockFlow::layoutExcludedChildren):
2381         (WebCore::RenderBlockFlow::logicalHeightForLineCount): Deleted.
2382         (WebCore::RenderBlockFlow::logicalHeightExcludingLineCount): Deleted.
2383         * rendering/RenderBlockFlow.h:
2384         * rendering/RenderDeprecatedFlexibleBox.cpp:
2385         (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
2386         * rendering/RenderFragmentContainer.cpp:
2387         (WebCore::RenderFragmentContainer::pageLogicalHeightForOffset const): Deleted.
2388         * rendering/RenderFragmentContainer.h:
2389         * rendering/RenderFragmentedFlow.cpp:
2390         (WebCore::RenderFragmentedFlow::validateFragments):
2391         (WebCore::RenderFragmentedFlow::pageLogicalHeightForOffset const):
2392         (WebCore::RenderFragmentedFlow::pageRemainingLogicalHeightForOffset const):
2393         * rendering/RenderFragmentedFlow.h:
2394         * rendering/RenderLinesClampFlow.cpp: Removed.
2395         * rendering/RenderLinesClampFlow.h: Removed.
2396         * rendering/RenderLinesClampSet.cpp: Removed.
2397         * rendering/RenderLinesClampSet.h: Removed.
2398         * rendering/RenderMultiColumnFlow.cpp:
2399         (WebCore::RenderMultiColumnFlow::isColumnSpanningDescendant const): Deleted.
2400         (WebCore::RenderMultiColumnFlow::createMultiColumnSet): Deleted.
2401         * rendering/RenderMultiColumnFlow.h:
2402         (WebCore::RenderMultiColumnFlow::multiColumnBlockFlow const): Deleted.
2403         (WebCore::RenderMultiColumnFlow::hasColumnSpanner const): Deleted.
2404         (WebCore::RenderMultiColumnFlow::findColumnSpannerPlaceholder const): Deleted.
2405         (WebCore::RenderMultiColumnFlow::columnCount const): Deleted.
2406         (WebCore::RenderMultiColumnFlow::columnWidth const): Deleted.
2407         (WebCore::RenderMultiColumnFlow::columnHeightAvailable const): Deleted.
2408         (WebCore::RenderMultiColumnFlow::setColumnHeightAvailable): Deleted.
2409         (WebCore::RenderMultiColumnFlow::inBalancingPass const): Deleted.
2410         (WebCore::RenderMultiColumnFlow::setInBalancingPass): Deleted.
2411         (WebCore::RenderMultiColumnFlow::needsHeightsRecalculation const): Deleted.
2412         (WebCore::RenderMultiColumnFlow::setNeedsHeightsRecalculation): Deleted.
2413         (WebCore::RenderMultiColumnFlow::shouldRelayoutForPagination const): Deleted.
2414         (WebCore::RenderMultiColumnFlow::setColumnCountAndWidth): Deleted.
2415         (WebCore::RenderMultiColumnFlow::progressionIsInline const): Deleted.
2416         (WebCore::RenderMultiColumnFlow::setProgressionIsInline): Deleted.
2417         (WebCore::RenderMultiColumnFlow::progressionIsReversed const): Deleted.
2418         (WebCore::RenderMultiColumnFlow::setProgressionIsReversed): Deleted.
2419         (WebCore::RenderMultiColumnFlow::spannerMap): Deleted.
2420         * rendering/RenderMultiColumnSet.cpp:
2421         (WebCore::RenderMultiColumnSet::collectLayerFragments):
2422         (WebCore::RenderMultiColumnSet::columnTranslationForOffset const):
2423         * rendering/RenderMultiColumnSet.h:
2424         (WebCore::RenderMultiColumnSet::multiColumnBlockFlow const): Deleted.
2425         (WebCore::RenderMultiColumnSet::multiColumnFlow const): Deleted.
2426         (WebCore::RenderMultiColumnSet::logicalTopInFragmentedFlow const): Deleted.
2427         (WebCore::RenderMultiColumnSet::logicalBottomInFragmentedFlow const): Deleted.
2428         (WebCore::RenderMultiColumnSet::logicalHeightInFragmentedFlow const): Deleted.
2429         (WebCore::RenderMultiColumnSet::computedColumnCount const): Deleted.
2430         (WebCore::RenderMultiColumnSet::computedColumnWidth const): Deleted.
2431         (WebCore::RenderMultiColumnSet::computedColumnHeight const): Deleted.
2432         (WebCore::RenderMultiColumnSet::columnHeightComputed const): Deleted.
2433         (WebCore::RenderMultiColumnSet::setComputedColumnWidthAndCount): Deleted.
2434         (WebCore::RenderMultiColumnSet::updateMinimumColumnHeight): Deleted.
2435         (WebCore::RenderMultiColumnSet::minimumColumnHeight const): Deleted.
2436         (WebCore::RenderMultiColumnSet::forcedBreaksCount const): Deleted.
2437         (WebCore::RenderMultiColumnSet::hasBeenFlowed const): Deleted.
2438         (WebCore::RenderMultiColumnSet::skipLayerFragmentCollectionForColumn const): Deleted.
2439         (WebCore::RenderMultiColumnSet::customBlockProgressionAdjustmentForColumn const): Deleted.
2440         (WebCore::RenderMultiColumnSet::ContentRun::ContentRun): Deleted.
2441         (WebCore::RenderMultiColumnSet::ContentRun::assumedImplicitBreaks const): Deleted.
2442         (WebCore::RenderMultiColumnSet::ContentRun::assumeAnotherImplicitBreak): Deleted.
2443         (WebCore::RenderMultiColumnSet::ContentRun::breakOffset const): Deleted.
2444         (WebCore::RenderMultiColumnSet::ContentRun::columnLogicalHeight const): Deleted.
2445         * rendering/RenderObject.h:
2446         (WebCore::RenderObject::isRenderLinesClampFlow const): Deleted.
2447         (WebCore::RenderObject::isRenderLinesClampSet const): Deleted.
2448         * rendering/style/LineClampValue.h:
2449         (WebCore::LinesClampValue::LinesClampValue): Deleted.
2450         (WebCore::LinesClampValue::isNone const): Deleted.
2451         (WebCore::LinesClampValue::operator== const): Deleted.
2452         (WebCore::LinesClampValue::operator!= const): Deleted.
2453         (WebCore::LinesClampValue::start const): Deleted.
2454         (WebCore::LinesClampValue::end const): Deleted.
2455         (WebCore::LinesClampValue::center const): Deleted.
2456         * rendering/style/RenderStyle.h:
2457         (WebCore::RenderStyle::lineClamp const):
2458         (WebCore::RenderStyle::setLineClamp):
2459         (WebCore::RenderStyle::initialLineClamp):
2460         (WebCore::RenderStyle::hasInlineColumnAxis const):
2461         (WebCore::RenderStyle::linesClamp const): Deleted.
2462         (WebCore::RenderStyle::hasLinesClamp const): Deleted.
2463         (WebCore::RenderStyle::setLinesClamp): Deleted.
2464         (WebCore::RenderStyle::initialLinesClamp): Deleted.
2465         * rendering/style/StyleRareNonInheritedData.cpp:
2466         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
2467         (WebCore::StyleRareNonInheritedData::operator== const):
2468         * rendering/style/StyleRareNonInheritedData.h:
2469         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
2470         (WebCore::isValidColumnSpanner):
2471         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
2472         (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant):
2473
2474 2018-07-25  Chris Dumez  <cdumez@apple.com>
2475
2476         navigator.userAgent may return outdated value after webView.customUserAgent is set
2477         https://bugs.webkit.org/show_bug.cgi?id=188009
2478         <rdar://problem/42566456>
2479
2480         Reviewed by Alex Christensen.
2481
2482         Invalidate the navigator.userAgent cache whenever the user agent gets changed to avoid exposing
2483         outdated values to JavaScript.
2484
2485         * page/Navigator.cpp:
2486         (WebCore::Navigator::userAgentChanged):
2487         * page/Navigator.h:
2488         * page/NavigatorID.idl:
2489         * page/Page.cpp:
2490         (WebCore::Page::userAgentChanged):
2491         * page/Page.h:
2492
2493 2018-07-25  David Fenton  <david_fenton@apple.com>
2494
2495         Unreviewed, rolling out r234187.
2496
2497         the layout test added with this change is flaky on the bots
2498
2499         Reverted changeset:
2500
2501         "Animation stops with object-fit:contain on an animated 2d
2502         canvas"
2503         https://bugs.webkit.org/show_bug.cgi?id=187840
2504         https://trac.webkit.org/changeset/234187
2505
2506 2018-07-25  Chris Dumez  <cdumez@apple.com>
2507
2508         Turn assertion preventing removal of ActiveDOMObjects while we iterate over them into a RELEASE_ASSERT
2509         https://bugs.webkit.org/show_bug.cgi?id=187978
2510
2511         Reviewed by Eric Carlson.
2512
2513         Turn assertion preventing removal of ActiveDOMObjects while we iterate over them into a RELEASE_ASSERT.
2514         If code does this, this leads to hard to investigate crashes such as rdar://problem/42160890. With a
2515         release assertion, we would find the culprits right away. The assertion guarding against addition of
2516         ActiveDOMObjects while we iterate is already a RELEASE_ASSERT.
2517
2518         * dom/ScriptExecutionContext.cpp:
2519         (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension):
2520         (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
2521         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
2522         (WebCore::ScriptExecutionContext::willDestroyActiveDOMObject):
2523         * dom/ScriptExecutionContext.h:
2524
2525 2018-07-24  Chris Dumez  <cdumez@apple.com>
2526
2527         REGRESSION (r219757): Accessing response getter of XHR instance from IFRAME sets constructor to Object from the IFRAME
2528         https://bugs.webkit.org/show_bug.cgi?id=187411
2529         <rdar://problem/41920593>
2530
2531         Reviewed by Sam Weinig.
2532
2533         Update JSXMLHttpRequest::response() to use the XMLHttpRequest's global object exec when constructing a JSONObject
2534         for the response instead of the caller's exec.
2535
2536         Test: http/tests/xmlhttprequest/xhr-response-constructor-subframe.html
2537
2538         * bindings/js/JSXMLHttpRequestCustom.cpp:
2539         (WebCore::JSXMLHttpRequest::response const):
2540
2541 2018-07-24  Simon Fraser  <simon.fraser@apple.com>
2542
2543         Animation stops with object-fit:contain on an animated 2d canvas
2544         https://bugs.webkit.org/show_bug.cgi?id=187840
2545
2546         Reviewed by Zalan Bujtas.
2547         
2548         If a canvas has object-fit: cover or contain, repaints need to mapped through
2549         the rect that is used to position the canvas in the element bounds, which is replacedContentRect().
2550         
2551         Add a version of replacedContentRect() that doesn't require passing the intrinsicSize() since
2552         all but RenderVideo just pass the RenderReplaced's intrinsicSize.
2553
2554         Test: fast/repaint/canvas-object-fit.html
2555
2556         * html/HTMLCanvasElement.cpp:
2557         (WebCore::HTMLCanvasElement::didDraw):
2558         * rendering/RenderHTMLCanvas.cpp:
2559         (WebCore::RenderHTMLCanvas::paintReplaced):
2560         * rendering/RenderImage.cpp:
2561         (WebCore::RenderImage::updateInnerContentRect):
2562         (WebCore::RenderImage::paintReplaced):
2563         * rendering/RenderLayerBacking.cpp:
2564         (WebCore::RenderLayerBacking::contentsBox const):
2565         * rendering/RenderReplaced.h:
2566         (WebCore::RenderReplaced::replacedContentRect const):
2567         * rendering/shapes/ShapeOutsideInfo.cpp:
2568         (WebCore::ShapeOutsideInfo::createShapeForImage const):
2569
2570 2018-07-24  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2571
2572         [Curl] Add support for wss:// websockets
2573         https://bugs.webkit.org/show_bug.cgi?id=172630
2574
2575         Reviewed by Fujii Hironori.
2576
2577         To support secure WebSocket connection, it is almost rewritten by using existing
2578         backend for CurlHandle to handle TLS connection and proxy support.
2579
2580         Test: http/tests/websocket/tests/hybi/simple-wss.html
2581
2582         * platform/network/curl/CurlContext.cpp:
2583         (WebCore::CurlSocketHandle::CurlSocketHandle):
2584         (WebCore::CurlSocketHandle::connect):
2585         (WebCore::CurlSocketHandle::send):
2586         (WebCore::CurlSocketHandle::receive):
2587         (WebCore::CurlSocketHandle::wait):
2588         * platform/network/curl/CurlContext.h:
2589         * platform/network/curl/SocketStreamHandleImpl.h:
2590         (WebCore::SocketStreamHandleImpl::SocketData::SocketData): Deleted.
2591         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
2592         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
2593         (WebCore::SocketStreamHandleImpl::~SocketStreamHandleImpl):
2594         (WebCore::SocketStreamHandleImpl::platformSendInternal):
2595         (WebCore::SocketStreamHandleImpl::platformClose):
2596         (WebCore::SocketStreamHandleImpl::threadEntryPoint):
2597         (WebCore::SocketStreamHandleImpl::handleError):
2598         (WebCore::SocketStreamHandleImpl::stopThread):
2599         (WebCore::createCopy): Deleted.
2600         (WebCore::SocketStreamHandleImpl::readData): Deleted.
2601         (WebCore::SocketStreamHandleImpl::sendData): Deleted.
2602         (WebCore::SocketStreamHandleImpl::waitForAvailableData): Deleted.
2603         (WebCore::SocketStreamHandleImpl::startThread): Deleted.
2604         (WebCore::SocketStreamHandleImpl::didReceiveData): Deleted.
2605         (WebCore::SocketStreamHandleImpl::didOpenSocket): Deleted.
2606
2607 2018-07-24  Tim Horton  <timothy_horton@apple.com>
2608
2609         Enable Web Content Filtering on watchOS
2610         https://bugs.webkit.org/show_bug.cgi?id=187979
2611         <rdar://problem/42559346>
2612
2613         Reviewed by Wenson Hsieh.
2614
2615         * Configurations/FeatureDefines.xcconfig:
2616
2617 2018-07-24  Chris Dumez  <cdumez@apple.com>
2618
2619         Unreviewed, rolling out r233496 and r233571.
2620
2621         Likely cause of <rdar://problem/42160890> and
2622         <rdar://problem/42329658> as ActiveDOMObjects can now be
2623         constructed / destroyed while we are iterating over them.
2624
2625         Reverted changesets:
2626
2627         "Nullptr crash accessing Document in
2628         GenericEventQueue::dispatchOneEvent()"
2629         https://bugs.webkit.org/show_bug.cgi?id=187284
2630         https://trac.webkit.org/changeset/233496
2631
2632         "REGRESSION(r233496): macOS Sierra hits debug assertions in
2633         TrackListBase::suspend"
2634         https://bugs.webkit.org/show_bug.cgi?id=187378
2635         https://trac.webkit.org/changeset/233571
2636
2637 2018-07-24  Aditya Keerthi  <akeerthi@apple.com>
2638
2639         [Datalist][macOS] Display suggestions for input[type=color]
2640         https://bugs.webkit.org/show_bug.cgi?id=187794
2641
2642         Reviewed by Tim Horton.
2643
2644         * html/ColorInputType.cpp:
2645         (WebCore::ColorInputType::shouldRespectListAttribute):
2646
2647 2018-07-24  Ryan Haddad  <ryanhaddad@apple.com>
2648
2649         Unreviewed, rolling out r234121.
2650
2651         Caused perf test failures.
2652
2653         Reverted changeset:
2654
2655         "We should cache the compiled sandbox profile in a data vault"
2656         https://bugs.webkit.org/show_bug.cgi?id=184991
2657         https://trac.webkit.org/changeset/234121
2658
2659 2018-07-24  Antoine Quint  <graouts@apple.com>
2660
2661         [Web Animations] Add an ASSERT() to check the contract that a CSSTransition has a valid effect in setTimingProperties()
2662         https://bugs.webkit.org/show_bug.cgi?id=187954
2663
2664         Reviewed by Dean Jackson.
2665
2666         * animation/CSSTransition.cpp:
2667         (WebCore::CSSTransition::setTimingProperties):
2668
2669 2018-07-24  Antoine Quint  <graouts@apple.com>
2670
2671         [Web Animations] Crash when setting an animation style on an existing animation that had its effect set to null
2672         https://bugs.webkit.org/show_bug.cgi?id=187953
2673
2674         Reviewed by Dean Jackson.
2675
2676         Test: webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect.html
2677
2678         Ensure that we have a valid effect before proceeding to update its timing. 
2679
2680         * animation/CSSAnimation.cpp:
2681         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
2682
2683 2018-07-24  Eric Carlson  <eric.carlson@apple.com>
2684
2685         [MediaStream] Restructure getDisplayMedia classes
2686         https://bugs.webkit.org/show_bug.cgi?id=187905
2687         <rdar://problem/42500215>
2688
2689         Unreviewed build fix.
2690
2691         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp: 
2692
2693 2018-07-24  Antoine Quint  <graouts@apple.com>
2694
2695         [Web Animations] Crash when setting "animation: none" after clearing an animation's effect
2696         https://bugs.webkit.org/show_bug.cgi?id=187952
2697
2698         Reviewed by Dean Jackson.
2699
2700         Test: webanimations/setting-css-animation-none-after-clearing-effect.html
2701
2702         We need to ensure that the animation we're trying to remove has not had its effect cleared via the
2703         Web Animations API since its creation before trying to check its phase.
2704
2705         * animation/AnimationTimeline.cpp:
2706         (WebCore::AnimationTimeline::cancelOrRemoveDeclarativeAnimation):
2707
2708 2018-07-24  Antoine Quint  <graouts@apple.com>
2709
2710         [Web Animations] Crash accessing CSSAnimation::bindingsCurrentTime when effect has been set to null
2711         https://bugs.webkit.org/show_bug.cgi?id=187950
2712         <rdar://problem/42515747>
2713
2714         Reviewed by Dean Jackson.
2715
2716         Test: webanimations/accessing-current-time-after-clearing-css-animation-effect.html
2717
2718         While a CSSAnimation has an effect created for it by the implementation, the developer may yet manipulate
2719         its effect via the Web Animations API and set it to null. As such, we must not assume it's always non-null.
2720
2721         * animation/CSSAnimation.cpp:
2722         (WebCore::CSSAnimation::bindingsCurrentTime const):
2723
2724 2018-07-24  Zalan Bujtas  <zalan@apple.com>
2725
2726         [LFC][IFC] BlockContainer::establishesInlineFormattingContext should only check the first inflow child.
2727         https://bugs.webkit.org/show_bug.cgi?id=187965
2728
2729         Reviewed by Antti Koivisto.
2730
2731         * layout/layouttree/LayoutBlockContainer.cpp:
2732         (WebCore::Layout::BlockContainer::establishesInlineFormattingContext const):
2733
2734 2018-07-24  Myles C. Maxfield  <mmaxfield@apple.com>
2735
2736         [Cocoa] Stop crashing in lastResortFallbackFont()
2737         https://bugs.webkit.org/show_bug.cgi?id=187936
2738
2739         Reviewed by Jon Lee.
2740
2741         CoreText can get into a state where both Times and Lucida Grande are inaccessible.
2742         Instead of crashing, we should use the real LastResort, which is backed by a section
2743         in the .rodata of the CoreText dylib, and as such should always exist.
2744
2745         * platform/graphics/FontCache.cpp:
2746         (WebCore::FontCache::fontForFamily):
2747         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2748         (WebCore::FontCache::lastResortFallbackFont):
2749
2750 2018-07-24  Daniel Bates  <dabates@apple.com>
2751
2752         Cannot view PDF's on my.gov.au: "Refused to load https://my.gov.au/attachment/viewAttachment because it
2753         appears in neither the object-src directive nor the default-src directive of the Content Security Policy"
2754         https://bugs.webkit.org/show_bug.cgi?id=187870
2755         <rdar://problem/41190880>
2756
2757         Reviewed by Dean Jackson.
2758
2759         Fixes an issue where opening attachments on my.gov.au would show a "Blocked Plug-in" message.
2760
2761         Opening an attachment on my.gov.au opens a same-origin plugin document in a child window. Currently
2762         same-origin plugin documents inherit their CSP policy from their opener. If the opener's CSP policy
2763         disallows embedding plugins then the plugin document would be blocked from loading a plugin. For now
2764         we relax the inheritance model such that we only inherit the plugin-types and report-uri directives
2765         from the opener.
2766
2767         Developers that want to block plugin content from being loaded in a same-origin child window must now
2768         serve such plugin content with a CSP policy that includes "object-src 'none'". This matches the behavior
2769         described in the second Note in section object-src of the CSP 3 spec: <https://w3c.github.io/webappsec-csp/#directive-object-src>
2770         (Editor's Draft, 10 July 2018). It also makes the behavior in WebKit more closely aligned with the
2771         behavior of Chrome and Firefox.
2772
2773         Tests: http/tests/security/contentSecurityPolicy/same-origin-plugin-document-allowed-in-child-window.html
2774                http/tests/security/contentSecurityPolicy/same-origin-plugin-document-blocked-in-child-window-report.php
2775                http/tests/security/contentSecurityPolicy/same-origin-plugin-document-with-csp-blocked-in-child-window.html
2776
2777         * dom/Document.cpp:
2778         (WebCore::Document::initContentSecurityPolicy): For plugin documents that have an opener call ContentSecurityPolicy::createPolicyForPluginDocumentFrom()
2779         to only inherit the plugin-types and report-uri directives from its opener's CSP policy. Otherwise, call ContentSecurityPolicy::copyStateFrom()
2780         to inherit all directives from the owner frame as we do now.
2781         * page/csp/ContentSecurityPolicy.cpp:
2782         (WebCore::ContentSecurityPolicy::createPolicyForPluginDocumentFrom): Create a new policy from the specified policy
2783         inheriting only the plugin-types and report-uri directives.
2784         * page/csp/ContentSecurityPolicy.h: Define a new PolicyFrom enumerator, InheritedForPluginDocument, for plugin documents
2785         loaded in a child window.
2786         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
2787         (WebCore::ContentSecurityPolicyDirectiveList::parse): When policyFrom is InheritedForPluginDocument then only
2788         recognize the plugin-types and report-uri directives when parsing the policy.
2789
2790 2018-07-24  Daniel Bates  <dabates@apple.com>
2791
2792         Rename Document::firstPartyForSameSiteCookies() to siteForCookies()
2793         https://bugs.webkit.org/show_bug.cgi?id=187892
2794
2795         Reviewed by Dean Jackson.
2796
2797         Standardize on the spec. language "site for cookies" for the names of the setter and getter
2798         on Document. The latest description of Same-Site cookies is in <https://httpwg.org/http-extensions/rfc6265bis.html>.
2799
2800         No functionality changed. So, no new tests.
2801
2802         * dom/Document.h:
2803         (WebCore::Document::siteForCookies const):
2804         (WebCore::Document::setSiteForCookies):
2805         (WebCore::Document::firstPartyForSameSiteCookies const): Deleted.
2806         (WebCore::Document::setFirstPartyForSameSiteCookies): Deleted.
2807         * loader/FrameLoader.cpp:
2808         (WebCore::FrameLoader::setFirstPartyForCookies):
2809         (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded):
2810         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2811         (WebCore::createPageForServiceWorker):
2812         * xml/XSLTProcessor.cpp:
2813         (WebCore::XSLTProcessor::createDocumentFromSource):
2814
2815 2018-07-24  Ross Kirsling  <ross.kirsling@sony.com>
2816
2817         WebCore::URL::hostIsIPAddress needs a Windows implementation
2818         https://bugs.webkit.org/show_bug.cgi?id=187859
2819
2820         Reviewed by Fujii Hironori.
2821
2822         * platform/URL.cpp:
2823         (WebCore::isIPv4Address): Added.
2824         (WebCore::isIPv6Address): Added.
2825         (WebCore::URL::hostIsIPAddress):
2826         Turn this stub into a platform-agnostic default implementation.
2827
2828 2018-07-24  Eric Carlson  <eric.carlson@apple.com>
2829
2830         [MediaStream] Restructure getDisplayMedia classes
2831         https://bugs.webkit.org/show_bug.cgi?id=187905
2832
2833         Reviewed by Dean Jackson.
2834
2835         No new tests, no functional changes.
2836
2837         * platform/mediastream/CaptureDeviceManager.h:
2838         (WebCore::CaptureDeviceManager::refreshCaptureDevices): Deleted, no need for it to be a 
2839         virtual method.
2840         * platform/mediastream/mac/AVCaptureDeviceManager.h:
2841
2842         * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h: refreshCaptureDevices is
2843         no longer virtual.
2844
2845         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
2846         (WebCore::DisplayCaptureManagerCocoa::captureDevices):
2847         (WebCore::DisplayCaptureManagerCocoa::updateDisplayCaptureDevices): Moved functionality 
2848         to ScreenDisplayCaptureSourceMac.
2849         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): Ditto.
2850         (WebCore::displayReconfigurationCallBack): Deleted, moved to ScreenDisplayCaptureSourceMac.
2851         (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa): Deleted.
2852         (WebCore::DisplayCaptureManagerCocoa::refreshCaptureDevices): Deleted.
2853         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
2854
2855         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
2856         (WebCore::roundUpToMacroblockMultiple): Moved from ScreenDisplayCaptureSourceMac.
2857         (WebCore::DisplayCaptureSourceCocoa::applySize): Ditto.
2858         (WebCore::DisplayCaptureSourceCocoa::sampleBufferFromPixelBuffer): Ditto.
2859         (WebCore::DisplayCaptureSourceCocoa::pixelBufferFromIOSurface): Ditto.
2860         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
2861
2862         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
2863         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
2864         (WebCore::updateDisplayID):
2865         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Fix log message.
2866         (WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream): Ditto.
2867         (WebCore::ScreenDisplayCaptureSourceMac::applySize): Update for base class changes.
2868         (WebCore::ScreenDisplayCaptureSourceMac::applyFrameRate): Ditto.
2869         (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable): Ditto.
2870         (WebCore::ScreenDisplayCaptureSourceMac::screenCaptureDeviceWithPersistentID): Moved from
2871         DisplayCaptureManagerCocoa.
2872         (WebCore::ScreenDisplayCaptureSourceMac::screenCaptureDevices): Ditto.
2873         (WebCore::roundUpToMacroblockMultiple): Moved to DisplayCaptureSourceCocoa.
2874         (WebCore::ScreenDisplayCaptureSourceMac::updateDisplayID): Ditto.
2875         (WebCore::ScreenDisplayCaptureSourceMac::sampleBufferFromPixelBuffer): Ditto.
2876         (WebCore::ScreenDisplayCaptureSourceMac::pixelBufferFromIOSurface): Ditto.
2877
2878 2018-07-24  Zalan Bujtas  <zalan@apple.com>
2879
2880         [LFC] Move geometry data structures to a dedicated file
2881         https://bugs.webkit.org/show_bug.cgi?id=187939
2882
2883         Reviewed by Antti Koivisto.
2884
2885         * WebCore.xcodeproj/project.pbxproj:
2886         * layout/FormattingContext.h:
2887         (WebCore::Layout::FormattingContext::Geometry::Position::operator LayoutPoint const): Deleted.
2888         * layout/FormattingContextGeometry.cpp:
2889         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
2890         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
2891         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
2892         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
2893         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
2894         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2895         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
2896         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
2897         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
2898         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
2899         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
2900         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
2901         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
2902         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
2903         (WebCore::Layout::FormattingContext::Geometry::computedBorder):
2904         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
2905         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
2906         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
2907         * layout/blockformatting/BlockFormattingContext.h:
2908         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2909         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2910         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
2911         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
2912         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
2913         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
2914         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
2915         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
2916         * layout/displaytree/DisplayBox.h:
2917         (WebCore::Display::Box::setHorizontalMargin):
2918         (WebCore::Display::Box::setVerticalMargin):
2919         (WebCore::Display::Box::setVerticalNonCollapsedMargin):
2920         (WebCore::Display::Box::setBorder):
2921         (WebCore::Display::Box::setPadding):
2922
2923 2018-07-24  Thibault Saunier  <tsaunier@igalia.com>
2924
2925         [GStreamer] Implement bitrate modulation support in GStreamer based libwebrtc Encoders
2926         https://bugs.webkit.org/show_bug.cgi?id=187643
2927
2928         Reviewed by Philippe Normand.
2929
2930         Problem being that we do not have a proper unified encoder API in GStreamer, some work
2931         started at https://bugzilla.gnome.org/show_bug.cgi?id=796716 but it is quite controversial
2932         and meanwhile we should just move forward working around that limitation.
2933
2934         Source/WebCore:
2935         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
2936         (WebCore::GStreamerVideoEncoder::GStreamerVideoEncoder):
2937         (WebCore::GStreamerVideoEncoder::InitEncode):
2938         (WebCore::GStreamerVideoEncoder::getBitrateSetter):
2939         (WebCore::GStreamerVideoEncoder::createEncoder):
2940         (WebCore::GStreamerVideoEncoder::AddCodecIfSupported):
2941         (WebCore::GStreamerVideoEncoder::SetRestrictionCaps):
2942         (WebCore::GStreamerVideoEncoder::CreateEncoder): Deleted.
2943
2944 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
2945
2946         REGRESSION(r234055): inverted return values in MediaPlayer::wouldTaintOrigin()
2947         https://bugs.webkit.org/show_bug.cgi?id=187944
2948
2949         Reviewed by Carlos Garcia Campos.
2950
2951         The MediaPlayer::wouldTaintOrigin(), as introduced in r234055, should
2952         return false when the URL protocol is `data:`, and should return true
2953         when the given SecurityOrigin cannot access the media URL.
2954
2955         This matches behavior of CanvasRenderingContext::wouldTaintOrigin()
2956         which the new method falls back to when the MediaPlayerPrivate
2957         implementation doesn't or can't determine the would-taint result.
2958
2959         This fixes a bunch of failing and timing-out WebGL test cases on ports
2960         using GStreamer (on which the MediaPlayerPrivate derivate doesn't
2961         implement the wouldTaintOrigin() method).
2962
2963         * platform/graphics/MediaPlayer.cpp:
2964         (WebCore::MediaPlayer::wouldTaintOrigin const):
2965
2966 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
2967
2968         [TextureMapper] Separate repaint counter state from debug visuals
2969         https://bugs.webkit.org/show_bug.cgi?id=187946
2970
2971         Reviewed by Carlos Garcia Campos.
2972
2973         Instead of managing the repaint counter visibility along with the
2974         debug border visuals, do that together with the repaint count value.
2975
2976         TextureMapperLayer::setRepaintCount() is renamed to setRepaintCounter()
2977         and now also sets the repaint counter visibility state instead of the
2978         setDebugVisuals() method.
2979
2980         GraphicsLayerTextureMapper implementation is adjusted appropriately.
2981         The unused setRepaintCount() method is also removed.
2982
2983         CoordinatedGraphicsLayerState now holds repaint counter state (both
2984         visibility and count value) in a struct that's separate from debug
2985         border state. CoordinatedGraphicsLayer implementation now updates
2986         that state accordingly.
2987
2988         No new tests -- no change in behavior.
2989
2990         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
2991         (WebCore::GraphicsLayerTextureMapper::setShowRepaintCounter):
2992         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
2993         (WebCore::GraphicsLayerTextureMapper::setRepaintCount): Deleted.
2994         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
2995         * platform/graphics/texmap/TextureMapperLayer.cpp:
2996         (WebCore::TextureMapperLayer::setDebugVisuals):
2997         (WebCore::TextureMapperLayer::setRepaintCounter):
2998         (WebCore::TextureMapperLayer::setRepaintCount): Deleted.
2999         * platform/graphics/texmap/TextureMapperLayer.h:
3000         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3001         (WebCore::CoordinatedGraphicsLayer::didUpdateTileBuffers):
3002         (WebCore::CoordinatedGraphicsLayer::setShowRepaintCounter):
3003         (WebCore::CoordinatedGraphicsLayer::syncLayerState):
3004         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
3005         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
3006         (WebCore::DebugVisuals::DebugVisuals): Deleted.
3007
3008 2018-07-24  Thibault Saunier  <tsaunier@igalia.com>
3009
3010         [WPE][GTK] Implement PeerConnection API on top of libwebrtc
3011         https://bugs.webkit.org/show_bug.cgi?id=186932
3012
3013         Reviewed by Philippe Normand.
3014
3015         Enabled many webrtc tests.
3016
3017         * platform/GStreamer.cmake: Build new files
3018         * platform/graphics/gstreamer/GStreamerCommon.cpp: Fix minor style issues
3019         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: Add a way to give precise name to pipelines
3020         and give useful names to pipelines with sources comming from a PeerConnection
3021         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Ditto.
3022         * platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.cpp: Added. Implement a subclass of webrtc::VideoFrame
3023         to represent a kNative GStreamer video frame.
3024         * platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.h: Added. Ditto.
3025         * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp: Handle incoming audio samples from libwebrtc.
3026         * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.h: Ditto.
3027         * platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp: Handle incoming video frames from libwebrtc.
3028         * platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h: Ditto.
3029         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp: Handle passing locally captured audio sample to libwebrtc.
3030         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h: Ditto.
3031         * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.cpp: Handle passing locally captured vidoe frames to libwebrtc.
3032         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp: Added. Implement a video decoder factory and LibWebRTC Video decoders based on GStreamer.
3033         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.h: Added. Ditto.
3034         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp: Added. Implement a video encoder factory and LibWebRTC H264/VP8 Video encoders based on GStreamer.
3035         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.h: Added. Ditto.
3036         * platform/mediastream/libwebrtc/LibWebRTCAudioFormat.h: Add information about signness of the LibWebRTC audio format.
3037         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp: Add support for newly added Encoder/Decoder factories.
3038         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.h: Ditto.
3039
3040 2018-07-24  Dirk Schulze  <krit@webkit.org>
3041
3042         [css-masking] Black backdrop on -webkit-clip-path on SVG root
3043         https://bugs.webkit.org/show_bug.cgi?id=187880
3044
3045         Reviewed by Simon Fraser.
3046
3047         For SVG document root elements, we currently clip twice:
3048         In RenderLayer and SVGRenderSupport.
3049         Avoid clipping in RenderLayer which currently clips before we established a
3050         backdrop for an SVG document.
3051
3052         Tests: svg/clip-path/clip-path-on-svg-005-expected.svg
3053                svg/clip-path/clip-path-on-svg-005.svg
3054
3055         * rendering/RenderLayer.cpp:
3056         (WebCore::RenderLayer::setupClipPath): Skip actual clipping.
3057
3058 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
3059
3060         [Nicosia] Add TextureMapperAnimations member to CompositingLayer::LayerState
3061         https://bugs.webkit.org/show_bug.cgi?id=187941
3062
3063         Reviewed by Carlos Garcia Campos.
3064
3065         Nicosia::CompositingLayer::LayerState gains a TextureMapperAnimations
3066         member that will be assigned a list of all active animations during each
3067         layer flush. Despite the name, TextureMapperAnimations doesn't depend on
3068         any other TextureMapper class. It might be renamed and moved in the
3069         future, but for now it's used as-is.
3070
3071         In CoordinatedGraphicsLayer, the syncAnimations() method now flips on
3072         the animationsChanged flag in the LayerState::Delta struct. This causes
3073         all the active animations to be copied over into the layer state in
3074         flushCompositingStateForThisLayerOnly().
3075
3076         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
3077         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3078         (WebCore::CoordinatedGraphicsLayer::syncAnimations):
3079         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
3080
3081 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
3082
3083         [Nicosia] Add FilterOperations member to CompositionLayer::LayerState
3084         https://bugs.webkit.org/show_bug.cgi?id=187901
3085
3086         Reviewed by Carlos Garcia Campos.
3087
3088         Nicosia::CompositionLayer::LayerState gains a FilterOperations member
3089         that can be assigned the list of filter operations for a given layer.
3090         The corresponding filtersChanged boolean is added to LayerState::Delta.
3091
3092         CoordinatedGraphicsLayer::syncFilters() flips on that delta member,
3093         which in turn causes the FilterOperations value to be updated during
3094         the layer flush, in flushCompositingStateForThisLayerOnly().
3095
3096         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
3097         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3098         (WebCore::CoordinatedGraphicsLayer::syncFilters):
3099         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
3100
3101 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
3102
3103         [CoordGraphics] Use adjusted position, anchor point, size values for Nicosia::CompositionLayer state
3104         https://bugs.webkit.org/show_bug.cgi?id=187899
3105
3106         Reviewed by Carlos Garcia Campos.
3107
3108         As is done for the CoordinatedGraphicsLayerState, the scale-adjusted
3109         position, anchor point and size values should be used when updating the
3110         corresponding Nicosia::CompositionLayer::LayerState members.
3111
3112         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3113         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
3114
3115 2018-07-23  Manuel Rego Casasnovas  <rego@igalia.com>
3116
3117         [css-grid] Add support for calc() in gutter properties
3118         https://bugs.webkit.org/show_bug.cgi?id=187902
3119
3120         Reviewed by Simon Fraser.
3121
3122         The parsing was already accepting calc() in grid row and column gaps,
3123         however the code was not taking that into account properly.
3124         If the calc() had a percentage it was ignored and that's wrong.
3125
3126         The fix is just a change in the ceck at RenderGrid::availableSpaceForGutters().
3127
3128         Tests: imported/w3c/web-platform-tests/css/css-grid/abspos/grid-positioned-items-gaps-002-rtl.html
3129                imported/w3c/web-platform-tests/css/css-grid/abspos/grid-positioned-items-gaps-002.html
3130                imported/w3c/web-platform-tests/css/css-grid/alignment/grid-gutters-011.html
3131                imported/w3c/web-platform-tests/css/css-grid/alignment/grid-gutters-012.html
3132
3133         * rendering/RenderGrid.cpp:
3134         (WebCore::RenderGrid::availableSpaceForGutters const):
3135
3136 2018-07-23  Aditya Keerthi  <akeerthi@apple.com>
3137
3138         Remove extraneous #endif in html.css
3139         https://bugs.webkit.org/show_bug.cgi?id=187934
3140
3141         Reviewed by Tim Horton.
3142
3143         * css/html.css: Remove extraneous #endif.
3144
3145 2018-07-23  Sihui Liu  <sihui_liu@apple.com>
3146
3147         CrashTracer: com.apple.WebKit.Storage at WebCore: WebCore::encodeKey
3148         https://bugs.webkit.org/show_bug.cgi?id=187927
3149
3150         Reviewed by Chris Dumez.
3151
3152         IDBKeyData is valid only when each key of it is valid.
3153
3154         Test: LayoutTests/storage/indexeddb/index-multientry.html
3155
3156         * Modules/indexeddb/IDBKeyData.cpp:
3157         (WebCore::IDBKeyData::isValid const):
3158         * Modules/indexeddb/IDBKeyData.h:
3159         (WebCore::IDBKeyData::isValid const): Deleted.
3160
3161 2018-07-23  Ben Richards  <benton_richards@apple.com>
3162
3163         We should cache the compiled sandbox profile in a data vault
3164         https://bugs.webkit.org/show_bug.cgi?id=184991
3165
3166         Reviewed by Ryosuke Niwa.
3167
3168         Added functionality to FileHandle so that it can lock a file while open.
3169         Added a function to FileSystem to delete non empty directories.
3170
3171         * platform/FileHandle.cpp:
3172         (WebCore::FileHandle::FileHandle):
3173         (WebCore::FileHandle::open):
3174         (WebCore::FileHandle::close):
3175         * platform/FileHandle.h:
3176         * platform/FileSystem.h:
3177         * platform/cocoa/FileSystemCocoa.mm:
3178         (WebCore::FileSystem::deleteNonEmptyDirectory):
3179
3180 2018-07-23  Justin Fan  <justin_fan@apple.com>
3181
3182         [macOS] Ensure that WebGL contexts are always set to an accelerated virtual screen
3183         https://bugs.webkit.org/show_bug.cgi?id=187923
3184
3185         Reviewed by Dean Jackson.
3186
3187         On eGPU displays, it is possible that CGL does not match the preferred renderer. 
3188         In this case, and when the web process is blocked from accessing the window server, 
3189         3D contexts *may* default to the software renderer. Ensure that even if this occurs,
3190         we set the context to use a hardware-accelerated renderer/virtual screen.
3191
3192         No new tests. Existing behavior covered by existing tests.
3193         Requires multiple screens, at least one attached to an eGPU, to stress. 
3194
3195         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
3196         (WebCore::identifyAndSetCurrentGPU):
3197
3198 2018-07-23  Sam Weinig  <sam@webkit.org>
3199
3200         Convert some obvious never-null pointers to references in the editing code
3201         https://bugs.webkit.org/show_bug.cgi?id=187914
3202
3203         Reviewed by Dean Jackson.
3204
3205         Fixup trivial cases of never-null pointers that really should be references.
3206
3207         * editing/ApplyStyleCommand.cpp:
3208         (WebCore::ApplyStyleCommand::shouldApplyInlineStyleToRun):
3209         (WebCore::ApplyStyleCommand::removeInlineStyleFromElement):
3210         (WebCore::ApplyStyleCommand::removeImplicitlyStyledElement):
3211         (WebCore::ApplyStyleCommand::removeCSSStyle):
3212         (WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
3213         (WebCore::ApplyStyleCommand::applyInlineStyleChange):
3214         * editing/EditingStyle.cpp:
3215         (WebCore::EditingStyle::overrideWithStyle):
3216         (WebCore::EditingStyle::conflictsWithInlineStyleOfElement const):
3217         (WebCore::EditingStyle::conflictsWithImplicitStyleOfElement const):
3218         (WebCore::EditingStyle::conflictsWithImplicitStyleOfAttributes const):
3219         (WebCore::EditingStyle::extractConflictingImplicitStyleOfAttributes const):
3220         (WebCore::EditingStyle::styleIsPresentInComputedStyleOfNode const):
3221         (WebCore::EditingStyle::elementIsStyledSpanOrHTMLEquivalent):
3222         (WebCore::EditingStyle::mergeInlineStyleOfElement):
3223         (WebCore::EditingStyle::wrappingStyleForSerialization):
3224         (WebCore::EditingStyle::legacyFontSize const):
3225         (WebCore::StyleChange::StyleChange):
3226         (WebCore::StyleChange::extractTextStyles):
3227         (WebCore::legacyFontSizeFromCSSValue):
3228         * editing/EditingStyle.h:
3229         (WebCore::EditingStyle::conflictsWithInlineStyleOfElement const):
3230         * editing/Editor.cpp:
3231         (WebCore::Editor::selectionStartCSSPropertyValue):
3232         * editing/ReplaceSelectionCommand.cpp:
3233         (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
3234         (WebCore::isInlineNodeWithStyle):
3235         * editing/markup.cpp:
3236         (WebCore::StyledMarkupAccumulator::appendElement):
3237         (WebCore::StyledMarkupAccumulator::serializeNodes):
3238
3239 2018-07-23  Per Arne Vollan  <pvollan@apple.com>
3240
3241         WebCore::primaryScreenDisplayID() always return 0
3242         https://bugs.webkit.org/show_bug.cgi?id=187922
3243         <rdar://problem/42286933>
3244
3245         Reviewed by Geoffrey Garen.
3246
3247         This function should return a valid display ID.
3248
3249         No new tests. Testing this requires a dual monitor setup.
3250
3251         * platform/mac/PlatformScreenMac.mm:
3252         (WebCore::primaryScreenDisplayID):
3253
3254 2018-07-23  Nan Wang  <n_wang@apple.com>
3255
3256         AX: Press tab to highlight items on a webpage is not working with voiceover enabled
3257         https://bugs.webkit.org/show_bug.cgi?id=187824
3258
3259         Reviewed by Zalan Bujtas.
3260
3261         We are deferring posting focused element change notification when the document needs a
3262         style recalculation. However, we only perform the cache update after a layout is completed.
3263         Added a timer to perform the cache update in the next runloop when non-layout type of mutation
3264         happens.
3265         
3266         Test: accessibility/mac/tab-focus-post-notification.html
3267
3268         * accessibility/AXObjectCache.cpp:
3269         (WebCore::AXObjectCache::AXObjectCache):
3270         (WebCore::AXObjectCache::~AXObjectCache):
3271         (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded):
3272         (WebCore::AXObjectCache::performCacheUpdateTimerFired):
3273         * accessibility/AXObjectCache.h:
3274         (WebCore::AXObjectCache::AXObjectCache):
3275         (WebCore::AXObjectCache::performCacheUpdateTimerFired):
3276
3277 2018-07-23  Chris Dumez  <cdumez@apple.com>
3278
3279         WebResourceLoadStatisticsStore fails to unregister itself as a MessageReceiver in its destructor
3280         https://bugs.webkit.org/show_bug.cgi?id=187910
3281         <rdar://problem/42356526>
3282
3283         Reviewed by Brent Fulgham.
3284
3285         Add internals API that causes the ResourceLoadObserver to notify its observer, and avoid waiting
3286         for the 5 second delay.
3287
3288         * testing/Internals.cpp:
3289         (WebCore::Internals::notifyResourceLoadObserver):
3290         * testing/Internals.h:
3291         * testing/Internals.idl:
3292
3293 2018-07-23  Zalan Bujtas  <zalan@apple.com>
3294
3295         [LCF][IFC] Add support for hyphenation.
3296         https://bugs.webkit.org/show_bug.cgi?id=187913
3297
3298         Reviewed by Antti Koivisto.
3299
3300         Move the hyphenation logic over from SimpleLineLayout::TextFragmentIterator.
3301
3302         * layout/inlineformatting/textlayout/Runs.h:
3303         (WebCore::Layout::TextRun::hasHyphen const):
3304         (WebCore::Layout::LayoutRun::setHasHyphen):
3305         (WebCore::Layout::LayoutRun::hasHyphen const):
3306         (WebCore::Layout::LayoutRun::LayoutRun):
3307         (WebCore::Layout::TextRun::createNonWhitespaceRunWithHyphen):
3308         (WebCore::Layout::TextRun::TextRun):
3309         * layout/inlineformatting/textlayout/TextContentProvider.cpp:
3310         (WebCore::Layout::TextContentProvider::findTextItemSlow const):
3311         (WebCore::Layout::TextContentProvider::width const):
3312         (WebCore::Layout::TextContentProvider::hyphenPositionBefore const):
3313         * layout/inlineformatting/textlayout/TextContentProvider.h:
3314         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.cpp:
3315         (WebCore::Layout::SimpleLineBreaker::Line::setTextAlign):
3316         (WebCore::Layout::SimpleLineBreaker::Line::justifyRuns):
3317         (WebCore::Layout::SimpleLineBreaker::Line::adjustRunsForTextAlign):
3318         (WebCore::Layout::SimpleLineBreaker::Line::collectExpansionOpportunities):
3319         (WebCore::Layout::SimpleLineBreaker::Line::closeLastRun):
3320         (WebCore::Layout::SimpleLineBreaker::Line::append):
3321         (WebCore::Layout::SimpleLineBreaker::Line::reset):
3322         (WebCore::Layout::SimpleLineBreaker::Style::Style):
3323         (WebCore::Layout::SimpleLineBreaker::handleLineEnd):
3324         (WebCore::Layout::SimpleLineBreaker::createRunsForLine):
3325         (WebCore::Layout::SimpleLineBreaker::hyphenPositionBefore const):
3326         (WebCore::Layout::SimpleLineBreaker::adjustSplitPositionWithHyphenation const):
3327         (WebCore::Layout::SimpleLineBreaker::split const):
3328         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.h:
3329
3330 2018-07-23  Antoine Quint  <graouts@apple.com>
3331
3332         [Web Animations] Querying the current time of a finished CSSAnimation after removing its target leads to a crash
3333         https://bugs.webkit.org/show_bug.cgi?id=187906
3334
3335         Reviewed by Dean Jackson.
3336
3337         Test: webanimations/accessing-current-time-after-finished-css-animation-target-removal.html
3338
3339         Because we carelessly look at a CSSAnimation's effect's timing in DeclarativeAnimation::bindingsCurrentTime
3340         without checking that the effect is non-null, we can crash in the case where the animation is finished and
3341         its target element has been removed, which caused the effect to be set to null.
3342
3343         We do not actually fix the lack of a null check, which will be the scope of a different patch, but instead
3344         ensure that we do _not_ set the animation's effect to null when its target is removed, which used to be
3345         performed via a call to WebAnimation::remove(). Instead, we introduce AnimationTimeline::elementWasRemoved()
3346         which notifies the timeline of an element being removed such that we may stop referencing any animation
3347         targeting this element from the various data structures holding strong references to the animation in question,
3348         and we then cancel the animation silently, which is a new option that ensures promises aren't resolved or
3349         rejected as a result.
3350
3351         Finally, the WebAnimation and AnimationEffectReadOnly classes established a ref-cycle as WebAnimation has
3352         `RefPtr<AnimationEffectReadOnly> m_effect` and AnimationEffectReadOnly has `RefPtr<WebAnimation> m_animation`.
3353         While it is correct that WebAnimation owns its effect, which is established by the DOM API, the
3354         reverse is not correct since we only hold the reverse internally for the benefit of our implementation.
3355         As such, we change AnimationEffectReadOnly's m_animation to be a WeakPtr<WebAnimation>. This means not
3356         calling WebAnimation::remove() and simply removing the animation from the animation maps on the timeline
3357         is sufficient to guarantee that the document timeline will not leak (and with it the document).
3358
3359         * animation/AnimationEffectReadOnly.h:
3360         (WebCore::AnimationEffectReadOnly::setAnimation):
3361         * animation/AnimationTimeline.cpp:
3362         (WebCore::AnimationTimeline::elementWasRemoved):
3363         * animation/AnimationTimeline.h:
3364         * animation/WebAnimation.cpp:
3365         (WebCore::WebAnimation::cancel):
3366         (WebCore::WebAnimation::resetPendingTasks):
3367         * animation/WebAnimation.h:
3368         * dom/Element.cpp:
3369         (WebCore::Element::removedFromAncestor):
3370         * rendering/updating/RenderTreeUpdater.cpp:
3371         (WebCore::RenderTreeUpdater::tearDownRenderers):
3372
3373 2018-07-23  Aditya Keerthi  <akeerthi@apple.com>
3374
3375         [iOS] Add support for input[type=color]
3376         https://bugs.webkit.org/show_bug.cgi?id=187871
3377
3378         Reviewed by Tim Horton.
3379
3380         * css/html.css: Remove unwanted styling for color inputs with a list attribute.
3381         * html/ColorInputType.cpp: Make the element focusable.
3382         (WebCore::ColorInputType::isMouseFocusable const):
3383         (WebCore::ColorInputType::isKeyboardFocusable const):
3384         * html/ColorInputType.h:
3385         * html/HTMLInputElement.h: Expose isColorControl() to WebKit.
3386         * page/Chrome.cpp:
3387         (WebCore::Chrome::createColorChooser):
3388
3389 2018-07-22  Dean Jackson  <dino@apple.com>
3390
3391         fullscreen env() variables should have initial values
3392         https://bugs.webkit.org/show_bug.cgi?id=187897
3393         <rdar://problem/42485682>
3394
3395         Reviewed by Sam Weinig.
3396
3397         The env() values for fullscreen properties need to be
3398         initialized, rather than wait for values to be set from WebKit.
3399         Without this, feature detection doesn't work, and properties
3400         won't parse correctly.
3401
3402         Test: fullscreen/fullscreen-env-initial.html
3403
3404         * dom/ConstantPropertyMap.cpp:
3405         (WebCore::ConstantPropertyMap::buildValues): Initialize the fullscreen values.
3406         (WebCore::ConstantPropertyMap::updateConstantsForFullscreen): Renamed function, because it
3407         also updates the duration value.
3408         (WebCore::ConstantPropertyMap::didChangeFullscreenInsets): Call new name.
3409         (WebCore::ConstantPropertyMap::updateConstantsForFullscreenInsets): Deleted.
3410         * dom/ConstantPropertyMap.h:
3411         * page/Page.cpp:
3412         (WebCore::Page::setFullscreenAutoHideDuration): Don't change the value if it doesn't need it.
3413         * page/Page.h: Add accessor for fullscreenAutoHideDuration. Also add a member variable.
3414         (WebCore::Page::fullscreenAutoHideDuration const):
3415
3416 2018-07-22  Zalan Bujtas  <zalan@apple.com>
3417
3418         [LFC][IFC] Add center/right/justify line alignment support.
3419         https://bugs.webkit.org/show_bug.cgi?id=187890
3420
3421         Reviewed by Antti Koivisto.
3422
3423         Move over some more code from simple line layout.
3424         (though text-align: justify is more preformant as now expansion opportunities are added as we process the text runs
3425         -as opposed to iterting through the runs again when we reach the end of the line.) 
3426
3427         * layout/inlineformatting/textlayout/Runs.h:
3428         (WebCore::Layout::LayoutRun::setLeft):
3429         (WebCore::Layout::LayoutRun::setExpansion):
3430         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.cpp:
3431         (WebCore::Layout::SimpleLineBreaker::Line::Line):
3432         (WebCore::Layout::SimpleLineBreaker::Line::setTextAlign):
3433         (WebCore::Layout::SimpleLineBreaker::Line::adjustedLeftForTextAlign const):
3434         (WebCore::Layout::SimpleLineBreaker::Line::justifyRuns):
3435         (WebCore::Layout::SimpleLineBreaker::Line::adjustRunsForTextAlign):
3436         (WebCore::Layout::expansionOpportunity):
3437         (WebCore::Layout::expansionBehavior):
3438         (WebCore::Layout::SimpleLineBreaker::Line::collectExpansionOpportunities):
3439         (WebCore::Layout::SimpleLineBreaker::Line::closeLastRun):
3440         (WebCore::Layout::SimpleLineBreaker::Line::append):
3441         (WebCore::Layout::SimpleLineBreaker::Line::collapseTrailingWhitespace):
3442         (WebCore::Layout::SimpleLineBreaker::Line::reset):
3443         (WebCore::Layout::SimpleLineBreaker::Style::Style):
3444         (WebCore::Layout::SimpleLineBreaker::handleLineEnd):
3445         (WebCore::Layout::SimpleLineBreaker::handleLineStart):
3446         (WebCore::Layout::isTextAlignRight):
3447         (WebCore::Layout::SimpleLineBreaker::createRunsForLine):
3448         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.h:
3449         (WebCore::Layout::SimpleLineBreaker::Line::setAvailableWidth):
3450         (WebCore::Layout::SimpleLineBreaker::Line::setCollapseWhitespace):
3451
3452 2018-07-21  Zalan Bujtas  <zalan@apple.com>
3453
3454         [LFC][IFC] Add verification for inline text runs.
3455         https://bugs.webkit.org/show_bug.cgi?id=187879
3456
3457         Reviewed by Antti Koivisto.
3458
3459         * layout/Verification.cpp:
3460         (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
3461         (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
3462         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
3463         (WebCore::Layout::verifyAndOutputSubtree):
3464         (WebCore::Layout::outputMismatchingBoxInformationIfNeeded): Deleted.
3465         * layout/inlineformatting/InlineFormattingContext.cpp:
3466         (WebCore::Layout::InlineFormattingContext::layout const):
3467         * layout/inlineformatting/InlineFormattingState.h:
3468         (WebCore::Layout::InlineFormattingState::addLayoutRuns):
3469         (WebCore::Layout::InlineFormattingState::layoutRuns const):
3470         * layout/layouttree/LayoutTreeBuilder.cpp:
3471         (WebCore::Layout::outputLayoutBox):
3472         (WebCore::Layout::outputLayoutTree):
3473         (WebCore::Layout::TreeBuilder::showLayoutTree):
3474
3475 2018-07-21  Zalan Bujtas  <zalan@apple.com>
3476
3477         [LFC] Do not use virtual methods to construct floating/formatting states.
3478         https://bugs.webkit.org/show_bug.cgi?id=187875
3479
3480         Reviewed by Antti Koivisto.
3481
3482         LayoutContext::establishedFormattingState() does not require FormattingContext anymore only the root of the context.
3483
3484         * layout/FormattingContext.cpp:
3485         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
3486         * layout/FormattingContext.h:
3487         * layout/LayoutContext.cpp:
3488         (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
3489         (WebCore::Layout::LayoutContext::formattingStateForBox const):
3490         (WebCore::Layout::LayoutContext::establishedFormattingState):
3491         * layout/LayoutContext.h:
3492         * layout/blockformatting/BlockFormattingContext.cpp:
3493         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
3494         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
3495         (WebCore::Layout::BlockFormattingContext::createFormattingState const): Deleted.
3496         (WebCore::Layout::BlockFormattingContext::createOrFindFloatingState const): Deleted.
3497         * layout/blockformatting/BlockFormattingContext.h:
3498         * layout/inlineformatting/InlineFormattingContext.cpp:
3499         (WebCore::Layout::InlineFormattingContext::createFormattingState const): Deleted.
3500         (WebCore::Layout::InlineFormattingContext::createOrFindFloatingState const): Deleted.
3501         * layout/inlineformatting/InlineFormattingContext.h:
3502
3503 2018-07-21  Zalan Bujtas  <zalan@apple.com>
3504
3505         [LFC][BFC] Do not collapse top/bottom margin with first/last inflow child from a non-block formatting context.
3506         https://bugs.webkit.org/show_bug.cgi?id=187867
3507
3508         Reviewed by Antti Koivisto.
3509
3510         The box's top/bottom margin never collapses with a non-block inflow child.
3511
3512         * layout/blockformatting/BlockMarginCollapse.cpp:
3513         (WebCore::Layout::isMarginTopCollapsedWithSibling):
3514         (WebCore::Layout::isMarginBottomCollapsedWithSibling):
3515         (WebCore::Layout::isMarginTopCollapsedWithParent):
3516         (WebCore::Layout::isMarginBottomCollapsedThrough):
3517         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild):
3518         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginTop):
3519         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginTop):
3520         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBottom):
3521         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop):
3522         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom):
3523         (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
3524         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild):
3525         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBottom):
3526         * layout/layouttree/LayoutBox.cpp:
3527         (WebCore::Layout::Box::establishesBlockFormattingContextOnly const): <div style="overflow: hidden">foobar</div> establishes both inline and block formatting context (inline wins though).
3528         * 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
3529         of inline formatting context, it is about the content.
3530
3531 2018-07-20  Jer Noble  <jer.noble@apple.com>
3532
3533         REGRESSION (r233974): Cannot close pip'd video; pops back into PiP.
3534         https://bugs.webkit.org/show_bug.cgi?id=187873
3535
3536         Reviewed by Jon Lee.
3537
3538         When the PIP machinery on Mac wants to close the PIP window (due to the close button being clicked), it does
3539         not consult our -shouldClosePiP handler; it just tells us that we're going to close. So we never setup the 
3540         necessary state on the WebProcess side and still think that our "targetIsFullscreen". When we get the "stop"
3541         action, just request exit fullscreen, but set up the _pipState to think we're already exiting (because we are).
3542
3543         * platform/mac/VideoFullscreenInterfaceMac.mm:
3544         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]):
3545
3546 2018-07-20  Justin Fan  <justin_fan@apple.com>
3547
3548         Safari WebGL does not consistently provide correct GPU context on eGPU systems
3549         https://bugs.webkit.org/show_bug.cgi?id=187750
3550         <rdar://problem/39531436>
3551
3552         Reviewed by Dean Jackson.
3553
3554         Move GraphicsContext3DManager into its own class, and notify it when page/Chrome receives a 
3555         windowScreenDidChange message. Add a private data struct to track which hostWindow created each context.
3556         Upon notification, Manager updates the contexts that match the hostWindow with the
3557         provided displayID. Each context matches displayID to rendererID (set during process creation 
3558         if window server is blocked), which is matched to a virtual screen, and updates its GPU accordingly.
3559
3560         No new tests. This requires multiple GPUs or eGPUs, each with attached display(s), to test.
3561
3562         * WebCore.xcodeproj/project.pbxproj:
3563         * page/Chrome.cpp:
3564         (WebCore::Chrome::windowScreenDidChange): Now calls GraphicsContext3DManager::screenDidChange().
3565         * platform/PlatformScreen.h:
3566         * platform/ScreenProperties.h: Add rendererID to struct.
3567         (WebCore::ScreenData::encode const):
3568         (WebCore::ScreenData::decode):
3569         * platform/graphics/GraphicsContext3D.h:
3570         * platform/graphics/GraphicsContext3DManager.cpp: Added (copied out of GraphicsContext3DCocoa.mm).
3571         (WebCore::attachToAppleGraphicsControl):
3572         (WebCore::hasMuxCapability):
3573         (WebCore::hasMuxableGPU):
3574         (WebCore::GraphicsContext3DManager::sharedManager):
3575         (WebCore::displayWasReconfigured):
3576         (WebCore::GraphicsContext3DManager::updateAllContexts):
3577         (WebCore::GraphicsContext3DManager::screenDidChange):
3578         (WebCore::GraphicsContext3DManager::addContext):
3579         (WebCore::GraphicsContext3DManager::removeContext):
3580         (WebCore::GraphicsContext3DManager::hostWindowForContext const):
3581         (WebCore::GraphicsContext3DManager::addContextRequiringHighPerformance):
3582         (WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance):
3583         (WebCore::GraphicsContext3DManager::updateHighPerformanceState):
3584         (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired):
3585         (WebCore::GraphicsContext3DManager::recycleContextIfNecessary):
3586         * platform/graphics/GraphicsContext3DManager.h: Added (copied out of GraphicsContext3DCocoa.mm).
3587         (WebCore::GraphicsContext3DManager::hasTooManyContexts const):
3588         (WebCore::GraphicsContext3DManager::GraphicsContext3DManager):
3589         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
3590         (WebCore::GraphicsContext3D::create):
3591         (WebCore::GraphicsContext3D::createShared):
3592         (WebCore::identifyAndSetCurrentGPU): Now matches rendererIDs to determine virtual screen. 
3593         (WebCore::GraphicsContext3D::GraphicsContext3D):
3594         (WebCore::GraphicsContext3D::~GraphicsContext3D):
3595         (WebCore::GraphicsContext3D::setContextVisibility):
3596         (WebCore::GraphicsContext3D::simulateContextChanged):
3597         (WebCore::GraphicsContext3D::screenDidChange):
3598         (WebCore::attachToAppleGraphicsControl): Deleted.
3599         (WebCore::hasMuxCapability): Deleted.
3600         (WebCore::hasMuxableGPU): Deleted.
3601         (WebCore::GraphicsContext3DManager::GraphicsContext3DManager): Deleted.
3602         (WebCore::GraphicsContext3DManager::hasTooManyContexts const): Deleted.
3603         (WebCore::manager): Deleted.
3604         (WebCore::displayWasReconfigured): Deleted.
3605         (WebCore::GraphicsContext3DManager::updateAllContexts): Deleted.
3606         (WebCore::GraphicsContext3DManager::addContext): Deleted.
3607         (WebCore::GraphicsContext3DManager::removeContext): Deleted.
3608         (WebCore::GraphicsContext3DManager::addContextRequiringHighPerformance): Deleted.
3609         (WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance): Deleted.
3610         (WebCore::GraphicsContext3DManager::updateHighPerformanceState): Deleted.
3611         (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired): Deleted.
3612         (WebCore::GraphicsContext3DManager::recycleContextIfNecessary): Deleted.
3613         * platform/mac/PlatformScreenMac.mm: Provide a display's rendererID.
3614         (WebCore::rendererIDForDisplayMask):
3615         (WebCore::collectScreenProperties):
3616         (WebCore::rendererIDForDisplay):
3617         (WebCore::primaryRendererID):
3618
3619 2018-07-19  Simon Fraser  <simon.fraser@apple.com>
3620
3621         Remove completed animations from GraphicsLayer, thus avoiding excessive backing store allocation
3622         https://bugs.webkit.org/show_bug.cgi?id=187844
3623         rdar://problem/40387294
3624
3625         Reviewed by Dean Jackson.
3626         
3627         A keyframe animation which animates 3D transforms, and is fill-forwards, currently
3628         leaves the GraphicsLayer in a state where it has a "running" animation. However, the
3629         logic that computes animation extent in RenderLayerBacking::updateGeometry() only does
3630         so for running or paused animations. GraphicsLayer then thinks that it has an active
3631         transform animation with unknown extent, and refuses to detach its backing store.
3632         
3633         This triggers excessive layer creation on some sites (e.g. https://www.kqed.org).
3634         
3635         Fix by always removing animations from the GraphicsLayer when they finish, whether
3636         or not they fill forwards. This is done by having KeyframeAnimation::onAnimationEnd()
3637         always call endAnimation().
3638         
3639         This change only fixes the non-Web Animation code path. webkit.org/b/187845 exists
3640         to fix the other code path.
3641         
3642         Also improve some logging that would have revealed this problem sooner.
3643
3644         Test: compositing/backing/backing-store-attachment-fill-forwards-animation.html
3645
3646         * page/animation/AnimationBase.h:
3647         (WebCore::AnimationBase::endAnimation):
3648         * page/animation/ImplicitAnimation.cpp:
3649         (WebCore::ImplicitAnimation::endAnimation):
3650         * page/animation/ImplicitAnimation.h:
3651         * page/animation/KeyframeAnimation.cpp:
3652         (WebCore::KeyframeAnimation::endAnimation):
3653         (WebCore::KeyframeAnimation::onAnimationEnd):
3654         * page/animation/KeyframeAnimation.h:
3655         * platform/graphics/ca/GraphicsLayerCA.cpp:
3656         (WebCore::GraphicsLayerCA::addAnimation):
3657         (WebCore::GraphicsLayerCA::updateCoverage):
3658
3659 2018-07-20  Ryosuke Niwa  <rniwa@apple.com>
3660
3661         Picking a color from the color panel for typing attributes needs to inverse transform through color-filter
3662         https://bugs.webkit.org/show_bug.cgi?id=187846
3663
3664         Reviewed by Simon Fraser.
3665
3666         This patch refines the color inversion for editing introduced in r234005 so that font panels and WebKit embedders
3667         can get and set inverted colors using attributed strings for a selected text in an editable region.
3668
3669         More specifically, when font panels or WebKit embedders set a font color or a background color via WebView's
3670         _applyStyleToSelection and _applyEditingStyleToSelection, WebKit would automatically invert the color before inserting
3671         into DOM so that the color visible to the user matches that's given to WebKit. Conversely,
3672         [WebView attributedSubstringFromRange:nsRange] now return the color visible to the user, i.e. the color after
3673         the color filter had been applied, so that some WebKit embedders can present the visually identical color to the user.
3674
3675         Because DOM never sees the color filter's effect in the computed style, etc... this patch reverts the change made to
3676         StyleChange in r234005 to avoid inverting the color passed to execCommand. This makes editing apps which is unaware
3677         of the dark mode or -apple-color-filter continue to function (because the color picker implemented in DOM will be
3678         applied of the same color filter before being presented to the user).
3679
3680         Finally, this patch introduces a testing hook in applyCommandToFrame so that executing foreColor or backColor with
3681         the soruce of CommandFromMenuOrKeyBinding would trigger the same code path as the one taken by Objective-C 
3682
3683         Tests: editing/execCommand/set-backColor-with-color-filter-from-scripts.html
3684                editing/execCommand/set-foreColor-with-color-filter-from-scripts.html
3685                editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html
3686                editing/style/set-backColor-with-color-filter.html
3687                editing/style/set-foreColor-with-color-filter.html
3688
3689         * editing/EditingStyle.cpp:
3690         (WebCore::EditingStyle::inverseTransformColorIfNeeded): Added.
3691         (WebCore::StyleChange::StyleChange): Revert the change made in r234005 since this code is also used by execCommand
3692         which is not desirable, and won't work for background color.
3693         (WebCore::StyleChange::extractTextStyles): Ditto.
3694         * editing/EditingStyle.h:
3695         * editing/Editor.cpp:
3696         (WebCore::Editor::applyStyle):
3697         (WebCore::Editor::applyStyleToSelection): Call EditingStyle::inverseTransformColorIfNeeded when ColorFilterMode is
3698         set to InvertColor.
3699         * editing/Editor.h:
3700         * editing/EditorCommand.cpp:
3701         (WebCore::applyCommandToFrame): Added the aforementioned testing hook.
3702         * editing/cocoa/HTMLConverter.mm:
3703         (WebCore::editingAttributedStringFromRange): Take the color filtr into account. Some WebKit embedders use this
3704         function to compute the font color in the selected text. Note that this function is mostly used for input methods
3705         so the color doesn't really matter, and its implementation is distinct from that of HTMLConverter.
3706
3707 2018-07-19  Jer Noble  <jer.noble@apple.com>
3708
3709         HLS resources with remote subresources will not taint canvasses.
3710         https://bugs.webkit.org/show_bug.cgi?id=187731
3711         <rdar://problem/42290703>
3712
3713         Reviewed by Brady Eidson.
3714
3715         Test: http/tests/security/canvas-remote-read-remote-video-hls.html
3716
3717         Most media sources are single-resource; they are accessed from a single origin. HLS manifests can contain many
3718         subresources from arbitrary origins, and canvases should be tainted when painted from media elements whose
3719         subresources were retrieved from tainting origins.
3720
3721         Add a new method to HTMLMediaElement, wouldTaintOrigin(), taking a SecurityOrigin, and returning whether the
3722         media element would taint that origin. This gets piped all the way down to MediaPlayerPrivateAVFoundationObjC
3723         which uses WebCoreNSURLSession to track all the origins of all the responses which resulted from the media
3724         element's load.
3725
3726         Drive-by fix: also fix this issue for media elements which render to an AudioContext.
3727
3728         Drive-by fix #2: CanvasRenderingContext2DBase::createPattern() needs to check the return value of
3729         ImageBuffer::create() before using it.
3730
3731         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
3732         (WebCore::MediaElementAudioSourceNode::wouldTaintOrigin):
3733         * html/HTMLMediaElement.cpp:
3734         (WebCore::HTMLMediaElement::didAttachRenderers):
3735         (WebCore::HTMLMediaElement::didDetachRenderers):
3736         (WebCore::HTMLMediaElement::scheduleUpdateShouldAutoplay):
3737         * html/HTMLMediaElement.h:
3738         (WebCore::HTMLMediaElement::wouldTaintOrigin const):
3739         * html/canvas/CanvasRenderingContext.cpp:
3740         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
3741         * html/canvas/CanvasRenderingContext2DBase.cpp:
3742         (WebCore::CanvasRenderingContext2DBase::createPattern):
3743         * platform/graphics/MediaPlayer.cpp:
3744         (WebCore::MediaPlayer::wouldTaintOrigin const):
3745         * platform/graphics/MediaPlayer.h:
3746         * platform/graphics/MediaPlayerPrivate.h:
3747         (WebCore::MediaPlayerPrivateInterface::hasSingleSecurityOrigin const):
3748         (WebCore::MediaPlayerPrivateInterface::wouldTaintOrigin const):
3749         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
3750         (WebCore::CDMSessionAVContentKeySession::update):
3751         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3752         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3753         (WebCore::MediaPlayerPrivateAVFoundationObjC::wouldTaintOrigin const):
3754         * platform/network/cocoa/WebCoreNSURLSession.h:
3755         * platform/network/cocoa/WebCoreNSURLSession.mm:
3756         (-[WebCoreNSURLSession task:didReceiveResponseFromOrigin:]):
3757         (-[WebCoreNSURLSession wouldTaintOrigin:]):
3758         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
3759
3760 2018-07-20  Zalan Bujtas  <zalan@apple.com>
3761
3762         Update FrameView::paintContents to use release logging.
3763         https://bugs.webkit.org/show_bug.cgi?id=187854
3764         <rdar://problem/42432371>
3765
3766         Reviewed by Simon Fraser.
3767
3768         Adding release logging helps identifying blank content cases. 
3769
3770         * page/FrameView.cpp:
3771         (WebCore::FrameView::paintContents):
3772
3773 2018-07-20  Jer Noble  <jer.noble@apple.com>
3774
3775         First Auto-PiP from Fullscreen too small & animation blocks
3776         https://bugs.webkit.org/show_bug.cgi?id=187745
3777         <rdar://problem/42316583>
3778
3779         Reviewed by Jon Lee.
3780
3781         1) When Auto-PiPing, we don't have the luxury of setting up the fullscreen state
3782         ahead of time; we get notified that PiP has already started. The area of the code
3783         which does this just-in-time setup needs to set the video layer's frame so that the
3784         transform within the PiP window is correct.
3785
3786         2) We generate a placeholder image when going into fullscreen, but we need to do
3787         so synchronously. Create the AVPlayerItemVideoOutput up front at AVPlayerItem creation
3788         time wherever AVPIVO is available.
3789
3790         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3791         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
3792         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
3793         (VideoFullscreenInterfaceAVKit::doSetup):
3794
3795 2018-07-20  Antoine Quint  <graouts@apple.com>
3796
3797         DeclarativeAnimation should suspend, resume, & stop m_eventQueue
3798         https://bugs.webkit.org/show_bug.cgi?id=187216
3799         <rdar://problem/41669739>
3800
3801         Reviewed by Ryosuke Niwa.
3802
3803         Suspend, resume and close the GenericEventQueue for DeclarativeAnimation as instructed through the DOMActiveObject protocol.
3804
3805         * animation/DeclarativeAnimation.cpp:
3806         (WebCore::DeclarativeAnimation::stop):
3807         (WebCore::DeclarativeAnimation::suspend):
3808         (WebCore::DeclarativeAnimation::resume):
3809         * animation/DeclarativeAnimation.h:
3810         * animation/WebAnimation.h:
3811
3812 2018-07-20  Zalan Bujtas  <zalan@apple.com>
3813
3814         [LFC][Inline formatting context] Add basic text content handling.
3815         https://bugs.webkit.org/show_bug.cgi?id=187860
3816
3817         Reviewed by Antti Koivisto.
3818
3819         InlineFormattingContext::layout() walks through the formatting root's descendant list in a post-order fashion and
3820         feeds the TextContentProvider.
3821         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
3822         this is about text content only.
3823
3824         * layout/displaytree/DisplayBox.h:
3825         (WebCore::Display::Box::contentBoxBottom const):
3826         (WebCore::Display::Box::contentBoxRight const):
3827         * layout/inlineformatting/InlineFormattingContext.cpp:
3828         (WebCore::Layout::InlineFormattingContext::layout const):
3829         * layout/inlineformatting/textlayout/TextContentProvider.cpp:
3830         (WebCore::Layout::TextContentProvider::textRuns): Add a helper function to support the case when all we need is just the run list in one go.
3831         * layout/inlineformatting/textlayout/TextContentProvider.h:
3832         * layout/layouttree/LayoutBox.cpp:
3833         (WebCore::Layout::Box::isDescendantOf const):
3834         * layout/layouttree/LayoutBox.h:
3835         * layout/layouttree/LayoutInlineBox.h:
3836         (WebCore::Layout::InlineBox::textContent const):
3837
3838 2018-07-20  Youenn Fablet  <youenn@apple.com>
3839
3840         FetchResponse should close its stream when loading finishes
3841         https://bugs.webkit.org/show_bug.cgi?id=187790
3842
3843         Reviewed by Chris Dumez.
3844
3845         It simplifies for a FetchResponse to push all its data into its stream if already created at end of load time.
3846         Did some refactoring in FetchBodyOwner to have a cleaner relationship with the stream source.
3847         Did a minor refactoring to expose the error description when loading fails as part of the rejected promise.
3848         This is consistent to errors sent back through callbacks.
3849
3850         Covered by existing tests.
3851
3852         * Modules/fetch/FetchBodyOwner.cpp:
3853         (WebCore::FetchBodyOwner::~FetchBodyOwner):
3854         * Modules/fetch/FetchBodyOwner.h:
3855         * Modules/fetch/FetchBodySource.cpp:
3856         (WebCore::FetchBodySource::FetchBodySource):
3857         (WebCore::FetchBodySource::setActive):
3858         (WebCore::FetchBodySource::setInactive):
3859         (WebCore::FetchBodySource::doStart):
3860         (WebCore::FetchBodySource::doPull):
3861         (WebCore::FetchBodySource::doCancel):
3862         (WebCore::FetchBodySource::cleanBodyOwner):
3863         * Modules/fetch/FetchBodySource.h:
3864         * Modules/fetch/FetchResponse.cpp:
3865         (WebCore::FetchResponse::BodyLoader::didSucceed):
3866         (WebCore::FetchResponse::BodyLoader::didFail):
3867
3868 2018-07-20  Jer Noble  <jer.noble@apple.com>
3869
3870         REGRESSION(r233969): ASSERT in -[WebAVPlayerLayer setVideoGravity:]
3871         https://bugs.webkit.org/show_bug.cgi?id=187814
3872         <rdar://problem/42391869>
3873
3874         Reviewed by Eric Carlson.
3875
3876         After r233969 caused models to disassociate themselves from interfaces, it is now possible that an
3877         VideoFullscreenInterfaceAVKit can have a nil model. We should null-check, not ASSERT, now that the
3878         assertion no longer holds true.
3879
3880         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
3881         (-[WebAVPlayerLayer layoutSublayers]):
3882         (-[WebAVPlayerLayer resolveBounds]):
3883         (-[WebAVPlayerLayer setVideoGravity:]):
3884
3885 2018-07-19  Antoine Quint  <graouts@apple.com>
3886
3887         Flaky crash in AnimationTimeline::cancelOrRemoveDeclarativeAnimation
3888         https://bugs.webkit.org/show_bug.cgi?id=187530
3889         <rdar://problem/42095186>
3890
3891         Reviewed by Dean Jackson.
3892
3893         We would crash in cancelOrRemoveDeclarativeAnimation() because updateCSSAnimationsForElement() would pass
3894         nullptr values due to the return value of cssAnimationsByName.take(nameOfAnimationToRemove). This is because
3895         we would create animations for animation names that may be empty or not match an existing @keyframes rule.
3896         Not only was that wasteful, but it was also non-compliant, and as a result of fixing this we're actually
3897         seeing a progression in the CSS Animations WPT tests.
3898
3899         * animation/AnimationTimeline.cpp:
3900         (WebCore::shouldConsiderAnimation): New function that performs all required steps to see if a provided animation
3901         is valid and has a name that is not "none", not the empty string and matches the name of a @keyframes rule.
3902         (WebCore::AnimationTimeline::updateCSSAnimationsForElement):
3903         * animation/KeyframeEffectReadOnly.cpp:
3904         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): We no longer need to check whether we have
3905         an empty animation name since we're no longer creating CSSAnimation objects in that circumstance.
3906         * css/StyleResolver.cpp:
3907         (WebCore::StyleResolver::isAnimationNameValid): Add a new method that checks whether the provided animation name
3908         a known @keyframes rule.
3909         * css/StyleResolver.h:
3910
3911 2018-07-19  Chris Dumez  <cdumez@apple.com>
3912
3913         Crash under WebCore::DocumentWriter::addData()
3914