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