2021-08-21 Sihui Liu IndexedDB: crash when triggering IDBOpenRequest completion back on a worker thread https://bugs.webkit.org/show_bug.cgi?id=229375 Reviewed by Brady Eidson. Client may dispatch custom events to an IDBRequest, and we should only change request state based on events created internally. * Modules/indexeddb/IDBRequest.cpp: (WebCore::IDBRequest::dispatchEvent): 2021-07-12 Chris Dumez Unreviewed, partial revert of r279661 to address crashes on iOS Debug. * page/DOMWindow.cpp: (WebCore::DOMWindow::removeAllEventListeners): 2021-08-31 Antti Koivisto REGRESSION (r272900): wpt.fyi loading performance is very slow (regressed, and slower than other browsers) https://bugs.webkit.org/show_bug.cgi?id=229680 Reviewed by Darin Adler. The page is inserting new children to shadow host and on each insertion we are traversing the composed tree to tear down renderers, even though there are none. * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderersAfterSlotChange): If the host doesn't have a renderer or 'display:contents' there can't be any renderers left in the subtree. 2021-08-16 Antti Koivisto REGRESSION (r275756): Accelerated animations freeze when invalidating layout with shadow dom https://bugs.webkit.org/show_bug.cgi?id=228954 Reviewed by Ryosuke Niwa. Test: animations/shadow-host-child-change.html Tearing down the host renderer after slot assignments change cancels animations on it. * dom/SlotAssignment.cpp: (WebCore::SlotAssignment::didChangeSlot): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderersAfterSlotChange): Add a version that keeps the animations going on the teardown root. (WebCore::RenderTreeUpdater::tearDownRenderers): * rendering/updating/RenderTreeUpdater.h: 2021-07-08 Antti Koivisto Shadow host stops rendering after removing a slot, updating style, then its assigned node https://bugs.webkit.org/show_bug.cgi?id=227652 Reviewed by Alan Bujtas. Test: fast/shadow-dom/remove-slot-and-host-child.html * dom/SlotAssignment.cpp: (WebCore::SlotAssignment::didChangeSlot): When we tear down the render tree we also need to request its rebuild unconditionally. 2021-07-22 Frédéric Wang nullptr crash in ApplyStyleCommand::applyRelativeFontStyleChange https://bugs.webkit.org/show_bug.cgi?id=223974 Reviewed by Darin Adler. WebCore::documentOrder does not handle well elements like that contains a shadow substree. This is causing assertion failures in debug build when setting start/end selection and nullptr crashes in release build when trying to browse selection between these start and end nodes. This patch fixes that issue by switching to shadow including tree order for these particular cases. It introduces a generic treeOrder(a, b) function that can be used for TreeType = ShadowIncludingTree as well as by WebCore::documentOrder. * dom/Node.cpp: Explicitly instantiate commonInclusiveAncestor so that it can be used by WebCore::treeOrder. * dom/Position.cpp: Explicitly instantiate templates. (WebCore::treeOrder): Convert documentOrder to a template parametrized by TreeType. (WebCore::documentOrder): Implement it with treeOrder. * dom/Position.h: Delcare new template. * editing/ApplyStyleCommand.cpp: (WebCore::ApplyStyleCommand::updateStartEnd): Use treeOrder. (WebCore::ApplyStyleCommand::removeInlineStyle): Ditto. * editing/VisiblePosition.cpp: (WebCore::documentOrder): Use treeOrder. * editing/VisibleSelection.cpp: (WebCore::VisibleSelection::setBaseAndExtentToDeepEquivalents): Use treeOrder. (WebCore::VisibleSelection::setWithoutValidation): Ditto. 2021-07-01 Sergio Villar Senin Missing layouts when using simplified layout with OOF positioned elements https://bugs.webkit.org/show_bug.cgi?id=226008 Reviewed by Alan Bujtas. There are some situations that allow us to do simplified layouts like when there is a positioned child that needs to be laid out and neither the parent nor any other normal children needs it. In those cases we just pick the list of positioned objects and invoke layoutPositionedObjects(). However that list might not be properly updated since it's only done during the layout in RenderBlock::layoutBlockChildren(). This is causing that we miss layouts in cases where a renderer has the posChildNeedsLayout() bit set (due to some style change for example) but no descendants in the positionedDescendantsMap() because it has not been laid out yet. In those cases we simply bail out the simplified layout and proceed as in the normal layout process. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::simplifiedLayout): 2021-07-20 Fujii Hironori Use WeakHashSet for Page::m_activityStateChangeObservers https://bugs.webkit.org/show_bug.cgi?id=228065 Reviewed by Chris Dumez. * page/ActivityStateChangeObserver.h: Inherit CanMakeWeakPtr. * page/Page.cpp: (WebCore::Page::addActivityStateChangeObserver): (WebCore::Page::removeActivityStateChangeObserver): (WebCore::Page::setActivityState): * page/Page.h: 2021-07-20 Said Abou-Hallawa Make SVGPropertyAnimator::computeCSSPropertyValue() take a reference to SVGElement https://bugs.webkit.org/show_bug.cgi?id=228093 Reviewed by Simon Fraser. The assumption is the pointer 'targetElement' can't be nullptr. So make it a reference instead. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::computeCSSPropertyValue): Deleted. (WebCore::inheritsFromProperty): Deleted. (WebCore::SVGAnimationElement::determinePropertyValueTypes): Deleted. * svg/SVGAnimationElement.h: Delete unused methods from SVGAnimationElement. * svg/properties/SVGPrimitivePropertyAnimator.h: * svg/properties/SVGPropertyAnimator.h: (WebCore::SVGPropertyAnimator::computeCSSPropertyValue const): (WebCore::SVGPropertyAnimator::computeInheritedCSSPropertyValue const): * svg/properties/SVGValuePropertyAnimatorImpl.h: * svg/properties/SVGValuePropertyListAnimatorImpl.h: 2021-07-16 Brady Eidson FetchBodySource/FetchBodyOwner cleanup and https://bugs.webkit.org/show_bug.cgi?id=228035 Reviewed by Geoffrey Garen. FetchBodyOwner should have a WeakPtr factory, and FetchBodySource should use it. * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchBodySource.cpp: (WebCore::FetchBodySource::FetchBodySource): (WebCore::FetchBodySource::doCancel): (WebCore::FetchBodySource::close): * Modules/fetch/FetchBodySource.h: * Modules/fetch/FetchResponse.h: 2021-07-15 Brady Eidson Use WeakPtr with UniqueIDBDatabaseConnection and https://bugs.webkit.org/show_bug.cgi?id=227969 Reviewed by Geoff Garen. No new tests possible. Noticed this raw ptr which was raw to break a ref cycle. WeakPtr works better. * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h: * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp: (WebCore::IDBServer::UniqueIDBDatabaseTransaction::UniqueIDBDatabaseTransaction): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::~UniqueIDBDatabaseTransaction): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::databaseConnection): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::abort): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::abortWithoutCallback): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::commit): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::createObjectStore): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::deleteObjectStore): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::renameObjectStore): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::clearObjectStore): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::createIndex): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::deleteIndex): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::renameIndex): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::putOrAdd): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::getRecord): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::getAllRecords): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::getCount): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::deleteRecord): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::openCursor): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::iterateCursor): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::objectStoreIdentifiers): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::didActivateInBackingStore): * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h: (WebCore::IDBServer::UniqueIDBDatabaseTransaction::databaseConnection): Deleted. 2021-07-15 Brady Eidson MemoryIDBBackingStore cleanup. and https://bugs.webkit.org/show_bug.cgi?id=227993 Reviewed by Geoffrey Garen. * Modules/indexeddb/server/MemoryIDBBackingStore.cpp: (WebCore::IDBServer::MemoryIDBBackingStore::registerObjectStore): * Modules/indexeddb/server/MemoryIDBBackingStore.h: 2021-07-09 Said Abou-Hallawa SVGInlineTextBox::acquirePaintingResource() should return false if the resource can't be applied https://bugs.webkit.org/show_bug.cgi?id=227826 Reviewed by Simon Fraser. Ensure RenderSVGResource::postApplyResource() is called only if the corresponding RenderSVGResource::applyResource() succeeds. Otherwise the GraphicsContext stack state will be unbalanced. * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::acquirePaintingResource): 2021-07-07 Ryosuke Niwa Deploy smart pointers in DOMWindow https://bugs.webkit.org/show_bug.cgi?id=227584 Reviewed by David Kilzer. Deployed Ref/RefPtr in more places in DOMWindow. * page/DOMWindow.cpp: (WebCore::DOMWindow::performance const): (WebCore::DOMWindow::shouldHaveWebKitNamespaceForWorld): (WebCore::DOMWindow::postMessage): (WebCore::DOMWindow::frameElement const): (WebCore::DOMWindow::focus): (WebCore::DOMWindow::blur): (WebCore::DOMWindow::close): (WebCore::DOMWindow::print): (WebCore::DOMWindow::stop): (WebCore::DOMWindow::alert): (WebCore::DOMWindow::confirmForBindings): (WebCore::DOMWindow::prompt): (WebCore::DOMWindow::outerHeight const): (WebCore::DOMWindow::outerWidth const): (WebCore::DOMWindow::innerHeight const): (WebCore::DOMWindow::innerWidth const): (WebCore::DOMWindow::screenX const): (WebCore::DOMWindow::screenY const): (WebCore::DOMWindow::scrollX const): (WebCore::DOMWindow::scrollY const): (WebCore::DOMWindow::closed const): (WebCore::DOMWindow::name const): (WebCore::DOMWindow::setName): (WebCore::DOMWindow::setStatus): (WebCore::DOMWindow::setDefaultStatus): (WebCore::DOMWindow::opener const): (WebCore::DOMWindow::disownOpener): (WebCore::DOMWindow::parent const): (WebCore::DOMWindow::top const): (WebCore::DOMWindow::consumeTransientActivation): (WebCore::DOMWindow::notifyActivated): (WebCore::DOMWindow::getMatchedCSSRules const): (WebCore::DOMWindow::scrollBy const): (WebCore::DOMWindow::allowedToChangeWindowGeometry const): (WebCore::DOMWindow::setTimeout): (WebCore::DOMWindow::clearTimeout): (WebCore::DOMWindow::setInterval): (WebCore::DOMWindow::requestAnimationFrame): (WebCore::DOMWindow::cancelAnimationFrame): (WebCore::DOMWindow::createImageBitmap): (WebCore::DOMWindow::isSecureContext const): (WebCore::DOMWindow::addEventListener): (WebCore::DOMWindow::startListeningForDeviceOrientationIfNecessary): (WebCore::DOMWindow::startListeningForDeviceMotionIfNecessary): (WebCore::DOMWindow::incrementScrollEventListenersCount): (WebCore::DOMWindow::removeEventListener): (WebCore::DOMWindow::dispatchLoadEvent): (WebCore::DOMWindow::removeAllEventListeners): (WebCore::DOMWindow::setLocation): (WebCore::DOMWindow::createWindow): (WebCore::DOMWindow::open): (WebCore::DOMWindow::showModalDialog): 2021-07-06 Ryosuke Niwa Deploy smart pointers in EventHandler and UserInputBridge https://bugs.webkit.org/show_bug.cgi?id=227481 Reviewed by Wenson Hsieh and Chris Dumez. Deployed Ref/RefPtr in various places in EventHandler and UserInputBridge. * page/EventHandler.cpp: (WebCore::EventHandler::selectClosestWordFromHitTestResult): (WebCore::EventHandler::selectClosestContextualWordFromMouseEvent): (WebCore::EventHandler::selectClosestContextualWordOrLinkFromMouseEvent): (WebCore::EventHandler::handleMousePressEventTripleClick): (WebCore::EventHandler::handleMousePressEventSingleClick): (WebCore::EventHandler::selectionExtentRespectingEditingBoundary): (WebCore::EventHandler::handleMouseDraggedEvent): (WebCore::EventHandler::eventMayStartDrag const): (WebCore::EventHandler::updateSelectionForMouseDrag): (WebCore::EventHandler::handleMouseReleaseEvent): (WebCore::EventHandler::hitTestResultAtPoint const): (WebCore::EventHandler::scrollOverflow): (WebCore::EventHandler::logicalScrollOverflow): (WebCore::EventHandler::scrollRecursively): (WebCore::EventHandler::logicalScrollRecursively): (WebCore::EventHandler::updateCursor): (WebCore::EventHandler::selectCursor): (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::handleMouseMoveEvent): (WebCore::contentFrameForNode): Renamed from targetIsFrame and made it return the node. (WebCore::EventHandler::updateDragAndDrop): (WebCore::EventHandler::cancelDragAndDrop): (WebCore::EventHandler::performDragAndDrop): (WebCore::hierarchyHasCapturingEventListeners): (WebCore::EventHandler::updateMouseEventTargetNode): (WebCore::EventHandler::notifyScrollableAreasOfMouseEvents): (WebCore::EventHandler::dispatchMouseEvent): (WebCore::EventHandler::isInsideScrollbar const): (WebCore::EventHandler::handleWheelEvent): (WebCore::EventHandler::handleWheelEventInternal): (WebCore::EventHandler::sendContextMenuEvent): (WebCore::EventHandler::sendContextMenuEventForKey): (WebCore::EventHandler::fakeMouseMoveEventTimerFired): (WebCore::EventHandler::hoverTimerFired): (WebCore::EventHandler::handleAccessKey): (WebCore::EventHandler::isKeyEventAllowedInFullScreen const): (WebCore::EventHandler::keyEvent): (WebCore::EventHandler::internalKeyEvent): (WebCore::setInitialKeyboardSelection): (WebCore::removeDraggedContentDocumentMarkersFromAllFramesInPage): (WebCore::EventHandler::handleKeyboardScrolling): (WebCore::EventHandler::handleTouchEvent): (WebCore::EventHandler::passWheelEventToWidget): * replay/UserInputBridge.cpp: (WebCore::UserInputBridge::handleMousePressEvent): (WebCore::UserInputBridge::handleMouseReleaseEvent): (WebCore::UserInputBridge::handleMouseMoveEvent): (WebCore::UserInputBridge::handleMouseMoveOnScrollbarEvent): (WebCore::UserInputBridge::handleMouseForceEvent): (WebCore::UserInputBridge::handleKeyEvent): (WebCore::UserInputBridge::handleAccessKeyEvent): (WebCore::UserInputBridge::handleWheelEvent): (WebCore::UserInputBridge::scrollRecursively): (WebCore::UserInputBridge::logicalScrollRecursively): (WebCore::UserInputBridge::loadRequest): (WebCore::UserInputBridge::tryClosePage): 2021-06-17 Sergio Villar Senin Nullptr crash in StyledMarkupAccumulator::traverseNodesForSerialization https://bugs.webkit.org/show_bug.cgi?id=226821 Reviewed by Ryosuke Niwa. r276394 fixed an issue in serialization when transversing the nodes. It added a new condition to the ASSERT that was checking that its OK not to have a next pointer when there is a valid pastEnd in the case of pastEnd being a descendant of the pointer traversing the node tree. However that descendant check was not including the shadow DOM. This is precisely the case detected by the test case this patch is adding. Test: editing/selection/setSelection-shadow-dom-crash.html * editing/markup.cpp: (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization): 2021-06-22 Rob Buis Make rendererIsEverNeeded check less strict https://bugs.webkit.org/show_bug.cgi?id=226791 Reviewed by Antti Koivisto. Make rendererIsEverNeeded check less strict in TreeResolver::resolveElement. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveElement): 2021-06-10 Chris Dumez Fix incorrect check in AudioNode.disconnect() https://bugs.webkit.org/show_bug.cgi?id=226818 Reviewed by Eric Carlson. * Modules/webaudio/AudioNode.cpp: (WebCore::AudioNode::disconnect): 2021-06-02 Rob Buis Make EndTransparancyLayer a potential no-op https://bugs.webkit.org/show_bug.cgi?id=226523 Reviewed by Simon Fraser. Make EndTransparancyLayer a no-op if there is no current transparency layer in place. * platform/graphics/displaylists/DisplayListItems.cpp: (WebCore::DisplayList::EndTransparencyLayer::apply const): 2021-05-28 Brent Fulgham Buffer computations should use correct type https://bugs.webkit.org/show_bug.cgi?id=226352 Reviewed by Ryosuke Niwa. The implementation of utf8Buffer holds the buffer size in an 'int', even though our buffer APIs take size_t arguments. Let's make this consistent. * platform/SharedBuffer.cpp: (WebCore::utf8Buffer): 2021-05-25 Ian Gilbert Only create MediaElementSession when necessary https://bugs.webkit.org/show_bug.cgi?id=226132 Reviewed by Eric Carlson. Some methods had an unexpected side effect of creating a MediaElementSession. Modified these to not create one if one does not already exist. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent): (WebCore::HTMLMediaElement::mediaState const): 2021-05-22 Rob Buis Detect invalid InlinePathData in StrokeInlinePath https://bugs.webkit.org/show_bug.cgi?id=225691 Reviewed by Ryosuke Niwa. Detect invalid InlinePathData in StrokeInlinePath. * platform/graphics/displaylists/DisplayListItems.h: (WebCore::DisplayList::StrokeInlinePath::StrokeInlinePath): (WebCore::DisplayList::StrokeInlinePath::path const): Deleted. 2021-05-21 Rob Buis Detect invalid InlinePathData in FillInlinePath https://bugs.webkit.org/show_bug.cgi?id=225693 Reviewed by Ryosuke Niwa. Detect invalid InlinePathData in FillInlinePath. * platform/graphics/displaylists/DisplayListItems.h: (WebCore::DisplayList::InlinePathDataStorage::InlinePathDataStorage): (WebCore::DisplayList::InlinePathDataStorage::isValid const): (WebCore::DisplayList::FillInlinePath::FillInlinePath): (WebCore::DisplayList::FillInlinePath::path const): Deleted. 2021-05-20 Chris Dumez WebAudioBufferList::setSampleCount() should early return if computeBufferSizes() fails https://bugs.webkit.org/show_bug.cgi?id=226028 rdar://78222414 Reviewed by Eric Carlson. If computeBufferSizes() fails (returns WTF::nullopt), we now early return on release builds, without modifying the WebAudioBufferList's internal state in any way. In Debug, we would still hit the assertion. * platform/audio/cocoa/WebAudioBufferList.cpp: (WebCore::WebAudioBufferList::setSampleCount): 2021-05-18 Alan Bujtas The containing block for a fixed renderer has to be a type of RenderBlock https://bugs.webkit.org/show_bug.cgi?id=225924 Reviewed by Simon Fraser. While an atomic inline level box with layout containment can certainly be the containing block for fixed (and absolute) boxes, the current render tree logic requires a containing block to be the type of RenderBlock. * rendering/RenderElement.cpp: (WebCore::nearestNonAnonymousContainingBlockIncludingSelf): make this function static so that we can call it from containingBlockForFixedPosition() (WebCore::RenderElement::containingBlockForFixedPosition const): (WebCore::RenderElement::containingBlockForAbsolutePosition const): 2021-05-17 Wenson Hsieh [GPU Process] Object identifiers with the deleted value should cause MESSAGE_CHECKs https://bugs.webkit.org/show_bug.cgi?id=225886 rdar://78114708 Reviewed by Chris Dumez. Implement some stricter validation around object identifiers in when decoding display list items in the GPU Process. Currently, we only check for the empty value (i.e. raw identifier value of 0) when iterating over these items, but treat an identifier with the deleted value as valid; instead, we should be treating items with either empty or deleted identifiers as invalid. To address this, we introduce a new helper method, `ObjectIdentifier::isValid`, and turn existing checks for `!!identifier` into `identifier.isValid()`. Test: DisplayListTests.InlineItemValidationFailure * platform/graphics/displaylists/DisplayListItems.h: (WebCore::DisplayList::ClipToImageBuffer::isValid const): (WebCore::DisplayList::DrawImageBuffer::isValid const): (WebCore::DisplayList::DrawNativeImage::isValid const): (WebCore::DisplayList::DrawPattern::isValid const): (WebCore::DisplayList::PaintFrameForMedia::isValid const): (WebCore::DisplayList::FlushContext::isValid const): (WebCore::DisplayList::MetaCommandChangeItemBuffer::isValid const): (WebCore::DisplayList::MetaCommandChangeDestinationImageBuffer::isValid const): 2021-05-17 Wenson Hsieh [GPU Process] Validate DocumentMarkerLineStyle::Mode when decoding DrawDotsForDocumentMarker https://bugs.webkit.org/show_bug.cgi?id=225874 rdar://77885775 Reviewed by Simon Fraser. Add validation around the style mode enum in `DrawDotsForDocumentMarker`'s `DocumentMarkerLineStyle`. To ensure that these enum values are safely decoded when deserializing `DrawDotsForDocumentMarker` items from arbitrary data, we store and read the style mode as `DocumentMarkerLineStyle::Mode`'s underlying type: a `uint8_t`. Upon item validation, we'll then return `false` from `isValid()` in the case where the underlying value is not a valid `DocumentMarkerLineStyle::Mode`. This is necessary because copying invalid enum class types triggers undefined behavior in C++, so we need to avoid copying the enum value as a `DocumentMarkerLineStyle::Mode` prior to validation. * platform/graphics/displaylists/DisplayListItems.cpp: (WebCore::DisplayList::operator<<): (WebCore::DisplayList::DrawDotsForDocumentMarker::isValid const): * platform/graphics/displaylists/DisplayListItems.h: 2021-05-17 Frederic Wang REGRESSION(r277425): Crash in FrameSelection::selectFrameElementInParentIfFullySelected https://bugs.webkit.org/show_bug.cgi?id=225795 Reviewed by Ryosuke Niwa. r277425 claimed that in FrameSelection::setSelectionWithoutUpdatingAppearance, !m_document->frame() was equivalent to !selectionEndpointsBelongToMultipleDocuments && !selectionIsInAnotherDocument && selectionIsInDetachedDocument, but it misses the case when newSelection.document() is null. So this patch adds back this particular case to the original "if" block. This patch also adds an ASSERT on m_document->frame(). No new tests. * editing/FrameSelection.cpp: (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance): Add back the case !m_document->frame() && !newSelection.document() to the first sanity check and ASSERT on m_document->frame() after the second sanity check. 2021-05-14 Rob Buis Provide custom SetInlineFillGradient copy ctor https://bugs.webkit.org/show_bug.cgi?id=225688 Reviewed by Wenson Hsieh. Provide custom SetInlineFillGradient copy ctor to deal with invalid SetInlineFillGradient source. * platform/graphics/displaylists/DisplayListItems.cpp: (WebCore::DisplayList::SetInlineFillGradient::SetInlineFillGradient): * platform/graphics/displaylists/DisplayListItems.h: (WebCore::DisplayList::SetInlineFillGradient::isValid const): 2021-05-12 Frederic Wang RELEASE_ASSERT(m_selection->isNone()) fails in Document::removedLastRef https://bugs.webkit.org/show_bug.cgi?id=225434 Reviewed by Ryosuke Niwa. Document::removedLastRef asserts that the document's selection is not set. However, setting that selection is possible in FrameSelection::setSelectionWithoutUpdatingAppearance when the document has not been destroyed yet but is already detached from its frame. This patch instead clears the selection in that case. No new tests. * editing/FrameSelection.cpp: (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance): Clears the selection when newSelection is in a detached document. Given the other conditions, this is actually checking equivalent to !m_document->frame(). 2021-04-28 Ryosuke Niwa Use a WeakHashSet for Document::m_mediaElements https://bugs.webkit.org/show_bug.cgi?id=225082 Unreviewed. Address the review comments by Chris & Darin. * dom/Document.cpp: (WebCore::Document::forEachMediaElement): 2021-04-28 Ian Gilbert Use a WeakHashSet for Document::m_mediaElements https://bugs.webkit.org/show_bug.cgi?id=225082 Reviewed by Ryosuke Niwa. Refactoring to use weak pointer instead of raw pointer. No observable change of behavior. * dom/Document.cpp: (WebCore::Document::registerMediaElement): (WebCore::Document::unregisterMediaElement): (WebCore::Document::forEachMediaElement): * dom/Document.h: 2021-04-27 Frédéric Wang [MathML] Assertion failure in RenderTreeNeedsLayoutChecker https://bugs.webkit.org/show_bug.cgi?id=224903 Reviewed by Alan Bujtas. After r226180, RenderMathMLRow no longer performs layout of its "embellished operator" children only its core descendant, which is causing dirty layout. Test: mathml/vertical-embellished-op-dirty-layout.html * rendering/mathml/RenderMathMLRow.cpp: (WebCore::RenderMathMLRow::stretchVerticalOperatorsAndLayoutChildren): always layout the "embellished operator" child, after its core . 2021-04-23 Ian Gilbert Crash in IndentOutdentCommand::outdentParagraph attempting to move a paragraph https://bugs.webkit.org/show_bug.cgi?id=224909 Reviewed by Ryosuke Niwa. Added check inside IndentOutdentCommand::outdentParagraph to ensure that inserting a HTMLBRElement was successful before attempting to move a paragraph to that node. * editing/IndentOutdentCommand.cpp: (WebCore::IndentOutdentCommand::outdentParagraph): 2021-04-19 Darin Adler Nullptr crash in CSSCalcValue::category() via HTMLConverterCaches::floatPropertyValueForNode https://bugs.webkit.org/show_bug.cgi?id=221392 Reviewed by Simon Fraser. * css/CSSCalculationValue.cpp: (WebCore::CSSCalcOperationNode::createCalcExpression const): Pass in a destination category when creating a CalcExpressionOperation. (WebCore::createCSS): Pass the destination category from the CalcExpressionOperation when creating a CSSCalcOperationNode. * css/CSSCalculationValue.h: Moved the CalculationCategory enumeration from here to CalculationValue.h. * platform/CalculationValue.cpp: (WebCore::operator==): Include destination category when comparing. * platform/CalculationValue.h: Moved CalculationCategory here. Added a destination category constructor argument, data members, and getter function to the CalcExpressionOperation class. 2021-04-15 Sergio Villar Senin Assertion failure in SVGAnimationElement::currentValuesForValuesAnimation https://bugs.webkit.org/show_bug.cgi?id=222715 Reviewed by Ryosuke Niwa. Replaced ASSERT_WITH_SECURITY_IMPLICATION by ASSERT. It was added by mistake as part of r157341 long time ago. There is no security implication because just after the assert there would be a division by 0 followed by a crash. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::currentValuesForValuesAnimation): 2021-04-09 Sergio Villar Senin Empty value is added in codePointsFromString in CSSFontFaceSet::matchingFacesExcludingPreinstalledFonts https://bugs.webkit.org/show_bug.cgi?id=223857 Reviewed by Darin Adler. Use UnsignedWithZeroKeyHashTraits in codePointsFromString() to avoid it. * css/CSSFontFaceSet.cpp: (WebCore::codePointsFromString): 2021-04-15 Zalan Bujtas [RenderTreeBuilder] Cleanup the inline tree when moving subtrees https://bugs.webkit.org/show_bug.cgi?id=224342 Reviewed by Antti Koivisto. When an inline box is moved over to a different BFC (), any inline level descendant () should be invalidated. The safest way to do this is to destroy the inline tree (the "subtree moving" will eventually be replaced by "destroy followed by construct" activity). * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::move): 2021-04-15 Carlos Garcia Campos REGRESSION(r272900): Nullptr crash in ComposedTreeIterator::traverseNextInShadowTree() via ShadowRoot::hostChildElementDidChange https://bugs.webkit.org/show_bug.cgi?id=222720 Reviewed by Ryosuke Niwa. This patch reverts r274064 to apply a different fix. Instead of null-checking the nodes returned by SlotAssignment::assignedNodesForSlot(), assigned nodes are removed from the list when they are about to be removed from the parent. That ensures we never return nullptr nodes nor nodes with a nullptr parent from the assigned nodes vector. * dom/ComposedTreeIterator.cpp: (WebCore::ComposedTreeIterator::traverseNextInShadowTree): (WebCore::ComposedTreeIterator::advanceInSlot): * dom/ContainerNode.cpp: (WebCore::ContainerNode::removeBetween): * dom/Node.h: (WebCore::Node::hasShadowRootContainingSlots const): (WebCore::Node::setHasShadowRootContainingSlots): * dom/ShadowRoot.h: * dom/SlotAssignment.cpp: (WebCore::SlotAssignment::addSlotElementByName): (WebCore::SlotAssignment::removeSlotElementByName): (WebCore::SlotAssignment::willRemoveAssignedNode): * dom/SlotAssignment.h: (WebCore::ShadowRoot::willRemoveAssignedNode): 2021-04-14 Ryosuke Niwa Crash in in ReplaceSelectionCommand::mergeEndIfNeeded() https://bugs.webkit.org/show_bug.cgi?id=222941 Unreviewed. Address Darin's post-commit comment that we don't need to explicitly call copyRef here. * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::mergeEndIfNeeded): 2021-04-14 Julian Gonzalez Crash in ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds() https://bugs.webkit.org/show_bug.cgi?id=224520 Reviewed by Ryosuke Niwa. Adopt RefPtr instead of using plain Node* here to avoid a crash. * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds): 2021-04-14 Carlos Garcia Campos Do not reset computed style for element children with display contents style https://bugs.webkit.org/show_bug.cgi?id=223794 Reviewed by Antti Koivisto. We were checking hasDisplayContents() was false before calling resetComputedStyle() on the parent, but we don't check it when iterating the children. * dom/Element.cpp: (WebCore::Element::resetComputedStyle): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveComposedTree): 2021-04-13 Rob Buis Skip style update https://bugs.webkit.org/show_bug.cgi?id=223365 Reviewed by Ryosuke Niwa. Skip style update for getting the SVG bounding box since boundingClientRect already updated style. * dom/Element.cpp: (WebCore::Element::boundingAbsoluteRectWithoutLayout): * svg/SVGElement.cpp: (WebCore::SVGElement::getBoundingBox): 2021-04-12 BJ Burg Modernize uses of ConsoleClient https://bugs.webkit.org/show_bug.cgi?id=224398 Reviewed by David Kilzer. ConsoleClient acts like a delegate, so its callers should be using weak references to it. * bindings/js/ScriptCachedFrameData.cpp: (WebCore::ScriptCachedFrameData::restore): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::initScriptForWindowProxy): * bindings/js/WindowProxy.cpp: (WebCore::WindowProxy::setDOMWindow): * workers/WorkerOrWorkletScriptController.cpp: (WebCore::WorkerOrWorkletScriptController::initScriptWithSubclass): 2021-04-11 Rob Buis Store InputType in a Ref before calling setValueAsDecimal https://bugs.webkit.org/show_bug.cgi?id=223535 Reviewed by Ryosuke Niwa. Store InputType in a Ref before calling setValueAsDecimal. * html/InputType.cpp: (WebCore::InputType::applyStep): 2021-04-09 Carlos Garcia Campos Teardown shadow root renderers on SlotAssignment::didChangeSlot https://bugs.webkit.org/show_bug.cgi?id=221386 Reviewed by Ryosuke Niwa. This reverts r272900 to move the call to RenderTreeUpdater::tearDownRenderers() from hostChildElementDidChange() to didChangeSlot(). This ensures the renderers are also cleared for other shadow root trees not using details element. * dom/SlotAssignment.cpp: (WebCore::SlotAssignment::addSlotElementByName): (WebCore::SlotAssignment::didChangeSlot): * dom/SlotAssignment.h: (WebCore::ShadowRoot::hostChildElementDidChange): 2021-03-24 Sergio Villar Senin [css-grid] Initialize auto-repeat data in RenderStyle in applyInitialGridTemplate{Columns|Rows} https://bugs.webkit.org/show_bug.cgi?id=222852 Reviewed by Antti Koivisto. We should initialize the auto repeat data (like auto repeat tracks or the insertion point) whenever applyInitialGridTemplateXXX is called. That method is normally called using different RenderStyle's but under some circumstances it might be the same. For those cases we wouldn't like to end up with obsolete data from a previous style resolution. The same applies also to the applyInheritGridTemplateXXX calls. We're also removing a duplicate call to setGridAutoRepeat{Row|Column}sInsertionPoint() that is not needed at all. In order to have a single place with all the style properties affecting columns and rows, all the set calls were moved to a macro that is used by all the apply{Initial|Inherit}GridTemplate{Columns|Rows} methods. This would allow us to prevent eventual out-of-sync issues like this one. * style/StyleBuilderCustom.h: (WebCore::Style::BuilderCustom::applyInitialGridTemplateColumns): (WebCore::Style::BuilderCustom::applyInheritGridTemplateColumns): (WebCore::Style::BuilderCustom::applyInitialGridTemplateRows): (WebCore::Style::BuilderCustom::applyInheritGridTemplateRows): 2021-04-02 Ryosuke Niwa PendingImageBitmap gets created on a stopped script execution context. https://bugs.webkit.org/show_bug.cgi?id=223971 Reviewed by Youenn Fablet. Don't create a PendingImageBitmap in PendingImageBitmap::fetch if the associated script execution context had already been stoppped. The new behavior matches of Chrome although it's technically incorrect. Correcting it to match the spec & Firefox will refactor a larger fix around how script execution context is used by the threaded loader. * html/ImageBitmap.cpp: (WebCore::PendingImageBitmap::fetch): 2021-03-31 Venky Dass Null pointer access crash in WebCore::makeBoundaryPoint(..) https://bugs.webkit.org/show_bug.cgi?id=223977 Reviewed by Darin Adler. In makeBoundaryPoint, position.containerNode() can be nullptr even if position.isNull() was false Test: LayoutTests/editing/inserting/crash-make-boundary-point.html * dom/Position.cpp: (WebCore::makeBoundaryPoint): 2021-08-21 Sihui Liu IndexedDB: crash when triggering IDBOpenRequest completion back on a worker thread https://bugs.webkit.org/show_bug.cgi?id=229375 Reviewed by Brady Eidson. Client may dispatch custom events to an IDBRequest, and we should only change request state based on events created internally. * Modules/indexeddb/IDBRequest.cpp: (WebCore::IDBRequest::dispatchEvent): 2021-03-30 Ryosuke Niwa Occasional debug assert in GenericTaskQueue::~GenericTaskQueue https://bugs.webkit.org/show_bug.cgi?id=223913 Reviewed by Eric Carlson. Eagerly initialize WeakPtrImpl so that we don't hit debug assertions. Also made Performance object use EventLoop. No new tests since there is no test case that reliably reproduces this issue. * dom/TaskSource.h: (TaskSource): Added PerformanceTimeline. * page/Performance.cpp: (WebCore::Performance::Performance): (WebCore::Performance::contextDestroyed): (WebCore::Performance::queueEntry): Use EventLoopTaskGroup instead of GenericTaskQueue to deliver entries. * page/Performance.h: * platform/GenericTaskQueue.h: (WebCore::GenericTaskQueue::GenericTaskQueue): Eagerly initialize WeakPtrImpl. Also assert that we're creating this object in the main thread. 2021-03-29 Chris Dumez REGRESSION(r274992): Nullptr crash in FontCache::retrieveOrAddCachedFonts https://bugs.webkit.org/show_bug.cgi?id=223858 Reviewed by Darin Adler and Ryosuke Niwa. Stop using a hash as key in the FontCascadeCache. Instead, use HashTraits and use FontCascadeCacheKey as key. Test: fonts/font-cache-crash.html * platform/graphics/FontCache.cpp: (WebCore::FontCache::retrieveOrAddCachedFonts): (WTF::FontCascadeCacheKeyHash::hash): * platform/graphics/FontCache.h: (WebCore::FontCascadeCacheKey::operator== const): (WTF::FontCascadeCacheKeyHash::equal): (WTF::HashTraits::emptyValue): (WTF::HashTraits::constructDeletedValue): (WTF::HashTraits::isDeletedValue): 2021-03-29 Ian Gilbert Make a Ref to HTMLPlugInElement when resolving callback https://bugs.webkit.org/show_bug.cgi?id=223846 Reviewed by Ryosuke Niwa. Take a Ref to the HTMLPlugInElement to keep it alive while invoking HTMLPlugInElement::swapRendererTimerFired() * html/HTMLPlugInElement.cpp: (WebCore::HTMLPlugInElement::swapRendererTimerFired): 2021-03-27 Ryosuke Niwa Don't add Frame as an opaque root of DOMWindow https://bugs.webkit.org/show_bug.cgi?id=223838 Reviewed by Simon Fraser. Don't add Frame as an opaque root of DOMWindow since we don't use Frame as an opaque root of any JS wrappers since r248276. * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::visitAdditionalChildren): 2021-03-26 Ian Gilbert Dirty layout for floating children of inline on full layout https://bugs.webkit.org/show_bug.cgi?id=223660 Reviewed by Zalan Bujtas. Avoid consuming an object on an empty line when that object is floating or out-of-flow. * rendering/line/BreakingContext.h: (WebCore::BreakingContext::handleEndOfLine): 2021-03-26 Zalan Bujtas [RenderTreeBuilder] No need to update the counters when the renderer is moved internally https://bugs.webkit.org/show_bug.cgi?id=223801 Reviewed by Ryosuke Niwa. When the renderer re-parenting is initiated by an "internal move" (e.g. anonymous block parent is not needed anymore so all the descendants are moved "one level" up), we don't need to re-compute the counters. Their state should not be any different after this re-parenting. * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::attachToRenderElementInternal): (WebCore::RenderTreeBuilder::move): * rendering/updating/RenderTreeBuilder.h: 2021-03-23 Frédéric Wang Nullptr crash in HTMLConverter::convert https://bugs.webkit.org/show_bug.cgi?id=221719 Reviewed by Ryosuke Niwa. When the "Undo" command is called after DOM changes, one of the selection's position anchors may have been moved to a new document. In that case, just clear the selection. Also add asserts to ensure the selection is in good state after unapply and reapply commands. * editing/CompositeEditCommand.cpp: (WebCore::EditCommandComposition::unapply): Add security assert to ensure selection is in good state. (WebCore::EditCommandComposition::reapply): Ditto. * editing/FrameSelection.cpp: (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance): If the selection's position anchors have been moved to a new document then just clear the selection. (WebCore::FrameSelection::isConnectedToDocument const): New method to verify that all the positions of the visible selection are in m_document. * editing/FrameSelection.h: Declare new method. * editing/VisibleSelection.cpp: (WebCore::VisibleSelection::document const): New method that returns a common document for all positions or nullptr otherwise. * editing/VisibleSelection.h: Declare new method. 2021-03-22 Venky Dass Nullptr crash in WebCore::RenderObject::RenderObjectBitfields::isLineBreak() where a NULL check is missing. https://bugs.webkit.org/show_bug.cgi?id=223409 Reviewed by Ryosuke Niwa. When the check for LineBreak is performed the BR elmement NULL check is not performed. Which results in a crash The fix therefore is to check for NULL. Test: LayoutTests/editing/inserting/insert-paragraph-between-hr-and-br-assigned-to-slot-crash.html * editing/InsertParagraphSeparatorCommand.cpp: (WebCore::InsertParagraphSeparatorCommand::doApply): 2021-03-22 Ian Gilbert [Web Animations] nullptr crash in updatePlaybackRate() with no timeline https://bugs.webkit.org/show_bug.cgi?id=223095 Reviewed by Ryosuke Niwa. Changed to WebAnimation::remove() to use setTimeline() instead of setTimelineInternal() to ensure the animation is in the correct play state. No new tests as this relies on navigating while updating the playback rate and I was unable to make a reliable test case. * animation/WebAnimation.cpp: (WebCore::WebAnimation::remove): Changed setTimelineInternal() to setTimeline() in order to ensure the animation has the correct play state. 2021-03-22 Patrick Angle REGRESSION(r272433): Inspector should not instrument inside `WebCore::Node::setRenderer` https://bugs.webkit.org/show_bug.cgi?id=223559 Reviewed by Ryosuke Niwa and Devin Rousso. Existing test coverage: - inspector/css/nodeLayoutContextTypeChanged.html - inspector/css/setLayoutContextTypeChangedMode.html The previous approach to observing render changes was most likely a performance regression in a very hot code path (`Node::setRenderer`). This patch resolves this by not instrumenting in this the hot path. Instead we call inspector instrumentation inside the constructors/destructors of only the RenderObject subclasses we are interested in observing layout changes for. Additionally, layout change events are now added to a `Vector` of pending changes, which will be sent to the front-end later in order to avoid evaluating JavaScript inside a destructor in WK1 with the new instrumentation points. * dom/Element.cpp: (WebCore::Element::didChangeRenderer): Deleted. * dom/Element.h: * dom/Node.h: (WebCore::Node::didChangeRenderer): Deleted. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::nodeLayoutContextChangedImpl): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::nodeLayoutContextChanged): * inspector/agents/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::InspectorCSSAgent): (WebCore::InspectorCSSAgent::reset): (WebCore::InspectorCSSAgent::nodeLayoutContextTypeChanged): (WebCore::InspectorCSSAgent::layoutContextTypeChangedTimerFired): - Moved layout change events behind a timer firing. * inspector/agents/InspectorCSSAgent.h: * rendering/RenderGrid.cpp: (WebCore::RenderGrid::RenderGrid): (WebCore::RenderGrid::~RenderGrid): - Move instrumentation from `Node::setRenderer` to `RenderGrid`. * rendering/RenderObject.h: (WebCore::Node::setRenderer): 2021-03-22 Chris Dumez Better validate JSArrays in AudioWorkletProcessor https://bugs.webkit.org/show_bug.cgi?id=223548 Reviewed by Geoffrey Garen. Better validate JSArrays in AudioWorkletProcessor. Replaces debug assertions with runtime checks for robustness. * Modules/webaudio/AudioWorkletProcessor.cpp: (WebCore::copyDataFromBusesToJSArray): (WebCore::copyDataFromParameterMapToJSObject): (WebCore::zeroJSArray): (WebCore::AudioWorkletProcessor::buildJSArguments): 2021-03-19 Rob Buis Protect frame before calling didBeginDocument https://bugs.webkit.org/show_bug.cgi?id=217185 Reviewed by Alex Christensen. Protect frame before calling didBeginDocument since it could potentially delete the frame through event handling. * loader/DocumentWriter.cpp: (WebCore::DocumentWriter::begin): 2021-03-18 Rob Buis Protect frame before calling setPrinting https://bugs.webkit.org/show_bug.cgi?id=222664 Reviewed by Ryosuke Niwa. Protect frame before calling setPrinting since it could potentially delete the frame through event handling. * page/PrintContext.cpp: (WebCore::PrintContext::begin): 2021-02-26 Sergio Villar Senin Invalidate RenderTreePosition's next sibling with display:contents https://bugs.webkit.org/show_bug.cgi?id=218578 Reviewed by Antti Koivisto. When inserting elements in the tree from JS it might happen that the renderTreePosition() in the RenderTreeUpdater caches a nextSibling() value which is only temporarily correct because we sequentially process the descendants of a given root node in RenderTreeUpdater::updateRenderTree(). One of those potentially incorrect scenarios is when using display:contents. We can detect those cases because we would leave a parent element in RenderTreeUpdater::popParent() without changing renderingParent() and so without changing renderTreePosition(). Once we are in that situation we must invalidate the cached position so the next sibling is recomputed. * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::popParent): Invalidate the render tree position's next sibling if the parent element is not the renderingParent(). 2021-03-18 Frédéric Wang ASSERTION FAILED: node.isConnected() in matchSlottedPseudoElementRules https://bugs.webkit.org/show_bug.cgi?id=221440 Reviewed by Ryosuke Niwa. ReplaceSelectionCommand::doApply() removes a
from an element and immediately calls highestNodeToRemoveInPruning() on that element. The former operation may destroy the element's renderer and confuses the latter operation. This happens in particular for a element which ends up being removed from the tree. This in turn causes unexpected issues such as a debug assertion failure in matchSlottedPseudoElementRules. To address that problem, ensure the document is laid out before calling highestNodeToRemoveInPruning(). This patch also increases and improves use of RefPtr. * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::removeNodeAndPruneAncestors): Use auto & makeRefPtr. (WebCore::CompositeEditCommand::prune): Store local highestNodeToRemove variable in a RefPtr. (WebCore::CompositeEditCommand::cleanupAfterDeletion): Store local node variable in a RefPtr. (WebCore::CompositeEditCommand::breakOutOfEmptyMailBlockquotedParagraph): Store local parentNode variable in a RefPtr. * editing/Editing.cpp: (WebCore::highestNodeToRemoveInPruning): Store local currentNode variable in a a RefPtr. * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::doApply): Use auto & makeRefPtr. Store local odeToRemove variable in a RefPtr. Ensure the document is laid out before calling highestNodeToRemoveInPruning. 2021-03-15 Zalan Bujtas Do not collapse the anonymous block when it is a candidate container for the list marker https://bugs.webkit.org/show_bug.cgi?id=223196 Reviewed by Antti Koivisto. Do not merge empty anonymous siblings when the callers says "do not collpase anonymous block". Those merge candidate anonymous blocks may be candidate containers for some other conent (we expand on r238119 here). * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::detach): 2021-03-14 Zalan Bujtas RenderLineBreak should stay inline level box even when display property says otherwise. https://bugs.webkit.org/show_bug.cgi?id=223151 Reviewed by Antti Koivisto. In this patch we make sure that the RenderLineBreak object always stays inline. While the display property applies to all elements (https://drafts.csswg.org/css-display/#the-display-properties), the line break element (
) seems to be an exception and all browsers handle
still as an inline level element. Renderers can (and do see RenderSVGInline::updateFromStyle) diverge from this computed display value and say they always want to be inline level boxes. This is ensured by RenderObject::setInline/isInline function pair. Initially there were 2 setInline() calls: One in RenderObject::setStyle(). It dealt with "block to inline" transition and one call in RenderBox::setStyle(). In these functions we simply set the renderer's "inInline" bit to the computed style value (setInline(style.isDisplayInlineType)). However derived renderer classes were able to override it by implementing the ::setStyle function and explicitly set the "isInline" bit to true/false. Over the years the second (RenderBox::setStyle) call transitioned to RenderBoxModelObject::updateFromStyle() and the first (RenderObject::setStyle) call got moved to normalizeTreeAfterStyleChange() and their order got flipped. Derived renderer classes can still explicitly set the "isInline" bit by implementing the ::updateFromStyle() function (this is similar to what we had with ::setStyle). However since the order is flipped, the "setInline()" call in normalizeTreeAfterStyleChange() now runs after updateFromStyle() and it may re-reset the "isInline" bit back to the computed value (hence the FIXME). The "setInline" call in normalizeTreeAfterStyleChange() is not needed anymore since the "isInline" bit is already updated by the time we get here (as opposed to when it was initially introduced in RenderObject::setStyle, see above). * rendering/RenderLineBreak.cpp: (WebCore::RenderLineBreak::updateFromStyle): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::normalizeTreeAfterStyleChange): 2021-03-13 Zalan Bujtas Mark the line dirty when list marker goes from inline to block https://bugs.webkit.org/show_bug.cgi?id=223132 Reviewed by Antti Koivisto. This patch ensures that the line layout has a chance to clean up the inline boxes when the marker goes from inline to block. Instead of deleting the inline box wrapper (InlineElement) here let's 1. mark both the renderer and the line dirty and let the inline layout code run its normal cleanup process on dirty lines. 2. detach the inline box wrapper from the now-block list marker. * rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::styleDidChange): * rendering/RootInlineBox.cpp: (WebCore::RootInlineBox::verticalPositionForBox): 2021-03-12 Rob Buis Use refptr to PeerConnectionFactoryInterface https://bugs.webkit.org/show_bug.cgi?id=222725 Reviewed by Youenn Fablet. Use refptr instead of reference to PeerConnectionFactoryInterface. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint): (WebCore::LibWebRTCMediaEndpoint::addTrack): (WebCore::LibWebRTCMediaEndpoint::createSourceAndRTCTrack): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: 2021-03-09 Carlos Garcia Campos Suspend widget hierarchy updates while executing node insertion https://bugs.webkit.org/show_bug.cgi?id=222719 Reviewed by Ryosuke Niwa. * dom/ContainerNode.cpp: (WebCore::executeNodeInsertionWithScriptAssertion): 2021-03-09 Zalan Bujtas [Multi-column] Adjust fragmented flow state of the out-of-flow descendants https://bugs.webkit.org/show_bug.cgi?id=222958 Reviewed by Antti Koivisto. When a block container's style change from positioned to non-positioned and it is part of a multi-column context, we need to make sure that the out-of-flow positined descendants' flow state are updated accordingly (as they may not be part of the multi-column context anymore). * rendering/RenderElement.cpp: (WebCore::RenderElement::adjustFragmentedFlowStateOnContainingBlockChangeIfNeeded): 2021-03-08 Julian Gonzalez Crash in in ReplaceSelectionCommand::mergeEndIfNeeded() https://bugs.webkit.org/show_bug.cgi?id=222941 Reviewed by Ryosuke Niwa. Make a copy of Ref when inserting before start of paragraph. * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::mergeEndIfNeeded): 2021-03-08 Carlos Garcia Campos REGRESSION(r272900): Nullptr crash in ComposedTreeIterator::traverseNextInShadowTree() via ShadowRoot::hostChildElementDidChange https://bugs.webkit.org/show_bug.cgi?id=222720 Reviewed by Ryosuke Niwa. The list of assigned nodes contains weak pointers, we should check the node hasn't been destroyed. Test: fast/html/details-set-inner-text-crash.html * dom/ComposedTreeIterator.cpp: (WebCore::ComposedTreeIterator::traverseNextInShadowTree): 2021-03-04 Julian Gonzalez Deploy Ref in SVGUseElement.cpp https://bugs.webkit.org/show_bug.cgi?id=222637 Reviewed by Ryosuke Niwa. Remove usage of raw pointers in a few functions here that showed issues in 222397. Thanks to Darin Adler for the initial version of this patch and Ryosuke Niwa for refinements. * svg/SVGUseElement.cpp: (WebCore::disassociateAndRemoveClones): (WebCore::removeDisallowedElementsFromSubtree): (WebCore::removeSymbolElementsFromSubtree): 2021-03-04 Ryosuke Niwa "precustomized" state of custom elements can become HTMLUnknownElement https://bugs.webkit.org/show_bug.cgi?id=221652 Reviewed by Darin Adler. The bug was caused by createJSHTMLWrapper in JSHTMLElementWrapperFactory.cpp relying on !isCustomElementUpgradeCandidate() to create HTMLUnknownElement as JS wrapper of the element. This is problematic after r266269 since that change re-purposes CustomElementState::Failed on a custom element as "precustomized" state instead of introducing another enum value in CustomElementState as RareDataBitFields has no more bits available. This patch fixes the problem by introducing a new NodeFlag::IsUnknownElement and using that to check whether JSHTMLUnknownElement should be created for a given element or not. Note that HTMLElement had a virtual function, isHTMLUnknownElement, to check this condition but invoking a virtual function proved to incur too much runtime cost. * dom/Node.h: (WebCore::Node::isUnknownElement const): Added. (WebCore::Node::isHTMLUnknownElement const): Added. (WebCore::Node::isSVGUnknownElement const): Added. (WebCore::Node::isMathMLUnknownElement const): Added. (WebCore::Node::NodeFlag): Added NodeFlag::IsUnknownElement. * dom/make_names.pl: (printWrapperFactoryCppFile): Treat the element as HTMLUnknownElement only if isUnknownElement returns true instead of isCustomElementUpgradeCandidate returning false. * html/HTMLElement.h: (WebCore::HTMLElement::isHTMLUnknownElement const): Deleted. * html/HTMLUnknownElement.h: * mathml/MathMLElement.cpp: (WebCore::MathMLElement::MathMLElement): Added ConstructionType as an argument. * mathml/MathMLElement.h: * mathml/MathMLUnknownElement.h: (WebCore::MathMLUnknownElement::MathMLUnknownElement): Set NodeFlag::IsUnknownElement. * svg/SVGElement.cpp: (WebCore::SVGElement::SVGElement): Added ConstructionType as an argument. * svg/SVGElement.h: * svg/SVGUnknownElement.h: (WebCore::SVGUnknownElement::SVGUnknownElement): Set NodeFlag::IsUnknownElement. 2021-03-01 Chris Dumez Protect AudioWorkletGlobalScope::registerProcessor() against re-entry https://bugs.webkit.org/show_bug.cgi?id=222567 Reviewed by Eric Carlson. AudioWorkletGlobalScope::registerProcessor() checks if 'name' is in m_processorConstructorMap then does some checks that potentially run JS and thus call registerProcessor() again (potentially with the same name). To address this, we now check the map again after potentially running the JS code. * Modules/webaudio/AudioWorkletGlobalScope.cpp: (WebCore::AudioWorkletGlobalScope::registerProcessor): 2021-03-03 Julian Gonzalez Crash in removeSymbolElementsFromSubtree() https://bugs.webkit.org/show_bug.cgi?id=222397 Reviewed by Ryosuke Niwa. Skip children in removeSymbolElementsFromSubtree(), so that we don't see nodes that have been removed in disassociateAndRemoveClones. Thanks to Darin Adler for the initial version of this patch and Ryosuke Niwa for refinements. * svg/SVGUseElement.cpp: (WebCore::removeSymbolElementsFromSubtree): 2021-07-29 Michael Catanzaro [WPE][GTK] .asc file extension is appended to filename of text/plain downloads https://bugs.webkit.org/show_bug.cgi?id=228566 Reviewed by Adrian Perez de Castro. Our MIMETypeRegistry::preferredExtensionForMIMEType returns "asc" for text/plain, possibly because "asc" sorts alphabetically ahead of all other possible file extensions for text/plain, and we just pick the first one. So if the text file does not contain any file extension, we give it a file extension for a GPG signature. Ouch. I don't know how to fix it, but we don't need to, because we don't really want to append any file extension for text/plain anyway. That's just annoying. If I download a file named "backtrace" then I don't want it renamed to "backtrace.txt". That would be expected on Windows, but certainly not from WebKitGTK. So I think it's reasonable to have a special case for text/plain. * platform/xdg/MIMETypeRegistryXdg.cpp: (WebCore::MIMETypeRegistry::preferredExtensionForMIMEType): 2021-04-21 Youenn Fablet Use BlobURL::getOriginURL in more places https://bugs.webkit.org/show_bug.cgi?id=224857 Reviewed by Alex Christensen. Covered by existing tests. * loader/PolicyChecker.cpp: (WebCore::FrameLoader::PolicyChecker::extendBlobURLLifetimeIfNecessary const): 2021-04-15 Youenn Fablet REGRESSION(Safari 14): iframe with blob url does not work with sandboxing https://bugs.webkit.org/show_bug.cgi?id=222312 Reviewed by Chris Dumez. In https://trac.webkit.org/r275884, we correctly compute whether a blob is to be considered secure or not. For that, we need to have the blob URL registered with its document origin. Update PolicyChecker to properly register the temporoary blob URL with its document origin. Test: http/tests/security/sandbox-iframe-and-blob.https.html * loader/PolicyChecker.cpp: (WebCore::FrameLoader::PolicyChecker::extendBlobURLLifetimeIfNecessary const): 2021-04-18 Youenn Fablet Blob URLs should use for their owner origin for CSP checks https://bugs.webkit.org/show_bug.cgi?id=224535 Reviewed by Alex Christensen. Before the patch, we were checking blob origin directly with ancestors. As per https://w3c.github.io/webappsec-csp/#match-url-to-source-expression step 4.1, we need to get the URL origin, which by spec is the origin of the blob creator. We only do this for navigation loads as script loads should be kept the current way, as a cross-site scripting protection, and to remain compatible with other browsers. Make some refactoring to add helper routines to get origin and secure context state of blob URLs in BlobURL. Make use of it in MixedContentChecker as a refactoring. Make use of the helper routine in ContentSecurityPolicySource::matches to fix the bug. Test: http/tests/security/frame-src-and-blob-download.https.html * fileapi/BlobURL.cpp: (WebCore::blobOwner): (WebCore::BlobURL::getOriginURL): (WebCore::BlobURL::isSecureBlobURL): * fileapi/BlobURL.h: * fileapi/ThreadableBlobRegistry.cpp: (WebCore::isBlobURLContainsNullOrigin): * loader/MixedContentChecker.cpp: (WebCore::MixedContentChecker::isMixedContent): * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::isSecure): * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::urlMatchesSelf const): * page/csp/ContentSecurityPolicy.h: * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::matches const): 2021-06-16 Chris Dumez Protect Element before calling dispatchMouseEvent() on it https://bugs.webkit.org/show_bug.cgi?id=226767 Reviewed by Ryosuke Niwa. * page/EventHandler.cpp: (WebCore::EventHandler::updateMouseEventTargetNode): (WebCore::EventHandler::dispatchMouseEvent): * page/PointerLockController.cpp: (WebCore::PointerLockController::dispatchLockedMouseEvent): * page/Quirks.cpp: (WebCore::Quirks::triggerOptionalStorageAccessQuirk const): 2021-05-27 Brent Fulgham Pass frame ref during navigationPolicyCompletionHandler https://bugs.webkit.org/show_bug.cgi?id=226268 Reviewed by Ryosuke Niwa. Pass the active frame to the navigationPolicyCompletionHandler lambda as a Ref to ensure it is kept alive during the policy check and subsequent steps. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): 2021-04-26 Said Abou-Hallawa Remove redundant frameDetached() from the SVGImage destructor https://bugs.webkit.org/show_bug.cgi?id=221616 Reviewed by Chris Dumez. SVGImage was originally written such that it has two separate objects: a page and a frame; see https://trac.webkit.org/r18470. So it made sense at that time to clean up the page and the frame separately. The Frame was cleaned up by telling the frame's loader that the frameDetached(). This code is not necessary right now since the page owns the main frame. And its destructor recursively detaches itself from all the frames. * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::~SVGImage): 2021-04-17 Brent Fulgham Perform port blocking earlier in the load https://bugs.webkit.org/show_bug.cgi?id=224525 Unreviewed follow-up (suggested by David Kilzer) * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): Restore an m_frame nullptr check., 2021-04-16 Brent Fulgham Perform port blocking earlier in the load https://bugs.webkit.org/show_bug.cgi?id=224525 Reviewed by Darin Adler. WebKit blocks loads to URLs with any of the prohibited ports defined in the engine. This blocking happens late in the load process, allowing connections to be made (and observed). Instead, we should stop the load early, at the same time we perform other checks. Test: http/tests/security/form-blocked-port.html * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::isSafeToLoadURL): Add a check for prohibited ports, and block (with relevant logging) if a load to a denied port is attempted. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): Ditto. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadFrameRequest): Ditto. (WebCore::FrameLoader::reportBlockedLoadFailed): Ditto. * loader/FrameLoader.h: * loader/PingLoader.cpp: (WebCore::PingLoader::loadImage): Ditto. * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::init): Ditto. * loader/SubframeLoader.cpp: (WebCore::FrameLoader::SubframeLoader::pluginIsLoadable): Ditto. (WebCore::FrameLoader::SubframeLoader::loadSubframe): Ditto. * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::canRequest): Ditto. (WebCore::CachedResourceLoader::canRequestAfterRedirection const): Ditto. 2021-03-02 Antoine Quint Crash under KeyframeEffect::setTarget() https://bugs.webkit.org/show_bug.cgi?id=222591 Reviewed by David Kilzer. The Styleable returned by targetStyleable() holds a reference to the Element that at this point is m_target (assuming it's non-null). However, once we set the new value for m_target, if the only reference to the original target was held by this KeyframeEffect, then that element will be deallocated and by the time we call didChangeTargetStyleable() it will be gone. To address, we create a RefPtr in the scope of KeyframeEffect::setTarget() protecting the Styleable's element while didChangeTargetStyleable() is called. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::setTarget): 2021-03-14 Rob Buis Cancel image loader events after first dispatch https://bugs.webkit.org/show_bug.cgi?id=218556 Reviewed by Darin Adler. Address post review comments. * dom/EventSender.h: (WebCore::EventSender::dispatchPendingEvents): 2021-07-13 Philippe Normand [GStreamer] Allow runtime opt-out of GL rendering https://bugs.webkit.org/show_bug.cgi?id=227873 Reviewed by Xabier Rodriguez-Calvar. In some cases GL rendering is not really useful, such as on machines without GPU. In those cases currently Mesa's llvmpipe is used, introducing CPU and RAM usage increase compared to the non-gl rendering path. For these cases the user can set a new env var, WEBKIT_GST_DISABLE_GL_SINK=1, allowing the player to use the Cairo sink. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::createVideoSinkGL): 2021-03-05 Myles C. Maxfield CanvasRenderingContext2DBase::canDrawTextWithParams() needs to resolve styles before using the drawingContext https://bugs.webkit.org/show_bug.cgi?id=221257 Reviewed by Ryosuke Niwa. Simply call fontProxy() (which internally resolves styles) before calling drawingContext(). Test: fast/text/canvas-synchronous-events.html * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::canDrawTextWithParams): 2021-03-12 Rob Buis Cancel image loader events after first dispatch https://bugs.webkit.org/show_bug.cgi?id=218556 Reviewed by Ryosuke Niwa. Cancel image loader events after first dispatch. Also change EventSender to use WeakPtr. * dom/EventSender.h: (WebCore::EventSender::dispatchEventSoon): (WebCore::EventSender::dispatchPendingEvents): * loader/ImageLoader.cpp: (WebCore::ImageLoader::dispatchPendingErrorEvent): * loader/ImageLoader.h: 2021-06-18 Philippe Normand [MSE][GStreamer] Soundcloud serves MP4 audio with empty tfdt boxes https://bugs.webkit.org/show_bug.cgi?id=191419 Reviewed by Michael Catanzaro. When MSE is used the player receives broken audio fragments, perhaps because the server expects the client to repair them. Not much we can do about this on GStreamer side though, so behave as a Chrome UserAgent and then MSE is not used, the player receives an MP3 stream. * platform/UserAgentQuirks.cpp: (WebCore::urlRequiresChromeBrowser): 2021-05-21 Chris Lord [GTK] REGRESSION: Broken scrolling on element.io with async scrolling https://bugs.webkit.org/show_bug.cgi?id=222265 Reviewed by Carlos Garcia Campos. Fix transform order for layer clipping in TextureMapperLayer. No new tests. * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::paintSelfAndChildren): 2021-05-15 Alexander Mikhaylenko [GTK] REGRESSION: Kinetic scrolling on touchpad doesn't work with async scrolling off https://bugs.webkit.org/show_bug.cgi?id=224182 Reviewed by Michael Catanzaro. Don't clear the scroll history every time we scroll, that defeats the whole point of having the scroll history. * platform/generic/ScrollAnimatorGeneric.cpp: (WebCore::ScrollAnimatorGeneric::scrollToPositionWithoutAnimation): 2021-06-15 Philippe Normand [GStreamer] Another crash under gst_element_add_pad https://bugs.webkit.org/show_bug.cgi?id=225765 Reviewed by Adrian Perez de Castro. Decodebin3 in GStreamer <= 1.16 does not respect user-supplied select-stream events. So we need to relax the release assert for these versions. This bug was fixed in: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/commit/b41b87522f59355bb21c001e9e2df96dc6956928 * platform/graphics/gstreamer/ImageDecoderGStreamer.cpp: (WebCore::ImageDecoderGStreamer::InnerDecoder::connectDecoderPad): 2021-05-24 Zan Dobersek GLContextEGL::swapBuffers() shouldn't do anything for Surfaceless contexts https://bugs.webkit.org/show_bug.cgi?id=226164 Reviewed by Philippe Normand. In case of a surfaceless GLContextEGL, the swapBuffers() method should return early, avoiding an assert expecting a non-null EGLSurface (not viable for surfaceless context) and a call to eglSwapBuffers(), which on some drivers could still fail even when the surfaceless context support is present and active. * platform/graphics/egl/GLContextEGL.cpp: (WebCore::GLContextEGL::swapBuffers): 2021-05-07 Chris Dumez AudioWorkletProcessor which does not extend base class crashes Safari https://bugs.webkit.org/show_bug.cgi?id=225449 Reviewed by Sam Weinig. Update AudioWorkletGlobalScope::createProcessor() to validate the type of the processor after constructing it. * Modules/webaudio/AudioWorkletGlobalScope.cpp: (WebCore::AudioWorkletGlobalScope::createProcessor): 2021-05-06 Philippe Normand [WebAudio][GStreamer] socketpair leaks https://bugs.webkit.org/show_bug.cgi?id=225463 Reviewed by Žan Doberšek. * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp: (WebCore::AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer): Properly dispose of the GStreamer pipeline and the resources it has hold on. * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp: (webKitWebAudioSrcChangeState): The ref returned by gst_buffer_pool_new() is transfer-full, so we need to adopt it here. 2021-05-06 Philippe Normand [GStreamer] Fallback to texture mapper video orientation handling when glvideoflip is not available https://bugs.webkit.org/show_bug.cgi?id=225454 Reviewed by Xabier Rodriguez-Calvar. r275412 introduced a new runtime dependency on gst-plugins-good's glvideoflip element, which is not desirable for the 2.32 branch. This patch let's the player handle rotation tags if the glvideoflip element wasn't found at runtime. Ideally we should probably not rely on glvideoflip in the first place as it might induce a performance impact, to be handled in a follow-up patch. * platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp: (webKitGLVideoSinkConstructed): (webKitGLVideoSinkGetProperty): (webkit_gl_video_sink_class_init): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::createVideoSinkGL): 2021-05-05 Carlos Garcia Campos [SOUP] Wrong cookie timestamp in case of long expire time https://bugs.webkit.org/show_bug.cgi?id=225389 Reviewed by Adrian Perez de Castro. There's an overflow when converting the dates in both libsoup2 and libsoup3, but for two different reasons. In the case of libsoup2 we are using an int for the conversion of milliseconds to seconds which is not enough. In the case of libsoup3 we are passing the value in milliseconds to g_date_time_new_from_unix_utc() that expects seconds. * platform/network/soup/CookieSoup.cpp: (WebCore::msToSoupDate): Use int64_t instead of int for the cast. (WebCore::Cookie::toSoupCookie const): Convert the value to seconds. 2021-04-22 Carlos Garcia Campos [GTK][WPE] Bump libsoup3 version to 2.99.4 https://bugs.webkit.org/show_bug.cgi?id=224925 Reviewed by Philippe Normand. Update to use the new API. * platform/network/soup/ResourceResponseSoup.cpp: (WebCore::ResourceResponse::ResourceResponse): * platform/network/soup/SoupVersioning.h: (soup_message_get_tls_peer_certificate): (soup_message_get_tls_peer_certificate_errors): (soup_message_get_tls_certificate): Deleted. (soup_message_get_tls_certificate_errors): Deleted. 2021-04-09 Carlos Garcia Campos [GTK][WPE] Bump libsoup3 version to 2.99.3 https://bugs.webkit.org/show_bug.cgi?id=224362 Reviewed by Žan Doberšek. * platform/network/soup/GUniquePtrSoup.h: * platform/network/soup/ResourceResponseSoup.cpp: (WebCore::ResourceResponse::platformSuggestedFilename const): 2021-05-03 Philippe Normand [GTK] Build with VIDEO=OFF fails https://bugs.webkit.org/show_bug.cgi?id=225316 Reviewed by Adrian Perez de Castro. * platform/audio/PlatformMediaSession.cpp: (WebCore::isPlayingAudio): Guard against invalid media types, when video is disabled we can safely return false here as well. * platform/graphics/opengl/GraphicsContextGLOpenGL.h: Include what we use (UniqueRef). 2021-04-16 Basuke Suzuki [PlayStation][OpenSSL] Remove warnings. https://bugs.webkit.org/show_bug.cgi?id=224630 Reviewed by Don Olmstead. There're two kinds of warnings in curl and openssl layer in our platform. a) Unused param b) '__WORDSIZE' is not defined. warning: '__WORDSIZE' is not defined, evaluates to 0 [-Wundef] #if __WORDSIZE >= 64 ^ No new tests because it's only for compilation issue. * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp: (WebCore::CryptoAlgorithmAES_GCM::encrypt): (WebCore::CryptoAlgorithmAES_GCM::decrypt): * crypto/openssl/CryptoKeyECOpenSSL.cpp: (WebCore::CryptoKeyEC::platformGeneratePair): (WebCore::CryptoKeyEC::platformImportRaw): (WebCore::CryptoKeyEC::platformImportJWKPublic): (WebCore::CryptoKeyEC::platformImportJWKPrivate): (WebCore::CryptoKeyEC::platformImportSpki): (WebCore::CryptoKeyEC::platformImportPkcs8): * crypto/openssl/CryptoKeyRSAOpenSSL.cpp: (WebCore::CryptoKeyRSA::create): (WebCore::CryptoKeyRSA::generatePair): (WebCore::CryptoKeyRSA::importSpki): (WebCore::CryptoKeyRSA::importPkcs8): 2021-04-16 Basuke Suzuki Use WebKit macro to detect 64bit in RenderLayerBacking.h https://bugs.webkit.org/show_bug.cgi?id=224707 Reviewed by Yusuke Suzuki. There's no definition of __WORDSIZE in some environment. Also there's WebKit macro for that. > warning: '__WORDSIZE' is not defined, evaluates to 0 [-Wundef] > #if __WORDSIZE == 64 && PLATFORM(COCOA) > ^ No test because it's compiler behavior. * rendering/RenderLayerBacking.h: 2021-04-22 Sergio Villar Senin Do not set synchronous scrolling for layers without relevant scrolling scopes https://bugs.webkit.org/show_bug.cgi?id=221383 Reviewed by Simon Fraser. Fixed backgrounds could force the layer compositor to set synchronous scrolling because they're slow to repaint. However that cannot be done if the layer's boxScrollingScope hasn't been previously updated in RenderLayer::updateLayerPosition. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateSynchronousScrollingNodes): Do not call setSynchronousScrollingReasons() if there is no scrollingScope. 2021-04-22 Alejandro G. Castro REGRESSION(r275790) [GTK][WPE] Scrolling rendering fails after the second page https://bugs.webkit.org/show_bug.cgi?id=224824 Reviewed by Simon Fraser. We are making the implementation more similar to the Apple scrolling coordinator. Now we reimplement willStartRenderingUpdate to be able to synchronize the state there. That way we can avoid the timer and just schedule a rendering update when we want to commit the tree state. Test: Fixes the timeout of the overflow-scrollable-after-back.html, added in the regression. * page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp: (WebCore::ScrollingCoordinatorNicosia::ScrollingCoordinatorNicosia): (WebCore::ScrollingCoordinatorNicosia::pageDestroyed): (WebCore::ScrollingCoordinatorNicosia::commitTreeStateIfNeeded): (WebCore::ScrollingCoordinatorNicosia::scheduleTreeStateCommit): (WebCore::ScrollingCoordinatorNicosia::willStartRenderingUpdate): (WebCore::ScrollingCoordinatorNicosia::commitTreeState): Deleted. * page/scrolling/nicosia/ScrollingCoordinatorNicosia.h: 2021-04-09 Simon Fraser scrollingTreeNodeDidScroll() should just trigger a rendering udpate https://bugs.webkit.org/show_bug.cgi?id=224394 Reviewed by Tim Horton. After handling wheel events on the scrolling thread, ThreadedScrollingTree::scrollingTreeNodeDidScroll() appends to a queue of pending updates and then triggers applyPendingScrollUpdates() on the main thread to process those updates. However, every rendering update also processes pending scroll updates via synchronizeStateFromScrollingTree(), so it's simpler if we just trigger a rendering update. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::scrollingThreadAddedPendingUpdate): (WebCore::AsyncScrollingCoordinator::scheduleRenderingUpdate): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::scheduleTreeStateCommit): * page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp: (WebCore::ScrollingCoordinatorNicosia::scheduleTreeStateCommit): 2021-04-06 Mike Gorse Build fails when video is disabled https://bugs.webkit.org/show_bug.cgi?id=224198 Reviewed by Adrian Perez de Castro. Add #if ENABLE(VIDEO) where needed. * editing/markup.cpp: (WebCore::createPageForSanitizingWebContent): * page/Page.cpp: * page/Page.h: * platform/graphics/GraphicsContext.cpp: * platform/graphics/GraphicsContext.h: * platform/graphics/GraphicsContextGL.h: * platform/graphics/GraphicsContextImpl.h: * platform/graphics/cairo/GraphicsContextImplCairo.cpp: * platform/graphics/cairo/GraphicsContextImplCairo.h: * platform/graphics/displaylists/DisplayList.cpp: (WebCore::DisplayList::DisplayList::append): * platform/graphics/displaylists/DisplayListItemBuffer.cpp: (WebCore::DisplayList::ItemHandle::apply): (WebCore::DisplayList::ItemHandle::destroy): (WebCore::DisplayList::ItemHandle::safeCopy const): * platform/graphics/displaylists/DisplayListItemType.cpp: (WebCore::DisplayList::sizeOfItemInBytes): (WebCore::DisplayList::isDrawingItem): (WebCore::DisplayList::isInlineItem): * platform/graphics/displaylists/DisplayListItemType.h: * platform/graphics/displaylists/DisplayListItems.cpp: (WebCore::DisplayList::operator<<): * platform/graphics/displaylists/DisplayListItems.h: * platform/graphics/displaylists/DisplayListRecorder.cpp: * platform/graphics/displaylists/DisplayListRecorder.h: * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp: * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h: * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp: * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/win/GraphicsContextImplDirect2D.cpp: * platform/graphics/win/GraphicsContextImplDirect2D.h: * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::dataChanged): 2021-03-28 Philippe Normand REGRESSION(r274527): [GStreamer] media/webaudio-background-playback.html now failing https://bugs.webkit.org/show_bug.cgi?id=223840 Reviewed by Chris Dumez. r274527 actually exposed a bug that was present since r271197. The AudioDestination pipeline was not stopping properly because webkitGstSetElementStateSynchronously() was returning too early. This patch also includes a few improvements in the webaudiosrc element, most notably regarding its preroll state. The element now stops emitting buffers downstream as soon as the AudioDestination is scheduled to stop. * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp: (webKitWebAudioSrcRenderAndPushFrames): Return early as soon as the destination is scheduled to stop. (webKitWebAudioSrcChangeState): Synchronize preroll state with element state. * platform/graphics/gstreamer/GStreamerCommon.cpp: (WebCore::webkitGstSetElementStateSynchronously): targetState might be lower than current state, e.g, when stopping a running pipeline, so we can't return early for those cases, otherwise the pipeline won't stop. 2021-04-07 Philippe Normand [GStreamer] Videos start playing muted in epiphany with no unmute icon visible in tab, webkit_web_view_get_is_muted() returns incorrect results https://bugs.webkit.org/show_bug.cgi?id=223195 Reviewed by Eric Carlson. For GStreamer ports the semantics of IsPlayingAudio slightly differ from Apple ports. The webkit_web_view_is_playing_audio() API is expected to return true if a page is producing audio even though it might be muted. The second change affects the private player mute state when the page mute state has been updated. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaState const): (WebCore::HTMLMediaElement::pageMutedStateDidChange): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: Logging improvements. (WebCore::MediaPlayerPrivateGStreamer::isMuted const): (WebCore::MediaPlayerPrivateGStreamer::volume const): (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVolumeChange): (WebCore::MediaPlayerPrivateGStreamer::setMuted): (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfMute): 2021-04-06 Philippe Normand REGRESSION(r274358) [GStreamer] http/tests/images/mp4-partial-load.html is flaky crashing inside GStreamer https://bugs.webkit.org/show_bug.cgi?id=223636 Reviewed by Carlos Alberto Lopez Perez. Ensure the GStreamer messages are always processed synchronously, even when the handler is called from another thread. Without blocking in the latter case, the select-streams event might be sent to decodebin too late. It has to be sent as a synchronous reaction to the stream-collection message. * platform/graphics/gstreamer/ImageDecoderGStreamer.cpp: (WebCore::ImageDecoderGStreamer::InnerDecoder::handleMessage): (WebCore::ImageDecoderGStreamer::InnerDecoder::preparePipeline): * platform/graphics/gstreamer/ImageDecoderGStreamer.h: 2021-04-29 Adrian Perez de Castro Unreviewed build fix after r276749 * Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp: (WebCore::copyBusData): Remove usage of DisableMallocRestrictionsForCurrentThreadScope guard, which is a type not available in the 2.32 release branch. 2021-04-06 Philippe Normand [GStreamer][WebRTC] Audio is not played from an audio element when the srcObject object has unstarted video tracks https://bugs.webkit.org/show_bug.cgi?id=209163 Reviewed by Xabier Rodriguez-Calvar. Ensure no MediaStream (active) video tracks can be added in a pipeline representing an