2021-09-08 Fujii Hironori KeyboardEvent should setDefaultHandled if EventHandler::startKeyboardScrolling returns true https://bugs.webkit.org/show_bug.cgi?id=229784 Reviewed by Darin Adler. If a KeyboardEvent is handled by the default event handler, it should be marked by Event::setDefaultHandled. Test: fast/scrolling/keyboard-scrolling-last-timestamp.html * page/EventHandler.cpp: (WebCore::EventHandler::defaultKeyboardEventHandler): (WebCore::EventHandler::defaultArrowEventHandler): 2021-09-01 Fujii Hironori REGRESSION(r280928) The smooth keyboard scrolling is unconditionally enabled for PageUp and PageDown keys https://bugs.webkit.org/show_bug.cgi?id=229733 Reviewed by Tim Horton. Even though WinCairo port doesn't enable EventHandlerDrivenSmoothKeyboardScrollingEnabled yet, it had been enabled only for PageUp and PageDown keys since r280928. Other keys (Space and Arrow keys) don't trigger the smooth scrolling. r280928 changed to call startKeyboardScrolling for PageUp and PageDown keys, but it didn't check the setting. * page/EventHandler.cpp: (WebCore::EventHandler::startKeyboardScrolling): (WebCore::EventHandler::defaultKeyboardEventHandler): 2021-10-26 Adrian Perez de Castro Multiple build issues with ENABLE_VIDEO=OFF https://bugs.webkit.org/show_bug.cgi?id=232264 Reviewed by Carlos Garcia Campos. No new tests needed. * accessibility/AXObjectCache.cpp: (WebCore::isSimpleImage): Guard usage of HTMLMediaElement with ENABLE(VIDEO). * platform/graphics/BifurcatedGraphicsContext.cpp: Ditto. 2021-10-15 Michael Catanzaro [WPE][GTK] Update user agent browser versions https://bugs.webkit.org/show_bug.cgi?id=231772 Reviewed by Carlos Garcia Campos. * platform/UserAgentQuirks.cpp: (WebCore::UserAgentQuirks::stringForQuirk): * platform/glib/UserAgentGLib.cpp: (WebCore::buildUserAgentString): 2021-10-13 Philippe Normand [GStreamer] Crash in WebCore::MediaPlayerPrivateGStreamer::sourceSetup when loading reddit video https://bugs.webkit.org/show_bug.cgi?id=231519 Reviewed by Xabier Rodriguez-Calvar. Since this GStreamer commit: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/commit/52bca104e447309898ca8904b3914211ec7d4114 and starting from GStreamer 1.20, the playbin::source-setup signal is emitted before the source element is added to the pipeline, so this gave us the opportunity to refactor our code handling the downloadbuffer configuration, using the existing deep-element-added signal handler. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): (WebCore::MediaPlayerPrivateGStreamer::sourceSetup): (WebCore::MediaPlayerPrivateGStreamer::configureDownloadBuffer): (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): (WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback): Deleted. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: 2021-09-15 Carlos Garcia Campos Fix size calculation in ImageBufferCairoImageSurfaceBackend::create() https://bugs.webkit.org/show_bug.cgi?id=229365 Reviewed by Don Olmstead. * platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp: (WebCore::ImageBufferCairoImageSurfaceBackend::calculateSafeBackendSize): Check the result of cairo_format_stride_for_width() and the multiplication doesn't overflow. (WebCore::ImageBufferCairoImageSurfaceBackend::create): Use tryFastCalloc() instead of tryFastZeroedMalloc(). 2021-09-07 Adrian Perez de Castro Fix non-unified builds Unreviewed non-unified build fixes. * workers/Worker.h: Add missing wtf/Deque.h header. 2021-09-01 Myles C. Maxfield CSSFontFaceSet.clear() should not clear CSS-connected members https://bugs.webkit.org/show_bug.cgi?id=229643 Reviewed by Darin Adler. The spec https://drafts.csswg.org/css-font-loading-3/#dom-fontfaceset-clear says: > Remove all non-CSS-connected items * css/CSSFontFaceSet.h: * css/FontFaceSet.cpp: (WebCore::FontFaceSet::clear): 2021-08-13 Sergio Villar Senin [css-flexbox] Add initial support for css-align-3 positional alignment properties https://bugs.webkit.org/show_bug.cgi?id=229074 Reviewed by Simon Fraser. Added initial support for Start and End positional alignment properties from https://drafts.csswg.org/css-align-3/#positional-values. These two properties align the flex item to be flush with the alignment container's (the flex container) start and end edges in the appropriate axis. * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::isColumnOrRowReverse const): New method. (WebCore::initialJustifyContentOffset): Handle Start and End. (WebCore::alignmentOffset): Ditto. (WebCore::RenderFlexibleBox::staticMainAxisPositionForPositionedChild): (WebCore::RenderFlexibleBox::alignmentForChild const): (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): (WebCore::RenderFlexibleBox::layoutColumnReverse): (WebCore::initialAlignContentOffset): Handle Start and End. (WebCore::RenderFlexibleBox::alignFlexLines): * rendering/RenderFlexibleBox.h: 2021-09-01 Said Abou-Hallawa [GPU Process](REGRESSION): A detached canvas leaks all the images it draws https://bugs.webkit.org/show_bug.cgi?id=229668 Reviewed by Simon Fraser. Before drawing the canvas to the page, the canvas element may need to prepare its context for display. For 2D canvas elements, this should happen regardless whether they are attached to the Document or not. Because prepareForDisplay() calls ImageBuffer::flushDrawingContextAsync(), this will ensure the canvas drawing commands are pushed from WebProcess to GPUProcess. It will also release the cached shared images from both WebProcess and GPUProcess. Move the decision to skip the context prepareForDisplay() step from Document::prepareCanvasesForDisplayIfNeeded() to WebGLRenderingContextBase::prepareForDisplay(). * dom/Document.cpp: (WebCore::Document::prepareCanvasesForDisplayIfNeeded): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::prepareForDisplay): 2021-08-31 Lauro Moura Non-unified build partial fixes, late late August 2021 https://bugs.webkit.org/show_bug.cgi?id=229741 Unreviewed non-unified build fixes. Still missing a strange WebCoreTestSupport.a-related link error. * Modules/mediastream/RTCIceTransportBackend.h: Add missing header. * Modules/mediastream/RTCPeerConnection.cpp: Ditto. * Modules/mediastream/libwebrtc/LibWebRTCIceTransportBackend.cpp: Ditto. * html/FormController.cpp: (WebCore::formSignature): Namespace HTMLNames. * html/FormController.h: Add missing header. * html/track/LoadableTextTrack.cpp: Add missing header. * loader/PrivateClickMeasurement.cpp: Ditto. * page/PageConfiguration.cpp: Ditto. 2021-08-31 Chris Dumez Enable SharedArrayBuffer support when COOP/COEP headers are used https://bugs.webkit.org/show_bug.cgi?id=229559 Reviewed by Alex Christensen. Make sure window.crossOriginIsolated returns true when COOP=same-origin and COEP=require-corp are used. Also make sure that cross-origin-isolates pages are allowed to use SharedArrayBuffer. Change is covered by rebaselined layout tests and new API tests. * loader/DocumentLoader.cpp: (WebCore::toNeedsBrowsingContextGroupSwitch): (WebCore::DocumentLoader::responseReceived): * loader/EmptyClients.cpp: (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForResponse): * loader/EmptyFrameLoaderClient.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::checkContentPolicy): * loader/FrameLoader.h: * loader/FrameLoaderClient.h: * loader/FrameLoaderTypes.h: * page/DOMWindow.cpp: (WebCore::DOMWindow::crossOriginIsolated const): * page/DOMWindow.idl: 2021-08-31 Kate Cheney Use after move in ServiceWorkerThreadProxy https://bugs.webkit.org/show_bug.cgi?id=229731 Reviewed by Chris Dumez. * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy): 2021-08-31 Marcos Caceres [Payment Request] Calling PaymentRequest's show() should consume user activation https://bugs.webkit.org/show_bug.cgi?id=217365 Reviewed by Youenn Fablet and Devin Rousso. Tested by existing WPT tests. * Modules/paymentrequest/PaymentRequest.cpp: (WebCore::PaymentRequest::show): 2021-08-31 Thibault Saunier [GStreamer] Fix deadlock tearing down pipeline when using fallback sink https://bugs.webkit.org/show_bug.cgi?id=229619 Reviewed by Xabier Rodriguez-Calvar. Whenever GstGL is disabled for whatever reason the fallback sink might be used and cancelling repaint need to be taken into account in any case. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::cancelRepaint): 2021-08-31 Sihui Liu REGRESSION (r281771): ASSERTION FAILED: !m_deletionHasBegun under WebCore::Permissions::~Permissions() https://bugs.webkit.org/show_bug.cgi?id=229714 Reviewed by Chris Dumez. PageConfiguration should hold Ref instead of UniqueRef. * Modules/permissions/PermissionController.h: * loader/EmptyClients.cpp: (WebCore::pageConfigurationWithEmptyClients): * page/Page.h: * page/PageConfiguration.cpp: (WebCore::PageConfiguration::PageConfiguration): * page/PageConfiguration.h: 2021-08-31 Kate Cheney Loads after session restore marked app initiated in Safari https://bugs.webkit.org/show_bug.cgi?id=229721 Reviewed by Brent Fulgham. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadDifferentDocumentItem): Set the proper app initiated value when creating a new request. 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-31 Ross Kirsling Unreviewed build fix for PlayStation following r241123. * css/typedom/CSSStyleValue.h: Add missing include. 2021-08-31 Johnson Zhou Addition of CSSUnparsedValue. (TypedOM) https://bugs.webkit.org/show_bug.cgi?id=229069 Reviewed by Darin Adler. * css/typedom/CSSOMVariableReferenceValue.cpp: 2021-08-31 Chris Dumez Implement self.structuredClone() https://bugs.webkit.org/show_bug.cgi?id=228331 Reviewed by Ryosuke Niwa. Implement self.structuredClone() as per: - https://html.spec.whatwg.org/#dom-structuredclone Tests: imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.html imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.worker.html * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/MessagePort.cpp: (WebCore::MessagePort::postMessage): * dom/MessagePort.h: * dom/MessagePort.idl: * page/Base64Utilities.h: * page/DOMWindow.h: (WebCore::WindowPostMessageOptions::WindowPostMessageOptions): * page/DOMWindow.idl: * page/StructuredSerializeOptions.h: Renamed from Source/WebCore/page/PostMessageOptions.h. (WebCore::StructuredSerializeOptions::StructuredSerializeOptions): * page/StructuredSerializeOptions.idl: Renamed from Source/WebCore/page/PostMessageOptions.idl. * page/WindowOrWorkerGlobalScope.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerClient.h. (WebCore::WindowOrWorkerGlobalScope::reportError): (WebCore::WindowOrWorkerGlobalScope::structuredClone): * page/WindowOrWorkerGlobalScope.h: Copied from Source/WebCore/page/Base64Utilities.h. (WebCore::WindowOrWorkerGlobalScope::structuredClone): * page/WindowOrWorkerGlobalScope.idl: * workers/DedicatedWorkerGlobalScope.cpp: (WebCore::DedicatedWorkerGlobalScope::postMessage): * workers/DedicatedWorkerGlobalScope.h: * workers/DedicatedWorkerGlobalScope.idl: * workers/Worker.cpp: (WebCore::Worker::postMessage): * workers/Worker.h: * workers/Worker.idl: * workers/WorkerGlobalScope.h: * workers/service/ServiceWorker.cpp: (WebCore::ServiceWorker::postMessage): * workers/service/ServiceWorker.h: * workers/service/ServiceWorker.idl: * workers/service/ServiceWorkerClient.cpp: (WebCore::ServiceWorkerClient::postMessage): * workers/service/ServiceWorkerClient.h: * workers/service/ServiceWorkerClient.idl: 2021-08-31 Alan Bujtas [LFC][Integration] Remove unused LayoutIntegation::Run functions https://bugs.webkit.org/show_bug.cgi?id=229711 Reviewed by Antti Koivisto. * layout/integration/LayoutIntegrationRun.h: (WebCore::LayoutIntegration::Run::image const): Deleted. (WebCore::LayoutIntegration::Run::hasUnderlyingLayout const): Deleted. * layout/integration/LayoutIntegrationRunIteratorModernPath.h: (WebCore::LayoutIntegration::RunIteratorModernPath::atEnd const): 2021-08-31 Alan Bujtas [IFC][Integration] Move integral vertical position adjustment over to createDisplayLines https://bugs.webkit.org/show_bug.cgi?id=229679 Reviewed by Antti Koivisto. This is in preparation for not constructing text runs in InlineContentBuilder::createDisplayLineRuns. * layout/integration/LayoutIntegrationInlineContentBuilder.cpp: (WebCore::LayoutIntegration::InlineContentBuilder::build const): (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLineRuns const): (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const): * layout/integration/LayoutIntegrationInlineContentBuilder.h: * layout/integration/LayoutIntegrationLine.h: (WebCore::LayoutIntegration::NonRootInlineBox::setVerticalPositionIntegral): * layout/integration/LayoutIntegrationRun.h: (WebCore::LayoutIntegration::Run::setVerticalPositionIntegral): 2021-08-31 Chris Dumez [COOP] html/cross-origin-opener-policy/coop-same-origin-allow-popups-document-write.html WPT test is failing https://bugs.webkit.org/show_bug.cgi?id=229692 Reviewed by Darin Adler. The test does the following: 1. An opener document with `COOP=same-origin-allow-popups` opens a new window that shows the initial empty document. Note that the openee inherits `COOP=same-origin-allow-popups` from its opener. 2. The opener document then calls document.write() on the openee. Note that, as per the HTML specification, this clears the 'is displaying initial empty document' flag. 3. The openee is navigated cross-origin to a destination without COOP. Normally, `COOP=same-origin-allow-popups` would allow the popup to be navigated cross-origin as per the logic here [1]: """ If all of the following are true: - isInitialAboutBlank, - activeDocumentCOOPValue's value is "same-origin-allow-popups". - responseCOOPValue is "unsafe-none", then return false (meaning, no context group switch). """ However, because of the document.write() call at step 2, the isInitialAboutBlank flag is no longer true and the check should fail, thus causing a browsing context group switch. [1] https://html.spec.whatwg.org/multipage/origin.html#check-browsing-context-group-switch-coop-value No new tests, rebaselined existing test. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::maybeLoadEmpty): Replace the bad check to committedFirstRealDocumentLoad (which stays true after calling document.write() on the initial empty document) with a check to !isDisplayingInitialEmptyDocument, which matches the specification text. isDisplayingInitialEmptyDocument correctly becomes false after calling document.write() on the initial empty document. * loader/DocumentLoader.h: (WebCore::DocumentLoader::crossOriginOpenerPolicy const): * loader/FrameLoader.cpp: (WebCore::FrameLoader::didBeginDocument): Fix didBeginDocument() so that it doesn't overwrite the document's cross-origin-opener-policy when the DocumentLoader does not know what the policy is. When opening a popup, Document::initSecurityContext() will set the popup's cross-origin-opener-policy to the one of its opener. When didBeginDocument() gets called later for the initial empty document, we don't want to overwrite the inherited policy with a new default cross-origin-opener-policy of unsafe-none. The reason the DocumentLoader does not have a policy for us is because this is the initial empty document and DocumentLoader's doCrossOriginOpenerHandlingOfResponse() was thus never called with an actual network response. 2021-08-31 Carlos Garcia Campos [SOUP] Assertion in startObservingCookieChanges() https://bugs.webkit.org/show_bug.cgi?id=229708 Reviewed by Philippe Normand. Add an implementation for startObservingCookieChanges() and stopObservingCookieChanges() setting the cookies observer callback on the given storage session. * platform/network/CookieStorage.h: * platform/network/cf/CookieStorageCFNet.cpp: (WebCore::startObservingCookieChanges): (WebCore::stopObservingCookieChanges): * platform/network/curl/CookieStorageCurl.cpp: (WebCore::startObservingCookieChanges): (WebCore::stopObservingCookieChanges): * platform/network/mac/CookieStorageMac.mm: (WebCore::startObservingCookieChanges): (WebCore::stopObservingCookieChanges): * platform/network/soup/CookieStorageSoup.cpp: (WebCore::startObservingCookieChanges): (WebCore::stopObservingCookieChanges): 2021-08-31 Alan Bujtas [LFC][Integration] Make naming more consistent across Layout::Run and Integration::Run structs https://bugs.webkit.org/show_bug.cgi?id=229693 Reviewed by Antti Koivisto. This is in preparation for merging these 2 structs. * display/DisplayTreeBuilder.cpp: (WebCore::Display::TreeBuilder::buildInlineDisplayTree): * display/css/DisplayBoxFactory.cpp: (WebCore::Display::BoxFactory::displayBoxForTextRun const): * display/css/DisplayBoxFactory.h: * display/css/DisplayTextBox.cpp: (WebCore::Display::TextBox::TextBox): * display/css/DisplayTextBox.h: (WebCore::Display::TextBox::expansion const): (WebCore::Display::TextBox::text const): * layout/Verification.cpp: (WebCore::Layout::checkForMatchingNonTextRuns): (WebCore::Layout::checkForMatchingTextRuns): (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded): * layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp: (WebCore::Layout::InlineDisplayContentBuilder::build): (WebCore::Layout::InlineDisplayContentBuilder::createRunsAndUpdateGeometryForLineContent): (WebCore::Layout::InlineDisplayContentBuilder::createRunsAndUpdateGeometryForLineSpanningInlineBoxes): * layout/formattingContexts/inline/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::lineLayout): (WebCore::Layout::InlineFormattingContext::computeStaticPositionForOutOfFlowContent): * layout/formattingContexts/inline/InlineFormattingState.h: (WebCore::Layout::InlineFormattingState::runs const): (WebCore::Layout::InlineFormattingState::runs): (WebCore::Layout::InlineFormattingState::addRun): (WebCore::Layout::InlineFormattingState::clearLineAndRuns): (WebCore::Layout::InlineFormattingState::shrinkToFit): (WebCore::Layout::InlineFormattingState::lineRuns const): Deleted. (WebCore::Layout::InlineFormattingState::lineRuns): Deleted. (WebCore::Layout::InlineFormattingState::addLineRun): Deleted. * layout/formattingContexts/inline/InlineLine.h: (WebCore::Layout::Line::Run::expansion const): (WebCore::Layout::Line::Run::setExpansion): * layout/formattingContexts/inline/InlineLineRun.h: (WebCore::Layout::Run::style const): (WebCore::Layout::Run::Run): (WebCore::Layout::Run::Text::Text): (WebCore::Layout::LineRun::Text::start const): Deleted. (WebCore::Layout::LineRun::Text::end const): Deleted. (WebCore::Layout::LineRun::Text::length const): Deleted. (WebCore::Layout::LineRun::Text::originalContent const): Deleted. (WebCore::Layout::LineRun::Text::renderedContent const): Deleted. (WebCore::Layout::LineRun::Text::hasHyphen const): Deleted. (WebCore::Layout::LineRun::isText const): Deleted. (WebCore::Layout::LineRun::isSoftLineBreak const): Deleted. (WebCore::Layout::LineRun::isLineBreakBox const): Deleted. (WebCore::Layout::LineRun::isLineBreak const): Deleted. (WebCore::Layout::LineRun::isAtomicInlineLevelBox const): Deleted. (WebCore::Layout::LineRun::isInlineBox const): Deleted. (WebCore::Layout::LineRun::isNonRootInlineBox const): Deleted. (WebCore::Layout::LineRun::isRootInlineBox const): Deleted. (WebCore::Layout::LineRun::isGenericInlineLevelBox const): Deleted. (WebCore::Layout::LineRun::isInlineLevelBox const): Deleted. (WebCore::Layout::LineRun::isNonRootInlineLevelBox const): Deleted. (WebCore::Layout::LineRun::type const): Deleted. (WebCore::Layout::LineRun::hasContent const): Deleted. (WebCore::Layout::LineRun::isLineSpanning const): Deleted. (WebCore::Layout::LineRun::logicalRect const): Deleted. (WebCore::Layout::LineRun::inkOverflow const): Deleted. (WebCore::Layout::LineRun::logicalTop const): Deleted. (WebCore::Layout::LineRun::logicalBottom const): Deleted. (WebCore::Layout::LineRun::logicalLeft const): Deleted. (WebCore::Layout::LineRun::logicalRight const): Deleted. (WebCore::Layout::LineRun::logicalWidth const): Deleted. (WebCore::Layout::LineRun::logicalHeight const): Deleted. (WebCore::Layout::LineRun::moveVertically): Deleted. (WebCore::Layout::LineRun::text): Deleted. (WebCore::Layout::LineRun::text const): Deleted. (WebCore::Layout::LineRun::expansion const): Deleted. (WebCore::Layout::LineRun::layoutBox const): Deleted. (WebCore::Layout::LineRun::lineIndex const): Deleted. (WebCore::Layout::LineRun::LineRun): Deleted. (WebCore::Layout::LineRun::Text::Text): Deleted. * layout/formattingContexts/table/TableFormattingContext.cpp: (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells): * layout/integration/LayoutIntegrationInlineContent.cpp: (WebCore::LayoutIntegration::InlineContent::iteratorForTextRun const): * layout/integration/LayoutIntegrationInlineContentBuilder.cpp: (WebCore::LayoutIntegration::InlineContentBuilder::build const): (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayRuns const): (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const): (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLineRuns const): Deleted. * layout/integration/LayoutIntegrationInlineContentBuilder.h: * layout/integration/LayoutIntegrationLineLayout.cpp: (WebCore::LayoutIntegration::LineLayout::paint): (WebCore::LayoutIntegration::LineLayout::hitTest): (WebCore::LayoutIntegration::LineLayout::paintTextRunUsingPhysicalCoordinates): * layout/integration/LayoutIntegrationPagination.cpp: (WebCore::LayoutIntegration::makeAdjustedContent): * layout/integration/LayoutIntegrationRun.h: (WebCore::LayoutIntegration::Run::logicalRect const): (WebCore::LayoutIntegration::Run::text): (WebCore::LayoutIntegration::Run::text const): (WebCore::LayoutIntegration::Run::isLineBreak const): (WebCore::LayoutIntegration::Run::Run): (WebCore::LayoutIntegration::Run::Text::Text): (WebCore::LayoutIntegration::Run::TextContent::start const): Deleted. (WebCore::LayoutIntegration::Run::TextContent::end const): Deleted. (WebCore::LayoutIntegration::Run::TextContent::length const): Deleted. (WebCore::LayoutIntegration::Run::TextContent::originalContent const): Deleted. (WebCore::LayoutIntegration::Run::TextContent::renderedContent const): Deleted. (WebCore::LayoutIntegration::Run::TextContent::hasHyphen const): Deleted. (WebCore::LayoutIntegration::Run::rect const): Deleted. (WebCore::LayoutIntegration::Run::textContent): Deleted. (WebCore::LayoutIntegration::Run::textContent const): Deleted. (WebCore::LayoutIntegration::Run::TextContent::TextContent): Deleted. * layout/integration/LayoutIntegrationRunIteratorModernPath.h: (WebCore::LayoutIntegration::RunIteratorModernPath::isText const): (WebCore::LayoutIntegration::RunIteratorModernPath::rect const): (WebCore::LayoutIntegration::RunIteratorModernPath::hasHyphen const): (WebCore::LayoutIntegration::RunIteratorModernPath::text const): (WebCore::LayoutIntegration::RunIteratorModernPath::start const): (WebCore::LayoutIntegration::RunIteratorModernPath::end const): (WebCore::LayoutIntegration::RunIteratorModernPath::length const): (WebCore::LayoutIntegration::RunIteratorModernPath::traverseNextTextRun): * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::showInlineTreeAndRuns): 2021-08-31 Antti Koivisto [CSS Cascade Layers] Compute order correctly for late added sublayers https://bugs.webkit.org/show_bug.cgi?id=229666 Reviewed by Simon Fraser. In cases like @layer a.b { ... } @layer c { ... } @layer a.d { ... } 'c' should have higher priority than 'a.d'. Replace the per-RuleData layer order vector with references (indexes) to layer entry vector. These entries have order field that can be recomputed. * style/RuleSet.cpp: (WebCore::Style::RuleSet::addRule): (WebCore::Style::RuleSet::Builder::addStyleRule): (WebCore::Style::RuleSet::Builder::pushCascadeLayer): Instead of computing order directly we just give each layer an identifier and add an entry for it to the layer vector. (WebCore::Style::RuleSet::Builder::popCascadeLayer): (WebCore::Style::RuleSet::Builder::~Builder): Compute layer order after building for all layers. (WebCore::Style::RuleSet::shrinkToFit): * style/RuleSet.h: (WebCore::Style::RuleSet::cascadeLayerForIdentifier): (WebCore::Style::RuleSet::cascadeLayerForIdentifier const): (WebCore::Style::RuleSet::cascadeLayerOrderFor const): 2021-08-31 Philippe Normand Unreviewed, OpenXR build warning fix. * platform/xr/openxr/OpenXRInputMappings.h: 2021-08-31 Youenn Fablet Add support for RTCIceTransport https://bugs.webkit.org/show_bug.cgi?id=229285 Reviewed by Eric Carlson. Introduce RTCIceTransport as per spec. Reuse the same model as RTCDtlsTransport with a backend and RTCPeerConnection be responsible to reuse or create transports as needed. Covered by updated tests. * Modules/mediastream/RTCDtlsTransport.cpp: (WebCore::RTCDtlsTransport::RTCDtlsTransport): * Modules/mediastream/RTCDtlsTransport.h: * Modules/mediastream/RTCDtlsTransport.idl: * Modules/mediastream/RTCDtlsTransportBackend.h: * Modules/mediastream/RTCIceTransport.cpp: (WebCore::RTCIceTransport::RTCIceTransport): (WebCore::RTCIceTransport::~RTCIceTransport): (WebCore::RTCIceTransport::stop): (WebCore::RTCIceTransport::virtualHasPendingActivity const): (WebCore::RTCIceTransport::onStateChanged): (WebCore::RTCIceTransport::onGatheringStateChanged): * Modules/mediastream/RTCIceTransport.h: (WebCore::RTCIceTransport::create): (WebCore::RTCIceTransport::state const): (WebCore::RTCIceTransport::backend const): * Modules/mediastream/RTCIceTransport.idl: * Modules/mediastream/RTCIceTransportBackend.h: Added. (WebCore::operator==): * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::computeConnectionState): (WebCore::RTCPeerConnection::updateConnectionState): (WebCore::isIceTransportUsedByTransceiver): (WebCore::RTCPeerConnection::computeIceConnectionStateFromIceTransports): (WebCore::RTCPeerConnection::processIceTransportStateChange): (WebCore::RTCPeerConnection::getOrCreateIceTransport): (WebCore::RTCPeerConnection::getOrCreateDtlsTransport): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCDtlsTransportBackend.cpp: (WebCore::LibWebRTCDtlsTransportBackend::iceTransportBackend): * Modules/mediastream/libwebrtc/LibWebRTCDtlsTransportBackend.h: * Modules/mediastream/libwebrtc/LibWebRTCIceTransportBackend.cpp: Added. (WebCore::toRTCIceTransportState): (WebCore::toRTCIceGatheringState): (WebCore::LibWebRTCIceTransportBackendObserver::LibWebRTCIceTransportBackendObserver): (WebCore::LibWebRTCIceTransportBackendObserver::start): (WebCore::LibWebRTCIceTransportBackendObserver::stop): (WebCore::LibWebRTCIceTransportBackendObserver::onIceTransportStateChanged): (WebCore::LibWebRTCIceTransportBackendObserver::onGatheringStateChanged): (WebCore::LibWebRTCIceTransportBackend::LibWebRTCIceTransportBackend): (WebCore::LibWebRTCIceTransportBackend::~LibWebRTCIceTransportBackend): (WebCore::LibWebRTCIceTransportBackend::registerClient): (WebCore::LibWebRTCIceTransportBackend::unregisterClient): * Modules/mediastream/libwebrtc/LibWebRTCIceTransportBackend.h: Added. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::OnIceConnectionChange): * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/EventNames.h: * dom/EventTargetFactory.in: 2021-08-31 Rob Buis Nullptr crash in TypingCommand::willAddTypingToOpenCommand via TypingCommand::deleteKeyPressed https://bugs.webkit.org/show_bug.cgi?id=229277 Reviewed by Ryosuke Niwa. Rewtite CompositeEditCommand::shouldBreakOutOfEmptyListItem() to return just VisibleSelection and check that it is not none in TypingCommand::willAddTypingToOpenCommand. Test: editing/deleting/delete-key-crash.html * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::moveParagraphs): * editing/CompositeEditCommand.h: * editing/TypingCommand.cpp: (WebCore::TypingCommand::deleteKeyPressed): 2021-08-31 Ryosuke Niwa Re-generalize top layer element concept https://bugs.webkit.org/show_bug.cgi?id=229488 Reviewed by Antti Koivisto. r281548 made the concept of top layer is confined to dialog element to eliminate the runtime cost of making 5+ function calls and looking up the list hash set per removal of every element. This patch re-generalize this concept for all elements by introducing a new node flag to avoid the runtime cost so that we may use it in the future for the full screen element. No new tests since there should be no observable behavior changes. This patch also inverts the relationship between member functions in Element and Document to reduce the number of function calls involved by 1. * dom/Document.cpp: (Document::removedLastRef): Make sure the list of top layer elements is empty. (WebCore::Document::addTopLayerElement): Renamed from addToTopLayer. The code to update the layer has been moved to Element::addToTopLayer. Also release-time assert that the element is connected to this document. (WebCore::Document::removeTopLayerElement): Ditto. * dom/Document.h: * dom/Element.cpp: (WebCore::Element::removedFromAncestor): Call removeTopLayerElement if this element had a top layer. (WebCore::renderLayerForElement): Added. (WebCore::Element::addToTopLayer): Moved from Document. Set the node flag: IsInTopLayer. (WebCore::Element::removeFromTopLayer): Ditto, clear the node flag. (WebCore::Element::isInTopLayerWillChange): Deleted. (WebCore::Element::isInTopLayerDidChange): Deleted. * dom/Element.h: (WebCore::Element::isInTopLayer const): Rewritten to make use of new node flag. * dom/Node.h: (WebCore::NodeFlag): Added a new node flag: IsInTopLayer. * html/HTMLDialogElement.cpp: (WebCore::HTMLDialogElement::showModal): (WebCore::HTMLDialogElement::close): (WebCore::HTMLDialogElement::removedFromAncestor): Deleted. * html/HTMLDialogElement.h: 2021-08-26 Darin Adler Cut down on use of CFGetTypeID, using dynamic_cf_cast instead; related streamlining https://bugs.webkit.org/show_bug.cgi?id=229414 Reviewed by Tim Horton. * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: (WebCore::makeSimpleColorFromARGBCFArray): Use dynamic_cf_cast. (WebCore::InbandTextTrackPrivateAVF::processCueAttributes): Ditto. Also removed unnecessary type casts when comparing with kCFBooleanTrue. * platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.mm: Use dynamic_cf_cast. * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontCache::systemFontFamilies): Ditto. (WebCore::isUserInstalledFont): Use kCFBooleanTrue. * platform/graphics/cocoa/HEVCUtilitiesCocoa.mm: (WebCore::validateHEVCParameters): Use dynamic_cf_cast and kCFBooleanTrue. (WebCore::validateDoViParameters): Ditto. * platform/graphics/cocoa/WebCoreDecompressionSession.mm: (WebCore::WebCoreDecompressionSession::shouldDecodeSample): Use kCFBooleanFalse. * platform/graphics/coretext/FontPlatformDataCoreText.cpp: (WebCore::FontPlatformData::objectForEqualityCheck): Use auto. * platform/graphics/cv/GraphicsContextGLCVANGLE.cpp: (WebCore::transferFunctionFromString): Removed type check, which caller should do since the agument type is CFStringRef. (WebCore::GraphicsContextGLCVANGLE::copyPixelBufferToTexture): Use dynamic_cf_cast instead of an unchecked static_cast. * platform/ios/UserAgentIOS.mm: (WebCore::deviceNameForUserAgent): Improved efficiency by returning a StringView instead of a String, no need to create and destroy a string or churn the reference count each time this function is called. (WebCore::standardUserAgentWithApplicationName): Improved efficiency by using a better idiom for the space before the application name. Use dynamic_cf_cast. * platform/mediastream/mac/WindowDisplayCapturerMac.mm: (WebCore::anyOfCGWindow): Use kCFBooleanFalse. * platform/network/cf/ProxyServerCFNet.cpp: (WebCore::processProxyServers): Use dynamic_cf_cast. * platform/network/cf/ResourceRequestCFNet.cpp: Move WTF_DECLARE_CF_TYPE_TRAIT for CFURLRef out of here. * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::chooseProxyFromArray): Ditto. * platform/network/ios/WebCoreURLResponseIOS.h: Tweaked a bit. * platform/network/ios/WebCoreURLResponseIOS.mm: (WebCore::createExtensionToMIMETypeMap): Deleted. (WebCore::adjustMIMETypeIfNecessary): Simplified the code that maps ".mjs" to "text/javascript" to make it much more efficient and not use a dictionary. Refactored to share code with the Mac, via the WebCoreURLResponse.h/mm files, which are not macOS-specific even though they are in a directory named "mac". Fixed one place where we did adoptCF where it should be adoptNS. Use CFSTR("application/octet-stream") directly instead of using WebCore::defaultMIMEType(). * platform/network/mac/NetworkStateNotifierMac.cpp: (WebCore::NetworkStateNotifier::updateStateWithoutNotifying): Use dynamic_cf_cast. * platform/network/mac/UTIUtilities.h: Renamed MIMETypeFromUTITree to mimeTypeFromUTITree to make the style robot happy. Changed the argument and return type to CFStringRef since that's what the callers all want, and what the implementation uses, and there is no reason to convert back and forth to WTF::String. * platform/network/mac/UTIUtilities.mm: (WebCore::mimeTypeFromUTITree): Use nullptr, not emptyString(), for the value when there is no MIME type found. Use auto. Use dynamic_cf_cast. Make recursion more efficient since we don't keep converting back and forth between CFStringRef and WTF::String. (WebCore::UTIFromTag): Removed unneeded explicit converstion to WTF::String. * platform/network/mac/WebCoreURLResponse.h: Added helper functions to the header, shared by WebCoreURLResponse.mm and WebCoreURLResponseIOS.mm. Use CFSTR("application/octet-stream") directly instead of using WebCore::defaultMIMEType().6 * platform/network/mac/WebCoreURLResponse.mm: (WebCore::createExtensionToMIMETypeMap): Deleted. (WebCore::adjustMIMETypeIfNecessary): Refactored to use a SortedArrayMap instead of a CFDictionary, eliminating various type casts and conversions. Refactored to use the new functions below. Use makeNeverDestroyed to instead of RetainPtr::leakRef. Removed unnecessary check for equality since this function only does work when CFURLResponseGetMIMEType is nullptr. (WebCore::filePathExtension): Added. Refactored the code to get a path extension from a CFURLResponseRef into a function since it's used in two places. (WebCore::preferredMIMETypeForFileExtensionFromUTType): Added. Refactored this logical operation, mapping a file extension to a MIME type, into a function. This is used in two places. Also puts ALLOW_DEPRECATED_DECLARATIONS_BEGIN/END pair into a single place, and this is where we'll switch to use newer UTType machinery later on. * testing/cocoa/WebArchiveDumpSupport.mm: (WebCoreTestSupport::convertWebResourceResponseToDictionary): Use auto and dynamic_cf_cast. 2021-08-30 Patrick Angle Web Inspector: Refactor `WorkerInspectorAgent` to use weak pointers for `WorkerInspectorProxy`s https://bugs.webkit.org/show_bug.cgi?id=229632 Reviewed by Chris Dumez. Covered by existing tests in LayoutTests/inspector/worker/* Make `WorkerInspectorProxy` reference counted, and use `WeakPtr`s to them in `InspectorWorkerAgent`. * inspector/agents/InspectorWorkerAgent.cpp: (WebCore::InspectorWorkerAgent::initialized): (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): * inspector/agents/InspectorWorkerAgent.h: * workers/WorkerInspectorProxy.cpp: (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): * workers/WorkerInspectorProxy.h: (WebCore::WorkerInspectorProxy::create): * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): * workers/WorkerMessagingProxy.h: 2021-08-30 Johnson Zhou Addition of CSSUnparsedValue. (TypedOM) https://bugs.webkit.org/show_bug.cgi?id=229069 Reviewed by Alex Christensen. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSCSSStyleValueCustom.cpp: (WebCore::toJSNewlyCreated): * bindings/js/WebCoreBuiltinNames.h: * css/typedom/CSSNumericValue.h: (WebCore::CSSNumericValue::getType const): * css/typedom/CSSOMVariableReferenceValue.cpp: Copied from Source/WebCore/css/typedom/CSSUnparsedValue.cpp. (WebCore::CSSOMVariableReferenceValue::create): (WebCore::CSSOMVariableReferenceValue::setVariable): (WebCore::CSSOMVariableReferenceValue::toString const): * css/typedom/CSSOMVariableReferenceValue.h: Copied from Source/WebCore/css/typedom/CSSUnparsedValue.h. * css/typedom/CSSOMVariableReferenceValue.idl: Copied from Source/WebCore/css/typedom/CSSStyleValue.idl. * css/typedom/CSSStyleImageValue.cpp: (WebCore::CSSStyleImageValue::CSSStyleImageValue): * css/typedom/CSSStyleImageValue.h: * css/typedom/CSSStyleValue.cpp: (WebCore::CSSStyleValue::parseStyleValue): (WebCore::CSSStyleValue::parse): (WebCore::CSSStyleValue::parseAll): (WebCore::CSSStyleValue::create): (WebCore::CSSStyleValue::CSSStyleValue): (WebCore::CSSStyleValue::reifyValue): (WebCore::CSSStyleValue::toString const): * css/typedom/CSSStyleValue.h: (WebCore::CSSStyleValue::getType const): (WebCore::CSSStyleValue::isUnitValue): Deleted. (WebCore::CSSStyleValue::isUnparsedValue): Deleted. (WebCore::CSSStyleValue::isImageValue): Deleted. * css/typedom/CSSStyleValue.idl: * css/typedom/CSSUnitValue.h: * css/typedom/CSSUnparsedValue.cpp: (WebCore::CSSUnparsedValue::create): (WebCore::CSSUnparsedValue::CSSUnparsedValue): (WebCore::CSSUnparsedValue::toString const): (WebCore::CSSUnparsedValue::item): (WebCore::CSSUnparsedValue::setItem): * css/typedom/CSSUnparsedValue.h: (WebCore::CSSUnparsedValue::length const): (isType): * css/typedom/CSSUnparsedValue.idl: * css/typedom/StylePropertyMapReadOnly.cpp: (WebCore::StylePropertyMapReadOnly::reifyValue): (WebCore::StylePropertyMapReadOnly::customPropertyValueOrDefault): * css/typedom/StylePropertyMapReadOnly.h: * dom/StyledElement.cpp: * html/CustomPaintImage.cpp: (WebCore::extractComputedProperty): 2021-08-30 Kiet Ho Remove hardcoded CSSUnitType enum values https://bugs.webkit.org/show_bug.cgi?id=229672 Reviewed by Simon Fraser. * css/CSSPrimitiveValue.h: (WebCore::CSSPrimitiveValue::isFontIndependentLength): (WebCore::CSSPrimitiveValue::isLength): (WebCore::CSSPrimitiveValue::isResolution): (WebCore::CSSPrimitiveValue::isViewportPercentageLength): * css/CSSUnits.h: 2021-08-30 Jer Noble Fix include guards in PlatformScreenMac.mm https://bugs.webkit.org/show_bug.cgi?id=229430 Reviewed by Alex Christensen. The include guards should refer to the file they're including. * platform/mac/PlatformScreenMac.mm: 2021-08-30 Alex Christensen WKWebViewConfiguration._loadsSubresources=NO should prevent preconnecting https://bugs.webkit.org/show_bug.cgi?id=229684 Reviewed by Tim Horton. * Modules/websockets/ThreadableWebSocketChannel.cpp: (WebCore::ThreadableWebSocketChannel::validateURL): * loader/ResourceLoadNotifier.cpp: (WebCore::ResourceLoadNotifier::dispatchWillSendRequest): * page/Page.cpp: (WebCore::Page::allowsLoadFromURL const): * page/Page.h: (WebCore::Page::loadsSubresources const): Deleted. 2021-08-30 Lauro Moura [LFC][IFC] Remove unused variables after r281744 https://bugs.webkit.org/show_bug.cgi?id=229677 Reviewed by Darin Adler. Silence compiler warnings. Covered by existing tests. * display/css/DisplayBoxFactory.cpp: (WebCore::Display::BoxFactory::displayBoxForTextRun const): 2021-08-30 Sihui Liu Add stubs for Permissions API https://bugs.webkit.org/show_bug.cgi?id=229339 Reviewed by Chris Dumez. Add bindings code and a feature flag for Permissions API. Spec: https://w3c.github.io/permissions/ No new tests. Rebaseline existing tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Headers.cmake: * Modules/permissions/Navigator+Permissions.idl: Added. * Modules/permissions/NavigatorPermissions.cpp: Added. (WebCore::NavigatorPermissions::NavigatorPermissions): (WebCore::NavigatorPermissions::permissions): (WebCore::NavigatorPermissions::from): (WebCore::NavigatorPermissions::supplementName): * Modules/permissions/NavigatorPermissions.h: Added. * Modules/permissions/PermissionController.h: Added. * Modules/permissions/PermissionDescriptor.h: Added. (WebCore::PermissionDescriptor::operator== const): (WebCore::PermissionDescriptor::encode const): (WebCore::PermissionDescriptor::decode): * Modules/permissions/PermissionDescriptor.idl: Added. * Modules/permissions/PermissionName.h: Added. * Modules/permissions/PermissionName.idl: Added. * Modules/permissions/PermissionObserver.h: Added. * Modules/permissions/PermissionState.h: Added. * Modules/permissions/PermissionState.idl: Added. * Modules/permissions/PermissionStatus.cpp: Added. (WebCore::PermissionStatus::create): (WebCore::PermissionStatus::PermissionStatus): (WebCore::PermissionStatus::~PermissionStatus): (WebCore::PermissionStatus::stateChanged): (WebCore::PermissionStatus::activeDOMObjectName const): (WebCore::PermissionStatus::virtualHasPendingActivity const): (WebCore::PermissionStatus::eventListenersDidChange): * Modules/permissions/PermissionStatus.h: Added. * Modules/permissions/PermissionStatus.idl: Added. * Modules/permissions/Permissions.cpp: Added. (WebCore::Permissions::create): (WebCore::Permissions::Permissions): (WebCore::Permissions::navigator): (WebCore::Permissions::query): * Modules/permissions/Permissions.h: Added. * Modules/permissions/Permissions.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * dom/Document.cpp: (WebCore::Document::permissionController): * dom/Document.h: * dom/EventTargetFactory.in: * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::permissionController): * dom/TaskSource.h: * loader/EmptyClients.cpp: (WebCore::pageConfigurationWithEmptyClients): * page/Page.cpp: (WebCore::m_permissionController): (WebCore::Page::permissionController): (WebCore::m_httpsUpgradeEnabled): Deleted. * page/Page.h: * page/PageConfiguration.cpp: (WebCore::PageConfiguration::PageConfiguration): * page/PageConfiguration.h: 2021-08-30 Chris Dumez SubmitEvent.submitter property isn't set for