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