2020-04-09 Simon Fraser [Async overflow scrolling] Vertical scrolls over a horizontally scrollable overflow are captured https://bugs.webkit.org/show_bug.cgi?id=210320 Reviewed by Tim Horton. This patch adds somewhat more sophisticated latching logic to the scrolling thread, which fixes the inability to vertically scroll if the mouse is over an enclosed horizontal scroller. ScrollingTree owns a ScrollingTreeLatchingController, which determines when to latch and clear latching. Latch clearing uses a 100ms delay (like main thread latching) so that a starting gesture soon after another gesture, whose initial x and y are small, goes to the same scroller as before. Scrolling tree latching works as follows. When we receive a scroll event which allows use of the latched node, and there is a latched node, send the event directly to that node. Otherwise, hit-test to find the most deeply nested scroll target. Traverse up the parent chain giving each node an opportunity to handle the event. If handled by a node, that node becomes the latched node. ScrollingTree no longer tracks the latched node itself. Tests: scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe.html scrollingcoordinator/mac/latching/horizontal-overflow-in-vertical-overflow.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously): (WebCore::ScrollingTree::handleWheelEvent): (WebCore::ScrollingTree::commitTreeState): (WebCore::ScrollingTree::latchedNodeID const): (WebCore::ScrollingTree::clearLatchedNode): (WebCore::ScrollingTree::mainFrameScrollPosition const): (WebCore::ScrollingTree::scrollingTreeAsText): (WebCore::ScrollingTree::setOrClearLatchedNode): Deleted. (WebCore::ScrollingTree::latchedNode): Deleted. (WebCore::ScrollingTree::setLatchedNode): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::hasLatchedNode const): Deleted. * page/scrolling/ScrollingTreeLatchingController.cpp: Added. (WebCore::ScrollingTreeLatchingController::receivedWheelEvent): (WebCore::ScrollingTreeLatchingController::latchedNodeForEvent const): (WebCore::ScrollingTreeLatchingController::latchedNodeID const): (WebCore::ScrollingTreeLatchingController::nodeDidHandleEvent): (WebCore::ScrollingTreeLatchingController::nodeWasRemoved): (WebCore::ScrollingTreeLatchingController::clearLatchedNode): * page/scrolling/ScrollingTreeLatchingController.h: Added. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::isLatchedNode const): (WebCore::ScrollingTreeScrollingNode::canScrollWithWheelEvent const): (WebCore::ScrollingTreeScrollingNode::scrollLimitReached const): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent): * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent): 2020-04-10 Simon Fraser Hit-testing a WebTiledBackingLayer with an animation asserts https://bugs.webkit.org/show_bug.cgi?id=210318 Reviewed by Tim Horton. collectDescendantLayersAtPoint() calls [layer presentationLayer] for layers with running animations, and this calls -initWithLayer: on our layer subclasses. Fix WebTiledBackingLayer to not assert in this case. Test: fast/scrolling/mac/hit-test-overflow-tiled-layer.html * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm: (-[WebTiledBackingLayer initWithLayer:]): 2020-04-10 Youenn Fablet Introduce a RealtimeMediaSource observer dedicated to receiving audio samples https://bugs.webkit.org/show_bug.cgi?id=210180 Reviewed by Eric Carlson. RealtimeMediaSource::Observer was called on various threads which was making iterating through them difficult. Observers were copied to a vector for iterating each time and locking was happening for each indivudual observer. Instead of doing that, RealtimeMediaSource::Observer no longer gives access to audio samples, all its methods are called from the main thread. AudioSampleObserver is introduced with a single method to receive audio samples. RealtimeMediaSource keeps a set of AudioSampleObserver separated from its existing Observer hashset. These observers can only be added/removed from the main thread while audio sample delivery usually happens from a background thread. We no longer need to copy the audio sample observers in a vector and lock only once when iterating the audio sample observers. This change requires to update MediaStreamTrackPrivate and RealtimeMediaSource observers. This includes WebAudio, Audio Renderer and Media Recorder. Each corresponding class is now registering itself as a MediaStreamTrackPrivate::Observer and when needed as a RealtimeMediaSource::Observer. This allows removing the additional copy-in-vector/lock that was happening when iterating over MediaStreamTrackPrivate::Observers for audio samples. This change also allows for a consumer to always observe the MediaStreamTrackPrivate but receive audio samples only when needed. We change the AudioTrackPrivateMediaStream implementation so that, if the renderer is muted, not playing, the track is muted or not enabled, it no longer receives audio samples. This is especially useful in the typical case where a video element displays the locally captured stream (including a local audio track) but is muted to prevent feedback loop. For that reason, the player is now setting the muted state of the renderer instead of setting volume to 0. Covered by existing test sets. * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::createMediaRecorderPrivate): * Modules/mediarecorder/MediaRecorder.h: * Modules/mediarecorder/MediaRecorderProvider.cpp: (WebCore::MediaRecorderProvider::createMediaRecorderPrivate): * Modules/mediarecorder/MediaRecorderProvider.h: * loader/EmptyClients.cpp: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVolume): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setMuted): * platform/mediarecorder/MediaRecorderPrivate.cpp: (WebCore::MediaRecorderPrivate::selectTracks): * platform/mediarecorder/MediaRecorderPrivate.h: (WebCore::MediaRecorderPrivate::setAudioSource): (WebCore::MediaRecorderPrivate::~MediaRecorderPrivate): * platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp: (WebCore::MediaRecorderPrivateAVFImpl::create): (WebCore::MediaRecorderPrivateAVFImpl::~MediaRecorderPrivateAVFImpl): (WebCore::MediaRecorderPrivateAVFImpl::audioSamplesAvailable): (WebCore::MediaRecorderPrivateAVFImpl::stopRecording): (WebCore::MediaRecorderPrivateAVFImpl::fetchData): * platform/mediarecorder/MediaRecorderPrivateAVFImpl.h: * platform/mediarecorder/MediaRecorderPrivateMock.cpp: (WebCore::MediaRecorderPrivateMock::MediaRecorderPrivateMock): (WebCore::MediaRecorderPrivateMock::~MediaRecorderPrivateMock): (WebCore::MediaRecorderPrivateMock::stopRecording): (WebCore::MediaRecorderPrivateMock::sampleBufferUpdated): (WebCore::MediaRecorderPrivateMock::audioSamplesAvailable): (WebCore::MediaRecorderPrivateMock::generateMockCounterString): (WebCore::MediaRecorderPrivateMock::fetchData): * platform/mediarecorder/MediaRecorderPrivateMock.h: * platform/mediastream/AudioTrackPrivateMediaStream.cpp: (WebCore::AudioTrackPrivateMediaStream::AudioTrackPrivateMediaStream): (WebCore::AudioTrackPrivateMediaStream::clear): (WebCore::AudioTrackPrivateMediaStream::play): (WebCore::AudioTrackPrivateMediaStream::pause): (WebCore::AudioTrackPrivateMediaStream::setMuted): (WebCore::AudioTrackPrivateMediaStream::audioSamplesAvailable): (WebCore::AudioTrackPrivateMediaStream::trackMutedChanged): (WebCore::AudioTrackPrivateMediaStream::trackEnabledChanged): (WebCore::AudioTrackPrivateMediaStream::trackEnded): (WebCore::AudioTrackPrivateMediaStream::updateRenderer): (WebCore::AudioTrackPrivateMediaStream::startRenderer): (WebCore::AudioTrackPrivateMediaStream::stopRenderer): * platform/mediastream/AudioTrackPrivateMediaStream.h: * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: (WebCore::webkitMediaStreamSrcFinalize): (WebCore::webkitMediaStreamSrcChangeState): (WebCore::webkitMediaStreamSrcSetupSrc): * platform/mediastream/MediaStreamPrivate.cpp: (WebCore::MediaStreamPrivate::forEachTrack): * platform/mediastream/MediaStreamPrivate.h: * platform/mediastream/MediaStreamTrackPrivate.cpp: (WebCore::MediaStreamTrackPrivate::forEachObserver const): (WebCore::MediaStreamTrackPrivate::addObserver): (WebCore::MediaStreamTrackPrivate::removeObserver): (WebCore::MediaStreamTrackPrivate::hasStartedProducingAudioData): * platform/mediastream/MediaStreamTrackPrivate.h: * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::addAudioSampleObserver): (WebCore::RealtimeMediaSource::removeAudioSampleObserver): (WebCore::RealtimeMediaSource::addObserver): (WebCore::RealtimeMediaSource::removeObserver): (WebCore::RealtimeMediaSource::forEachObserver const): (WebCore::RealtimeMediaSource::audioSamplesAvailable): * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::~RealtimeOutgoingAudioSource): (WebCore::RealtimeOutgoingAudioSource::observeSource): (WebCore::RealtimeOutgoingAudioSource::unobserveSource): * platform/mediastream/RealtimeOutgoingAudioSource.h: * platform/mediastream/WebAudioSourceProvider.h: * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h: * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm: (WebCore::WebAudioSourceProviderAVFObjC::WebAudioSourceProviderAVFObjC): (WebCore::WebAudioSourceProviderAVFObjC::~WebAudioSourceProviderAVFObjC): (WebCore::WebAudioSourceProviderAVFObjC::trackEnabledChanged): (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable): * testing/Internals.cpp: (WebCore::Internals::~Internals): (WebCore::createRecorderMockSource): (WebCore::Internals::observeMediaStreamTrack): (WebCore::Internals::videoSampleAvailable): * testing/Internals.h: 2020-04-10 Youenn Fablet SWServer should not run a service worker that is terminating https://bugs.webkit.org/show_bug.cgi?id=210044 Reviewed by Chris Dumez. If a test is being terminated and we want to restart it, we were previously running it right away. This does not work well as the service worker process might still have the terminating service worker in its map. Also, if the service worker is not able to terminate properly, we will kill the service worker process so there is no reason to try running this service worker in this process. Instead, wait for the service worker to terminate (which might include terminating the service worker process). In addition, we remove the isServiceWorkerRunning internals API since this is potentially flaky as the service worker might be terminated and rerunning in between two isServiceWorkerRunning checks. Instead, we introduce whenServiceWorkerIsTerminated which will resolve as soon as the service worker goes to terminated. Covered by existing spinning tests no longer crashing. * testing/Internals.cpp: (WebCore::Internals::whenServiceWorkerIsTerminated): * testing/Internals.h: * testing/Internals.idl: * workers/service/SWClientConnection.h: (WebCore::SWClientConnection::whenServiceWorkerIsTerminatedForTesting): * workers/service/server/SWServer.cpp: (WebCore::SWServer::runServiceWorkerIfNecessary): (WebCore::SWServer::runServiceWorker): (WebCore::SWServer::workerContextTerminated): * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::whenTerminated): (WebCore::SWServerWorker::setState): * workers/service/server/SWServerWorker.h: (WebCore::SWServerWorker::isNotRunning const): 2020-04-10 Charlie Turner [EME][GStreamer] Relax proxy initialization assert https://bugs.webkit.org/show_bug.cgi?id=210258 Reviewed by Xabier Rodriguez-Calvar. update() may be called on a session before its parent MediaKeys object has been associated with a media element. Supporting this is officially optional, but enough sites (including the W3C EME tests) depend on this optional behaviour that we should support it. Covered by imported/w3c/web-platform-tests/encrypted-media. * platform/encryptedmedia/CDMProxy.cpp: (WebCore::CDMInstanceProxy::mergeKeysFrom): Since the background proxy may not be installed yet, don't ASSERT() it exists. * platform/encryptedmedia/CDMProxy.h: (WebCore::KeyStore::hasKeys const): (WebCore::CDMInstanceProxy::setProxy): Now, when the background proxy is installed, check if any keys have been made available as described above, and if so, set them. 2020-04-10 Adrian Perez de Castro [GTK] Avoid direct GdkEvent field usage in GtkUtilities.h https://bugs.webkit.org/show_bug.cgi?id=210329 Reviewed by Carlos Garcia Campos. No new tests needed. * platform/gtk/GtkUtilities.h: (WebCore::wallTimeForEvent): Use gdk_event_get_time() instead of direct field access. 2020-04-10 Youenn Fablet Bump priority of LibWebRTCAudioModule thread https://bugs.webkit.org/show_bug.cgi?id=210107 Reviewed by Eric Carlson. LibWebRTCAudioModule operates on its own thread and is responsible to generate and push remote audio track data to audio renderers. It does this every 50 milliseconds and any delay in this task will trigger audio crackling. Migrate LibWebRTCAudioModule from a thread based approach to a WorkQueue. This gives cleaner code and allows to set the WorkQueue QOS to QOS::UserInteractive so that it does not get imnterrupted too often. We expect the audio task to be done every 50 ms. If it takes less than 50 ms to dispatch the task and execute, we dispatch a new task with some delay to keep the exact 50ms delay. Otherwise, we dispatch a task without any delay to try recovering as much as we can. Manullay tested on iOS using mock sources on pages rendering multiple audio tracks. This reduces audio crackling a lot but not completely. * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp: (WebCore::LibWebRTCAudioModule::LibWebRTCAudioModule): (WebCore::LibWebRTCAudioModule::StartPlayout): (WebCore::LibWebRTCAudioModule::StartPlayoutOnAudioThread): * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: 2020-04-09 Peng Liu REGRESSION: (r258434) [ Mac WK1 ] media/track/track-css-user-override.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=210134 Reviewed by Eric Carlson. Call captionPreferencesChanged() directly in CaptionUserPreferences::setCaptionsStyleSheetOverride(). * page/CaptionUserPreferences.cpp: (WebCore::CaptionUserPreferences::setCaptionsStyleSheetOverride): 2020-04-09 Cathie Chen Fix up code style for scroll animation https://bugs.webkit.org/show_bug.cgi?id=210171 Reviewed by Simon Fraser. 1. Use AnimatedScroll instead of bool to indicate animated or not. 2. Remove parameter ScrollRectToVisibleOptions, the autoscroll status is available from EventHandler. 3. In order to keep consistent, use RenderLayer::setScrollPosition instead of RenderLayer::scrollToPosition. 4. Add AnimatedScroll parameter to ScrollView::setContentsScrollPosition, then the scroll animation can be dealt in FrameView::setScrollPosition. 5. In ScrollView::setScrollPosition, the scroll animation should be cancled before return. * dom/Element.cpp: Use AnimatedScroll instead of bool. (WebCore::Element::scrollTo): (WebCore::Element::setScrollLeft): (WebCore::Element::setScrollTop): * page/DOMWindow.cpp: (WebCore::DOMWindow::scrollTo const): No need to call scrollToOffsetWithAnimation here. * page/FrameView.cpp: (WebCore::FrameView::setScrollPosition): * page/FrameView.h: * platform/ScrollTypes.h: Add AnimatedScroll. * platform/ScrollView.cpp: (WebCore::ScrollView::setContentsScrollPosition): Add parameter AnimatedScroll. (WebCore::ScrollView::setScrollPosition): Cancel the scroll animation before return. * platform/ScrollView.h: * rendering/RenderBox.cpp: (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::RenderBox::setScrollPosition): * rendering/RenderBox.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollToXPosition): (WebCore::RenderLayer::scrollToYPosition): (WebCore::RenderLayer::setScrollPosition): (WebCore::RenderLayer::scrollRectToVisible): Remove AutoscrollStatus. (WebCore::RenderLayer::autoscroll): (WebCore::RenderLayer::scrollToPosition): Deleted. Use setScrollPosition instead. * rendering/RenderLayer.h: * rendering/RenderListBox.cpp: (WebCore::RenderListBox::setScrollLeft): (WebCore::RenderListBox::setScrollTop): * rendering/RenderListBox.h: * rendering/RenderTextControlSingleLine.cpp: (WebCore::RenderTextControlSingleLine::setScrollLeft): (WebCore::RenderTextControlSingleLine::setScrollTop): * rendering/RenderTextControlSingleLine.h: 2020-04-09 Alex Christensen IPC serialization of enums should serialize std::underlying_type instead of uint64_t https://bugs.webkit.org/show_bug.cgi?id=210228 Reviewed by Chris Dumez and Darin Adler. No change in behavior, other than less memory and time spent in IPC code. * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::drawTextInternal): * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContextStateChange::dump const): * platform/graphics/GraphicsContext.h: * platform/graphics/ca/PlatformCALayer.cpp: (WebCore::PlatformCALayer::drawRepaintIndicator): * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::setPlatformTextDrawingMode): * platform/graphics/cocoa/FontCascadeCocoa.mm: (WebCore::shouldUseLetterpressEffect): (WebCore::FontCascade::drawGlyphs): * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::drawText): * rendering/TextPaintStyle.cpp: (WebCore::updateGraphicsContext): * rendering/TextPainter.cpp: (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded): * rendering/svg/RenderSVGResourceGradient.cpp: (WebCore::RenderSVGResourceGradient::applyResource): * rendering/svg/RenderSVGResourcePattern.cpp: (WebCore::RenderSVGResourcePattern::applyResource): * rendering/svg/RenderSVGResourceSolidColor.cpp: (WebCore::RenderSVGResourceSolidColor::applyResource): 2020-04-08 Darin Adler [Cocoa] Simplify NSArray, NSDictionary, and NSNumber idioms throughout WebKit https://bugs.webkit.org/show_bug.cgi?id=210138 Reviewed by Alex Christensen. - Added createNSArray and makeVector. - Use createNSArray and makeVector in many places where we convert between NSArray and Vector, replacing multiple existing functions that were doing the same job before; later can use them even more. - Use @[] many places where we create an autoreleased NSArray. - Use @{} many places where we create an autoreleased NSDictionary. - Use @() many places where we create an autoreleased NSNumber. * PlatformMac.cmake: Moved Float/IntRectMac.mm to Float/IntRectCocoa.mm. * SourcesCocoa.txt: Ditto. * WebCore.xcodeproj/project.pbxproj: Ditto. * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (AXAttributeStringSetBlockquoteLevel): Use @(). (AXAttributeStringSetHeadingLevel): Use @(). (-[WebAccessibilityObjectWrapper textMarkerRangeForSelection]): Use @[]. (-[WebAccessibilityObjectWrapper _stringFromStartMarker:toEndMarker:attributed:]): Use @[]. (-[WebAccessibilityObjectWrapper elementsForRange:]): Use @[]. (-[WebAccessibilityObjectWrapper textMarkersForRange:]): Use @[]. * accessibility/mac/AXObjectCacheMac.mm: (WebCore::textReplacementChangeDictionary): Use @(). * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (makeVectorElement): Aded overload for AccessibilitySearchKey. (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute): Use makeVector. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (accessibilityTextCriteriaForParameterizedAttribute): Use makeVector. (accessibilitySearchTextCriteriaForParameterizedAttribute): Use makeVector. (AXAttributeStringSetStyle): Use @(). (AXAttributeStringSetBlockquoteLevel): Use @(). (AXAttributeStringSetHeadingLevel): Use @(). (-[WebAccessibilityObjectWrapper accessibilityActionNames]): Use @[]. (convertStringsToNSArray): Deleted. (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): Use @(), @[], and createNSArray. (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): Ditto. * bridge/objc/WebScriptObject.mm: (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]): Use @(). * editing/cocoa/AlternativeTextUIController.mm: (WebCore::AlternativeTextUIController::alternativesForContext): Use makeVector. * editing/cocoa/HTMLConverter.mm: (defaultParagraphStyle): Use @[]. (HTMLConverter::computedAttributesForElement): Use @(). (HTMLConverter::_processMetaElementWithName): Use @(). (HTMLConverter::_addTableForElement): Use @(). * page/ios/FrameIOS.mm: (WebCore::Frame::interpretationsForCurrentRoot const): Use @[]. * platform/cocoa/MIMETypeRegistryCocoa.mm: (WebCore::MIMETypeRegistry::getExtensionsForMIMEType): Use makeVector. * platform/graphics/FloatRect.h: Added makeNSArrayElement overload so we can convert Vector into NSArray. * platform/graphics/IntRect.h: Similarly for IntRect. * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm: (WebCore::MediaSelectionGroupAVFObjC::updateOptions): Use createNSArray. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::mediaDescriptionForKind): Use @[]. (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Use @(). (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): Use @(). (WebCore::MediaPlayerPrivateAVFoundationObjC::checkPlayability): Use @[]. (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput): Use @{} and @(). * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm: (WebCore::PlatformCAAnimationCocoa::valueFunction const): (WebCore::PlatformCAAnimationCocoa::setFromValue): (WebCore::PlatformCAAnimationCocoa::copyFromValueFrom): (WebCore::PlatformCAAnimationCocoa::setToValue): (WebCore::PlatformCAAnimationCocoa::copyToValueFrom): (WebCore::PlatformCAAnimationCocoa::setValues): (WebCore::PlatformCAAnimationCocoa::copyValuesFrom): (WebCore::PlatformCAAnimationCocoa::setKeyTimes): (WebCore::PlatformCAAnimationCocoa::copyKeyTimesFrom): (WebCore::PlatformCAAnimationCocoa::setTimingFunctions): (WebCore::PlatformCAAnimationCocoa::copyTimingFunctionsFrom): Use @(), @[], modern for loops, auto, and allocate with capacity. * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm: (WebCore::PlatformCAFilters::filterValueForOperation): Use @(). * platform/graphics/cocoa/FloatRectCocoa.mm: Moved from mac/FloatRectMac.mm. (WebCore::makeNSArrayElement): Added so we can convert Vector into NSArray. * platform/graphics/cocoa/IntRectCocoa.mm: Moved from mac/IntRectMac.mm. (WebCore::makeNSArrayElement): Similarly for IntRect. (WebCore::enclosingIntRect): Use clampTo to be consistent with what enclosingIntRect(FloatRect) does (while fixing check-webkit-style complaint). * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer display]): Add WebCore namespace prefix; needed depending on how sources get unified (and was affecting my local build when it temporarily had an additional source file). (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]): Ditto. (-[WebGLLayer bindFramebufferToNextAvailableSurface]): Ditto. * platform/graphics/ios/FontCacheIOS.mm: (WebCore::systemFontModificationAttributes): Use @(). * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::getTypes): Use makeVector. (WebCore::createItemProviderRegistrationList): Use createNSArray. (WebCore::PlatformPasteboard::updateSupportedTypeIdentifiers): Use createNSArray. * platform/ios/WebItemProviderPasteboard.mm: (-[WebItemProviderPasteboard setItemProviders:]): Use @[]. * platform/ios/wak/WAKView.mm: (-[WAKView subviews]): Dittto. * platform/mac/PlatformPasteboardMac.mm: (WebCore::PlatformPasteboard::getTypes): Use makeVector. (WebCore::PlatformPasteboard::getPathnamesForType const): Use makeVector. (WebCore::PlatformPasteboard::addTypes): Use makeVector. (WebCore::PlatformPasteboard::setTypes): Use makeVector. * platform/mac/StringUtilities.h: Removed webCoreStringVectorFromNSStringArray, replaced by makeVector * platform/mac/StringUtilities.mm: (WebCore::webCoreStringVectorFromNSStringArray): Deleted. * platform/mac/WebCoreNSURLExtras.mm: Removed unneeded include. * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: (WebCore::MediaRecorderPrivateWriter::setVideoInput): Use @(). * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::setupCaptureSession): Use @(). * platform/network/cocoa/CookieCocoa.mm: (WebCore::Cookie::operator NSHTTPCookie * _Nullable const): Use @(). * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::NetworkStorageSession::setCookiesFromDOM const): Use @{}. * platform/network/cocoa/ResourceRequestCocoa.mm: (WebCore::ResourceRequest::doUpdatePlatformRequest): Use @YES/@NO. 2020-04-09 Daniel Bates [ macOS debug wk2 ] REGRESSION(r259761): ASSERTION FAILED: !needsLayout() on fast/events/scroll-subframe-in-rendering-update.html https://bugs.webkit.org/show_bug.cgi?id=210278 Reviewed by Simon Fraser. Add a comment to clarify that the needsLayout() check during EventRegion painting in RenderWidget::paint() is a workaround for : it is needed because event regions are only stored on compositing layers. Following r259761 a non-composited frames can request their enclosing compositing layer to update the event region on their behalf. Outside of this special request (tracked via RenderView::needsEventRegionUpdateForNonCompositedFrame()) we want to do what the code did pre-r259761 and bail out in RenderWidget::paint() when asked to perform an event region paint. We cannot depend on RenderView::needsEventRegionUpdateForNonCompositedFrame() though since it could be have been set by a deep nested non-composited child frame and an intermediary child frame along the path may have had its layout dirtied. That is why we check needsLayout(). Eventually the needsEventRegionUpdateForNonCompositedFrame() bit will be serviced (and turned off) once all frames along the path to the originally requesting frame lay out. * rendering/RenderWidget.cpp: (WebCore::RenderWidget::paint): 2020-04-09 David Kilzer Add using WTF::isInBounds to CheckedArithmetic.h Reviewed by Darin Adler. * fileapi/Blob.cpp: (WebCore::Blob::size const): * page/PointerCaptureController.cpp: (WebCore::PointerCaptureController::elementWasRemoved): * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::cacheNativeImageAtIndex): * platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm: (WebCore::tryGetResourceAsBufferBinding): - Remove WTF:: prefix from isInBounds(). 2020-04-09 Andres Gonzalez Fix for crash in test accessibility/mac/aria-grid-with-strange-hierarchy.html in isolated tree mode. https://bugs.webkit.org/show_bug.cgi?id=210295 Reviewed by Chris Fleizach. Covered by accessibility/mac/aria-grid-with-strange-hierarchy.html. - When AXIsolatedTree::applyPendingChanges encounters a change for an already existing object, the existing object is discarded and the new object replaces it in the nodes map. The existing and new objects must have the same platform wrapper. Thus the wrapper needs to be detached from the existing object about to be discarded, and re-attached to the new object. We were missing the re-attachment, and hence the crash when the wrapper tries to access its underlying object. - In addition, moved the LockHolder in a couple of intances to before AXIsolatedTree::nodeForID, because this method accesses a member variable used in both threads. - Added stricter assert checks to catch problems with the management of objects and wrappers during tree updates. * accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::updateNode): (WebCore::AXIsolatedTree::updateChildren): (WebCore::AXIsolatedTree::applyPendingChanges): * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (-[WebAccessibilityObjectWrapperBase attachIsolatedObject:]): 2020-04-09 Said Abou-Hallawa REGRESSION: CSS animations inside an embedded SVG image do not animate https://bugs.webkit.org/show_bug.cgi?id=209370 Reviewed by Simon Fraser. If WebAnimation is enabled and the SVGImage includes CSS animations, the DocumentTimeline is added to the SVGDocument of the embedded SVGImage. Because the SVGImage has its own Page the RenderingUpdate is scheduled and the updateRendering steps run in this Page. The Page of the SVGImage is inactive such that scheduling RenderingUpdate fails; therefore the updateRendering steps never run and the CSS animation never advances. The fix is: 1) Scheduling the RenderingUpdate: This has to happen in the Page which contains the renderer of the SVGImage. Because DocumentTimeline is added to SVGDocument, this scheduling will go through these hubs: - DocumentTimeline - Page - ChromeClient -> SVGImageChromeClient - SVGImage - ImageObserver -> CachedImageObserver - CachedImage - CachedImageClient -> RenderElement - Page 2) Running the updateRendering steps: Each document in the Page will enumerate its cached SVGImages. The updateRendering of the Page of each SVGImage will be called. To make enumerating the cached SVGImages of a Document faster, the URL of the cached SVGImage will be added to the cachedSVGImagesURLs of CachedResourceLoader when notifyFinished() is called for associated CachedImage. Tests: svg/animations/css-animation-background-svg.html svg/animations/css-animation-embedded-svg.html svg/animations/css-animation-hover-svg.html * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::scheduleAnimationResolution): (WebCore::DocumentTimeline::updateAnimationsAndSendEvents): * html/ImageBitmap.cpp: * loader/cache/CachedImage.cpp: (WebCore::CachedImage::hasSVGImage const): (WebCore::CachedImage::CachedImageObserver::scheduleTimedRenderingUpdate): (WebCore::CachedImage::scheduleTimedRenderingUpdate): * loader/cache/CachedImage.h: * loader/cache/CachedImageClient.h: (WebCore::CachedImageClient::scheduleTimedRenderingUpdate): * loader/cache/CachedResourceLoader.cpp: (WebCore::isSVGImageCachedResource): (WebCore::cachedResourceSVGImage): (WebCore::CachedResourceLoader::notifyFinished): (WebCore:: const): * loader/cache/CachedResourceLoader.h: * page/ChromeClient.h: (WebCore::ChromeClient::scheduleTimedRenderingUpdate): * page/Page.cpp: (WebCore::Page::scheduleTimedRenderingUpdate): (WebCore::Page::updateRendering): * page/Page.h: * platform/graphics/ImageObserver.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::notifyFinished): (WebCore::RenderElement::scheduleTimedRenderingUpdate): * rendering/RenderElement.h: * rendering/RenderImage.cpp: (WebCore::RenderImage::notifyFinished): * svg/graphics/SVGImage.h: * svg/graphics/SVGImageClients.h: 2020-04-09 Keith Miller Remove legacy X-WebKit-CSP header support https://bugs.webkit.org/show_bug.cgi?id=210256 Reviewed by Geoffrey Garen. Supporting this header is causes compatibly issues for some sites and they appear to be misconfigured. Additionally, no other browser has supported these headers in many years. This patch removes all support for the legacy X-WebKit-CSP header. * dom/Document.cpp: (WebCore::Document::processHttpEquiv): * page/csp/ContentSecurityPolicyDirectiveList.cpp: (WebCore::ContentSecurityPolicyDirectiveList::ContentSecurityPolicyDirectiveList): * page/csp/ContentSecurityPolicyResponseHeaders.cpp: (WebCore::ContentSecurityPolicyResponseHeaders::ContentSecurityPolicyResponseHeaders): * page/csp/ContentSecurityPolicyResponseHeaders.h: * platform/network/HTTPHeaderNames.in: * platform/network/ResourceResponseBase.cpp: (WebCore::isSafeCrossOriginResponseHeader): 2020-04-09 Per Arne Vollan [Cocoa] The function WebCore::systemHasBattery() should cache the result. https://bugs.webkit.org/show_bug.cgi?id=210296 Reviewed by Darin Adler. The function WebCore::systemHasBattery() should cache the result, since the return value of this function will be the same on a specific device. No new tests, since there is no change in behavior. * platform/cocoa/SystemBattery.mm: (WebCore::systemHasBattery): 2020-04-09 Keith Rollin Set ENTITLEMENTS_REQUIRED=NO for some Xcode build targets https://bugs.webkit.org/show_bug.cgi?id=210250 Reviewed by Jonathan Bedard. When building with the public version of Xcode 11.4, with XCBuild enabled, and targeting the iOS device, some build targets issue an error like: error: An empty identity is not valid when signing a binary for the product type 'Command-line Tool'. (in target 'yasm' from project 'libwebrtc') A comment in suggests setting ENTITLEMENTS_REQUIRED=NO to relax the requirement. To that end, when building with the public Xcode, establish that setting for the affected targets. No new tests -- no changed functionality. * Configurations/WebCoreTestShim.xcconfig: * Configurations/WebCoreTestSupport.xcconfig: 2020-04-09 Rob Buis Remove FrameLoader::outgoingOrigin https://bugs.webkit.org/show_bug.cgi?id=210286 Reviewed by Darin Adler. Remove FrameLoader::outgoingOrigin since it is no longer used. * loader/FrameLoader.cpp: (WebCore::FrameLoader::outgoingOrigin const): Deleted. * loader/FrameLoader.h: 2020-04-09 Jacob Uphoff Unreviewed, reverting r259816. This commit broke the webkit build for macOS and iOS Reverted changeset: "Introduce a RealtimeMediaSource observer dedicated to receiving audio samples" https://bugs.webkit.org/show_bug.cgi?id=210180 https://trac.webkit.org/changeset/259816 2020-04-09 Daniel Bates [ macOS debug wk2 ] REGRESSION(r259762): ASSERTION FAILED: !needsLayout() on fast/events/scroll-subframe-in-rendering-update.html https://bugs.webkit.org/show_bug.cgi?id=210278 Reviewed by Darin Adler. Only EventRegion paint the contents of the widget if the widget is a frame view that does not need layout because layout must come before painting. Otherwise, an assertion failure will occur. * rendering/RenderWidget.cpp: (WebCore::RenderWidget::paint): 2020-04-09 Simon Fraser eventSender.monitorWheelEvents() should clear latching state https://bugs.webkit.org/show_bug.cgi?id=210288 Reviewed by Tim Horton. Use monitorWheelEvents() as a trigger to clear scroll latching state, both main-thread (via Page) and scrolling thread (via ScrollingTree). Page::ensureWheelEventTestMonitor() had side-effects, so hide it, and have clients explicitly call Page::startMonitoringWheelEvents(). * page/Page.cpp: (WebCore::Page::startMonitoringWheelEvents): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): 2020-04-09 Wenson Hsieh Add an API test for https://bugs.webkit.org/show_bug.cgi?id=210294 Reviewed by Tim Horton. Avoid trying to place the missing value into paragraphSets in TextManipulationController by bailing if either the start or end positions are null (while the missing value requires both the start and end to be null, it is sufficient to bail if either are null because `observeParagraphs` will be a no-op anyways). See Tools/ChangeLog for more details. Test: TextManipulation.CompleteTextManipulationAvoidCrashingWhenContentIsRemoved * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::scheduleObservartionUpdate): 2020-04-09 Ryan Haddad Unreviewed, reverting r259804. Breaks the watchOS build. Reverted changeset: "IPC serialization of enums should serialize std::underlying_type instead of uint64_t" https://bugs.webkit.org/show_bug.cgi?id=210228 https://trac.webkit.org/changeset/259804 2020-04-09 Youenn Fablet Introduce a RealtimeMediaSource observer dedicated to receiving audio samples https://bugs.webkit.org/show_bug.cgi?id=210180 Reviewed by Eric Carlson. RealtimeMediaSource::Observer was called on various threads which was making iterating through them difficult. Observers were copied to a vector for iterating each time and locking was happening for each indivudual observer. Instead of doing that, RealtimeMediaSource::Observer no longer gives access to audio samples, all its methods are called from the main thread. AudioSampleObserver is introduced with a single method to receive audio samples. RealtimeMediaSource keeps a set of AudioSampleObserver separated from its existing Observer hashset. These observers can only be added/removed from the main thread while audio sample delivery usually happens from a background thread. We no longer need to copy the audio sample observers in a vector and lock only once when iterating the audio sample observers. This change requires to update MediaStreamTrackPrivate and RealtimeMediaSource observers. This includes WebAudio, Audio Renderer and Media Recorder. Each corresponding class is now registering itself as a MediaStreamTrackPrivate::Observer and when needed as a RealtimeMediaSource::Observer. This allows removing the additional copy-in-vector/lock that was happening when iterating over MediaStreamTrackPrivate::Observers for audio samples. This change also allows for a consumer to always observe the MediaStreamTrackPrivate but receive audio samples only when needed. We change the AudioTrackPrivateMediaStream implementation so that, if the renderer is muted, not playing, the track is muted or not enabled, it no longer receives audio samples. This is especially useful in the typical case where a video element displays the locally captured stream (including a local audio track) but is muted to prevent feedback loop. For that reason, the player is now setting the muted state of the renderer instead of setting volume to 0. Covered by existing test sets. * Modules/mediarecorder/MediaRecorder.cpp: (WebCore::MediaRecorder::createMediaRecorderPrivate): * Modules/mediarecorder/MediaRecorder.h: * Modules/mediarecorder/MediaRecorderProvider.cpp: (WebCore::MediaRecorderProvider::createMediaRecorderPrivate): * Modules/mediarecorder/MediaRecorderProvider.h: * loader/EmptyClients.cpp: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVolume): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setMuted): * platform/mediarecorder/MediaRecorderPrivate.cpp: (WebCore::MediaRecorderPrivate::selectTracks): * platform/mediarecorder/MediaRecorderPrivate.h: (WebCore::MediaRecorderPrivate::setAudioSource): (WebCore::MediaRecorderPrivate::~MediaRecorderPrivate): * platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp: (WebCore::MediaRecorderPrivateAVFImpl::create): (WebCore::MediaRecorderPrivateAVFImpl::~MediaRecorderPrivateAVFImpl): (WebCore::MediaRecorderPrivateAVFImpl::audioSamplesAvailable): (WebCore::MediaRecorderPrivateAVFImpl::stopRecording): (WebCore::MediaRecorderPrivateAVFImpl::fetchData): * platform/mediarecorder/MediaRecorderPrivateAVFImpl.h: * platform/mediarecorder/MediaRecorderPrivateMock.cpp: (WebCore::MediaRecorderPrivateMock::MediaRecorderPrivateMock): (WebCore::MediaRecorderPrivateMock::~MediaRecorderPrivateMock): (WebCore::MediaRecorderPrivateMock::stopRecording): (WebCore::MediaRecorderPrivateMock::sampleBufferUpdated): (WebCore::MediaRecorderPrivateMock::audioSamplesAvailable): (WebCore::MediaRecorderPrivateMock::generateMockCounterString): (WebCore::MediaRecorderPrivateMock::fetchData): * platform/mediarecorder/MediaRecorderPrivateMock.h: * platform/mediastream/AudioTrackPrivateMediaStream.cpp: (WebCore::AudioTrackPrivateMediaStream::AudioTrackPrivateMediaStream): (WebCore::AudioTrackPrivateMediaStream::clear): (WebCore::AudioTrackPrivateMediaStream::play): (WebCore::AudioTrackPrivateMediaStream::pause): (WebCore::AudioTrackPrivateMediaStream::setMuted): (WebCore::AudioTrackPrivateMediaStream::audioSamplesAvailable): (WebCore::AudioTrackPrivateMediaStream::trackMutedChanged): (WebCore::AudioTrackPrivateMediaStream::trackEnabledChanged): (WebCore::AudioTrackPrivateMediaStream::trackEnded): (WebCore::AudioTrackPrivateMediaStream::updateRenderer): (WebCore::AudioTrackPrivateMediaStream::startRenderer): (WebCore::AudioTrackPrivateMediaStream::stopRenderer): * platform/mediastream/AudioTrackPrivateMediaStream.h: * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: (WebCore::webkitMediaStreamSrcFinalize): (WebCore::webkitMediaStreamSrcChangeState): (WebCore::webkitMediaStreamSrcSetupSrc): * platform/mediastream/MediaStreamPrivate.cpp: (WebCore::MediaStreamPrivate::forEachTrack): * platform/mediastream/MediaStreamPrivate.h: * platform/mediastream/MediaStreamTrackPrivate.cpp: (WebCore::MediaStreamTrackPrivate::forEachObserver const): (WebCore::MediaStreamTrackPrivate::addObserver): (WebCore::MediaStreamTrackPrivate::removeObserver): (WebCore::MediaStreamTrackPrivate::hasStartedProducingAudioData): * platform/mediastream/MediaStreamTrackPrivate.h: * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::addAudioSampleObserver): (WebCore::RealtimeMediaSource::removeAudioSampleObserver): (WebCore::RealtimeMediaSource::addObserver): (WebCore::RealtimeMediaSource::removeObserver): (WebCore::RealtimeMediaSource::forEachObserver const): (WebCore::RealtimeMediaSource::audioSamplesAvailable): * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::~RealtimeOutgoingAudioSource): (WebCore::RealtimeOutgoingAudioSource::observeSource): (WebCore::RealtimeOutgoingAudioSource::unobserveSource): * platform/mediastream/RealtimeOutgoingAudioSource.h: * platform/mediastream/WebAudioSourceProvider.h: * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h: * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm: (WebCore::WebAudioSourceProviderAVFObjC::WebAudioSourceProviderAVFObjC): (WebCore::WebAudioSourceProviderAVFObjC::~WebAudioSourceProviderAVFObjC): (WebCore::WebAudioSourceProviderAVFObjC::trackEnabledChanged): (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable): * testing/Internals.cpp: (WebCore::Internals::~Internals): (WebCore::createRecorderMockSource): (WebCore::Internals::observeMediaStreamTrack): (WebCore::Internals::videoSampleAvailable): * testing/Internals.h: 2020-04-09 Antti Koivisto Removed unused fields and functions from StylePropertyShorthand https://bugs.webkit.org/show_bug.cgi?id=210279 Reviewed by Darin Adler. * css/StylePropertyShorthand.cpp: (WebCore::borderAbridgedShorthand): Deleted. * css/StylePropertyShorthand.h: (WebCore::StylePropertyShorthand::StylePropertyShorthand): (WebCore::StylePropertyShorthand::properties const): (WebCore::StylePropertyShorthand::propertiesForInitialization const): Deleted. 2020-04-08 Simon Fraser [Async overflow scroll] Horizontal scrolls can trigger unwanted back swipes https://bugs.webkit.org/show_bug.cgi?id=210095 Reviewed by Tim Horton. With async overflow/frame scrolling, EventDispatcher::wheelEvent() can't immediately determine whether the scrolling tree handled the scroll; we have to wait until the event has been processed by the scrolling thread. To allow that, add a ScrollingEventResult::SendToScrollingThread return value and a give tryToHandleWheelEvent() a callback that's called when the scrolling thread is done with the event. EventDispatcher uses that to send the "didReceiveEvent" with "handled" back to the UI process, which then proceeds with history or reading list swipes. Various fixes were necessary to correctly determine whether the event was handled. ScrollingTreeFrameScrollingNodeMac::handleWheelEvent() didn't return an accurate ScrollingEventResult, and ScrollController didn't return false in cases where rubber-banding was disabled (which broke navigation swipes and reading list navigation). Tests: scrollingcoordinator/mac/latching/main-frame-back-swipe.html scrollingcoordinator/mac/latching/simple-page-rubberbands.html * page/scrolling/ScrollingCoordinatorTypes.h: * page/scrolling/ScrollingThread.h: * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): (WebCore::ScrollingTree::mainFrameCanRubberBandInDirection): * page/scrolling/ScrollingTree.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::tryToHandleWheelEvent): * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::allowsHorizontalStretching const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::allowsVerticalStretching const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::shouldRubberBandInDirection const): * platform/cocoa/ScrollController.h: * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::handleWheelEvent): (WebCore::ScrollController::wheelDeltaBiasingTowardsVertical): (WebCore::ScrollController::directionFromEvent): (WebCore::ScrollController::shouldRubberBandInHorizontalDirection const): (WebCore::ScrollController::shouldRubberBandInDirection const): (WebCore::ScrollController::shouldRubberBandInHorizontalDirection): Deleted. 2020-04-09 Alex Christensen IPC serialization of enums should serialize std::underlying_type instead of uint64_t https://bugs.webkit.org/show_bug.cgi?id=210228 Reviewed by Chris Dumez and Darin Adler. No change in behavior, other than less memory and time spent in IPC code. * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::drawTextInternal): * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContextStateChange::dump const): * platform/graphics/GraphicsContext.h: * platform/graphics/ca/PlatformCALayer.cpp: (WebCore::PlatformCALayer::drawRepaintIndicator): * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::setPlatformTextDrawingMode): * platform/graphics/cocoa/FontCascadeCocoa.mm: (WebCore::shouldUseLetterpressEffect): (WebCore::FontCascade::drawGlyphs): * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::drawText): * rendering/TextPaintStyle.cpp: (WebCore::updateGraphicsContext): * rendering/TextPainter.cpp: (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded): * rendering/svg/RenderSVGResourceGradient.cpp: (WebCore::RenderSVGResourceGradient::applyResource): * rendering/svg/RenderSVGResourcePattern.cpp: (WebCore::RenderSVGResourcePattern::applyResource): * rendering/svg/RenderSVGResourceSolidColor.cpp: (WebCore::RenderSVGResourceSolidColor::applyResource): 2020-04-09 Antti Koivisto Use more WeakPtr in RenderTreeBuilder::FirstLetter https://bugs.webkit.org/show_bug.cgi?id=210251 Reviewed by Zalan Bujtas. For safety. * rendering/updating/RenderTreeBuilderFirstLetter.cpp: (WebCore::RenderTreeBuilder::FirstLetter::createRenderers): 2020-04-09 Delan Azabani Remove unnecessary explicit parsing for mo@maxsize value "infinity" https://bugs.webkit.org/show_bug.cgi?id=202720 Reviewed by Frédéric Wang. In MathML 2, the default mo@maxsize was infinity [1], unless some other default was given by mstyle@maxsize [2]. The sole purpose of "infinity" was to give authors a way to set mo@maxsize to infinity when some other mstyle@maxsize was set. MathML Core removes mstyle@maxsize [3][4], such that "infinity" has the same semantics as any other missing or invalid mo@maxsize, so the spec has been simplified to make infinity an anonymous value [5][6]. No functional change, because WebKit has never supported mstyle@maxsize anyway. To verify that there's no functional change: 1. Search for references to LengthType::Infinity, and observe that the mo@maxsize parser in MathMLOperatorElement::maxSize is the only place where a Length of ::type infinity is created 2. Search for references to that method, and observe that the only caller (RenderMathMLOperator::maxSize) passes intMaxForLayoutUnit (infinity) to toUserUnits as the referenceValue 3. Go to the definition of toUserUnits, and observe that the refer- enceValue is used as the ParsingFailed default 4. Step 1 shows that no other attributes would be affected by removing LengthType::Infinity, and steps 2 and 3 show that mo@maxsize treats invalid values as infinity, therefore it's safe to remove both the "infinity" parsing code and the underlying LengthType variant [1] https://www.w3.org/TR/MathML2/chapter3.html#id.3.2.5.2 [2] https://www.w3.org/TR/MathML2/chapter3.html#presm.mstyle [3] https://mathml-refresh.github.io/mathml-core/#style-change-mstyle [4] https://github.com/mathml-refresh/mathml/issues/1 [5] https://mathml-refresh.github.io/mathml-core/#dictionary-based-attributes [6] https://github.com/mathml-refresh/mathml/issues/107 No new tests, because no functional change. * mathml/MathMLElement.h: Remove LengthType::Infinity. * mathml/MathMLOperatorElement.cpp: (WebCore::MathMLOperatorElement::maxSize): Remove explicit branch on "infinity". Replace what remains with an equivalent cachedMathMLLength call. * rendering/mathml/RenderMathMLBlock.cpp: (WebCore::toUserUnits): Remove explicit branch on LengthType::Infinity. * rendering/mathml/RenderMathMLOperator.cpp: (WebCore::RenderMathMLOperator::maxSize): Update comment to refer to the default value in the same way as the spec. 2020-04-08 Chris Dumez querySelector("#\u0000") should match an element with ID U+FFFD https://bugs.webkit.org/show_bug.cgi?id=210119 Reviewed by Darin Adler. As per the specification [1][2], we should preprocess the input string before performing CSS tokenization. The preprocessing step replaces certain characters in the input string. However, our code did not have this preprocessing step and instead was trying to deal with those characters during tokenization. This is however not working as expected for the '\0' character (which is supposed to be replaced with U+FFFD REPLACEMENT CHARACTER) because our code deals with StringViews of the input String and just converts part of the input stream to Strings / AtomStrings. To address the issue, this patch adds a preprocessing step that replaces the '\0' character with the U+FFFD REPLACEMENT CHARACTER). I opted not to replace '\r' or '\f' characters since our tokenizer seems to be dealing fine with those. [1] https://drafts.csswg.org/css-syntax/#input-preprocessing [2] https://drafts.csswg.org/css-syntax/#parser-entry-points Test: imported/w3c/web-platform-tests/dom/nodes/ParentNode-querySelector-escapes.html * css/parser/CSSTokenizer.cpp: (WebCore::preprocessString): (WebCore::CSSTokenizer::CSSTokenizer): (WebCore::CSSTokenizer::lessThan): (WebCore::CSSTokenizer::hyphenMinus): (WebCore::CSSTokenizer::hash): (WebCore::CSSTokenizer::reverseSolidus): (WebCore::CSSTokenizer::letterU): (WebCore::CSSTokenizer::consumeNumber): (WebCore::CSSTokenizer::consumeIdentLikeToken): (WebCore::CSSTokenizer::consumeStringTokenUntil): (WebCore::CSSTokenizer::consumeUnicodeRange): (WebCore::CSSTokenizer::consumeUrlToken): (WebCore::CSSTokenizer::consumeBadUrlRemnants): (WebCore::CSSTokenizer::consumeSingleWhitespaceIfNext): (WebCore::CSSTokenizer::consumeIfNext): (WebCore::CSSTokenizer::consumeName): (WebCore::CSSTokenizer::consumeEscape): (WebCore::CSSTokenizer::nextTwoCharsAreValidEscape): (WebCore::CSSTokenizer::nextCharsAreNumber): (WebCore::CSSTokenizer::nextCharsAreIdentifier): * css/parser/CSSTokenizer.h: * css/parser/CSSTokenizerInputStream.h: (WebCore::CSSTokenizerInputStream::nextInputChar const): (WebCore::CSSTokenizerInputStream::peek const): (WebCore::CSSTokenizerInputStream::peekWithoutReplacement const): Deleted. 2020-04-08 Alex Christensen _corsDisablingPatterns should allow security policy access to those patterns https://bugs.webkit.org/show_bug.cgi?id=210218 Reviewed by Timothy Hatcher. This gives WKWebViewConfiguration._corsDisablingPatterns power similar to WKBundleAddOriginAccessWhitelistEntry but its API is per-WKWebView (even if its implementation is unfortunately currently process global in the web process). Functionality covered by a new API test. * page/Page.cpp: (WebCore::m_loadsFromNetwork): * page/PageConfiguration.h: * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::canRequest const): (WebCore::SecurityOrigin::canDisplay const): * page/SecurityPolicy.cpp: (WebCore::originAccessPatterns): (WebCore::SecurityPolicy::isAccessWhiteListed): (WebCore::SecurityPolicy::allowAccessTo): (WebCore::SecurityPolicy::isAccessToURLWhiteListed): Deleted. * page/SecurityPolicy.h: 2020-04-08 Wenson Hsieh REGRESSION (r258525): Occasional crashes under TextManipulationController::observeParagraphs https://bugs.webkit.org/show_bug.cgi?id=210215 Reviewed by Darin Adler. In the case where `startOfParagraph` or `endOfParagraph` return a null `Position`, we end up crashing under TextManipulationController::observeParagraphs while creating `ParagraphContentIterator`, which expects non-null `Position`s because it dereferences the result of `makeBoundaryPoint`. Avoid this crash for now by bailing if either the start or end positions are null. Tests to be added in a followup patch. * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::observeParagraphs): 2020-04-08 Kenneth Russell Release WebGLLayer earlier in ~GraphicsContextGLOpenGL https://bugs.webkit.org/show_bug.cgi?id=210213 Reviewed by Dean Jackson. Release WebGLLayer earlier and remove public context property, which is no longer called. * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL): * platform/graphics/cocoa/WebGLLayer.h: * platform/graphics/cocoa/WebGLLayer.mm: 2020-04-08 Daniel Bates Track editable elements on screen https://bugs.webkit.org/show_bug.cgi?id=209888 Reviewed by Simon Fraser. Amend EventRegion to store a region of all the hit test visible rects of editable elements on the page. This data will be sent over to the UI process so that it can quickly determine if a search rect would intersect any editable elements. An element is considered editable if it has CSS -webkit-user-modify value that isn't read-only. Note that the value of the HTML content attribute contenteditable is internally converted to its -webkit-user-modify equivalent (e.g. contenteditable="true" <=> "-webkit-user-modify: read-write"). Tests: editing/editable-region/fixed-and-absolute-contenteditable-scrolled.html editing/editable-region/float-contenteditable.html editing/editable-region/hit-test-basic.html editing/editable-region/hit-test-fixed.html editing/editable-region/hit-test-overlap.html editing/editable-region/iframe.html editing/editable-region/input-basic.html editing/editable-region/out-hanging-child-of-contenteditable.html editing/editable-region/overflow-scroll-text-field-and-contenteditable.html editing/editable-region/relative-inside-fixed-contenteditable-scrolled.html editing/editable-region/relative-inside-transformed-contenteditable.html editing/editable-region/transformed-scrolled-on-top-of-fixed-contenteditables.html * Configurations/FeatureDefines.xcconfig: Add feature define to track editable elements on screen (enabled by default on iOS and iOS Simulator). * dom/Document.h: (WebCore::Document::mayHaveEditableElements const): (WebCore::Document::setMayHaveEditableElements): Add some state to each document to track whether it may have an editable element or not. This value represents a "maybe" because it is only set and never unset. It is set if the style resolver saw an element with an editable style. This flag is used as a performance optimization to avoid creating an event region if there are no editable elements on the page. * page/Frame.cpp: (WebCore::Frame::invalidateContentEventRegionsIfNeeded): Check if there are any editable elements. If so, invalidate the event region. * rendering/EventRegion.cpp: (WebCore::EventRegion::operator== const): Update for editable region. (WebCore::EventRegion::unite): If the specified style has a writable CSS user-modify value then unite the region with the editable region. (WebCore::EventRegion::translate): Update for editable region. (WebCore::EventRegion::containsEditableElementsInRect const): Added. Check if the specified rect intersects the editable region. If it does then that means there are one or more editable elements whose bounds intersect that rect. Otherwise, there are none. (WebCore::EventRegion::dump const): Update for editable region. * rendering/EventRegion.h: (WebCore::EventRegion::intersects const): Added. (WebCore::EventRegion::rectsForEditableElements const): Return the rects in the editable region. (WebCore::EventRegion::encode const): Encode the editable region. (WebCore::EventRegion::decode): Decode the editable region. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintObject): Traverse descendants if the page has any editable elements so that we find all of them. * rendering/RenderElement.cpp: (WebCore::RenderElement::styleWillChange): Amend the event region invalidation criterion to look for a change in writability. If there was a change (e.g. read-only to read-write) then invalidate the event region to force a re-computation of it. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::invalidateEventRegion): If the document has editable elements then we need to create an event region. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateEventRegion): Update the region if there are editable elements. (WebCore::RenderLayerBacking::paintDebugOverlays): Paint the editable elements in the debug overlay. For now, I piggybacked (like was done for touch-action regions) on the non-fast scrollable region flag (not shown in the patch). I will look to add a dedicated debug overlay flag in a follow up patch. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveElement): Mark the document as having an editable element if the style for the element being resolved is writable. 2020-04-08 Daniel Bates Should find touch-action elements inside non-composited iframes https://bugs.webkit.org/show_bug.cgi?id=210041 Reviewed by Simon Fraser. Fix up event region code to traverse non-composited iframes that have elements with a non-auto touch-action. The event region is computed for each composited layer during a compositing layer update and was retricted to being updated if the layer's associated document may have an element with a non-auto touch-action. To make this work for non-composited iframes I find its enclosing compositing layer, set a special bit that it needs an event region update because of the non- composited child iframe and schedule a compositing layer update. When the update happens, it checks to see if the special bit is set and if so overrides any restrictions that would have prevented the event region from being updated. The painting code for widgets is also fixed up to pass through an EventRegionContext to update during EventRegion painting. This strategy works well for updating the event region. However debug paint overlays are not updated (i.e. RenderLayerBacking::paintDebugOverlays() is not called) until the embedding client's view is repainted. For now, to fix this up I added another a hack, a special bit (RenderView::needsRepaintHackAfterCompositingLayerUpdateForDebugOverlaysOnly()) that is only set if debug overlays are to be shown, to have the compositor repaint the view after updating compositing layers. Tests: pointerevents/ios/programmatic-touch-action-none-inside-iframe.html pointerevents/ios/touch-action-none-inside-iframe.html pointerevents/ios/touch-action-none-inside-nested-iframe.html * dom/Document.cpp: (WebCore::Document::invalidateEventRegionsForFrame): Added. Try to invalidate the event region. This may fail if the document does not have an enclosing compositing layer for repaint (e.g. nested composited iframes - see test pointerevents/ios/touch-action-none-inside-nested-iframe.html). If this happens then recursive on our owner element's document. Recursion is used instead of a loop to future proof this code for out-of-process (OOP) frames, which will likely introduce document proxy objects. * dom/Document.h: * page/Frame.cpp: (WebCore::Frame::invalidateContentEventRegionsIfNeeded): Added. Check if our document has any elements with a non-auto touch-action. If it does then ask the compositor if the enclosing compositing layer for repaint's event region must be invalidated - it will only reply true if this is a non-composited iframe. If it does then forward this invalidation request to the document. The reason I delegate to the document instead of handling the logic here is to future proof this code for OOP iframes. * page/Frame.h: * page/FrameView.cpp: (WebCore::FrameView::didLayout): Call Frame::invalidateContentEventRegionsIfNeeded(). Also while I am here take out a ref on the document to ensure it lives through the end of this function, including through the accessibility's postNotification() code that calls out to the embedding client. (WebCore::FrameView::paintContents): * page/FrameView.h: * platform/ScrollView.cpp: (WebCore::ScrollView::paint): * platform/ScrollView.h: * platform/Scrollbar.cpp: (WebCore::Scrollbar::paint): * platform/Scrollbar.h: * platform/Widget.cpp: (WebCore::Widget::paint): * platform/Widget.h: * platform/gtk/WidgetGtk.cpp: (WebCore::Widget::paint): * platform/ios/WidgetIOS.mm: (WebCore::Widget::paint): * platform/mac/WidgetMac.mm: (WebCore::Widget::paint): * platform/win/WidgetWin.cpp: (WebCore::Widget::paint): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintObject): Pass an EventRegionContext through. * rendering/RenderElement.cpp: (WebCore::RenderElement::styleWillChange): Update code now that RendeLayer::invalidateEventRegion() takes a reason. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paint): Pass the EventRegionContext through. If are passed one then update paint flags to collect event region. (WebCore::RenderLayer::invalidateEventRegion): Changed return value from void to bool so as to indicate to the caller whether the event region was actually invalidated. Also made it take an argument as to the reason for the invalidation. If invalidation is due to a non-composited iframe then sets some state and schedule a compositing layer update. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateEventRegion): (WebCore::RenderLayerBacking::setContentsNeedDisplay): (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): Pass an EventRegionContext through (WebCore::RenderLayerCompositor::viewNeedsToInvalidateEventRegionOfEnclosingCompositingLayerForRepaint const): Added. * rendering/RenderLayerCompositor.h: * rendering/RenderScrollbar.cpp: (WebCore::RenderScrollbar::paint): * rendering/RenderScrollbar.h: * rendering/RenderView.h: Pass an EventRegionContext through. * rendering/RenderWidget.cpp: (WebCore::RenderWidget::paintContents): Translate the event region by our content paint offset. (WebCore::RenderWidget::paint): Update for EventRegion. If painting the event region and the view needs layout then do what we do now and bail out. Otherwise, proceed to paint the widget's content. The changes to FrameView::didLayout() above means that for non-composited frames that need an event region update they already performed a layout. So, these paints will be allowed to descend into painting of the widget's content. 2020-04-08 Rob Buis Make more use of FrameLoader pageID/frameID getters https://bugs.webkit.org/show_bug.cgi?id=210182 Reviewed by Chris Dumez. Make more use of FrameLoader pageID/frameID getters, before this change they were only used internally in FrameLoader. * dom/Document.cpp: (WebCore::Document::pageID const): (WebCore::Document::frameID const): * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick): * loader/CookieJar.cpp: (WebCore::CookieJar::cookies const): (WebCore::CookieJar::cookieRequestHeaderFieldProxy): (WebCore::CookieJar::setCookies): (WebCore::CookieJar::cookieRequestHeaderFieldValue const): (WebCore::CookieJar::getRawCookies const): * loader/NavigationAction.cpp: (WebCore::createGlobalFrameIdentifier): * loader/PolicyChecker.cpp: * testing/Internals.cpp: (WebCore::Internals::frameIdentifier const): 2020-04-08 Doug Kelly Additional cleanup from "Hit test with clipPath referencing parent element causes infinite recursion" https://bugs.webkit.org/show_bug.cgi?id=210203 Reviewed by Geoffrey Garen. As suggested from the review in bug #209773, this incorporates some additional cleanup, including making the SVGHitTestCycleDetectionScope constructor explicit, and clarifying the add/remove with the WeakHashSet, since WeakPtr's operator* returns a reference to the template type (which is what we need). No new tests as this is covered by existing tests and there are no functional changes. * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGHitTestCycleDetectionScope::SVGHitTestCycleDetectionScope): (WebCore::SVGHitTestCycleDetectionScope::~SVGHitTestCycleDetectionScope): * rendering/svg/SVGRenderSupport.h: 2020-04-08 Devin Rousso Web Inspector: Storage: cannot clear out multiple or all local storage entries https://bugs.webkit.org/show_bug.cgi?id=209867 Reviewed by Timothy Hatcher. Tests: inspector/storage/clearDOMStorageItems.html inspector/storage/getDOMStorageItems.html inspector/storage/removeDOMStorageItem.html inspector/storage/setDOMStorageItem.html * inspector/agents/InspectorDOMStorageAgent.h: * inspector/agents/InspectorDOMStorageAgent.cpp: (WebCore::InspectorDOMStorageAgent::clearDOMStorageItems): Added. Add a `clearDOMStorageItems` command instead of calling `removeDOMStorageItem` for each key. 2020-04-08 Kenneth Russell WebContent process crashes in com.apple.WebCore: rx::IOSurfaceSurfaceCGL::releaseTexImage https://bugs.webkit.org/show_bug.cgi?id=210151 Reviewed by Dean Jackson. Explicitly check for context teardown when displaying a WebGLLayer. * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer display]): 2020-04-08 Wenson Hsieh [macOS] Make PlatformPasteboard robust against types that cannot be encoded with +defaultCStringEncoding https://bugs.webkit.org/show_bug.cgi?id=210195 Reviewed by Tim Horton. When setting pasteboard data using the three PlatformPasteboard methods below, avoid calling into NSPasteboard in the case where the pasteboard type fails to be encoded using +[NSString defaultCStringEncoding]. This is because AppKit pasteboard logic will attempt to convert the given string into a C string using [NSString defaultCStringEncoding], and then assume that the result is non-null, if the type is neither declared nor dynamic. * platform/mac/PlatformPasteboardMac.mm: (WebCore::canWritePasteboardType): (WebCore::PlatformPasteboard::setTypes): (WebCore::PlatformPasteboard::setBufferForType): (WebCore::PlatformPasteboard::setStringForType): Add early returns if canWritePasteboardType returns false. 2020-04-08 Truitt Savell Unreviewed, reverting r259708. Broke the iOS device Build Reverted changeset: "Enable the use of XCBuild by default in Apple builds" https://bugs.webkit.org/show_bug.cgi?id=209890 https://trac.webkit.org/changeset/259708 2020-04-08 Rob Buis Import fetch/origin/assorted.window.js https://bugs.webkit.org/show_bug.cgi?id=210128 Reviewed by Youenn Fablet. Import fetch/origin/assorted.window.js and remove the hack to make the previous (incorrect) version work. * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::updateReferrerAndOriginHeaders): 2020-04-08 Doug Kelly Hit test with clipPath referencing parent element causes infinite recursion https://bugs.webkit.org/show_bug.cgi?id=209773 Reviewed by Geoffrey Garen. Upon further investigation, the original fix for the hit test in RenderSVGResourceClipper to prevent infinite recursion was incomplete, as something such as a use element could easily cause another cycle which would not be detected by the initial fix. Instead, by maintaining a set of visited elements, we can prevent visiting the same element twice, and thus breaking any cycles which might occur in the SVG document. We track these elements within the SVGHitTestCycleDetectionScope class, where the set of visited elements are maintained statically, and instances of the class will manage the scope, as an RAII-style object. This is covered by an existing test, but includes additional test cases which illustrate the more complex document structure. Tests: svg/hittest/svg-clip-path-child-element-with-use-root.html svg/hittest/svg-clip-path-child-element-with-use.html * rendering/svg/RenderSVGContainer.cpp: (WebCore::RenderSVGContainer::nodeAtFloatPoint): * rendering/svg/RenderSVGImage.cpp: (WebCore::RenderSVGImage::nodeAtFloatPoint): * rendering/svg/RenderSVGResourceClipper.cpp: (WebCore::RenderSVGResourceClipper::hitTestClipContent): * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::nodeAtPoint): * rendering/svg/RenderSVGShape.cpp: (WebCore::RenderSVGShape::nodeAtFloatPoint): * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::nodeAtFloatPoint): * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::pointInClippingArea): (WebCore::SVGHitTestCycleDetectionScope::SVGHitTestCycleDetectionScope): (WebCore::SVGHitTestCycleDetectionScope::~SVGHitTestCycleDetectionScope): (WebCore::SVGHitTestCycleDetectionScope::visitedElements): (WebCore::SVGHitTestCycleDetectionScope::isEmpty): (WebCore::SVGHitTestCycleDetectionScope::isVisiting): * rendering/svg/SVGRenderSupport.h: 2020-04-08 Antoine Quint transition-property is not computed correctly when transition-duration is set to "inherit" https://bugs.webkit.org/show_bug.cgi?id=204554 Reviewed by Antti Koivisto. Test: transitions/transition-property-for-element-with-transition-duration-inherit.html The "transition-property" would behave as if "inherit" was set when the "transition-duration" property itself was set explicitly to "inherit". We fix this by storing all the information contained in the "transition-property" into the single Animation::m_property member instead of splitting it across Animation::m_mode as well. We now use a TransitionProperty struct which holds both the transition "mode" (none, all, single property, unknown property) and and the CSS property targeted itself. This requires modifying call sites of both Animation::property() and Animation::animationMode() throughout WebCore. * animation/AnimationTimeline.cpp: (WebCore::transitionMatchesProperty): (WebCore::compileTransitionPropertiesInStyle): * css/CSSComputedStyleDeclaration.cpp: (WebCore::createTransitionPropertyValue): * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::mapAnimationProperty): * css/makeprop.pl: (generateAnimationPropertyInitialValueSetter): (generateAnimationPropertyInheritValueSetter): * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::updateTransitions): * page/animation/ImplicitAnimation.cpp: (WebCore::ImplicitAnimation::ImplicitAnimation): * page/ios/ContentChangeObserver.cpp: (WebCore::ContentChangeObserver::didAddTransition): * platform/animation/Animation.cpp: (WebCore::Animation::Animation): (WebCore::Animation::operator=): (WebCore::Animation::animationsMatch const): (WebCore::operator<<): * platform/animation/Animation.h: (WebCore::Animation::property const): (WebCore::Animation::timingFunction const): (WebCore::Animation::setProperty): (WebCore::Animation::setTimingFunction): (WebCore::Animation::initialProperty): (WebCore::Animation::animationMode const): Deleted. (WebCore::Animation::setAnimationMode): Deleted. * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::adjustTransitions): (WebCore::RenderStyle::transitionForProperty const): 2020-04-08 Youenn Fablet Handle errors when grabbing grabbing microphone audio samples from the AudioUnit https://bugs.webkit.org/show_bug.cgi?id=210185 Reviewed by Eric Carlson. We compute the buffer size to copy microphone samples when setting up the Audio Unit. This is based on the preferred buffer size and sample rate. But these values might change over time by the web page durig the capture. If the preferred buffer size increases (for instance if the page stops using WebAudio), our buffer might be too small. Capture will fail but we will not notify the web application. Update the code to reconfigure the AudioUnit if AudioUnitRender returns an error of type kAudio_ParamError. Update the code to only increment the number of microphoneProcsCalled if AudioUnitRender succeeds. This will ensure that, should AudioUnitRender fails for some time, the timer will kick in and fail the capture. Page will be notified and can call getUserMedia again to restart capture. * platform/mediastream/mac/CoreAudioCaptureSource.cpp: (WebCore::CoreAudioSharedUnit::processMicrophoneSamples): 2020-04-08 Keith Rollin Enable the use of XCBuild by default in Apple builds https://bugs.webkit.org/show_bug.cgi?id=209890 Reviewed by Darin Adler. Switch from the "legacy" Xcode build system to the "new" build system (also known as "XCBuild"). Switching to the new system speeds up builds by a small percentage, better validates projects for build-related issues (such as dependency cycles), lets WebKit benefit from future improvements in XCBuild such as those coming from the underlying llbuild open source project, and prepares us for any other tools built for this new ecosystem. Specific changes: - Remove Xcode project and workspace settings that selected the Build system, allowing the default to take hold (which is currently the New build system). - Updated webkitdirs.pm with a terser check for Xcode version. - Update build-webkit and Makefile.shared to be explicit when using the old build system (no longer treat it as a default or fall-back configuration). - Update various xcconfig files similarly to treat the default as using the new build system. - Update various post-processing build steps to check for Xcode 11.4 and to no longer treat the default as using the old build system. No new tests -- no changed functionality. * WebCore.xcodeproj/project.pbxproj: 2020-04-08 Philippe Normand [GTK][WPE] Release logs are unconditionally filling the journal https://bugs.webkit.org/show_bug.cgi?id=209421 Reviewed by Carlos Alberto Lopez Perez. * platform/unix/LoggingUnix.cpp: (WebCore::logLevelString): Disable all logging when the WEBKIT_DEBUG environment variable is empty. 2020-04-07 Antoine Quint [iPadOS] Unable to toggle subpages on sites.google.com https://bugs.webkit.org/show_bug.cgi?id=210143 Reviewed by Brent Fulgham. If a site built with sites.google.com has some sub-pages, tapping on the right-pointing arrow will not disclose the sub-pages due to preventDefault() being called on the touchend event handler. We work around this issue by adding a new quirk that will prevent a given touch event type from being dispatched on a given element. This quirk is only true for sites.google.com and the right-pointing arrow for the sub-pages disclosure. * page/Quirks.cpp: (WebCore::Quirks::shouldPreventDispatchOfTouchEvent const): * page/Quirks.h: 2020-04-07 Tyler Wilcock [css-values-4] Support font-relative lh and rlh unit https://bugs.webkit.org/show_bug.cgi?id=195180 Reviewed by Antti Koivisto. Implement support for 'lh' and 'rlh' units. https://www.w3.org/TR/css-values-4/#font-relative-lengths * css/CSSCalculationValue.cpp: (WebCore::calcUnitCategory): (WebCore::calculationCategoryForCombination): (WebCore::hasDoubleValue): * css/CSSGradientValue.cpp: (WebCore::CSSLinearGradientValue::createGradient): (WebCore::CSSRadialGradientValue::createGradient): (WebCore::CSSConicGradientValue::createGradient): * css/CSSPrimitiveValue.cpp: (WebCore::isValidCSSUnitTypeForDoubleConversion): (WebCore::isStringType): (WebCore::CSSPrimitiveValue::cleanup): (WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble): (WebCore::CSSPrimitiveValue::unitTypeString): (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const): (WebCore::CSSPrimitiveValue::equals const): (WebCore::CSSPrimitiveValue::collectDirectComputationalDependencies const): (WebCore::CSSPrimitiveValue::collectDirectRootComputationalDependencies const): * css/CSSPrimitiveValue.h: (WebCore::CSSPrimitiveValue::isFontRelativeLength): (WebCore::CSSPrimitiveValue::isLength): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::convertingToLengthRequiresNonNullStyle const): * css/CSSToLengthConversionData.cpp: (WebCore::CSSToLengthConversionData::viewportWidthFactor const): (WebCore::CSSToLengthConversionData::viewportHeightFactor const): (WebCore::CSSToLengthConversionData::viewportMinFactor const): (WebCore::CSSToLengthConversionData::viewportMaxFactor const): * css/CSSToLengthConversionData.h: Replace bool 'm_computingFontSize' with Optional that indicates the property being computed, where none means the property being computed is unknown or unimportant to know. (WebCore::CSSToLengthConversionData::CSSToLengthConversionData): Add 'parentStyle' parameter, necessary for calculating lh/rlh unit values. (WebCore::CSSToLengthConversionData::parentStyle const): (WebCore::CSSToLengthConversionData::computingFontSize const): (WebCore::CSSToLengthConversionData::computingLineHeight const): (WebCore::CSSToLengthConversionData::copyWithAdjustedZoom const): (WebCore::CSSToLengthConversionData::copyWithAdjustedZoomAndPropertyToCompute const): * css/CSSUnits.cpp: (WebCore::operator<<): * css/CSSUnits.h: * css/MediaQueryEvaluator.cpp: (WebCore::MediaQueryEvaluator::evaluate const): * css/parser/CSSParserToken.cpp: (WebCore::cssPrimitiveValueUnitFromTrie): * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeLength): * css/parser/SizesAttributeParser.cpp: (WebCore::SizesAttributeParser::computeLength): (WebCore::SizesAttributeParser::effectiveSizeDefaultValue): * html/shadow/TextControlInnerElements.cpp: (WebCore::TextControlInnerElement::resolveCustomStyle): * rendering/RenderElement.h: (WebCore::RenderElement::parentStyle const): * rendering/RenderThemeIOS.mm: (WebCore::applyCommonButtonPaddingToStyle): (WebCore::RenderThemeIOS::adjustButtonStyle const): * rendering/style/RenderStyle.cpp: Extract 'computedLineHeight' behavior into separate 'computeLineHeight' function so logic can be reused elsewhere. (WebCore::RenderStyle::computedLineHeight const): (WebCore::RenderStyle::computeLineHeight const): * rendering/style/RenderStyle.h: * style/StyleBuilderConverter.h: Extract zoom calculation logic out of 'csstoLengthConversionDataWithTextZoomFactor' into separate 'zoomWithTextZoomFactor' function so logic can be reused elsewhere. (WebCore::Style::zoomWithTextZoomFactor): (WebCore::Style::BuilderConverter::csstoLengthConversionDataWithTextZoomFactor): (WebCore::Style::BuilderConverter::convertLineHeight): * style/StyleBuilderCustom.h: (WebCore::Style::BuilderCustom::applyValueFontSize): * style/StyleBuilderState.cpp: (WebCore::Style::BuilderState::BuilderState): 2020-04-07 Zalan Bujtas fastclick.com: A Gradient banner is missing https://bugs.webkit.org/show_bug.cgi?id=210169 Reviewed by Simon Fraser. This patch ensures that if the non-fixed specified size for the background content computes to be a close-to-zero value, we produce at least one device pixel size content. (and this is similar to what we do for FillSizeType::Contain/Cover.) Test: fast/backgrounds/generated-bck-image-with-small-relative-size.html * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::calculateFillTileSize const): 2020-04-07 Joonghun Park Unreviewed. remove the build warning below since r243033. warning: unused parameter ‘pageMuted’ [-Wunused-parameter] No new tests, no new behaviors. * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::setInterrupted): 2020-04-07 Chris Fleizach AX: VoiceOver can't activate combobox when textfield is inside it https://bugs.webkit.org/show_bug.cgi?id=210081 Reviewed by Joanmarie Diggs. Change accessKeyAction to return whether a simulated click event was dispatched. Accessibility uses that information to decide whether it should sent an event afterwards, because some objects accessKeyAction is only to focus(). AX is expected here to press on the object (and possibly focus). Test: accessibility/activation-of-input-field-inside-other-element.html * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::press): * dom/Element.h: (WebCore::Element::accessKeyAction): * html/BaseCheckableInputType.cpp: (WebCore::BaseCheckableInputType::accessKeyAction): * html/BaseCheckableInputType.h: * html/BaseChooserOnlyDateAndTimeInputType.cpp: (WebCore::BaseChooserOnlyDateAndTimeInputType::accessKeyAction): * html/BaseChooserOnlyDateAndTimeInputType.h: * html/BaseClickableWithKeyInputType.cpp: (WebCore::BaseClickableWithKeyInputType::accessKeyAction): * html/BaseClickableWithKeyInputType.h: * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::accessKeyAction): * html/HTMLAnchorElement.h: * html/HTMLButtonElement.cpp: (WebCore::HTMLButtonElement::accessKeyAction): * html/HTMLButtonElement.h: * html/HTMLElement.cpp: (WebCore::HTMLElement::accessKeyAction): * html/HTMLElement.h: * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::accessKeyAction): * html/HTMLInputElement.h: * html/HTMLLabelElement.cpp: (WebCore::HTMLLabelElement::accessKeyAction): * html/HTMLLabelElement.h: * html/HTMLLegendElement.cpp: (WebCore::HTMLLegendElement::accessKeyAction): * html/HTMLLegendElement.h: * html/HTMLOptGroupElement.cpp: (WebCore::HTMLOptGroupElement::accessKeyAction): * html/HTMLOptGroupElement.h: * html/HTMLOptionElement.cpp: (WebCore::HTMLOptionElement::accessKeyAction): * html/HTMLOptionElement.h: * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::accessKeyAction): * html/HTMLSelectElement.h: * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::accessKeyAction): * html/HTMLTextAreaElement.h: * html/HiddenInputType.cpp: (WebCore::HiddenInputType::accessKeyAction): * html/HiddenInputType.h: * html/InputType.cpp: (WebCore::InputType::accessKeyAction): * html/InputType.h: * html/RangeInputType.cpp: (WebCore::RangeInputType::accessKeyAction): * html/RangeInputType.h: * svg/SVGElement.cpp: (WebCore::SVGElement::accessKeyAction): * svg/SVGElement.h: 2020-04-07 Jiewen Tan [WebAuthn] Cancel WebAuthn requests when users cancel LocalAuthentication prompts https://bugs.webkit.org/show_bug.cgi?id=209923 Reviewed by Brent Fulgham. Covered by new tests within existing test files. * testing/MockWebAuthenticationConfiguration.h: (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::decode): * testing/MockWebAuthenticationConfiguration.idl: Adds a new parameter to reflect user cancellations on LocalAuthentication UI. 2020-04-07 Tadeu Zagallo Not using strict mode within ClassDeclaration statement https://bugs.webkit.org/show_bug.cgi?id=205578 Reviewed by Yusuke Suzuki. Test: JSTests/ stress/superclass-expression-strictness.js * bindings/js/JSDOMWindowCustom.cpp: (WebCore::IDLOperation::cast): * bindings/js/JSEventTargetCustom.h: (WebCore::IDLOperation::call): * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): 2020-04-07 Simon Fraser Use RectEdges<> in some scrolling tree code https://bugs.webkit.org/show_bug.cgi?id=210141 Reviewed by Tim Horton. Add utility functions on ScrollingTreeScrollingNode to get pinned and rubberband state. Use them to push main frame state to the scrolling tree (which we do so we can safely access the state from the EventDispatcher thread). * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::setMainFramePinnedState): (WebCore::ScrollingTree::setMainFrameCanRubberBand): (WebCore::ScrollingTree::willWheelEventStartSwipeGesture): (WebCore::ScrollingTree::setMainFramePinState): Deleted. (WebCore::ScrollingTree::setCanRubberBandState): Deleted. * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::edgePinnedState const): (WebCore::ScrollingTreeScrollingNode::isRubberBanding const): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinAndRubberbandState): 2020-04-07 Joanmarie Diggs AX: Change ATK mapping of the ARIA alert and alertdialog roles https://bugs.webkit.org/show_bug.cgi?id=210121 Reviewed by Chris Fleizach. The ARIA alert role is a live region; not a dialog/message box. In contrast, the ATK alert role is for dialogs such as a warning message which should be presented immediately to the user. Because of the similarity in role names, the original mappings in the Core-AAM were not ideal. They have recently been fixed so we need to update our implementation accordingly. Changed mappings - alertdialog from ATK_ROLE_DIALOG to ATK_ROLE_ALERT - alert from ATK_ROLE_ALERT to ATK_ROLE_NOTIFICATION Updated existing tests to reflect this change. * accessibility/atk/WebKitAccessible.cpp: (atkRole): 2020-04-07 Antti Koivisto Make StylePropertyShorthand iterable https://bugs.webkit.org/show_bug.cgi?id=210117 Reviewed by Darin Adler. Enable modern for-loops. * animation/AnimationTimeline.cpp: (WebCore::transitionMatchesProperty): (WebCore::compileTransitionPropertiesInStyle): * css/CSSComputedStyleDeclaration.cpp: (WebCore::updateStyleIfNeededForProperty): * css/StyleProperties.cpp: (WebCore::StyleProperties::propertyIsImportant const): (WebCore::MutableStyleProperties::setProperty): * css/StylePropertyShorthand.h: (WebCore::StylePropertyShorthand::begin const): (WebCore::StylePropertyShorthand::end const): * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::addExpandedPropertyForValue): * inspector/agents/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::getSupportedCSSProperties): * page/animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): 2020-04-07 Chris Dumez documentFragment.getElementById() should not work for empty-string IDs https://bugs.webkit.org/show_bug.cgi?id=210111 Reviewed by Geoffrey Garen. Make sure that getElementById() returns null when given an empty string ID: - https://dom.spec.whatwg.org/#concept-id Test: imported/w3c/web-platform-tests/dom/nodes/DocumentFragment-getElementById.html * dom/DocumentFragment.cpp: (WebCore::DocumentFragment::getElementById const): * dom/TreeScope.cpp: (WebCore::TreeScope::getElementById const): 2020-04-07 Timothy Hatcher WKUserScripts deferred from injection are not injected if -[WKWebView _notifyUserScripts] is called early. https://bugs.webkit.org/show_bug.cgi?id=210131 rdar://problem/61368446 Reviewed by Brady Eidson. If Page::notifyToInjectUserScripts() is called early, before Frame::injectUserScripts() happens, m_hasBeenNotifiedToInjectUserScripts will be false, allowing scripts to build up in m_userScriptsAwaitingNotification and never being injected (since Page::notifyToInjectUserScripts() will not be called again). * page/Page.cpp: (WebCore::Page::notifyToInjectUserScripts): Set m_hasBeenNotifiedToInjectUserScripts to true when called. 2020-04-07 Devin Rousso Web Inspector: unable to see cookies on pages that have subframes which have been denied access to cookies https://bugs.webkit.org/show_bug.cgi?id=210125 Reviewed by Timothy Hatcher. Previously, the same boolean value was re-used when checking whether that URL and `document` pairs is able to access cookies, meaning that if the last check returned `false`, the logic would incorrectly think that none of the URL and `document` pairs would have access to any cookies, resulting in an empty array. Instead of using this all-or-nothing boolean, if a URL and `document` pair is not able to access cookies, simply ignore it and move on to the next pair. * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::getCookies): 2020-04-07 Ryosuke Niwa TextManipulationController fails to replace a paragraph that ends with a br https://bugs.webkit.org/show_bug.cgi?id=210099 Reviewed by Wenson Hsieh. The bug was caused by TextManipulationController::replace not ignoring the br at the end of a paragraph even through it doesn't appear as a token. We also need to insert this br back at the end of the paragraph when completing the manipulation. * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::replace): 2020-04-07 Jer Noble Make sure playback of remote audio tracks is stable even if pages are using webaudio https://bugs.webkit.org/show_bug.cgi?id=210052 Reviewed by Eric Carlson. If a client requests data from AudioSampleDataSource, and the time requested happens to land precicely on the end of the AudioSampleDataSoure's CARingBuffer's range, the function will get into an inconsistent state where it believes both that not enough samples are available to fulfill the request, but also that the number of frames available is equal to the number of requested frames. This is due to an off-by-one error, where the end of the CARingBuffer's range is incorrectly treated as inclusive, rather than exclusive. All subsequent requests will start at sampleCount + timestamp, as if that data was returned correctly, rather than returning zeros, propogating the error to future requests. Fix this state by correctly checking if timestamp is greater-than-or-equal-to endFrame. This will cause the method to return zero frames, and correctly apply an offset so the next request will start at the same effective timestamp. * platform/audio/mac/AudioSampleDataSource.mm: (WebCore::AudioSampleDataSource::pullSamplesInternal): 2020-04-07 Alicia Boya García [GStreamer] Log a warning if playbin is not found https://bugs.webkit.org/show_bug.cgi?id=210112 Reviewed by Philippe Normand. I spent quite a bit of time looking in the debugger for what ended up being a trivial configuration issue because there was no logging showing any obvious problem. Let's add it. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::isAvailable): 2020-04-07 Adrian Perez de Castro [GTK] CMake find module for GTK4 https://bugs.webkit.org/show_bug.cgi?id=210110 Reviewed by Don Olmstead. No new tests needed. * PlatformGTK.cmake: Use the GTK::GTK imported target. 2020-04-07 Andres Gonzalez Initialization of modal nodes should happen lazily, not in the AXObjectCache constructor. https://bugs.webkit.org/show_bug.cgi?id=210090 Reviewed by Chris Fleizach. - The initialization of modal nodes was performed in the AXObjectCache constructor, which is not necessary. Instead, this change performs the initialization of the modal nodes before they are needed. - updateCurrentModalNode was replaced with currentModalNode, and its implementation cleaned up. - Now the initialization and update of AXObjectCached::m_modalNodesSet and m_currentMOdalNode is clearer. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::AXObjectCache): (WebCore::AXObjectCache::findModalNodes): (WebCore::AXObjectCache::currentModalNode const): (WebCore::AXObjectCache::modalNode): (WebCore::AXObjectCache::handleModalChange): (WebCore::AXObjectCache::updateCurrentModalNode): Renamed currentModalNode. * accessibility/AXObjectCache.h: 2020-04-07 Youenn Fablet Remove unnecessary memory allocation from RealtimeIncomingAudioSourceCocoa::OnData https://bugs.webkit.org/show_bug.cgi?id=209969 Reviewed by Eric Carlson. Instead of allocating a new buffer for every audio chunk and copy the audio chunk, Create a WebAudioBufferList once (without any buffer allocation) and set the audio buffer pointer given by libwebrtc as the WebAudioBufferList buffer pointer. We do not take care of muted state anymore since this is done by consumers anyway. Covered by existing tests. * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp: (WebCore::RealtimeIncomingAudioSourceCocoa::OnData): * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.h: 2020-04-07 Claudio Saavedra [GTK] gtk_icon_info_free is deprecated since GTK+ 3.8 https://bugs.webkit.org/show_bug.cgi?id=118381 Reviewed by Carlos Garcia Campos. GtkIconInfo is a GObject since 3.8, update accordingly. * platform/graphics/gtk/ImageGtk.cpp: (WebCore::loadMissingImageIconFromTheme): * platform/gtk/GUniquePtrGtk.h: 2020-04-07 Doug Kelly Add release asserts to KeyframeEffectStack::ensureEffectsAreSorted() https://bugs.webkit.org/show_bug.cgi?id=210084 Reviewed by Ryosuke Niwa. To ensure any potential problems in KeyframeEffectStack::ensureEffectsAreSorted() are found closer to the root cause, add several RELEASE_ASSERTs throughout this function (and its associated comparison function). This should guard against null pointers/null WeakPtrs, as well as other state problems which would be unexpected for the comparison function used by std::sort. No new tests; this only adds additional asserts, so there is no change to functionality, and this code is covered by existing tests. * animation/KeyframeEffectStack.cpp: (WebCore::KeyframeEffectStack::ensureEffectsAreSorted): * animation/WebAnimationUtilities.cpp: (WebCore::compareAnimationsByCompositeOrder): 2020-04-07 Rob Buis Use GlobalFrameIdentifier in NavigationAction https://bugs.webkit.org/show_bug.cgi?id=210036 Reviewed by Darin Adler. Use GlobalFrameIdentifier in NavigationAction rather than adding yet another custom data type. * loader/NavigationAction.cpp: (WebCore::createGlobalFrameIdentifier): (WebCore::m_globalFrameIdentifier): * loader/NavigationAction.h: (WebCore::NavigationAction::Requester::globalFrameIdentifier const): (WebCore::NavigationAction::Requester::pageID const): Deleted. (WebCore::NavigationAction::Requester::frameID const): Deleted. 2020-04-06 Jack Lee Nullptr crash in CompositeEditCommand::splitTreeToNode when inserting image in anchor element that has uneditable parent https://bugs.webkit.org/show_bug.cgi?id=210004 Reviewed by Ryosuke Niwa. RemoveNodePreservingChildren can fail and leave the children dangling if the parent of the node is uneditable. Added editability check for the to-be-removed node. Test: editing/inserting/insert-img-anchor-uneditable-parent.html * editing/RemoveNodePreservingChildrenCommand.cpp: (WebCore::RemoveNodePreservingChildrenCommand::doApply): 2020-04-06 David Kilzer Use-after-move of Vector in TextManipulationController::observeParagraphs() Reviewed by Ryosuke Niwa. * editing/TextManipulationController.cpp: (WebCore::TextManipulationController::observeParagraphs): - Replace WTFMove() with std::exchange() to fix the clang static analyzer warning. For WTF::Vector, this has no change in behavior. 2020-04-06 Jack Lee Nullptr crash in WebCore::lastPositionInNode when indenting text node that has user-select:all parent. https://bugs.webkit.org/show_bug.cgi?id=210016 Reviewed by Ryosuke Niwa. In rangeForParagraphSplittingTextNodesIfNeeded, added null check for previousSibling() after splitTextNode is called, and returns empty positions to caller. In formatSelection, check the returned positions from rangeForParagraphSplittingTextNodesIfNeeded and stop indenting the rest of the paragraphs. Test: fast/editing/indent-pre-user-select-all-crash.html * editing/ApplyBlockElementCommand.cpp: (WebCore::ApplyBlockElementCommand::formatSelection): (WebCore::ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded): 2020-04-06 Devin Rousso Web Inspector: `console.log(...)` appear as `CONSOLE LOG LOG` in the system console https://bugs.webkit.org/show_bug.cgi?id=210083 Reviewed by Timothy Hatcher. * page/PageConsoleClient.cpp: (WebCore::PageConsoleClient::addMessage): Use the actual `MessageSource` and `MessageType` when printing console messages. 2020-04-06 Wenson Hsieh REGRESSION: 4 TestWebKitAPI.DragAndDropTests.DataTransferSetData tests failing on iOS https://bugs.webkit.org/show_bug.cgi?id=209685 Reviewed by Megan Gardner. After updating a WebKit open source test runner to iOS 13.4, 4 pasteboard-related API tests began to fail in release builds on that particular bot. Logging statements added in r259465, r259518, r259534, and r259541 strongly suggest that this is due to an IPC dispatch race when clearing the platform pasteboard before writing custom pasteboard data. On iOS, the former is dispatched asynchronously, while the latter is dispatched as sync IPC. This means that if the UI process happens to be waiting for a sync IPC response from the web process, it will end up handling the incoming IPC messages out of order by immediately dispatching sync IPC (in this case, writing custom pasteboard data) before dispatching the async IPC (clearing data). This causes the custom pasteboard data to be cleared on the platform pasteboard immediately after it is written. To fix this, we limit clearing pasteboard data to when we would've otherwise avoided writing any custom pasteboard data, and additionally make it so that writing custom pasteboard data always clears out any pre- existing content on the pasteboard (obviating the need for a separate message to clear the pasteboard). Note that writing custom pasteboard data always clears the existing pasteboard on macOS and iOS -- on macOS, we use `-declareTypes:owner:`; on iOS, we use `-setItemProviders:`; in the case of macCatalyst, we `-setItems:`. * dom/DataTransfer.cpp: (WebCore::DataTransfer::commitToPasteboard): Push the call to clear the pasteboard down from the call sites of `commitToPasteboard` into `commitToPasteboard` itself; then, only explicitly clear the pasteboard in the case where we aren't writing custom pasteboard data (i.e. either custom pasteboard data is disabled, or there is no data to write), (WebCore::DataTransfer::moveDragState): See above. * editing/Editor.cpp: (WebCore::dispatchClipboardEvent): See above. * platform/ios/WebItemProviderPasteboard.mm: (-[WebItemProviderPasteboard stageRegistrationLists:]): Remove always-on logging added in r259541 to help diagnose the test failures. 2020-04-06 Zalan Bujtas Delete line boxes when moving text renderers between block flows https://bugs.webkit.org/show_bug.cgi?id=210000 Reviewed by Antti Koivisto. After style and/or tree mutation the existing line boxes are destroyed during the subsequent layout. When the text renderer moves between block flows and the destination block flow initiates a different type of line layout, we need to make sure the previous line content is cleaned up properly. * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::layoutSimpleLines): (WebCore::RenderBlockFlow::layoutLFCLines): * rendering/RenderText.cpp: (WebCore::RenderText::removeAndDestroyTextBoxes): (WebCore::RenderText::dirtyLineBoxes): (WebCore::RenderText::deleteLineBoxes): * rendering/RenderText.h: 2020-04-06 Ross Kirsling Update minimum ICU version to 60.2 https://bugs.webkit.org/show_bug.cgi?id=209694 Reviewed by Darin Adler. * PlatformMac.cmake: * WebCore.xcodeproj/project.pbxproj: * icu/LICENSE: Deleted. * icu/README: Deleted. Remove leftover files following r219155 as well as a corresponding Xcode step. * editing/cocoa/DataDetection.mm: (WebCore::buildQuery): * page/ios/FrameIOS.mm: (WebCore::Frame::interpretationsForCurrentRoot const): * platform/cocoa/KeyEventCocoa.mm: (WebCore::keyForCharCode): * platform/cocoa/TelephoneNumberDetectorCocoa.cpp: (WebCore::TelephoneNumberDetector::find): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::createFontForCharacters): (WebCore::FontCache::prewarm): * platform/graphics/mac/ComplexTextControllerCoreText.mm: (WebCore::provideStringAndAttributes): * platform/graphics/mac/GlyphPageMac.cpp: (WebCore::GlyphPage::fill): Manually convert between UChar and UniChar/unichar where needed. * platform/text/CharacterProperties.h: (WebCore::isEmojiGroupCandidate): (WebCore::isEmojiWithPresentationByDefault): (WebCore::isEmojiModifierBase): (WebCore::icuLibraryUnderstandsSupplementalSymbolsAndPictographs): Deleted. Remove obsoleted compile-time and runtime version checks. 2020-04-06 Simon Fraser Make ScrollableArea TextStream-loggable https://bugs.webkit.org/show_bug.cgi?id=210042 Reviewed by Darin Adler. ScrollableArea is a pure virtual base class, so has to dump via a virtual function, so add debugDescription() and implement it in derived classes. Make the common pattern be that operator<<(TextStream&, ...) calls debugDescription. * page/Frame.cpp: (WebCore::Frame::debugDescription const): (WebCore::operator<<): * page/Frame.h: * page/FrameView.cpp: (WebCore::FrameView::debugDescription const): (WebCore::operator<<): * page/FrameView.h: * platform/ScrollView.cpp: (WebCore::ScrollView::debugDescription const): * platform/ScrollView.h: * platform/ScrollableArea.cpp: (WebCore::operator<<): * platform/ScrollableArea.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::debugDescription const): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): * rendering/RenderListBox.cpp: (WebCore::RenderListBox::debugDescription const): * rendering/RenderListBox.h: 2020-04-06 Jack Lee Nullptr crash in CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary with draggable text https://bugs.webkit.org/show_bug.cgi?id=209999 Reviewed by Ryosuke Niwa. VisibleParagraphStart/End may return empty VisiblePosition if no proper element or node can be used as position candidate. Add null check for the returned VisiblePositions. Test: fast/css/style-change-draggable-text.html * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary): 2020-04-06 Jer Noble Strengthen the ASSERT in ImageDecoderAVFObjC::storeSampleBuffer(). https://bugs.webkit.org/show_bug.cgi?id=209972 Reviewed by Brent Fulgham. * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (WebCore::ImageDecoderAVFObjC::storeSampleBuffer): 2020-04-06 Jer Noble [ Mac wk2 ] http/tests/media/track-in-band-hls-metadata.html is flaky crashing. https://bugs.webkit.org/show_bug.cgi?id=209490 Reviewed by Darin Adler. To ensure the TaskDispatcher doesn't get destroyed on a background thread at the same time it's executing tasks on the main thread, when a GenericTaskQueue is destroyed on a background thread, move the TaskDispatcher into a task, and use the dispatcher itself to destroy itself on the main thread. * platform/GenericTaskQueue.h: (WebCore::GenericTaskQueue::GenericTaskQueue): (WebCore::GenericTaskQueue::~GenericTaskQueue): (WebCore::GenericTaskQueue::enqueueTask): 2020-04-06 Antti Koivisto 'currentcolor' doesn't need setHasExplicitlyInheritedProperties marking anymore https://bugs.webkit.org/show_bug.cgi?id=210017 Reviewed by Darin Adler. Removing this marking reveals problems in style update avoidance code in CSSComputedStyleDeclaration that also need to be addressed. The problems are not specific to exlicit 'currentcolor', they also reproduce with the initial value (thus the new test). Test: fast/css/currentColor-initial-style-update.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::nonInheritedColorPropertyHasValueCurrentColor): Add a helper. (WebCore::hasValidStyleForProperty): Treat a non-inherited color property as inherited if it is 'currentcolor'. (WebCore::updateStyleIfNeededForProperty): Expand shorthands so properties like border-color test correctly. * css/CSSProperty.cpp: (WebCore::CSSProperty::isColorProperty): Move here from CSSParserFastPaths. * css/CSSProperty.h: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::maybeParseValue): (WebCore::isColorPropertyID): Deleted. * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::unresolvedColorForProperty const): Factor into a helper. Handle all color values. (WebCore::RenderStyle::colorResolvingCurrentColor const): Renamed for clarity and some cleanups. (WebCore::RenderStyle::visitedDependentColor const): (WebCore::RenderStyle::colorIncludingFallback const): Deleted. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::isCurrentColor): * style/StyleBuilderState.cpp: (WebCore::Style::BuilderState::colorFromPrimitiveValue const): Remove setHasExplicitlyInheritedProperties marking. 2020-04-06 Simon Fraser Make RenderObject TextStream-loggable https://bugs.webkit.org/show_bug.cgi?id=210035 Post-landing followup. More use of StringBuilder's variadic append. Have Node::debugDescription() include its address, and have derived classes get the base class debugDescription(). Add an override in Text. * dom/Element.cpp: (WebCore::Element::debugDescription const): * dom/Node.cpp: (WebCore::Node::debugDescription const): * dom/Text.cpp: (WebCore::Text::debugDescription const): (WebCore::Text::formatForDebugger const): * dom/Text.h: * rendering/RenderObject.cpp: (WebCore::RenderObject::debugDescription const): 2020-04-06 Cathie Chen The change of zoom shouldn't affect ResizeObserverSize https://bugs.webkit.org/show_bug.cgi?id=209947 Reviewed by Simon Fraser. Zoom in/out shouldn't affect ResizeObserverSize. Use adjustLayoutUnitForAbsoluteZoom instead. Test: imported/w3c/web-platform-tests/resize-observer/resize-observer-with-zoom.html * page/ResizeObservation.cpp: (WebCore::ResizeObservation::computeObservedSize const): 2020-04-06 Antoine Quint [Web Animations] Move Document.getAnimations() to DocumentOrShadowRoot https://bugs.webkit.org/show_bug.cgi?id=202192 Reviewed by Antti Koivisto. We remove the getAnimations() declaration from the Document interface and instead move it on the DocumentOrShadowRoot interface. We add the new method Document::matchingAnimations() which takes a lambda that is provided an animation's effect's target to determine whether that animation should be found in the list of animations. In the case of Document::getAnimations(), we filter out animations targeting elements hosted in shadow roots, while in ShadowRoot:getAnimations(), we filter out animations targeting elements that are not hosted in the shadow root the method was called on. * dom/Document.cpp: (WebCore::Document::getAnimations): (WebCore::Document::matchingAnimations): * dom/Document.h: * dom/Document.idl: * dom/DocumentOrShadowRoot.idl: * dom/Element.cpp: (WebCore::Element::getAnimations): * dom/ShadowRoot.cpp: (WebCore::ShadowRoot::getAnimations): * dom/ShadowRoot.h: 2020-04-04 Darin Adler Stop using live ranges in DocumentMarkerController https://bugs.webkit.org/show_bug.cgi?id=209985 Reviewed by Antti Koivisto. - Removed uses of live ranges from DocumentMarkerController. - Removed "active/inactive text match marker", which was only ever used by Chromium, and has been dead code in WebKit for while now. - Made a replacement for Range::absoluteTextQuads, in RenderObject, and moved all callers over. - Added a fast path for Node::isCharacterDataNode that makes it work without a virtual function call for the common node types. - Added a Node::length function that matches the DOM specification's definiton of a node's length, part of how ranges are defined. - Added a structure OffsetRange to represent start/end offsets within a single character data node. This is a common idiom to handle possible partial selection of text nodes at the start and end of the range when iterating text within a range. - Changed DocumentMarker functions to use OffsetRange. - Added helper functions for turning a vector of quads into a vector of bounding box rectangles, and for computing a union of all the rectangles, since both of these are common coding patterns. - Added an intersectingNodes function, producing a for-loop-compatible range for iterating all nodes covered by a DOM range. - Changed RenderObject::SetLayoutNeededForbiddenScope so it can be used without an #if at each call site, expands to nothing in release builds. - Eliminated uses of RetainPtr instead of just id to pass arguments. * dom/CharacterData.h: Updated since isCharacterDataNode is no longer a virtual function. * dom/Document.cpp: (WebCore::Document::textInserted): Pass an OffsetRange to removeMarkers. (WebCore::Document::textRemoved): Ditto. * dom/DocumentMarker.h: Removed most platform-specific functions. Removed the active match boolean, which was only ever used for Chromium. Use OffsetRange. Updated some obsolete comments. * dom/DocumentMarkerController.cpp: Removed include of "Range.h". (WebCore::DocumentMarkerController::collectTextRanges): Change return value to return a structure with a node and an offset range rather than using a SimpleRange; adds clarity to the fact that it's guranteed to be only a single node. May even want to consider some day moving TextIterator over to this, but it's definitely better here for now. (WebCore::DocumentMarkerController::addMarker): Updated for the change to collectTextRanges and to DocumentMarker construction, and to use construction syntax that doesn't repeat the DocumentMarker class name. Deleted overloads that are no longer needed. (WebCore::DocumentMarkerController::addMarkerToNode): Ditto. (WebCore::DocumentMarkerController::addTextMatchMarker): Ditto. (WebCore::DocumentMarkerController::addDictationPhraseWithAlternativesMarker): Deleted. (WebCore::DocumentMarkerController::addDictationResultMarker): Deleted. (WebCore::DocumentMarkerController::addDraggedContentMarker): Updated as above. (WebCore::DocumentMarkerController::addPlatformTextCheckingMarker): Deleted. (WebCore::DocumentMarkerController::copyMarkers): Fix a mistake where copying markers would have a side effect of modifying the original. (WebCore::DocumentMarkerController::removeMarkers): Just have this call filterMarkers with null for the function. (WebCore::DocumentMarkerController::filterMarkers): Updated for the change to collectTextRanges and to pass a OffsetRange. (WebCore::updateRenderedRectsForMarker): Use SimpleRange instead of a live range. Use the new RenderObject::absoluteTextQuads and boundingBoxes functions to make this clearer and simpler. (WebCore::shouldInsertAsSeparateMarker): Update for changes to DocumentMarker. (WebCore::DocumentMarkerController::copyMarkers): Take an OffsetRange instead of a start and length. Also removed the unused "delta" argument since all callers were passing 0. (WebCore::DocumentMarkerController::removeMarkers): Removed unneeded check if a key is still in the map. (WebCore::DocumentMarkerController::forEach): Added. Shared logic for the multiple functions that iterate the markers covered by a SimpleRange. (WebCore::DocumentMarkerController::markersInRange): Call forEach. (WebCore::DocumentMarkerController::repaintMarkers): Simplified loops. (WebCore::DocumentMarkerController::setMarkersActive): Deleted. Was only used for Chromium and has been dead code since. (WebCore::DocumentMarkerController::hasMarkers): Call forEach. (WebCore::DocumentMarkerController::clearDescriptionOnMarkersIntersectingRange): Call forEach. * dom/DocumentMarkerController.h: Updated for the above. * dom/Element.cpp: (WebCore::Element::boundsInRootViewSpace): Use unitedBoundingBoxes. (WebCore::Element::absoluteEventBounds): Ditto. (WebCore::Element::boundingAbsoluteRectWithoutLayout): Ditto. * dom/Node.h: Added inline fast path for isCharacterDataNode. Moved some inline function bodies out of class definition so it's easier to read it and get an overview. * dom/Range.cpp: (WebCore::Range::absoluteRectsForRangeInText const): Use boundingBoxes. (WebCore::Range::absoluteTextQuads const): Deleted. (WebCore::Range::borderAndTextRects const): Use boundingBoxes. * dom/Range.h: Deleted absoluteTextQuads. * dom/RenderedDocumentMarker.h: Use rvalue references and move. * dom/SimpleRange.cpp: (WebCore::fastIsCharacterData): Deleted. Moved the optimizations into Node::isCharacterDataNode so now all callers get them. (WebCore::length): Deleted. Moved to Node::length. (WebCore::makeBoundaryPointAfterNodeContents): Use Node::length. (WebCore::IntersectingNodeRange::first const): Added. (WebCore::IntersectingNodeRange::sentinel const): Added. (WebCore::characterDataOffsetRange): Added. (WebCore::IntersectingNodeIterator::operator++): Added. * dom/SimpleRange.h: Added intersectingNodes function, and the IntersectingNodeRange and IntersectingNodeIterator classes used to make it work. Added the OffsetRange structure and the characterDataOffsetRange function, also to help with iteration. * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord): Take out unneeded holds_alternative check. (WebCore::AlternativeTextController::removeDictationAlternativesForMarker): Removed unneeded assertion. (WebCore::AlternativeTextController::dictationAlternativesForMarker): Removed unneeded assertion. (WebCore::AlternativeTextController::applyDictationAlternative): Removed unneeded local variables. (WebCore::AlternativeTextController::show): Pass reference to range rather than pointer to rootViewRectForRange. (WebCore::AlternativeTextController::timerFired): Ditto. (WebCore::AlternativeTextController::rootViewRectForRange const): Take a SimpleRange instead of a live range. Also use RenderObject::absoluteTextQuads and unitedBoundingBoxes. * editing/AlternativeTextController.h: Updated for above. * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers): Removed most of the code since we can copy marker data without separate code for each type. Also use SimpleRange instead of a live range. * editing/DictationCommand.cpp: Call addMarker instead of addMarkerToNode. * editing/Editing.cpp: (WebCore::visiblePositionForIndexUsingCharacterIterator): Use SimpleRange instead of a live range. * editing/Editor.cpp: (WebCore::Editor::updateMarkersForWordsAffectedByEditing): Removed a local variable. * editing/Editor.h: Remove use of RetainPtr for arguments. * editing/FrameSelection.cpp: (WebCore::FrameSelection::getTextRectangles const): Deleted. (WebCore::FrameSelection::getClippedVisibleTextRectangles const): Merged the logic from getTextRectangles in here, and changed to use RenderObject::absoluteTextQuads and boundingBoxes. * editing/FrameSelection.h: Updated for above. * editing/SplitTextNodeCommand.cpp: (WebCore::SplitTextNodeCommand::doApply): Updated for changes to the copyMarkers function. (WebCore::SplitTextNodeCommand::doUnapply): Ditto. * editing/cocoa/DataDetection.mm: (WebCore::detectItemAtPositionWithRange): Use RenderObject::absoluteTextQuads and unitedBoundingBoxes. * editing/ios/DictationCommandIOS.cpp: (WebCore::DictationCommandIOS::DictationCommandIOS): Remove use of RetainPtr for arguments. (WebCore::DictationCommandIOS::create): Move from header. (WebCore::DictationCommandIOS::doApply): Updated to do the work here since we don't have addDictationPhraseWithAlternativesMarker any more. Specifically, remove the first interpretation, which leaves behind a vector of alternatives. Same for addDictationResultMarker. * editing/ios/DictationCommandIOS.h: Updated for the above. * editing/ios/EditorIOS.mm: (WebCore::Editor::insertDictationPhrases): Take id instead of RetainPtr. (WebCore::Editor::setDictationPhrasesAsChildOfElement): Changed around since we don't have addDictationPhraseWithAlternativesMarker or addDictationResultMarker any more. * page/FrameView.cpp: (WebCore::FrameView::paintContents): Update for changes to SetLayoutNeededForbiddenScope. * page/ios/FrameIOS.mm: (WebCore::Frame::interpretationsForCurrentRoot const): Get alternatives directly from DocumentMarker::data, now that there is not a separate DocumentMarker::alternatives function. * page/mac/ServicesOverlayController.mm: (WebCore::textQuadsToBoundingRectForRange): Deleted. (WebCore::ServicesOverlayController::buildPhoneNumberHighlights): Use RenderObject::absoluteTextQuads, unitedBoundingBoxes, and enclosingIntRect to do what textQuadsToBoundingRectForRange did. * platform/SerializedPlatformDataCueValue.h: Remove definition of id since that's now done in RetainPtr.h. * platform/graphics/FloatQuad.cpp: (WebCore::boundingBoxes): Added. (WebCore::unitedBoundingBoxes): Added. * platform/graphics/FloatQuad.h: A couple tweaks, plus declared the functions above. * platform/network/ResourceHandle.h: Remove definition of id since that's now done in RetainPtr.h. * platform/network/cf/AuthenticationChallenge.h: Ditto. * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::resolveStyleForMarkedText): Take out isActiveMatch logic that was used for Chromium only. * rendering/RenderBox.cpp: (WebCore::RenderBox::minPreferredLogicalWidth const): Update for changes to SetLayoutNeededForbiddenScope. (WebCore::RenderBox::maxPreferredLogicalWidth const): Ditto. * rendering/RenderCounter.cpp: (WebCore::RenderCounter::computePreferredLogicalWidths): Ditto. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::paintIntoLayer): Ditto. * rendering/RenderObject.cpp: (WebCore::RenderObject::SetLayoutNeededForbiddenScope::SetLayoutNeededForbiddenScope): Changed to take a const& instead of a *. (WebCore::RenderObject::SetLayoutNeededForbiddenScope::~SetLayoutNeededForbiddenScope): Ditto. (WebCore::RenderObject::markContainingBlocksForLayout): Update for changes to SetLayoutNeededForbiddenScope. (WebCore::RenderObject::absoluteBoundingBoxRect const): Use unitedBoundingBoxes and enclosingIntRect. (WebCore::RenderObject::absoluteBoundingBoxRectForRange): Use the new RenderObject::absoluteTextQuads and unitedBoundingBoxes. (WebCore::RenderObject::absoluteTextQuads): Added. Moved here from Range::absoluteTextQuads, but refactored for simplicity and removed the unused, and mildly complex to implement, feature that would indicate whether some or all of the quads were from fixed positioning. * rendering/RenderObject.h: Tweaked comments. Moved multi-line function bodies out of the RenderObject class definition to make it easier to read. Declared a new absoluteTextQuads function. Made m_setNeedsLayoutForbidden so setNeedsLayoutIsForbidden can be const. Conditionalized isSetNeedsLayoutForbidden and SetLayoutNeededForbiddenScope so both can be used in production builds but expand to no code. * rendering/RenderReplaced.cpp: (WebCore::draggedContentContainsReplacedElement): Simplified and updated now that the dragged content data no longer has its own named structure. (WebCore::RenderReplaced::paint): Update for changes to SetLayoutNeededForbiddenScope. * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::calcRowLogicalHeight): Ditto. (WebCore::RenderTableSection::layoutRows): Ditto. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::textSearchHighlightColor const): Removed the Chromium-only concept of active vs. inactive text search highlight colors. (WebCore::RenderTheme::platformTextSearchHighlightColor const): Ditto. (WebCore::RenderTheme::activeTextSearchHighlightColor const): Deleted. (WebCore::RenderTheme::inactiveTextSearchHighlightColor const): Deleted. (WebCore::RenderTheme::platformActiveTextSearchHighlightColor const): Deleted. (WebCore::RenderTheme::platformInactiveTextSearchHighlightColor const): Deleted. * rendering/RenderTheme.h: Ditto. * rendering/RenderThemeMac.h: Ditto. * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::platformTextSearchHighlightColor const): Ditto. (WebCore::RenderThemeMac::platformActiveTextSearchHighlightColor const): Deleted. (WebCore::RenderThemeMac::platformInactiveTextSearchHighlightColor const): Deleted. * testing/Internals.cpp: (WebCore::Internals::addTextMatchMarker): Deleted. Was only used for a test of Chromium-specific scroll tick marks. * testing/Internals.h: Deleted addTextMatchMarker. * testing/Internals.idl: Ditto. 2020-04-06 Antti Koivisto Remove instance fields and methods from StyleColor https://bugs.webkit.org/show_bug.cgi?id=210045 Reviewed by Zalan Bujtas. They are unused. The type itself remains as a namespace for static functions. We might want bring it back later but there is no need to leave dead code around now. * css/StyleColor.h: (WebCore::StyleColor::StyleColor): Deleted. (WebCore::StyleColor::currentColor): Deleted. (WebCore::StyleColor::isCurrentColor const): Deleted. (WebCore::StyleColor::getColor const): Deleted. (WebCore::StyleColor::resolve const): Deleted. (WebCore::operator==): Deleted. (WebCore::operator!=): Deleted. 2020-04-06 Said Abou-Hallawa CanvasRenderingContext2D.drawImage should ignore the EXIF orientation if the image-orientation is none https://bugs.webkit.org/show_bug.cgi?id=209849 Reviewed by Darin Adler. drawImage() will get the image-orientation of the HTMLImageElement from its computed style. This will be passed to GraphicsContext::drawImage() in the ImagePaintingOptions. Previously we were passing FromImage always. Test: fast/images/image-orientation-none-canvas.html * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::drawImage): * html/canvas/CanvasRenderingContext2DBase.h: 2020-04-05 Rob Buis Remove code that has no effect from loadURL https://bugs.webkit.org/show_bug.cgi?id=210029 Reviewed by Darin Adler. Remove setDomainForCachePartition from loadURL since it will be overwritten in DocumentLoader::loadMainResource, this was introduced by r213126. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): 2020-04-05 Manuel Rego Casasnovas Computed style for "outline-offset" is wrong when "outline-style" is "none" https://bugs.webkit.org/show_bug.cgi?id=209913 Reviewed by Daniel Bates. Computed style for outline-offset was not returning the proper value if "outline-style" was "none". This was due to a check in RenderStyle::outlineOffset() that this patch removes. This code could be there because this is needed for "outline-width" as specified in the spec (https://drafts.csswg.org/css-ui/#outline-props), however there's nothing about this on the "outline-offset" property. Test: imported/w3c/web-platform-tests/css/css-ui/parsing/outline-offset-computed.html * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::outlineOffset const): 2020-04-05 Peng Liu The value of [AVPlayerViewController isPictureInPicturePossible] is NO in the first attempt to enter PiP https://bugs.webkit.org/show_bug.cgi?id=204979 Reviewed by Darin Adler. We should use "#if HAVE(AVOBSERVATIONCONTROLLER)" instead of "#if HAVE(HAVE_AVOBSERVATIONCONTROLLER)". * platform/ios/VideoFullscreenInterfaceAVKit.mm: (-[WebAVPlayerViewController initWithFullscreenInterface:]): (VideoFullscreenInterfaceAVKit::doEnterFullscreen): 2020-04-05 Wenson Hsieh Address review comments after r259550 https://bugs.webkit.org/show_bug.cgi?id=208472 Reviewed by Darin Adler. * platform/ios/ValidationBubbleIOS.mm: Change a few named constants to be `constexpr` instead, and add comments describing their purpose. (label): (updateLabelFrame): Rename these helper functions and move them up the file. Turn what was previously named `WebValidationBubbleViewController_labelFrame` into `updateLabelFrame`, and have it additionally update the view controller's label's frame to avoid repeating this logic in the subclassed method implementations below. (callSuper): (WebValidationBubbleViewController_viewDidLoad): (WebValidationBubbleViewController_viewWillLayoutSubviews): (WebValidationBubbleViewController_viewSafeAreaInsetsDidChange): (allocWebValidationBubbleViewControllerInstance): Instead of using `-valueForKey`, use `objc_getAssociatedObject` and `objc_setAssociatedObject`, with `OBJC_ASSOCIATION_RETAIN_NONATOMIC`. (WebCore::ValidationBubble::ValidationBubble): (invokeUIViewControllerSelector): Deleted. (WebValidationBubbleViewController_dealloc): Deleted. Remove the -dealloc override. We don't need this anymore, since we're now using associated objects with `OBJC_ASSOCIATION_RETAIN_NONATOMIC` to hold on to and keep track of our label. (WebValidationBubbleViewController_labelFrame): Deleted. (WebValidationBubbleViewController_label): Deleted. 2020-04-05 Simon Fraser Make RenderObject TextStream-loggable https://bugs.webkit.org/show_bug.cgi?id=210035 Reviewed by Zalan Bujtas. Add operator<<(TextStream, const RenderObject&) and add virtual debugDescription() functions on Node and RenderObject which should eventually replace the awkward formatForDebugger(char* buffer, unsigned length). Convert RenderLayer to use renderer's debug description. * dom/Element.cpp: (WebCore::Element::debugDescription const): * dom/Element.h: * dom/Node.cpp: (WebCore::Node::debugDescription const): (WebCore::operator<<): * dom/Node.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::name const): * rendering/RenderObject.cpp: (WebCore::RenderObject::debugDescription const): (WebCore::operator<<): * rendering/RenderObject.h: 2020-04-05 Zan Dobersek Unreviewed, adding missing header inclusions to get non-unified build building. * html/HTMLCanvasElement.cpp: * loader/ResourceLoadNotifier.h: * workers/service/ServiceWorkerProvider.h: 2020-04-05 Wenson Hsieh [iOS] Ugly and misaligned form validation bubble https://bugs.webkit.org/show_bug.cgi?id=208472 Reviewed by Tim Horton. In iOS 13, the view of a `UIViewController` that is presented as a popover encompasses the arrow (connected to the popover) that points to the target rect. This means that our current logic for laying out the inner text label of a form validation bubble on iOS no longer works, since it sets a frame that is offset vertically and horizontally from the bounds of the view controller's view. To fix this, we need to respect the safe area insets of the view controller's view when laying out the label. The idiomatic way to do this is to subclass -viewSafeAreaInsetsDidChange and -viewWillLayoutSubviews on the view controller, and update the subview's (i.e. label's) frame; unfortunately, since ValidationBubble is implemented in WebCore, we can't explicitly link against UIKit, so we need to dynamically create a UIViewController subclass and override these subclassing hooks to get our desired behavior. * platform/ValidationBubble.h: * platform/ios/ValidationBubbleIOS.mm: (invokeUIViewControllerSelector): (WebValidationBubbleViewController_dealloc): (WebValidationBubbleViewController_viewDidLoad): (WebValidationBubbleViewController_viewWillLayoutSubviews): (WebValidationBubbleViewController_viewSafeAreaInsetsDidChange): (WebValidationBubbleViewController_labelFrame): (WebValidationBubbleViewController_label): (allocWebValidationBubbleViewControllerInstance): Subclass and create a custom UIViewController to ensure that the label is vertically centered in its popover. See above for more details. (WebCore::ValidationBubble::ValidationBubble): (WebCore::ValidationBubble::show): Minor style fixes: remove extraneous `.get()`s on `RetainPtr`, and use property syntax when possible. (WebCore::ValidationBubble::setAnchorRect): Additionally remove a line of code that currently forces the form validation popover to present below its target rect (and therefore have an arrow pointing up). It wasn't apparent why this logic was added in r208361, but it seems the intention wasn't to restrict the popover to presenting below the target. This allows the form validation popover to show up in the case where the input element is aligned to the very bottom of the web view, such that there isn't enough space below the field to show the validation bubble. 2020-04-04 Rob Buis Remove LockHistory parameter from loadWithNavigationAction https://bugs.webkit.org/show_bug.cgi?id=210007 Reviewed by Darin Adler. Remove LockHistory parameter from loadWithNavigationAction since NavigationAction has a member for this. Where needed explicitly set the LockHistory on the actions. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::loadWithNavigationAction): (WebCore::FrameLoader::loadPostRequest): (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): (WebCore::FrameLoader::loadDifferentDocumentItem): * loader/FrameLoader.h: 2020-04-04 David Kilzer Build fix v2: HTMLFormElement should use WeakPtr to keep track of its FormNamedItem https://bugs.webkit.org/show_bug.cgi?id=209925 * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::elementFromPastNamesMap const): (WebCore::HTMLFormElement::addToPastNamesMap): - Apply macros consistently. Regressed in r259513 and was not fixed by r259527. 2020-04-04 Wenson Hsieh Add a fourth round of logging to help diagnose https://bugs.webkit.org/show_bug.cgi?id=210011 Reviewed by Darin Adler. Augment logging in WebItemProviderPasteboard to additionally dump a backtrace when registering item providers when initiating a drag on iOS. Logging thus far suggests that this is due to an IPC dispatch race when sending the following messages to the UI process: `WebPasteboardProxy::writeCustomData` and `WebPasteboardProxy::writeStringToPasteboard`. While `writeCustomData` is dispatched synchronously, `writeStringToPasteboard` is dispatched asynchronously; this means that it is possible for the call to `writeCustomData` to be dispatched before `writeStringToPasteboard` even if the web process sends the `writeCustomData` message later, due to the UI-process-side mechanism for immediately dispatching incoming sync IPC if it is currently processing sync IPC itself. A backtrace here should help to confirm this theory. * platform/ios/WebItemProviderPasteboard.mm: (-[WebItemProviderPasteboard stageRegistrationLists:]): 2020-04-04 Doug Kelly Additional sanity checks in compareAnimationsByCompositeOrder() https://bugs.webkit.org/show_bug.cgi?id=209996 Reviewed by Geoffrey Garen. compareAnimationsByCompositeOrder() is used by std::sort() which requires strict weak ordering. This adds additional checks to ensure strict weak ordering is maintained, first by ensuring the transitionProperty string is different before returning that comparison, then by only using if the animation is a CSSTransition or CSSAnimation if the left hand and right hand sides differ. This should leave all remaining cases to sort by the global animation list. No new tests; this should be covered by existing tests and should not change functionality otherwise. * animation/WebAnimationUtilities.cpp: (WebCore::compareAnimationsByCompositeOrder): 2020-04-04 Wenson Hsieh Add even more logging to try and diagnose https://bugs.webkit.org/show_bug.cgi?id=210008 Reviewed by Tim Horton. * platform/ios/WebItemProviderPasteboard.mm: (-[WebItemProviderPasteboard stageRegistrationLists:]): 2020-04-04 Myles C. Maxfield Ahom text is busted https://bugs.webkit.org/show_bug.cgi?id=209898 Reviewed by Tim Horton. https://en.wikipedia.org/wiki/Ahom_language The Ahom language, U+11700 - U+1173F, requires the complex text codepath. This patch also makes some languages adjacent in codepoint-space (Dogra, Dives Akuru, Nandinagari, Zanabazar Square, Soyombo, Warang Citi, and Pau Cin Hau) use the complex path too. At some point, we really need to make the fast text codepath opt-in instead of opt-out. This patch is a simple band-aid fix until we can do that. No new tests because I can't find an appropriately licenced font. There is Noto Serif Ahom, but that's licenced under SIL OFL, and I'm not sure if that's an acceptable license to be committed to WebKit. https://github.com/googlefonts/noto-fonts/tree/master/hinted/NotoSerifAhom * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::characterRangeCodePath): 2020-04-04 Antti Koivisto Implement the css-color-4 behavior for inheritance of currentColor https://bugs.webkit.org/show_bug.cgi?id=193171 Reviewed by Simon Fraser. In CSS3/4 'currentcolor' inherits as 'currentcolor' instead of as a resolved color value. Value 'currentcolor' is represented in RenderStyle as invalid Color object. This has been true even before the explicit property value for it was added. Fallback to 'color' has always been the default behavior of most color properties. As a result the correct behavior falls pretty easily from WebKit code. It essentially amounts to allowing color properties to inherit normally even when they are invalid/currentcolor. In future we might want to wrap RenderStyle color values into a type that makes 'currentcolor' more explicit. * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): * css/CSSGradientValue.cpp: (WebCore::CSSGradientValue::gradientWithStylesResolved): * css/CSSProperties.json: - Remove 'no-default-color' which triggered to old inheritance behavior. - Rename initial value invalidColor to currentColor for clarity. * css/makeprop.pl: Code for 'no-default-color' generation is not needed anymore. (generateInheritValueSetter): * page/animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::colorIncludingFallback const): Resolve 'background-color' like the rest so setting it to 'currentcolor' works correctly. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::currentColor): (WebCore::RenderStyle::invalidColor): Deleted. * style/StyleBuilderCustom.h: (WebCore::Style::BuilderCustom::applyTextOrBoxShadowValue): * style/StyleBuilderState.cpp: (WebCore::Style::BuilderState::createFilterOperations): (WebCore::Style::BuilderState::colorFromPrimitiveValue const): Don't resolve 'currentcolor', instead return it as a value. (WebCore::Style::BuilderState::colorFromPrimitiveValueWithResolvedCurrentColor const): Helper for a few cases where we still resolve current color during style building time. It is used for filters and generated images. * style/StyleBuilderState.h: * svg/SVGStopElement.cpp: (WebCore::SVGStopElement::stopColorIncludingOpacity const): Resolve 'currentcolor' during use time for svg color stops. 2020-04-04 Peng Liu REGRESSION (r259095): ASSERTION FAILED: m_videoFullscreenMode != VideoFullscreenModeNone seen with TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS https://bugs.webkit.org/show_bug.cgi?id=209680 Reviewed by Jer Noble. API test: WebKitLegacy.PreemptVideoFullscreen Call fullscreenModeChanged(VideoFullscreenModeNone) right before calling the functions of ChromeClient to make sure the state (m_videoFullscreenMode) has the expected value when some callbacks come back to the video element. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::dispatchEvent): (WebCore::HTMLMediaElement::exitFullscreen): Add null pointer checkings to fix two crashes found in stress tests. * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::requestVideoContentLayer): (VideoFullscreenControllerContext::returnVideoContentLayer): 2020-04-03 David Kilzer Build fix: HTMLFormElement should use WeakPtr to keep track of its FormNamedItem https://bugs.webkit.org/show_bug.cgi?id=209925 * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::elementFromPastNamesMap const): - Apply macros consistently. Regressed in r259513. 2020-04-03 Jack Lee Protect contentFrame in SubframeLoader::loadOrRedirectSubframe with RefPtr. https://bugs.webkit.org/show_bug.cgi?id=127096 Reviewed by Alex Christensen. ContentFrame is used throughout loadOrRedirectSubframe so it needs to be protected with RefPtr. And if loader changes frame in SubframeLoader::loadSubframe, return nullptr to notify the caller. No new tests, covered by existing test. * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::loadOrRedirectSubframe): (WebCore::SubframeLoader::loadSubframe): * loader/SubframeLoader.h: 2020-04-03 Alex Christensen Add SPI to make WKUserScripts wait for a notification https://bugs.webkit.org/show_bug.cgi?id=209845 Reviewed by Chris Dumez. There's also SPI on WKWebView to provide this notification, and on WKWebViewConfiguration to start out with this notification. * dom/ExtensionStyleSheets.cpp: (WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache const): * html/ImageDocument.cpp: (WebCore::ImageDocument::createDocumentStructure): * html/MediaDocument.cpp: (WebCore::MediaDocumentParser::createDocumentStructure): * html/PluginDocument.cpp: (WebCore::PluginDocumentParser::createDocumentStructure): * html/parser/HTMLConstructionSite.cpp: (WebCore::HTMLConstructionSite::dispatchDocumentElementAvailableIfNeeded): * loader/FrameLoader.cpp: (WebCore::FrameLoader::finishedParsing): * page/Frame.cpp: (WebCore::Frame::injectUserScripts): (WebCore::Frame::injectUserScriptImmediately): * page/Page.cpp: (WebCore::m_deviceOrientationUpdateProvider): (WebCore::Page::notifyToInjectUserScripts): (WebCore::Page::addUserScriptAwaitingNotification): (WebCore::Page::injectUserStyleSheet): (WebCore::Page::removeInjectedUserStyleSheet): * page/Page.h: (WebCore::Page::hasBeenNotifiedToInjectUserScripts const): * page/PageConfiguration.h: * page/UserContentTypes.h: (): Deleted. * page/UserScript.h: (WebCore::UserScript::UserScript): (WebCore::UserScript::waitForNotificationBeforeInjecting const): (WebCore::UserScript::encode const): (WebCore::UserScript::decode): * page/UserScriptTypes.h: (): Deleted. * page/UserStyleSheet.h: (WebCore::UserStyleSheet::UserStyleSheet): * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::XMLDocumentParser::startElementNs): 2020-04-03 Alex Christensen Use-after-move of `formState` in WebCore::PolicyChecker::checkNavigationPolicy() https://bugs.webkit.org/show_bug.cgi?id=209987 Reviewed by Chris Dumez. Use std::exchange because formState is used later. No change in behavior, but this will allow use-after-move hunts to continue. * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): 2020-04-03 Sihui Liu ASSERTION FAILED: objectStoreInfo in SQLiteIDBBackingStore::getRecord https://bugs.webkit.org/show_bug.cgi?id=209976 Reviewed by Geoffrey Garen. Return error if objectStoreInfo is null in SQLiteIDBBackingStore::getRecord, because there is a possibility SQLiteIDBBackingStore does not have requested objectStoreInfo. * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord): 2020-04-03 Wenson Hsieh Add more logging to help diagnose https://bugs.webkit.org/show_bug.cgi?id=209988 Reviewed by Timothy Hatcher. Remove logging that was previously added in r259465. * platform/ios/WebItemProviderPasteboard.mm: (-[WebItemProviderPasteboard updateSupportedTypeIdentifiers:]): 2020-04-02 Ryosuke Niwa HTMLFormElement should use WeakPtr to keep track of its FormNamedItem https://bugs.webkit.org/show_bug.cgi?id=209925 Reviewed by Wenson Hsieh. Like r259393, this patch replaces the HashMap of AtomString to the raw pointer of a FormNamedItem by a HashMap of AtomString to WeakPtr of a FormNamedItem. It also replaces a bunch of ASSERT_WITH_SECURITY_IMPLICATIONs with ASSERTs since there are no more security implications left after this patch. * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::formElementIndex): (WebCore::HTMLFormElement::removeFormElement): (WebCore::HTMLFormElement::assertItemCanBeInPastNamesMap const): (WebCore::HTMLFormElement::elementFromPastNamesMap const): (WebCore::HTMLFormElement::addToPastNamesMap): (WebCore::HTMLFormElement::removeFromPastNamesMap): * html/HTMLFormElement.h: 2020-04-03 Tim Horton Add a visual debug indicator for locating and identifying all kinds of WebViews https://bugs.webkit.org/show_bug.cgi?id=209982 Reviewed by Simon Fraser. Add a debug overlay that can be enabled with a single switch for all *WebView variants, which indicates the type of *WebView in an unmissable, gaudy fashion. This is intended to address some shortcomings of existing mechanisms that people use to answer the "what kind of web view is X app using?" question. Specifically: - it will appear even if the Web Content process does not launch or crashes - it will appear even if a custom content view is being used (e.g. PDF) - it will appear even if compositing is not enabled (e.g. in a legacy WebView on macOS) - it explicitly states in written text the class name of the web view, with no need for interpreting colors - it covers the entire web view, so cannot be accidentally obscured No new tests, just debugging UI. * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * testing/cocoa/WebViewVisualIdentificationOverlay.h: Added. * testing/cocoa/WebViewVisualIdentificationOverlay.mm: Added. (+[WebViewVisualIdentificationOverlay shouldIdentifyWebViews]): Use a single default across all kinds of WebViews, instead of using WebPreferences and friends, in order to make it extremely easy to turn on, and because it's intended to be set globally, and is not useful on a per-view basis. (+[WebViewVisualIdentificationOverlay installForWebViewIfNeeded:kind:deprecated:]): (-[WebViewVisualIdentificationOverlay initWithWebView:kind:deprecated:]): (-[WebViewVisualIdentificationOverlay dealloc]): (-[WebViewVisualIdentificationOverlay observeValueForKeyPath:ofObject:change:context:]): (-[WebViewVisualIdentificationOverlay drawLayer:inContext:]): Draw a wash and the class name over the entire face of the web view. The wash is blue for WKWebView and red for all of the deprecated web views (WKView, WebView, UIWebView). 2020-04-03 David Kilzer REGRESSION (r8412): Use RetainPtr<> for NSMutableAttributedString in -[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:spellCheck:] Reviewed by Darin Adler. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:spellCheck:]): Make use of RetainPtr<>. 2020-04-03 Kenneth Russell Fix bugs related to VideoTextureCopierCV and ANGLE roll script https://bugs.webkit.org/show_bug.cgi?id=209943 Reviewed by Dean Jackson. Fixed longstanding preexisting bugs related to creation and deletion of OpenGL objects inside VideoTextureCopierCV, including in which context its internal framebuffer was created. Unbind the output texture after hooking it up to the framebuffer to avoid any appearance of rendering feedback loops. Stop setting the WebGL compatibility context creation attribute for VideoTextureCopier's context. Covered by preexisting layout tests. * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): * platform/graphics/cv/VideoTextureCopierCV.cpp: (WebCore::VideoTextureCopierCV::VideoTextureCopierCV): (WebCore::VideoTextureCopierCV::~VideoTextureCopierCV): (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture): (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture): 2020-04-03 Eric Carlson Filter some capture device names https://bugs.webkit.org/show_bug.cgi?id=209941 Reviewed by Youenn Fablet. Test: fast/mediastream/anonymize-device-name.html * platform/mediastream/CaptureDevice.h: (WebCore::CaptureDevice::label const): 2020-04-03 Rob Buis Remove unused parameter from loadWithNavigationAction https://bugs.webkit.org/show_bug.cgi?id=209959 Reviewed by Darin Adler. Remove unused parameter from loadWithNavigationAction. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadWithNavigationAction): (WebCore::FrameLoader::load): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::reloadWithOverrideEncoding): (WebCore::FrameLoader::reload): (WebCore::FrameLoader::loadDifferentDocumentItem): * loader/FrameLoader.h: 2020-04-03 David Kilzer [Xcode] Replace ASAN_OTHER_CFLAGS and ASAN_OTHER_CPLUSPLUSFLAGS with $(inherited) Reviewed by Alexey Proskuryakov. * Configurations/Base.xcconfig: - Remove ASAN_OTHER_CFLAGS, ASAN_OTHER_CPLUSPLUSFLAGS and ASAN_OTHER_LDFLAGS. 2020-04-03 Wenson Hsieh Add logging to help diagnose https://bugs.webkit.org/show_bug.cgi?id=209967 Reviewed by Darin Adler. Add logging to try and diagnose a handful of API test failures on iOS 13.4 test runners. The failures seem to only reproduce in release builds on one particular bot; even then, the problem still doesn't reproduce when running the API tests on this failing bot. As such, add some logging to try and verify whether... (1) the UI process is even attempting to update its supported item provider types, which should happen after each drag session update. (2) WKContentView is receiving calls to update the drag session in the first place. * platform/ios/WebItemProviderPasteboard.mm: (-[WebItemProviderPasteboard updateSupportedTypeIdentifiers:]): 2020-04-03 Sihui Liu ASSERTION FAILED: m_delegate in IDBConnectionToClient::identifier() https://bugs.webkit.org/show_bug.cgi?id=209891 Reviewed by Geoffrey Garen. IDBConnectionToClient::connectionToClientClosed() can lead UniqueIDBDatabase to start processing new requests, and we should make sure it ignores the requests from the closed connection. Otherwise, the connection can be held alive by the request being processed. We can do that by marking connection closed before calling connectionToClientClosed on UniqueIDBDatabaseConnection. API Test: IndexedDB.KillWebProcessWithOpenConnection * Modules/indexeddb/server/IDBConnectionToClient.cpp: (WebCore::IDBServer::IDBConnectionToClient::connectionToClientClosed): 2020-04-03 Zalan Bujtas [MultiColumn] Infinite loop in RenderBlockFlow::pushToNextPageWithMinimumLogicalHeight https://bugs.webkit.org/show_bug.cgi?id=209948 Reviewed by Antti Koivisto. pushToNextPageWithMinimumLogicalHeight is supposed to find the next page/column with enough space for the content. However we keep finding the same column because it is not balanced properly yet (while in layout, they have the initial height of LayoutUnit::max). Test: fast/multicol/infinite-loop-with-unbalanced-column.html * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::pushToNextPageWithMinimumLogicalHeight const): 2020-04-03 youenn fablet Add initial support for WebRTC HEVC https://bugs.webkit.org/show_bug.cgi?id=204283 Reviewed by Eric Carlson. Add a runtime flag for H265 in lieu of VP8 and pipe it to libwebrtc factories. Test: webrtc/h265.html * page/Page.cpp: (WebCore::m_deviceOrientationUpdateProvider): * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::webRTCH265CodecEnabled const): (WebCore::RuntimeEnabledFeatures::setWebRTCH265CodecEnabled): * platform/mediastream/libwebrtc/LibWebRTCProvider.h: * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp: (WebCore::LibWebRTCProviderCocoa::createDecoderFactory): (WebCore::LibWebRTCProviderCocoa::createEncoderFactory): * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): 2020-04-03 Yousuke Kimoto FileSystem handle leaks in CurlCacheManager and NetworkCacheData when failed to open a file https://bugs.webkit.org/show_bug.cgi?id=209949 Reviewed by Fujii Hironori. A file handle of FileSystem is not closed when the file handle doesn't return its status. The handle should be released before returning. No new tests, no behavior change. * platform/network/curl/CurlCacheManager.cpp: (WebCore::CurlCacheManager::loadIndex): 2020-04-03 Peng Liu WebCore::HTMLMediaElement::mediaCanStart crashes https://bugs.webkit.org/show_bug.cgi?id=209950 Reviewed by Jer Noble. Use WeakHashSet instead of HashSet to record MediaCanStartListeners in Document. * dom/Document.cpp: (WebCore::Document::addMediaCanStartListener): (WebCore::Document::removeMediaCanStartListener): (WebCore::Document::takeAnyMediaCanStartListener): * dom/Document.h: * page/MediaCanStartListener.h: 2020-04-03 Simon Fraser Flesh out enclosingScrollableArea() implementations https://bugs.webkit.org/show_bug.cgi?id=209953 Reviewed by Timothy Hatcher. enclosingScrollableArea() is a virtual function on ScrollableArea. It's currently only called in an unused iOS WebKit1 code path, but will soon be used for scroll latching, so flesh out implementations. Will be tested by future scroll latching tests. * page/FrameView.cpp: (WebCore::FrameView::enclosingScrollableArea const): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::enclosingScrollableArea const): * rendering/RenderListBox.cpp: (WebCore::RenderListBox::enclosingScrollableArea const): 2020-04-02 Simon Fraser Rename widgetDidHandleWheelEvent back to passWheelEventToWidget and make some functions private https://bugs.webkit.org/show_bug.cgi?id=209951 Reviewed by Zalan Bujtas. Revert the rename from r199331, and make private wheel-event related functions that are internal to EventHandler. * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): (WebCore::EventHandler::passWheelEventToWidget): (WebCore::EventHandler::widgetDidHandleWheelEvent): Deleted. * page/EventHandler.h: * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::passWheelEventToWidget): (WebCore::EventHandler::widgetDidHandleWheelEvent): Deleted. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::passWheelEventToWidget): (WebCore::EventHandler::widgetDidHandleWheelEvent): Deleted. 2020-04-02 Andres Gonzalez Crash in RenderMenuList::didUpdateActiveOption. https://bugs.webkit.org/show_bug.cgi?id=208867 Reviewed by Chris Fleizach. Enabled test accessibility/menu-list-sends-change-notification.html. - Check the type of the AccessibilityObject before downcasting in RenderMenuList. - Fixed handling of the AXMenuListValueChanged notification on the Mac. This notification was previously ignored and hence the LayoutTest was failing. * accessibility/mac/AXObjectCacheMac.mm: (WebCore::AXObjectCache::postPlatformNotification): * rendering/RenderMenuList.cpp: (RenderMenuList::didUpdateActiveOption): 2020-04-02 Eric Carlson Remove unused media controls code https://bugs.webkit.org/show_bug.cgi?id=209875 Remove code for the, now unused, C++ based media controls. Reviewed by Daniel Bates. No new tests, no functional change. * Modules/mediacontrols/MediaControlsHost.cpp: (WebCore::MediaControlsHost::textTrackContainer): * Modules/mediacontrols/MediaControlsHost.h: * Modules/plugins/QuickTimePluginReplacement.mm: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * accessibility/AXObjectCache.cpp: (WebCore::createFromRenderer): * accessibility/AccessibilityMediaControls.cpp: Removed. * accessibility/AccessibilityMediaControls.h: Removed. * dom/Node.h: (WebCore::Node::isMediaControlElement const): Deleted. (WebCore::Node::isMediaControls const): Deleted. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): (WebCore::HTMLMediaElement::~HTMLMediaElement): (WebCore::HTMLMediaElement::childShouldCreateRenderer const): (WebCore::HTMLMediaElement::pauseAfterDetachedTask): (WebCore::HTMLMediaElement::updateRenderer): (WebCore::HTMLMediaElement::selectMediaResource): (WebCore::HTMLMediaElement::mediaLoadingFailed): (WebCore::HTMLMediaElement::setNetworkState): (WebCore::HTMLMediaElement::changeNetworkStateFromLoadingToIdle): (WebCore::HTMLMediaElement::setReadyState): (WebCore::HTMLMediaElement::progressEventTimerFired): (WebCore::HTMLMediaElement::setMuted): (WebCore::HTMLMediaElement::playbackProgressTimerFired): (WebCore::HTMLMediaElement::addTextTrack): (WebCore::HTMLMediaElement::removeTextTrack): (WebCore::HTMLMediaElement::didAddTextTrack): (WebCore::HTMLMediaElement::ensureMediaControlsShadowRoot): (WebCore::HTMLMediaElement::updateCaptionContainer): (WebCore::HTMLMediaElement::layoutSizeChanged): (WebCore::HTMLMediaElement::configureTextTracks): (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): (WebCore::HTMLMediaElement::updateVolume): (WebCore::HTMLMediaElement::updatePlayState): (WebCore::HTMLMediaElement::enterFullscreen): (WebCore::HTMLMediaElement::exitFullscreen): (WebCore::HTMLMediaElement::didBecomeFullscreenElement): (WebCore::HTMLMediaElement::willStopBeingFullscreenElement): (WebCore::HTMLMediaElement::textTrackReadyStateChanged): (WebCore::HTMLMediaElement::configureTextTrackDisplay): (WebCore::HTMLMediaElement::updateTextTrackDisplay): (WebCore::HTMLMediaElement::updateTextTrackRepresentationImageIfNeeded): (WebCore::HTMLMediaElement::setClosedCaptionsVisible): (WebCore::HTMLMediaElement::configureMediaControls): (WebCore::HTMLMediaElement::captionPreferencesChanged): (WebCore::HTMLMediaElement::setController): (WebCore::HTMLMediaElement::getCurrentMediaControlsStatus): (WebCore::HTMLMediaElement::closeCaptionTracksChanged): Deleted. (WebCore::HTMLMediaElement::mediaControls const): Deleted. (WebCore::HTMLMediaElement::hasMediaControls const): Deleted. (WebCore::HTMLMediaElement::createMediaControls): Deleted. * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::mediaControlsHost): * html/shadow/MediaControlElementTypes.cpp: Removed. * html/shadow/MediaControlElementTypes.h: Removed. * html/shadow/MediaControlElements.cpp: Removed. * html/shadow/MediaControlElements.h: Removed. * html/shadow/MediaControlTextTrackContainerElement.cpp: Added. (WebCore::MediaControlTextTrackContainerElement::create): (WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement): (WebCore::MediaControlTextTrackContainerElement::createElementRenderer): (WebCore::compareCueIntervalForDisplay): (WebCore::MediaControlTextTrackContainerElement::updateDisplay): (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentationImageIfNeeded): (WebCore::MediaControlTextTrackContainerElement::processActiveVTTCue): (WebCore::MediaControlTextTrackContainerElement::updateActiveCuesFontSize): (WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle): (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentationIfNeeded): (WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation): (WebCore::MediaControlTextTrackContainerElement::updateTextTrackStyle): (WebCore::MediaControlTextTrackContainerElement::enteredFullscreen): (WebCore::MediaControlTextTrackContainerElement::exitedFullscreen): (WebCore::MediaControlTextTrackContainerElement::updateVideoDisplaySize): (WebCore::MediaControlTextTrackContainerElement::updateSizes): (WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage): (WebCore::MediaControlTextTrackContainerElement::textTrackRepresentationBoundsChanged): (WebCore::MediaControlTextTrackContainerElement::hide): (WebCore::MediaControlTextTrackContainerElement::show): (WebCore::MediaControlTextTrackContainerElement::isShowing const): (WebCore::MediaControlTextTrackContainerElement::logger const): (WebCore::MediaControlTextTrackContainerElement::logIdentifier const): (WebCore::MediaControlTextTrackContainerElement::logChannel const): * html/shadow/MediaControlTextTrackContainerElement.h: Added. * html/shadow/MediaControls.cpp: Removed. * html/shadow/MediaControls.h: Removed. * page/CaptionUserPreferencesMediaAF.cpp: * page/Page.cpp: (WebCore::Page::setPageScaleFactor): (WebCore::Page::setUserInterfaceLayoutDirection): * rendering/RenderMediaControls.cpp: Removed. * rendering/RenderMediaControls.h: Removed. * rendering/RenderSlider.cpp: * rendering/RenderTheme.cpp: * rendering/RenderThemeAdwaita.cpp: * rendering/RenderThemeCocoa.h: * rendering/RenderThemeCocoa.mm: (WebCore::RenderThemeCocoa::mediaControlsFormattedStringForDuration): * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::mediaControlsStyleSheet): (WebCore::RenderThemeIOS::modernMediaControlsStyleSheet): (WebCore::RenderThemeIOS::mediaControlsScript): (WebCore::RenderThemeIOS::mediaControlsBase64StringForIconNameAndType): * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::mediaControlsStyleSheet): (WebCore::RenderThemeMac::modernMediaControlsStyleSheet): (WebCore::RenderThemeMac::mediaControlsScript): (WebCore::RenderThemeMac::mediaControlsBase64StringForIconNameAndType): * testing/Internals.cpp: (WebCore::Internals::getCurrentMediaControlsStatusForElement): 2020-04-02 Eric Carlson Don't call -[AVCapture startRunning] when interruption ends https://bugs.webkit.org/show_bug.cgi?id=209919 Calling -[AVCaptureSession startRunning] after a VideoNotAllowedInSideBySide interruption ends triggers a bug in AVCapture that hangs the app for several seconds, but restarting the capture session isn't necessary because it will restart automatically in that case. Reviewed by Youenn Fablet. Tested manually. * platform/mediastream/mac/AVVideoCaptureSource.h: Remove InterruptionReason enum, convert m_interruption to m_interrupted bool * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::AVVideoCaptureSource): Remove InterruptionReason enum checking. (WebCore::AVVideoCaptureSource::stopProducingData): m_interruption -> m_interrupted. (WebCore::AVVideoCaptureSource::interrupted const): Ditto. (WebCore::AVVideoCaptureSource::captureSessionBeginInterruption): Ditto. (WebCore::AVVideoCaptureSource::captureSessionEndInterruption): Ditto. Don't restart the session. (-[WebCoreAVVideoCaptureSourceObserver observeValueForKeyPath:ofObject:change:context:]): Drive-by fix: always log notifications to help with debugging. 2020-04-02 David Kilzer REGRESSION (r258525): Leak of NSMutableAttributedString in -[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:spellCheck:] Reviewed by Chris Fleizach. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:spellCheck:]): Move early return to avoid leaking NSMutableAttributedString. 2020-04-02 Chris Dumez ActiveDOMObject::hasPendingActivity() should stop preventing wrapper collection after ActiveDOMObject::stop() has been called https://bugs.webkit.org/show_bug.cgi?id=209886 Reviewed by Ryosuke Niwa. ActiveDOMObject::stop() gets called when the script execution context is about to be destroyed. ActiveDOMObject objects should no longer run script after that and there is therefore no point in keeping the JS wrapper alive once stop() has been called. Worse, depending on the implementation of virtualHasPendingActivity(), keeping the wrapper alive past this point may actually cause JS wrapper leaks. Some of the virtualHasPendingActivity() were properly checking if the context was stopped but not all of them. To address the issue, we now check ActiveDOMObject::isContextStopped() in the JS bindings, in addition to ActiveDOMObject::hasPendingActivity(), so that it is no longer possible to keep a JS wrapper alive past the point where the script execution context has been stopped. This new approach is a lot less leak/error prone. * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::virtualHasPendingActivity const): * Modules/indexeddb/IDBOpenDBRequest.cpp: (WebCore::IDBOpenDBRequest::requestCompleted): * Modules/indexeddb/IDBRequest.cpp: (WebCore::IDBRequest::virtualHasPendingActivity const): (WebCore::IDBRequest::stop): (WebCore::IDBRequest::enqueueEvent): (WebCore::IDBRequest::dispatchEvent): * Modules/indexeddb/IDBRequest.h: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::virtualHasPendingActivity const): (WebCore::IDBTransaction::stop): (WebCore::IDBTransaction::notifyDidAbort): (WebCore::IDBTransaction::enqueueEvent): (WebCore::IDBTransaction::dispatchEvent): * Modules/indexeddb/IDBTransaction.h: * Modules/mediastream/MediaDevices.cpp: (WebCore::MediaDevices::virtualHasPendingActivity const): * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::JSTestInterfaceOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::JSTestNamedConstructorOwner::isReachableFromOpaqueRoots): * css/FontFace.cpp: (WebCore::FontFace::virtualHasPendingActivity const): * dom/ActiveDOMObject.h: * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::virtualHasPendingActivity const): * workers/service/ServiceWorkerRegistration.cpp: (WebCore::ServiceWorkerRegistration::getOrCreate): (WebCore::ServiceWorkerRegistration::update): (WebCore::ServiceWorkerRegistration::unregister): (WebCore::ServiceWorkerRegistration::queueTaskToFireUpdateFoundEvent): (WebCore::ServiceWorkerRegistration::stop): (WebCore::ServiceWorkerRegistration::virtualHasPendingActivity const): * workers/service/ServiceWorkerRegistration.h: 2020-04-02 Simon Fraser Rename some wheel-event related functions https://bugs.webkit.org/show_bug.cgi?id=209918 Reviewed by Zalan Bujtas. Rename some functions to describe what they do, rather than being generic "platform" things, to make the code easier to read. Similarly, rename m_clearLatchingStateTimer for what it does. * page/EventHandler.cpp: (WebCore::EventHandler::EventHandler): (WebCore::EventHandler::clearLatchedStateTimerFired): (WebCore::EventHandler::determineWheelEventTarget): (WebCore::EventHandler::recordWheelEventForDeltaFilter): (WebCore::EventHandler::processWheelEventForScrolling): (WebCore::EventHandler::processWheelEventForScrollSnap): (WebCore::EventHandler::completeWidgetWheelEvent): (WebCore::EventHandler::handleWheelEvent): (WebCore::EventHandler::platformPrepareForWheelEvents): Deleted. (WebCore::EventHandler::platformRecordWheelEvent): Deleted. (WebCore::EventHandler::platformCompleteWheelEvent): Deleted. (WebCore::EventHandler::platformNotifyIfEndGesture): Deleted. * page/EventHandler.h: * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded): (WebCore::EventHandler::determineWheelEventTarget): (WebCore::EventHandler::recordWheelEventForDeltaFilter): (WebCore::EventHandler::processWheelEventForScrolling): (WebCore::EventHandler::processWheelEventForScrollSnap): (WebCore::EventHandler::platformPrepareForWheelEvents): Deleted. (WebCore::EventHandler::platformRecordWheelEvent): Deleted. (WebCore::EventHandler::platformCompleteWheelEvent): Deleted. (WebCore::EventHandler::platformNotifyIfEndGesture): Deleted. 2020-04-02 Daniel Bates Traverse float descendants when computing event and touch-action regions https://bugs.webkit.org/show_bug.cgi?id=209896 Reviewed by Antti Koivisto. Consider floating objects when computing the event region and touch-action region. For touch-action hit testing this means that CSS touch-action is honored on floating objects. Tests: fast/scrolling/ios/event-region-float.html pointerevents/ios/touch-action-region-float.html * rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintObject): 2020-04-02 Jer Noble Hulu.com gets stuck in a "loading" state when seeking https://bugs.webkit.org/show_bug.cgi?id=209916 Reviewed by Eric Carlson. Hulu.com depends on the "canplay" event firing after a seek to hide their loading indicator. The HTML spec says that "canplay" should only be fired when moving from the HAVE_CURRENT_DATA to HAVE_FUTURE_DATA or greater, but when seeking within the buffered range, the readyState never drops below HAVE_FUTURE_DATA. To work around this behavior, add a quirk for Hulu.com that always fires "canplay" after a seek completes, so long as the readyState is HAVE_FUTURE_DATA or higher. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::seekTask): (WebCore::HTMLMediaElement::finishSeek): * page/Quirks.cpp: (WebCore::Quirks::needsCanPlayAfterSeekedQuirk const): * page/Quirks.h: 2020-04-02 Wenson Hsieh Avoid null deref after inserting a text field with a list attribute https://bugs.webkit.org/show_bug.cgi?id=209909 Reviewed by Ryosuke Niwa. On macOS, when painting a text field with an associated datalist (i.e. `HTMLInputElement::list()` is non-null), we assume that the datalist suggestions dropdown button has a renderer (in other words, it does not have a style of `display: none`). Existing logic in `TextFieldInputType` is responsible for upholding this invariant -- when the list attribute changes on an input field (e.g. when we parse the list attribute, or when it is set by JavaScript), we update the inline display style of `m_dataListDropdownIndicator`, such that it is set to `display: none` only if there is either no list attribute, or the list attribute is empty, or the list does not refer to a connected datalist element. However, there is one scenario in which this invariant is violated. Consider the following: 1. An input field is created, and its list attribute is set to "foo". Importantly, it is not connected yet. 2. A datalist element with id "foo" is then created and then added to the document. 3. The input field created in (1) is then added to the document. In this scenario, `listAttributeTargetChanged()` is invoked after (1), but since it is not connected, it has no datalist yet, and so `m_dataListDropdownIndicator` will remain non-rendered. When it is later added to the DOM, nothing attempts to `m_dataListDropdownIndicator` even though its list attribute now refers to a datalist, so it remains hidden. When we later go to paint the input's datalist dropdown button in `RenderThemeMac::paintListButtonForInput`, we assume that the dropdown button must be rendered because the input has a datalist and subsequently crash since `buttonElement->renderer()` remains null. To fix this, we add logic to update the datalist dropdown button's inline display style when it is connected to the document with an existing, non-empty list attribute. Test: fast/forms/datalist/append-input-with-list-attribute.html * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::parseAttribute): (WebCore::HTMLInputElement::didFinishInsertingNode): Notify the InputType subclass that the datalist element may have changed after an input element is connected to the document with a non-empty list attribute. (WebCore::HTMLInputElement::dataListMayHaveChanged): (WebCore::ListAttributeTargetObserver::idTargetChanged): (WebCore::HTMLInputElement::listAttributeTargetChanged): Deleted. Rename listAttributeTargetChanged to dataListMayHaveChanged, since it is no longer called only when the list attribute changes value, but rather when the input's datalist element may have changed. * html/HTMLInputElement.h: * html/InputType.cpp: (WebCore::InputType::dataListMayHaveChanged): (WebCore::InputType::listAttributeTargetChanged): Deleted. * html/InputType.h: * html/RangeInputType.cpp: (WebCore::RangeInputType::dataListMayHaveChanged): (WebCore::RangeInputType::listAttributeTargetChanged): Deleted. * html/RangeInputType.h: * html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::dataListMayHaveChanged): (WebCore::TextFieldInputType::listAttributeTargetChanged): Deleted. * html/TextFieldInputType.h: 2020-04-01 Darin Adler Remove all uses of live ranges from TextIterator https://bugs.webkit.org/show_bug.cgi?id=209723 Reviewed by Antti Koivisto. - Replaced TextIterator::getLocationAndLengthFromRange with a function named characterRange that computes a CharacterRange given a scope and a range. - Removed the overload of plainText that takes a pointer to a live range. - Update the many callers of plainText that pass a pointer to a live range to pass a reference instead, adding null checks as needed to preserve behavior. - Rewrote some call sites to not use live ranges at all, or use them minimally. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::nextSentenceEndPosition const): Streamlined the logic in this function, using a smaller number of null checks since the functions we are calling also do null checks, simpler variable names and fewer local variables. Pass a reference to a live range rather than a pointer to the plainText function. (WebCore::AccessibilityObject::previousSentenceStartPosition const): Ditto. (WebCore::AccessibilityObject::nextParagraphEndPosition const): Ditto. (WebCore::AccessibilityObject::previousParagraphStartPosition const): Ditto. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textUnderElement const): Ditto. (WebCore::boundsForRects): Converted this to a file-local function and changed it to take a SimpleRange instead of a live range. (WebCore::AccessibilityRenderObject::boundsForVisiblePositionRange const): Pass a reference to a live range instead of a pointer. (WebCore::AccessibilityRenderObject::boundsForRange const): Ditto. * accessibility/AccessibilityRenderObject.h: Removed boundsForRects. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper _convertToNSRange:]): Rewrote to use characterRange instead of TextIterator::getLocationAndLengthFromRange. * dom/BoundaryPoint.h: (WebCore::makeBoundaryPointBeforeNodeContents): Added. * dom/Element.cpp: (WebCore::Element::innerText): Pass a SimpleRange instead of a live range to the plainText function. * dom/Range.cpp: (WebCore::Range::text const): Pass a reference to a live range instead of a pointer to the plainText function. * dom/SimpleRange.cpp: (WebCore::makeBoundaryPointAfterNodeContents): Added. (WebCore::makeRangeSelectingNodeContents): Use makeBoundaryPointBeforeNodeContents and makeBoundaryPointAfterNodeContents * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::applyPendingCorrection): Pass a reference to a live range to plainText. (WebCore::AlternativeTextController::show): Ditto. (WebCore::AlternativeTextController::timerFired): Ditto. (WebCore::AlternativeTextController::handleAlternativeTextUIResult): Ditto. (WebCore::AlternativeTextController::recordAutocorrectionResponse): Ditto. Also take a SimpleRange argument. (WebCore::AlternativeTextController::markPrecedingWhitespaceForDeletedAutocorrectionAfterCommand): Ditto. (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord):Ditto. * editing/AlternativeTextController.h: Update for the above changes. * editing/Editor.cpp: (WebCore::Editor::markMisspellingsAfterTypingToWord): Pass a reference to a live range to plainText. (WebCore::correctSpellcheckingPreservingTextCheckingParagraph): Ditto. Also refactor for simplicity and clarity. (WebCore::Editor::markAndReplaceFor): Ditto. (WebCore::Editor::changeBackToReplacedString): Ditto. (WebCore::Editor::transpose): Ditto. (WebCore::Editor::addRangeToKillRing): Ditto. (WebCore::Editor::stringForCandidateRequest const): Ditto. * editing/ReplaceRangeWithTextCommand.cpp: (WebCore::ReplaceRangeWithTextCommand::doApply): Ditto. * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplacementFragment::ReplacementFragment): Ditto. * editing/SpellingCorrectionCommand.cpp: (WebCore::SpellingCorrectionCommand::doApply): Ditto. * editing/TextCheckingHelper.cpp: (WebCore::TextCheckingParagraph::text const): Ditto. (WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar): Ditto. * editing/TextIterator.cpp: Use more constexpr. (WebCore::characterSubrange): Deleted. Moved the logic from this function into the one place using it, the rangeForMatch function. (WebCore::resolveCharacterLocation): Deleted. Moved to the header file. (WebCore::TextIterator::getLocationAndLengthFromRange): Deleted. (WebCore::plainText): Deleted the overload that takes a live range pointer. (WebCore::plainTextUsingBackwardsTextIteratorForTesting): Deleted. Moved the implementation to Internals. There's nothing special about the algorithm, it uses SimplifiedBackwardsTextIterator in a simple way. (WebCore::collapsedToBoundary): Deleted. Moved the code to the one place it's used, the rangeForMatch function. (WebCore::forEachMatch): Renamed from findPlainTextMatches and changed to work without any use of live ranges and to use CharacterRange. (WebCore::rangeForMatch): Rewrote to include more of the logic, removing the collapsedToBoundary and characterSubrange functions, and to not use any live ranges. (WebCore::findClosestPlainText): Rewrote to tighten up the algorithm a bit, break ties based on the search direction, and have less repetitive code. (WebCore::findPlainText): Rewrote for clarity. * editing/TextIterator.h: Removed the forward declaration of Range. Removed the overload of plainText that takes a live range pointer. Moved the functions that work with character ranges up to the top of the file, grouped the other functions more logically. Deleted the TextIterator::getLocationAndLengthFromRange function. Put some inline function definitions here. * editing/TypingCommand.cpp: (WebCore::TypingCommand::markMisspellingsAfterTyping): Pass a reference to a live range to plainText. * editing/VisibleUnits.cpp: (WebCore::charactersAroundPosition): Pass a SimpleRange to plainText rather than a live range. * editing/cocoa/DataDetection.mm: (WebCore::detectItemAtPositionWithRange): Pass a reference to a live range to plainText. * editing/cocoa/DictionaryLookup.mm: (WebCore::DictionaryLookup::rangeForSelection): Ditto. * editing/cocoa/HTMLConverter.h: Tweaked #if a bit. * editing/mac/DictionaryLookupLegacy.mm: (WebCore::DictionaryLookup::rangeForSelection): Pass a reference to a live range to plainText. Also rewrote logic to use mostly SimpleRange. (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto. * editing/markup.cpp: (WebCore::StyledMarkupAccumulator::renderedTextRespectingRange): Ditto. * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::handleBeforeTextInsertedEvent const): Ditto. * page/ContextMenuController.cpp: (WebCore::ContextMenuController::contextMenuItemSelected): Ditto. * page/DOMSelection.cpp: (WebCore::DOMSelection::toString): Ditto. * page/Page.cpp: (WebCore::Page::replaceRangesWithText): Rewrote to replaces use of TextIterator::getLocationAndLengthFromRange with characterRange. * page/ios/FrameIOS.mm: (WebCore::Frame::interpretationsForCurrentRoot const): Pass a reference to a live range to plainText. * testing/Internals.cpp: (WebCore::Internals::locationFromRange): Use characterRange. (WebCore::Internals::lengthFromRange): Ditto. (WebCore::Internals::rangeAsTextUsingBackwardsTextIterator): USe SimplifiedBackwardsTextIterator directly since we no longer have the function plainTextUsingBackwardsTextIteratorForTesting. 2020-04-02 Ryosuke Niwa Remove a superflous blank line added in the previous commit as pointed out during the code review. * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::copyAssociatedElementsVector const): 2020-04-01 Ryosuke Niwa HTMLFormElement should use WeakPtr to keep track of its associated elements https://bugs.webkit.org/show_bug.cgi?id=209894 Reviewed by Wenson Hsieh. Replaced the vector of raw pointers to FormAssociatedElement in HTMLFormElement by a vector of WeakPtr to the equivalent HTMLElement. Most of code changes below are due to type of elements in the vector changing from FormAssociatedElement to HTMLElement and needing conversion. This patch also moves clearing of m_form from ~FormAssociatedElement to its subclasses' destructors since we need to make a virtual function call to get HTMLElement* out of FormAssociatedElement, which would be too late inside ~FormAssociatedElement. No new tests since there should be no behavioral change. * html/FormAssociatedElement.cpp: (WebCore::FormAssociatedElement::~FormAssociatedElement): Assert that m_form had been cleared instead of clearing it here. * html/FormAssociatedElement.h: (WebCore::FormAssociatedElement::clearForm): Added. * html/FormController.cpp: (WebCore::recordFormStructure): * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::~HTMLFormControlElement): Now calls clearForm. Also removed the redundant comment. * html/HTMLFormControlsCollection.cpp: (WebCore::findFormAssociatedElement): (WebCore::HTMLFormControlsCollection::unsafeFormControlElements const): Deleted. (WebCore::HTMLFormControlsCollection::copyFormControlElementsVector const): Deleted. (WebCore::HTMLFormControlsCollection::customElementAfter const): (WebCore::HTMLFormControlsCollection::updateNamedElementCache const): * html/HTMLFormControlsCollection.h: * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::~HTMLFormElement): (WebCore::HTMLFormElement::removedFromAncestor): (WebCore::HTMLFormElement::length const): (WebCore::HTMLFormElement::textFieldValues const): (WebCore::HTMLFormElement::resetAssociatedFormControlElements): (WebCore::HTMLFormElement::formElementIndexWithFormAttribute): (WebCore::HTMLFormElement::registerFormElement): (WebCore::HTMLFormElement::removeFormElement): (WebCore::HTMLFormElement::checkInvalidControlsAndCollectUnhandled): (WebCore::HTMLFormElement::assertItemCanBeInPastNamesMap const): (WebCore::HTMLFormElement::unsafeAssociatedElements const): (WebCore::HTMLFormElement::copyAssociatedElementsVector const): * html/HTMLFormElement.h: * html/HTMLObjectElement.cpp: (WebCore::HTMLObjectElement::~HTMLObjectElement): Added. Calls clearForm. * html/HTMLObjectElement.h: 2020-04-02 Alex Christensen Add SPI to restrict loading to main resources or non-network loads https://bugs.webkit.org/show_bug.cgi?id=209893 Reviewed by Tim Horton. This will allow two projects that currently use the injected bundle SPI to use these instead. Covered by API tests. * Modules/websockets/ThreadableWebSocketChannel.cpp: (WebCore::ThreadableWebSocketChannel::validateURL): * loader/ResourceLoadNotifier.cpp: (WebCore::ResourceLoadNotifier::assignIdentifierToInitialRequest): (WebCore::ResourceLoadNotifier::dispatchWillSendRequest): * loader/ResourceLoadNotifier.h: * page/Page.cpp: (WebCore::m_loadsFromNetwork): (WebCore::m_deviceOrientationUpdateProvider): Deleted. * page/Page.h: (WebCore::Page::loadsSubresources const): (WebCore::Page::loadsFromNetwork const): * page/PageConfiguration.h: 2020-04-02 Eric Carlson [iOS] Allow WebKit to use camera in multi-tasking mode https://bugs.webkit.org/show_bug.cgi?id=209904 Reviewed by Youenn Fablet. * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::setupSession): 2020-04-02 Antoine Quint Video previews on shutterstock.com don't play when tapped on iPadOS https://bugs.webkit.org/show_bug.cgi?id=209903 Reviewed by Wenson Hsieh. When tapping on a video preview after searching for a video on shutterstock.com, for instance on https://www.shutterstock.com/video/search/people, we correctly enter the hover state thanks to our content observation heuristics, but the