2021-01-08 Russell Epstein Cherry-pick r271337. rdar://problem/72941242 BlobLoader lifetime cleanup. and https://bugs.webkit.org/show_bug.cgi?id=220486 Reviewed by Chris Dumez. Source/WebCore: Test: LayoutTests/http/tests/loading/blob-load-fail.html * fileapi/Blob.cpp: (WebCore::Blob::loadBlob): (WebCore::Blob::text): (WebCore::Blob::arrayBuffer): * fileapi/Blob.h: LayoutTests: * http/tests/loading/blob-load-fail-expected.txt: Added. * http/tests/loading/blob-load-fail.html: Added. * http/tests/loading/resources/remote-blob.php: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271337 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-08 Brady Eidson BlobLoader lifetime cleanup. and https://bugs.webkit.org/show_bug.cgi?id=220486 Reviewed by Chris Dumez. Test: LayoutTests/http/tests/loading/blob-load-fail.html * fileapi/Blob.cpp: (WebCore::Blob::loadBlob): (WebCore::Blob::text): (WebCore::Blob::arrayBuffer): * fileapi/Blob.h: 2020-12-21 Alan Coon Cherry-pick r270580. rdar://problem/72552978 Multicolumn children becoming in-flow elements should be inserted into the multicolumn flow https://bugs.webkit.org/show_bug.cgi?id=218503 Reviewed by Zalan Bujtas. Out of flow children of a multicolumn container are not really part of the multicolumn flow. Making them in-flow (i.e. setting "position: static;") should trigger the code that inserts them into the MultiColumnFlowThread object of the multicolumn container. RenderTreeBuilder was handling this in-flow <-> out-of-flow changes just for the cases in which the inline status of an element was affecting the parent. * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::normalizeTreeAfterStyleChange): Insert renderer in the multicolumn flow thread whenever it becames in flow. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270580 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-12-02 Sergio Villar Senin Multicolumn children becoming in-flow elements should be inserted into the multicolumn flow https://bugs.webkit.org/show_bug.cgi?id=218503 Reviewed by Zalan Bujtas. Out of flow children of a multicolumn container are not really part of the multicolumn flow. Making them in-flow (i.e. setting "position: static;") should trigger the code that inserts them into the MultiColumnFlowThread object of the multicolumn container. RenderTreeBuilder was handling this in-flow <-> out-of-flow changes just for the cases in which the inline status of an element was affecting the parent. * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::normalizeTreeAfterStyleChange): Insert renderer in the multicolumn flow thread whenever it becames in flow. 2020-12-18 Alan Coon Cherry-pick r270983. rdar://problem/72484021 Crash in DOMSelection::getRangeAt() https://bugs.webkit.org/show_bug.cgi?id=219804 Patch by Julian Gonzalez on 2020-12-18 Reviewed by Darin Adler. Add a check in HTMLTextFormControlElement::setSelectionRange() that ensures we do not try to move the frame's selection if the HTMLTextFormControlElement is no longer connected. * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::setSelectionRange): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270983 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-12-18 Julian Gonzalez Crash in DOMSelection::getRangeAt() https://bugs.webkit.org/show_bug.cgi?id=219804 Reviewed by Darin Adler. Add a check in HTMLTextFormControlElement::setSelectionRange() that ensures we do not try to move the frame's selection if the HTMLTextFormControlElement is no longer connected. * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::setSelectionRange): 2020-12-16 Alan Coon Cherry-pick r269900. rdar://problem/72298580 Build fails on internal simulator builds due to missing enum kCVPixelFormatType_AGX_420YpCbCr8BiPlanarVideoRange https://bugs.webkit.org/show_bug.cgi?id=219030 Patch by Kimmo Kinnunen on 2020-11-17 Reviewed by Antti Koivisto. Fix compile for simulator builds. Rename HAVE_CV_AGX_420_PIXEL_FORMAT_TYPES to HAVE_COREVIDEO_COMPRESSED_PIXEL_FORMAT_TYPES to better reflect what the ifdef does. Source/WebCore: * platform/graphics/cv/GraphicsContextGLCVANGLE.cpp: (WebCore::pixelRangeFromPixelFormat): (WebCore::GraphicsContextGLCVANGLE::copyPixelBufferToTexture): Source/WebCore/PAL: * pal/spi/cf/CoreVideoSPI.h: Source/WTF: * wtf/PlatformHave.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269900 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-11-17 Kimmo Kinnunen Build fails on internal simulator builds due to missing enum kCVPixelFormatType_AGX_420YpCbCr8BiPlanarVideoRange https://bugs.webkit.org/show_bug.cgi?id=219030 Reviewed by Antti Koivisto. Fix compile for simulator builds. Rename HAVE_CV_AGX_420_PIXEL_FORMAT_TYPES to HAVE_COREVIDEO_COMPRESSED_PIXEL_FORMAT_TYPES to better reflect what the ifdef does. * platform/graphics/cv/GraphicsContextGLCVANGLE.cpp: (WebCore::pixelRangeFromPixelFormat): (WebCore::GraphicsContextGLCVANGLE::copyPixelBufferToTexture): 2020-12-15 Alan Coon Cherry-pick r266695. rdar://problem/72356057 [css-flexbox] min-height: auto not applied to nested flexboxes. https://bugs.webkit.org/show_bug.cgi?id=210089 Reviewed by Daniel Bates. Source/WebCore: Nested flexboxes with column direction were not computing correctly min-size:auto because we were explicitly preventing them from doing so in the code. Implemented the required bits to make it work correctly and thus removed the retriction. The idea is to set an indefinite override containing block size so that percentages would be resolved to auto as spec'ed. The code which decides whether to apply min-size:auto was refactored in the shouldApplyMinSizeAutoForChild() method. In order not to cause regressions some other two additional changes were also implemented. First we had to adjust childHasIntrinsicMainAxisSize() so that it also takes into account the cases where shouldApplyMinSizeAutoForChild() is true and return true. Secondly we had to add an additional case to mainAxisLengthIsDefinite() so that it returns false for column flows where the flexBasis is intrinsic. Inspired by Blink's crrev.com/c/1641510, crrev.com/c/1269995 & crrev.com/c/1786297 by * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::shouldApplyMinSizeAutoForChild const): Refactored from RenderFlexibleBox::adjustChildSizeForMinAndMax. (WebCore::RenderFlexibleBox::mainAxisLengthIsDefinite const): Additional case for column flows. (WebCore::RenderFlexibleBox::layoutFlexItems): Reset m_hasDefiniteHeight to Unknown after calling constructFlexItem() because the latter might set now an override containing block height which basically potentially makes any cached size value incorrect. (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax): Directly call shouldApplyMinSizeAutoForChild(). (WebCore::RenderFlexibleBox::constructFlexItem): Set an indefinite override containing block size for children with percentage sizes so that they're resolved as auto. (WebCore::RenderFlexibleBox::childHasIntrinsicMainAxisSize const): Return true for those cases where the main axis length is indefinite and also when shouldApplyMinSizeAutoForChild(). * rendering/RenderFlexibleBox.h: LayoutTests: Apart from enabling some tests we're removing a test which is now invalid as it was added under the condition that we were not matching the specs wrt percentage height computation in column flexboxes. * TestExpectations: Removed two test cases that are passing now. * fast/flexbox/nested-column-intrinsic-min-disabled-expected.html: Removed. * fast/flexbox/nested-column-intrinsic-min-disabled.html: Removed. * platform/ios/fast/forms/auto-fill-button/input-strong-password-auto-fill-button-expected.txt: Updated. * platform/mac/fast/forms/auto-fill-button/input-strong-password-auto-fill-button-expected.txt: Ditto. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266695 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-02 Sergio Villar Senin [css-flexbox] min-height: auto not applied to nested flexboxes. https://bugs.webkit.org/show_bug.cgi?id=210089 Reviewed by Daniel Bates. Nested flexboxes with column direction were not computing correctly min-size:auto because we were explicitly preventing them from doing so in the code. Implemented the required bits to make it work correctly and thus removed the retriction. The idea is to set an indefinite override containing block size so that percentages would be resolved to auto as spec'ed. The code which decides whether to apply min-size:auto was refactored in the shouldApplyMinSizeAutoForChild() method. In order not to cause regressions some other two additional changes were also implemented. First we had to adjust childHasIntrinsicMainAxisSize() so that it also takes into account the cases where shouldApplyMinSizeAutoForChild() is true and return true. Secondly we had to add an additional case to mainAxisLengthIsDefinite() so that it returns false for column flows where the flexBasis is intrinsic. Inspired by Blink's crrev.com/c/1641510, crrev.com/c/1269995 & crrev.com/c/1786297 by * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::shouldApplyMinSizeAutoForChild const): Refactored from RenderFlexibleBox::adjustChildSizeForMinAndMax. (WebCore::RenderFlexibleBox::mainAxisLengthIsDefinite const): Additional case for column flows. (WebCore::RenderFlexibleBox::layoutFlexItems): Reset m_hasDefiniteHeight to Unknown after calling constructFlexItem() because the latter might set now an override containing block height which basically potentially makes any cached size value incorrect. (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax): Directly call shouldApplyMinSizeAutoForChild(). (WebCore::RenderFlexibleBox::constructFlexItem): Set an indefinite override containing block size for children with percentage sizes so that they're resolved as auto. (WebCore::RenderFlexibleBox::childHasIntrinsicMainAxisSize const): Return true for those cases where the main axis length is indefinite and also when shouldApplyMinSizeAutoForChild(). * rendering/RenderFlexibleBox.h: 2020-12-15 Alan Coon Cherry-pick r270101. rdar://problem/72298523 Add support for RTCPeerConnection.onicecandidateerror event https://bugs.webkit.org/show_bug.cgi?id=169644 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/webrtc/idlharness.https.window-expected.txt: Source/WebCore: Expose RTCPeerConnection.onicecandidateerror and use it for wrong STUN/TURN server URLs. For that matter, add RTCPeerConnectionIceErrorEvent as per spec with a slight change to the init directory to keep the same terminology between event and init dictionary. Covered by updated webrtc/stun-server-filtering.html test. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::iceServersFromConfiguration): (WebCore::iceServersFromConfiguration): Deleted. * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCPeerConnectionIceErrorEvent.cpp: Added. (WebCore::RTCPeerConnectionIceErrorEvent::create): (WebCore::RTCPeerConnectionIceErrorEvent::RTCPeerConnectionIceErrorEvent): (WebCore::RTCPeerConnectionIceErrorEvent::eventInterface const): * Modules/mediastream/RTCPeerConnectionIceErrorEvent.h: Added. * Modules/mediastream/RTCPeerConnectionIceErrorEvent.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * dom/EventNames.h: * dom/EventNames.in: LayoutTests: * webrtc/rtcpeerconnection-error-messages-expected.txt: * webrtc/stun-server-filtering.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270101 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-11-20 Youenn Fablet Add support for RTCPeerConnection.onicecandidateerror event https://bugs.webkit.org/show_bug.cgi?id=169644 Reviewed by Alex Christensen. Expose RTCPeerConnection.onicecandidateerror and use it for wrong STUN/TURN server URLs. For that matter, add RTCPeerConnectionIceErrorEvent as per spec with a slight change to the init directory to keep the same terminology between event and init dictionary. Covered by updated webrtc/stun-server-filtering.html test. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::iceServersFromConfiguration): (WebCore::iceServersFromConfiguration): Deleted. * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCPeerConnectionIceErrorEvent.cpp: Added. (WebCore::RTCPeerConnectionIceErrorEvent::create): (WebCore::RTCPeerConnectionIceErrorEvent::RTCPeerConnectionIceErrorEvent): (WebCore::RTCPeerConnectionIceErrorEvent::eventInterface const): * Modules/mediastream/RTCPeerConnectionIceErrorEvent.h: Added. * Modules/mediastream/RTCPeerConnectionIceErrorEvent.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * dom/EventNames.h: * dom/EventNames.in: 2020-12-14 Alan Coon Cherry-pick r270449. rdar://problem/72298505 Add safety checks to xsltParamArrayFromParameterMap() Reviewed by Darin Adler. Source/WebCore: * xml/XSLTProcessorLibxslt.cpp: (WebCore::xsltParamArrayFromParameterMap): Source/WTF: * wtf/PlatformHave.h: (HAVE_LIBXSLT_FIX_FOR_RADAR_71864140): Add. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270449 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-12-04 David Kilzer Add safety checks to xsltParamArrayFromParameterMap() Reviewed by Darin Adler. * xml/XSLTProcessorLibxslt.cpp: (WebCore::xsltParamArrayFromParameterMap): 2020-12-14 Alan Coon Cherry-pick r270373. rdar://problem/72298666 iframe with `sandbox=allow-top-navigation-by-user-activation` can navigate top frame when the user interacts with an iframe from another origin https://bugs.webkit.org/show_bug.cgi?id=219413 Reviewed by Geoffrey Garen. Source/WebCore: An iframe with `sandbox=allow-top-navigation-by-user-activation` can navigate the top frame when the user interacts with an frame from another origin. This is not strict enough and does not match the behavior of Chrome. In Chrome, the user activation is only valid for the purpose of navigation if the user interacted with either: - The iframe triggering the navigation - A descendant iframe of the iframe triggering the navigation - A frame from the same origin as the iframe triggering the navigation This patch aligns our behavior with Chrome's. Test: http/tests/security/block-top-level-navigations-by-sandboxed-iframe-with-propagated-user-gesture.html * dom/Document.cpp: (WebCore::Document::canNavigateInternal): * dom/UserGestureIndicator.cpp: (WebCore::UserGestureToken::UserGestureToken): (WebCore::UserGestureToken::isValidForDocument const): (WebCore::UserGestureIndicator::processingUserGesture): * dom/UserGestureIndicator.h: (WebCore::UserGestureToken::create): LayoutTests: Add layout test coverage. * http/tests/security/block-top-level-navigations-by-sandboxed-iframe-with-propagated-user-gesture-expected.txt: Added. * http/tests/security/block-top-level-navigations-by-sandboxed-iframe-with-propagated-user-gesture.html: Added. * http/tests/security/resources/navigate-top-level-frame-to-failure-page-via-message-handler.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270373 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-12-02 Chris Dumez iframe with `sandbox=allow-top-navigation-by-user-activation` can navigate top frame when the user interacts with an iframe from another origin https://bugs.webkit.org/show_bug.cgi?id=219413 Reviewed by Geoffrey Garen. An iframe with `sandbox=allow-top-navigation-by-user-activation` can navigate the top frame when the user interacts with an frame from another origin. This is not strict enough and does not match the behavior of Chrome. In Chrome, the user activation is only valid for the purpose of navigation if the user interacted with either: - The iframe triggering the navigation - A descendant iframe of the iframe triggering the navigation - A frame from the same origin as the iframe triggering the navigation This patch aligns our behavior with Chrome's. Test: http/tests/security/block-top-level-navigations-by-sandboxed-iframe-with-propagated-user-gesture.html * dom/Document.cpp: (WebCore::Document::canNavigateInternal): * dom/UserGestureIndicator.cpp: (WebCore::UserGestureToken::UserGestureToken): (WebCore::UserGestureToken::isValidForDocument const): (WebCore::UserGestureIndicator::processingUserGesture): * dom/UserGestureIndicator.h: (WebCore::UserGestureToken::create): 2020-12-14 Alan Coon Cherry-pick r270367. rdar://problem/72298753 Block suspicious top level navigations by iframes even if sandbox=allow-top-navigation is specified https://bugs.webkit.org/show_bug.cgi?id=219408 Reviewed by Geoffrey Garen. Source/WebCore: Block suspicious top level navigations by iframes even if sandbox=allow-top-navigation is specified, when the parent of the sandboxed iframe is not first-party. Test: http/tests/security/block-top-level-navigations-by-third-party-sandboxed-iframe.html * dom/Document.cpp: (WebCore::Document::isNavigationBlockedByThirdPartyIFrameRedirectBlocking): LayoutTests: Add layout test coverage. * http/tests/security/block-top-level-navigations-by-third-party-sandboxed-iframe-expected.txt: Added. * http/tests/security/block-top-level-navigations-by-third-party-sandboxed-iframe.html: Added. * http/tests/security/resources/navigate-top-level-frame-to-failure-page-via-sandboxed-iframe.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270367 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-12-02 Chris Dumez Block suspicious top level navigations by iframes even if sandbox=allow-top-navigation is specified https://bugs.webkit.org/show_bug.cgi?id=219408 Reviewed by Geoffrey Garen. Block suspicious top level navigations by iframes even if sandbox=allow-top-navigation is specified, when the parent of the sandboxed iframe is not first-party. Test: http/tests/security/block-top-level-navigations-by-third-party-sandboxed-iframe.html * dom/Document.cpp: (WebCore::Document::isNavigationBlockedByThirdPartyIFrameRedirectBlocking): 2020-12-14 Alan Coon Cherry-pick r269893. rdar://problem/72298580 Textures Fail to Render in WebGL from HLS Stream on iPhone 12 [iOS 14.2] https://bugs.webkit.org/show_bug.cgi?id=218637 Patch by Kimmo Kinnunen on 2020-11-16 Reviewed by Eric Carlson. Patch by Jer Noble. Treat internal compressed YUV pixel formats kCVPixelFormatType_AGX_420YpCbCr8BiPlanarVideoRange and kCVPixelFormatType_AGX_420YpCbCr8BiPlanarFullRange as kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange and kCVPixelFormatType_420YpCbCr8BiPlanarFullRange when using the OpenGL shader to convert video IOSurface to a WebGL texture. Fixes cases where the decoder outputs the compressed formats. No new tests, adding more comprehensive test content suite is tracked in another bug. Source/WebCore: * platform/graphics/cv/GraphicsContextGLCVANGLE.cpp: (WebCore::pixelRangeFromPixelFormat): (WebCore::GraphicsContextGLCVANGLE::copyPixelBufferToTexture): Source/WebCore/PAL: * PAL.xcodeproj/project.pbxproj: * pal/spi/cf/CoreVideoSPI.h: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269893 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-11-16 Kimmo Kinnunen Textures Fail to Render in WebGL from HLS Stream on iPhone 12 [iOS 14.2] https://bugs.webkit.org/show_bug.cgi?id=218637 Reviewed by Eric Carlson. Patch by Jer Noble. Treat internal compressed YUV pixel formats kCVPixelFormatType_AGX_420YpCbCr8BiPlanarVideoRange and kCVPixelFormatType_AGX_420YpCbCr8BiPlanarFullRange as kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange and kCVPixelFormatType_420YpCbCr8BiPlanarFullRange when using the OpenGL shader to convert video IOSurface to a WebGL texture. Fixes cases where the decoder outputs the compressed formats. No new tests, adding more comprehensive test content suite is tracked in another bug. * platform/graphics/cv/GraphicsContextGLCVANGLE.cpp: (WebCore::pixelRangeFromPixelFormat): (WebCore::GraphicsContextGLCVANGLE::copyPixelBufferToTexture): 2020-12-14 Alan Coon Cherry-pick r269535. rdar://problem/72298703 Empty text runs can't be split any further. https://bugs.webkit.org/show_bug.cgi?id=218506 Reviewed by David Kilzer and Ryosuke Niwa. This patch ensures that when we can't fit an empty text run on the line (available space is negative) we don't try to split it even when the style says so. * layout/inlineformatting/InlineContentBreaker.cpp: (WebCore::Layout::InlineContentBreaker::processOverflowingContent const): (WebCore::Layout::InlineContentBreaker::tryBreakingTextRun const): * layout/inlineformatting/text/TextUtil.cpp: (WebCore::Layout::TextUtil::fixedPitchWidth): (WebCore::Layout::TextUtil::split): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269535 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-11-06 Zalan Bujtas Empty text runs can't be split any further. https://bugs.webkit.org/show_bug.cgi?id=218506 Reviewed by David Kilzer and Ryosuke Niwa. This patch ensures that when we can't fit an empty text run on the line (available space is negative) we don't try to split it even when the style says so. * layout/inlineformatting/InlineContentBreaker.cpp: (WebCore::Layout::InlineContentBreaker::processOverflowingContent const): (WebCore::Layout::InlineContentBreaker::tryBreakingTextRun const): * layout/inlineformatting/text/TextUtil.cpp: (WebCore::Layout::TextUtil::fixedPitchWidth): (WebCore::Layout::TextUtil::split): 2020-12-01 Alan Coon Cherry-pick r269190. rdar://problem/71381759 Increase camera failing timer to 30 seconds https://bugs.webkit.org/show_bug.cgi?id=218389 Reviewed by Eric Carlson. From testing, 3 seconds is not always enough if getUserMedia is quickly called multiple times. Let's increase to 30 seconds to give room for slow systems while still being able to identify failures. * platform/mediastream/mac/AVVideoCaptureSource.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269190 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-30 Youenn Fablet Increase camera failing timer to 30 seconds https://bugs.webkit.org/show_bug.cgi?id=218389 Reviewed by Eric Carlson. From testing, 3 seconds is not always enough if getUserMedia is quickly called multiple times. Let's increase to 30 seconds to give room for slow systems while still being able to identify failures. * platform/mediastream/mac/AVVideoCaptureSource.h: 2020-12-01 Alan Coon Cherry-pick r269954. rdar://problem/71836563 RenderTreeBuilderBlock using an incorrect anonymous parent to attach a new renderer https://bugs.webkit.org/show_bug.cgi?id=218505 Reviewed by Antti Koivisto. Let's consider the following simplified render tree: PARENT |___beforeChildAnonymousContainer |___hierarchy of anonymous blocks |___beforeChild When RenderTreeBuilderBlock is attaching a new renderer given PARENT and beforeChild, it first tries to attach it to the PARENT if beforeChild is a direct child of PARENT. Otherwise it assumes that beforeChild is the direct child of an anonymous block which is in between PARENT and beforeChild. However in some cases, as the one presented above, beforeChild might have a whole hierarchy of anonymous blocks in between. That's why we cannot assume that beforeChild->parent() is a direct child of PARENT. Instead we should use beforeChildAnonymousContainer as the parent of the new renderer. * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation): Use beforeChildAnonymousContainer instead of beforeChild->parent(). git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269954 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-11-17 Sergio Villar Senin RenderTreeBuilderBlock using an incorrect anonymous parent to attach a new renderer https://bugs.webkit.org/show_bug.cgi?id=218505 Reviewed by Antti Koivisto. Let's consider the following simplified render tree: PARENT |___beforeChildAnonymousContainer |___hierarchy of anonymous blocks |___beforeChild When RenderTreeBuilderBlock is attaching a new renderer given PARENT and beforeChild, it first tries to attach it to the PARENT if beforeChild is a direct child of PARENT. Otherwise it assumes that beforeChild is the direct child of an anonymous block which is in between PARENT and beforeChild. However in some cases, as the one presented above, beforeChild might have a whole hierarchy of anonymous blocks in between. That's why we cannot assume that beforeChild->parent() is a direct child of PARENT. Instead we should use beforeChildAnonymousContainer as the parent of the new renderer. * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation): Use beforeChildAnonymousContainer instead of beforeChild->parent(). 2020-12-01 Alan Coon Cherry-pick r269695. rdar://problem/71836652 Protect ScheduledURLNavigation member https://bugs.webkit.org/show_bug.cgi?id=218593 Patch by Rob Buis on 2020-11-11 Reviewed by Alex Christensen. Protect ScheduledURLNavigation member m_url by using a copy since ScheduledURLNavigation itself is not protected and may be cancelled (and thus deleted) just at the time it is sending a message to the UIProcess which encodes the passed m_url member variable. * loader/NavigationScheduler.cpp: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269695 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-11-11 Rob Buis Protect ScheduledURLNavigation member https://bugs.webkit.org/show_bug.cgi?id=218593 Reviewed by Alex Christensen. Protect ScheduledURLNavigation member m_url by using a copy since ScheduledURLNavigation itself is not protected and may be cancelled (and thus deleted) just at the time it is sending a message to the UIProcess which encodes the passed m_url member variable. * loader/NavigationScheduler.cpp: 2020-11-16 Russell Epstein Cherry-pick r268979. rdar://problem/71446613 Use a WeakHashSet for Document::m_captionPreferencesChangedElements https://bugs.webkit.org/show_bug.cgi?id=218170 Reviewed by Eric Carlson. Source/WebCore: Refactoring to move from raw pointer to weak pointer. For that purpose, we use WeakHashSet and WeakHashSet::forEach for extra safety. No observable change of behavior. * dom/Document.cpp: (WebCore::Document::registerForCaptionPreferencesChangedCallbacks): (WebCore::Document::unregisterForCaptionPreferencesChangedCallbacks): (WebCore::Document::captionPreferencesChanged): * dom/Document.h: Source/WTF: * wtf/WeakHashSet.h: Add a static cast for classes inheriting CanMakeWeakPtr like done for the set iterator. Update code to compile in WinCairo. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268979 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-26 Youenn Fablet Use a WeakHashSet for Document::m_captionPreferencesChangedElements https://bugs.webkit.org/show_bug.cgi?id=218170 Reviewed by Eric Carlson. Refactoring to move from raw pointer to weak pointer. For that purpose, we use WeakHashSet and WeakHashSet::forEach for extra safety. No observable change of behavior. * dom/Document.cpp: (WebCore::Document::registerForCaptionPreferencesChangedCallbacks): (WebCore::Document::unregisterForCaptionPreferencesChangedCallbacks): (WebCore::Document::captionPreferencesChanged): * dom/Document.h: 2020-11-13 Russell Epstein Cherry-pick r269384. rdar://problem/71381924 REGRESSION (r257839): Miscomputed style due to computed 'rem' value in matched declaration cache https://bugs.webkit.org/show_bug.cgi?id=218561 Reviewed by Zalan Bujtas. Source/WebCore: Test: fast/dom/focus-rem-style-update.html Call to focus() causes computed style update for the element’s ancestor chain before the the document has otherwise been styled (using the shortcut mechanism introduced in r257839). This style, which uses ‘rem’ unit and so depends on root element font size, gets cached in MatchedDeclarationsCache. The root font size then changes but during the resulting style update we use this cached value, failing to re-resolve ‘rem’. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveElement): Invalidate matched declarations cache also when there is no existing document element style. LayoutTests: * fast/dom/focus-rem-style-update-expected.html: Added. * fast/dom/focus-rem-style-update.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269384 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-11-04 Antti Koivisto REGRESSION (r257839): Miscomputed style due to computed 'rem' value in matched declaration cache https://bugs.webkit.org/show_bug.cgi?id=218561 Reviewed by Zalan Bujtas. Test: fast/dom/focus-rem-style-update.html Call to focus() causes computed style update for the element’s ancestor chain before the the document has otherwise been styled (using the shortcut mechanism introduced in r257839). This style, which uses ‘rem’ unit and so depends on root element font size, gets cached in MatchedDeclarationsCache. The root font size then changes but during the resulting style update we use this cached value, failing to re-resolve ‘rem’. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveElement): Invalidate matched declarations cache also when there is no existing document element style. 2020-11-13 Russell Epstein Cherry-pick r269321. rdar://problem/71083861 Protect against HTMLMediaElement being destroyed during disptachEvent(). https://bugs.webkit.org/show_bug.cgi?id=218398 Reviewed by Chris Dumez. Make the MainThreadGenericEventQueue protect the target as well as the owner of the queue. Drive-by fix: Create the scoped `eventFiringScope` object after the `protect` object, to ensure that the member variable set by the first scope will safely occur. Drive-by fix #2: Also null-check the result of document().page() within HTMLMediaElement::dispatchEvent(). * dom/GenericEventQueue.cpp: (WebCore::MainThreadGenericEventQueue::dispatchOneEvent): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::dispatchEvent): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269321 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-11-03 Jer Noble Protect against HTMLMediaElement being destroyed during disptachEvent(). https://bugs.webkit.org/show_bug.cgi?id=218398 Reviewed by Chris Dumez. Make the MainThreadGenericEventQueue protect the target as well as the owner of the queue. Drive-by fix: Create the scoped `eventFiringScope` object after the `protect` object, to ensure that the member variable set by the first scope will safely occur. Drive-by fix #2: Also null-check the result of document().page() within HTMLMediaElement::dispatchEvent(). * dom/GenericEventQueue.cpp: (WebCore::MainThreadGenericEventQueue::dispatchOneEvent): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::dispatchEvent): 2020-11-13 Russell Epstein Cherry-pick r269208. rdar://problem/71378171 AX: Incorrect list of voices being displayed on iOS https://bugs.webkit.org/show_bug.cgi?id=218293 Reviewed by Per Arne Vollan. Source/WebCore: Limit the voices that we display in WebSpeech to only built-in system voices. This was the intention of the "compact" decision, but some mobile assets have compact voices, which are not available WebContent. * platform/ios/PlatformSpeechSynthesizerIOS.mm: (WebCore::PlatformSpeechSynthesizer::initializeVoiceList): Source/WebCore/PAL: * PAL.xcodeproj/project.pbxproj: * pal/PlatformMac.cmake: * pal/spi/cocoa/AXSpeechManagerSPI.h: Added. Source/WTF: * wtf/PlatformHave.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269208 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-30 Chris Fleizach AX: Incorrect list of voices being displayed on iOS https://bugs.webkit.org/show_bug.cgi?id=218293 Reviewed by Per Arne Vollan. Limit the voices that we display in WebSpeech to only built-in system voices. This was the intention of the "compact" decision, but some mobile assets have compact voices, which are not available WebContent. * platform/ios/PlatformSpeechSynthesizerIOS.mm: (WebCore::PlatformSpeechSynthesizer::initializeVoiceList): 2020-11-13 Russell Epstein Cherry-pick r269121. rdar://problem/71381839 [MSE] Handle trackId changing across Initialization Segments https://bugs.webkit.org/show_bug.cgi?id=218294 Reviewed by Eric Carlson. Source/WebCore: Test: media/media-source/media-source-trackid-change.html When appending an initialization segment after the receivedFirstInitializationSegment flag is true, and when the number of video or audio tracks is 1, the trackId is allowed to change across initialiaztion segments. When this occurs, move the TrackBuffer inside the trackBufferMap to refer to the new trackId, so that when MediaSamples are parsed, they're put into the correct TrackBuffer. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment): * html/track/AudioTrack.cpp: (WebCore::AudioTrack::setPrivate): * html/track/InbandTextTrack.cpp: (WebCore::InbandTextTrack::setPrivate): * html/track/VideoTrack.cpp: (WebCore::VideoTrack::setPrivate): LayoutTests: * media/media-source/media-source-trackid-change-expected.txt: Added. * media/media-source/media-source-trackid-change.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269121 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-28 Jer Noble [MSE] Handle trackId changing across Initialization Segments https://bugs.webkit.org/show_bug.cgi?id=218294 Reviewed by Eric Carlson. Test: media/media-source/media-source-trackid-change.html When appending an initialization segment after the receivedFirstInitializationSegment flag is true, and when the number of video or audio tracks is 1, the trackId is allowed to change across initialiaztion segments. When this occurs, move the TrackBuffer inside the trackBufferMap to refer to the new trackId, so that when MediaSamples are parsed, they're put into the correct TrackBuffer. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment): * html/track/AudioTrack.cpp: (WebCore::AudioTrack::setPrivate): * html/track/InbandTextTrack.cpp: (WebCore::InbandTextTrack::setPrivate): * html/track/VideoTrack.cpp: (WebCore::VideoTrack::setPrivate): 2020-11-13 Russell Epstein Cherry-pick r268782. rdar://problem/71381941 Release assert in ~Node due to render element of pseudo element not getting removed in time https://bugs.webkit.org/show_bug.cgi?id=217996 Patch by Julian Gonzalez on 2020-10-20 Reviewed by Ryosuke Niwa. When attaching a shadow root to an element, remember to tear down renderers not only if one exists on the element, but also if it uses display: contents. * dom/Element.cpp: (WebCore::Element::addShadowRoot): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268782 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-20 Julian Gonzalez Release assert in ~Node due to render element of pseudo element not getting removed in time https://bugs.webkit.org/show_bug.cgi?id=217996 Reviewed by Ryosuke Niwa. When attaching a shadow root to an element, remember to tear down renderers not only if one exists on the element, but also if it uses display: contents. * dom/Element.cpp: (WebCore::Element::addShadowRoot): 2020-11-13 Russell Epstein Cherry-pick r266052. rdar://problem/71378190 RTCRtpSynchronizationSource.rtpTimestamp is not present https://bugs.webkit.org/show_bug.cgi?id=215722 Patch by Justin Uberti on 2020-08-24 Reviewed by Youenn Fablet. LayoutTests/imported/w3c: Updated expectations file to indicate that tests checking for .rtpTimestamp now pass. * LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpReceiver-getSynchronizationSources.https-expected.txt: Source/WebCore: Updated expected results in LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpReceiver-getSynchronizationSources.https-expected.txt. * Modules/mediastream/RTCRtpContributingSource.idl: * Modules/mediastream/RTCRtpContributingSource.idl: * Modules/mediastream/RTCRtpSynchronizationSource.idl: Minor modification to ensure JSRTCRtpSynchronizationSource.cpp gets regenerated. * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.cpp: (WebCore::fillRTCRtpContributingSource): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266052 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-24 Justin Uberti RTCRtpSynchronizationSource.rtpTimestamp is not present https://bugs.webkit.org/show_bug.cgi?id=215722 Reviewed by Youenn Fablet. Updated expected results in LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpReceiver-getSynchronizationSources.https-expected.txt. * Modules/mediastream/RTCRtpContributingSource.idl: * Modules/mediastream/RTCRtpContributingSource.idl: * Modules/mediastream/RTCRtpSynchronizationSource.idl: Minor modification to ensure JSRTCRtpSynchronizationSource.cpp gets regenerated. * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.cpp: (WebCore::fillRTCRtpContributingSource): 2020-11-04 Kocsen Chung Revert r269190. rdar://problem/70970247 2020-11-04 Alan Coon Cherry-pick r269025. rdar://problem/70970161 REGRESSION (r268386): Flashes of inverted color when zooming the map on windy.com https://bugs.webkit.org/show_bug.cgi?id=218177 Patch by Kimmo Kinnunen on 2020-10-27 Reviewed by Dean Jackson. Source/WebCore: Refactoring r268386 changed the behavior so that a new WebGL drawing buffer would be created when CA would be using the oldest IOSurface display buffer of the WebGL layer. Before r268386 the WebGL would just draw on top of the IOSurface even if CA was using it. This change made the existing bug of using uninitialized IOSurfaces visible, since IOSurfaces seem to be initialized with red. The existing bug was probably in r262366. The fix in this commit fixes the case where WebGL context is drawn to but the CA does not display the contents. Draw would cause preparation of the drawing buffer for display, along with the contract that drawing buffer might be uninitialized. However, the clear of the drawing buffer was marked needed only during display. Case that failed at the time of writing was the case where after draw, the element would be removed by setting display:none. This would return red contents, e.g. uninitialized IOSurface contents. Before r268386 this would first return red until 3 buffers had passed and then it would start recycling old display buffer contents. The naming is not fixed in this commit due to just fixing the regression. Other ports contain code that makes renaming or restructuring the callbacks more confusing for the other ports. Test: fast/canvas/webgl/webgl-clear-composited-notshowing.html * WebCore.xcodeproj/project.pbxproj: * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::prepareForDisplay): * platform/graphics/cocoa/WebGLLayer.h: * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer initWithDevicePixelRatio:contentsOpaque:]): (-[WebGLLayer display]): (-[WebGLLayer detachClient]): * platform/graphics/cocoa/WebGLLayerClient.h: Removed. * platform/graphics/opengl/GraphicsContextGLOpenGL.h: LayoutTests: Test case for WebGL which is drawn to a canvas that is not visible. This should still adhere to preserveDrawingBuffer == false contract of clearing the drawing buffer correctly. Case that failed at the time of writing was the case where after draw, the element would be removed by setting display:none. * fast/canvas/webgl/webgl-clear-composited-notshowing-expected.txt: Added. * fast/canvas/webgl/webgl-clear-composited-notshowing.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269025 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-27 Kimmo Kinnunen REGRESSION (r268386): Flashes of inverted color when zooming the map on windy.com https://bugs.webkit.org/show_bug.cgi?id=218177 Reviewed by Dean Jackson. Refactoring r268386 changed the behavior so that a new WebGL drawing buffer would be created when CA would be using the oldest IOSurface display buffer of the WebGL layer. Before r268386 the WebGL would just draw on top of the IOSurface even if CA was using it. This change made the existing bug of using uninitialized IOSurfaces visible, since IOSurfaces seem to be initialized with red. The existing bug was probably in r262366. The fix in this commit fixes the case where WebGL context is drawn to but the CA does not display the contents. Draw would cause preparation of the drawing buffer for display, along with the contract that drawing buffer might be uninitialized. However, the clear of the drawing buffer was marked needed only during display. Case that failed at the time of writing was the case where after draw, the element would be removed by setting display:none. This would return red contents, e.g. uninitialized IOSurface contents. Before r268386 this would first return red until 3 buffers had passed and then it would start recycling old display buffer contents. The naming is not fixed in this commit due to just fixing the regression. Other ports contain code that makes renaming or restructuring the callbacks more confusing for the other ports. Test: fast/canvas/webgl/webgl-clear-composited-notshowing.html * WebCore.xcodeproj/project.pbxproj: * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::prepareForDisplay): * platform/graphics/cocoa/WebGLLayer.h: * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer initWithDevicePixelRatio:contentsOpaque:]): (-[WebGLLayer display]): (-[WebGLLayer detachClient]): * platform/graphics/cocoa/WebGLLayerClient.h: Removed. * platform/graphics/opengl/GraphicsContextGLOpenGL.h: 2020-11-04 Alan Coon Cherry-pick r268446. rdar://problem/70970178 REGRESSION: fast/canvas/webgl/context-attributes-alpha.html fails https://bugs.webkit.org/show_bug.cgi?id=217697 Patch by Kimmo Kinnunen on 2020-10-14 Reviewed by Antti Koivisto. The original work in "Cocoa: Make WebGLLayer not dependent on GraphicsContextGLOpenGL" was missing the hunk to initialize WebGLLayer contentsOpaque. Neither the EWS nor the local testing used the test case. No new tests, tested by fast/canvas/webgl/context-attributes-alpha.html. * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): * platform/graphics/cocoa/WebGLLayer.h: * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer initWithClient:devicePixelRatio:contentsOpaque:]): (-[WebGLLayer initWithClient:devicePixelRatio:]): Deleted. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268446 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-14 Kimmo Kinnunen REGRESSION: fast/canvas/webgl/context-attributes-alpha.html fails https://bugs.webkit.org/show_bug.cgi?id=217697 Reviewed by Antti Koivisto. The original work in "Cocoa: Make WebGLLayer not dependent on GraphicsContextGLOpenGL" was missing the hunk to initialize WebGLLayer contentsOpaque. Neither the EWS nor the local testing used the test case. No new tests, tested by fast/canvas/webgl/context-attributes-alpha.html. * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): * platform/graphics/cocoa/WebGLLayer.h: * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer initWithClient:devicePixelRatio:contentsOpaque:]): (-[WebGLLayer initWithClient:devicePixelRatio:]): Deleted. 2020-11-04 Alan Coon Cherry-pick r268386. rdar://problem/70970067 Cocoa: Make WebGLLayer not dependent on GraphicsContextGLOpenGL https://bugs.webkit.org/show_bug.cgi?id=217212 Patch by Kimmo Kinnunen on 2020-10-13 Reviewed by Dean Jackson. Source/WebCore: WebGLLayer was needlessly using GraphicsContextGLOpenGL. This is problematic because WebGLLayer should work with upcoming remote GraphicsContextGL implementation. The prepare callgraph was: GCGLOpenGL -> WebGLLayer -> GCGLOpenGL Refactor it to be: GCGLOpenGL -> WebGLLayer Move the back buffer ownership to the GraphicsContextGLOpenGL. Make the front buffer ownership explicit in WebGLLayer. Move the EGL bindings ownerships of all buffers to GraphicsContextGLOpenGL. Make the WebGLLayer not use EGL or OpenGL, it does not need and cannot use it as not all of its clients use OpenGL (i.e. the above mentioned remote use-case). Improves the memory usage by not allocating front buffers unless needed. In case the canvas does not present, will not allocate front buffers at all. Improves error handling of the allocations and EGL bindings. No new tests, a refactor. * WebCore.xcodeproj/project.pbxproj: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::reshapeFBOs): (WebCore::GraphicsContextGLOpenGL::prepareTexture): (WebCore::GraphicsContextGLOpenGL::prepareTextureImpl): * platform/graphics/angle/GraphicsContextGLANGLEUtilities.h: Added. (WebCore::ScopedRestoreTextureBinding::ScopedRestoreTextureBinding): (WebCore::ScopedRestoreTextureBinding::~ScopedRestoreTextureBinding): * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::makeContextCurrent): (WebCore::GraphicsContextGLOpenGL::reshapeDisplayBufferBacking): (WebCore::GraphicsContextGLOpenGL::bindDisplayBufferBacking): (WebCore::GraphicsContextGLOpenGL::prepareForDisplay): (WebCore::GraphicsContextGLOpenGL::didDisplay): * platform/graphics/cocoa/WebGLLayer.h: * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer initWithClient:devicePixelRatio:]): (-[WebGLLayer copyImageSnapshotWithColorSpace:]): (-[WebGLLayer recycleBuffer]): (-[WebGLLayer prepareForDisplayWithContents:]): (-[WebGLLayer display]): (-[WebGLLayer detachClient]): * platform/graphics/cocoa/WebGLLayerClient.h: Copied from Source/WebCore/platform/graphics/cocoa/WebGLLayer.h. (WebCore::WebGLLayerClient::~WebGLLayerClient): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp: (WebCore::GraphicsContextGLOpenGL::reshapeFBOs): Source/WebKit: Removed unneeded inclusions of GraphicsContextGLOpenGL.h. The file is now using non-public headers. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/mac/WebPageMac.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268386 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-13 Kimmo Kinnunen Cocoa: Make WebGLLayer not dependent on GraphicsContextGLOpenGL https://bugs.webkit.org/show_bug.cgi?id=217212 Reviewed by Dean Jackson. WebGLLayer was needlessly using GraphicsContextGLOpenGL. This is problematic because WebGLLayer should work with upcoming remote GraphicsContextGL implementation. The prepare callgraph was: GCGLOpenGL -> WebGLLayer -> GCGLOpenGL Refactor it to be: GCGLOpenGL -> WebGLLayer Move the back buffer ownership to the GraphicsContextGLOpenGL. Make the front buffer ownership explicit in WebGLLayer. Move the EGL bindings ownerships of all buffers to GraphicsContextGLOpenGL. Make the WebGLLayer not use EGL or OpenGL, it does not need and cannot use it as not all of its clients use OpenGL (i.e. the above mentioned remote use-case). Improves the memory usage by not allocating front buffers unless needed. In case the canvas does not present, will not allocate front buffers at all. Improves error handling of the allocations and EGL bindings. No new tests, a refactor. * WebCore.xcodeproj/project.pbxproj: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::reshapeFBOs): (WebCore::GraphicsContextGLOpenGL::prepareTexture): (WebCore::GraphicsContextGLOpenGL::prepareTextureImpl): * platform/graphics/angle/GraphicsContextGLANGLEUtilities.h: Added. (WebCore::ScopedRestoreTextureBinding::ScopedRestoreTextureBinding): (WebCore::ScopedRestoreTextureBinding::~ScopedRestoreTextureBinding): * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::makeContextCurrent): (WebCore::GraphicsContextGLOpenGL::reshapeDisplayBufferBacking): (WebCore::GraphicsContextGLOpenGL::bindDisplayBufferBacking): (WebCore::GraphicsContextGLOpenGL::prepareForDisplay): (WebCore::GraphicsContextGLOpenGL::didDisplay): * platform/graphics/cocoa/WebGLLayer.h: * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer initWithClient:devicePixelRatio:]): (-[WebGLLayer copyImageSnapshotWithColorSpace:]): (-[WebGLLayer recycleBuffer]): (-[WebGLLayer prepareForDisplayWithContents:]): (-[WebGLLayer display]): (-[WebGLLayer detachClient]): * platform/graphics/cocoa/WebGLLayerClient.h: Copied from Source/WebCore/platform/graphics/cocoa/WebGLLayer.h. (WebCore::WebGLLayerClient::~WebGLLayerClient): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp: (WebCore::GraphicsContextGLOpenGL::reshapeFBOs): 2020-11-04 Alan Coon Cherry-pick r268198. rdar://problem/70970161 Mac: Remove OpenGL and OpenGL ES backends https://bugs.webkit.org/show_bug.cgi?id=217374 Patch by Kimmo Kinnunen on 2020-10-08 Reviewed by Darin Adler. Remove macOS OpenGL (CGL) and iOS OpenGL ES (EAGL) implementations of GraphicsContextGLOpenGL. These are not used anymore and cannot be used for conformant WebGL. The two removed backends would just create maintainance burden. Removes TextureCacheCV, this was not implemented for ANGLE and in comments it was said to be disabled in the platform. Fixes a bug where iOS apps on Mac Apple Silicon would not use correct texture target to convert the video frames in VideoTextureCopierCV. Fixes few instances of using GL types in WebGL implementation instead of WebCore defined GCGL types. This is needed now that the includes are (a bit) more correct. No new tests, a refactoring. * PlatformMac.cmake: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * html/canvas/ANGLEInstancedArrays.cpp: (WebCore::ANGLEInstancedArrays::supported): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::create): (WebCore::WebGLRenderingContextBase::readPixels): * platform/graphics/GraphicsContextGL.cpp: * platform/graphics/GraphicsContextGL.h: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::reshapeFBOs): (WebCore::GraphicsContextGLOpenGL::paintRenderingResultsToCanvas): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::IOSurfaceTextureTarget): (WebCore::GraphicsContextGLOpenGL::IOSurfaceTextureTargetQuery): (WebCore::GraphicsContextGLOpenGL::EGLIOSurfaceTextureTarget): (WebCore::GraphicsContextGLOpenGL::makeContextCurrent): (WebCore::GraphicsContextGLOpenGL::checkGPUStatus): (WebCore::GraphicsContextGLOpenGL::setContextVisibility): (WebCore::GraphicsContextGLOpenGL::screenDidChange): * platform/graphics/cocoa/WebGLLayer.h: * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer initWithGraphicsContextGL:]): (-[WebGLLayer setAnchorPoint:]): (-[WebGLLayer copyImageSnapshotWithColorSpace:]): (-[WebGLLayer prepareForDisplay]): (-[WebGLLayer display]): (-[WebGLLayer releaseGLResources]): (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]): (-[WebGLLayer bindFramebufferToNextAvailableSurface]): * platform/graphics/cv/TextureCacheCV.h: Removed. * platform/graphics/cv/TextureCacheCV.mm: Removed. * platform/graphics/cv/VideoTextureCopierCV.cpp: (WebCore::VideoTextureCopierCV::initializeContextObjects): (WebCore::VideoTextureCopierCV::initializeUVContextObjects): (WebCore::VideoTextureCopierCV::attachIOSurfaceToTexture): (WebCore::VideoTextureCopierCV::detachIOSurfaceFromTexture): (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture): (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture): * platform/graphics/cv/VideoTextureCopierCV.h: * platform/graphics/ios/GraphicsContextGLOpenGLESIOS.h: Removed. * platform/graphics/opengl/ExtensionsGLOpenGL.cpp: (WebCore::ExtensionsGLOpenGL::blitFramebuffer): (WebCore::ExtensionsGLOpenGL::createVertexArrayOES): (WebCore::ExtensionsGLOpenGL::deleteVertexArrayOES): (WebCore::ExtensionsGLOpenGL::isVertexArrayOES): (WebCore::ExtensionsGLOpenGL::bindVertexArrayOES): (WebCore::ExtensionsGLOpenGL::supportsExtension): (WebCore::ExtensionsGLOpenGL::drawBuffersEXT): (WebCore::ExtensionsGLOpenGL::drawArraysInstanced): (WebCore::ExtensionsGLOpenGL::drawElementsInstanced): (WebCore::ExtensionsGLOpenGL::vertexAttribDivisor): * platform/graphics/opengl/ExtensionsGLOpenGL.h: * platform/graphics/opengl/ExtensionsGLOpenGLCommon.cpp: (WebCore::ExtensionsGLOpenGLCommon::initializeAvailableExtensions): * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp: (WebCore::GraphicsContextGLOpenGL::setContextVisibility): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp: (WebCore::GraphicsContextGLOpenGL::readPixelsAndConvertToBGRAIfNecessary): (WebCore::GraphicsContextGLOpenGL::reshapeFBOs): (WebCore::GraphicsContextGLOpenGL::resolveMultisamplingIfNecessary): (WebCore::GraphicsContextGLOpenGL::getIntegerv): (WebCore::GraphicsContextGLOpenGL::depthRange): (WebCore::GraphicsContextGLOpenGL::clearDepth): (WebCore::GraphicsContextGLOpenGL::getExtensions): (WebCore::GraphicsContextGLOpenGL::readPixels): * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp: (WebCore::GraphicsContextGLOpenGL::paintRenderingResultsToCanvas): (WebCore::GraphicsContextGLOpenGL::copyTexImage2D): (WebCore::GraphicsContextGLOpenGL::copyTexSubImage2D): (WebCore::GraphicsContextGLOpenGL::finish): (WebCore::GraphicsContextGLOpenGL::flush): (WebCore::GraphicsContextGLOpenGL::deleteTexture): * platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp: * platform/graphics/opengl/GraphicsContextGLOpenGLManager.cpp: (WebCore::GraphicsContextGLOpenGLManager::updateAllContexts): (WebCore::GraphicsContextGLOpenGLManager::updateHighPerformanceState): (WebCore::GraphicsContextGLOpenGLManager::disableHighPerformanceGPUTimerFired): * platform/graphics/opengl/GraphicsContextGLOpenGLManager.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268198 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-08 Kimmo Kinnunen Mac: Remove OpenGL and OpenGL ES backends https://bugs.webkit.org/show_bug.cgi?id=217374 Reviewed by Darin Adler. Remove macOS OpenGL (CGL) and iOS OpenGL ES (EAGL) implementations of GraphicsContextGLOpenGL. These are not used anymore and cannot be used for conformant WebGL. The two removed backends would just create maintainance burden. Removes TextureCacheCV, this was not implemented for ANGLE and in comments it was said to be disabled in the platform. Fixes a bug where iOS apps on Mac Apple Silicon would not use correct texture target to convert the video frames in VideoTextureCopierCV. Fixes few instances of using GL types in WebGL implementation instead of WebCore defined GCGL types. This is needed now that the includes are (a bit) more correct. No new tests, a refactoring. * PlatformMac.cmake: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * html/canvas/ANGLEInstancedArrays.cpp: (WebCore::ANGLEInstancedArrays::supported): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::create): (WebCore::WebGLRenderingContextBase::readPixels): * platform/graphics/GraphicsContextGL.cpp: * platform/graphics/GraphicsContextGL.h: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::reshapeFBOs): (WebCore::GraphicsContextGLOpenGL::paintRenderingResultsToCanvas): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::IOSurfaceTextureTarget): (WebCore::GraphicsContextGLOpenGL::IOSurfaceTextureTargetQuery): (WebCore::GraphicsContextGLOpenGL::EGLIOSurfaceTextureTarget): (WebCore::GraphicsContextGLOpenGL::makeContextCurrent): (WebCore::GraphicsContextGLOpenGL::checkGPUStatus): (WebCore::GraphicsContextGLOpenGL::setContextVisibility): (WebCore::GraphicsContextGLOpenGL::screenDidChange): * platform/graphics/cocoa/WebGLLayer.h: * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer initWithGraphicsContextGL:]): (-[WebGLLayer setAnchorPoint:]): (-[WebGLLayer copyImageSnapshotWithColorSpace:]): (-[WebGLLayer prepareForDisplay]): (-[WebGLLayer display]): (-[WebGLLayer releaseGLResources]): (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]): (-[WebGLLayer bindFramebufferToNextAvailableSurface]): * platform/graphics/cv/TextureCacheCV.h: Removed. * platform/graphics/cv/TextureCacheCV.mm: Removed. * platform/graphics/cv/VideoTextureCopierCV.cpp: (WebCore::VideoTextureCopierCV::initializeContextObjects): (WebCore::VideoTextureCopierCV::initializeUVContextObjects): (WebCore::VideoTextureCopierCV::attachIOSurfaceToTexture): (WebCore::VideoTextureCopierCV::detachIOSurfaceFromTexture): (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture): (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture): * platform/graphics/cv/VideoTextureCopierCV.h: * platform/graphics/ios/GraphicsContextGLOpenGLESIOS.h: Removed. * platform/graphics/opengl/ExtensionsGLOpenGL.cpp: (WebCore::ExtensionsGLOpenGL::blitFramebuffer): (WebCore::ExtensionsGLOpenGL::createVertexArrayOES): (WebCore::ExtensionsGLOpenGL::deleteVertexArrayOES): (WebCore::ExtensionsGLOpenGL::isVertexArrayOES): (WebCore::ExtensionsGLOpenGL::bindVertexArrayOES): (WebCore::ExtensionsGLOpenGL::supportsExtension): (WebCore::ExtensionsGLOpenGL::drawBuffersEXT): (WebCore::ExtensionsGLOpenGL::drawArraysInstanced): (WebCore::ExtensionsGLOpenGL::drawElementsInstanced): (WebCore::ExtensionsGLOpenGL::vertexAttribDivisor): * platform/graphics/opengl/ExtensionsGLOpenGL.h: * platform/graphics/opengl/ExtensionsGLOpenGLCommon.cpp: (WebCore::ExtensionsGLOpenGLCommon::initializeAvailableExtensions): * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp: (WebCore::GraphicsContextGLOpenGL::setContextVisibility): * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp: (WebCore::GraphicsContextGLOpenGL::readPixelsAndConvertToBGRAIfNecessary): (WebCore::GraphicsContextGLOpenGL::reshapeFBOs): (WebCore::GraphicsContextGLOpenGL::resolveMultisamplingIfNecessary): (WebCore::GraphicsContextGLOpenGL::getIntegerv): (WebCore::GraphicsContextGLOpenGL::depthRange): (WebCore::GraphicsContextGLOpenGL::clearDepth): (WebCore::GraphicsContextGLOpenGL::getExtensions): (WebCore::GraphicsContextGLOpenGL::readPixels): * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp: (WebCore::GraphicsContextGLOpenGL::paintRenderingResultsToCanvas): (WebCore::GraphicsContextGLOpenGL::copyTexImage2D): (WebCore::GraphicsContextGLOpenGL::copyTexSubImage2D): (WebCore::GraphicsContextGLOpenGL::finish): (WebCore::GraphicsContextGLOpenGL::flush): (WebCore::GraphicsContextGLOpenGL::deleteTexture): * platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp: * platform/graphics/opengl/GraphicsContextGLOpenGLManager.cpp: (WebCore::GraphicsContextGLOpenGLManager::updateAllContexts): (WebCore::GraphicsContextGLOpenGLManager::updateHighPerformanceState): (WebCore::GraphicsContextGLOpenGLManager::disableHighPerformanceGPUTimerFired): * platform/graphics/opengl/GraphicsContextGLOpenGLManager.h: 2020-11-04 Alan Coon Cherry-pick r266840. rdar://70970161 * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::validateTexFuncLayer): (WebCore::WebGL2RenderingContext::compressedTexSubImage2D): (WebCore::WebGL2RenderingContext::clientWaitSync): (WebCore::ValidateTransformFeedbackPrimitiveMode): (WebCore::WebGL2RenderingContext::getActiveUniformBlockParameter): (WebCore::WebGL2RenderingContext::getParameter): (WebCore::WebGL2RenderingContext::validateClearBuffer): (WebCore::WebGL2RenderingContext::uniform1fv): (WebCore::WebGL2RenderingContext::uniform2fv): (WebCore::WebGL2RenderingContext::uniform3fv): (WebCore::WebGL2RenderingContext::uniform4fv): (WebCore::WebGL2RenderingContext::uniform1iv): (WebCore::WebGL2RenderingContext::uniform2iv): (WebCore::WebGL2RenderingContext::uniform3iv): (WebCore::WebGL2RenderingContext::uniform4iv): (WebCore::WebGL2RenderingContext::uniformMatrix2fv): (WebCore::WebGL2RenderingContext::uniformMatrix3fv): (WebCore::WebGL2RenderingContext::uniformMatrix4fv): (WebCore::WebGL2RenderingContext::readPixels): * html/canvas/WebGL2RenderingContext.h: * platform/graphics/GraphicsContextGL.h: 2020-09-10 Don Olmstead WebGL2RenderingContext should use Graphics Context types https://bugs.webkit.org/show_bug.cgi?id=216310 Reviewed by Kenneth Russell. A number of declarations were using OpenGL types instead of the GCGL types. All instances of GL types were replaced with the equivalent GCGL ones. Any GL constants were replaced with the listing in GraphicsContext. Renamed GraphcsContext::WAIT_FAILED to WAIT_FAILED_WEBGL to remove PLATFORM(WIN) defining its own variant WAIT_FAILED_WIN. WAIT_FAILED conflicts with a Windows definition. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::validateTexFuncLayer): (WebCore::WebGL2RenderingContext::compressedTexSubImage2D): (WebCore::WebGL2RenderingContext::clientWaitSync): (WebCore::ValidateTransformFeedbackPrimitiveMode): (WebCore::WebGL2RenderingContext::getActiveUniformBlockParameter): (WebCore::WebGL2RenderingContext::getParameter): (WebCore::WebGL2RenderingContext::validateClearBuffer): (WebCore::WebGL2RenderingContext::uniform1fv): (WebCore::WebGL2RenderingContext::uniform2fv): (WebCore::WebGL2RenderingContext::uniform3fv): (WebCore::WebGL2RenderingContext::uniform4fv): (WebCore::WebGL2RenderingContext::uniform1iv): (WebCore::WebGL2RenderingContext::uniform2iv): (WebCore::WebGL2RenderingContext::uniform3iv): (WebCore::WebGL2RenderingContext::uniform4iv): (WebCore::WebGL2RenderingContext::uniformMatrix2fv): (WebCore::WebGL2RenderingContext::uniformMatrix3fv): (WebCore::WebGL2RenderingContext::uniformMatrix4fv): (WebCore::WebGL2RenderingContext::readPixels): * html/canvas/WebGL2RenderingContext.h: * platform/graphics/GraphicsContextGL.h: 2020-11-02 Alan Coon Cherry-pick r269190. rdar://problem/70970247 Increase camera failing timer to 30 seconds https://bugs.webkit.org/show_bug.cgi?id=218389 Reviewed by Eric Carlson. From testing, 3 seconds is not always enough if getUserMedia is quickly called multiple times. Let's increase to 30 seconds to give room for slow systems while still being able to identify failures. * platform/mediastream/mac/AVVideoCaptureSource.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269190 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-30 Youenn Fablet Increase camera failing timer to 30 seconds https://bugs.webkit.org/show_bug.cgi?id=218389 Reviewed by Eric Carlson. From testing, 3 seconds is not always enough if getUserMedia is quickly called multiple times. Let's increase to 30 seconds to give room for slow systems while still being able to identify failures. * platform/mediastream/mac/AVVideoCaptureSource.h: 2020-11-02 Alan Coon Cherry-pick r266364. rdar://problem/70970205 Implement WEBGL_compressed_texture_s3tc_srgb extension https://bugs.webkit.org/show_bug.cgi?id=215973 Patch by James Darpinian on 2020-08-31 Reviewed by Dean Jackson. Source/ThirdParty/ANGLE: * src/libANGLE/renderer/gl/formatutilsgl.cpp: (rx::nativegl::ExtAndVersionOrExt): (rx::nativegl::BuildInternalFormatInfoMap): Source/WebCore: Tested by webgl/2.0.0/conformance/extensions/webgl-compressed-texture-s3tc-srgb.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMConvertWebGL.cpp: (WebCore::convertToJSValue): * html/canvas/WebGLCompressedTextureS3TCsRGB.cpp: Added. (WebCore::WebGLCompressedTextureS3TCsRGB::WebGLCompressedTextureS3TCsRGB): (WebCore::WebGLCompressedTextureS3TCsRGB::getName const): (WebCore::WebGLCompressedTextureS3TCsRGB::supported): * html/canvas/WebGLCompressedTextureS3TCsRGB.h: Added. * html/canvas/WebGLCompressedTextureS3TCsRGB.idl: Added. * html/canvas/WebGLExtension.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::getExtension): (WebCore::WebGLRenderingContext::getSupportedExtensions): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::extensionIsEnabled): (WebCore::WebGLRenderingContextBase::validateCompressedTexFuncData): (WebCore::WebGLRenderingContextBase::validateCompressedTexDimensions): (WebCore::WebGLRenderingContextBase::validateCompressedTexSubDimensions): * html/canvas/WebGLRenderingContextBase.h: * platform/graphics/ExtensionsGL.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266364 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-31 James Darpinian Implement WEBGL_compressed_texture_s3tc_srgb extension https://bugs.webkit.org/show_bug.cgi?id=215973 Reviewed by Dean Jackson. Tested by webgl/2.0.0/conformance/extensions/webgl-compressed-texture-s3tc-srgb.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMConvertWebGL.cpp: (WebCore::convertToJSValue): * html/canvas/WebGLCompressedTextureS3TCsRGB.cpp: Added. (WebCore::WebGLCompressedTextureS3TCsRGB::WebGLCompressedTextureS3TCsRGB): (WebCore::WebGLCompressedTextureS3TCsRGB::getName const): (WebCore::WebGLCompressedTextureS3TCsRGB::supported): * html/canvas/WebGLCompressedTextureS3TCsRGB.h: Added. * html/canvas/WebGLCompressedTextureS3TCsRGB.idl: Added. * html/canvas/WebGLExtension.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::getExtension): (WebCore::WebGLRenderingContext::getSupportedExtensions): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::extensionIsEnabled): (WebCore::WebGLRenderingContextBase::validateCompressedTexFuncData): (WebCore::WebGLRenderingContextBase::validateCompressedTexDimensions): (WebCore::WebGLRenderingContextBase::validateCompressedTexSubDimensions): * html/canvas/WebGLRenderingContextBase.h: * platform/graphics/ExtensionsGL.h: 2020-11-02 Alan Coon Cherry-pick r266362. rdar://problem/70970398 WebGL goes in a bad state where glContext.createProgram() returns null https://bugs.webkit.org/show_bug.cgi?id=215844 Patch by James Darpinian on 2020-08-31 Reviewed by Kenneth Russell. Added test webgl/2.0.0/conformance/canvas/render-after-resize-test.html * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::reshape): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266362 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-08-31 James Darpinian WebGL goes in a bad state where glContext.createProgram() returns null https://bugs.webkit.org/show_bug.cgi?id=215844 Reviewed by Kenneth Russell. Added test webgl/2.0.0/conformance/canvas/render-after-resize-test.html * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::reshape): 2020-10-29 Russell Epstein Cherry-pick r269118. rdar://problem/70795320 macCatalyst WebGL on Apple Silicon devices is using a software renderer https://bugs.webkit.org/show_bug.cgi?id=218303 Reviewed by Geoffrey Garen. Source/ThirdParty/ANGLE: * src/gpu_info_util/SystemInfo.h: * src/gpu_info_util/SystemInfo_apple.mm: (angle::GetSystemInfo): We can just use the macOS version of GetSystemInfo in macCatalyst. * src/gpu_info_util/SystemInfo_macos.mm: (angle::GetSystemInfo_mac): * src/libANGLE/Display.cpp: * src/libANGLE/formatutils.cpp: (gl::BuildInternalFormatInfoMap): * src/libANGLE/renderer/gl/renderergl_utils.cpp: (rx::nativegl_gl::GenerateCaps): It turns out we must use EAGL in macCatalyst on Apple Silicon in all cases, not just in-process in iOS apps (the problem is not just about coexistence of the two GLs, but actually about our ability to load the accelerated renderer /at all/ in macCatalyst processes). I left the runtime switching in place, because there is a future in which we /can/ use CGL in non-iOS-app processes, but that future is not now. Source/WebCore: * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::needsEAGLOnMac): (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::IOSurfaceTextureTarget): (WebCore::GraphicsContextGLOpenGL::IOSurfaceTextureTargetQuery): (WebCore::GraphicsContextGLOpenGL::EGLIOSurfaceTextureTarget): (WebCore::isiOSAppOnMac): Deleted. See ANGLE ChangeLog. Source/WebKit: * UIProcess/mac/HighPerformanceGPUManager.mm: (WebKit::HighPerformanceGPUManager::addProcessRequiringHighPerformance): (WebKit::HighPerformanceGPUManager::removeProcessRequiringHighPerformance): (WebKit::HighPerformanceGPUManager::updateState): (WebKit::isiOSAppOnMac): Deleted. HighPerformanceGPUManager is PLATFORM(MAC)-only, which is not true for MACCATALYST, so delete this dead code. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269118 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-28 Tim Horton macCatalyst WebGL on Apple Silicon devices is using a software renderer https://bugs.webkit.org/show_bug.cgi?id=218303 Reviewed by Geoffrey Garen. * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::needsEAGLOnMac): (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::IOSurfaceTextureTarget): (WebCore::GraphicsContextGLOpenGL::IOSurfaceTextureTargetQuery): (WebCore::GraphicsContextGLOpenGL::EGLIOSurfaceTextureTarget): (WebCore::isiOSAppOnMac): Deleted. See ANGLE ChangeLog. 2020-10-28 Russell Epstein Cherry-pick r268952. rdar://problem/70795327 [BigSur] Appending a new WebM init segment between Cluster elements throws an error https://bugs.webkit.org/show_bug.cgi?id=218149 Reviewed by Eric Carlson. Source/ThirdParty/libwebrtc: Add an "OnElementEnd()" callback to libwebm. * Source/third_party/libwebm/webm_parser/include/webm/callback.h: * Source/third_party/libwebm/webm_parser/src/callback.cc: * Source/third_party/libwebm/webm_parser/src/master_parser.cc: * Source/third_party/libwebm/webm_parser/src/webm_parser.cc: Source/WebCore: Test: media/media-source/media-source-webm-init-inside-segment.html The WebM Byte Stream Format specification states that an "initialization segment" consists of both a leading Ebml element and Segment element, and a "media segment" consists of a single Cluster element. However, while both Ebml and Segment elements are top-level, Cluster elements are contained within a Segment. This means if a client pushes a new "initialization segment" after parsing some-but-not-all Clusters within a Segment, the new Ebml and Segment elements will be parsed as children of the preceeding Segment, and the subsquent Segment will overflow its "parent's" size. In order to support appending a new "initialization segment" while still in the middle of parsing the previous Segment element, first improve our state tracking in order to determine what the current parent element is. Then, when we detect that an Ebml element is parsed while still inside a Segment, abort with a simulated error, which when caught, will indicate that the parser needs to be reset, and the reader "rewound" to the Ebml's position. To allow the reader to rewind, we must not throw away appended data as we iterate over them. Instead, we will only discard read samples once each parsing pass is fully complete. This allows us to "rewind" across appended segment boundaries, if necessary. Because all WTF::Deque iterators are invalidated whenever any element is removed, and because we do not need random-access to the elements in the deque, replace the Deque with a StdList to store the incoming data. * platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.h: * platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.mm: (WebCore::SourceBufferParserAVFObjC::setLogger): * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC): * platform/graphics/cocoa/SourceBufferParser.h: * platform/graphics/cocoa/SourceBufferParserWebM.cpp: (WTF::LogArgument::toString): (WTF::LogArgument::toString): (WebCore::logChannel): (WebCore::logClassName): (WebCore::SourceBufferParserWebM::appendData): (WebCore::SourceBufferParserWebM::resetParserState): (WebCore::SourceBufferParserWebM::invalidate): (WebCore::SourceBufferParserWebM::setLogger): (WebCore::SourceBufferParserWebM::OnElementBegin): (WebCore::SourceBufferParserWebM::OnElementEnd): (WebCore::SourceBufferParserWebM::OnEbml): (WebCore::SourceBufferParserWebM::OnSegmentBegin): (WebCore::SourceBufferParserWebM::OnInfo): (WebCore::SourceBufferParserWebM::OnTrackEntry): * platform/graphics/cocoa/SourceBufferParserWebM.h: LayoutTests: * media/media-source/content/test-vp9-long-manifest.json: Added. * media/media-source/content/test-vp9-long.webm: Added. * media/media-source/media-source-webm-init-inside-segment-expected.txt: Added. * media/media-source/media-source-webm-init-inside-segment.html: Added. * platform/mac/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268952 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-24 Jer Noble [BigSur] Appending a new WebM init segment between Cluster elements throws an error https://bugs.webkit.org/show_bug.cgi?id=218149 Reviewed by Eric Carlson. Test: media/media-source/media-source-webm-init-inside-segment.html The WebM Byte Stream Format specification states that an "initialization segment" consists of both a leading Ebml element and Segment element, and a "media segment" consists of a single Cluster element. However, while both Ebml and Segment elements are top-level, Cluster elements are contained within a Segment. This means if a client pushes a new "initialization segment" after parsing some-but-not-all Clusters within a Segment, the new Ebml and Segment elements will be parsed as children of the preceeding Segment, and the subsquent Segment will overflow its "parent's" size. In order to support appending a new "initialization segment" while still in the middle of parsing the previous Segment element, first improve our state tracking in order to determine what the current parent element is. Then, when we detect that an Ebml element is parsed while still inside a Segment, abort with a simulated error, which when caught, will indicate that the parser needs to be reset, and the reader "rewound" to the Ebml's position. To allow the reader to rewind, we must not throw away appended data as we iterate over them. Instead, we will only discard read samples once each parsing pass is fully complete. This allows us to "rewind" across appended segment boundaries, if necessary. Because all WTF::Deque iterators are invalidated whenever any element is removed, and because we do not need random-access to the elements in the deque, replace the Deque with a StdList to store the incoming data. * platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.h: * platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.mm: (WebCore::SourceBufferParserAVFObjC::setLogger): * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC): * platform/graphics/cocoa/SourceBufferParser.h: * platform/graphics/cocoa/SourceBufferParserWebM.cpp: (WTF::LogArgument::toString): (WTF::LogArgument::toString): (WebCore::logChannel): (WebCore::logClassName): (WebCore::SourceBufferParserWebM::appendData): (WebCore::SourceBufferParserWebM::resetParserState): (WebCore::SourceBufferParserWebM::invalidate): (WebCore::SourceBufferParserWebM::setLogger): (WebCore::SourceBufferParserWebM::OnElementBegin): (WebCore::SourceBufferParserWebM::OnElementEnd): (WebCore::SourceBufferParserWebM::OnEbml): (WebCore::SourceBufferParserWebM::OnSegmentBegin): (WebCore::SourceBufferParserWebM::OnInfo): (WebCore::SourceBufferParserWebM::OnTrackEntry): * platform/graphics/cocoa/SourceBufferParserWebM.h: 2020-10-28 Russell Epstein Cherry-pick r268791. rdar://problem/70795323 [iOS] Disable audio capture in the background for non Safari applications https://bugs.webkit.org/show_bug.cgi?id=217948 Reviewed by Eric Carlson. Source/WebCore: We do not have good OS support when capturing audio in a WebProcess for a backgrounded application. Until we have proper support, it seems best to mute audio capture when being backgrounded. Manually tested. * platform/mediastream/mac/RealtimeMediaSourceCenterMac.mm: (WebCore::RealtimeMediaSourceCenter::shouldInterruptAudioOnPageVisibilityChange): LayoutTests: * platform/ios/mediastream/video-muted-in-background-tab.html: By default, audio capture will be muted in WTR if page goes to background. Update the test to explicitly request for audio capture to continue while in background. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268791 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-21 Youenn Fablet [iOS] Disable audio capture in the background for non Safari applications https://bugs.webkit.org/show_bug.cgi?id=217948 Reviewed by Eric Carlson. We do not have good OS support when capturing audio in a WebProcess for a backgrounded application. Until we have proper support, it seems best to mute audio capture when being backgrounded. Manually tested. * platform/mediastream/mac/RealtimeMediaSourceCenterMac.mm: (WebCore::RealtimeMediaSourceCenter::shouldInterruptAudioOnPageVisibilityChange): 2020-10-21 Russell Epstein Cherry-pick r268398. rdar://problem/70541902 Webcam video from navigator.mediaDevices.getUserMedia() to 2D canvas fails on Safari on iPhone https://bugs.webkit.org/show_bug.cgi?id=217578 Reviewed by Eric Carlson. It is unneeded for MediaStream video backends to enqueue samples to the display layer if the video element is hidden. In iOS, the samples may never be flushed which might cause capture failing after enqueuing too many camera samples. To avoid that, we no longer enqueue samples to the display layer when the player is not visible. In case of canvas painting, other backends need to be made visible for canvas painting to work. For MediaStream backend, we do not need that since we always keep the last sample. For that reason, we keep the backend as not visible even if canvas happens. We do so by introducing a setVisibleForCanvas that is a no-op for MediaStream backend and similar to setVisible for other backends. For good measure, we now flush the MediaStream display layer whenever visibility changed. Manually tested. * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::paintCurrentFrameInContext): * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::setVisibleForCanvas): * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::setVisibleForCanvas): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVisible): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVisibleForCanvas): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268398 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-13 Youenn Fablet Webcam video from navigator.mediaDevices.getUserMedia() to 2D canvas fails on Safari on iPhone https://bugs.webkit.org/show_bug.cgi?id=217578 Reviewed by Eric Carlson. It is unneeded for MediaStream video backends to enqueue samples to the display layer if the video element is hidden. In iOS, the samples may never be flushed which might cause capture failing after enqueuing too many camera samples. To avoid that, we no longer enqueue samples to the display layer when the player is not visible. In case of canvas painting, other backends need to be made visible for canvas painting to work. For MediaStream backend, we do not need that since we always keep the last sample. For that reason, we keep the backend as not visible even if canvas happens. We do so by introducing a setVisibleForCanvas that is a no-op for MediaStream backend and similar to setVisible for other backends. For good measure, we now flush the MediaStream display layer whenever visibility changed. Manually tested. * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::paintCurrentFrameInContext): * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::setVisibleForCanvas): * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::setVisibleForCanvas): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVisible): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVisibleForCanvas): 2020-10-21 Russell Epstein Cherry-pick r268712. rdar://problem/70541891 Fix crash in RenderLayerBacking::updateClippingStackLayerGeometry() https://bugs.webkit.org/show_bug.cgi?id=217940 Reviewed by Tim Horton. Crash data suggest that entry.clipData.clippingLayer (which is a WeakRef) can be null, so check it. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateClippingStackLayerGeometry): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268712 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-19 Simon Fraser Fix crash in RenderLayerBacking::updateClippingStackLayerGeometry() https://bugs.webkit.org/show_bug.cgi?id=217940 Reviewed by Tim Horton. Crash data suggest that entry.clipData.clippingLayer (which is a WeakRef) can be null, so check it. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateClippingStackLayerGeometry): 2020-10-21 Russell Epstein Cherry-pick r268701. rdar://problem/70541911 Fix possible crash in GraphicsLayerCA::computeVisibleAndCoverageRect() https://bugs.webkit.org/show_bug.cgi?id=217930 Reviewed by Tim Horton. If we made a m_overflowControlsHostLayerAncestorClippingStack, make sure we unparent its layers when tearing down the RenderLayerBacking, and when we determine that we longer need a m_ancestorClippingStack (having a m_overflowControlsHostLayerAncestorClippingStack implies that we have a m_ancestorClippingStack). * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::destroyGraphicsLayers): (WebCore::RenderLayerBacking::updateAncestorClipping): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268701 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-19 Simon Fraser Fix possible crash in GraphicsLayerCA::computeVisibleAndCoverageRect() https://bugs.webkit.org/show_bug.cgi?id=217930 Reviewed by Tim Horton. If we made a m_overflowControlsHostLayerAncestorClippingStack, make sure we unparent its layers when tearing down the RenderLayerBacking, and when we determine that we longer need a m_ancestorClippingStack (having a m_overflowControlsHostLayerAncestorClippingStack implies that we have a m_ancestorClippingStack). * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::destroyGraphicsLayers): (WebCore::RenderLayerBacking::updateAncestorClipping): 2020-10-21 Russell Epstein Cherry-pick r268473. rdar://problem/70541789 Web Inspector: REGRESSION(r267148): new Big Sur styles are not used https://bugs.webkit.org/show_bug.cgi?id=217682 Reviewed by Brian Burg. r267148 changed `navigator.userAgent` from `11_0` to `10_15_7`. This breaks Web Inspector styling, which relied on this value to know what OS version it was running on in order to know which styles to use. Source/WebCore: * inspector/InspectorFrontendHost.idl: * inspector/InspectorFrontendHost.h: * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::platformVersionName const): Added. Derive a lowercased kekab-cased platform version name from `__MAC_OS_X_VERSION_MIN_REQUIRED`. Source/WebInspectorUI: * UserInterface/Base/Platform.js: * UserInterface/Views/Variables.css: (body.mac-platform): Added. (body.mac-platform:not(.sierra, .high-sierra)): Deleted. Use `InspectorFrontendHost.platformVersionName` instead of `navigator.userAgent`. Remove unnecessary platform version names and other unused data. * UserInterface/Base/Main.js: (WI.contentLoaded): (WI.undockedTitleAreaHeight): Added. * UserInterface/Views/Popover.js: (WI.Popover.prototype._update): Provide a way to get the undocked title area height for use in JavaScript calculations. * UserInterface/Controllers/HARBuilder.js: (WI.HARBuilder.creator): The `WI.Platform.version.build` hasn't changed in a long time, so just remove it. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268473 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-14 Devin Rousso Web Inspector: REGRESSION(r267148): new Big Sur styles are not used https://bugs.webkit.org/show_bug.cgi?id=217682 Reviewed by Brian Burg. r267148 changed `navigator.userAgent` from `11_0` to `10_15_7`. This breaks Web Inspector styling, which relied on this value to know what OS version it was running on in order to know which styles to use. * inspector/InspectorFrontendHost.idl: * inspector/InspectorFrontendHost.h: * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::platformVersionName const): Added. Derive a lowercased kekab-cased platform version name from `__MAC_OS_X_VERSION_MIN_REQUIRED`. 2020-10-21 Russell Epstein Cherry-pick r268084. rdar://problem/70541921 AX: Expose lineRangeForPosition for iOS Accessibility code https://bugs.webkit.org/show_bug.cgi?id=217256 Reviewed by Zalan Bujtas. Expose the existing lineRangeForPosition method for iOS accessibility. * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper lineMarkersForMarker:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268084 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-06 Chris Fleizach AX: Expose lineRangeForPosition for iOS Accessibility code https://bugs.webkit.org/show_bug.cgi?id=217256 Reviewed by Zalan Bujtas. Expose the existing lineRangeForPosition method for iOS accessibility. * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper lineMarkersForMarker:]): 2020-10-21 Russell Epstein Cherry-pick r266787. rdar://problem/70541715 AccessibilityMenuList and MenuListPopup notifications need to be posted asynchronously. https://bugs.webkit.org/show_bug.cgi?id=216309 Reviewed by Chris Fleizach. MenuList notifications were posted synchronously which triggers a DOM layout and style update in the middle of an ongoing DOM mutation update. This is unnecessary and, furthermore, causes crashes since the DOM layout update cannot be re-entrant. This change makes these notifications asynchronous. * accessibility/AccessibilityMenuList.cpp: (WebCore::AccessibilityMenuList::didUpdateActiveOption): * accessibility/AccessibilityMenuListPopup.cpp: (WebCore::AccessibilityMenuListPopup::didUpdateActiveOption): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266787 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-09 Andres Gonzalez AccessibilityMenuList and MenuListPopup notifications need to be posted asynchronously. https://bugs.webkit.org/show_bug.cgi?id=216309 Reviewed by Chris Fleizach. MenuList notifications were posted synchronously which triggers a DOM layout and style update in the middle of an ongoing DOM mutation update. This is unnecessary and, furthermore, causes crashes since the DOM layout update cannot be re-entrant. This change makes these notifications asynchronous. * accessibility/AccessibilityMenuList.cpp: (WebCore::AccessibilityMenuList::didUpdateActiveOption): * accessibility/AccessibilityMenuListPopup.cpp: (WebCore::AccessibilityMenuListPopup::didUpdateActiveOption): 2020-10-15 Russell Epstein Apply patch. rdar://problem/70321689 2020-10-15 Youenn Fablet Improve computation of default audio input and output devices https://bugs.webkit.org/show_bug.cgi?id=217652 Previously, we were ensuring the default device is the first in the list if the list was not empty. For the first enumeration of devices, we were expecting the default device to be the first in kAudioHardwarePropertyDevices list. But this is not guaranteed, so we should make sure to prepend the default device in the list even for the first enumeration. Manually tested. * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp: (WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices): 2020-10-15 Russell Epstein Cherry-pick r268308. rdar://problem/70321629 [Mac] AirPlay menu does not show up when AirPlay button is clicked https://bugs.webkit.org/show_bug.cgi?id=217536 Reviewed by Eric Carlson. Source/WebCore: PAL tries to soft-link the AVRoutePickerView from the AVFoundation framework, rather than the (correct) AVKit framework. Remove AVRoutePickerView from AVFoundationSoftLink.h and use the already declared version inside AVRoutePickerViewTargetPicker.mm. * platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.mm: (WebCore::AVRoutePickerViewTargetPicker::isAvailable): Source/WebCore/PAL: * pal/cocoa/AVFoundationSoftLink.h: * pal/cocoa/AVFoundationSoftLink.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268308 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-09 Jer Noble [Mac] AirPlay menu does not show up when AirPlay button is clicked https://bugs.webkit.org/show_bug.cgi?id=217536 Reviewed by Eric Carlson. PAL tries to soft-link the AVRoutePickerView from the AVFoundation framework, rather than the (correct) AVKit framework. Remove AVRoutePickerView from AVFoundationSoftLink.h and use the already declared version inside AVRoutePickerViewTargetPicker.mm. * platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.mm: (WebCore::AVRoutePickerViewTargetPicker::isAvailable): 2020-10-08 Russell Epstein Cherry-pick r266909. rdar://problem/69101091 Source/WebCore: Text replacements at the beginning of a second line are replaced too early https://bugs.webkit.org/show_bug.cgi?id=216327 Reviewed by Darin Adler. In the changes in r258871, using SimpleRanges instead of Range causing some side effects when the replacements at the beginning of lines. The ranges that we are counting are backwards and the return characters are being counted instead of being ignored. There is almost certainly a better fix than this, but this patch restores the original logic that was present when Range was being used, until a better fix can be worked out. Test: editing/spelling/text-replacement-first-word-second-line.html * editing/Editor.cpp: (WebCore::Editor::markAndReplaceFor): * editing/TextCheckingHelper.cpp: (WebCore::TextCheckingParagraph::automaticReplacementStart const): (WebCore::TextCheckingParagraph::automaticReplacementLength const): * editing/TextCheckingHelper.h: LayoutTests: Overlapping text replacements at the beginning of a line are replaced too early https://bugs.webkit.org/show_bug.cgi?id=216327 Reviewed by Darin Adler. * editing/spelling/text-replacement-first-word-second-line-expected.txt: Added. * editing/spelling/text-replacement-first-word-second-line.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266909 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-10 Megan Gardner Text replacements at the beginning of a second line are replaced too early https://bugs.webkit.org/show_bug.cgi?id=216327 Reviewed by Darin Adler. In the changes in r258871, using SimpleRanges instead of Range causing some side effects when the replacements at the beginning of lines. The ranges that we are counting are backwards and the return characters are being counted instead of being ignored. There is almost certainly a better fix than this, but this patch restores the original logic that was present when Range was being used, until a better fix can be worked out. Test: editing/spelling/text-replacement-first-word-second-line.html * editing/Editor.cpp: (WebCore::Editor::markAndReplaceFor): * editing/TextCheckingHelper.cpp: (WebCore::TextCheckingParagraph::automaticReplacementStart const): (WebCore::TextCheckingParagraph::automaticReplacementLength const): * editing/TextCheckingHelper.h: 2020-10-14 Russell Epstein Cherry-pick r267203. rdar://problem/70310545 Rename ShouldAllowExternalSchemes to ShouldAllowExternalSchemesButNotAppLinks to clarify what this enum value is for. https://bugs.webkit.org/show_bug.cgi?id=216651 Patch by Hoa Dinh on 2020-09-17 Reviewed by Alex Christensen. Rename ShouldAllowExternalSchemes to ShouldAllowExternalSchemesButNotAppLinks and reflects the change where it's used. Source/WebCore: Source/WebCore: * loader/FrameLoaderTypes.h: * page/ContextMenuController.cpp: (WebCore::ContextMenuController::contextMenuItemSelected): Source/WebKit: Source/WebKit: * Shared/SessionState.cpp: (WebKit::isValidEnum): * UIProcess/API/APINavigationAction.h: * UIProcess/API/glib/WebKitWebViewSessionState.cpp: (toExternalURLsPolicy): (toWebCoreExternalURLsPolicy): * UIProcess/WebPageProxy.h: * UIProcess/mac/LegacySessionStateCoding.cpp: (WebKit::decodeSessionHistoryEntry): * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp: (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267203 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-17 Hoa Dinh Rename ShouldAllowExternalSchemes to ShouldAllowExternalSchemesButNotAppLinks to clarify what this enum value is for. https://bugs.webkit.org/show_bug.cgi?id=216651 Reviewed by Alex Christensen. Rename ShouldAllowExternalSchemes to ShouldAllowExternalSchemesButNotAppLinks and reflects the change where it's used. Source/WebCore: * loader/FrameLoaderTypes.h: * page/ContextMenuController.cpp: (WebCore::ContextMenuController::contextMenuItemSelected): 2020-10-14 Russell Epstein Cherry-pick r268003. rdar://problem/70267725 Make NetscapePlugInStreamLoaderClient a weak pointer on NetscapePlugInStreamLoader Reviewed by Alex Christensen. Source/WebCore: Could not write a test since reproducing a crash requires rapidly reloading a URL to a PDF at random points during the previous load. Make NetscapePlugInStreamLoaderClient a WeakPtr on NetscapePlugInStreamLoader, and add nullptr checks for NetscapePlugInStreamLoader.m_client as needed. * loader/NetscapePlugInStreamLoader.cpp: (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader): (WebCore::NetscapePlugInStreamLoader::willSendRequest): (WebCore::NetscapePlugInStreamLoader::didReceiveResponse): (WebCore::NetscapePlugInStreamLoader::didReceiveDataOrBuffer): (WebCore::NetscapePlugInStreamLoader::didFinishLoading): (WebCore::NetscapePlugInStreamLoader::didFail): (WebCore::NetscapePlugInStreamLoader::willCancel): * loader/NetscapePlugInStreamLoader.h: Source/WebKit: Making NetscapePlugInStreamLoaderClient inherit from CanMakeWeakPtr<> caused PDFPlugin to fail to compile because one of its parent classes already inherited from CanMakeWeakPtr<>. To fix this, extract a PDFPluginStreamLoaderClient class from PDFPlugin and link the lifetime of PDFPluginStreamLoaderClient to PDFPlugin. After moving the NetscapePlugInStreamLoaderClient virtual methods from PDFPlugin to PDFPluginStreamLoaderClient, add some simple methods to PDFPlugin so that PDFPluginStreamLoaderClient doesn't access the instance variables directly. Also make use of these new methods in other parts of PDFPlugin. * WebProcess/Plugins/PDF/PDFPlugin.h: (WebKit::PDFPlugin::documentFinishedLoading): Add. (WebKit::PDFPlugin::identifierForLoader): Add. (WebKit::PDFPlugin::removeOutstandingByteRangeRequest): Add. (WebKit::PDFPlugin::PDFPluginStreamLoaderClient): Add class. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::PDFPlugin): (WebKit::PDFPlugin::receivedNonLinearizedPDFSentinel): (WebKit::PDFPlugin::getResourceBytesAtPosition): (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::willSendRequest): Move from PDFPlugin. (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::didReceiveResponse): Ditto. (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::didReceiveData): Ditto. (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::didFail): Ditto. (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::didFinishLoading): Ditto. (WebKit::PDFPlugin::byteRangeRequestForLoader): (WebKit::PDFPlugin::forgetLoader): (WebKit::PDFPlugin::willSendRequest): Move to PDFPluginStreamLoaderClient. (WebKit::PDFPlugin::didReceiveResponse): Ditto. (WebKit::PDFPlugin::didReceiveData): Ditto. (WebKit::PDFPlugin::didFail): Ditto. (WebKit::PDFPlugin::didFinishLoading): Ditto. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268003 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-05 David Kilzer Make NetscapePlugInStreamLoaderClient a weak pointer on NetscapePlugInStreamLoader Reviewed by Alex Christensen. Could not write a test since reproducing a crash requires rapidly reloading a URL to a PDF at random points during the previous load. Make NetscapePlugInStreamLoaderClient a WeakPtr on NetscapePlugInStreamLoader, and add nullptr checks for NetscapePlugInStreamLoader.m_client as needed. * loader/NetscapePlugInStreamLoader.cpp: (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader): (WebCore::NetscapePlugInStreamLoader::willSendRequest): (WebCore::NetscapePlugInStreamLoader::didReceiveResponse): (WebCore::NetscapePlugInStreamLoader::didReceiveDataOrBuffer): (WebCore::NetscapePlugInStreamLoader::didFinishLoading): (WebCore::NetscapePlugInStreamLoader::didFail): (WebCore::NetscapePlugInStreamLoader::willCancel): * loader/NetscapePlugInStreamLoader.h: 2020-10-14 Russell Epstein Cherry-pick r267116. rdar://problem/70267318 [macOS Big Sur] CGFontRenderingGetFontSmoothingDisabled() is no longer useful https://bugs.webkit.org/show_bug.cgi?id=216588 Reviewed by Simon Fraser. Source/WebCore: No new tests because there is no behavior change. * platform/graphics/coretext/FontCascadeCoreText.cpp: (WebCore::FontCascade::isSubpixelAntialiasingAvailable): Source/WTF: We can eliminate WebKit's use of it to eventually phase it out entirely. * wtf/PlatformHave.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267116 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-15 Myles C. Maxfield [macOS Big Sur] CGFontRenderingGetFontSmoothingDisabled() is no longer useful https://bugs.webkit.org/show_bug.cgi?id=216588 Reviewed by Simon Fraser. No new tests because there is no behavior change. * platform/graphics/coretext/FontCascadeCoreText.cpp: (WebCore::FontCascade::isSubpixelAntialiasingAvailable): 2020-10-14 Alan Coon Cherry-pick r268371. rdar://problem/70267767 [macOS] Workaround for MAC_OS_X_VERSION_MAJOR incorrectly including minor version when building with Xcode 12 on macOS Big Sur SUs https://bugs.webkit.org/show_bug.cgi?id=217602 rdar://70194453 Patch by Luming Yin on 2020-10-12 Reviewed by Darin Adler. The previous workaround turns out to be ineffective because we can't set the value of TARGET_MAC_OS_X_VERSION_MAJOR based on a previous value of itself. Introduce a new variable TARGET_MAC_OS_X_VERSION_MAJOR to determine whether we need to explicitly adjust MAC_OS_X_VERSION_MAJOR to 110000. PerformanceTests: * DecoderTest/Configurations/DebugRelease.xcconfig: * MediaTime/Configurations/DebugRelease.xcconfig: Source/bmalloc: * Configurations/DebugRelease.xcconfig: Source/JavaScriptCore: * Configurations/DebugRelease.xcconfig: Source/ThirdParty: * gtest/xcode/Config/General.xcconfig: Source/ThirdParty/ANGLE: * Configurations/DebugRelease.xcconfig: Source/ThirdParty/libwebrtc: * Configurations/DebugRelease.xcconfig: Source/WebCore: * Configurations/DebugRelease.xcconfig: Source/WebCore/PAL: * Configurations/DebugRelease.xcconfig: Source/WebInspectorUI: * Configurations/DebugRelease.xcconfig: Source/WebKit: * Configurations/DebugRelease.xcconfig: Source/WebKitLegacy/mac: * Configurations/DebugRelease.xcconfig: Source/WTF: * Configurations/DebugRelease.xcconfig: Tools: * ContentExtensionTester/Configurations/DebugRelease.xcconfig: * DumpRenderTree/mac/Configurations/DebugRelease.xcconfig: * ImageDiff/cg/Configurations/DebugRelease.xcconfig: * MiniBrowser/Configurations/DebugRelease.xcconfig: * TestWebKitAPI/Configurations/DebugRelease.xcconfig: * WebEditingTester/Configurations/DebugRelease.xcconfig: * WebKitTestRunner/Configurations/DebugRelease.xcconfig: * lldb/lldbWebKitTester/Configurations/DebugRelease.xcconfig: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268371 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-12 Luming Yin [macOS] Workaround for MAC_OS_X_VERSION_MAJOR incorrectly including minor version when building with Xcode 12 on macOS Big Sur SUs https://bugs.webkit.org/show_bug.cgi?id=217602 rdar://70194453 Reviewed by Darin Adler. The previous workaround turns out to be ineffective because we can't set the value of TARGET_MAC_OS_X_VERSION_MAJOR based on a previous value of itself. Introduce a new variable TARGET_MAC_OS_X_VERSION_MAJOR to determine whether we need to explicitly adjust MAC_OS_X_VERSION_MAJOR to 110000. * Configurations/DebugRelease.xcconfig: 2020-10-14 Alan Coon Cherry-pick r268353. rdar://problem/70267767 [macOS] Workaround for MAC_OS_X_VERSION_MAJOR incorrectly including minor version when building with Xcode 12 on macOS Big Sur SUs https://bugs.webkit.org/show_bug.cgi?id=217602 rdar://70194453 Patch by Luming Yin on 2020-10-12 Reviewed by Darin Adler. Due to a bug in Xcode (rdar://70185899), Xcode 12.0 and Xcode 12.1 Beta incorrectly includes the minor release number in MAC_OS_X_VERSION_MAJOR, which causes Debug and Release builds of WebKit to be misconfigured when building on macOS Big Sur SUs, leading to webpages failing to load. To work around the Xcode bug, when the MAC_OS_X_VERSION_MAJOR includes the minor version number, drop the minor version number by explicitly setting TARGET_MAC_OS_X_VERSION_MAJOR to 110000. Note: This change should be reverted after is resolved. PerformanceTests: * DecoderTest/Configurations/DebugRelease.xcconfig: * MediaTime/Configurations/DebugRelease.xcconfig: Source/bmalloc: * Configurations/DebugRelease.xcconfig: Source/JavaScriptCore: * Configurations/DebugRelease.xcconfig: Source/ThirdParty: * gtest/xcode/Config/General.xcconfig: Source/ThirdParty/ANGLE: * Configurations/DebugRelease.xcconfig: Source/ThirdParty/libwebrtc: * Configurations/DebugRelease.xcconfig: Source/WebCore: * Configurations/DebugRelease.xcconfig: Source/WebCore/PAL: * Configurations/DebugRelease.xcconfig: Source/WebInspectorUI: * Configurations/DebugRelease.xcconfig: Source/WebKit: * Configurations/DebugRelease.xcconfig: Source/WebKitLegacy/mac: * Configurations/DebugRelease.xcconfig: Source/WTF: * Configurations/DebugRelease.xcconfig: Tools: * ContentExtensionTester/Configurations/DebugRelease.xcconfig: * DumpRenderTree/mac/Configurations/DebugRelease.xcconfig: * ImageDiff/cg/Configurations/DebugRelease.xcconfig: * MiniBrowser/Configurations/DebugRelease.xcconfig: * TestWebKitAPI/Configurations/DebugRelease.xcconfig: * WebEditingTester/Configurations/DebugRelease.xcconfig: * WebKitTestRunner/Configurations/DebugRelease.xcconfig: * lldb/lldbWebKitTester/Configurations/DebugRelease.xcconfig: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268353 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-12 Luming Yin [macOS] Workaround for MAC_OS_X_VERSION_MAJOR incorrectly including minor version when building with Xcode 12 on macOS Big Sur SUs https://bugs.webkit.org/show_bug.cgi?id=217602 rdar://70194453 Reviewed by Darin Adler. Due to a bug in Xcode (rdar://70185899), Xcode 12.0 and Xcode 12.1 Beta incorrectly includes the minor release number in MAC_OS_X_VERSION_MAJOR, which causes Debug and Release builds of WebKit to be misconfigured when building on macOS Big Sur SUs, leading to webpages failing to load. To work around the Xcode bug, when the MAC_OS_X_VERSION_MAJOR includes the minor version number, drop the minor version number by explicitly setting TARGET_MAC_OS_X_VERSION_MAJOR to 110000. Note: This change should be reverted after is resolved. * Configurations/DebugRelease.xcconfig: 2020-10-14 Alan Coon Cherry-pick r268206. rdar://problem/70267322 Presidential Executive Order pages not accessible with Safari. https://bugs.webkit.org/show_bug.cgi?id=217415 Reviewed by Chris Fleizach and Simon Fraser. Follow up to the previous change for this bug per Simon Fraser's comment. Check not only the visibility and opacity of the object in question but also of its ancestors. Expanded the test accessibility/aria-modal.html to include the case where the visibility of the modal dialog is determined by the opacity of its parent object. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::isNodeVisible const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268206 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-08 Andres Gonzalez Presidential Executive Order pages not accessible with Safari. https://bugs.webkit.org/show_bug.cgi?id=217415 Reviewed by Chris Fleizach and Simon Fraser. Follow up to the previous change for this bug per Simon Fraser's comment. Check not only the visibility and opacity of the object in question but also of its ancestors. Expanded the test accessibility/aria-modal.html to include the case where the visibility of the modal dialog is determined by the opacity of its parent object. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::isNodeVisible const): 2020-10-14 Alan Coon Cherry-pick r268162. rdar://problem/70267741 REGRESSION: Safari unable to load PDF in (docs.legalconnect.com) https://bugs.webkit.org/show_bug.cgi?id=217451 Reviewed by Alex Christensen. Source/WebCore: Test: fast/replaced/pdf-as-embed-with-no-mime-type-is-not-blank.html If plugins are enabled, we'll always let the request go through, and WebKit will guess that files with PDFPlugin-handled extensions should instantiate PDFPlugin, even if no other plugins are available. However, if plugins are disabled, requestPlugin() will early return if the explicitly specified MIME type is not handled by an application plugin (even though the downstream WebKit code would have happily instantiated an application plugin for us). Application plugins shouldn't depend on the plugin enablement setting. To fix this, have SubframeLoader guess the MIME type if not explicitly specified (matching WebKit's behavior), and allow the request if it matches an application plugin. * loader/SubframeLoader.cpp: (WebCore::findPluginMIMETypeFromURL): Improve this previously logging-only function to use the lastPathComponent of the URL instead of randomly looking at the end of the URL, to ignore query strings and fragments when looking for the file extension. (WebCore::FrameLoader::SubframeLoader::requestPlugin): Make use of findPluginMIMETypeFromURL to guess the MIME type if it's not explicitly specified. If the guessed MIME type is one that is handled by application plugins, allow the request to go out to WebKit (which may then instantiate a PDFPlugin, for example). (WebCore::logPluginRequest): (WebCore::FrameLoader::SubframeLoader::requestObject): (WebCore::FrameLoader::SubframeLoader::createJavaAppletWidget): Pass the URL instead of stringifying it, so we can lastPathComponent as above. LayoutTests: * fast/replaced/pdf-as-embed-with-no-mime-type-is-not-blank-expected-mismatch.html: Added. * fast/replaced/pdf-as-embed-with-no-mime-type-is-not-blank.html: Added. Add a test ensuring that with no specified MIME type still renders the PDF. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268162 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-07 Tim Horton REGRESSION: Safari unable to load PDF in (docs.legalconnect.com) https://bugs.webkit.org/show_bug.cgi?id=217451 Reviewed by Alex Christensen. Test: fast/replaced/pdf-as-embed-with-no-mime-type-is-not-blank.html If plugins are enabled, we'll always let the request go through, and WebKit will guess that files with PDFPlugin-handled extensions should instantiate PDFPlugin, even if no other plugins are available. However, if plugins are disabled, requestPlugin() will early return if the explicitly specified MIME type is not handled by an application plugin (even though the downstream WebKit code would have happily instantiated an application plugin for us). Application plugins shouldn't depend on the plugin enablement setting. To fix this, have SubframeLoader guess the MIME type if not explicitly specified (matching WebKit's behavior), and allow the request if it matches an application plugin. * loader/SubframeLoader.cpp: (WebCore::findPluginMIMETypeFromURL): Improve this previously logging-only function to use the lastPathComponent of the URL instead of randomly looking at the end of the URL, to ignore query strings and fragments when looking for the file extension. (WebCore::FrameLoader::SubframeLoader::requestPlugin): Make use of findPluginMIMETypeFromURL to guess the MIME type if it's not explicitly specified. If the guessed MIME type is one that is handled by application plugins, allow the request to go out to WebKit (which may then instantiate a PDFPlugin, for example). (WebCore::logPluginRequest): (WebCore::FrameLoader::SubframeLoader::requestObject): (WebCore::FrameLoader::SubframeLoader::createJavaAppletWidget): Pass the URL instead of stringifying it, so we can lastPathComponent as above. 2020-10-14 Alan Coon Cherry-pick r268117. rdar://problem/70267698 Presidential Executive Order pages not accessible with Safari. https://bugs.webkit.org/show_bug.cgi?id=217415 Reviewed by Chris Fleizach. Source/WebCore: Test: accessibility/aria-modal.html. These pages have a dialog modal element of the form