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