haikuwebkit/Source/WebCore/ChangeLog

65516 lines
3.1 MiB
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

2021-08-23 Martin Robinson <mrobinson@webkit.org>
Sticky position should not use transformed position to compute sticky offset.
https://bugs.webkit.org/show_bug.cgi?id=164292
<rdar://problem/29054773>
Reviewed by Simon Fraser.
No new tests. This change is tested by the following WPT test:
web-platform-tests/css/css-position/sticky/position-sticky-transforms-translate.html
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::computeStickyPositionConstraints const): When calling localToContainerQuad,
pass 0 for the mode which means that the transformation between coordinate systems does not include
transforms.
2021-08-23 Carlos Garcia Campos <cgarcia@igalia.com>
Create a RenderLineBreak when BR element has unsupported content data style
https://bugs.webkit.org/show_bug.cgi?id=224849
Reviewed by Antti Koivisto.
Instead of falling back to RenderElement::createFor(), create a RenderLineBreak just ignoring the unsupported
content data.
* html/HTMLBRElement.cpp:
(WebCore::HTMLBRElement::createElementRenderer):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::isContentDataSupported):
(WebCore::RenderElement::createFor):
* rendering/RenderElement.h:
2021-08-23 Chris Dumez <cdumez@apple.com>
HTMLStyleElement should be able to fire the load event more than once
https://bugs.webkit.org/show_bug.cgi?id=228975
Reviewed by Youenn Fablet.
HTMLStyleElement should be able to fire the load event more than once. WebKit has a flag
preventing the load event to fire more than once but this behavior is not present in the
HTML specification and doesn't match other browsers.
No new tests, rebaselined existing test.
* html/HTMLStyleElement.cpp:
(WebCore::HTMLStyleElement::notifyLoadedSheetAndAllCriticalSubresources):
* html/HTMLStyleElement.h:
2021-08-23 Alicia Boya García <aboya@igalia.com>
[MSE][GStreamer] Implement multi-track support
https://bugs.webkit.org/show_bug.cgi?id=229072
Reviewed by Xabier Rodriguez-Calvar.
This patch adds support for SourceBuffer having more than one track in
the GStreamer port.
This fixes the following LayoutTests:
imported/w3c/web-platform-tests/media-source/mediasource-activesourcebuffers.html
media/media-source/media-source-has-audio-video.html
media/media-source/only-bcp47-language-tags-accepted-as-valid.html
* platform/graphics/gstreamer/GStreamerCommon.h:
(GstIteratorAdaptor::GstIteratorAdaptor):
(GstIteratorAdaptor::iterator::iterator):
(GstIteratorAdaptor::iterator::operator*):
(GstIteratorAdaptor::iterator::operator++):
(GstIteratorAdaptor::iterator::operator==):
(GstIteratorAdaptor::iterator::operator!=):
(GstIteratorAdaptor::begin):
(GstIteratorAdaptor::end):
* platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::AppendPipeline::AppendPipeline):
(WebCore::AppendPipeline::~AppendPipeline):
(WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
(WebCore::AppendPipeline::appsinkCapsChanged):
(WebCore::AppendPipeline::handleEndOfAppend):
(WebCore::AppendPipeline::appsinkNewSample):
(WebCore::AppendPipeline::didReceiveInitializationSegment):
(WebCore::AppendPipeline::consumeAppsinksAvailableSamples):
(WebCore::AppendPipeline::resetParserState):
(WebCore::AppendPipeline::handleAppsinkNewSampleFromStreamingThread):
(WebCore::createOptionalParserForFormat):
(WebCore::AppendPipeline::generateTrackId):
(WebCore::AppendPipeline::tryCreateTrackFromPad):
(WebCore::AppendPipeline::tryMatchPadToExistingTrack):
(WebCore::AppendPipeline::linkPadWithTrack):
(WebCore::AppendPipeline::makeWebKitTrack):
(WebCore::AppendPipeline::Track::initializeElements):
(WebCore::AppendPipeline::hookTrackEvents):
(WebCore::AppendPipeline::streamTypeToString):
(WebCore::AppendPipeline::id): Deleted.
(WebCore::AppendPipeline::trackId): Deleted.
(WebCore::AppendPipeline::consumeAppsinkAvailableSamples): Deleted.
(WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromStreamingThread): Deleted.
(WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink): Deleted.
(WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread): Deleted.
* platform/graphics/gstreamer/mse/AppendPipeline.h:
(WebCore::AppendPipeline::sourceBufferPrivate):
(WebCore::AppendPipeline::Track::Track):
(WebCore::AppendPipeline::appsrc):
(WebCore::AppendPipeline::appsinkCaps): Deleted.
(WebCore::AppendPipeline::track): Deleted.
(WebCore::AppendPipeline::appsink): Deleted.
(WebCore::AppendPipeline::demuxerSrcPadCaps): Deleted.
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::setInitialVideoSize):
(WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected): Deleted.
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
2021-08-22 Carlos Garcia Campos <cgarcia@igalia.com>
[Freetype] Set maximum allowed font size for Freetype
https://bugs.webkit.org/show_bug.cgi?id=228893
Reviewed by Michael Catanzaro.
Maximum allowed font size in Freetype2 is 65535 because x_ppem and y_ppem fields in FreeType structs are of type
'unsigned short'.
* rendering/style/RenderStyleConstants.h:
2021-08-22 Alan Bujtas <zalan@apple.com>
[LFC][IFC] Add support for vertical-align: super
https://bugs.webkit.org/show_bug.cgi?id=228235
Reviewed by Antti Koivisto.
* layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::LineBoxBuilder::computeLineBoxHeightAndAlignInlineLevelBoxesVertically):
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForChild):
2021-08-22 Kate Cheney <katherine_cheney@apple.com>
Report correct blocked URI in CSP violation report
https://bugs.webkit.org/show_bug.cgi?id=226316
<rdar://problem/78552912>
Reviewed by Alex Christensen.
Tests: http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect.html
http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects.html
Currently for a blocked redirection we report the blocked URI as the
target URL. This is not up to spec and we should actually report the
requested URL.
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::redirectReceived):
(WebCore::DocumentThreadableLoader::isAllowedByContentSecurityPolicy):
* loader/DocumentThreadableLoader.h:
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::allowConnectToSource const):
(WebCore::ContentSecurityPolicy::reportViolation const):
* page/csp/ContentSecurityPolicy.h:
2021-08-22 Myles C. Maxfield <mmaxfield@apple.com>
Tiny cleanups in CSS parsing code
https://bugs.webkit.org/show_bug.cgi?id=229369
Reviewed by Alan Bujtas.
Use references for non-nullable pointers, and pass nullptr instead of 0 to other pointer parameters.
No new tests because there is no behavior change.
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::parseAuthorStyleSheet):
(WebCore::StyleSheetContents::parseString):
* css/StyleSheetContents.h:
* css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseSheet):
* css/parser/CSSParser.h:
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::parseStyleSheet):
* css/parser/CSSParserImpl.h:
2021-08-22 Alan Bujtas <zalan@apple.com>
[LFC][IFC] Add support for out-of-flow box static positioning
https://bugs.webkit.org/show_bug.cgi?id=229103
Reviewed by Antti Koivisto.
This patch is in preparation for enabling positioned content for IFC handling.
In this patch we compute the static position for out-of-flow content inside the inline formatting context.
As per spec, the static position of an out-of-flow box is computed as if the position was set to static.
However it does not mean that the out-of-flow box should be involved in the inline layout process.
Instead we figure out this static position after the inline layout by looking at
the previous sibling (or parent) box's geometry and place the out-of-flow box at the logical right position.
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
(WebCore::Layout::InlineFormattingContext::lineLayoutForIntergration):
(WebCore::Layout::InlineFormattingContext::computeStaticPositionForOutOfFlowContent):
(WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
(WebCore::Layout::InlineFormattingContext::collectContentIfNeeded):
(WebCore::Layout::InlineFormattingContext::collectInlineContentIfNeeded): Deleted.
* layout/formattingContexts/inline/InlineFormattingContext.h:
2021-08-22 Myles C. Maxfield <mmaxfield@apple.com>
REGRESSION(r281389): canUseSimplifiedTextMeasuring() needs to match with WidthIterator::applyCSSVisibilityRules()
https://bugs.webkit.org/show_bug.cgi?id=229388
Reviewed by Alan Bujtas.
WidthIterator::applyCSSVisibilityRules() has some special handling for specific characters.
If those characters are present, we need to make sure we actually use WidthIterator::applyCSSVisibilityRules()
instead of taking the fast path in FontCascade::widthForSimpleText().
This is split out from https://bugs.webkit.org/show_bug.cgi?id=215643, and will be tested by that bug's test.
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::canUseSimplifiedTextMeasuring):
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::characterCanUseSimplifiedTextMeasuring):
(WebCore::WidthIterator::applyCSSVisibilityRules):
* platform/graphics/WidthIterator.h:
* rendering/RenderText.cpp:
(WebCore::RenderText::computeCanUseSimplifiedTextMeasuring const):
2021-08-22 Alan Bujtas <zalan@apple.com>
[LFC][IFC] Add support for vertical-align: sub
https://bugs.webkit.org/show_bug.cgi?id=228217
Reviewed by Antti Koivisto.
Adjust legacy's integral alignment too.
* layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::LineBoxBuilder::computeLineBoxHeightAndAlignInlineLevelBoxesVertically):
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForChild):
2021-08-22 Myles C. Maxfield <mmaxfield@apple.com>
Control characters (Unicode category Cc) should be rendered visibly
https://bugs.webkit.org/show_bug.cgi?id=149128
<rdar://problem/79224941>
Reviewed by Alan Bujtas.
We can map these glyphs to the .notdef glyph, which is (supposed to be) visible.
Tests: fast/dom/52776.html
fast/text/fixed-pitch-control-characters.html
fast/text/wide-zero-width-space.html
fast/text/zero-width-characters.html
imported/w3c/web-platform-tests/css/css-text/white-space*
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::applyCSSVisibilityRules):
2021-08-21 Myles C. Maxfield <mmaxfield@apple.com>
overwriteCodePoint() in createAndFillGlyphPage() is wrong
https://bugs.webkit.org/show_bug.cgi?id=215643
<rdar://problem/67430461>
Reviewed by Alan Bujtas.
The CSS spec says that certain characters have to be invisible. Previously, we were doing this
by just treating these characters as if they were the zero width space character. However, this
is wrong for 2 reasons:
1. If the primary font supports the desired character but doesn't support the zero width space
character, we'll fallback past it and trigger a download for secondary fonts until
we find one that supports the ZWS character (which the page didn't even ask for!)
2. Shaping is Turing-complete, and expects that the correct glyphIDs are fed into the shaper.
We can't just arbitrarily swap out glyphIDs before shaping just because we feel like it.
Instead, the solution is to handle these invisible characters after font fallback, and after
shaping. This patch does it just like we handle adding letter-spacing, word-spacing, and
justification after shaping - by iterating over the glyphs output by the shaper and seeing if
any need to be adjusted.
This patch also includes a fix for the situation where the glyph buffer might be left in an
inconsistent state, where the array of glyphs is shorter than the array of characters -
this new codepath added in this patch revealed this existing problem, and fixes it here too.
Test: fast/text/zwj-ligature.html
* platform/graphics/Font.cpp:
(WebCore::createAndFillGlyphPage):
(WebCore::overrideControlCharacters): Deleted.
* platform/graphics/GlyphBuffer.h:
(WebCore::GlyphBuffer::glyphAt const):
(WebCore::GlyphBuffer::deleteGlyphWithoutAffectingSize):
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::applyCSSVisibilityRules):
(WebCore::WidthIterator::advance):
* platform/graphics/WidthIterator.h:
2021-08-21 Alan Bujtas <zalan@apple.com>
[LFC][Integration] Do not create an InlineFormattingContext object for constructing display lines and runs
https://bugs.webkit.org/show_bug.cgi?id=228061
Reviewed by Sam Weinig.
We've got all we need in the inlineFormattingState object.
* 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/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::constructContent):
2021-08-21 Alan Bujtas <zalan@apple.com>
[LFC][IFC] Add support for -webkit-text-security: disc
https://bugs.webkit.org/show_bug.cgi?id=229047
Reviewed by Antti Koivisto.
The disc glyph affects layout, so let's replace the text before we start measuring the inline content.
* layout/integration/LayoutIntegrationBoxTree.cpp:
(WebCore::LayoutIntegration::BoxTree::buildTree):
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::printReason):
(WebCore::LayoutIntegration::canUseForStyle):
* layout/integration/LayoutIntegrationCoverage.h:
2021-08-21 Alan Bujtas <zalan@apple.com>
[IFC][Integration] Enable modern line layout for placeholder elements
https://bugs.webkit.org/show_bug.cgi?id=228887
Reviewed by Antti Koivisto.
Apparently placeholders don't do strange things anymore (this check is originated in SLL).
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForLineLayoutWithReason):
2021-08-21 Sihui Liu <sihui_liu@apple.com>
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-08-21 Zalan Bujtas <zalan@apple.com>
[IFC][Integration] Group non-standard CSS properties
https://bugs.webkit.org/show_bug.cgi?id=228855
<rdar://problem/81880442>
Reviewed by Antti Koivisto.
List of unsupported non-standard CSS properties (consider it a priority list).
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForStyle):
2021-08-21 Per Arne <pvollan@apple.com>
[Win] Crash under FontCache::lastResortFallbackFont
https://bugs.webkit.org/show_bug.cgi?id=228186
Reviewed by Myles C. Maxfield.
Add null check to resolve crash in FontCache::lastResortFallbackFont. Additionally, return early in BitmapImage::getHBITMAPOfSize
when the bits per pixel in the bitmap is of unexpected size, since that will cause a crash under this function. This can happen
if an event is being handled while already in the Windows paint handler.
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::FontCache::lastResortFallbackFont):
* platform/graphics/win/GraphicsContextCGWin.cpp:
(WebCore::CGContextWithHDC):
* platform/graphics/win/ImageCGWin.cpp:
(WebCore::BitmapImage::getHBITMAPOfSize):
2021-08-21 Myles C. Maxfield <mmaxfield@apple.com>
[Cocoa] Single characters don't get shaped in the fast text codepath
https://bugs.webkit.org/show_bug.cgi?id=186804
Reviewed by Alan Bujtas.
Previously, single characters weren't shaped in the fast text codepath,
because shaping in the fast text codepath was just for kerning and
ligatures. Kerning didn't need to shape individual characters because
kerning only applies to pairs of characters, and ligatures didn't need
to shape individual characters because two characters are required to
form a ligature. However, now that we want to replace the complex text
codepath with a new-and-improved fast text codepath, we have to perform
all shaping in the fast text codepath, regardless of how many characters
are present.
Test: fast/text/single-character-shaping.html
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::applyFontTransforms):
(WebCore::WidthIterator::commitCurrentFontRange):
(WebCore::WidthIterator::advanceInternal):
(WebCore::WidthIterator::shouldApplyFontTransforms const): Deleted.
* platform/graphics/WidthIterator.h:
* platform/graphics/coretext/FontCoreText.cpp:
(WebCore::Font::applyTransforms): Keep kerning disabled for single glyphs,
because of performance. This will be able to be removed when rdar://82195405
is fixed.
* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::computePreferredLogicalWidths):
2021-08-21 Alan Bujtas <zalan@apple.com>
[IFC][Integration] Add painting support for vertical text content
https://bugs.webkit.org/show_bug.cgi?id=228940
Reviewed by Antti Koivisto.
Translate the logical layout coordinates to physical paint coordinates by taking the writing mode into account.
(e.g. writing-mode: vertical-rl;
run logical rect: [0, 0][20x18]
in a flipped block box: [10, 10][100x50]
with the paint offset: [8, 8]
translates to: [90, 8][20x18]
)
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::paint):
(WebCore::LayoutIntegration::LineLayout::paintTextRunUsingPhysicalCoordinates):
* layout/integration/LayoutIntegrationLineLayout.h:
2021-08-21 Zalan Bujtas <zalan@apple.com>
[IFC][Integration] Do not scan the content for overflowing glyph when line-box-contain is set to glyph
https://bugs.webkit.org/show_bug.cgi?id=228895
<rdar://problem/81651487>
Reviewed by Antti Koivisto.
This is in preparation for removing content scanning completely.
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::printReason):
(WebCore::LayoutIntegration::canUseForText):
(WebCore::LayoutIntegration::canUseForFontAndText):
* layout/integration/LayoutIntegrationCoverage.h:
2021-08-21 Zalan Bujtas <zalan@apple.com>
Fix spelling: MidWorkdBreak -> MidWordBreak
Unreviewed.
* layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::tryBreakingTextRun const):
* layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::midWordBreak):
(WebCore::Layout::TextUtil::midWorkdBreak): Deleted.
* layout/formattingContexts/inline/text/TextUtil.h:
2021-08-21 Youenn Fablet <youenn@apple.com>
Prevent AudioSession category from moving out of PlayAndRecord too quickly
https://bugs.webkit.org/show_bug.cgi?id=229327
<rdar://81997024>
Reviewed by Eric Carlson.
If category is PlayAndRecord, we stick to PlayAndRecord until audio is no longer playing at which point we
transition to whatever category is most appropriate.
Introduce PlatformMediaSession::isPlaying in addition to canProduceAudio to compute whether audio is being played.
Test: http/tests/media/media-stream/audio-capture-and-category.https.html
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::isPlaying const):
* Modules/webaudio/AudioContext.h:
* html/HTMLMediaElement.h:
* platform/audio/PlatformMediaSession.cpp:
(WebCore::PlatformMediaSession::isPlaying const):
* platform/audio/PlatformMediaSession.h:
(WebCore::PlatformMediaSessionClient::isPlaying const):
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::updateSessionState):
2021-08-20 Tim Nguyen <ntim@apple.com>
Walk up stacking contexts in RenderLayerBacking::compositingOpacity
https://bugs.webkit.org/show_bug.cgi?id=229350
Reviewed by Simon Fraser.
Shorter way to do the same thing, since stackingContext() chain is top-layer aware and opacity creates stacking contexts anyway.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::compositingOpacity const):
2021-08-20 Alan Bujtas <zalan@apple.com>
[IFC][Integration] canUseForLineLayoutWithReason's establishesInlineFormattingContext should check against inflow content
https://bugs.webkit.org/show_bug.cgi?id=229104
Reviewed by Antti Koivisto.
<div><div style="position: absolute"></div>this is still a inline formatting context</div>
We don't allow to mix inline and block inflow content.
However out-of-flow block level boxes can certainly have inline siblings. canUseForLineLayoutWithReason should check
the content accordingly.
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForLineLayoutWithReason):
2021-08-20 Alan Bujtas <zalan@apple.com>
[IFC][Integration] Walk the box tree to update the replaced content location
https://bugs.webkit.org/show_bug.cgi?id=229105
Reviewed by Antti Koivisto.
Normally there are more runs than entries in the box list. It's more performant to iterate
the box list for the renderer location adjustment.
* layout/integration/LayoutIntegrationBoxTree.h:
(WebCore::LayoutIntegration::BoxTree::boxAndRendererList):
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::constructContent):
2021-08-20 Simon Fraser <simon.fraser@apple.com>
Use UserMediaRequestIdentifier in WebKit rather than a mysterious uint64_t
https://bugs.webkit.org/show_bug.cgi?id=229308
Reviewed by Youenn Fablet.
Move UserMediaRequestIdentifier to its own header.
* Headers.cmake:
* Modules/mediastream/UserMediaRequest.h:
* WebCore.xcodeproj/project.pbxproj:
2021-08-20 Alan Bujtas <zalan@apple.com>
[LFC][Integration] Initialize root box's border and padding values
https://bugs.webkit.org/show_bug.cgi?id=229109
Reviewed by Antti Koivisto.
This is what LFC would normally do.
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::layout):
(WebCore::LayoutIntegration::LineLayout::prepareLayoutState):
2021-08-20 Alan Bujtas <zalan@apple.com>
[LFC][Integration] HTMLTextFormControlElement should use the inline iterator to collect content for wrap=hard
https://bugs.webkit.org/show_bug.cgi?id=228882
Reviewed by Antti Koivisto.
getNextSoftBreak is simply returns the position of the last item on the line unless it's a hard line break.
(endsWithBreak -> previousLineBrokeCleanly -> previousLineBrokeAtBR see https://trac.webkit.org/changeset/6107)
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::valueWithHardLineBreaks const):
(WebCore::getNextSoftBreak): Deleted. line->lineBreakPos() translates to the position where the line breaks within the run.
maximumCaretOffset() returns the same value, though the naming is a bit confusing and probably should be renamed or introduce
something similar on the line iterator.
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForLineLayoutWithReason):
2021-08-20 Zalan Bujtas <zalan@apple.com>
[IFC][Integration] Enable inline level boxes with relative (min/max)width and (min/max)height values
https://bugs.webkit.org/show_bug.cgi?id=229065
Reviewed by Antti Koivisto.
When a block level box's style changes, while we mark the box itself for layout we normally don't
walk the subtree for damaged inline content. Instead during layout, we dirty these individual descendant renderers as needed.
Inline level boxes with relative width/height values are part of this group.
It's also similar to what we do in LegacyLineLayout::layoutLineBoxes.
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForChild):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutModernLines):
2021-08-20 Alan Bujtas <zalan@apple.com>
[IFC][Integration] Enable non-auto line-break values
https://bugs.webkit.org/show_bug.cgi?id=228842
Reviewed by Antti Koivisto.
IFC already supports line-break (except after-white-space).
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForStyle):
2021-08-20 Patrick Angle <pangle@apple.com>
Web Inspector: Style rules declared after a rule whose selector has over 8192 components are not shown correctly
https://bugs.webkit.org/show_bug.cgi?id=229218
Reviewed by Devin Rousso.
Test: inspector/css/getMatchedStylesForNodeLargeSelectors.html
CSS rules are limited to 8192 selector components in WebCore, and when more components are present the rule is
split into multiple `StyleRule` instances. This meant Web Inspector could not reliably resolve a `StyleRule`
back to its source data, which we do to enable things like editing, as well as to make sure we show the un-split
selector in the Styles sidebar of the Elements tab. Previously, the presences of multiple `StyleRule`s for a
single source data declaration was not accounted for, which meant that rules after the split rules would show a
mix of style information from the actual rule as well as a rule some number of declarations later in the same
style sheet. This is resolved by marking `StyleRule`s that have been split and marking the last of the split
rules. This allows us to then forgo incrementing the index for looking up raw declarations until we encounter
the last rule from a split `StyleRule`.
* css/StyleRule.cpp:
(WebCore::StyleRule::StyleRule):
(WebCore::StyleRule::createForSplitting):
(WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount const):
* css/StyleRule.h:
- Added two members to track rules that are split into multiple rules due to exceeding the 8192 component limit
for selectors in order to determine later which rules are effectively duplicates of each other. We use two
members here, one to track that the rule was split from a larger authored rule (`m_isSplitRule`), and one to
mark the last rule split from a given rule (`m_isLastRuleInSplitRule`). The second member prevents situations
where we might otherwise accidentally continue iterating into a list of `StyleRule` where two large authored
rules that had to be split are present next to each other in an ordered collection of `StyleRule`.
* inspector/InspectorStyleSheet.cpp:
(WebCore::selectorsFromSource):
- Use a vector of `CSSSelector`s for specificity information since we now collect selectors from potentially
multiple `CSSStyleRule`s.
(WebCore::InspectorStyleSheet::cssStyleRulesSplitFromSameRule):
- Find any neighboring CSSStyleRules that were split from the same original rule based on the order of rules as
well as the new flags in `StyleRule`
(WebCore::InspectorStyleSheet::selectorsForCSSStyleRule):
- Find all selectors for a given CSSStyleRule, including other `CSSStyleRule`s split from the same rule in a
style sheet.
(WebCore::InspectorStyleSheet::buildObjectForSelectorList):
- Use all CSSSelectors from for the CSSStyleRule and other rules that were split from the same rule in a style
sheet.
(WebCore::InspectorStyleSheet::ruleSourceDataFor const):
(WebCore::InspectorStyleSheet::ruleIndexByStyle const):
- When looking up an index to get rule source data, make sure we don't overcount split rules.
* inspector/InspectorStyleSheet.h:
2021-08-20 Simon Fraser <simon.fraser@apple.com>
Outdent WorkerRunLoop class definition
https://bugs.webkit.org/show_bug.cgi?id=229352
Reviewed by Wenson Hsieh.
Just outdent the class.
* workers/WorkerRunLoop.h:
(WebCore::WorkerRunLoop::terminated const):
(WebCore::WorkerRunLoop::createUniqueId):
(WebCore::WorkerRunLoop::Task::mode const):
(WebCore::WorkerRunLoop::isBeingDebugged const):
2021-08-20 Alan Bujtas <zalan@apple.com>
[LFC][IFC] Make mid-word breaking surrogate pair aware
https://bugs.webkit.org/show_bug.cgi?id=229026
Reviewed by Antti Koivisto.
Surrogate pairs represent one "character" (U16_IS_LEAD + U16_IS_TAIL).
We should never break them half even when CSS tells us to break the word at arbitrary position.
This is in preparation for removing the U16_IS_SURROGATE check in canUseForCharacter.
* layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::tryBreakingTextRun const):
* layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::midWorkdBreak):
(WebCore::Layout::TextUtil::split): Deleted.
* layout/formattingContexts/inline/text/TextUtil.h:
2021-08-20 Alan Bujtas <zalan@apple.com>
[LFC][Integration] Use the logical width when passing in the constraint for the inline content
https://bugs.webkit.org/show_bug.cgi?id=228942
Reviewed by Simon Fraser.
Let's pass in the logical width (e.g. block box's height in case of vertical writing direction) to the inline line layout.
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::layout):
2021-08-20 Alan Bujtas <zalan@apple.com>
[LFC][IFC] Add support for justified non-breaking space
https://bugs.webkit.org/show_bug.cgi?id=228727
Reviewed by Antti Koivisto.
Let's use FontCascade::expansionOpportunityCount to figure out the number of expansion counts in a run.
It helps with finding non-breakable space in an otherwise non-whitespace content (foo&nbsp;bar where the contet forms one run but the because
of the non-breakable _space_ in the middle, it also produces an expansion opportunity).
This patch moves all the expansion handling over to Line::applyRunExpansion as we anyway need to walk the content to find such spaces (i.e. not worth trying to pre-compute them).
* layout/formattingContexts/inline/InlineLine.cpp:
(WebCore::Layout::Line::applyRunExpansion):
(WebCore::Layout::Line::Run::Run):
(WebCore::Layout::Line::Run::expand):
(WebCore::Layout::Line::Run::visuallyCollapseTrailingWhitespace):
(WebCore::Layout::Line::Run::setExpansionBehavior): Deleted.
(WebCore::Layout::Line::Run::expansionBehavior const): Deleted.
(WebCore::Layout::Line::Run::setHorizontalExpansion): Deleted.
* layout/formattingContexts/inline/InlineLine.h:
(WebCore::Layout::Line::Run::expansion const):
(WebCore::Layout::Line::Run::setExpansion):
(WebCore::Layout::Line::Run::hasExpansionOpportunity const): Deleted.
(WebCore::Layout::Line::Run::expansionOpportunityCount const): Deleted.
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForCharacter):
(WebCore::LayoutIntegration::canUseForText):
(WebCore::LayoutIntegration::canUseForFontAndText):
(WebCore::LayoutIntegration::canUseForStyle):
2021-08-20 Alan Bujtas <zalan@apple.com>
[LFC][IFC] LineBox provides redundant geometry information
https://bugs.webkit.org/show_bug.cgi?id=228050
Reviewed by Sam Weinig.
LineBoxGeometry class provides the line's geometry. This is also in preparation for making LineBox a non-persistent type of structure.
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
* layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::LineBoxBuilder::build):
(WebCore::Layout::LineBoxBuilder::constructAndAlignInlineLevelBoxes):
(WebCore::Layout::LineBoxBuilder::computeLineBoxHeightAndAlignInlineLevelBoxesVertically):
(WebCore::Layout::InlineFormattingGeometry::verticallyAdjustedLineForLineContent const):
(WebCore::Layout::InlineFormattingGeometry::lineBoxForLineContent const): Deleted.
* layout/formattingContexts/inline/InlineFormattingGeometry.h:
* layout/formattingContexts/inline/InlineLineBox.cpp:
(WebCore::Layout::LineBox::LineBox):
(WebCore::Layout::m_rootInlineBox): Deleted.
* layout/formattingContexts/inline/InlineLineBox.h:
(WebCore::Layout::LineBox::logicalRect const): Deleted.
(WebCore::Layout::LineBox::alignmentBaseline const): Deleted.
(WebCore::Layout::LineBox::setLogicalHeight): Deleted.
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayNonRootInlineBoxes const):
2021-08-20 Wenson Hsieh <wenson_hsieh@apple.com>
Followup to <trac.webkit.org/r281288>
https://bugs.webkit.org/show_bug.cgi?id=229269
rdar://81349236
Reviewed by Jer Noble.
Make two minor adjustments after the changes in r281288:
1. Rename `keyPathsForValuesAffectingValueCanBeginTouchBarScrubbing` to just
`keyPathsForValuesAffectingCanBeginTouchBarScrubbing`, since the Objective-C property name is
`-canBeginTouchBarScrubbing` rather than `-valueCanBeginTouchBarScrubbing`.
2. After fixing (1), the implementation of this method is no longer dead code, so we'll to make sure that the
`NSSet` we create and return contains valid Objective-C objects (i.e. NSString instead of `const char*`) --
in particular, this affects `"contentDuration"`.
* platform/mac/WebPlaybackControlsManager.mm:
(+[WebPlaybackControlsManager keyPathsForValuesAffectingCanBeginTouchBarScrubbing]):
(+[WebPlaybackControlsManager keyPathsForValuesAffectingValueCanBeginTouchBarScrubbing]): Deleted.
2021-08-20 Carlos Alberto Lopez Perez <clopez@igalia.com>
REGRESSION(r274166): [GTK] It broke run-javascriptcore-tests causing all tests to use lot of memory
https://bugs.webkit.org/show_bug.cgi?id=229321
Unreviewed, reverting r274166 because it caused JSC tests to use too much memory.
Reverted changeset:
"[GTK] Reenable -fvisibility=hidden"
https://bugs.webkit.org/show_bug.cgi?id=181916
https://commits.webkit.org/r274166
Covered by existing tests.
* PlatformGTK.cmake:
* dom/EventTarget.cpp:
* dom/EventTarget.h:
2021-08-20 Dean Jackson <dino@apple.com>
[WebXR] A session with only one view should cover the full screen
https://bugs.webkit.org/show_bug.cgi?id=229110
<rdar://problem/81940621>
Reviewed by Tim Horton.
If we get into the state with an immersive session and only one view,
we should treat that view as the full width. This situation should never
happen with a real headset, but can be found in testing scenarios.
Test: http/wpt/webxr/xrViewport_singleView_valid.https.html
* Modules/webxr/WebXRWebGLLayer.cpp:
(WebCore::WebXRWebGLLayer::computeViewports): Add test for only one
view and assume it is the left eye.
2021-08-20 Aditya Keerthi <akeerthi@apple.com>
[macOS] Crash when painting <meter> with large scale
https://bugs.webkit.org/show_bug.cgi?id=229273
rdar://81219669
Reviewed by Wenson Hsieh.
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintMeter):
Draw the cell into an image buffer to avoid an assertion beneath WebKit.
2021-08-20 Patrick Angle <pangle@apple.com>
Release assert in ScriptController::canExecuteScripts via WebCore::WebSocket::didReceiveMessage
https://bugs.webkit.org/show_bug.cgi?id=229301
Reviewed by Ryosuke Niwa.
Test: http/tests/websocket/tests/hybi/inspector/send-and-recieve-debugger.html
`WebCore::WebSocket::didReceiveMessage` and other functions that fire JS events may be called while the
`WebSocketChannel` is being resumed, but it is not yet safe to evaluate JavaScript during resuming. This was
already accounted for with some events like errors and closing, but it holds true for all events. We should
delay firing these events as well.
* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::didConnect):
(WebCore::WebSocket::didReceiveMessage):
(WebCore::WebSocket::didReceiveBinaryData):
2021-08-20 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r281307.
https://bugs.webkit.org/show_bug.cgi?id=229336
broke layout tests
Reverted changeset:
"[IFC][Integration] Enable non-auto line-break values"
https://bugs.webkit.org/show_bug.cgi?id=228842
https://commits.webkit.org/r281307
2021-08-20 Alan Bujtas <zalan@apple.com>
[IFC] Undo incorrect InlineTextBox -> LegacyInlineTextBox renaming
https://bugs.webkit.org/show_bug.cgi?id=229081
Reviewed by Antti Koivisto.
* layout/formattingContexts/inline/text/TextUtil.h:
* layout/layouttree/LayoutBox.h:
(WebCore::Layout::Box::isInlineTextBox const):
* layout/layouttree/LayoutInlineTextBox.cpp:
(WebCore::Layout::InlineTextBox::InlineTextBox):
2021-08-20 Antti Koivisto <antti@apple.com>
[LFC][Integration] Enable full underline support
https://bugs.webkit.org/show_bug.cgi?id=229322
Reviewed by Alan Bujtas.
We can now paint all underlines.
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::printReason):
(WebCore::LayoutIntegration::canUseForStyle):
* layout/integration/LayoutIntegrationCoverage.h:
* layout/integration/LayoutIntegrationInlineContent.cpp:
(WebCore::LayoutIntegration::InlineContent::iteratorForRun const):
(WebCore::LayoutIntegration::InlineContent::iteratorForTextRun const):
* layout/integration/LayoutIntegrationInlineContent.h:
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::paint):
2021-08-20 Alan Bujtas <zalan@apple.com>
[IFC][Integration] Enable custom hyphen strings
https://bugs.webkit.org/show_bug.cgi?id=229049
Reviewed by Antti Koivisto.
This was most likely the case of non-primary font handling in SLL. It just works in IFC.
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForStyle):
2021-08-20 Tim Nguyen <ntim@apple.com>
Initial implementation of inert subtrees
https://bugs.webkit.org/show_bug.cgi?id=110952
Reviewed by Antti Koivisto.
Currently covers:
- Blocking focus & selecting
- aria-hidden like behaviour
Hit testing/event retargeting will be covered by https://bugs.webkit.org/show_bug.cgi?id=229330 pending a spec issue
Relevant WPT enabled. More testing coverage will be provided with the inert attribute.
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isAXHidden const):
* dom/Element.cpp:
(WebCore::Element::isFocusable const):
* dom/Node.cpp:
(WebCore::Node::canStartSelection const):
(WebCore::Node::isInert const):
* dom/Node.h:
2021-08-20 Alan Bujtas <zalan@apple.com>
[LFC][Integration] line-clamp is an unsupported CSS property
https://bugs.webkit.org/show_bug.cgi?id=228794
Reviewed by Simon Fraser.
Let's bail out on -webkit-line-clamp instead of the presence of a deprecated flex box. While line clamping requires legacy line layout, regular flex item content is fine with either line layout codepaths.
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::printReason):
(WebCore::LayoutIntegration::canUseForLineLayoutWithReason):
* layout/integration/LayoutIntegrationCoverage.h:
2021-08-20 Alan Bujtas <zalan@apple.com>
[IFC][Integration] Enable non-auto line-break values
https://bugs.webkit.org/show_bug.cgi?id=228842
Reviewed by Antti Koivisto.
IFC already supports line-break.
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForStyle):
2021-08-20 Alan Bujtas <zalan@apple.com>
[LFC][IFC] Add support for -webkit-nbsp-mode: space
https://bugs.webkit.org/show_bug.cgi?id=228805
Reviewed by Antti Koivisto.
Treat non-breaking space as regular space.
TextUtil::findNextBreakablePosition already covers the "find the soft wrapping opportunity" part.
e.g.
<div style="-webkit-nbsp-mode: space">1&nbsp2</div>
produces 3 InlineTextItem objects as follows
[1][whitespace][2]
as opposed to just 1 [1non-breakable-space2]
* layout/formattingContexts/inline/InlineTextItem.cpp:
(WebCore::Layout::moveToNextNonWhitespacePosition):
(WebCore::Layout::InlineTextItem::createAndAppendTextItems):
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForStyle):
2021-08-20 Philippe Normand <pnormand@igalia.com>
REGRESSION(r280732) [GStreamer] fast/mediastream/getDisplayMedia-max-constraints1.html and other are failing
https://bugs.webkit.org/show_bug.cgi?id=228941
Reviewed by Youenn Fablet.
The GStreamer mock display capture source is now wrapped in another RealtimeMediaSource in
order to avoid a spurious setSize() call from the RealtimeVideoSource constructor that would
then prevent the mock source to ensure its size matches the intrinsic size.
For the non-mock display capture source, we now ensure the size matches the intrinsic size
whenever the capture settings have changed.
* platform/mediastream/RealtimeVideoCaptureSource.h:
* platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
(WebCore::GStreamerVideoCaptureSource::settingsDidChange):
* platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.cpp:
(WebCore::MockDisplayCaptureSourceGStreamer::create):
(WebCore::MockDisplayCaptureSourceGStreamer::capabilities):
(WebCore::MockDisplayCaptureSourceGStreamer::settings):
* platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.h:
* platform/mock/MockRealtimeMediaSourceCenter.cpp:
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::generateFrame):
2021-08-20 Myles C. Maxfield <mmaxfield@apple.com>
GlyphBuffer can become inconsistent with its backing string
https://bugs.webkit.org/show_bug.cgi?id=229064
Reviewed by Alan Bujtas.
This is split out from https://bugs.webkit.org/show_bug.cgi?id=215643.
Before shaping, the glyphs in the GlyphBuffer need to match one-to-one with code units in the string.
We iterate over the string, adding glyphs into the GlyphBuffer, but there was one early "continue"
in the loop that skips the add() call.
Because this patch adds ASSERT()s, this is actually covered by existing tests.
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::commitCurrentFontRange):
(WebCore::addToGlyphBuffer):
(WebCore::WidthIterator::advanceInternal):
* platform/graphics/WidthIterator.h:
2021-08-20 Tim Nguyen <ntim@apple.com>
Ensure ancestors with opacity don't affect top layer elements
https://bugs.webkit.org/show_bug.cgi?id=229317
Reviewed by Antti Koivisto.
Test: imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-opacity.html
Associated WPT PR: https://github.com/web-platform-tests/wpt/pull/30104
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::compositingOpacity const):
2021-08-20 Youenn Fablet <youenn@apple.com>
Add support for RTCPeerConnection.canTrickleIceCandidates
https://bugs.webkit.org/show_bug.cgi?id=229287
Reviewed by Eric Carlson.
Add support for https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-cantrickleicecandidates.
Return null in case connection is closed or setRemoteDescription was never called successfully.
Add binding code to get the value from webrtc backend.
Covered by rebased tests.
* Modules/mediastream/PeerConnectionBackend.h:
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::canTrickleIceCandidates const):
* Modules/mediastream/RTCPeerConnection.h:
* Modules/mediastream/RTCPeerConnection.idl:
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::canTrickleIceCandidates const):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::LibWebRTCPeerConnectionBackend::canTrickleIceCandidates const):
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2021-08-19 Tim Nguyen <ntim@apple.com>
Implement top layer rendering bits
https://bugs.webkit.org/show_bug.cgi?id=84796
Reviewed by Simon Fraser.
Enabled relevant WPTs. Some WPTs need extra layout work.
* dom/Document.cpp:
(WebCore::Document::addToTopLayer):
(WebCore::Document::removeFromTopLayer):
* dom/Element.cpp:
(WebCore::Element::isInTopLayerWillChange):
(WebCore::Element::isInTopLayerDidChange):
* dom/Element.h:
* rendering/RenderLayer.cpp:
(WebCore::canCreateStackingContext):
(WebCore::RenderLayer::stackingContext const):
(WebCore::RenderLayer::rebuildZOrderLists):
(WebCore::RenderLayer::collectLayers):
(WebCore::RenderLayer::enclosingAncestorForPosition const):
(WebCore::RenderLayer::establishesTopLayer const):
(WebCore::RenderLayer::establishesTopLayerWillChange):
(WebCore::RenderLayer::establishesTopLayerDidChange):
* rendering/RenderLayer.h:
2021-08-19 Antti Koivisto <antti@apple.com>
[:has() pseudo-class] Basic support
https://bugs.webkit.org/show_bug.cgi?id=228894
Reviewed by Simon Fraser.
This patch adds basic support for :has() pseudo-class, https://drafts.csswg.org/selectors/#has-pseudo.
The initial implementation is very inefficient. There is no support for invalidation yet.
The feature is disabled by default.
* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText const):
Serialization.
* css/CSSSelector.h:
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne const):
Selector matching using nested SelectorChecker.
* css/SelectorPseudoClassAndCompatibilityElementMap.in:
* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
(WebCore::add):
* css/parser/CSSParserContext.h:
* css/parser/CSSParserSelector.h:
(WebCore::CSSParserSelector::setPseudoClassType):
* css/parser/CSSSelectorParser.cpp:
(WebCore::CSSSelectorParser::consumeForgivingSelectorList):
Add a template version of the forgiving parsing function.
(WebCore::CSSSelectorParser::consumeForgivingComplexSelectorList):
Use it for complex selector lists.
(WebCore::CSSSelectorParser::consumeForgivingRelativeSelectorList):
And the new relative selector lists.
(WebCore::CSSSelectorParser::consumeRelativeSelector):
Parse relative selectors like "> foo".
(WebCore::CSSSelectorParser::consumePseudo):
(WebCore::CSSSelectorParser::consumeComplexForgivingSelectorList): Deleted.
* css/parser/CSSSelectorParser.h:
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):
No compiler support yet.
2021-08-19 Myles C. Maxfield <mmaxfield@apple.com>
The fast text codepath does not handle run initial advances
https://bugs.webkit.org/show_bug.cgi?id=227979
Reviewed by Alan Bujtas.
This is the next step to delete the complex text codepath from Cocoa ports.
The initial advance contributes to the layout width of text. Its purpose is to move
all the visually successive glyphs to the right. For the leftmost run, WidthIterator
saves this initial advance to the GlyphBuffer, because knowing it is necessary to
compute the paint location of glyphs (inside GlyphBuffer::flatten()). For all other
runs other than the leftmost run, those runs' initial advance is added to the advance
width of whichever glyph ends up being just to the left of the run. In LTR, this is
the last glyph of the last (logical) run, whereas in RTL this is the first glyph of
the next (logical) run.
Because this is just adding infrastructure, it doesn't add any tests yet. This will be
tested when we delete the complex text codepath.
* platform/graphics/ComplexTextController.h: Because we're going to stop using
ComplexTextController, we should move this (presumably helpful) comment somewhere
where it will be accessible to the Cocoa ports. This would be GlyphBuffer::flatten().
* platform/graphics/Font.cpp:
(WebCore::Font::applyTransforms const): Return the initial advance.
* platform/graphics/Font.h: Ditto.
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::widthOfTextRange const):
(WebCore::FontCascade::widthForSimpleText const): Make sure that the initial advance
contributes to layout width.
(WebCore::FontCascade::layoutSimpleText const): The initial advance is actually NOT
supposed to point directly to the first glyph's paint position. See
https://bugs.webkit.org/show_bug.cgi?id=228180.
(WebCore::FontCascade::drawEmphasisMarks const):
* platform/graphics/GlyphBuffer.h:
(WebCore::GlyphBuffer::flatten):
(WebCore::GlyphBuffer::isFlattened const):
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::applyFontTransforms): Return the initial advance.
(WebCore::expandWithInitialAdvance):
(WebCore::WidthIterator::applyInitialAdvance): This implements the logic above, where
the initial advance of non-leftmost runs get added to the visually previous glyph's
advance. For LTR, we can just add it directly to the previously-recorded glyph advance.
However, for RTL, we have to save the initial advance to a variable, which is named
m_leftoverInitialAdvance, and apply it when we encounter the next run. This is because
WidthIterator encounters run in logical order.
(WebCore::WidthIterator::commitCurrentFontRange):
(WebCore::WidthIterator::finalize): For RTL, if the last run has an initial advance,
we need to save it to the GlyphBuffer's initial advance field. We know if the last run
has an initial advance because there will still be data in m_leftoverInitialAdvance
left over.
* platform/graphics/WidthIterator.h:
* platform/graphics/coretext/FontCoreText.cpp:
(WebCore::Font::applyTransforms const): Return the initial advance.
2021-08-19 Myles C. Maxfield <mmaxfield@apple.com>
[Cocoa] Stop honoring any dot-prefixed font names
https://bugs.webkit.org/show_bug.cgi?id=228177
Reviewed by Sam Weinig.
Dot-prefixed fonts are intentionally unsupported. We should stop supporting them.
If authors want to access the various system fonts, they can use system-ui,
ui-serif, ui-monospace, or ui-rounded.
Test: fast/text/font-lookup-dot-prefix-case-sensitive.html
* platform/cocoa/VersionChecks.h:
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::isDotPrefixedForbiddenFont):
(WebCore::platformFontLookupWithFamily):
2021-08-19 Alan Bujtas <zalan@apple.com>
[IFC][Integration] The root inlinebox's style is always the IFC's root style
https://bugs.webkit.org/show_bug.cgi?id=228062
Reviewed by Antti Koivisto.
This is in preparation for keeping the inline box structure private to the layout code.
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::InlineContentBuilder::computeLineLevelVisualAdjustmentsForRuns const):
2021-08-19 Myles C. Maxfield <mmaxfield@apple.com>
[Cocoa] Stop treating the system font as a non-variable font
https://bugs.webkit.org/show_bug.cgi?id=228176
Reviewed by Sam Weinig.
Modern versions of macOS and iOS can treat the system font as a variable font,
and be able to apply weights like "342" instead of just "300" or "400".
Tests: fast/text/variable-system-font-2.html
fast/text/variable-system-font.html
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::preparePlatformFont):
2021-08-19 Jean-Yves Avenard <jya@apple.com>
Touchbar not showing time scrubbing
https://bugs.webkit.org/show_bug.cgi?id=229269
rdar://81349236
Reviewed by Jer Noble.
AVKit uses canSeek to determine when to show the time scrubber
in the touch bar. This was a synthesized method determined on weither the video
is seekable and has a seekable range set.
Should the value of either boolean change which would impact the final value of
[AVTouchBarPlaybackControlsControlling canSeek] , no observers would be called.
Add the appropriate obj-c methods to explicitly set a dependency between properties
willChange/didChange.
Been unable to reproduce the problem programatically, the issue is highly timing
dependent.
An API test will be added with https://bugs.webkit.org/show_bug.cgi?id=229286.
* platform/mac/WebPlaybackControlsManager.mm:
(+[WebPlaybackControlsManager keyPathsForValuesAffectingCanSeek]):
(+[WebPlaybackControlsManager keyPathsForValuesAffectingContentDuration]):
(-[WebPlaybackControlsManager setSeekableTimeRanges:]):
(+[WebPlaybackControlsManager keyPathsForValuesAffectingValueCanBeginTouchBarScrubbing]):
2021-08-19 Alan Bujtas <zalan@apple.com>
[LFC][IFC] Remove redundant inlineBoxEndSet in InlineFormattingContext::computeGeometryForLineContent
https://bugs.webkit.org/show_bug.cgi?id=228054
Reviewed by Antti Koivisto.
It's not used anymore.
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
2021-08-19 Chris Dumez <cdumez@apple.com>
Implement Crypto.randomUUID()
https://bugs.webkit.org/show_bug.cgi?id=229240
Reviewed by Geoff Garen.
Implement Crypto.randomUUID():
- https://wicg.github.io/uuid/#extensions-to-the-crypto-interface
Chrome already implements this and Firefox seems to be working on it
(https://bugzilla.mozilla.org/show_bug.cgi?id=1705264).
No new tests, rebaselined existing tests.
* page/Crypto.cpp:
(WebCore::Crypto::randomUUID const):
* page/Crypto.h:
* page/Crypto.idl:
2021-08-19 Simon Fraser <simon.fraser@apple.com>
Remove unused RenderLayerCompositor member variable
https://bugs.webkit.org/show_bug.cgi?id=229257
Reviewed by Alan Bujtas.
m_inPostLayoutUpdate was unused.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateCompositingLayers):
* rendering/RenderLayerCompositor.h:
2021-08-19 Alan Bujtas <zalan@apple.com>
[LFC][IFC] Remove redundant LineBox functions
https://bugs.webkit.org/show_bug.cgi?id=228046
Reviewed by Sam Weinig.
The line box's contentLogicalWidth always matches the root inlinebox's logical width.
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
* layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::LineBoxBuilder::constructAndAlignInlineLevelBoxes):
(WebCore::Layout::LineBoxBuilder::computeLineBoxHeightAndAlignInlineLevelBoxesVertically):
* layout/formattingContexts/inline/InlineLineBox.cpp:
(WebCore::Layout::LineBox::LineBox):
* layout/formattingContexts/inline/InlineLineBox.h:
(WebCore::Layout::LineBox::logicalRect const):
(WebCore::Layout::LineBox::logicalWidth const): Deleted.
(WebCore::Layout::LineBox::logicalHeight const): Deleted.
(WebCore::Layout::LineBox::logicalTopLeft const): Deleted.
(WebCore::Layout::LineBox::logicalSize const): Deleted.
(WebCore::Layout::LineBox::contentLogicalWidth const): Deleted.
2021-08-19 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Remove support for the meaningful tap heuristic
https://bugs.webkit.org/show_bug.cgi?id=229298
rdar://82130066
Reviewed by Tim Horton.
See WebKit ChangeLog for more details.
* page/ChromeClient.h:
(WebCore::ChromeClient::didHandleOrPreventMouseDownOrMouseUpEvent): Deleted.
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::handleMouseDoubleClickEvent):
(WebCore::EventHandler::handleMouseReleaseEvent):
2021-08-19 Alan Bujtas <zalan@apple.com>
[Line layout] "zero width space" (U+200B) is a breaking space
https://bugs.webkit.org/show_bug.cgi?id=227858
Reviewed by Antti Koivisto.
This is a workaround for handling mismatching prior-context content in break iterators.
* layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::endsWithSoftWrapOpportunity):
2021-08-19 Alan Bujtas <zalan@apple.com>
[LFC][IFC] Add support for negative horizontal margin (inline box)
https://bugs.webkit.org/show_bug.cgi?id=227837
Reviewed by Antti Koivisto.
When building up the line for line breaking, each inline item is placed adjacent with no gaps
in-between the neighboring entries. They are considered atomic with their margins, padding, borders and content width.
Later when we form the inline runs out of these entries, we offset them by their horizontal margin values.
* layout/formattingContexts/inline/InlineLine.cpp:
(WebCore::Layout::Line::appendInlineBoxStart):
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::printReason):
(WebCore::LayoutIntegration::canUseForChild):
* layout/integration/LayoutIntegrationCoverage.h:
2021-08-19 Alan Bujtas <zalan@apple.com>
[LFC][IFC] Add support for overflow-wrap: anywhere
https://bugs.webkit.org/show_bug.cgi?id=227695
Reviewed by Antti Koivisto.
Adjust the line breaking logic in IFC to support "overflow-wrap: anywhere".
From the line breaking point of view, "anywhere" and "break-word" work the same way
(i.e. an unbreakable content can be broken at an arbitrary position if there are no other, previous break points in the line).
https://drafts.csswg.org/css-text-3/#overflow-wrap-property
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator OverflowWrap const):
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
* layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::wordBreakBehavior const):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::breakWords const):
* rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<):
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleRareInheritedData.h:
2021-08-19 Alex Christensen <achristensen@webkit.org>
Remove more non-inclusive language from Source
https://bugs.webkit.org/show_bug.cgi?id=229230
Reviewed by Myles C. Maxfield.
No change in behavior.
* WebCore.order:
* features.json:
2021-08-19 Simon Fraser <simon.fraser@apple.com>
Rename Element::clientRect() which does not return a value in web-exposed "client" coordinates
https://bugs.webkit.org/show_bug.cgi?id=229243
Reviewed by Wenson Hsieh.
The result of Element::clientRect() is in the coordinate space of the root view,
not in the space of the Element's Frame, so does not match the other functions on Element
with "client" in the name.
Rename to Element::boundingBoxInRootViewCoordinates() for clarity.
* dom/Element.cpp:
(WebCore::Element::boundingBoxInRootViewCoordinates const):
(WebCore::Element::clientRect const): Deleted.
* dom/Element.h:
* html/MediaElementSession.cpp:
(WebCore::isElementMainContentForPurposesOfAutoplay):
(WebCore::isElementRectMostlyInMainFrame):
* page/Page.cpp:
(WebCore::Page::editableElementsInRect const):
2021-08-13 Tim Nguyen <ntim@apple.com>
Top layer: handle display: contents and non out-of-flow position values
https://bugs.webkit.org/show_bug.cgi?id=229093
Reviewed by Simon Fraser.
From: https://fullscreen.spec.whatwg.org/#new-stacking-layer
If its specified display property is contents, it computes to block.
If its specified position property is not absolute or fixed, it computes to absolute.
Test: imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/modal-dialog-display-contents.html
* style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::adjust const):
(WebCore::Style::Adjuster::adjustDisplayContentsStyle const):
2021-08-19 Simon Fraser <simon.fraser@apple.com>
Rename EventHandler::sendScrollEvent() to scheduleScrollEvent() since the event is not sent synchronously
https://bugs.webkit.org/show_bug.cgi?id=229256
Reviewed by Geoffrey Garen.
Rename EventHandler::sendScrollEvent() and FrameView::sendScrollEvent()
to scheduleScrollEvent() since the event dispatch happens via the next rendering update.
* page/EventHandler.cpp:
(WebCore::EventHandler::scheduleScrollEvent):
(WebCore::EventHandler::sendScrollEvent): Deleted.
* page/EventHandler.h:
* page/FrameView.cpp:
(WebCore::FrameView::FrameView):
(WebCore::FrameView::scrollPositionChanged):
(WebCore::FrameView::scheduleScrollEvent):
(WebCore::FrameView::sendScrollEvent): Deleted.
* page/FrameView.h:
2021-08-19 Kyle Piddington <kpiddington@apple.com>
WebGL via Metal experimental feature does not correctly toggle metal backend
https://bugs.webkit.org/show_bug.cgi?id=229267
<rdar://81855735>
Reviewed by Dean Jackson.
GraphicsContextGLAttributes defines 'useMetal' as 'true' by default.
Since this branch was only checking if Metal was enabled via the
setting, rather than checking the status of the flag, the metal backend
was never disabled, even when requested.
Tests: webgl/webgl-metal-disabled.html
webgl/webgl-metal-enabled.html
* WebCore.xcodeproj/project.pbxproj:
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::create):
* testing/Internals.cpp:
(WebCore::Internals::requestedMetal):
* testing/Internals.h:
* testing/Internals.idl:
* testing/Internals.mm:
(WebCore::Internals::platformSupportsMetal):
2021-08-19 Simon Fraser <simon.fraser@apple.com>
Avoid DOMRect overhead in VTTRegion
https://bugs.webkit.org/show_bug.cgi?id=229249
Reviewed by Eric Carlson.
Use Element::boundingClientRect() instead of Element::getBoundingClientRect() to
avoid DOMRect overhead. No behavior change.
* html/track/VTTRegion.cpp:
(WebCore::VTTRegion::displayLastTextTrackCueBox):
(WebCore::VTTRegion::willRemoveTextTrackCueBox):
2021-08-19 Antti Koivisto <antti@apple.com>
TextDecorationPainter should not depend on LegacyInlineTextBox
https://bugs.webkit.org/show_bug.cgi?id=228814
Reviewed by Alan Bujtas.
Use the inline iterator instead.
* layout/integration/LayoutIntegrationLineIterator.h:
(WebCore::LayoutIntegration::LineIterator::isFirst const):
(WebCore::LayoutIntegration::PathLine::baselineType const):
* layout/integration/LayoutIntegrationLineIteratorLegacyPath.h:
(WebCore::LayoutIntegration::LineIteratorLegacyPath::baselineType const):
* layout/integration/LayoutIntegrationLineIteratorModernPath.h:
(WebCore::LayoutIntegration::LineIteratorModernPath::baselineType const):
* layout/integration/LayoutIntegrationRunIterator.cpp:
(WebCore::LayoutIntegration::RunIterator::line const):
(WebCore::LayoutIntegration::PathRun::line const):
(WebCore::LayoutIntegration::PathRun::style const):
(WebCore::LayoutIntegration::textRunFor):
* layout/integration/LayoutIntegrationRunIterator.h:
(WebCore::LayoutIntegration::PathTextRun::renderer const):
* layout/integration/LayoutIntegrationRunIteratorModernPath.h:
* rendering/LegacyInlineFlowBox.cpp:
(WebCore::LegacyInlineFlowBox::maxLogicalBottomForTextDecorationLine const): Deleted.
(WebCore::LegacyInlineFlowBox::minLogicalTopForTextDecorationLine const): Deleted.
* rendering/LegacyInlineFlowBox.h:
* rendering/LegacyInlineTextBox.cpp:
(WebCore::LegacyInlineTextBox::paintMarkedTextDecoration):
* rendering/LegacyLineLayout.cpp:
(WebCore::setLogicalWidthForTextRun):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::enclosingRendererWithTextDecoration const): Deleted.
* rendering/RenderElement.h:
* rendering/TextDecorationPainter.cpp:
(WebCore::TextDecorationPainter::paintTextDecoration):
* rendering/TextDecorationPainter.h:
(WebCore::TextDecorationPainter::setTextRunIterator):
(WebCore::TextDecorationPainter::setInlineTextBox): Deleted.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeAffectsVisualOverflow const):
* style/InlineTextBoxStyle.cpp:
(WebCore::isAncestorAndWithinBlock):
(WebCore::minLogicalTopForTextDecorationLine):
(WebCore::maxLogicalBottomForTextDecorationLine):
Moved from LegacyInlineFlowBox.
(WebCore::enclosingRendererWithTextDecoration):
Moved from RenderElement.
(WebCore::computeUnderlineOffset):
(WebCore::visualOverflowForDecorations):
* style/InlineTextBoxStyle.h:
2021-08-19 Antti Koivisto <antti@apple.com>
Move MarkedTextStyle into StyledMarkedText scope
https://bugs.webkit.org/show_bug.cgi?id=228956
Reviewed by Alan Bujtas.
As StyledMarkedText::Style.
Also other cleanups and a file rename to match the type.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* rendering/LegacyInlineTextBox.cpp:
(WebCore::LegacyInlineTextBox::paint):
* rendering/StyledMarkedText.cpp: Renamed from Source/WebCore/rendering/MarkedTextStyle.cpp.
(WebCore::resolveStyleForMarkedText):
(WebCore::computeStyleForUnmarkedMarkedText):
(WebCore::StyledMarkedText::subdivideAndResolve):
(WebCore::coalesceAdjacent):
(WebCore::StyledMarkedText::coalesceAdjacentWithEqualBackground):
(WebCore::StyledMarkedText::coalesceAdjacentWithEqualForeground):
(WebCore::StyledMarkedText::coalesceAdjacentWithEqualDecorations):
* rendering/StyledMarkedText.h: Renamed from Source/WebCore/rendering/MarkedTextStyle.h.
2021-08-19 Simon Fraser <simon.fraser@apple.com>
Use an OptionSet<MapCoordinatesMode> in place of MapCoordinatesFlags
https://bugs.webkit.org/show_bug.cgi?id=229170
Reviewed by Antti Koivisto.
Replace MapCoordinatesFlags with OptionSet<MapCoordinatesMode>. No behavior
change.
* html/HTMLAnchorElement.cpp:
(WebCore::appendServerMapMousePosition):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::mapLocalToContainer const):
(WebCore::RenderBox::mapAbsoluteToLocalPoint const):
* rendering/RenderBox.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::mapAbsoluteToLocalPoint const):
* rendering/RenderBoxModelObject.h:
* rendering/RenderFragmentedFlow.cpp:
(WebCore::RenderFragmentedFlow::mapLocalToContainer const):
* rendering/RenderFragmentedFlow.h:
* rendering/RenderGeometryMap.cpp:
(WebCore::RenderGeometryMap::RenderGeometryMap):
(WebCore::RenderGeometryMap::pushMappingsToAncestor):
* rendering/RenderGeometryMap.h:
(WebCore::RenderGeometryMap::mapCoordinatesFlags const):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::mapLocalToContainer const):
* rendering/RenderInline.h:
* rendering/RenderMultiColumnFlow.cpp:
(WebCore::RenderMultiColumnFlow::mapAbsoluteToLocalPoint const):
* rendering/RenderMultiColumnFlow.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::absoluteBoundingBoxRect const):
(WebCore::RenderObject::localToAbsolute const):
(WebCore::RenderObject::absoluteToLocal const):
(WebCore::RenderObject::absoluteToLocalQuad const):
(WebCore::RenderObject::mapLocalToContainer const):
(WebCore::RenderObject::mapAbsoluteToLocalPoint const):
(WebCore::RenderObject::localToContainerQuad const):
(WebCore::RenderObject::localToContainerPoint const):
* rendering/RenderObject.h:
(WebCore::RenderObject::localToAbsolute):
(WebCore::RenderObject::absoluteToLocal):
(WebCore::RenderObject::localToAbsoluteQuad const):
* rendering/RenderObjectEnums.h:
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::volumeSliderOffsetFromMuteButton const):
* rendering/RenderView.cpp:
(WebCore::RenderView::mapLocalToContainer const):
(WebCore::RenderView::mapAbsoluteToLocalPoint const):
* rendering/RenderView.h:
* rendering/svg/RenderSVGForeignObject.cpp:
(WebCore::RenderSVGForeignObject::mapLocalToContainer const):
* rendering/svg/RenderSVGForeignObject.h:
* rendering/svg/RenderSVGInline.cpp:
(WebCore::RenderSVGInline::mapLocalToContainer const):
* rendering/svg/RenderSVGInline.h:
* rendering/svg/RenderSVGModelObject.cpp:
(WebCore::RenderSVGModelObject::mapLocalToContainer const):
* rendering/svg/RenderSVGModelObject.h:
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::mapLocalToContainer const):
* rendering/svg/RenderSVGRoot.h:
* rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::mapLocalToContainer const):
* rendering/svg/RenderSVGText.h:
* rendering/svg/SVGRenderSupport.cpp:
(WebCore::SVGRenderSupport::mapLocalToContainer):
2021-08-19 Simon Fraser <simon.fraser@apple.com>
Remove duplicate LayerTreeAsText enums and use an OptionSet<>
https://bugs.webkit.org/show_bug.cgi?id=229226
Reviewed by Antti Koivisto.
GraphicsLayerClient had enum LayerTreeAsTextBehaviorFlags and Frame had an anonymous
enum and typedef unsigned LayerTreeFlags. Clean up by adding LayerTreeAsTextOptions.h
and using OptionSet<LayerTreeAsTextOptions> everywhere.
* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* page/Frame.h:
* page/PageOverlayController.cpp:
(WebCore::PageOverlayController::shouldSkipLayerInDump const):
* page/PageOverlayController.h:
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::dumpLayer const):
(WebCore::dumpChildren):
(WebCore::GraphicsLayer::dumpProperties const):
(WebCore::GraphicsLayer::layerTreeAsText const):
(showGraphicsLayerTree):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::dumpLayer):
(WebCore::GraphicsLayer::layerTreeAsText):
(WebCore::GraphicsLayer::dumpAdditionalProperties const):
* platform/graphics/GraphicsLayerClient.h:
(WebCore::GraphicsLayerClient::shouldSkipLayerInDump const):
(WebCore::GraphicsLayerClient::shouldDumpPropertyForLayer const):
* platform/graphics/LayerTreeAsTextOptions.h: Added.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::dumpAdditionalProperties const):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::dumpInnerLayer):
(WebCore::CoordinatedGraphicsLayer::dumpAdditionalProperties const):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::shouldSkipLayerInDump const):
(WebCore::RenderLayerBacking::shouldDumpPropertyForLayer const):
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerTreeAsText):
* rendering/RenderLayerCompositor.h:
* testing/Internals.cpp:
(WebCore::toLayerTreeAsTextOptions):
(WebCore::Internals::layerTreeAsText const):
(WebCore::Internals::pageOverlayLayerTreeAsText const):
(WebCore::toLayerTreeFlags): Deleted.
* testing/MockPageOverlayClient.cpp:
(WebCore::MockPageOverlayClient::layerTreeAsText):
* testing/MockPageOverlayClient.h:
2021-08-19 Simon Fraser <simon.fraser@apple.com>
Use an enum for the forVisitedLink argument to BuilderState::colorFromPrimitiveValue()
https://bugs.webkit.org/show_bug.cgi?id=229224
Reviewed by Alex Christensen.
Convert the bool argument to an enum class.
* css/makeprop.pl:
(colorFromPrimitiveValue):
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueCaretColor):
(WebCore::Style::BuilderCustom::applyValueStrokeColor):
* style/StyleBuilderState.cpp:
(WebCore::Style::BuilderState::colorFromPrimitiveValue const):
* style/StyleBuilderState.h:
2021-08-19 Youenn Fablet <youenn@apple.com>
RTCPeerConnection::m_transceiverSet does not need to be allocated separately from its RTCPeerConnection
https://bugs.webkit.org/show_bug.cgi?id=229183
Reviewed by Eric Carlson.
No change of behavior.
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::addTrack):
(WebCore::RTCPeerConnection::removeTrack):
(WebCore::RTCPeerConnection::getStats):
(WebCore::RTCPeerConnection::doClose):
(WebCore::RTCPeerConnection::addInternalTransceiver):
(WebCore::RTCPeerConnection::getSenders const):
(WebCore::RTCPeerConnection::getReceivers const):
(WebCore::RTCPeerConnection::getTransceivers const):
* Modules/mediastream/RTCPeerConnection.h:
2021-08-19 Tim Nguyen <ntim@apple.com>
Port HTMLDetailsElement to use modern event handling code
https://bugs.webkit.org/show_bug.cgi?id=228863
Reviewed by Antti Koivisto.
No behaviour change, follows: https://html.spec.whatwg.org/#details-notification-task-steps
* html/HTMLDetailsElement.cpp:
(WebCore::HTMLDetailsElement::parseAttribute):
(WebCore::HTMLDetailsElement::toggleOpen):
(WebCore::detailToggleEventSender): Deleted.
(WebCore::HTMLDetailsElement::~HTMLDetailsElement): Deleted.
(WebCore::HTMLDetailsElement::dispatchPendingEvent): Deleted.
* html/HTMLDetailsElement.h:
2021-08-19 Tim Nguyen <ntim@apple.com>
Implement ::backdrop pseudo element
https://bugs.webkit.org/show_bug.cgi?id=227801
Reviewed by Antti Koivisto.
This adds UA styles, RenderTreeBuilder support and WebInspector support for ::backdrop.
Some imported blink tests now start passing, some still need proper top layer support.
* css/CSSSelector.cpp:
(WebCore::CSSSelector::pseudoId):
* css/CSSSelector.h:
* css/SelectorPseudoElementTypeMap.in:
* css/dialog.css:
(dialog::backdrop):
(::backdrop):
* inspector/agents/InspectorCSSAgent.cpp:
(WebCore::protocolValueForPseudoId):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::backdropRenderer const):
(WebCore::RenderElement::setBackdropRenderer):
* rendering/RenderElement.h:
* rendering/RenderObject.h:
* rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<):
* rendering/style/RenderStyleConstants.h:
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::destroyAndCleanUpAnonymousWrappers):
* rendering/updating/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::updateAfterDescendants):
* rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
(WebCore::RenderTreeUpdater::GeneratedContent::updateBackdropRenderer):
* rendering/updating/RenderTreeUpdaterGeneratedContent.h:
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolvePseudoStyle):
2021-08-19 Carlos Garcia Campos <cgarcia@igalia.com>
document.hasFocus() returns true for unfocused pages
https://bugs.webkit.org/show_bug.cgi?id=229139
Reviewed by Adrian Perez de Castro.
We are always claiming to be focused when the document in the active window even if the page is not actually
focused.
* dom/Document.cpp:
(WebCore::Document::hasFocus const): Check also that page is focused.
2021-08-19 Youenn Fablet <youenn@apple.com>
Rename MediaPlayer::setVisible to MediaPlayer::setPageIsVisible
https://bugs.webkit.org/show_bug.cgi?id=228837
<rdar://problem/81857023>
Reviewed by Eric Carlson.
No change of behavior, just renaming a method to make its name more accurate.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::visibilityStateChanged):
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::loadWithNextMediaEngine):
(WebCore::MediaPlayer::setPageIsVisible):
(WebCore::MediaPlayer::setVisible): Deleted.
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::setVisibleForCanvas):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::setPageIsVisible):
(WebCore::MediaPlayerPrivateAVFoundation::setVisible): Deleted.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPageIsVisible):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVisible): Deleted.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setPageIsVisible):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVisible): Deleted.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* platform/graphics/holepunch/MediaPlayerPrivateHolePunch.h:
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::MediaPlayerPrivateMediaFoundation::setPageIsVisible):
(WebCore::MediaPlayerPrivateMediaFoundation::setVisible): Deleted.
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
* platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
(WebCore::MockMediaPlayerMediaSource::setPageIsVisible):
(WebCore::MockMediaPlayerMediaSource::setVisible): Deleted.
* platform/mock/mediasource/MockMediaPlayerMediaSource.h:
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::willBeDestroyed):
(WebCore::RenderVideo::updatePlayer):
2021-08-19 Youenn Fablet <youenn@apple.com>
RTCRtpTransceiver does not need an ice transport
https://bugs.webkit.org/show_bug.cgi?id=229186
Reviewed by Eric Carlson.
No change of behavior, we are removing a member from RTCRtpTransceiver which is unused.
We are also updating RTCIceTransport as it does not need to have virtual methods yet.
* Modules/mediastream/RTCIceTransport.cpp:
(WebCore::RTCIceTransport::~RTCIceTransport):
* Modules/mediastream/RTCIceTransport.h:
* Modules/mediastream/RTCIceTransport.idl:
* Modules/mediastream/RTCRtpTransceiver.cpp:
(WebCore::RTCRtpTransceiver::RTCRtpTransceiver):
* Modules/mediastream/RTCRtpTransceiver.h:
2021-08-19 Youenn Fablet <youenn@apple.com>
Add support for RTCDtlsTransport
https://bugs.webkit.org/show_bug.cgi?id=229133
Reviewed by Eric Carlson.
RTCDtlsTransport is an object representing the transport used by RTCRtp senders and receivers.
Add WebIDL and backend implementation.
In particular, we set sender/receiver transports as per spec when setting the descriptions.
Add support for state and certificates access. Add support for statechange event.
Covered by rebased tests.
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
(WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
* Modules/mediastream/PeerConnectionBackend.h:
* Modules/mediastream/RTCDtlsTransport.cpp: Added.
(WebCore::RTCDtlsTransport::RTCDtlsTransport):
(WebCore::RTCDtlsTransport::~RTCDtlsTransport):
(WebCore::RTCDtlsTransport::getRemoteCertificates):
(WebCore::RTCDtlsTransport::stop):
(WebCore::RTCDtlsTransport::virtualHasPendingActivity const):
(WebCore::RTCDtlsTransport::onStateChanged):
(WebCore::RTCDtlsTransport::onError):
* Modules/mediastream/RTCDtlsTransport.h: Added.
* Modules/mediastream/RTCDtlsTransport.idl: Added.
* Modules/mediastream/RTCDtlsTransportBackend.h: Added.
(WebCore::operator==):
* Modules/mediastream/RTCDtlsTransportState.h: Added.
* Modules/mediastream/RTCDtlsTransportState.idl: Added.
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::getOrCreateDtlsTransport):
(WebCore::RTCPeerConnection::updateTransceiverTransports):
(WebCore::RTCPeerConnection::updateTransceiversAfterSuccessfulLocalDescription):
(WebCore::RTCPeerConnection::updateTransceiversAfterSuccessfulRemoteDescription):
* Modules/mediastream/RTCPeerConnection.h:
* Modules/mediastream/RTCRtpReceiver.cpp:
* Modules/mediastream/RTCRtpReceiver.h:
* Modules/mediastream/RTCRtpReceiver.idl:
* Modules/mediastream/RTCRtpReceiverBackend.h:
* Modules/mediastream/RTCRtpSender.cpp:
* Modules/mediastream/RTCRtpSender.h:
* Modules/mediastream/RTCRtpSender.idl:
* Modules/mediastream/RTCRtpSenderBackend.h:
* Modules/mediastream/libwebrtc/LibWebRTCDtlsTransportBackend.cpp: Added.
(WebCore::toRTCDtlsTransportState):
(WebCore::LibWebRTCDtlsTransportBackendObserver::LibWebRTCDtlsTransportBackendObserver):
(WebCore::LibWebRTCDtlsTransportBackendObserver::updateState):
(WebCore::LibWebRTCDtlsTransportBackendObserver::start):
(WebCore::LibWebRTCDtlsTransportBackendObserver::stop):
(WebCore::LibWebRTCDtlsTransportBackendObserver::OnStateChange):
(WebCore::LibWebRTCDtlsTransportBackendObserver::OnError):
(WebCore::LibWebRTCDtlsTransportBackend::LibWebRTCDtlsTransportBackend):
(WebCore::LibWebRTCDtlsTransportBackend::~LibWebRTCDtlsTransportBackend):
(WebCore::LibWebRTCDtlsTransportBackend::registerClient):
(WebCore::LibWebRTCDtlsTransportBackend::unregisterClient):
* Modules/mediastream/libwebrtc/LibWebRTCDtlsTransportBackend.h: Added.
* Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.cpp:
(WebCore::LibWebRTCRtpReceiverBackend::rtpDtlsTransportBackend):
* Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h:
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
(WebCore::LibWebRTCRtpSenderBackend::rtpDtlsTransportBackend):
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
* Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
* Modules/mediastream/libwebrtc/LibWebRTCUtils.h:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* dom/EventTargetFactory.in:
2021-08-18 David Kilzer <ddkilzer@apple.com>
Bug 229264: Leak of CMBufferQueueRef (up to 752 bytes each) in com.apple.WebKit.GPU.Development process
<https://webkit.org/b/229264>
<rdar://problem/82101153>
Reviewed by Anders Carlsson.
Covered by running layout tests with --leaks plus future patch
to check for leaks in the GPU process.
* platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm:
(WebCore::VideoSampleBufferCompressor::initialize):
- Use adoptCF() to fix the leak since CMBufferQueueCreate()
returns a retained object.
2021-08-18 David Kilzer <ddkilzer@apple.com>
Leak of CMSampleBufferRef (up to 2.25 KB each) in com.apple.WebKit.GPU.Development process
<https://webkit.org/b/229262>
<rdar://problem/82076765>
Reviewed by Darin Adler.
Covered by running layout tests with --leaks plus future patch
to check for leaks in the GPU process.
* platform/mediarecorder/cocoa/AudioSampleBufferCompressor.h:
(WebCore::AudioSampleBufferCompressor::sampleBufferWithNumPackets):
- Update signature to return RetainPtr<CMSampleBufferRef>.
* platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm:
(WebCore::AudioSampleBufferCompressor::sampleBufferWithNumPackets):
- Update signature to return RetainPtr<CMSampleBufferRef>.
- Rename `sampleBuffer` to `rawSampleBuffer` to match similar
pattern used in other code, then use `sampleBuffer` to store
`rawSampleBuffer` wrapped in a RetainPtr<>.
(WebCore::AudioSampleBufferCompressor::processSampleBuffersUntilLowWaterTime):
- Add get() to `buffer` variable since it is now a RetainPtr<>.
2021-08-18 Chris Dumez <cdumez@apple.com>
Unreviewed, reverting r281206.
Reverting because of branching, will re-land soon
Reverted changeset:
"Implement Crypto.randomUUID()"
https://bugs.webkit.org/show_bug.cgi?id=229240
https://commits.webkit.org/r281206
2021-08-18 Chris Dumez <cdumez@apple.com>
Implement Crypto.randomUUID()
https://bugs.webkit.org/show_bug.cgi?id=229240
Reviewed by Geoffrey Garen.
Implement Crypto.randomUUID():
- https://wicg.github.io/uuid/#extensions-to-the-crypto-interface
Chrome already implements this and Firefox seems to be working on it
(https://bugzilla.mozilla.org/show_bug.cgi?id=1705264).
No new tests, rebaselined existing tests.
* page/Crypto.cpp:
(WebCore::Crypto::randomUUID const):
* page/Crypto.h:
* page/Crypto.idl:
2021-08-18 Andres Gonzalez <andresg_22@apple.com>
Add layout test for WebAccessibilityObjectWrapper handler for attribute AXLineForTextMarker on MacOS.
https://bugs.webkit.org/show_bug.cgi?id=229220
<rdar://problem/82057459>
Reviewed by Chris Fleizach.
Test: accessibility/mac/line-index-for-textmarker.html
There was not a layout test that exercised directly the handler for the
AXLineForTextMarker attribute in [WebAccessibilityObjectWrapper
accessibilityAttributeValue:withParameter:].
This patch adds the above test to exercise this method for textarea and
contenteditable elements. The text in these elements includes soft and
hard linebreaks, which are important test cases for this API.
The handler for AXLineForTextMarker in turn calls
AccessibilityObject::lineForPosition, and analyzing this method, made a
minor optimization by getting rid off of an unnecessary local variable
and object copy.
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::lineForPosition const):
2021-08-18 Simon Fraser <simon.fraser@apple.com>
Update feature statuses in features.json
https://bugs.webkit.org/show_bug.cgi?id=229212
Reviewed by Wenson Hsieh.
Update the status of various features in features.json to reflect their current state.
Remove `"enabled-by-default": true` from features that are marked as Supported.
* features.json:
2021-08-18 Megan Gardner <megan_gardner@apple.com>
Add Highlight API to features.json
https://bugs.webkit.org/show_bug.cgi?id=208226
Reviewed by Simon Fraser.
* features.json:
2021-08-18 Jer Noble <jer.noble@apple.com>
REGRESSION(r280723): Protected HLS + EME playback fails with "temporary error"
https://bugs.webkit.org/show_bug.cgi?id=229201
<rdar://81807216>
Reviewed by Eric Carlson.
In r280723, we stopped unconditionally creating an AVPlayerLayer when we create an AVPlayer. However,
we will still create an AVPlayerItemVideoOutput when we create an AVPlayerItem. This leaves our
AVPlayer in a state where AVFoundation will throw a "temporary error; try again later" when given
an otherwise valid protected HLS stream and key data through EME.
To work around this behavior, delay creating the AVPlayerItemVideoOutput until explicitly told to
create video renderers, typically simultaneous to creating an AVPlayerLayer.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
2021-08-18 Martin Robinson <mrobinson@webkit.org>
[css-scroll-snap] Don't snap to offscreen snap areas in unidirectional scrolls
https://bugs.webkit.org/show_bug.cgi?id=227949
<rdar://problem/80895783>
Reviewed by Frédéric Wang.
No new tests. This is covered by two existing WPT tests.
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::componentForAxis): Added this helper.
(WebCore::hasCompatibleSnapArea): Added this helper that checks to see if any of the snap areas
at a given scroll snap position are compatible with the viewport.
(WebCore::adjustPreviousAndNextForOnscreenSnapAreas): Adjusts the selected previous and next snap
positions by looking backward and forward for the first compatible snap position.
(WebCore::closestSnapOffsetWithInfoAndAxis): Use the new helper.
2021-08-18 Chris Dumez <cdumez@apple.com>
Crash under JSIntersectionObserverCallback::handleEvent()
https://bugs.webkit.org/show_bug.cgi?id=229196
<rdar://82016054>
Reviewed by Geoffrey Garen.
Early return in IntersectionObserver::notify() if the callback has already been destroyed.
This is not supposed to happen as we're supposed to be keeping the JSIntersectionObserver
wrapper alive as long as the IntersectionObserver may fire events, which should keep the
callback alive too. However, despite Ryosuke's fix in r280549, the crash is still happening
in the wild. To address the crash, I am simply doing an early return for now, similarly to
what we already do in MutationObserver::deliver(), while keeping a debug assertion around
in hope of finding the root cause at some point.
No new tests, we do not not how this is happening yet.
* page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::notify):
2021-08-18 Martin Robinson <mrobinson@webkit.org>
position: sticky with display: inline-block
https://bugs.webkit.org/show_bug.cgi?id=224415
<rdar://problem/76811968>
Reviewed by Simon Fraser.
Improve sticky positioning applied to inline items. The first improvement is to
skip anonymous RenderBlock parents of inline display items when looking for the
containing block used to calculate sticky constraints. These anonymous parents
are not the containing block that constrains the movement of these kind of stickily
positioned items. Instead look for containing block for the anonymous parent,
which does limit the scroll boundaries of inline stickily position items.
Previously, when converting the frame rect from the coordinate space of the stickily
positioned item to that of the scrolling container, the code used to apply the offset
from the containing block to the scrolling ancestor directly to the frame rect. That
doesn't work when the containing block that determines sticky constraints is not the
direct containing block of the stickily positioned items (as it is for inlines).
Instead, the code now just maps the frame rect directly from the item parent to
the scrolling ancestor. This simplifies things a bit and allows it to work with
inline stickily positioned items.
Finally, this change adds comments to make it clearer what this method is doing.
No new tests. This is covered by existing WPT tests. Specifically the following
tests are now passing:
imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-hyperlink.html
imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-nested-table.html
imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-parts.html
imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-th-bottom.html
imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-nested-thead-th.html
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::positionOffsetValue): enclosingClippingBoxForStickyPosition now returns a pair
to avoid passing in a pointer. Only look at the first part of the pair here.
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::computeStickyPositionConstraints const): Modified this method
to return a pair in order to avoid dealing with input parameters. This allows simplifying this
method, making the code a bit simpler.
(WebCore::RenderBoxModelObject::enclosingClippingBoxForStickyPosition const): Deleted.
(WebCore::RenderBoxModelObject::computeStickyPositionConstraints const): Make two changes
to this method to improve sticky positioning for inline elements. The first change is
to be a bit better about finding the appropriate containing block for calculating sticky
constraints. The second is to more resiliently move from coordinate systems. In addition,
improve the comments for this method to make it clearer what is happening at each step.
* rendering/RenderBoxModelObject.h: Updated method declaration.
2021-08-18 Xabier Rodriguez Calvar <calvaris@igalia.com>
[GStreamer][EME] Try to parse XML init datas that could possibly come from MPD manifests
https://bugs.webkit.org/show_bug.cgi?id=229145
Reviewed by Alicia Boya Garcia.
Added GStreamerEMEUtilities to include implementation of
InitData::extractCencIfNeeded. This tries to parse the possible
XML inside an init data that could come from MPD manifests. If it
succeeds, it keeps the parsed init data, if not, it returns the
original one.
Based on a patch by Philippe Normand.
* platform/GStreamer.cmake:
* platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp: Added.
(WebCore::markupStartElement):
(WebCore::markupEndElement):
(WebCore::markupText):
(WebCore::markupPassthrough):
(WebCore::markupError):
(WebCore::InitData::extractCencIfNeeded):
* platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
(WebCore::InitData::InitData):
2021-08-17 Devin Rousso <drousso@apple.com>
Web Inspector: match the undocked tab bar style when docked bottom/side
https://bugs.webkit.org/show_bug.cgi?id=212398
Reviewed by Timothy Hatcher.
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::platformVersionName const):
Add macOS Monterey.
2021-08-17 Jer Noble <jer.noble@apple.com>
De-duplicate the Cocoa-specific MediaPlayerPrivateRemote constructor
https://bugs.webkit.org/show_bug.cgi?id=229193
Reviewed by Eric Carlson.
Don't include a Objective-C header in a file which will be included by C++ source; forward-declare
the class instead.
* platform/graphics/avfoundation/objc/VideoLayerManagerObjC.h:
* platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm:
2021-08-17 Alex Christensen <achristensen@webkit.org>
Document load events should update timing in PerformanceNavigationTiming even after its instantiation
https://bugs.webkit.org/show_bug.cgi?id=229181
Reviewed by Chris Dumez.
When we make a PerformanceNavigationTiming object, we copy the DocumentLoadTiming and DocumentEventTiming values.
If PerformanceNavigationTiming is accessed before the document has finished loading, we still need to update the timing values.
Covered by a newly passing WPT test, which Chrome and Firefox already pass.
* dom/Document.cpp:
(WebCore::Document::documentEventTimingFromNavigationTiming):
(WebCore::Document::setReadyState):
(WebCore::Document::finishedParsing):
* dom/Document.h:
* loader/DocumentLoadTiming.h:
(WebCore::DocumentLoadTiming::setLoadEventStart):
(WebCore::DocumentLoadTiming::setLoadEventEnd):
(WebCore::DocumentLoadTiming::markLoadEventStart): Deleted.
(WebCore::DocumentLoadTiming::markLoadEventEnd): Deleted.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::dispatchLoadEvent):
* page/Performance.h:
* page/PerformanceNavigationTiming.h:
2021-08-17 Antti Koivisto <antti@apple.com>
Incorrect repaint when inline level box style change triggers line height change
https://bugs.webkit.org/show_bug.cgi?id=229140
<rdar://problem/81980863>
Reviewed by Alan Bujtas.
If an existing block shrinks vertically as a result of layout we fail to invalidate the
old content area for repaint, thus potentially leaving painting artefacts behind.
This is often hidden by the content shift triggering other repaints.
Test: fast/repaint/line-layout-block-shrink.html
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutModernLines):
Adjust the repaint area to include the content size before the layout.
2021-08-17 Philippe Normand <pnormand@igalia.com>
REGRESSION(r218083): [GStreamer] webrtc unexpected failures
https://bugs.webkit.org/show_bug.cgi?id=229187
Reviewed by Xabier Rodriguez-Calvar.
The stream-collection messages actually don't need to be handled synchronously in the
mediastream cases. The limitations of the MSE backend do not apply there.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::handleStreamCollectionMessage):
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
2021-08-17 Jean-Yves Avenard <jya@apple.com>
Implement API to ensure MediaRemote key mapping is correct
https://bugs.webkit.org/show_bug.cgi?id=229070
<rdar://problem/81894480>
Reviewed by Eric Carlson.
This change adds Internals entries to test bug 229068.
While we do not mock the MediaRemote service, we still go one step further in
ensuring that the mappings between MediaSession action handlers and
PlatformMediaSession are correct.
Test: media/media-session/actionHandlerInternalMappings.html
* platform/NowPlayingManager.cpp:
(WebCore::NowPlayingManager::supportedCommands const):
* platform/NowPlayingManager.h:
* platform/audio/PlatformMediaSession.h:
* platform/audio/PlatformMediaSessionManager.h:
(WebCore::PlatformMediaSessionManager::supportedCommands const):
* platform/audio/cocoa/MediaSessionManagerCocoa.h:
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::supportedCommands const):
* testing/Internals.cpp:
(WebCore::Internals::platformSupportedCommands const):
* testing/Internals.h:
* testing/Internals.idl:
2021-08-17 Philippe Normand <pnormand@igalia.com>
REGRESSION(r278981): [GStreamer][Debug] Assert crashes when running media/track tests
https://bugs.webkit.org/show_bug.cgi?id=229123
<rdar://problem/81978494>
Reviewed by Xabier Rodriguez-Calvar.
Implement a dummy id() method for InbandTextTrackPrivateGStreamer.
* platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
(WebCore::InbandTextTrackPrivateGStreamer::InbandTextTrackPrivateGStreamer):
* platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
2021-08-17 Jer Noble <jer.noble@apple.com>
LayoutTests imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-* are flakey
https://bugs.webkit.org/show_bug.cgi?id=229169
Reviewed by Eric Carlson.
When a data:// URL is passed to AVFoundation, the loading of that URL is handled by WebCoreAVFResourceLoader,
which in turn relies on a PlatformMediaResourceLoader to turn the data URL into a data buffer. However, in the
case of the GPU process, this means dispatching the request from GPU, to WebContent, to Network process and to
send the data back from the Network, to WebContent, to GPU process. If a synchronous operation (like painting)
is underway, the data response can block until that synchronous operation completes. If that operation is a
paint, and the data requested is required to complete that paint, the paint will fail.
For the narrow case of a data:// URL, it's not necessary to dispatch to another process to turn that URL into
data; it can happen locally, avoiding the hop to another process and the subsequent deadlock.
* platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
(WebCore::WebCoreAVFResourceLoader::logger const):
* platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
(WebCore::DataURLResourceMediaLoader::DataURLResourceMediaLoader):
(WebCore::WebCoreAVFResourceLoader::~WebCoreAVFResourceLoader):
(WebCore::WebCoreAVFResourceLoader::startLoading):
2021-08-16 Antti Koivisto <antti@apple.com>
REGRESSION (r275756): Accelerated animations freeze when invalidating layout with shadow dom
https://bugs.webkit.org/show_bug.cgi?id=228954
<rdar://problem/81750217>
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-08-16 Devin Rousso <drousso@apple.com>
Web Share CanShare() should be called after transient activation check
https://bugs.webkit.org/show_bug.cgi?id=229132
Reviewed by Tim Horton.
Test: web-platform-tests/web-share/share-consume-activation.https.html
* page/Navigator.cpp:
(WebCore::Navigator::share):
2021-08-16 Alex Christensen <achristensen@webkit.org>
Report resource timing when SubresourceLoader::checkForHTTPStatusCodeError returns true
https://bugs.webkit.org/show_bug.cgi?id=229167
Reviewed by Chris Dumez.
Since r281110 we report timing data for loads which "fail" because of HTTP status codes in the 400-599 range.
This matches the behavior of Chrome, Firefox, and the spec, but there was a code path where we still weren't reporting
those resources' timing data. This wasn't a problem before r281110 because we would've discarded it anyways, but
this code path needs to report the timing data before calling SubresourceLoader::cancel.
Covered by several newly passing WPT tests, which Chrome and Firefox already pass.
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::didReceiveResponse):
(WebCore::SubresourceLoader::checkForHTTPStatusCodeError):
2021-08-16 Dean Jackson <dino@apple.com>
WebXR contexts have to use high-power GPUs
https://bugs.webkit.org/show_bug.cgi?id=229111
<rdar://81658893>
Reviewed by Sam Weinig.
The WebGL context used by WebXR needs to be using the same GPU
as the headset it is talking to. However, the API allows for the
creation of the WebGL context before initializing the WebXR
session.
For now, assume this will trigger the high-performance GPU
on any dual-GPU system. i.e. when the WebGL is created, look
for the "webXRCompatible" creation attribute and force
the high-power GPU if available.
Test: webxr/high-performance.html
* html/canvas/WebGLRenderingContextBase.h: Export the method to retrieve attributes.
* platform/graphics/GraphicsContextGLAttributes.h: Add a flag for forcing the
high performance gpu.
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::InitializeEGLDisplay):
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
* testing/Internals.cpp: New internals method to check what GPU was requested.
(WebCore::Internals::requestedGPU):
* testing/Internals.h:
* testing/Internals.idl:
2021-08-16 Alex Christensen <achristensen@webkit.org>
Fix null crash after r281110
https://bugs.webkit.org/show_bug.cgi?id=225737
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::reportResourceTiming):
I saw a nullptr crash here in EWS from bug 229167.
Looks like there's a case where we can call reportResourceTiming without a resource.
Early return if m_resource is null.
2021-08-16 Alex Christensen <achristensen@webkit.org>
Resource Timing: Duration is 0 in many cases
https://bugs.webkit.org/show_bug.cgi?id=225737
Reviewed by Chris Dumez.
This fixes two problems with our PerformanceResourceTiming implementation:
1. ResourceTimingInformation::shouldAddResourceTiming wasn't adding timing data if CachedResource::errorOccurred returned true,
which includes when the server responds with an HTTP 404. We want loadFailedOrCanceled instead, which only returns true if
there's a network error or if the load is cancelled. This matches the behavior of other browsers.
2. ResourceTiming::fromMemoryCache was assuming that it never had network information to report because we pulled from the cache,
not the network. However, a common case is that HTMLPreloadScanner::scan calls HTMLResourcePreloader::preload which loads the resource
while the HTML parser is blocked on loading scripts or other things, then CachedResourceLoader::requestResource pulls it out of the
memory cache. In this case, use the network metrics that we are already storing if it's the first time we are pulling this resource
out of the memory cache. After that, 0 load time is quite accurate.
Covered by newly passing Web Platform Tests, which Chrome and Firefox already passed.
* loader/ResourceTiming.cpp:
(WebCore::ResourceTiming::fromMemoryCache):
(WebCore::ResourceTiming::ResourceTiming):
(WebCore::ResourceTiming::initServerTiming): Deleted.
* loader/ResourceTiming.h:
(WebCore::ResourceTiming::ResourceTiming):
* loader/ResourceTimingInformation.cpp:
(WebCore::ResourceTimingInformation::shouldAddResourceTiming):
* loader/cache/CachedResource.h:
(WebCore::CachedResource::takeNetworkLoadMetrics):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
* platform/network/ResourceResponseBase.h:
(WebCore::ResourceResponseBase::deprecatedNetworkLoadMetricsOrNull const):
(WebCore::ResourceResponseBase::takeNetworkLoadMetrics):
2021-08-16 Andres Gonzalez <andresg_22@apple.com>
Expose [WebAccessibilityObjectWrapper lineRectsAndText] on MacOS.
https://bugs.webkit.org/show_bug.cgi?id=229045
<rdar://81819301>
Reviewed by Chris Fleizach.
Test: accessibility/element-line-rects-and-text.html
Moved the [WebAccessibilityObjectWrapper lineRectsAndText] method, and
supporting methods and functions, from the iOS subclass to the base
(Cocoa) class so that it can be used in both iOS and MacOS.
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
Moved the following methods and functions to WebAccessibilityObjectWrapperBase.mm.
(-[WebAccessibilityObjectWrapper _prepareAccessibilityCall]): Deleted.
(-[WebAccessibilityObjectWrapper _addAccessibilityObject:toTextMarkerArray:]): Deleted.
(blockquoteLevel): Deleted.
(AXAttributeStringSetLanguage): Deleted.
(AXAttributeStringSetBlockquoteLevel): Deleted.
(AXAttributeStringSetHeadingLevel): Deleted.
(AXAttributeStringSetFont): Deleted.
(AXAttributeStringSetNumber): Deleted.
(AXAttributeStringSetStyle): Deleted.
(AXAttributedStringAppendText): Deleted.
(-[WebAccessibilityObjectWrapper contentForSimpleRange:attributed:]): Deleted.
(-[WebAccessibilityObjectWrapper lineRectsAndText]): Deleted.
* accessibility/mac/WebAccessibilityObjectWrapperBase.h:
* accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
(-[WebAccessibilityObjectWrapperBase _prepareAccessibilityCall]):
(addObjectWrapperToArray):
(blockquoteLevel):
(AXAttributeStringSetLanguage):
(AXAttributeStringSetBlockquoteLevel):
(AXAttributeStringSetHeadingLevel):
(AXAttributeStringSetFont):
(AXAttributeStringSetNumber):
(AXAttributeStringSetStyle):
(AXAttributedStringAppendText):
(-[WebAccessibilityObjectWrapperBase contentForSimpleRange:attributed:]):
(-[WebAccessibilityObjectWrapperBase lineRectsAndText]):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
Added handling of the attribute "AXLineRectsAndText".
2021-08-16 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r281093.
https://bugs.webkit.org/show_bug.cgi?id=229159
broke many GTK media tests
Reverted changeset:
"REGRESSION(r278981): [GStreamer][Debug] Assert crashes when
running media/track tests"
https://bugs.webkit.org/show_bug.cgi?id=229123
https://commits.webkit.org/r281093
2021-08-16 Brent Fulgham <bfulgham@apple.com>
REGRESSION (r281012): WebInspector console no longer shows script integrity information
https://bugs.webkit.org/show_bug.cgi?id=229097
<rdar://problem/81915909>
Reviewed by Youenn Fablet.
* bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::notifyFinished): Add full console message during promise rejection.
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::reportIntegrityMetadataError): Treat integrity mismatch as
a ResourceError::Type::AccessControl so that it gets detailed console logging.
2021-08-16 Philippe Normand <pnormand@igalia.com>
REGRESSION(r278981): [GStreamer][Debug] Assert crashes when running media/track tests
https://bugs.webkit.org/show_bug.cgi?id=229123
Reviewed by Xabier Rodriguez-Calvar.
The TrackPrivateBaseGStreamer class now includes all the common code that is used by its
subclasses. InbandTextTrackPrivateGStreamer now returns valid track IDs (fixing the issue of
this regression: ASSERTs). The patch also includes coding style fixes, removal of un-needed
includes and a few other clean-ups related with the Track support in the GStreamer platform
layer.
* platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
(WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
* platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
* platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
(WebCore::InbandTextTrackPrivateGStreamer::InbandTextTrackPrivateGStreamer):
(WebCore::InbandTextTrackPrivateGStreamer::disconnect): Deleted.
(WebCore::InbandTextTrackPrivateGStreamer::streamChanged): Deleted.
(WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfStreamChanged): Deleted.
* platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
(WebCore::InbandTextTrackPrivateGStreamer::create):
(WebCore::InbandTextTrackPrivateGStreamer::streamId const): Deleted.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfTrack):
(WebCore::MediaPlayerPrivateGStreamer::handleTextSample):
* platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
(WebCore::TrackPrivateBaseGStreamer::generateUniquePlaybin2StreamID):
(WebCore::TrackPrivateBaseGStreamer::TrackPrivateBaseGStreamer):
(WebCore::TrackPrivateBaseGStreamer::setPad):
(WebCore::TrackPrivateBaseGStreamer::notifyTrackOfStreamChanged):
(WebCore::TrackPrivateBaseGStreamer::streamChanged):
* platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
(WebCore::TrackPrivateBaseGStreamer::setIndex):
(WebCore::TrackPrivateBaseGStreamer::stream):
* platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
(WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
* platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
2021-08-16 David Kilzer <ddkilzer@apple.com>
"make analyze" should run clang static analyzer in deep mode
<https://webkit.org/b/229127>
<rdar://problem/81960587>
Reviewed by Alexey Proskuryakov.
* Scripts/generate-derived-sources.sh:
- Treat "analyze" the same as "build" for "ACTION" environment
variable.
2021-08-16 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r281078.
https://bugs.webkit.org/show_bug.cgi?id=229144
broke GTK/WPE mediastream tests
Reverted changeset:
"REGRESSION(r278981): [GStreamer][Debug] Assert crashes when
running media/track tests"
https://bugs.webkit.org/show_bug.cgi?id=229123
https://commits.webkit.org/r281078
2021-08-16 Philippe Normand <pnormand@igalia.com>
[GTK][WPE] Test fast/mediastream/mediastreamtrack-video-clone.html is flaky timeout since r280775
https://bugs.webkit.org/show_bug.cgi?id=229063
Reviewed by Xabier Rodriguez-Calvar.
Ignore redundant stream collections also in the mediastream case. Both the mediastream and
MSE source elements behave similarly regarding stream collections.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::handleStreamCollectionMessage):
2021-08-16 Philippe Normand <pnormand@igalia.com>
REGRESSION(r278981): [GStreamer][Debug] Assert crashes when running media/track tests
https://bugs.webkit.org/show_bug.cgi?id=229123
Reviewed by Xabier Rodriguez-Calvar.
The TrackPrivateBaseGStreamer class now includes all the common code that is used by its
subclasses. InbandTextTrackPrivateGStreamer now returns valid track IDs (fixing the issue of
this regression: ASSERTs). The patch also includes coding style fixes, removal of un-needed
includes and a few other clean-ups related with the Track support in the GStreamer platform
layer.
* platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
(WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
* platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
* platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
(WebCore::InbandTextTrackPrivateGStreamer::InbandTextTrackPrivateGStreamer):
(WebCore::InbandTextTrackPrivateGStreamer::disconnect): Deleted.
(WebCore::InbandTextTrackPrivateGStreamer::streamChanged): Deleted.
(WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfStreamChanged): Deleted.
* platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
(WebCore::InbandTextTrackPrivateGStreamer::create):
(WebCore::InbandTextTrackPrivateGStreamer::streamId const): Deleted.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfTrack):
(WebCore::MediaPlayerPrivateGStreamer::handleTextSample):
* platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
(WebCore::TrackPrivateBaseGStreamer::generateUniquePlaybin2StreamID):
(WebCore::TrackPrivateBaseGStreamer::TrackPrivateBaseGStreamer):
(WebCore::TrackPrivateBaseGStreamer::setPad):
(WebCore::TrackPrivateBaseGStreamer::notifyTrackOfStreamChanged):
(WebCore::TrackPrivateBaseGStreamer::streamChanged):
* platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
(WebCore::TrackPrivateBaseGStreamer::setIndex):
(WebCore::TrackPrivateBaseGStreamer::stream):
* platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
(WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
* platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
2021-08-16 Carlos Garcia Campos <cgarcia@igalia.com>
Move WebMAudioUtilitiesCocoa.h from Headers.cmake to PlatformMac.cmake
https://bugs.webkit.org/show_bug.cgi?id=229129
Unreviewed. Fix GTK/WPE distcheck build.
* Headers.cmake:
* PlatformMac.cmake:
2021-08-15 Simon Fraser <simon.fraser@apple.com>
[LFC Display] Make Display::ImageBox a CachedImageClient to get image repaint working
https://bugs.webkit.org/show_bug.cgi?id=229125
Reviewed by Anders Carlsson.
Make Display::ImageBox hold a CachedResourceHandle<CachedImage> so it can register
as a client and get notified about image changes, for repainting.
* display/css/DisplayBoxFactory.cpp:
(WebCore::Display::BoxFactory::displayBoxForLayoutBox const):
* display/css/DisplayImageBox.cpp:
(WebCore::Display::ImageBox::ImageBox):
(WebCore::Display::m_cachedImage):
(WebCore::Display::ImageBox::~ImageBox):
(WebCore::Display::ImageBox::image const):
(WebCore::Display::ImageBox::imageChanged):
(WebCore::Display::ImageBox::debugDescription const):
(WebCore::Display::m_image): Deleted.
* display/css/DisplayImageBox.h:
(WebCore::Display::ImageBox::image const): Deleted.
2021-08-15 David Kilzer <ddkilzer@apple.com>
Bug 229112: ThreadSanitizer: data races of WTF::String in WebResourceLoadStatisticsStore
<https://webkit.org/b/229112>
<rdar://problem/81940951>
Reviewed by Kate Cheney.
Covered by running layout tests with TSan in:
http/tests/privateClickMeasurement/
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::parsePrivateClickMeasurement const):
- Add WTFMove() for updated SourceSite constructor. Verified
that this doesn't create a use-after-move issue.
* loader/PrivateClickMeasurement.h:
(WebCore::PrivateClickMeasurement::SourceSite::SourceSite):
- Change to take rvalue reference for efficiency and to match
AttributionDestinationSite constructor.
(WebCore::PrivateClickMeasurement::SourceSite::isolatedCopy const): Add.
(WebCore::PrivateClickMeasurement::AttributionDestinationSite::isolatedCopy const): Add.
- Add isolatedCopy() methods to use in multi-threaded scenarios.
2021-08-15 Rob Buis <rbuis@igalia.com>
Remove shadow related SVG functionality
https://bugs.webkit.org/show_bug.cgi?id=228870
Reviewed by Simon Fraser.
Remove shadow related SVG functionality since it was added
for the removed property -webkit-svg-shadow (see r238071).
* rendering/style/SVGRenderStyle.cpp:
(WebCore::SVGRenderStyle::SVGRenderStyle):
(WebCore::SVGRenderStyle::operator== const):
(WebCore::SVGRenderStyle::copyNonInheritedFrom):
(WebCore::SVGRenderStyle::diff const):
* rendering/style/SVGRenderStyle.h:
(WebCore::SVGRenderStyle::initialLightingColor):
(WebCore::SVGRenderStyle::baselineShiftValue const):
(WebCore::SVGRenderStyle::isolatesBlending const):
(WebCore::SVGRenderStyle::initialShadow): Deleted.
(WebCore::SVGRenderStyle::setShadow): Deleted.
(WebCore::SVGRenderStyle::shadow const): Deleted.
* rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::layout):
* rendering/svg/RenderSVGImage.h:
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::computeFloatVisibleRectInContainer const):
(WebCore::RenderSVGRoot::updateCachedBoundaries):
* rendering/svg/RenderSVGRoot.h:
* rendering/svg/SVGRenderSupport.cpp:
(WebCore::SVGRenderSupport::clippedOverflowRectForRepaint):
(WebCore::SVGRenderSupport::computeFloatVisibleRectInContainer):
* rendering/svg/SVGRenderingContext.cpp:
(WebCore::SVGRenderingContext::~SVGRenderingContext):
(WebCore::SVGRenderingContext::prepareToRenderSVGContent):
* rendering/svg/SVGRenderingContext.h:
2021-08-15 Simon Fraser <simon.fraser@apple.com>
[LFC Display] Introduce type-safe rect types for the display tree
https://bugs.webkit.org/show_bug.cgi?id=220214
Reviewed by Alan Bujtas.
Introduce AbsoluteFloatRect, UnadjustedAbsoluteFloatRect and ViewFloatRect which are
type-safe float rect types for the display tree.
AbsoluteFloatRect is relative to document origin. UnadjustedAbsoluteFloatRect is similar,
but is computed before scrolling and transforms are taken into account.
ViewFloatRect is relative to the view.
* WebCore.xcodeproj/project.pbxproj:
* display/DisplayGeometryTypes.h: Copied from Source/WebCore/display/css/DisplayReplacedBox.h.
(WebCore::Display::intersection):
(WebCore::Display::unionRect):
* display/DisplayTree.cpp:
(WebCore::Display::Tree::setBoxNeedsDisplay const):
* display/DisplayTree.h:
* display/DisplayTreeBuilder.cpp:
* display/css/DisplayBox.cpp:
(WebCore::Display::Box::Box):
(WebCore::Display::Box::setNeedsDisplay):
* display/css/DisplayBox.h:
(WebCore::Display::Box::Box):
(WebCore::Display::Box::absoluteBoxRect const):
(WebCore::Display::Box::absolutePaintingExtent const):
* display/css/DisplayBoxClip.cpp:
(WebCore::Display::BoxClip::pushClip):
(WebCore::Display::BoxClip::pushRoundedClip):
* display/css/DisplayBoxClip.h:
(WebCore::Display::BoxClip::clipRect const):
* display/css/DisplayBoxDecorationPainter.cpp:
(WebCore::Display::BoxDecorationPainter::paintFillLayer const):
* display/css/DisplayBoxFactory.cpp:
(WebCore::Display::BoxFactory::displayBoxForRootBox const):
(WebCore::Display::BoxFactory::displayBoxForLayoutBox const):
(WebCore::Display::BoxFactory::displayBoxForTextRun const):
(WebCore::Display::BoxFactory::setupBoxGeometry const):
* display/css/DisplayBoxModelBox.cpp:
(WebCore::Display::BoxModelBox::BoxModelBox):
(WebCore::Display::BoxModelBox::clipForDescendants const):
(WebCore::Display::BoxModelBox::absolutePaintingExtent const):
* display/css/DisplayBoxModelBox.h:
(WebCore::Display::BoxModelBox::BoxModelBox):
(WebCore::Display::BoxModelBox::absoluteBorderBoxRect const):
(WebCore::Display::BoxModelBox::absolutePaddingBoxRect const):
(WebCore::Display::BoxModelBox::absoluteContentBoxRect const):
(WebCore::Display::BoxModelBox::setAbsolutePaddingBoxRect):
(WebCore::Display::BoxModelBox::setAbsoluteContentBoxRect):
* display/css/DisplayContainerBox.cpp:
(WebCore::Display::ContainerBox::ContainerBox):
* display/css/DisplayContainerBox.h:
* display/css/DisplayImageBox.cpp:
(WebCore::Display::ImageBox::ImageBox):
* display/css/DisplayImageBox.h:
* display/css/DisplayReplacedBox.cpp:
(WebCore::Display::ReplacedBox::ReplacedBox):
* display/css/DisplayReplacedBox.h:
(WebCore::Display::ReplacedBox::replacedContentRect const):
(WebCore::Display::ReplacedBox::setReplacedContentRect):
* display/css/DisplayStackingItem.h:
(WebCore::Display::StackingItem::paintedContentBounds const):
(WebCore::Display::StackingItem::paintedBoundsIncludingDescendantItems const):
(WebCore::Display::StackingItem::setPaintedContentBounds):
(WebCore::Display::StackingItem::setPaintedBoundsIncludingDescendantItems):
* display/css/DisplayTextBox.cpp:
(WebCore::Display::TextBox::TextBox):
* display/css/DisplayTextBox.h:
2021-08-15 Simon Fraser <simon.fraser@apple.com>
[LFC Display] Add a Display::Box flag for HasTransfrom
https://bugs.webkit.org/show_bug.cgi?id=229115
Reviewed by Alan Bujtas.
It's possible for a non-box model box to have a RenderStyle with a transform, but that
style isn't applied because transforms only apply to atomic inline or block boxes,
so store a bit on Box for boxes that have transforms.
* display/css/DisplayBox.h:
(WebCore::Display::Box::setHasTransform):
(WebCore::Display::Box::hasTransform const):
* display/css/DisplayBoxFactory.cpp:
(WebCore::Display::BoxFactory::constructBoxRareGeometry const):
(WebCore::Display::BoxFactory::setupBoxModelBox const):
* display/css/DisplayCSSPainter.cpp:
(WebCore::Display::CSSPainter::paintAtomicallyPaintedBox):
2021-08-14 Said Abou-Hallawa <said@apple.com>
[GPU Process] REGRESSION: WebContent often crashes when opening a Google spreadsheet with charts
https://bugs.webkit.org/show_bug.cgi?id=229106
<rdar://81806877>
Reviewed by Wenson Hsieh.
Add a method to return the backend of the ImageBuffer.
* platform/graphics/ConcreteImageBuffer.h:
* platform/graphics/ImageBuffer.h:
2021-08-13 Chris Dumez <cdumez@apple.com>
Add Cross-Origin-Embedder-Policy support for Blob URLs
https://bugs.webkit.org/show_bug.cgi?id=229041
Reviewed by Alex Christensen.
Add Cross-Origin-Embedder-Policy (COEP) support for Blob URLs. We do the same thing as for COOP,
we pass the COEP policy when registering the Blob URL and store it in the BlobData. When we need
the construct a Blob resource response as a result of a load, we add the right COEP headers
based on the BlobData's COEP policy.
No new tests, rebaselined existing tests.
* Modules/fetch/FetchLoader.cpp:
(WebCore::FetchLoader::startLoadingBlobURL):
* fileapi/Blob.cpp:
(WebCore::BlobURLRegistry::registerURL):
(WebCore::Blob::Blob):
* fileapi/FileReaderLoader.cpp:
(WebCore::FileReaderLoader::start):
* fileapi/ThreadableBlobRegistry.cpp:
(WebCore::ThreadableBlobRegistry::registerBlobURL):
* fileapi/ThreadableBlobRegistry.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::loadResource):
* loader/CrossOriginEmbedderPolicy.cpp:
(WebCore::addCrossOriginEmbedderPolicyHeaders):
* loader/CrossOriginEmbedderPolicy.h:
(WebCore::operator==):
* loader/CrossOriginOpenerPolicy.cpp:
(WebCore::addCrossOriginOpenerPolicyHeaders):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didBeginDocument):
* platform/network/BlobData.h:
(WebCore::BlobData::crossOriginEmbedderPolicy const):
(WebCore::BlobData::setCrossOriginEmbedderPolicy):
* platform/network/BlobRegistry.h:
* platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::registerBlobURL):
(WebCore::BlobRegistryImpl::registerBlobURLOptionallyFileBacked):
* platform/network/BlobRegistryImpl.h:
* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::notifyResponseOnSuccess):
2021-08-13 Brent Fulgham <bfulgham@apple.com>
Unreviewed build fix after r281012
https://bugs.webkit.org/show_bug.cgi?id=228861
Add missing constructor signature when USE(CFURLCONNECTION) is true.
* platform/network/cf/ResourceError.h:
* platform/network/cf/ResourceErrorCF.cpp: Add missing constructor signature.
(WebCore::ResourceError::ResourceError):
2021-08-13 Alex Christensen <achristensen@webkit.org>
Unreviewed, reverting r281009.
Timing not quite right
Reverted changeset:
"Unprefix -webkit-backface-visibility"
https://bugs.webkit.org/show_bug.cgi?id=170983
https://commits.webkit.org/r281009
2021-08-13 Tim Nguyen <ntim@apple.com>
Check for dialog existence in top layer in HTMLDialogElement::showModal & close
https://bugs.webkit.org/show_bug.cgi?id=227907
Reviewed by Antti Koivisto.
Test: imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html
Test expectations are unchanged because the test uses elementFromPoint, meaning that behaviour difference isn't noticeable
until top layer rendering bits are implemented (which would change elementFromPoint's result by shuffling z-order based on top layer elements).
* dom/Element.h:
(WebCore::Element::isInTopLayer const):
* html/HTMLDialogElement.cpp:
(WebCore::HTMLDialogElement::showModal):
(WebCore::HTMLDialogElement::close):
2021-08-13 Jean-Yves Avenard <jya@apple.com>
nexttrack and previoustrack MediaSession handlers not working
https://bugs.webkit.org/show_bug.cgi?id=229068
rdar://80100092
Reviewed by Youenn Fablet.
Map between MediaSession action next/previousTrack and RemoteControlCommandType ones
were inverted.
There is no infrastrure in place to ensure that the right MRMediaRemoteCommand is
used with the MediaRemote backend, which prevents automating the test.
* Modules/mediasession/MediaSession.cpp:
(WebCore::platformCommandForMediaSessionAction):
2021-08-13 Youenn Fablet <youenn@apple.com>
Overly verbose catchable fetch error messages lead to cross-origin leaks
https://bugs.webkit.org/show_bug.cgi?id=228861
Reviewed by Brent Fulgham.
Standardize error messages to get more uniform with other browsers.
To continue supporting service worker errors going to page errors,
we add a boolean to ResourceError to control whether sanitizing the error message or not.
This allows to keep error messages from service worker type exceptions to be exposed in window environments through fetch rejection.
Also handle ScriptModuleLoader since it is doing its own SRI checks.
Covered by rebased tests.
* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::loadingException const):
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::BodyLoader::didFail):
* platform/network/ResourceErrorBase.h:
(WebCore::ResourceErrorBase::sanitizedDescription const):
(WebCore::ResourceErrorBase::isSanitized const):
(WebCore::ResourceErrorBase::setAsSanitized):
(WebCore::ResourceErrorBase::ResourceErrorBase):
* platform/network/cf/ResourceError.h:
(WebCore::ResourceError::ResourceError):
* platform/network/curl/ResourceError.h:
(WebCore::ResourceError::ResourceError):
* platform/network/soup/ResourceError.h:
(WebCore::ResourceError::ResourceError):
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadSynchronously):
* workers/service/FetchEvent.cpp:
(WebCore::FetchEvent::createResponseError):
(WebCore::FetchEvent::respondWith):
(WebCore::FetchEvent::promiseIsSettled):
* workers/service/FetchEvent.h:
* workers/service/context/ServiceWorkerFetch.cpp:
(WebCore::ServiceWorkerFetch::processResponse):
(WebCore::ServiceWorkerFetch::dispatchFetchEvent):
* bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::notifyFinished):
2021-08-13 Sergio Villar Senin <svillar@igalia.com>
Crash in MockMediaSourcePrivate
https://bugs.webkit.org/show_bug.cgi?id=226795
Reviewed by Darin Adler.
The MockMediaPlayerMediaSource uses callOnMainThread() to execute advanceCurrentTime(). It might
happen that the object is destructed before the callback is executed as it isn't a ref counted
object. That leads to a crash on ASAN builds.
Made the object capable of creating weak ptrs so that we could check whether the _this_ object
has been freed in the meantime or not. For the former case we just bail out.
* platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
(WebCore::MockMediaPlayerMediaSource::play): Create a WeakPtr.
(WebCore::MockMediaPlayerMediaSource::seekWithTolerance): Ditto.
(WebCore::MockMediaPlayerMediaSource::seekCompleted): Ditto.
* platform/mock/mediasource/MockMediaPlayerMediaSource.h: inherit from CanMakeWeakPtr.
2021-08-12 Alex Christensen <achristensen@webkit.org>
Unprefix -webkit-backface-visibility
https://bugs.webkit.org/show_bug.cgi?id=170983
Reviewed by Simon Fraser.
This has already been done by Chrome and Firefox.
Keep the prefixed version as an alias.
Test: imported/w3c/web-platform-tests/css/css-transforms/css-transform-property-existence.html
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSProperties.json:
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
(WebCore::CSSParserFastPaths::isKeywordPropertyID):
2021-08-12 Cameron McCormack <heycam@apple.com>
Fix bounds checks for WhitespaceCache string lengths
https://bugs.webkit.org/show_bug.cgi?id=229066
<rdar://81850871>
Reviewed by Simon Fraser.
When the whitespace string length is maximumWhitespaceStringLength,
we read from and write to one element past the end of m_codes and
m_indexes. Since we don't need to store codes and indexes for zero
length strings, subtract one from the index we use.
* html/parser/HTMLConstructionSite.cpp:
(WebCore::WhitespaceCache::lookup):
* html/parser/HTMLConstructionSite.h:
2021-08-12 David Kilzer <ddkilzer@apple.com>
ThreadSanitizer: data race in WebCore::CARingBufferStorageVector::setCurrentFrameBounds() / getCurrentFrameBounds()
<https://webkit.org/b/229014>
<rdar://problem/81817224>
Reviewed by Chris Dumez.
This turned out to be a false-positive since reads and writes
are protected differently, and it's okay if a read returns data
from the ring buffer that is one slot older than the current
write.
Covered by layout tests running with TSan:
fast/mediastream/getUserMedia-webaudio.html
fast/mediastream/mediastreamtrack-audio-clone.html
imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-insertDTMF.https.html
imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-iceConnectionState.https.html
imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-track-stats.https.html
imported/w3c/web-platform-tests/webrtc/protocol/missing-fields.html
webrtc/audio-peer-connection-g722.html
webrtc/audio-peer-connection-webaudio.html
webrtc/audio-replace-track.html
webrtc/peer-connection-audio-mute.html
webrtc/peer-connection-audio-mute2.html
webrtc/peer-connection-createMediaStreamDestination.html
webrtc/peer-connection-remote-audio-mute.html
webrtc/peer-connection-remote-audio-mute2.html
* platform/audio/cocoa/CARingBuffer.cpp:
(WebCore::CARingBufferStorageVector::getCurrentFrameBounds):
(WebCore::CARingBufferStorageVector::currentStartFrame const):
(WebCore::CARingBufferStorageVector::currentEndFrame const):
- Add SUPPRESS_TSAN attribute since reads are protected by
std::atomic<int32_t> m_timeBoundsQueuePtr only being
incremented after the next m_timeBoundsQueue slot is updated.
Writes are potected by
Locker locker { m_currentFrameBoundsLock }.
2021-08-12 Alex Christensen <achristensen@webkit.org>
Unreviewed, reverting r280977.
Seems to have broken a test in debug
Reverted changeset:
"Migrate Performance::resourceTimingBufferFullTimerFired to
HTML event loop"
https://bugs.webkit.org/show_bug.cgi?id=229044
https://commits.webkit.org/r280977
2021-08-12 Alex Christensen <achristensen@webkit.org>
Migrate Performance::resourceTimingBufferFullTimerFired to HTML event loop
https://bugs.webkit.org/show_bug.cgi?id=229044
Reviewed by Geoff Garen.
Covered by existing tests.
There should be no change in behavior.
* page/Performance.cpp:
(WebCore::Performance::Performance):
(WebCore::Performance::addResourceTiming):
(WebCore::Performance::dispatchResourceTimingBufferFullEvent):
(WebCore::Performance::contextDestroyed): Deleted.
(WebCore::Performance::resourceTimingBufferFullTimerFired): Deleted.
* page/Performance.h:
2021-08-12 Jer Noble <jer.noble@apple.com>
[macOS] Enter fullscreen animation interferes with auto-hiding menu bar
https://bugs.webkit.org/show_bug.cgi?id=229039
<rdar://79150656>
Reviewed by Eric Carlson.
Add a new utility method to calculate the available screen rect taking menu bar
hiding into account.
* platform/PlatformScreen.h:
* platform/mac/PlatformScreenMac.mm:
(WebCore::screenRectAvoidingMenuBar):
2021-08-12 Devin Rousso <drousso@apple.com>
Fix some `NSAttributedString` inconsistencies between WK1 and WK2
https://bugs.webkit.org/show_bug.cgi?id=229013
<rdar://problem/81215696>
Reviewed by Timothy Hatcher.
`NSAttributedString` now uses WK2, which has caused us to discover some inconsistencies (and bugs).
Tests: NSAttributedStringWebKitAdditions.DefaultFontSize
NSAttributedStringWebKitAdditions.MultipleParagraphs
* editing/cocoa/HTMLConverter.mm:
(HTMLConverter::_blockLevelElementForNode):
Check the given node before looking at the parent as it could already be a block. This
allows for sequental `<p>` to each have their own positioning instead of only the first one.
(HTMLConverter::computedAttributesForElement):
Fix typo that used `margin-right` instead of `margin-bottom` when setting `paragraphSpacing`.
2021-08-12 Youenn Fablet <youenn@apple.com>
Adopt span in RTCRtpSFrameTransform
https://bugs.webkit.org/show_bug.cgi?id=229029
Reviewed by Eric Carlson.
Transition to Span for improved readability, no change of behavior.
* Modules/mediastream/RTCEncodedFrame.cpp:
(WebCore::RTCEncodedFrame::data const):
* Modules/mediastream/RTCRtpSFrameTransform.cpp:
(WebCore::processFrame):
(WebCore::RTCRtpSFrameTransform::initializeTransformer):
(WebCore::transformFrame):
(WebCore::RTCRtpSFrameTransform::createStreams):
* Modules/mediastream/RTCRtpSFrameTransformer.cpp:
(WebCore::RTCRtpSFrameTransformer::decryptFrame):
(WebCore::RTCRtpSFrameTransformer::encryptFrame):
(WebCore::RTCRtpSFrameTransformer::transform):
* Modules/mediastream/RTCRtpSFrameTransformer.h:
* Modules/mediastream/RTCRtpScriptTransformer.cpp:
(WebCore::RTCRtpScriptTransformer::writable):
* Modules/mediastream/RTCRtpTransformableFrame.h:
(): Deleted.
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransformableFrame.cpp:
(WebCore::LibWebRTCRtpTransformableFrame::data const):
(WebCore::LibWebRTCRtpTransformableFrame::setData):
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransformableFrame.h:
2021-08-12 Johnson Zhou <qiaosong_zhou@apple.com>
Removal of "TypedOM" prefix for CSSOM Object names
https://bugs.webkit.org/show_bug.cgi?id=229028
Reviewed by Alex Christensen.
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSCSSStyleValueCustom.cpp: Renamed from Source/WebCore/bindings/js/JSTypedOMCSSStyleValueCustom.cpp.
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* css/typedom/CSSNumericValue.cpp: Renamed from Source/WebCore/css/typedom/TypedOMCSSUnitValue.cpp.
* css/typedom/CSSNumericValue.h: Renamed from Source/WebCore/css/typedom/TypedOMCSSNumericValue.h.
* css/typedom/CSSNumericValue.idl: Renamed from Source/WebCore/css/typedom/TypedOMCSSNumericValue.idl.
* css/typedom/CSSStyleImageValue.cpp: Renamed from Source/WebCore/css/typedom/TypedOMCSSImageValue.cpp.
(WebCore::CSSStyleImageValue::CSSStyleImageValue):
(WebCore::CSSStyleImageValue::document const):
* css/typedom/CSSStyleImageValue.h: Renamed from Source/WebCore/css/typedom/TypedOMCSSImageValue.h.
* css/typedom/CSSStyleImageValue.idl: Renamed from Source/WebCore/css/typedom/TypedOMCSSImageValue.idl.
* css/typedom/CSSStyleValue.cpp: Renamed from Source/WebCore/css/typedom/TypedOMCSSStyleValue.cpp.
* css/typedom/CSSStyleValue.h: Renamed from Source/WebCore/css/typedom/TypedOMCSSStyleValue.h.
* css/typedom/CSSStyleValue.idl: Renamed from Source/WebCore/css/typedom/TypedOMCSSStyleValue.idl.
* css/typedom/CSSUnitValue.cpp: Renamed from Source/WebCore/css/typedom/TypedOMCSSNumericValue.cpp.
* css/typedom/CSSUnitValue.h: Renamed from Source/WebCore/css/typedom/TypedOMCSSUnitValue.h.
* css/typedom/CSSUnitValue.idl: Renamed from Source/WebCore/css/typedom/TypedOMCSSUnitValue.idl.
* css/typedom/CSSUnparsedValue.cpp: Renamed from Source/WebCore/css/typedom/TypedOMCSSUnparsedValue.cpp.
* css/typedom/CSSUnparsedValue.h: Renamed from Source/WebCore/css/typedom/TypedOMCSSUnparsedValue.h.
* css/typedom/CSSUnparsedValue.idl: Renamed from Source/WebCore/css/typedom/TypedOMCSSUnparsedValue.idl.
* css/typedom/StylePropertyMapReadOnly.cpp:
(WebCore::StylePropertyMapReadOnly::reifyValue):
(WebCore::StylePropertyMapReadOnly::customPropertyValueOrDefault):
* css/typedom/StylePropertyMapReadOnly.h:
* css/typedom/StylePropertyMapReadOnly.idl:
* dom/StyledElement.cpp:
* html/CustomPaintImage.cpp:
(WebCore::extractComputedProperty):
(WebCore::CustomPaintImage::doCustomPaint):
* html/ImageBitmap.cpp:
(WebCore::ImageBitmap::createPromise):
* html/ImageBitmap.h:
* html/canvas/CanvasDrawImage.idl:
* html/canvas/CanvasFillStrokeStyles.idl:
* html/canvas/CanvasRenderingContext.cpp:
(WebCore::CanvasRenderingContext::checkOrigin):
* html/canvas/CanvasRenderingContext.h:
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::size):
(WebCore::CanvasRenderingContext2DBase::drawImage):
(WebCore::CanvasRenderingContext2DBase::createPattern):
* html/canvas/CanvasRenderingContext2DBase.h:
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::processArgument):
(WebCore::InspectorCanvas::indexForData):
* inspector/InspectorCanvas.h:
* inspector/InspectorCanvasCallTracer.cpp:
* inspector/InspectorCanvasCallTracer.h:
* inspector/agents/InspectorCanvasAgent.cpp:
* page/WindowOrWorkerGlobalScope.idl:
2021-08-12 Kimmo Kinnunen <kkinnunen@apple.com>
webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos.html fails on Cocoa
https://bugs.webkit.org/show_bug.cgi?id=228821
<rdar://problem/81562236>
Reviewed by Kenneth Russell.
When uploading the WebGL texture content from videos, use the video
visible data size instead of video element size. The video data can
be scaled with its filters, but we should upload only the original
pixels.
The GPU codepath already did this, but CPU codepath did not.
This change fixes the CPU codepath.
Fixes webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos.html
webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos.html
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::texImageSourceHelper):
(WebCore::WebGLRenderingContextBase::videoFrameToImage):
(WebCore::WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer):
* html/canvas/WebGLRenderingContextBase.h:
2021-08-12 Youenn Fablet <youenn@apple.com>
Implement SFrameTransform error handling
https://bugs.webkit.org/show_bug.cgi?id=228947
Reviewed by Eric Carlson.
Add support for RTCRtpSFrameTransformErrorEvent.
When RTCRtpSFrameTransformer encounters an issue, dispatch a task to RTCRtpSFrameTransform context and fire a corresponding event.
This follows https://w3c.github.io/webrtc-encoded-transform/#sframe-transform-algorithm, except that:
- we are not yet exposing some fields in RTCRtpSFrameTransformErrorEvent.
- we are using errorType instead of type which should be fixed in the spec.
Test: imported/w3c/web-platform-tests/webrtc-encoded-transform/sframe-transform-error.html
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/mediastream/RTCRtpSFrameTransform.cpp:
(WebCore::RTCRtpSFrameTransform::RTCRtpSFrameTransform):
(WebCore::errorTypeFromInformation):
(WebCore::processFrame):
(WebCore::RTCRtpSFrameTransform::hasKey const):
(WebCore::RTCRtpSFrameTransform::initializeTransformer):
(WebCore::transformFrame):
(WebCore::RTCRtpSFrameTransform::createStreams):
(WebCore::RTCRtpSFrameTransform::writable):
(WebCore::RTCRtpSFrameTransform::virtualHasPendingActivity const):
* Modules/mediastream/RTCRtpSFrameTransform.h:
* Modules/mediastream/RTCRtpSFrameTransform.idl:
* Modules/mediastream/RTCRtpSFrameTransformErrorEvent.cpp: Added.
(WebCore::RTCRtpSFrameTransformErrorEvent::create):
(WebCore::RTCRtpSFrameTransformErrorEvent::RTCRtpSFrameTransformErrorEvent):
(WebCore::RTCRtpSFrameTransformErrorEvent::eventInterface const):
* Modules/mediastream/RTCRtpSFrameTransformErrorEvent.h: Added.
* Modules/mediastream/RTCRtpSFrameTransformErrorEvent.idl: Added.
* Modules/mediastream/RTCRtpSFrameTransformer.cpp:
(WebCore::RTCRtpSFrameTransformer::hasKey const):
(WebCore::RTCRtpSFrameTransformer::decryptFrame):
(WebCore::RTCRtpSFrameTransformer::encryptFrame):
(WebCore::RTCRtpSFrameTransformer::transform):
* Modules/mediastream/RTCRtpSFrameTransformer.h:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* dom/EventNames.in:
* dom/EventTargetFactory.in:
2021-08-11 Alex Christensen <achristensen@webkit.org>
Remove optimistic assertion added in r280931
https://bugs.webkit.org/show_bug.cgi?id=229008
* page/PerformanceTiming.cpp:
(WebCore::PerformanceTiming::fetchStart const):
This assertion is hit in the test fast/dom/Window/property-access-on-cached-window-after-frame-removed.html
when accessing window.performance.fetchStart from a detached window object from a frame that has been removed from the DOM.
2021-08-11 Chris Dumez <cdumez@apple.com>
Add initial support for Cross-Origin-Embedder-Policy (COEP)
https://bugs.webkit.org/show_bug.cgi?id=228754
Reviewed by Alex Christensen.
Add initial support for Cross-Origin-Embedder-Policy (COEP) behind a runtime feature flag, off by default:
- https://html.spec.whatwg.org/multipage/origin.html#coep
The COEP header has the following impacts:
- When a document with `Cross-Origin-Embedder-Policy: require-corp` loads an iframe or a worker script, if the network
response for that iframe doesn't also contain `Cross-Origin-Embedder-Policy: require-corp`, then we fail the load.
- When a document with `Cross-Origin-Embedder-Policy: require-corp` loads cross-origin subresources, then either CORS
must be used or the resource response must be allowed by Cross-Origin-Resource-Policy (CORP) header.
Support is only for WK2 and checks are done in the network process for better security. Support for workers and service
workers (including cache storage) is included.
Most of the Web-Platform-Tests for COEP are passing with this patch. The exceptions are:
- Some tests relying on Blob are failing. Similarly to COOP, Blobs need to inherit COEP from their
creator. This is currently unimplemented as the change will likely be non-trivial. I will follow-up
to fix Blob support for both COOP and COEP.
- Tests in the credentialless/ folder are failing because we do not support `Cross-Origin-Embedder-Policy: credentialless`.
This seems to be a fairly recent extension proposed by Google and it is not part of the HTML specification yet.
- Some tests expect violation reporting and they are failing and we do not implement reporting yet.
Note that `self.crossOriginIsolated` still returns false, even if the pages opts into both COOP & COEP, and APIs such
as SharedArrayBuffer still are not permitted to use. In order to support this, we will have to actually implement process
swapping so that we know a process is not actually shared by several origins.
Test: http/wpt/html/cross-origin-embedder-policy/require-corp.https.html
* Modules/cache/DOMCache.cpp:
(WebCore::DOMCache::queryCache):
* Modules/cache/DOMCacheEngine.cpp:
(WebCore::DOMCacheEngine::convertToException):
* Modules/cache/DOMCacheEngine.h:
* Modules/cache/RetrieveRecordsOptions.h:
(WebCore::RetrieveRecordsOptions::isolatedCopy const):
(WebCore::RetrieveRecordsOptions::encode const):
(WebCore::RetrieveRecordsOptions::decode):
* dom/Document.cpp:
(WebCore::Document::initSecurityContext):
* dom/SecurityContext.h:
(WebCore::SecurityContext::crossOriginEmbedderPolicy const):
(WebCore::SecurityContext::setCrossOriginEmbedderPolicy):
* loader/CrossOriginAccessControl.cpp:
(WebCore::shouldCrossOriginResourcePolicyCancelLoad):
(WebCore::validateCrossOriginResourcePolicy):
* loader/CrossOriginAccessControl.h:
* loader/CrossOriginEmbedderPolicy.cpp:
(WebCore::obtainCrossOriginEmbedderPolicy):
(WebCore::CrossOriginEmbedderPolicy::isolatedCopy const):
* loader/CrossOriginEmbedderPolicy.h:
(WebCore::CrossOriginEmbedderPolicy::encode const):
(WebCore::CrossOriginEmbedderPolicy::decode):
* loader/CrossOriginOpenerPolicy.cpp:
(WebCore::obtainCrossOriginOpenerPolicy):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::loadResourceSynchronously):
(WebCore::DocumentThreadableLoader::create):
(WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
(WebCore::DocumentThreadableLoader::crossOriginEmbedderPolicy const):
* loader/DocumentThreadableLoader.h:
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::begin):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didBeginDocument):
* loader/ResourceLoaderOptions.h:
* loader/WorkerThreadableLoader.cpp:
(WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
* page/SecurityOrigin.h:
* platform/network/HTTPParsers.cpp:
(WebCore::parseCrossOriginResourcePolicyHeader):
* platform/network/HTTPParsers.h:
* workers/Worker.cpp:
(WebCore::Worker::notifyFinished):
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::WorkerGlobalScope):
* workers/WorkerGlobalScopeProxy.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
* workers/WorkerMessagingProxy.h:
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadSynchronously):
(WebCore::WorkerScriptLoader::loadAsynchronously):
(WebCore::WorkerScriptLoader::didReceiveResponse):
* workers/WorkerScriptLoader.h:
(WebCore::WorkerScriptLoader::crossOriginEmbedderPolicy const):
* workers/WorkerThread.cpp:
(WebCore::WorkerParameters::isolatedCopy const):
* workers/WorkerThread.h:
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerContextData.cpp:
(WebCore::ServiceWorkerContextData::isolatedCopy const):
* workers/service/ServiceWorkerContextData.h:
(WebCore::ServiceWorkerContextData::encode const):
(WebCore::ServiceWorkerContextData::decode):
* workers/service/ServiceWorkerFetchResult.h:
(WebCore::ServiceWorkerFetchResult::isolatedCopy const):
(WebCore::serviceWorkerFetchError):
(WebCore::ServiceWorkerFetchResult::encode const):
(WebCore::ServiceWorkerFetchResult::decode):
* workers/service/ServiceWorkerJob.cpp:
(WebCore::ServiceWorkerJob::notifyFinished):
* workers/service/ServiceWorkerJobClient.h:
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::ServiceWorkerThread):
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::doPushChanges):
(WebCore::RegistrationDatabase::importRecords):
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::addRegistrationFromStore):
(WebCore::SWServer::updateWorker):
(WebCore::SWServer::installContextData):
* workers/service/server/SWServer.h:
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::scriptFetchFinished):
* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::SWServerWorker):
(WebCore::SWServerWorker::contextData const):
* workers/service/server/SWServerWorker.h:
2021-08-11 Jean-Yves Avenard <jya@apple.com>
Audio buffer may contain more frames than decoded.
https://bugs.webkit.org/show_bug.cgi?id=228732
rdar://problem/81447014
Reviewed by Eric Carlson.
It is necessary to call repeatedly ExtAudioFileRead until it explicitly indicates that
it reached EOF.
Test: webaudio/decode-audio-data-wav.html.
* platform/audio/cocoa/AudioFileReaderCocoa.cpp:
(WebCore::AudioFileReader::createBus): Ensure that all frames have been decoded and
trim length to the actual number of frames returned.
This was already done for the webm case.
2021-08-11 Chris Dumez <cdumez@apple.com>
<a rel="opener noopener" target="_blank"> should create a window without opener
https://bugs.webkit.org/show_bug.cgi?id=229011
Reviewed by Alex Christensen.
<a rel="opener noopener" target="_blank"> should create a window without opener, as per:
- https://html.spec.whatwg.org/#get-an-element's-noopener (noopener is checked *before* opener).
Firefox and Chrome match the specification.
No new tests, rebaselined existing tests.
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::handleClick):
2021-08-11 Alex Christensen <achristensen@webkit.org>
REGRESSION (r278392) performance.measure should never throw an InvalidAccessError for fetchStart
https://bugs.webkit.org/show_bug.cgi?id=229008
<rdar://79960877>
Reviewed by Chris Dumez.
Test: http/tests/performance/performance-measure-fetch-start.html
PerformanceTiming::fetchStart is returning 0 when we get a main resource from the cache sometimes.
This is causing PerformanceUserTiming::convertMarkToTimestamp to throw an error, which it should.
Like PerformanceResourceTiming::fetchStart we need to fall back to ResourceLoadTiming::startTime
if the NetworkLoadMetrics doesn't have any useful data for us.
* page/PerformanceTiming.cpp:
(WebCore::PerformanceTiming::fetchStart const):
2021-08-11 John Wilander <wilander@apple.com>
PCM: Flip WebCore's FraudPreventionEnabled to true if HAVE(RSA_BSSA) to match the experimental setting
https://bugs.webkit.org/show_bug.cgi?id=228961
Reviewed by Tim Horton.
Existing tests use the affected anchor attribute.
* page/RuntimeEnabledFeatures.h:
* page/Settings.yaml:
2021-08-11 Dana Estra <destra@apple.com>
Start smooth keyboard scrolling animation when pageUp or pageDown key is pressed.
https://bugs.webkit.org/show_bug.cgi?id=228156
Reviewed by Tim Horton.
UIProcess now no longer handles scrollPageUp and scrollPageDown events. They return to eventHandler as
unhandled and the keyboard scroll animation is started.
Tests: fast/scrolling/keyboard-scrolling-distance-downArrow.html
fast/scrolling/keyboard-scrolling-distance-pageDown.html
* page/EventHandler.cpp:
(WebCore::EventHandler::defaultKeyboardEventHandler):
* platform/KeyboardScrollingAnimator.cpp:
(WebCore::KeyboardScrollingAnimator::keyboardScrollForKeyboardEvent const):
2021-08-11 Aditya Keerthi <akeerthi@apple.com>
REGRESSION (r273072): Caps lock indicator in password field is too large
https://bugs.webkit.org/show_bug.cgi?id=228970
rdar://81546781
Reviewed by Wenson Hsieh.
r273072 made it so that flex items with an intrinsic size will honor
their aspect ratio when computing their content size. Prior to the
change, in taller password fields, the flex item representing the caps
lock indicator would be tall and narrow. The height would stretch to
fill the container, but the width would maintain its intrinsic width of
17px. Now that aspect ratio is accounted for, the width increases to
match the height, resulting in a much larger indicator in taller password
fields.
However, while r273072 regressed the appearance of the caps lock
indicator, it merely exposed an issue with the styling of the indicator.
Consider the following test case, which is a reduced version how the
caps lock indicator is styled:
<div style="display: flex; height: 100px">
<div style="content: url(17_x_17_blue_square.svg); align-self: stretch;"></div>
</div>
Prior to r273072, this displayed a 17x17 blue square (inside a 17x100
flex item). However, in Chrome, Firefox, and WebKit after r273072, this
shows a 100x100 blue square (inside a 100x100 flex item). This is the
expected behavior now that aspect ratio is accounted for.
Consequently, to fix the issue, the width of the indicator must be
limited to a maximum value. 17px was chosen to be the max-width, as the
indicator's width would not exceed 17px prior to r273072.
Test: fast/forms/caps-lock-indicator-width.html
* css/html.css:
(input::-webkit-caps-lock-indicator):
2021-08-11 Chris Dumez <cdumez@apple.com>
Stop evaluating <script>s moved between Documents during fetching
https://bugs.webkit.org/show_bug.cgi?id=202714
<rdar://problem/56208425>
Reviewed by Geoffrey Garen.
Stop evaluating <script>s moved between Documents during fetching:
- https://github.com/whatwg/html/issues/2469
- https://github.com/whatwg/html/pull/2673
Both Firefox and Chrome already behave this way.
No new tests, rebaselined existing tests.
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::prepareScript):
Set the element's preparation-time document to its node document, as per:
- https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script (step 11)
(WebCore::ScriptElement::executePendingScript):
If scriptElement's preparation-time document is not equal to scriptElement's node document, then return, as per:
- https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block (step 2)
* dom/ScriptElement.h:
2021-08-11 Youenn Fablet <youenn@apple.com>
Media element is not always autoplaying when going from background to foreground if it is initially not in viewport
https://bugs.webkit.org/show_bug.cgi?id=228955
Reviewed by Eric Carlson.
In case video element is autoplayable but is paused, we should try to autoplay even if we are not interrupted due to invisible autoplay.
Covered by API test.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updateShouldAutoplay):
2021-08-11 Youenn Fablet <youenn@apple.com>
Remove --no-demangle XLinker option from WebCore
https://bugs.webkit.org/show_bug.cgi?id=228949
Reviewed by Alexey Proskuryakov.
Remove options that were added inadvertently.
No change of behavior as this is changing the linker log only.
* Configurations/WebCore.xcconfig:
* Configurations/WebCoreTestSupport.xcconfig:
2021-08-11 Chris Dumez <cdumez@apple.com>
HTMLMetaElement http-equiv should not be processed in shadow trees
https://bugs.webkit.org/show_bug.cgi?id=228973
Reviewed by Geoffrey Garen.
HTMLMetaElement http-equiv should not be processed in shadow trees:
- https://html.spec.whatwg.org/#attr-meta-http-equiv
- https://html.spec.whatwg.org/multipage/infrastructure.html#insert-an-element-into-a-document
- https://dom.spec.whatwg.org/#in-a-document-tree
Firefox and Chrome already match the specification here.
No new tests, rebaselined existing test.
* dom/Node.h:
(WebCore::Node::isInDocumentTree const):
* html/HTMLMetaElement.cpp:
(WebCore::HTMLMetaElement::attributeChanged):
(WebCore::HTMLMetaElement::process):
2021-08-11 Chris Dumez <cdumez@apple.com>
HTMLStyleElement should create its style sheet even if its media attribute is invalid
https://bugs.webkit.org/show_bug.cgi?id=228977
Reviewed by Antti Koivisto.
HTMLStyleElement should create its style sheet even if its media attribute is invalid.
WebKit currently didn't and this was causing us to fail the following WPT test:
- html/semantics/document-metadata/the-style-element/style_non_matching_media.html
This WPT test is passing in both Firefox and Chrome.
No new tests, rebaselined existing tests.
* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::createSheet):
2021-08-11 Chris Dumez <cdumez@apple.com>
Dynamically changing HTMLStyleElement.type should change the rendering accordingly
https://bugs.webkit.org/show_bug.cgi?id=228980
Reviewed by Antti Koivisto.
Dynamically changing HTMLStyleElement.type should change the rendering accordingly.
This is causing the following WPT test to fail in WebKit:
- html/semantics/document-metadata/the-style-element/style_type_change.html
This test is passing in both Firefox and Chrome.
No new tests, rebaselined existing test.
* html/HTMLStyleElement.cpp:
(WebCore::HTMLStyleElement::parseAttribute):
2021-08-11 Adrian Perez de Castro <aperez@igalia.com>
Non-unified build fixes, mid August 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=228985
Unreviewed non-unified build fixes.
* fileapi/ThreadableBlobRegistry.cpp: Add missing CrossOriginOpenerPolicy.h include.
* html/FormController.cpp: Add missing TypedElementDescendantIterator.h include.
* html/FormController.h: Add missing forward declaration for the Document type.
* loader/CrossOriginEmbedderPolicy.cpp: Add missing ResourceResponse.h include.
* loader/CrossOriginOpenerPolicy.cpp: Ditto.
2021-08-11 Cathie Chen <cathiechen@igalia.com>
REGRESSION (r277997): Max-height not applied for image
https://bugs.webkit.org/show_bug.cgi?id=228872
Reviewed by Antti Koivisto.
The image get stretched because constrainLogicalHeightByMinMax uses the intrinsic height for the minimum height.
According to [1], the automatic minimum size in the ratio-dependent axis of a box is its min-content size,
not the intrinsic size. To fix this, the ratio-dependent minimum height of a box should be computed from aspect-ratio
if it doesn't have any child, otherwise, then it should consider the intrinsic height.
[1] https://www.w3.org/TR/css-sizing-4/#aspect-ratio-minimum
* rendering/RenderBox.cpp:
(WebCore::RenderBox::constrainLogicalHeightByMinMax const): The minimum height is computed from aspect-ratio if it doesn't have any child.
2021-08-11 Rob Buis <rbuis@igalia.com>
[SVG] Attribute change triggers redundant (and out of order) setNeedsLayout call
https://bugs.webkit.org/show_bug.cgi?id=228125
Reviewed by Darin Adler.
As explained in the bug the setNeedsLayout call is redundant, however
keep using it for embedded SVG's to update width/height of the embedder.
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::svgAttributeChanged):
2021-08-10 Chris Dumez <cdumez@apple.com>
Add Cross-Origin-Opener-Policy support for Blob URLs
https://bugs.webkit.org/show_bug.cgi?id=228924
Reviewed by Alex Christensen.
Pass ScriptExecutionContext's cross-origin-opener-policy when registering a public
Blob URL and store it in the blob registry alongside the blob data. As a result,
we are able to service the right COOP headers on the blob response later on when
doing a load of this blob. In the future, we'll pass the cross-origin-embedder-policy
as well, once we support it.
No new tests, rebaselined existing test.
* Modules/fetch/FetchLoader.cpp:
(WebCore::FetchLoader::startLoadingBlobURL):
* dom/Document.h:
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::crossOriginOpenerPolicy const):
* dom/ScriptExecutionContext.h:
* fileapi/Blob.cpp:
(WebCore::BlobURLRegistry::registerURL):
(WebCore::Blob::Blob):
* fileapi/FileReaderLoader.cpp:
(WebCore::FileReaderLoader::start):
* fileapi/ThreadableBlobRegistry.cpp:
(WebCore::ThreadableBlobRegistry::registerBlobURL):
* fileapi/ThreadableBlobRegistry.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::loadResource):
* loader/CrossOriginEmbedderPolicy.cpp:
(WebCore::obtainCrossOriginEmbedderPolicy):
For WebKit1, the initial empty document seems to have an empty URL instead of
"about:blank" so I had to extend the check so that COEP properly gets enabled.
* loader/CrossOriginOpenerPolicy.cpp:
(WebCore::obtainCrossOriginOpenerPolicy):
For WebKit1, the initial empty document seems to have an empty URL instead of
"about:blank" so I had to extend the check so that COOP properly gets enabled.
(WebCore::crossOriginOpenerPolicyToString):
(WebCore::CrossOriginOpenerPolicy::isolatedCopy const):
(WebCore::addCrossOriginOpenerPolicyHeaders):
* loader/CrossOriginOpenerPolicy.h:
(WebCore::operator==):
(WebCore::CrossOriginOpenerPolicy::encode const):
(WebCore::CrossOriginOpenerPolicy::decode):
* platform/network/BlobData.cpp:
(WebCore::BlobData::clone const):
* platform/network/BlobData.h:
(WebCore::BlobData::crossOriginOpenerPolicy const):
(WebCore::BlobData::setCrossOriginOpenerPolicy):
* platform/network/BlobRegistry.h:
* platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::registerBlobURL):
(WebCore::BlobRegistryImpl::registerBlobURLOptionallyFileBacked):
* platform/network/BlobRegistryImpl.h:
* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::notifyResponseOnSuccess):
2021-08-10 Wenson Hsieh <wenson_hsieh@apple.com>
[Live Text] Unable to start drag on image when the first piece of text inside the image is selected
https://bugs.webkit.org/show_bug.cgi?id=228967
rdar://80471465
Reviewed by Tim Horton.
When selecting text inside an image element using Live Text, if the text selection contains the very first
character (in DOM order) that appears in the image element's shadow root, the user will be unable to start an
image drag on the same image by clicking another part of the image that does not contain Live Text. This happens
because `DragController::startDrag` to handle the drag as a selection drag rather than an image drag, which (in
turn) happens because `DragController::draggableElement` computes a drag source type of
`DragSourceAction::Selection`.
This occurs because `FrameSelection::contains(const LayoutPoint&)` returns `true` for any point inside the
shadow root of an image element with Live Text that does NOT hit-test to a text node, because we end up hit-
testing to the image overlay container `div` as our `innerNode`, which means that the DOM position for the given
point is going to be at the first position inside the image overlay container. Since this canonicalizes to the
beginning of the first text node (in DOM order) inside the image overlay, if that first text node happens to be
selected, we'll end up believing that the layout point (which is not over any text inside the image) is inside
the selection.
To avoid this, we make a minor adjustment to the logic in `FrameSelection::contains`, so that we handle text
inside image overlays by mapping the selected text range to absolute quads, and then checking whether the given
point (in absolute coordinates) is contained in any of those quads.
While we could theoretically use this approach for all selections, it's both more expensive than a hit-test and
might result in compatibility issues, so we just limit it to the case where we know (a-prior) that all
selectable text is arbitrarily positioned using transforms.
This change fixes an API test that currently fails on macOS: DragAndDropTests.DragElementWithImageOverlay
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::contains const):
2021-08-10 Chris Dumez <cdumez@apple.com>
Meta HTTP refresh should not navigate if document has sandboxed automatic features browsing context flag set
https://bugs.webkit.org/show_bug.cgi?id=228965
Reviewed by Darin Adler.
Meta HTTP refresh should not navigate if document has sandboxed automatic features browsing context flag set:
- https://html.spec.whatwg.org/multipage/semantics.html#shared-declarative-refresh-steps (Step 13)
Firefox and Chrome already behave this way.
No new tests, rebaselined existing tests.
* dom/Document.cpp:
(WebCore::Document::processMetaHttpEquiv):
* dom/Document.h:
* html/HTMLMetaElement.cpp:
(WebCore::HTMLMetaElement::process):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::responseReceived):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::receivedFirstData):
(WebCore::FrameLoader::scheduleRefreshIfNeeded):
* loader/FrameLoader.h:
* loader/FrameLoaderTypes.h:
* loader/NavigationScheduler.cpp:
(WebCore::ScheduledRedirect::ScheduledRedirect):
(WebCore::NavigationScheduler::scheduleRedirect):
* loader/NavigationScheduler.h:
2021-08-10 Ryosuke Niwa <rniwa@webkit.org>
Deploy some more smart pointers in DOMWindow.cpp
https://bugs.webkit.org/show_bug.cgi?id=228883
Reviewed by Darin Adler.
A follow up to r279661. Deploy even more smart pointers.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::dispatchAllPendingBeforeUnloadEvents):
(WebCore::DOMWindow::failedToRegisterDeviceMotionEventListener):
(WebCore::DOMWindow::dispatchEvent):
2021-08-10 Antti Koivisto <antti@apple.com>
Remove some dead code from LegacyInlineFlowBox::nodeAtPoint
https://bugs.webkit.org/show_bug.cgi?id=228960
Reviewed by Alan Bujtas.
* rendering/LegacyInlineFlowBox.cpp:
(WebCore::LegacyInlineFlowBox::nodeAtPoint):
This hit test quirk got accidentally disabled 7 years ago (in http://trac.webkit.org/changeset/170875/webkit)
and this became dead code. No one has complained.
2021-08-10 Ben Nham <nham@apple.com>
Fix nested resource load tracepoints
https://bugs.webkit.org/show_bug.cgi?id=228242
Reviewed by Alex Christensen.
The main resource and subresource load tracepoints aren't interpreted correctly if there are
multiple resource loads in flight at the same time. To fix this, we pass the pointer to the
FrameLoader or SubresourceLoader to ktrace so that the tracing tool can use that pointer to
properly nest overlapping resource loading trace intervals.
One additional change I made is to move the SubresourceLoadWillStart tracepoint to after the
call to willSendRequestInternal. The reason for this is because I wanted to log the resource
ID associated with the subresource request, but we only generate that ID after the call to
willSendRequestInternal.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::provisionalLoadStarted):
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):
(WebCore::SubresourceLoader::didFinishLoading):
(WebCore::SubresourceLoader::didFail):
(WebCore::SubresourceLoader::didCancel):
2021-08-10 Chris Dumez <cdumez@apple.com>
Document.baseURI is inaccurate for iframe srcdoc documents
https://bugs.webkit.org/show_bug.cgi?id=228933
Reviewed by Alex Christensen.
Document.baseURI is inaccurate for iframe srcdoc documents:
- https://html.spec.whatwg.org/#fallback-base-url
This aligns our behavior with both Chrome and Firefox.
No new tests, rebaselined existing tests.
* dom/Document.cpp:
(WebCore::Document::fallbackBaseURL const):
(WebCore::Document::updateBaseURL):
Extract "fallback base URL" logic out of updateBaseURL() and into its own function so that
it can be called from other places. Add logic to deal with iframe srcdoc documents to
our "fallback base URL" logic, as per:
- https://html.spec.whatwg.org/#fallback-base-url
(WebCore::Document::processBaseElement):
As per https://html.spec.whatwg.org/#set-the-frozen-base-url, we should use the document's fallback base URL
as base URL when parsing the base element's href attribute.
* dom/Document.h:
* html/HTMLBaseElement.cpp:
(WebCore::HTMLBaseElement::href const):
Per https://html.spec.whatwg.org/#dom-base-href, we should use the document's fallback base URL when
parsing the base element's href attribute. Also we should return the attribute value if the URL fails
parsing, not a null URL.
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::openFunc):
Keep in sync with HTMLBaseElement::href(), as per comment.
2021-08-10 Kimmo Kinnunen <kkinnunen@apple.com>
Scripts/generate-derived-sources.sh: line 19: [: binary operator expected while building Source/WebKit
https://bugs.webkit.org/show_bug.cgi?id=228908
Reviewed by Per Arne Vollan.
* Scripts/generate-derived-sources.sh:
Quote the use of CC so that future copy-paste does not make the same mistake
as this bug.
2021-08-10 Devin Rousso <drousso@apple.com>
[macOS] REGRESSION(r278850): modifying `playbackRate` via JS on a TouchBar mac only sometimes works and also causes the `defaultPlaybackRate` to change
https://bugs.webkit.org/show_bug.cgi?id=228939
<rdar://problem/80427578>
Reviewed by Eric Carlson.
Test: VideoControlsManager.VideoControlsManagerDoesNotChangeValuesExposedToJavaScript
* platform/mac/PlaybackSessionInterfaceMac.mm:
(WebCore::PlaybackSessionInterfaceMac::rateChanged):
Make sure to change the `defaultPlaybackRate` before the `rate` as otherwise the former will
override changes made to the latter (see r278850 (and r277203) for details as to why).
* platform/mac/WebPlaybackControlsManager.h:
* platform/mac/WebPlaybackControlsManager.mm:
(-[WebPlaybackControlsManager setDefaultPlaybackRate:]):
(-[WebPlaybackControlsManager setDefaultPlaybackRate:fromJavaScript:]): Added.
(-[WebPlaybackControlsManager setRate:]):
(-[WebPlaybackControlsManager setRate:fromJavaScript:]): Added.
Add a way to distinguish whether the change to the `rate`/`defaultPlaybackRate` came from JS
or some native call (e.g. AVKit). If the former, don't propagate the change to the playback
model (which eventually is the `HTMLMediaElement` in the WebProcess) as that's where the
value came from in the first place. Note that we still want to propagate the `rate` to the
`defaultPlaybackRate` (and vice versa when `isPlaying`) in the UIProcess for the reasons
described in r278850 (and r277203), but we don't want to expose it to JS.
* platform/ios/PlaybackSessionInterfaceAVKit.mm:
(WebCore::PlaybackSessionInterfaceAVKit::rateChanged):
* platform/ios/WebAVPlayerController.h:
* platform/ios/WebAVPlayerController.mm:
(-[WebAVPlayerController setDefaultPlaybackRate:]):
(-[WebAVPlayerController setDefaultPlaybackRate:fromJavaScript:]): Added.
(-[WebAVPlayerController setRate:]):
(-[WebAVPlayerController setRate:fromJavaScript:]): Added.
Drive-by: r278850 was based r277203 (which added the above), so fix that code now too.
2021-08-09 Yusuke Suzuki <ysuzuki@apple.com>
Partially revert r280256 behavior change since it broke Facetime
https://bugs.webkit.org/show_bug.cgi?id=228943
rdar://81700268
Reviewed by Mark Lam.
In r280256, custom accessors start getting holder's JSGlobalObject (this is right behavior).
We also introduced IncumbentWindow IDL attribute to get the caller's JSGlobalObject, which is
necessary in Location. At that time, we replaced all ActiveWindow to IncumbentWindow, but it
changes the JSGlobalObject of `replace`, `assign`, and `reload` since they are functions (not
custom accessors). We observed that, after this change, facetime Web page is broken: when opening
the link to Facetime, it should show the prompt of "Open in Facetime app" in iOS. But after this
change, it won't happen.
We revert the semantic change by using ActiveWindow for replace, assign, and reload. This is
not the correct semantics from the spec, but this is the same to one before r280256, and we
will change this once we find the way to bypass this issue.
* page/Location.cpp:
(WebCore::Location::assign):
(WebCore::Location::replace):
(WebCore::Location::reload):
* page/Location.h:
* page/Location.idl:
2021-08-09 Chris Dumez <cdumez@apple.com>
Blob URL changes after loading it
https://bugs.webkit.org/show_bug.cgi?id=228923
Reviewed by Geoff Garen.
Blob URL changes after loading it. This is because we use URLWithBlobURLLifetimeExtension to
extend the lifetime of the Blob URL during the load and URLWithBlobURLLifetimeExtension ends
up creating a new public Blob URL. This is Web-observable so we need a way to extend the
lifetime of a Blob URL without actually generating a new Blob URL.
This patch replaces URLWithBlobURLLifetimeExtension with a new BlobURLHandle class which
extends the lifetime of a Blob URL as long as there are BlobURLHandle objects referring
to it. BlobURLHandle works with both private and public Blob URLs so it replaces
Blob::Handle as well (which I recently introduced via r280547). The Blob URL no longer
changes when we extend its lifetime. Instead, the Blob registry now keeps track of
references to a given Blob and only removes a Blob URL once there are no longer any
references to it.
Test: fast/files/blob-as-frame-url.html
* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::serialize):
(WebCore::CloneSerializer::CloneSerializer):
(WebCore::CloneSerializer::dumpIfTerminal):
(WebCore::SerializedScriptValue::SerializedScriptValue):
(WebCore::SerializedScriptValue::create):
* bindings/js/SerializedScriptValue.h:
(WebCore::SerializedScriptValue::blobHandles const):
(WebCore::SerializedScriptValue::SerializedScriptValue):
* fileapi/Blob.cpp:
(WebCore::Blob::Blob):
(WebCore::Blob::slice const):
(WebCore::Blob::size const):
(WebCore::Blob::handle const):
* fileapi/Blob.h:
(WebCore::Blob::url const):
* fileapi/BlobURL.cpp:
(WebCore::BlobURLHandle::BlobURLHandle):
(WebCore::BlobURLHandle::~BlobURLHandle):
(WebCore::BlobURLHandle::registerBlobURLHandleIfNecessary):
(WebCore::BlobURLHandle::unregisterBlobURLHandleIfNecessary):
(WebCore::BlobURLHandle::operator=):
(WebCore::BlobURLHandle::clear):
* fileapi/BlobURL.h:
(WebCore::BlobURLHandle::BlobURLHandle):
(WebCore::BlobURLHandle::url const):
* fileapi/ThreadableBlobRegistry.cpp:
(WebCore::ThreadableBlobRegistry::registerBlobURLHandle):
(WebCore::ThreadableBlobRegistry::unregisterBlobURLHandle):
* fileapi/ThreadableBlobRegistry.h:
* loader/PolicyChecker.cpp:
(WebCore::FrameLoader::PolicyChecker::extendBlobURLLifetimeIfNecessary const):
(WebCore::FrameLoader::PolicyChecker::checkNavigationPolicy):
(WebCore::FrameLoader::PolicyChecker::checkNewWindowPolicy):
* loader/PolicyChecker.h:
* platform/network/BlobRegistry.h:
* platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::registerFileBlobURL):
(WebCore::BlobRegistryImpl::registerBlobURL):
(WebCore::BlobRegistryImpl::registerBlobURLOptionallyFileBacked):
(WebCore::BlobRegistryImpl::registerBlobURLForSlice):
(WebCore::BlobRegistryImpl::unregisterBlobURL):
(WebCore::BlobRegistryImpl::addBlobData):
(WebCore::BlobRegistryImpl::registerBlobURLHandle):
(WebCore::BlobRegistryImpl::unregisterBlobURLHandle):
* platform/network/BlobRegistryImpl.h:
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::setResponseType):
(WebCore::XMLHttpRequest::open):
(WebCore::XMLHttpRequest::prepareToSend):
(WebCore::XMLHttpRequest::send):
(WebCore::XMLHttpRequest::createRequest):
(WebCore::XMLHttpRequest::clearRequest):
(WebCore::XMLHttpRequest::didFinishLoading):
* xml/XMLHttpRequest.h:
2021-08-09 Simon Fraser <simon.fraser@apple.com>
Vertical scroll with mouse wheel in horizontal scroller fails to propagate to the document
https://bugs.webkit.org/show_bug.cgi?id=228891
<rdar://81640239>
Reviewed by Antti Koivisto.
If a page has a horizontal scrolling carousel with a non-passive wheel event handler, and a
user with a clicky scroll wheel mouse tries to vertically scroll over that carousel, then
we'd fail to propagate the scroll to the page. This affects apple.com/store.
This happened because we don't do latching for legacy mouse wheel events, so we hit the code
in EventHandler::handleWheelEventInAppropriateEnclosingBox(); this finds the carousel and
calls handleWheelEventInScrollableArea(), but that dispatches to the scrolling thread in way
that does not propagate the event to the nearest ancestor that can handle it.
The fix is to check that the ScrollableArea can handle the event, sharing some code that
already exists and was used by findEnclosingScrollableContainer(). This is a conservative
fix; it's possible that scrollableAreaCanHandleEvent() could be called down in
handleWheelEventInScrollableArea() but that will affect other call sites.
Test: fast/scrolling/mac/vertical-scroll-in-horizontal-scroller.html
* page/EventHandler.cpp:
(WebCore::EventHandler::handleWheelEventInAppropriateEnclosingBox):
(WebCore::EventHandler::scrollableAreaCanHandleEvent):
* page/EventHandler.h:
* page/mac/EventHandlerMac.mm:
(WebCore::findEnclosingScrollableContainer):
2021-08-09 Kate Cheney <katherine_cheney@apple.com>
Add console logging to encourage the use of authenticated encryption in WebCrypto
https://bugs.webkit.org/show_bug.cgi?id=228879
<rdar://problem/80655397>
Reviewed by Brent Fulgham.
Warn about risks of using AES-CBC and AES-CTR modes in WebCrypto,
based on recommendations in
https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt.
We should encourage authenticated encryption instead.
* crypto/SubtleCrypto.cpp:
(WebCore::SubtleCrypto::encrypt):
(WebCore::SubtleCrypto::decrypt):
2021-08-09 Said Abou-Hallawa <said@apple.com>
Ease sandboxing restrictions for Mail to allow HEIF image decoding
https://bugs.webkit.org/show_bug.cgi?id=228812
<rdar://80967782>
Reviewed by Per Arne Vollan.
No need to pass kCGImageSourceEnableRestrictedDecoding to ImageIO anymore.
* platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::createImageSourceOptions):
2021-08-09 Dean Jackson <dino@apple.com>
WebGL 2.0 doesn't work on A8 devices (iPad mini 4, iPad Air 2)
https://bugs.webkit.org/show_bug.cgi?id=228904
rdar://79198313
Reviewed by Anders Carlsson.
We can't use the ANGLE Metal backend for WebGL 2 on A8 devices (e.g. iPad Mini 4
and iPad Air 2). In this case revert back to the OpenGL backend.
It would be better if this check was exposed as API from ANGLE, but
its only a small number of devices, and this code can be removed once
they are no longer supported.
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::platformSupportsMetal): Add a parameter to indicate WebGL 2, and
check the Metal device family support.
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
2021-08-09 Michael Catanzaro <mcatanzaro@gnome.org>
-Warray-bounds, -Wstringop-truncation warnings in Packed.h
https://bugs.webkit.org/show_bug.cgi?id=226557
<rdar://problem/79103658>
Reviewed by Adrian Perez de Castro.
Suppressing the -Warray-bounds warning introduces the -Wstringop-truncation warning, which
cannot be suppressed with pragmas. The only solution I found is -Wno-stringop-truncation. I
could apply it globally, but this warning does not have many false positives, so I think
it's better to suppress the warning only for WebSocket.cpp. Unfortunately we have to remove
it from the unified build in order to add custom flags, but it seems worth it to avoid
suppressing the warning globally.
* CMakeLists.txt:
2021-08-09 Jer Noble <jer.noble@apple.com>
[Cocoa|GPU] platformLayer() not always added to remotedly hosted context; black video while playing
https://bugs.webkit.org/show_bug.cgi?id=228873
<rdar://81271107>
Reviewed by Eric Carlson.
Coalesce calls to renderingModeChanged() by setting a flag to call renderingModeChanged() in
the next run loop, and call into this coalescing method, setNeedsRenderingModeChanged(),
whenever the MediaPlayerPrivateAVFoundation subclasses create or destroy a video layer
or software painting context. This ensures that the MediaPlayerClient is always notified
when the rendering mode changes, regardless of why that change occurred.
Drive-by fix: replace the call in createVideoLayer() to "callOnMainThread()"
with "ensureOnMainThread()". The call to "callOnMainThread()" was added to avoid a
deadlock in WebKitLegacy, and "ensureOnMainThread()" has the correct behavior there, but
will be synchronous in WebKit.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::setUpVideoRendering):
(WebCore::MediaPlayerPrivateAVFoundation::setNeedsRenderingModeChanged):
(WebCore::MediaPlayerPrivateAVFoundation::renderingModeChanged):
(WebCore::MediaPlayerPrivateAVFoundation::prepareForRendering):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::MediaPlayerPrivateAVFoundationCF::destroyVideoLayer):
(WebCore::AVFWrapper::createAVCFVideoLayer):
(WebCore::AVFWrapper::createImageGenerator):
(WebCore::AVFWrapper::destroyImageGenerator):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoOutput):
2021-08-09 Alicia Boya García <aboya@igalia.com>
[MSE][GStreamer] Update tracks synchronously
https://bugs.webkit.org/show_bug.cgi?id=228825
Reviewed by Xabier Rodriguez-Calvar.
A mistake introduced with the WebKitMediaSrc v2 patch made the call to
updateTracks() in MediaPlayerPrivateGStreamer asynchronous.
This introduced a subtle race condition in which the "resize" event
may be handled before updateTracks() is called, therefore m_hasVideo
has not yet been set to true, and querying the video size from the
"resize" event handler returns 0x0.
This fixes a timeout flake in media/media-source/media-source-resize.html.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::handleStreamCollectionMessage):
2021-08-09 Yusuke Suzuki <ysuzuki@apple.com>
Unreviewed, remove WTFLogAlways
https://bugs.webkit.org/show_bug.cgi?id=228858
* html/parser/HTMLConstructionSite.cpp:
(WebCore::WhitespaceCache::lookup):
2021-08-09 Cameron McCormack <heycam@apple.com>
Cache recently atomized all-whitespace strings for use by the HTML parser
https://bugs.webkit.org/show_bug.cgi?id=228858
Reviewed by Yusuke Suzuki.
We have a memory optimization where the HTML parser will atomize any
text node string that is all whitespace. This can be expensive,
as we need to loop over the string's characters three times: to detect
that it is indeed all whitespace, to hash the string, and to compare
to any existing entry in the atom hash table.
Many whitespace strings encountered during parsing have a limited
form -- they have a few runs of consecutive equal whitespace
characters, e.g. it's common to see a newline followed by a number
of space characters. We can take advantage of this by compressing
the whitespace string into a simple run-length encoded form while
we loop over the characters to check that the string is all
whitespace. Unlike a hash, this encoded form perfectly identifies the
string content.
We add a WhitespaceCache that is owned by the Document, which stores
the most recently atomized all-whitespace string encountered by the
parser for a given length, and keys it with the encoded form. The
parser can then look up the WhitespaceCache and find an AtomString
without the need to perform a lookup in the atom hash table.
The WhitespaceCache continues to hold on to the cached whitespace
atoms for the life of the document. The WhitespaceCache itself
takes a bit over 1 KiB when empty, and if completely populated would
take a bit over 2 KiB plus 8 KiB of atom string data (a 1 byte string,
plus a 2 byte string, plus a 3 byte string, etc.). This doesn't seem
high enough to be worth clearing this out just to avoid memory usage
from text nodes that have been removed from the document.
We have the Document own the WhitespaceCache so that it's not just the
initial document load, but any uses of innerHTML or other fragment
parsing APIs, that can re-use previously atomized whitespace strings.
The choice of WhitespaceCache::maximumCachedStringLength = 128 is
somewhat arbitrary. The value must be <= 255 to avoid overflowing
the specific 64 bit code format used to encode the whitespace string.
Testing on Speedometer shows whitespace strings only up to length 26,
but it may be worth testing other content to see if it's worth
reducing maximumCachedStringLength.
When running Speedometer 2, no entries in the cache ever get replaced
by a different whitespace string of the same length, and 16 unique
whitespace string lengths are encountered.
We don't compute codes for 16 bit strings, since 16 bit strings passed
in to WhitespaceCache::lookup() are almost always the entirety of an
HTMLToken's data, and HTMLToken tracks whether any 16 bit characters are
present. If there are any, then we know the string cannot be all
whitespace, and we use a WhitespaceMode value of NotAllWhitespace to
skip the atomization altogether.
This patch is an almost 1% improvement on Speedometer 2.
* dom/Document.cpp:
(WebCore::m_whitespaceCache):
* dom/Document.h:
(WebCore::Document::whitespaceCache):
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::HTMLConstructionSite):
(WebCore::HTMLConstructionSite::insertTextNode):
(WebCore::WhitespaceCache::codeForString):
(WebCore::WhitespaceCache::lookup):
* html/parser/HTMLConstructionSite.h:
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::insertPhoneNumberLink):
(WebCore::HTMLTreeBuilder::linkifyPhoneNumbers):
(WebCore::HTMLTreeBuilder::processCharacterBufferForInBody):
* html/parser/HTMLTreeBuilder.h:
2021-08-09 Cameron McCormack <heycam@apple.com>
Increase inline size of HTMLToken::Attribute::value
https://bugs.webkit.org/show_bug.cgi?id=228910
<rdar://problem/81686150>
Reviewed by Yusuke Suzuki.
Some attributes we encounter during HTML parsing are longer than 32
characters, and this shows up on profiles.
This patch improves Speedometer 2 by a modest amount (~0.3%).
* html/parser/HTMLToken.h:
2021-08-08 Jer Noble <jer.noble@apple.com>
REGRESSION: http/tests/preload/onload_event.html is a flaky timeout on Big Sur wk1 Release
https://bugs.webkit.org/show_bug.cgi?id=227366
<rdar://problem/79733280>
Reviewed by Eric Carlson.
Querying for any state on an AVAsset before its fully loaded will cause AVFoundation to block
on networking to fulfill the request, and in the case where WebKit handles loading, will eventually
dispatch to the main thread (which is blocked) in WebCore loader code, causing a deadlock.
Always guard queries to AVAsset with checks for the loaded status of the property being queried.
To make this easier, add a new safeAVAssetTracksForVisualMedia() method, similar to the existing
safeAVAssetTracksForAudibleMedia(), which checks the "tracks" property status and returns an empty
array if the tracks are not yet loaded.
Guard a few more methods by bailing early if the AVAsset is not fully loaded.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged):
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateRotationSession):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::safeAVAssetTracksForVisualMedia):
2021-08-07 David Kilzer <ddkilzer@apple.com>
UBSan: KeyboardScrollingAnimator.cpp:303:10: runtime error: load of value nnn, which is not a valid value for type 'bool'
<https://webkit.org/b/228901>
Reviewed by Tim Horton.
Covered by running 78 layout tests with UBSan enabled.
* platform/KeyboardScrollingAnimator.h:
- Initialize m_scrollTriggeringKeyIsPressed to false.
2021-08-07 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Web process crashes when detaching Document with uncommitted marked text
https://bugs.webkit.org/show_bug.cgi?id=228841
rdar://79960890
Reviewed by Ryosuke Niwa.
In the case where the document is in the process of being detached (underneath `willBeRemovedFromFrame()`), if
there is currently uncommitted marked text in the document, we will attempt to cancel the IME composition in the
process of clearing out the selection. On macOS, this calls into `Editor::cancelComposition()` which
subsequently triggers layout under various call stacks (DOM mutations, text event dispatch, and when scrolling
to reveal the selection); this triggers a security release assertion inside `Document::updateLayout()`.
To mitigate this, we avoid calling into this codepath if the Document no longer has a living render tree (i.e.,
the render tree has either been destroyed, is being destroyed, or has not been created yet).
Test: editing/inserting/remove-frame-with-marked-text.html
* editing/mac/EditorMac.mm:
(WebCore::Editor::selectionWillChange):
2021-08-07 Myles C. Maxfield <mmaxfield@apple.com>
Deduplicate logging channel algorithms
https://bugs.webkit.org/show_bug.cgi?id=228809
Reviewed by Fujii Hironori.
No new tests because there is no behavior change.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AXLogger.cpp:
* inspector/agents/page/PageConsoleAgent.cpp:
* page/Page.cpp:
* platform/LogInitialization.cpp: Copied from Source/WebCore/platform/LogInitialization.h.
(WebCore::logChannels):
(WebCore::getLogChannel):
* platform/LogInitialization.h:
* platform/Logging.cpp:
(WebCore::isLogChannelEnabled): Deleted.
(WebCore::setLogChannelToAccumulate): Deleted.
(WebCore::clearAllLogChannelsToAccumulate): Deleted.
(WebCore::initializeLogChannelsIfNecessary): Deleted.
(WebCore::getLogChannel): Deleted.
* platform/Logging.h:
* testing/js/WebCoreTestSupport.cpp:
(WebCoreTestSupport::setLogChannelToAccumulate):
(WebCoreTestSupport::clearAllLogChannelsToAccumulate):
(WebCoreTestSupport::initializeLogChannelsIfNecessary):
2021-08-07 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r280756.
https://bugs.webkit.org/show_bug.cgi?id=228897
Broke gtk build
Reverted changeset:
"Deduplicate logging channel algorithms"
https://bugs.webkit.org/show_bug.cgi?id=228809
https://commits.webkit.org/r280756
2021-08-07 Myles C. Maxfield <mmaxfield@apple.com>
Deduplicate logging channel algorithms
https://bugs.webkit.org/show_bug.cgi?id=228809
Reviewed by Fujii Hironori.
No new tests because there is no behavior change.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AXLogger.cpp:
* inspector/agents/page/PageConsoleAgent.cpp:
* page/Page.cpp:
* platform/LogInitialization.cpp: Copied from Source/WebCore/platform/LogInitialization.h.
(WebCore::logChannels):
(WebCore::getLogChannel):
* platform/LogInitialization.h:
* platform/Logging.cpp:
(WebCore::isLogChannelEnabled): Deleted.
(WebCore::setLogChannelToAccumulate): Deleted.
(WebCore::clearAllLogChannelsToAccumulate): Deleted.
(WebCore::initializeLogChannelsIfNecessary): Deleted.
(WebCore::getLogChannel): Deleted.
* platform/Logging.h:
* testing/js/WebCoreTestSupport.cpp:
(WebCoreTestSupport::setLogChannelToAccumulate):
(WebCoreTestSupport::clearAllLogChannelsToAccumulate):
(WebCoreTestSupport::initializeLogChannelsIfNecessary):
2021-08-06 Kate Cheney <katherine_cheney@apple.com>
CrashTracer: com.apple.WebKit.WebContent at com.apple.WebCore: WebCore::CryptoKeyRSA::exportJwk const
https://bugs.webkit.org/show_bug.cgi?id=228878
<rdar://problem/60147231>
Reviewed by Brent Fulgham.
exportData() could return nullptr. We should check the value of
rsaComponents before trying to use it.
* crypto/keys/CryptoKeyRSA.cpp:
(WebCore::CryptoKeyRSA::exportJwk const):
2021-08-06 Alexander Mikhaylenko <alexm@gnome.org>
REGRESSION(r279987): [GTK][WPE] It caused 2 new test failures
https://bugs.webkit.org/show_bug.cgi?id=228160
Reviewed by Michael Catanzaro.
Normally adjustText*() are only called for unstyled elements to adjust their platform
appearance, However, for entries we always call it since
https://bugs.webkit.org/show_bug.cgi?id=173572 and it causes problems.
That change was done for RenderThemeGtk and is not relevant anymore, so we can revert
it.
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle):
2021-08-06 Youenn Fablet <youenn@apple.com>
[GPUP] Test WebKit2.CrashGPUProcessAfterApplyingConstraints fails when Media in GPU Process is enabled
https://bugs.webkit.org/show_bug.cgi?id=228759
<rdar://problem/81529641>
Reviewed by Geoffrey Garen.
Revert part of https://trac.webkit.org/changeset/279940/webkit.
* platform/mediastream/RealtimeVideoSource.cpp:
(WebCore::RealtimeVideoSource::sourceSettingsChanged):
Covered by API test.
2021-08-06 Youenn Fablet <youenn@apple.com>
WebKit::SampleBufferDisplayLayer needs to handle GPUProcess crash
https://bugs.webkit.org/show_bug.cgi?id=228824
<rdar://problem/81564477>
Reviewed by Eric Carlson.
Manually tested.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferDisplayLayerStatusDidChange):
Recreate a new layer if the previous one failed.
2021-08-06 Andres Gonzalez <andresg_22@apple.com>
Crash at WebKit::WebPage::requestTextRecognition caused by accessibility invocation.
https://bugs.webkit.org/show_bug.cgi?id=228864
rdar://80679512
Reviewed by Chris Fleizach.
* accessibility/AXImage.cpp:
(WebCore::AXImage::imageOverlayElements):
It was calling requestTextRecognition with *element(), but element() can
return nullptr, which would lead to the crash.
2021-08-06 Jer Noble <jer.noble@apple.com>
[Cocoa] Remove support for AVAssetImageGenerator
https://bugs.webkit.org/show_bug.cgi?id=228560
<rdar://problem/81336280>
Reviewed by Eric Carlson.
A much more minimal approach to removing support for AVAssetImageGenerator.
The only time we use an AVAssetImageGenerator (as opposed to an AVPlayerItemVideoOutput)
is when the latter does not currently have an available image enqueued. Because painting
is a synchronous operation, we use a synchronous API (the generator) to create an image
for that operation. However, this can create deadlocks if (for example) the resource needs
to load data on the main thread in order to complete the painting operation.
Instead, allow the main runloop to spin while waiting (up to 1_s) for the video output
to receive a decoded frame.
Drive-by fixes:
- Don't create an AVPlayerLayer at AVPlayer-creation; this causes the AVPlayerItemVideoOutput
to never receive a decoded frambe (as the layer is not in a CALayer-heirarchy).
- preferredRenderingMode() shouldn't be "none" when the page isn't visible. We already
just mark the layer as "hidden" in that case.
- Don't tear down the AVPlayerItemVideoOutput when creating an AVPlayerLayer; it'll just
get re-created anyway.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::preferredRenderingMode const):
(WebCore::MediaPlayerPrivateAVFoundation::setUpVideoRendering):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintCurrentFrameInContext):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange):
(WebCore::MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange):
(-[WebCoreAVFPullDelegate outputMediaDataWillChange:]):
(-[WebCoreAVFPullDelegate setParent:]):
2021-08-06 Antti Koivisto <antti@apple.com>
REGRESSION (r274038): Keyframe animation with top/left with percentages fails to animate
https://bugs.webkit.org/show_bug.cgi?id=228811
<rdar://problem/81568266>
Reviewed by Alan Bujtas.
r274038 ended up disabling interpolation of percent values for top/left/bottom/right.
Test: animations/top-left-percent-interpolation.html
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
Enable them.
2021-08-06 Youenn Fablet <youenn@apple.com>
MediaPlayerPrivateMediaStreamAVFObjC should skip enqueuing frames when not visible
https://bugs.webkit.org/show_bug.cgi?id=228816
<rdar://81077972>
Reviewed by Eric Carlson.
Do not create layers when not needed.
This prevents enqueuing frames in a AVSampleBufferDisplayLayer that will only buffer them, thus breaking camera capture/video decoding.
We do this by not calling ensureLayers when getting a new track. Instead we react upon player renderingCanBeAccelerated value.
It is also unnecessary and takes CPU cycles to enqueue frames when the video element is not visible.
HTMLMediaElement and RenderVideo thus pass to MediaPlayer a new flag telling whether the video element is visible in the view port.
MediaPlayerPrivateMediaStreamAVFObjC will then skip enqueueing frames if not needed.
Add getter and internals API to cover these changes.
Test: fast/mediastream/mediaPlayer-visibility.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::isVisibleInViewportChanged):
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::loadWithNextMediaEngine):
(WebCore::MediaPlayer::setVisibleInViewport):
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::setVisibleInViewport):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVisible):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVisibleInViewport):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paintCurrentFrameInContext):
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::updatePlayer):
* testing/Internals.cpp:
(WebCore::Internals::isPlayerVisibleInViewport const):
* testing/Internals.h:
* testing/Internals.idl:
2021-08-05 Cameron McCormack <heycam@apple.com>
Stop tracking form elements with FormController
https://bugs.webkit.org/show_bug.cgi?id=228724
<rdar://problem/81435095>
Reviewed by Darin Adler.
FormController currently tracks the insertion order of
HTMLFormElementWithState objects in the document. But we don't need
to know this list of form controls until the time we need to save
form state for the document (e.g. on pagehide). So we instead
traverse the document to find those elements at the point we need
them, rather than maintain FormController::m_formElementsWithState.
This is a small speedup (1-2%) on a few of the Speedometer subtests
that insert and remove many input elements.
A future optimization could record on the Document whether there are
any input elements that have had their value changed, since it's
probably common for pages with form controls to never be changed.
* dom/Document.cpp:
(WebCore::Document::formElementsState const): Traverse the document to
find all the HTMLFormElementWithState objects.
* dom/Element.h:
(WebCore::Element::isFormControlElementWithState const):
* html/FormController.cpp:
(WebCore::FormController::createSavedFormStateMap):
(WebCore::FormController::formElementsState const):
* html/FormController.h:
* html/HTMLFormControlElementWithState.cpp:
(WebCore::HTMLFormControlElementWithState::insertedIntoAncestor):
Track the order that HTMLFormControlElementWithState objects are
inserted into the document.
(WebCore::HTMLFormControlElementWithState::removedFromAncestor):
* html/HTMLFormControlElementWithState.h:
(WebCore::HTMLFormControlElementWithState::insertionIndex const):
(isType):
* page/Frame.h: Remove unused formElementsCharacterCount.
* page/ios/FrameIOS.mm:
2021-08-05 Tim Horton <timothy_horton@apple.com>
fast/canvas/canvas-crash.html doesn't test what it intends to on iOS
https://bugs.webkit.org/show_bug.cgi?id=228747
Reviewed by Simon Fraser.
The test fast/canvas/canvas-crash.html intends to test changes made
to actual canvas code (see r215632); however, on the iOS simulator
the test doesn't even manage to make a canvas context because of
"maximum area" and "maximum backing store size" limits, which differ
per-platform. This results in unique test results for iOS, as well
as the test not actually exercising the code it was intended to.
Fix this by adding an override for the maximum area limit (we already
had one for maximum backing store size), and overriding them in
this test (and another similarly afflicted test).
* html/HTMLCanvasElement.cpp:
(WebCore::maxCanvasArea):
(WebCore::HTMLCanvasElement::setMaxCanvasAreaForTesting):
(WebCore::HTMLCanvasElement::createImageBuffer const):
* html/HTMLCanvasElement.h:
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setMaxCanvasArea):
* testing/Internals.h:
* testing/Internals.idl:
2021-08-05 Andres Gonzalez <andresg_22@apple.com>
VoiceOver is not announcing the state as selected/unselected when an item is selected in a grid.
https://bugs.webkit.org/show_bug.cgi?id=228840
<rdar://78225826>
Reviewed by Chris Fleizach.
Test: accessibility/selected-state-changed-notifications.html.
On iOS, a table/grid cell element is not exposed to AX clients. Instead
the content of the cell is. This patch ensures that if the cell element
is selected, the AX objects that represent the content inside the cell
will inherit the selected state from the cell.
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _accessibilityTraitsFromAncestors]):
2021-08-05 Tim Nguyen <ntim@apple.com>
Implement support for <dialog> element cancel event
https://bugs.webkit.org/show_bug.cgi?id=227534
Reviewed by Chris Dumez.
This makes <dialog> emit a cancel event then close when the escape key is pressed.
Updated relevant WPT:
- <dialog> cancel event WPTs: used send_keys instead of test_driver.Actions() (which are unsupported by WebKit test runner)
- oncancel now is recognized
Failing WPT:
- dialog-cancel-with-input.html: needs <dialog> focusing steps (webkit.org/b/227537) to be implemented for <input> to get focus
- dialog-cancel-with-select.html: needs <dialog> focusing steps (webkit.org/b/227537) to be implemented for <select> to get focus
- dialog-keydown-preventDefault.html: current implementation does not prevent canceling from happening when keydown event has preventDefault()
* dom/GlobalEventHandlers.idl:
* html/HTMLAttributeNames.in:
* html/HTMLDialogElement.cpp:
(WebCore::HTMLDialogElement::cancel):
* html/HTMLDialogElement.h:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::createEventHandlerNameMap):
* page/EventHandler.cpp:
(WebCore::EventHandler::internalKeyEvent):
2021-08-05 Eric Carlson <eric.carlson@apple.com>
[iOS] getUserMedia sometimes doesn't capture from specified microphone
https://bugs.webkit.org/show_bug.cgi?id=228753
rdar://79704226
Reviewed by Youenn Fablet.
The system will always choose the "default" audio input source unless
+[AVAudioSession setPreferredInput:error:] is called first, and that only works
if the audio session category has been set to PlayAndRecord *before* it is called,
so configure the audio session for recording before we choose and configure the
audio capture device.
Tested manually, this only reproduces on hardware.
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::activeAudioSessionRequired const): Audio
capture requires an active audio session.
(WebCore::PlatformMediaSessionManager::removeSession): Move `#if USE(AUDIO_SESSION)`
guard inside of maybeDeactivateAudioSession so it isn't spread throughout the file.
(WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback): Ditto.
(WebCore::PlatformMediaSessionManager::processWillSuspend): Ditto.
(WebCore::PlatformMediaSessionManager::processDidResume): Ditto.
(WebCore::PlatformMediaSessionManager::sessionCanProduceAudioChanged): Add logging,
call `maybeActivateAudioSession()` so we activate the audio session if necessary.
(WebCore::PlatformMediaSessionManager::addAudioCaptureSource): Call updateSessionState
instead of scheduleUpdateSessionState so the audio session category is updated
immediately.
(WebCore::PlatformMediaSessionManager::maybeDeactivateAudioSession): Move
`#if USE(AUDIO_SESSION)` into the function so it doesn't need to be spread
throughout the file.
(WebCore::PlatformMediaSessionManager::maybeActivateAudioSession): Ditto.
* platform/audio/PlatformMediaSessionManager.h:
(WebCore::PlatformMediaSessionManager::isApplicationInBackground const):
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSessionIOS::setPreferredBufferSize): Log an error if we are unable
to set the preferred buffer size.
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
(WebCore::AVAudioSessionCaptureDeviceManager::setPreferredAudioSessionDeviceUID):
New, set the preferred input so capture will use select the device we want.
(WebCore::AVAudioSessionCaptureDeviceManager::scheduleUpdateCaptureDevices): Remove
m_recomputeDevices, `setAudioCaptureDevices` has been restructured so we don't need it.
(WebCore::AVAudioSessionCaptureDeviceManager::computeCaptureDevices): Ditto.
(WebCore::AVAudioSessionCaptureDeviceManager::setAudioCaptureDevices): Don't update
the list of capture devices when the default device changes, only when a device is
added, removed, enabled, or disabled.
* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioSharedUnit::setCaptureDevice): Call `setPreferredAudioSessionDeviceUID`
so the correct device is selected.
(WebCore::CoreAudioSharedUnit::cleanupAudioUnit): Clear m_persistentID.
(WebCore::CoreAudioCaptureSource::create): Return an error with a string, or the
web process can detect a failure.
(WebCore::CoreAudioCaptureSource::stopProducingData): Add logging.
2021-08-05 Alan Bujtas <zalan@apple.com>
Document::isLayoutTimerActive should read isLayoutPending
https://bugs.webkit.org/show_bug.cgi?id=228835
Reviewed by Antti Koivisto.
Callers of this function curious about whether there's a layout scheduled.
* dom/Document.cpp:
(WebCore::Document::isLayoutPending const):
(WebCore::Document::isLayoutTimerActive const): Deleted.
* dom/Document.h:
* html/parser/HTMLParserScheduler.cpp:
(WebCore::HTMLParserScheduler::continueNextChunkTimerFired):
2021-08-05 Michael Catanzaro <mcatanzaro@gnome.org>
Suppress more -Wreturn-type warnings
https://bugs.webkit.org/show_bug.cgi?id=228831
Unreviewed.
* platform/KeyboardScrollingAnimator.cpp:
(WebCore::KeyboardScrollingAnimator::keyboardScrollForKeyboardEvent const):
2021-08-05 Michael Catanzaro <mcatanzaro@gnome.org>
GCC 11 builds should use -Wno-array-bounds, -Wno-nonnull
https://bugs.webkit.org/show_bug.cgi?id=228601
Reviewed by Carlos Garcia Campos.
* css/CSSValue.h:
(WebCore::CSSValue::deref):
* css/StyleRule.h:
(WebCore::StyleRuleBase::deref const):
* dom/Node.h:
(WebCore::Node::deref const):
2021-08-05 Rob Buis <rbuis@igalia.com>
Fix warning in HTTPParsers.parseStructuredFieldValue
https://bugs.webkit.org/show_bug.cgi?id=228815
Reviewed by Sam Weinig.
UChar is unsigned, so it is not needed to check that it is
zewro or greater.
* platform/network/HTTPParsers.cpp:
(WebCore::parseStructuredFieldValue):
2021-08-05 Imanol Fernandez <ifernandez@igalia.com>
Fix XR related clang warnings in WPE
https://bugs.webkit.org/show_bug.cgi?id=228779
Reviewed by Sam Weinig.
Fix a few compiler warnings.
* platform/xr/openxr/OpenXRInputSource.cpp:
(PlatformXR::OpenXRInputSource::getButton const):
* platform/xr/openxr/OpenXRSwapchain.cpp:
(PlatformXR::OpenXRSwapchain::create):
(PlatformXR::OpenXRSwapchain::OpenXRSwapchain):
(PlatformXR::OpenXRSwapchain::acquireImage):
* platform/xr/openxr/OpenXRSwapchain.h:
2021-08-04 Darin Adler <darin@apple.com>
Change WebSocket.cpp to @no-unify, since its hard to do that for someone without a Mac
https://bugs.webkit.org/show_bug.cgi?id=228808
Reviewed by Anders Carlsson.
* Sources.txt: Add @no-unify.
* WebCore.xcodeproj/project.pbxproj: Add WebSocket.cpp to the WebCore target.
2021-08-04 Devin Rousso <drousso@apple.com>
REGRESSION (r280374): ASSERTION FAILED: Completion handler should not be called more than once under WebCore::MediaControlsContextMenuProvider::contextMenuItemSelected
https://bugs.webkit.org/show_bug.cgi?id=228725
<rdar://problem/81437221>
Reviewed by Eric Carlson.
The contextmenu system used by (modern) media controls are a bit wonky in that it has to
support both macOS and iOS, which use wildly different mechanisms. The former has distinct
methods for handling when a contextmenu item is selected vs when the menu is dismissed (at
least as of r280374). The latter has a single method that handles both. Additionally, the
(modern) media controls JS expects the following from `showMediaControlsContextMenu`:
1. `showMediaControlsContextMenu` will only `return true` if the contextmenu will be shown
2. the callback provided to `showMediaControlsContextMenu` will always/only be invoked when
the contextmenu is dismissed (regardless of whether an item is selected)
3. if an item is selected, the logic for that will be handled by the `MediaControlsHost`
This patch primarily addresses #2, but also slightly adjusts the code to fix #1. It does #1
by moving the call that saves the callback further down. On iOS, #2 already works. On macOS,
it does #2 by changing from `CompletionHandler` to `Function`, allowing it to be called more
than once, with the understanding that the JS callback will not be invoked more than once.
This way, macOS can match the behavior of iOS by eagerly invoking the JS callback when a
contextmenu item is selected without waiting for the menu to actually dismiss, while still
handling the contextmenu being dismissed without an item being selected (and also not having
to worry about whether the `CompletionHandler` has already been invoked).
* Modules/mediacontrols/MediaControlsHost.h:
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsContextMenuProvider::create):
(WebCore::MediaControlsContextMenuProvider::MediaControlsContextMenuProvider):
(WebCore::MediaControlsContextMenuProvider::didDismissContextMenu):
(WebCore::MediaControlsContextMenuProvider::contextMenuCleared):
(WebCore::MediaControlsHost::showMediaControlsContextMenu):
2021-08-04 Dana Estra <destra@apple.com>
REGRESSION (r280492): Clicking backspace on sign in fields results in deleting two characters instead of one.
https://bugs.webkit.org/show_bug.cgi?id=228802
Reviewed by Tim Horton.
No tests yet.
* page/EventHandler.cpp:
(WebCore::EventHandler::defaultKeyboardEventHandler):
2021-08-04 Peng Liu <peng.liu6@apple.com>
[Catalina][GPUP] Some API tests fail after GPU Process features are enabled
https://bugs.webkit.org/show_bug.cgi?id=228589
Reviewed by Jer Noble.
When "Media in GPU Process" is enabled, `AudioSession[IOS|Mac]` runs in
the GPU process. `HTMLMediaElement`, which is an observer of audio session,
runs in a WebContent process. It cannot get its AudioSession's configuration
directly. We need a mechanism to "push" the latest audio session configuration
from the GPU process to the WebContent process.
This patch replaces the `MutedStateObserver` with an audio session configuration
change observer interface, so that an audio session will notify its observers
after changing its configurations, including buffer size, muted state, sample rate.
Currently, this observer interface is used on macOS only.
No new tests. Fix an API test failure.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::initializeMediaSession):
(WebCore::HTMLMediaElement::~HTMLMediaElement):
(WebCore::HTMLMediaElement::hardwareMutedStateDidChange):
* html/HTMLMediaElement.h:
* platform/audio/AudioSession.cpp:
(WebCore::AudioSession::addConfigurationChangeObserver):
(WebCore::AudioSession::removeConfigurationChangeObserver):
* platform/audio/AudioSession.h:
* platform/audio/ios/AudioSessionIOS.h:
Move `m_interruptionObservers` to this class because only `AudioSessionIOS`
supports interruption observers.
* platform/audio/mac/AudioSessionMac.h:
* platform/audio/mac/AudioSessionMac.mm:
(WebCore::AudioSessionMac::handleSampleRateChange):
(WebCore::AudioSessionMac::handleSampleRateChange const):
(WebCore::AudioSessionMac::handleBufferSizeChange):
(WebCore::AudioSessionMac::handleBufferSizeChange const):
(WebCore::AudioSessionMac::sampleRate const):
(WebCore::AudioSessionMac::setPreferredBufferSize):
(WebCore::AudioSessionMac::handleMutedStateChange):
(WebCore::AudioSessionMac::addConfigurationChangeObserver):
(WebCore::AudioSessionMac::removeConfigurationChangeObserver):
(WebCore::AudioSessionMac::addMutedStateObserver): Deleted.
(WebCore::AudioSessionMac::removeMutedStateObserver): Deleted.
2021-08-04 Miguel Gomez <magomez@igalia.com>
[GTK][WPE] Elliptic radial gradients are not working
https://bugs.webkit.org/show_bug.cgi?id=228771
Reviewed by Žan Doberšek.
Transform the radial circular gradients using the aspect ratio to convert
them into the appropriate elliptic gradients.
* platform/graphics/cairo/GradientCairo.cpp:
(WebCore::Gradient::createPattern):
2021-08-04 Devin Rousso <drousso@apple.com>
REGRESSION(?): subtitle text sizing is sometimes inconsistent
https://bugs.webkit.org/show_bug.cgi?id=228786
<rdar://problem/80525509>
Reviewed by Eric Carlson.
Tested manually. I'm still not 100% sure of the root cause of this, but after talking with
some folks more familiar with WebKit's media "stack" it seems like this only happens with
in-band non-VTT subtitle tracks that have their own styling. The fix is also pretty obvious.
* html/track/TextTrackCueGeneric.cpp:
(WebCore::TextTrackCueGeneric::setFontSize):
We should still pass along the new font size (and `bool important`) even if we don't have a
display tree yet, as the font size (and `bool important`) are used when the display tree is
created, meaning that we shouldn't have to wait for another `setFontSize` call after the
display tree is created in order to update the font size.
2021-08-04 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r280630.
https://bugs.webkit.org/show_bug.cgi?id=228788
broke some downstream tests
Reverted changeset:
"fast/canvas/canvas-crash.html doesn't test what it intends to
on iOS"
https://bugs.webkit.org/show_bug.cgi?id=228747
https://commits.webkit.org/r280630
2021-08-04 Antti Koivisto <antti@apple.com>
Use fast malloc for RuleData vectors
https://bugs.webkit.org/show_bug.cgi?id=228770
Reviewed by Chris Dumez.
Revert the change that enabled probabilistic guard malloc as it is not needed anymore.
* style/RuleFeature.h:
* style/RuleSet.h:
2021-08-04 Antti Koivisto <antti@apple.com>
Reduce Vector<> wasted capacity in some RuleSet code
https://bugs.webkit.org/show_bug.cgi?id=224160
<rdar://problem/76369555>
Unreviewed, reverting revert r279242.
Reland as this was not related to the crashes seen.
* style/RuleSet.cpp:
(WebCore::Style::RuleSet::addRulesFromSheet):
(WebCore::Style::RuleSet::evaluateDynamicMediaQueryRules):
(WebCore::Style::shrinkDynamicRules):
(WebCore::Style::RuleSet::shrinkToFit):
* style/RuleSet.h:
2021-08-04 Andres Gonzalez <andresg_22@apple.com>
Add support for aria-selected value changes in table cells.
https://bugs.webkit.org/show_bug.cgi?id=228756
<rdar://problem/81483071>
Reviewed by Chris Fleizach.
Test: accessibility/selected-state-changed-notifications.html
- Added the AXSelectedStateChangedNotification to notify AX clients that
the selected state of an object has changed.
- This notification is used in this patch for aria-selected value
changes in table cells.
* accessibility/AXLogger.cpp:
(WebCore::operator<<):
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::selectedStateChanged):
(WebCore::AXObjectCache::handleAttributeChange):
* accessibility/AXObjectCache.h:
* accessibility/ios/AXObjectCacheIOS.mm:
(WebCore::AXObjectCache::notificationPlatformName):
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::postPlatformNotification):
2021-08-04 Martin Robinson <mrobinson@webkit.org>
Add a HashTraits implementation for LayoutUnit
https://bugs.webkit.org/show_bug.cgi?id=228630
Reviewed by Fujii Hironori.
No new tests. This should not change behavior in an easily-observable way, but
could prevent rare hashing problems in the future.
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::updateSnapOffsetsForScrollableArea): Use LayoutUnit as the hash, which avoids
and extra conversion to float.
* platform/LayoutUnit.h: Add a HashTraits implementation for LayoutUnit.
2021-08-04 Cathie Chen <cathiechen@igalia.com>
REGRESSION (r277997) Images get stretched with aspect-ratio and max-width: x%
https://bugs.webkit.org/show_bug.cgi?id=228076
Reviewed by Antti Koivisto.
The image get stretched because constrainLogicalWidthInFragmentByMinMax returns the intrinsic width while computing MinSize.
According to [1], the box's minimum width is its min-content size not the MinIntrinsic width which is used because of
the recursion. To break the recursion, computeIntrinsicLogicalWidthUsing calls computeLogicalWidthFromAspectRatioInternal instead,
then checks children's width.
[1] https://www.w3.org/TR/css-sizing-4/#aspect-ratio-minimum
* rendering/RenderBox.cpp:
(WebCore::RenderBox::constrainLogicalWidthInFragmentByMinMax const): If shouldComputeLogicalWidthFromAspectRatio,
the length should be treated as MinContent not MinIntrinsic.
(WebCore::RenderBox::computeIntrinsicLogicalWidthUsing const): To break the loop, call computeLogicalWidthFromAspectRatioInternal instead
to get the width from aspect-ratio and if there is child, make sure the min/max logical width not less than content's width.
(WebCore::RenderBox::computeLogicalWidthFromAspectRatioInternal const):
(WebCore::RenderBox::computeLogicalWidthFromAspectRatio const):
* rendering/RenderBox.h:
2021-08-04 Tim Horton <timothy_horton@apple.com>
fast/canvas/canvas-crash.html doesn't test what it intends to on iOS
https://bugs.webkit.org/show_bug.cgi?id=228747
Reviewed by Simon Fraser.
The test fast/canvas/canvas-crash.html intends to test changes made
to actual canvas code (see r215632); however, on the iOS simulator
the test doesn't even manage to make a canvas context because of
"maximum area" and "maximum backing store size" limits, which differ
per-platform. This results in unique test results for iOS, as well
as the test not actually exercising the code it was intended to.
Fix this by adding an override for the maximum area limit (we already
had one for maximum backing store size), and overriding them in
this test (and another similarly afflicted test).
* html/HTMLCanvasElement.cpp:
(WebCore::maxCanvasArea):
(WebCore::HTMLCanvasElement::setMaxCanvasAreaForTesting):
(WebCore::HTMLCanvasElement::createImageBuffer const):
* html/HTMLCanvasElement.h:
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setMaxCanvasArea):
* testing/Internals.h:
* testing/Internals.idl:
2021-08-04 Carlos Garcia Campos <cgarcia@igalia.com>
Add missing null-check in Touch constructor
https://bugs.webkit.org/show_bug.cgi?id=228231
Reviewed by Darin Adler.
* dom/Touch.cpp:
(WebCore::scaledLocation): Helper to initialize absolutePosition.
(WebCore::Touch::Touch): Use scaledLocation().
2021-08-03 Alexey Shvayka <shvaikalesh@gmail.com>
ReadableStream's pipeTo() and pipeThrough() don't properly check for AbortSignal
https://bugs.webkit.org/show_bug.cgi?id=227693
Reviewed by Sam Weinig.
This patch introduces @isAbortSignal global private function to replace `instanceof`
checks that a) were false positive for `Object.create(AbortSignal.prototype)` and
b) observably performed [[GetPrototypeOf]] and Symbol.hasInstance lookup / call.
Aligns WebKit with Blink and the spec (https://heycam.github.io/webidl/#implements).
Test: imported/w3c/web-platform-tests/streams/piping/abort.any.js
* Modules/streams/ReadableStream.js:
(pipeThrough):
(pipeTo):
* Modules/streams/ReadableStreamInternals.js:
(readableStreamPipeToWritableStream):
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSC_DEFINE_HOST_FUNCTION):
(WebCore::JSDOMGlobalObject::addBuiltinGlobals):
* bindings/js/WebCoreBuiltinNames.h:
2021-08-03 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, reverting r280531 and r280589.
caused
Reverted changesets:
"[Cocoa] Remove support for AVAssetImageGenerator"
https://bugs.webkit.org/show_bug.cgi?id=228560
https://commits.webkit.org/r280531
"REGRESSION (r280531): multiple modern-media-controls tests
have become flaky timeouts"
https://bugs.webkit.org/show_bug.cgi?id=228714
https://commits.webkit.org/r280589
2021-08-03 Alex Christensen <achristensen@webkit.org>
Null check self.session after calling _cancel instead of before
https://bugs.webkit.org/show_bug.cgi?id=228757
<rdar://79224868>
Reviewed by Geoffrey Garen.
_cancel already null checks self.session before using it.
It seems to be setting self.session to null after the null check, so move the null check to before we use it.
This should fix an occasional crash during teardown.
* platform/network/cocoa/WebCoreNSURLSession.mm:
(-[WebCoreNSURLSessionDataTask _restart]):
2021-08-03 Kimmo Kinnunen <kkinnunen@apple.com>
Crash while reading WebGL drawing buffer if canvas image buffer allocation fails
https://bugs.webkit.org/show_bug.cgi?id=228737
<rdar://81150042>
Reviewed by Brent Fulgham.
The crash would happen for example when running out of memory during snapshot
or printing. Snapshots and printing forces the WebGL canvas to be "painted
to document", which would then trigger the crash.
Other code-paths that invoke CanvasBase::makeRenderingResultsAvailable,
e.g. toDataURL and drawImage will check for the buffer before, and
as such are not testable in the sense that adding the test would trigger
the bug.
Test: webgl/webgl-oom-paint-document-no-crash.html
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::paintRenderingResultsToCanvas):
Check for the nullptr from CanvasBase::buffer(). This might happen
when the ImageBuffer was not allocated due to memory constraints.
2021-08-03 Antti Koivisto <antti@apple.com>
REGRESSION(r279050): Crash under CSSImageValue::createDeprecatedCSSOMWrapper with cursor images
https://bugs.webkit.org/show_bug.cgi?id=228735
Reviewed by Alex Christensen.
CSSCursorImageValue is not a CSSImageValue. This used to work before r279050 because they had
the URL field in the same offset.
Test: fast/css/cursor-image-cssvalue.html
* css/CSSValue.cpp:
(WebCore::CSSValue::createDeprecatedCSSOMWrapper const):
Don't do any special handling for CSSCursorImageValue. They are exposed as generic (deprecated)
CSS values with cssText only.
2021-08-03 Alex Christensen <achristensen@webkit.org>
Use WeakPtr instead of manual raw pointer management in URLSearchParams
https://bugs.webkit.org/show_bug.cgi?id=228723
Reviewed by Chris Dumez.
This is less error prone.
* html/DOMURL.cpp:
(WebCore::DOMURL::~DOMURL): Deleted.
* html/DOMURL.h:
* html/URLSearchParams.cpp:
(WebCore::URLSearchParams::URLSearchParams):
* html/URLSearchParams.h:
(WebCore::URLSearchParams::associatedURLDestroyed): Deleted.
2021-08-03 Youenn Fablet <youenn@apple.com>
ReadableStream's pipeTo() and pipeThrough() don't handle options in spec-perfect way
https://bugs.webkit.org/show_bug.cgi?id=227690
<rdar://problem/80482144>
Reviewed by Alexey Shvayka.
Order getters as per spec for pipeTo and pipeThrough.
Handle the case of null dictionaries as if they are undefined
Use getter instead of using 'in' as per WebIDL spec.
If options is undefined, skip calling any getter.
Covered by updated test.
* Modules/streams/ReadableStream.js:
(pipeThrough):
(pipeTo):
2021-08-03 Youenn Fablet <youenn@apple.com>
Update FirstWithDOMWindowReuseRestriction linked-on-or-after check to latest MacOS/iOS betas
https://bugs.webkit.org/show_bug.cgi?id=228736
<rdar://81419036>
Reviewed by Chris Dumez.
* platform/cocoa/VersionChecks.h:
Delay enabling new behavior to MacOS 12 and iOS 15 SDK since new behavior is enabled for those OS versions.
2021-08-03 Jer Noble <jer.noble@apple.com>
REGRESSION (r280531): multiple modern-media-controls tests have become flaky timeouts
https://bugs.webkit.org/show_bug.cgi?id=228714
<rdar://problem/81426715>
Reviewed by Eric Carlson.
Update preferredRenderingMode() to reflect what setUpVideoRendering() actually does: use
MediaRenderingToContext whenever possible. This will cause setUpVideoRendering() to be
called from updateStates() to create the context, even if the element has been marked as
!isVisible() by RenderVideo upon removal from the DOM.
Also, in renderingModeChanged(), don't attempt to deduce whether scheduleUpdateStates()
should be called; just call it universally.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::preferredRenderingMode const):
(WebCore::MediaPlayerPrivateAVFoundation::renderingModeChanged):
2021-08-03 Kimmo Kinnunen <kkinnunen@apple.com>
Crash in webgl/1.0.x/conformance/textures/misc/texture-with-flip-y-and-premultiply-alpha.html
https://bugs.webkit.org/show_bug.cgi?id=223920
<rdar://problem/76261913>
Reviewed by Kenneth Russell.
After enabling WEBGL_depth_texture, the getDataFormat would assert for case of
format == RGBA, type == UNSIGNED_SHORT. UNSIGNED_SHORT is intended for
format == DEPTH_COMPONENT.
Instead, return error if the data conversion cannot be done. This is better in all
cases than doing non-expected data conversion in release build and assertion in
debug builds.
Tested by webgl/1.0.x/conformance/textures/misc/texture-with-flip-y-and-premultiply-alpha.html
(disabled for now).
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::texImageArrayBufferViewHelper):
* platform/graphics/GraphicsContextGL.cpp:
(WebCore::getDataFormat):
(WebCore::packPixels):
(WebCore::GraphicsContextGL::extractTextureData):
* platform/graphics/GraphicsContextGL.h:
2021-08-03 Rob Buis <rbuis@igalia.com>
Check that shadow root is connected in invalidateStyleAfterStyleSheetChange
https://bugs.webkit.org/show_bug.cgi?id=227383
Reviewed by Antti Koivisto.
Check that shadow root is connected in invalidateStyleAfterStyleSheetChange.
Test: fast/shadow-dom/shadow-tree-removal-crash.html
* style/StyleScope.cpp:
(WebCore::Style::Scope::updateActiveStyleSheets):
2021-08-02 Frédéric Wang <fwang@igalia.com>
Align implementation of PositionIterator::isCandidate() on Position::isCandidate()
https://bugs.webkit.org/show_bug.cgi?id=228635
Reviewed by Darin Adler.
The bug fixed in r280381 was due to the fact that PositionIterator::isCandidate() and
Position::isCandidate() had gone out of sync. To prevent future bugs of this kind, this patch
modifies PositionIterator::isCandidate() so that it is aligned with
PositionIterator::isCandidate() (except when an m_anchorType check is needed) and add code
comments in both functions to ensure the same changes are always applied to them.
* dom/Position.cpp:
(WebCore::Position::isCandidate const): Add a comment to make sure we update PositionIterator
when changing that function. Also use auto for a local variable like in PositionIterator.
* dom/PositionIterator.cpp:
(WebCore::PositionIterator::isCandidate const): Add a comment to make sure we update Position
when changing that function. Rearrange the code to use positionBeforeOrAfterNodeIsCandidate
and early return when the node is a <html> element (these are not behavior changes). For
block flow / grid / flexbox renderers, add a special handling when the anchor node is a root
editable element ; also change the fallback value returned at the end of the function (these
are two behavior changes).
2021-08-02 Jean-Yves Avenard <jya@apple.com>
[WebAudio] webm; properly trim frames according to the codec delay information
https://bugs.webkit.org/show_bug.cgi?id=228140
rdar://problem/80883882
Reviewed by Eric Carlson.
Add frame-perfect decoding for Opus and Vorbis in WebM container.
Unfortunately, due to a vorbis decoder bug, it is not possible to test that
vorbis decoding returns the right number of frames.
Amend Opus test to ensure the right amount of frames are returned.
* platform/audio/cocoa/AudioFileReaderCocoa.cpp:
(WebCore::AudioFileReader::demuxWebMData const):
(WebCore::passthroughInputDataCallback): AudioToolbox internal logging could overflow
if we used packet descriptions with offsets, so we take the most commonly used scenario
where we have a single packet to decode at a time.
(WebCore::AudioFileReader::decodeWebMData const):
* platform/graphics/cocoa/AudioTrackPrivateWebM.cpp:
(WebCore::AudioTrackPrivateWebM::codecDelay const):
(WebCore::AudioTrackPrivateWebM::setDiscardPadding):
(WebCore::AudioTrackPrivateWebM::discardPadding const):
* platform/graphics/cocoa/AudioTrackPrivateWebM.h:
* platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::SourceBufferParserWebM::OnElementEnd): Fly-by, ensure m_didParseInitializationDataCallback
only ever accessed on client thread.
(WebCore::SourceBufferParserWebM::OnBlockGroupEnd):
* platform/graphics/cocoa/SourceBufferParserWebM.h: Add trimming data callback.
Only mark WEBCORE_EXPORT the methods that need it.
(WebCore::SourceBufferParserWebM::appendData):
(WebCore::SourceBufferParserWebM::setDidParseTrimmingDataCallback):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::canPlayType const): Make canPlayType(webm/audio; codecs=vorbis)
returns maybe if feature flag set.
2021-08-02 Chris Dumez <cdumez@apple.com>
[COOP] Cross-Origin-Opener-Policy header parsing fails when report-to parameter is present
https://bugs.webkit.org/show_bug.cgi?id=228719
Reviewed by Geoff Garen.
Cross-Origin-Opener-Policy header parsing fails when report-to parameter is present, because
parseStructuredFieldValue() doesn't handle parameters whose value is double-quoted:
- https://datatracker.ietf.org/doc/html/rfc8941#section-4.2.3.2
- https://datatracker.ietf.org/doc/html/rfc8941#section-4.2.3.1
- https://datatracker.ietf.org/doc/html/rfc8941#section-4.2.5
Test: http/wpt/cross-origin-opener-policy/header-parsing-with-report-to.https.html
* platform/network/HTTPParsers.cpp:
(WebCore::parseStructuredFieldValue):
2021-08-02 Sonia Singla <soniasingla.1812@gmail.com>
[css-cleanup] Replace webkit- prefix properties with Standard CSS Properties in Source/**
https://bugs.webkit.org/show_bug.cgi?id=228697
Reviewed by Frédéric Wang.
* Modules/mediacontrols/mediaControlsApple.css:
(video::-webkit-media-controls-closed-captions-container h3,):
* Modules/mediacontrols/mediaControlsBase.css:
(video::-webkit-media-controls-closed-captions-container h3,):
(video::-webkit-media-controls-closed-captions-container li.selected::before,):
* css/html.css:
(p):
(blockquote):
(figure):
(hr):
(h1):
(:is(article, aside, nav, section) h1):
(:is(article, aside, nav, section) :is(article, aside, nav, section) h1):
(:is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1):
(:is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1):
(:is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1):
(h2):
(h3):
(h4):
(h5):
(h6):
(ul, menu, dir):
(ol):
(dd):
(dl):
(ol ul, ul ol, ul ul, ol ol):
(legend):
(fieldset):
* css/mathml.css:
(mi):
(msub > mi:first-child, msubsup > mi:first-child):
(msubsup > mi:first-child + * + *):
2021-08-02 Sihui Liu <sihui_liu@apple.com>
Assertion is not acquired in network process when opening a SQLite database
https://bugs.webkit.org/show_bug.cgi?id=228705
Reviewed by Chris Dumez.
Opening database may require database file lock.
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::open):
2021-08-01 Ryosuke Niwa <rniwa@webkit.org>
Calling unobserve on ResizeObserver should not clear existing observations in active targets
https://bugs.webkit.org/show_bug.cgi?id=228693
Reviewed by Chris Dumez.
The bug was caused by ResizeObserver::removeObservation removing it from the active targets.
Note that there is nothing in the specification which alludes to this behavior,
and the new behavior is consistent with Firefox and the way IntersectionObserver works:
https://drafts.csswg.org/resize-observer/#dom-resizeobserver-unobserve
To keep elements alive while they're in the active targets but not in the observation targets,
this patch also makes each element of the active observation as opaque roots of ResizeObserver
in ResizeObserver::isReachableFromOpaqueRoots.
Test: resize-observer/resize-observer-keeps-element-of-queued-entry-alive.html
* page/ResizeObserver.cpp:
(WebCore::ResizeObserver::deliverObservations):
(WebCore::ResizeObserver::isReachableFromOpaqueRoots const):
(WebCore::ResizeObserver::removeObservation):
2021-08-02 Ryosuke Niwa <rniwa@webkit.org>
REGRESSION(r279800): IntersectionObserver may never get a delivery of an observation if the element
has been unobserved and is disconnected
https://bugs.webkit.org/show_bug.cgi?id=228679
Reviewed by Chris Dumez.
The bug was caused by the elements of the pending entries not being considered as opaque roots
of the intersection observer. If the intersection observer is no longer observing those elements,
the JS wrapper of the intersection observer may be collected erroneously.
This patch addresses this issue by explicitly treating the elements of pending entries as
opaque roots of the intersection observer in IntersectionObserver::isReachableFromOpaqueRoots.
Test: intersection-observer/intersection-observer-keeps-element-of-queued-entry-alive.html
* page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::isReachableFromOpaqueRoots const):
2021-08-02 Wenson Hsieh <wenson_hsieh@apple.com>
[Live Text] Use iBeam cursor when hovering over selectable text inside image links
https://bugs.webkit.org/show_bug.cgi?id=228700
rdar://81210248
Reviewed by Tim Horton.
Make a couple of small adjustments to allow the cursor to change to an I-beam when hovering over selectable Live
Text inside images in links, but only in the case where the computed cursor type is Auto. Currently, this always
results in a Hand cursor type because of the link ancestor, despite the injected Live Text being selectable.
Test: fast/images/text-recognition/mac/cursor-types-for-recognized-text.html
* html/HTMLElement.cpp:
(WebCore::HTMLElement::updateWithTextRecognitionResult):
Drive-by fix an adjacent bug, wherein we try to check whether the image element has `user-select: none;` before
the style has been resolved, which results in injecting selectable Live Text even when the page has explicitly
disabled text selection on the image element. Instead, move this code to right after we update layout after
ensuring the UA shadow DOM structure for Live Text, so that the bool flag is meaningful.
* page/EventHandler.cpp:
(WebCore::EventHandler::selectCursor):
2021-08-02 Chris Dumez <cdumez@apple.com>
imported/w3c/web-platform-tests/webmessaging/broadcastchannel/blobs.html is a flaky failure since implementing BlobChannel
https://bugs.webkit.org/show_bug.cgi?id=228168
<rdar://problem/80922502>
Reviewed by Alex Christensen.
The test was flaky because it is trying to send a Blob via BroadcastChannel.postMessage()
without keeping the blob alive. When GC triggers, the Blob would go away and trying to
decode the Blob upon receiving would fail.
To address the issue, I introduced a Blob::Handle class that wraps the Blob's internal URL
and keeps the Blob data alive as long as as someone is holding such handle. Previously,
the Blob destructor would unregister the internal URL and the Blob data would go away.
I then updated SerializedScriptValue to hold on to Blob::Handle objects instead of Blob
URLs. This guarantees that when using postMessage() to send a message to a worker, the
Blob data will stay alive until we dispatch the message event on the worker side and try
and deserialized the SerializedScriptValue.
For BroadcastChannel.postMessage() though, we end up going via the network process and
the SerializedScriptValue ends up getting serialized/deserialized over IPC. I added a
CompletionHandler to BroadcastChannelRegistry::postMessage() which only gets called
once the message event has successfully been dispatched. I use this completion handler
to make sure the SerializedScriptValue's Blob URLs stay valid until the the message has
been dispatched by holding on to the Blob::Handles.
No new tests, unskipped existing test.
* Modules/indexeddb/IDBValue.cpp:
(WebCore::IDBValue::IDBValue):
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::serialize):
(WebCore::CloneSerializer::CloneSerializer):
(WebCore::CloneSerializer::dumpIfTerminal):
(WebCore::CloneSerializer::write):
(WebCore::SerializedScriptValue::SerializedScriptValue):
(WebCore::SerializedScriptValue::computeMemoryCost const):
(WebCore::SerializedScriptValue::create):
(WebCore::SerializedScriptValue::blobURLs const):
(WebCore::SerializedScriptValue::writeBlobsToDiskForIndexedDB):
* bindings/js/SerializedScriptValue.h:
(WebCore::SerializedScriptValue::hasBlobURLs const):
(WebCore::SerializedScriptValue::blobHandles const):
(WebCore::SerializedScriptValue::SerializedScriptValue):
* dom/BroadcastChannel.cpp:
(WebCore::BroadcastChannel::postMessage):
(WebCore::BroadcastChannel::dispatchMessageTo):
* dom/BroadcastChannel.h:
* dom/BroadcastChannelRegistry.h:
* fileapi/Blob.cpp:
(WebCore::BlobInternalURL::create):
(WebCore::BlobInternalURL::~BlobInternalURL):
(WebCore::BlobInternalURL::url const):
(WebCore::BlobInternalURL::BlobInternalURL):
(WebCore::Blob::Blob):
(WebCore::Blob::~Blob):
(WebCore::Blob::url const):
(WebCore::Blob::slice const):
(WebCore::Blob::size const):
(WebCore::Blob::handle const):
(WebCore::Blob::Handle::Handle):
(WebCore::Blob::Handle::url const):
* fileapi/Blob.h:
* loader/EmptyClients.cpp:
2021-08-02 Wenson Hsieh <wenson_hsieh@apple.com>
REGRESSION (Safari 15): Unable to repaint canvases with software filters when GPU Process is enabled
https://bugs.webkit.org/show_bug.cgi?id=228682
rdar://79699997
Reviewed by Simon Fraser.
In the case where GPU process is enabled for canvas rendering but is not enabled for DOM rendering, canvas
elements with software CSS filters fail to repaint as the canvas' backing image buffer changes. In this
particular scenario, we first paint the canvas' remotely-backed image buffer into the filter's input buffer,
which is backed by an unaccelerated graphics context. The filter is then applied, producing an output image
buffer which we then paint into the page. The bug occurs during the initial step of painting the contents of the
canvas' remote image buffer into the filter's input context, which involves creating a CGImageRef from the
`ImageBufferCGBackend::draw`.
When asking for a CGImageRef from the canvas' image buffer (which is backed by an IOSurface that's drawn into in
the GPU process), QuartzCore caches the resulting CGImageRef corresponding to the IOSurface handle in the web
process. Subsequently, when we try to repaint the canvas, we'll end up using this same initial cached CGImageRef
because the graphics context of the IOSurface handle in the web process hasn't been drawn into (because all the
actual draw calls are made in the GPU process). As such, regardless of the current state of the canvas' image
buffer, the input to the filter will always be the initial native image created from the canvas' image buffer.
We avoid this problem when GPU process is disabled because the calls to update the canvas' 2D context in the
web process will clear out the cached CGImageRef in QuartzCore. Additionally, we avoid this problem when drawing
into accelerated contexts because QuartzCore will draw the cached CGImageRef using a codepath that reads back
the up-to-date contents from the IOSurface. However, in the QuartzCore's unaccelerated (ripc) image drawing
codepath, we copy the contents of the cached image right away, causing us to end up with stale image data that
does not reflect the current state of the IOSurface.
To work around this in Safari 15 (in both Monterey as well as downlevel versions of macOS), we deploy a similar
technique as we'd previously used in r201334 to invalidate QuartzCore's cached image, but only:
1. If the seed value of the backing IOSurface has changed since the last time we've drawn the image buffer, and
2. The destination context we're painting the image buffer into is unaccelerated.
Test: css3/filters/canvas-with-filter-after-repaint.html
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::ImageBufferCGBackend::draw):
(WebCore::ImageBufferCGBackend::drawPattern):
Call into `prepareToDrawIntoContext` (see below).
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::ImageBufferCGBackend::prepareToDrawIntoContext):
* platform/graphics/cg/ImageBufferCGBackend.h:
* platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
(WebCore::ImageBufferIOSurfaceBackend::prepareToDrawIntoContext):
Add a new subclassable method on ImageBufferCGBackend that's invoked before drawing the contents of the image
buffer into a given destination GraphicsContext. We use this opportunity in ImageBufferIOSurfaceBackend to
notice if the IOSurface seed count has updated since we've last drawn the image buffer, and intentionally emit a
no-op drawing command (i.e. filling an empty rect) in the graphics context to invalidate QuartzCore's cached
CGImageRef. Note that we only deploy this workaround when drawing into unaccelerated contexts (see above for
more details).
(WebCore::ImageBufferIOSurfaceBackend::invalidateCachedNativeImage const):
Pull the no-op drawing command out into a separate helper method, with a comment describing why this exists.
(WebCore::ImageBufferIOSurfaceBackend::drawConsuming):
(WebCore::ImageBufferIOSurfaceBackend::copyCGImageForEncoding const):
* platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
* platform/graphics/cocoa/IOSurface.h:
* platform/graphics/cocoa/IOSurface.mm:
(WebCore::IOSurface::seed const):
Add a helper method to grab the seed value of an IOSurface.
2021-08-02 Chris Dumez <cdumez@apple.com>
HTMLElement.innerText setter should convert new lines to <br>
https://bugs.webkit.org/show_bug.cgi?id=228605
<rdar://problem/81333038>
Reviewed by Darin Adler.
HTMLElement.innerText setter should convert new lines to <br>:
- https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute:dom-innertext-3
- https://html.spec.whatwg.org/multipage/dom.html#rendered-text-fragment
Our innerText setter had some logic that was specific to render styles that isn't part of
the specification. It was causing us to not replace the new lines with <br> in some
web-observable cases. I dropped this logic to align with Blink and Gecko.
No new tests, rebaselined existing tests.
* html/HTMLElement.cpp:
(WebCore::HTMLElement::setInnerText):
2021-08-02 Sam Weinig <weinig@apple.com>
[Modern Media Controls] Address additional feedback on LayoutTraits refactor
https://bugs.webkit.org/show_bug.cgi?id=227489
<rdar://problem/80215569>
Reviewed by Devin Rousso.
Splitting up larger change to land pieces incrementally.
Part 1:
- Replaces eval() based lexical lookup with an explicit `window.layoutTraitsClasses`
registry map.
* Modules/modern-media-controls/controls/ios-layout-traits.js:
* Modules/modern-media-controls/controls/layout-traits.js:
* Modules/modern-media-controls/controls/macos-layout-traits.js:
* Modules/modern-media-controls/controls/watchos-layout-traits.js:
* Modules/modern-media-controls/media/media-controller.js:
(MediaController.prototype.get layoutTraits):
2021-08-02 Jer Noble <jer.noble@apple.com>
[Cocoa] Remove support for AVAssetImageGenerator
https://bugs.webkit.org/show_bug.cgi?id=228560
Reviewed by Eric Carlson.
AVAssetImageGenerator is used when there is not yet an available image from
AVPlayerItemVideoOutput. However, AVAssetImageGenerator is a synchronous API call; if data
for the current time is not available, the generator will cause a request for that data to
be issued, and if the main thread is blocked in a synchronous call to the generator, that
request can never be completed, causing a deadlock.
Instead, always block moving to a readyState >= HAVE_CURRENT_DATA until either the
AVPlayerLayer or the AVPlayerItemVideoOutput report having an available frame. This
prevents clients from attempting to paint until a frame is available, and ensures that we
will always have an available frame for painting, removing the need for the synchronous
generator call.
To ensure the readyState is updated when AVPlayerItemVideoOutput has an available image,
register with the output at creation time for a notification as soon as an image is
available. And in the existing delegate object, send a message back to the
MediaPlayerPrivateAVFoundationObjC when that occurs.
No tests needed; this should reduce flakiness of existing tests and cause no regression in
behavior.
Note, changes from last attempt:
AVPlayerLayer will fail to move to the -readyForDisplay state if it's not attached to a
layer tree, so when we remove the HTMLMediaElement from the DOM, we must send MediaPlayer a
acceleratedRenderingStateChanged() notification. This will cause the
MediaPlayerPrivateAVFoundationObjC to throw away its AVPlayerLayer, and will not block
moving to HAVE_CURRENT_DATA waiting for the layer to become readyForDisplay.
When we throw away (or create) the AVPlayerLayer, we must conditionally call updateStates
() to recalculate the readyState; but because updateStates() may try to create or destroy
an AVPlayerLayer, we must do this on a task to avoid re-entrancy. Adopt these changes
inside MediaPlayerPrivateAVFoundationCF as well.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::pauseAfterDetachedTask):
(WebCore::HTMLMediaElement::mediaPlayerRenderingCanBeAccelerated):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::setUpVideoRendering):
(WebCore::MediaPlayerPrivateAVFoundation::prepareForRendering):
(WebCore::MediaPlayerPrivateAVFoundation::renderingModeChanged):
(WebCore::MediaPlayerPrivateAVFoundation::scheduleUpdateStates):
(WebCore::MediaPlayerPrivateAVFoundation::updateStates):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::hasContextRenderer const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyContextVideoRenderer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintCurrentFrameInContext):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
(-[WebCoreAVFPullDelegate setParent:]):
(-[WebCoreAVFPullDelegate outputMediaDataWillChange:]):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageGenerator): Deleted.
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyImageGenerator): Deleted.
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator): Deleted.
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect): Deleted.
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::MediaPlayerPrivateAVFoundationCF::createVideoLayer):
(WebCore::MediaPlayerPrivateAVFoundationCF::destroyVideoLayer):
2021-08-02 Alan Bujtas <zalan@apple.com>
REGRESSION (r273072): Images do not layout correctly on walmart.com/grocery
https://bugs.webkit.org/show_bug.cgi?id=228656
<rdar://80418083>
Reviewed by Sergio Villar Senin.
Take the min/max values into account when computing the definite size (https://drafts.csswg.org/css-sizing-3/#definite)
for the flex child.
Test: fast/flexbox/flex-with-min-max-height.html
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeCrossSizeForChildUsingContainerCrossSize const):
2021-08-02 Andres Gonzalez <andresg_22@apple.com>
Fix for [WebAccessibilityObjectWrapper lineRectsAndText] to properly handle replacement nodes and SVG text.
https://bugs.webkit.org/show_bug.cgi?id=228336
<rdar://problem/81172124>
Reviewed by Chris Fleizach and Darin Adler.
Test: LayoutTests/accessibility/ios-simulator/element-line-rects-and-text.html
- Renamed stringsForSimpleRange to better reflect the fact that this
method can return strings and AXObjects.
- Handles the case where contentForSimpleRange returns AXObjects
corresponding to replacement objects. This fixes the cases of images and
SVG text.
- Fixed the problem with soft linebreaks where the start of the next
line was skipping the first character in the line.
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper contentForSimpleRange:attributed:]):
(-[WebAccessibilityObjectWrapper arrayOfTextForTextMarkers:attributed:]):
(-[WebAccessibilityObjectWrapper lineRectsAndText]):
(-[WebAccessibilityObjectWrapper stringsForSimpleRange:attributed:]):
Renamed to contentForSimpleRange since it is returns an array of strings
and AXObjects.
2021-08-02 Martin Robinson <mrobinson@webkit.org>
[css-scroll-snap] Consider all snap areas at a given snap offset when snapping
https://bugs.webkit.org/show_bug.cgi?id=228141
Reviewed by Frédéric Wang.
When deciding whether to snap to snap areas that overflow the snap port, don't
just consider the first snap area at a given snap offset. Instead, keep information
about all snap areas in the ScrolSnapOffsetInfo. In order to avoid iterating over
arrays of hundreds of rectangles, also record whether any of them are larger than
the viewport. This will avoid extra work on the most common usecase of large sets
of snap areas (gridded table layouts).
This change is tested by extending an existing WPT test.
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::rangeForAxis): Added this helper.
(WebCore::searchForPotentialSnapPoints): When deciding if a particular snap area
overflows the snap port, look at all available snap areas instead of just the
first one.
(WebCore::updateSnapOffsetsForScrollableArea): Instead of only recording the first
snap area, record all of them in the list of snap area rectangles.
(WebCore::convertOffsetInfo): Convert the list of snap ares.
* page/scrolling/ScrollSnapOffsetsInfo.h:
(WebCore::operator==): Added this operator which is necessary now that snapAreaIndices
is a vector.
2021-08-01 Rob Buis <rbuis@igalia.com>
Migrate GlyphOverflow to LayoutUnits instead of ints
https://bugs.webkit.org/show_bug.cgi?id=133040
Reviewed by Darin Adler.
Migrate GlyphOverflow to LayoutUnits instead of ints. This
is another step in the direction of subpixel layout/rendering.
* platform/graphics/FontCascade.h:
* rendering/LegacyInlineFlowBox.cpp:
(WebCore::LegacyInlineFlowBox::addTextBoxVisualOverflow):
* rendering/LegacyRootInlineBox.cpp:
(WebCore::LegacyRootInlineBox::ascentAndDescentForBox const):
* rendering/RenderText.cpp:
(WebCore::RenderText::computePreferredLogicalWidths):
* style/InlineTextBoxStyle.cpp:
(WebCore::extendIntToFloat):
2021-07-31 Maciej Stachowiak <mjs@apple.com>
ListAttributeTargetObserver is needlessly created even when there is no list attribute
https://bugs.webkit.org/show_bug.cgi?id=228541
Reviewed by Yusuke Suzuki.
No new tests because no behavior change.
This is possibly a small improvement (~0.5%) on Speedometer subtests that do innerHTML, but not statistically significant.
Ported from a Chromium change by Adithya Srinivasan
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::resetListAttributeTargetObserver): check if there's a list attribute before making an observer.
2021-07-31 Youenn Fablet <youenn@apple.com>
Improve LocalSampleBufferDisplayLayer logging
https://bugs.webkit.org/show_bug.cgi?id=228582
Reviewed by Eric Carlson.
Add logging to correlate a LocalSampleBufferDisplayLayer to its HTMLMediaElement and its MediaStreamTrack.
Introduce setLogIdentifer for that purpose.
No observable change of behavior.
* platform/graphics/avfoundation/SampleBufferDisplayLayer.h:
* platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h:
* platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:
(WebCore::LocalSampleBufferDisplayLayer::enqueueSample):
(WebCore::LocalSampleBufferDisplayLayer::onIrregularFrameRateNotification):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack):
2021-07-31 Youenn Fablet <youenn@apple.com>
AVVideoCaptureSource should not start/stop the camera if trying to apply the same size/frame rate configuration
https://bugs.webkit.org/show_bug.cgi?id=228634
<rdar://81174160>
Reviewed by Eric Carlson.
In some configurations, pages want to set a frame rate of 30, but the actual frame rate set will be 29.9999.
In that case, our heuristic to not recalibrate the camera fails.
To prevent this, we add checks in AVVideoCaptureSource to validate whether the new presets are the same as the already applied ones.
Manually tested.
* platform/mediastream/mac/AVVideoCaptureSource.h:
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::setSessionSizeAndFrameRate):
2021-07-31 Martin Robinson <mrobinson@webkit.org>
REGRESSION(r279564): [GTK] Mouse wheel scrolling scrolls too little (take two)
https://bugs.webkit.org/show_bug.cgi?id=228572
Reviewed by Adrian Perez de Castro.
Test: platform/gtk/fast/scrolling/scroll-wheel-repeated-events.html
When scrolling by a delta with ScrollAnimationSmooth, base the target point
on the current scroll target instead of on the current position. We also
pass the point to updatePerAxisData instead of the delta in order to make
it more explicit what the desired behavior is for this method.
* platform/ScrollAnimationSmooth.h: Update argument name.
* platform/ScrollAnimationSmooth.cpp:
(WebCore::ScrollAnimationSmooth::scroll): Base the delta on the target position and
pass that as the argument to updatePerAxisData. When scrolling to a point, simply
pass that to updatePerAxisData.
(WebCore::ScrollAnimationSmooth::updatePerAxisData): Accept a point instead of a
delta, which makes it more obvious how to use this function and allows it to
be used the same way by both version of ScrollAnimationSmooth::scroll.
2021-07-31 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r280488.
https://bugs.webkit.org/show_bug.cgi?id=228677
media/modern-media-controls/ tests are failing or timed-out
Reverted changeset:
"[Cocoa] Remove support for AVAssetImageGenerator"
https://bugs.webkit.org/show_bug.cgi?id=228560
https://commits.webkit.org/r280488
2021-07-30 Rob Buis <rbuis@igalia.com>
[css-overflow] Implement clip value for overflow
https://bugs.webkit.org/show_bug.cgi?id=198230
Reviewed by Simon Fraser.
Implement overflow: clip. Parsing is like the other
overflow values but special logic is added to handle
the case where only one of overflow-x/overflow-y uses
'clip' [1]. Also adjusts code that computes layout and
visual overflow to take overflow: clip into account.
This matches Chrome and Firefox.
[1] https://drafts.csswg.org/css-overflow/#propdef-overflow-x
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator Overflow const):
* css/CSSProperties.json:
* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
(WebCore::add):
* css/parser/CSSParserContext.h:
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
* page/FrameView.cpp: handle scrollbars
on viewport element same as overflow: hidden.
(WebCore::FrameView::applyOverflowToViewport):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::updateFromStyle):
(WebCore::RenderBox::scrollWidth const): overflow clip
forbids all scrolling.
(WebCore::RenderBox::scrollHeight const): Ditto.
(WebCore::RenderBox::setScrollLeft): Ditto.
(WebCore::RenderBox::setScrollTop): Ditto.
(WebCore::RenderBox::setScrollPosition): Ditto.
(WebCore::RenderBox::requiresLayerWithScrollableArea const): do
not create layer with scrollable area for overflow: clip.
(WebCore::RenderBox::canBeProgramaticallyScrolled const): overflow clip
forbids all scrolling.
(WebCore::RenderBox::scrollPosition const): overflow clip
forbids all scrolling.
(WebCore::RenderBox::overflowClipRect const): only clip the rect horizontally
for overflow-x: clip and only vertically for overflow-y: clip.
(WebCore::RenderBox::createsNewFormattingContext const): do
not create formatting context for overflow: clip.
(WebCore::RenderBox::addOverflowFromChild):
(WebCore::RenderBox::addLayoutOverflow):
(WebCore::RenderBox::layoutOverflowRectForPropagation const):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::enclosingScrollableContainerForSnapping const):
* rendering/RenderObject.h: Add helper method that excludes overflow-x/y: clip.
(WebCore::RenderObject::hasPotentiallyScrollableOverflow const):
* rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<):
* rendering/style/RenderStyleConstants.h:
* style/StyleAdjuster.cpp: Add special logic is to handle the case where only
one of overflow-x/overflow-y uses 'clip'.
(WebCore::Style::Adjuster::adjust const):
2021-07-30 Chris Dumez <cdumez@apple.com>
Add initial support for 'Cross-Origin-Opener-Policy' HTTP header
https://bugs.webkit.org/show_bug.cgi?id=192193
<rdar://problem/42013525>
Reviewed by Geoff Garen.
Add initial support for 'Cross-Origin-Opener-Policy' HTTP header:
- https://html.spec.whatwg.org/multipage/origin.html#cross-origin-opener-policy-value
Support is complete enough to pass most WPT tests with the exception of:
- The ones involving blob. Support for Blob does not seem trivial so I will address
separately (https://github.com/whatwg/html/issues/5198).
- The ones that requires reporting COOP enforcement as this is not supported yet.
This is a fairly large task so I'll handle separately.
- The ones that involve Cross-Origin-Embedder-Policy (COEP) and this is not yet
supported.
I tried to stay as close as possible to the HTML specification as possible in terms
of structuring and naming. I also have code comments to link to the relevant HTML
spec sections.
Note that as it stands, we do not currently swap process based on COOP header. We
merely do isolation of the new browsing context at JS level for now. At some point,
we'll want to actually process-swap, once we support COEP and we want to re-enable
some Web APIs such as SharedArrayBuffer.
No new tests, covered by web-plaform-tests/html/cross-origin-opener-policy.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* dom/Document.cpp:
(WebCore::Document::initSecurityContext):
(WebCore::Document::shouldForceNoOpenerBasedOnCOOP const):
(WebCore::Document::crossOriginOpenerPolicy const):
(WebCore::Document::setCrossOriginOpenerPolicy):
* dom/Document.h:
(WebCore::Document::isSameOriginAsTopDocument const):
* dom/SecurityContext.cpp:
(WebCore::SecurityContext::enforceSandboxFlags):
* dom/SecurityContext.h:
(WebCore::SecurityContext::creationSandboxFlags const):
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::openURLExternally):
* loader/CrossOriginEmbedderPolicy.cpp: Copied from Source/WebCore/page/AbstractFrame.cpp.
(WebCore::obtainCrossOriginEmbedderPolicy):
* loader/CrossOriginEmbedderPolicy.h: Copied from Source/WebCore/page/AbstractFrame.cpp.
* loader/CrossOriginOpenerPolicy.cpp: Added.
(WebCore::obtainCrossOriginOpenerPolicy):
* loader/CrossOriginOpenerPolicy.h: Copied from Source/WebCore/page/AbstractFrame.h.
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::willSendRequest):
(WebCore::checkIfCOOPValuesRequireBrowsingContextGroupSwitch):
(WebCore::computeResponseOriginAndCOOP):
(WebCore::DocumentLoader::doCrossOriginOpenerHandlingOfResponse):
(WebCore::DocumentLoader::enforceResponseCrossOriginOpenerPolicy):
(WebCore::DocumentLoader::responseReceived):
(WebCore::DocumentLoader::maybeLoadEmpty):
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::crossOriginOpenerPolicy const):
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::begin):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didBeginDocument):
(WebCore::FrameLoader::setOpener):
(WebCore::FrameLoader::loadURL):
(WebCore::FrameLoader::loadPostRequest):
(WebCore::createWindow):
(WebCore::FrameLoader::switchBrowsingContextsGroup):
* loader/FrameLoader.h:
* loader/NavigationAction.cpp:
* loader/NavigationAction.h:
(WebCore::NavigationAction::Requester::securityOrigin const):
(WebCore::NavigationAction::Requester::topOrigin const):
(WebCore::NavigationAction::Requester::crossOriginOpenerPolicy const):
* page/AbstractFrame.cpp:
(WebCore::AbstractFrame::resetWindowProxy):
* page/AbstractFrame.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::crossOriginIsolated const):
(WebCore::DOMWindow::createWindow):
* page/DOMWindow.h:
* page/Frame.cpp:
(WebCore::Frame::resetScript):
* page/Frame.h:
* page/Page.h:
(WebCore::Page::setOpenedByDOMWithOpener):
* page/WindowOrWorkerGlobalScope.idl:
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::applyPolicyToScriptExecutionContext):
* platform/network/HTTPHeaderNames.in:
* platform/network/HTTPParsers.cpp:
(WebCore::parseStructuredFieldValue):
* platform/network/HTTPParsers.h:
* platform/network/ResourceResponseBase.cpp:
(WebCore::isSafeRedirectionResponseHeader):
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::crossOriginIsolated const):
* workers/WorkerGlobalScope.h:
2021-07-30 Chris Dumez <cdumez@apple.com>
Unreviewed, reverting r280482.
Will take a more conservative approach
Reverted changeset:
"HTMLElement.innerText setter should convert new lines to
<br>"
https://bugs.webkit.org/show_bug.cgi?id=228605
https://commits.webkit.org/r280482
2021-07-30 Dana Estra <destra@apple.com>
Add spacebar functionality for macOS smooth scrolling
https://bugs.webkit.org/show_bug.cgi?id=228155
Reviewed by Tim Horton.
Fixed bug that was causing spacebar events to return false from beginKeyboardScrollGesture.
Manually tested on webpage.
* platform/KeyboardScrollingAnimator.cpp:
(WebCore::KeyboardScrollingAnimator::beginKeyboardScrollGesture):
2021-07-30 Chris Dumez <cdumez@apple.com>
Unreviewed follow-up to r280491 to address review feedback from Darin Adler.
Use URL::isBlankURL() instead of a case-sensitive match for aboutBlankURL().
* dom/Document.cpp:
(WebCore::Document::updateBaseURL):
2021-07-30 Dana Estra <destra@apple.com>
Add key-driven smooth scrolling to macOS
https://bugs.webkit.org/show_bug.cgi?id=228009
Reviewed by Tim Horton.
Cause keyboard scroll event to trigger start of smooth scroll animation, using same physics implementation as iOS smooth scrolling.
No tests yet.
* WebCore.xcodeproj/project.pbxproj:
* dom/Node.cpp:
(WebCore::Node::defaultEventHandler):
* page/EventHandler.cpp:
(WebCore::EventHandler::defaultKeyboardEventHandler):
(WebCore::EventHandler::scrollDistance):
(WebCore::EventHandler::stopKeyboardScrolling):
(WebCore::EventHandler::startKeyboardScrolling):
* platform/KeyboardScrollingAnimator.cpp: Added.
* platform/KeyboardScrollingAnimator.h: Added.
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::startAnimationCallback):
* platform/ScrollAnimator.h:
* platform/ScrollController.cpp:
(WebCore::ScrollController::animationCallback):
(WebCore::ScrollController::startOrStopAnimationCallbacks):
(WebCore::ScrollController::beginKeyboardScrolling):
(WebCore::ScrollController::stopKeyboardScrolling):
(WebCore::ScrollController::setIsAnimatingKeyboardScrolling):
(WebCore::ScrollController::updateKeyboardScrollingAnimatingState):
* platform/ScrollController.h:
(WebCore::ScrollControllerClient::updateKeyboardScrollPosition):
2021-07-30 Chris Dumez <cdumez@apple.com>
Document's fallback base URL should be deduced from its creator when URL is about:blank
https://bugs.webkit.org/show_bug.cgi?id=228624
Reviewed by Geoffrey Garen.
Document's fallback base URL should be deduced from its creator when URL is about:blank:
- https://html.spec.whatwg.org/multipage/urls-and-fetching.html#fallback-base-url
Chrome and Firefox match the specification here.
Tests: http/tests/dom/iframe-no-src-local-origin-allow.html
http/tests/dom/iframe-no-src-set-location.html
* dom/Document.cpp:
(WebCore::Document::updateBaseURL):
2021-07-30 Jer Noble <jer.noble@apple.com>
[Cocoa] Remove support for AVAssetImageGenerator
https://bugs.webkit.org/show_bug.cgi?id=228560
Reviewed by Eric Carlson.
AVAssetImageGenerator is used when there is not yet an available image from AVPlayerItemVideoOutput.
However, AVAssetImageGenerator is a synchronous API call; if data for the current time is not available,
the generator will cause a request for that data to be issued, and if the main thread is blocked in a
synchronous call to the generator, that request can never be completed, causing a deadlock.
Instead, always block moving to a readyState >= HAVE_CURRENT_DATA until either the AVPlayerLayer or
the AVPlayerItemVideoOutput report having an available frame. This prevents clients from attempting
to paint until a frame is available, and ensures that we will always have an available frame for
painting, removing the need for the synchronous generator call.
To ensure the readyState is updated when AVPlayerItemVideoOutput has an available image, register
with the output at creation time for a notification as soon as an image is available. And in the existing
delegate object, send a message back to the MediaPlayerPrivateAVFoundationObjC when that occurs.
No tests needed; this should reduce flakiness of existing tests and cause no regression in behavior.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::updateStates):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::hasContextRenderer const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyContextVideoRenderer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintCurrentFrameInContext):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
(-[WebCoreAVFPullDelegate setParent:]):
(-[WebCoreAVFPullDelegate outputMediaDataWillChange:]):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageGenerator): Deleted.
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyImageGenerator): Deleted.
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator): Deleted.
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect): Deleted.
2021-07-30 Chris Dumez <cdumez@apple.com>
HTMLElement.innerText setter should convert new lines to <br>
https://bugs.webkit.org/show_bug.cgi?id=228605
Reviewed by Sam Weinig.
HTMLElement.innerText setter should convert new lines to <br>:
- https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute:dom-innertext-3
- https://html.spec.whatwg.org/multipage/dom.html#rendered-text-fragment
Our innerText setter had some logic that was specific to form elements and specific render
styles that wasn't part of the specification. It was causing us to not replace the new lines
with <br> in some cases. I dropped this logic to align with Blink and Gecko, as those are
passing the same WPT tests.
No new tests, rebaselined existing tests.
* html/HTMLElement.cpp:
(WebCore::HTMLElement::setInnerText):
2021-07-30 Chris Dumez <cdumez@apple.com>
Clicking an HTMLLinkElement should not trigger a navigation
https://bugs.webkit.org/show_bug.cgi?id=228618
Reviewed by Sam Weinig.
Clicking an HTMLLinkElement should not trigger a navigation because HTMLLinkElement has no activation
behavior as per the HTML specification:
- https://html.spec.whatwg.org/multipage/semantics.html#htmllinkelement
Firefox and Chrome follow the specification here.
No new tests, updated/rebaselined existing tests.
* html/HTMLLinkElement.cpp:
* html/HTMLLinkElement.h:
2021-07-30 Dean Jackson <dino@apple.com>
[Media Controls] Add an option for having no scrubber on the time control and parameterize margin
https://bugs.webkit.org/show_bug.cgi?id=228633
rdar://81314458
Reviewed by Tim Horton.
Add support for a scrubber bar that does not have a knob (or, to be clear, an
invisible knob). While here, move the constant for the margin into a custom
CSS property so it can be easily overridden.
* Modules/modern-media-controls/controls/media-controls.css:
(*): Add --scrubber-margin custom property.
* Modules/modern-media-controls/controls/slider.css:
(.slider > .custom-slider > .knob.none): Add style for a "none" knob.
* Modules/modern-media-controls/controls/slider.js:
(Slider.prototype.commit): Support "none".
* Modules/modern-media-controls/controls/time-control.js: Get the margin from
the new custom property.
(TimeControl.prototype.get minimumWidth):
(TimeControl.prototype.get idealMinimumWidth):
(TimeControl.prototype.layout):
(TimeControl.prototype._performIdealLayout):
2021-07-30 Chris Dumez <cdumez@apple.com>
postMessage() should throw if any duplicate transferable is found in transferList
https://bugs.webkit.org/show_bug.cgi?id=228608
Reviewed by Youenn Fablet.
postMessage() should throw if any duplicate transferable is found in transferList:
- https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializewithtransfer (Step 2.3)
No new tests, rebaselined existing test.
* bindings/js/SerializedScriptValue.cpp:
(WebCore::SerializedScriptValue::create):
2021-07-30 Rob Buis <rbuis@igalia.com>
[AspectRatio] Fix replaced-element-034.html
https://bugs.webkit.org/show_bug.cgi?id=228223
Reviewed by Manuel Rego Casasnovas.
Fix replaced-element-034.html by making hasReplacedLogicalHeight
return false for *-content when aspect-ratio is provided and relying
on computeReplacedLogicalHeight to take aspect-ratio into account.
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::hasReplacedLogicalHeight const):
2021-07-29 Tomoki Imai <Tomoki.Imai@sony.com>
Missing playing events when the ready state becomes HAVE_FUTURE_DATA/HAVE_ENOUGH_DATA from HAVE_METADATA state
https://bugs.webkit.org/show_bug.cgi?id=228531
Reviewed by Eric Carlson.
The main issue is that missing playing event when the ready state becomes HAVE_FUTURE_DATA or HAVE_ENOUGH_DATA from HAVE_METADATA.
According to the specification, we need to "notify about playing" in the following cases:
- If the previous ready state was HAVE_CURRENT_DATA or less, and the new ready state is HAVE_FUTURE_DATA, and it's not paused.
- If the new ready state is HAVE_ENOUGH_DATA, and it's eligible for autoplay
The implementation didn't cover these cases and had web compatibility issues.
We also should move scheduleNotifyAboutPlaying from setPlaying to playInternal and checks the ready state.
- Without this change, playing event is fired twice. The first one is fired by setReadyState, and the second is called from setPlaying.
- According to the specification, scheduleNotifyAboutPlaying should be in "internal play steps" and check the ready state.
Checking ready state fixes the issue where playing event is fired twice.
Test: media/media-source/media-source-monitor-playing-event.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setReadyState): Added missing scheduleNotifyAboutPlaying calls. Added do-while to make the implementation similar to the specification text
(WebCore::HTMLMediaElement::playInternal): Added scheduleNotifyAboutPlaying call.
According to the specification, "internal play steps" should "notify about playing" when
the ready state is HAVE_FUTURE_DATA or HAVE_ENOUGH_DATA.
(WebCore::HTMLMediaElement::setPlaying): Removed scheduleNotifyAboutPlaying call because playInternal now calls scheduleNotifyAboutPlaying instead.
Reference:
- https://html.spec.whatwg.org/multipage/media.html#internal-play-steps
- https://html.spec.whatwg.org/multipage/media.html#ready-states
2021-07-29 Myles C. Maxfield <mmaxfield@apple.com>
Stop building WebGPU and the WHLSL compiler to decrease binary size
https://bugs.webkit.org/show_bug.cgi?id=228179
Reviewed by Dean Jackson, Robin Morisset, and Devin Rousso.
No new tests because there is no behavior change.
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/webgpu/GPUBindGroupLayoutBinding.h: Removed.
* Modules/webgpu/GPUBindGroupLayoutBinding.idl: Removed.
* Modules/webgpu/GPUBindGroupLayoutDescriptor.h: Removed.
* Modules/webgpu/GPUBindGroupLayoutDescriptor.idl: Removed.
* Modules/webgpu/GPUBlendDescriptor.idl: Removed.
* Modules/webgpu/GPUBufferDescriptor.idl: Removed.
* Modules/webgpu/GPUBufferUsage.idl: Removed.
* Modules/webgpu/GPUCanvasContext.cpp: Removed.
* Modules/webgpu/GPUCanvasContext.h: Removed.
* Modules/webgpu/GPUCanvasContext.idl: Removed.
* Modules/webgpu/GPUColor.idl: Removed.
* Modules/webgpu/GPUColorStateDescriptor.idl: Removed.
* Modules/webgpu/GPUColorWrite.idl: Removed.
* Modules/webgpu/GPUCompareFunction.idl: Removed.
* Modules/webgpu/GPUDepthStencilStateDescriptor.idl: Removed.
* Modules/webgpu/GPUErrorFilter.idl: Removed.
* Modules/webgpu/GPUExtent3D.idl: Removed.
* Modules/webgpu/GPULoadOp.idl: Removed.
* Modules/webgpu/GPUOrigin3D.h: Removed.
* Modules/webgpu/GPUOrigin3D.idl: Removed.
* Modules/webgpu/GPUOutOfMemoryError.idl: Removed.
* Modules/webgpu/GPURequestAdapterOptions.idl: Removed.
* Modules/webgpu/GPUSamplerDescriptor.idl: Removed.
* Modules/webgpu/GPUShaderStage.h: Removed.
* Modules/webgpu/GPUShaderStage.idl: Removed.
* Modules/webgpu/GPUStoreOp.idl: Removed.
* Modules/webgpu/GPUTextureDescriptor.idl: Removed.
* Modules/webgpu/GPUTextureFormat.idl: Removed.
* Modules/webgpu/GPUTextureUsage.idl: Removed.
* Modules/webgpu/GPUUncapturedErrorEvent.cpp: Removed.
* Modules/webgpu/GPUUncapturedErrorEvent.h: Removed.
* Modules/webgpu/GPUUncapturedErrorEvent.idl: Removed.
* Modules/webgpu/GPUValidationError.idl: Removed.
* Modules/webgpu/GPUVertexAttributeDescriptor.idl: Removed.
* Modules/webgpu/GPUVertexBufferDescriptor.idl: Removed.
* Modules/webgpu/GPUVertexInputDescriptor.idl: Removed.
* Modules/webgpu/Navigator+GPU.idl: Removed.
* Modules/webgpu/NavigatorGPU.cpp: Removed.
* Modules/webgpu/NavigatorGPU.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLAST.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLAddressEscapeMode.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLArrayType.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLBaseFunctionAttribute.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLBlock.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLBreak.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLContinue.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLDefaultDelete.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLExpression.cpp: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLExpression.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLForLoop.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLGlobalVariableReference.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLNameSpace.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLNamedType.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLNumThreadsFunctionAttribute.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLPointerType.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLQualifier.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLReplaceWith.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLReturn.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLSemantic.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLStatement.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLType.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.cpp: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLUnnamedTypeHash.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: Removed.
* Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp: Removed.
* Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.h: Removed.
* Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp: Removed.
* Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.h: Removed.
* Modules/webgpu/WHLSL/Metal/WHLSLMangledNames.h: Removed.
* Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp: Removed.
* Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h: Removed.
* Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp: Removed.
* Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h: Removed.
* Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp: Removed.
* Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.h: Removed.
* Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp: Removed.
* Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.h: Removed.
* Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.cpp: Removed.
* Modules/webgpu/WHLSL/Metal/WHLSLVertexBufferIndexCalculator.h: Removed.
* Modules/webgpu/WHLSL/WHLSLASTDumper.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLASTDumper.h: Removed.
* Modules/webgpu/WHLSL/WHLSLBuildStandardLibraryFunctionMap.py: Removed.
* Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.h: Removed.
* Modules/webgpu/WHLSL/WHLSLCheckReferenceTypes.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLCheckReferenceTypes.h: Removed.
* Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.h: Removed.
* Modules/webgpu/WHLSL/WHLSLChecker.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLChecker.h: Removed.
* Modules/webgpu/WHLSL/WHLSLCodeLocation.h: Removed.
* Modules/webgpu/WHLSL/WHLSLComputeDimensions.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLComputeDimensions.h: Removed.
* Modules/webgpu/WHLSL/WHLSLError.h: Removed.
* Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.h: Removed.
* Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.h: Removed.
* Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLHighZombieFinder.h: Removed.
* Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLInferTypes.h: Removed.
* Modules/webgpu/WHLSL/WHLSLIntrinsics.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLIntrinsics.h: Removed.
* Modules/webgpu/WHLSL/WHLSLLexer.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLLexer.h: Removed.
* Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.h: Removed.
* Modules/webgpu/WHLSL/WHLSLNameContext.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLNameContext.h: Removed.
* Modules/webgpu/WHLSL/WHLSLNameResolver.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLNameResolver.h: Removed.
* Modules/webgpu/WHLSL/WHLSLParser.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLParser.h: Removed.
* Modules/webgpu/WHLSL/WHLSLParsingMode.h: Removed.
* Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h: Removed.
* Modules/webgpu/WHLSL/WHLSLPrepare.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLPrepare.h: Removed.
* Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.h: Removed.
* Modules/webgpu/WHLSL/WHLSLProgram.h: Removed.
* Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLPropertyResolver.h: Removed.
* Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.h: Removed.
* Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLRecursionChecker.h: Removed.
* Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.h: Removed.
* Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.h: Removed.
* Modules/webgpu/WHLSL/WHLSLResolvingType.h: Removed.
* Modules/webgpu/WHLSL/WHLSLScopedSetAdder.h: Removed.
* Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLSemanticMatcher.h: Removed.
* Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt: Removed.
* Modules/webgpu/WHLSL/WHLSLStandardLibraryFunctionMap.h: Removed.
* Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.h: Removed.
* Modules/webgpu/WHLSL/WHLSLStatementBehaviorChecker.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLStatementBehaviorChecker.h: Removed.
* Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.h: Removed.
* Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.h: Removed.
* Modules/webgpu/WHLSL/WHLSLVisitor.cpp: Removed.
* Modules/webgpu/WHLSL/WHLSLVisitor.h: Removed.
* Modules/webgpu/WebGPU.cpp: Removed.
* Modules/webgpu/WebGPU.h: Removed.
* Modules/webgpu/WebGPU.idl: Removed.
* Modules/webgpu/WebGPUAdapter.cpp: Removed.
* Modules/webgpu/WebGPUAdapter.h: Removed.
* Modules/webgpu/WebGPUAdapter.idl: Removed.
* Modules/webgpu/WebGPUBindGroup.cpp: Removed.
* Modules/webgpu/WebGPUBindGroup.h: Removed.
* Modules/webgpu/WebGPUBindGroup.idl: Removed.
* Modules/webgpu/WebGPUBindGroupBinding.h: Removed.
* Modules/webgpu/WebGPUBindGroupBinding.idl: Removed.
* Modules/webgpu/WebGPUBindGroupDescriptor.cpp: Removed.
* Modules/webgpu/WebGPUBindGroupDescriptor.h: Removed.
* Modules/webgpu/WebGPUBindGroupDescriptor.idl: Removed.
* Modules/webgpu/WebGPUBindGroupLayout.cpp: Removed.
* Modules/webgpu/WebGPUBindGroupLayout.h: Removed.
* Modules/webgpu/WebGPUBindGroupLayout.idl: Removed.
* Modules/webgpu/WebGPUBuffer.cpp: Removed.
* Modules/webgpu/WebGPUBuffer.h: Removed.
* Modules/webgpu/WebGPUBuffer.idl: Removed.
* Modules/webgpu/WebGPUBufferBinding.h: Removed.
* Modules/webgpu/WebGPUBufferBinding.idl: Removed.
* Modules/webgpu/WebGPUCommandBuffer.cpp: Removed.
* Modules/webgpu/WebGPUCommandBuffer.h: Removed.
* Modules/webgpu/WebGPUCommandBuffer.idl: Removed.
* Modules/webgpu/WebGPUCommandEncoder.cpp: Removed.
* Modules/webgpu/WebGPUCommandEncoder.h: Removed.
* Modules/webgpu/WebGPUCommandEncoder.idl: Removed.
* Modules/webgpu/WebGPUComputePassEncoder.cpp: Removed.
* Modules/webgpu/WebGPUComputePassEncoder.h: Removed.
* Modules/webgpu/WebGPUComputePassEncoder.idl: Removed.
* Modules/webgpu/WebGPUComputePipeline.cpp: Removed.
* Modules/webgpu/WebGPUComputePipeline.h: Removed.
* Modules/webgpu/WebGPUComputePipeline.idl: Removed.
* Modules/webgpu/WebGPUComputePipelineDescriptor.cpp: Removed.
* Modules/webgpu/WebGPUComputePipelineDescriptor.h: Removed.
* Modules/webgpu/WebGPUComputePipelineDescriptor.idl: Removed.
* Modules/webgpu/WebGPUDevice.cpp: Removed.
* Modules/webgpu/WebGPUDevice.h: Removed.
* Modules/webgpu/WebGPUDevice.idl: Removed.
* Modules/webgpu/WebGPUDeviceErrorScopes.cpp: Removed.
* Modules/webgpu/WebGPUDeviceErrorScopes.h: Removed.
* Modules/webgpu/WebGPUDeviceErrorScopes.idl: Removed.
* Modules/webgpu/WebGPUDeviceEventHandler.idl: Removed.
* Modules/webgpu/WebGPUPipeline.cpp: Removed.
* Modules/webgpu/WebGPUPipeline.h: Removed.
* Modules/webgpu/WebGPUPipelineDescriptorBase.h: Removed.
* Modules/webgpu/WebGPUPipelineDescriptorBase.idl: Removed.
* Modules/webgpu/WebGPUPipelineLayout.cpp: Removed.
* Modules/webgpu/WebGPUPipelineLayout.h: Removed.
* Modules/webgpu/WebGPUPipelineLayout.idl: Removed.
* Modules/webgpu/WebGPUPipelineLayoutDescriptor.cpp: Removed.
* Modules/webgpu/WebGPUPipelineLayoutDescriptor.h: Removed.
* Modules/webgpu/WebGPUPipelineLayoutDescriptor.idl: Removed.
* Modules/webgpu/WebGPUProgrammablePassEncoder.cpp: Removed.
* Modules/webgpu/WebGPUProgrammablePassEncoder.h: Removed.
* Modules/webgpu/WebGPUProgrammablePassEncoder.idl: Removed.
* Modules/webgpu/WebGPUProgrammableStageDescriptor.cpp: Removed.
* Modules/webgpu/WebGPUProgrammableStageDescriptor.h: Removed.
* Modules/webgpu/WebGPUProgrammableStageDescriptor.idl: Removed.
* Modules/webgpu/WebGPUQueue.cpp: Removed.
* Modules/webgpu/WebGPUQueue.h: Removed.
* Modules/webgpu/WebGPUQueue.idl: Removed.
* Modules/webgpu/WebGPURenderPassDescriptor.cpp: Removed.
* Modules/webgpu/WebGPURenderPassDescriptor.h: Removed.
* Modules/webgpu/WebGPURenderPassDescriptor.idl: Removed.
* Modules/webgpu/WebGPURenderPassEncoder.cpp: Removed.
* Modules/webgpu/WebGPURenderPassEncoder.h: Removed.
* Modules/webgpu/WebGPURenderPassEncoder.idl: Removed.
* Modules/webgpu/WebGPURenderPipeline.cpp: Removed.
* Modules/webgpu/WebGPURenderPipeline.h: Removed.
* Modules/webgpu/WebGPURenderPipeline.idl: Removed.
* Modules/webgpu/WebGPURenderPipelineDescriptor.cpp: Removed.
* Modules/webgpu/WebGPURenderPipelineDescriptor.h: Removed.
* Modules/webgpu/WebGPURenderPipelineDescriptor.idl: Removed.
* Modules/webgpu/WebGPUSampler.cpp: Removed.
* Modules/webgpu/WebGPUSampler.h: Removed.
* Modules/webgpu/WebGPUSampler.idl: Removed.
* Modules/webgpu/WebGPUShaderModule.cpp: Removed.
* Modules/webgpu/WebGPUShaderModule.h: Removed.
* Modules/webgpu/WebGPUShaderModule.idl: Removed.
* Modules/webgpu/WebGPUShaderModuleDescriptor.h: Removed.
* Modules/webgpu/WebGPUShaderModuleDescriptor.idl: Removed.
* Modules/webgpu/WebGPUSwapChain.cpp: Removed.
* Modules/webgpu/WebGPUSwapChain.h: Removed.
* Modules/webgpu/WebGPUSwapChain.idl: Removed.
* Modules/webgpu/WebGPUSwapChainDescriptor.cpp: Removed.
* Modules/webgpu/WebGPUSwapChainDescriptor.h: Removed.
* Modules/webgpu/WebGPUTexture.cpp: Removed.
* Modules/webgpu/WebGPUTexture.h: Removed.
* Modules/webgpu/WebGPUTexture.idl: Removed.
* Modules/webgpu/WebGPUTextureView.cpp: Removed.
* Modules/webgpu/WebGPUTextureView.h: Removed.
* Modules/webgpu/WebGPUTextureView.idl: Removed.
* Modules/webgpu/WorkerNavigator+GPU.idl: Removed.
* Modules/webgpu/WorkerNavigatorGPU.cpp: Removed.
* Modules/webgpu/WorkerNavigatorGPU.h: Removed.
* Sources.txt:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* dom/Document.cpp:
(WebCore::Document::getCSSCanvasContext):
* dom/Document.h:
* dom/Document.idl:
* dom/EventNames.in:
* dom/EventTargetFactory.in:
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getContext):
(WebCore::HTMLCanvasElement::isWebGPUType): Deleted.
(WebCore::HTMLCanvasElement::createContextWebGPU): Deleted.
(WebCore::HTMLCanvasElement::getContextWebGPU): Deleted.
* html/HTMLCanvasElement.h:
* html/HTMLCanvasElement.idl:
* html/canvas/CanvasRenderingContext.h:
(WebCore::CanvasRenderingContext::isWebGL const):
(WebCore::CanvasRenderingContext::isWebGPU const): Deleted.
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::InspectorCanvas):
(WebCore::InspectorCanvas::canvasElement const):
(WebCore::InspectorCanvas::scriptExecutionContext const):
(WebCore::InspectorCanvas::resolveContext const):
(WebCore:: const):
(WebCore::InspectorCanvas::resetRecordingData):
(WebCore::InspectorCanvas::recordAction):
(WebCore::InspectorCanvas::buildObjectForCanvas):
(WebCore::InspectorCanvas::releaseObjectForRecording):
(WebCore::InspectorCanvas::buildInitialState):
(WebCore::canvasIfContextMatchesDevice): Deleted.
(WebCore::InspectorCanvas::deviceContext const): Deleted.
(WebCore::InspectorCanvas::isDeviceForCanvasContext const): Deleted.
* inspector/InspectorCanvas.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didCreateWebGPUDeviceImpl): Deleted.
(WebCore::InspectorInstrumentation::willDestroyWebGPUDeviceImpl): Deleted.
(WebCore::InspectorInstrumentation::willConfigureSwapChainImpl): Deleted.
(WebCore::InspectorInstrumentation::didCreateWebGPUPipelineImpl): Deleted.
(WebCore::InspectorInstrumentation::willDestroyWebGPUPipelineImpl): Deleted.
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didCreateWebGPUDevice): Deleted.
(WebCore::InspectorInstrumentation::willDestroyWebGPUDevice): Deleted.
(WebCore::InspectorInstrumentation::willConfigureSwapChain): Deleted.
(WebCore::InspectorInstrumentation::didCreateWebGPUPipeline): Deleted.
(WebCore::InspectorInstrumentation::willDestroyWebGPUPipeline): Deleted.
* inspector/InspectorShaderProgram.cpp:
(WebCore::InspectorShaderProgram::requestShaderSource):
(WebCore::InspectorShaderProgram::updateShader):
(WebCore::InspectorShaderProgram::buildObjectForShaderProgram):
(WebCore::InspectorShaderProgram::pipeline const): Deleted.
* inspector/InspectorShaderProgram.h:
* inspector/agents/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
(WebCore::InspectorCanvasAgent::enable):
(WebCore::InspectorCanvasAgent::startRecording):
(WebCore::InspectorCanvasAgent::stopRecording):
(WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
(WebCore::InspectorCanvasAgent::recordAction):
(WebCore::InspectorCanvasAgent::reset):
(WebCore::InspectorCanvasAgent::didCreateWebGPUDevice): Deleted.
(WebCore::InspectorCanvasAgent::willDestroyWebGPUDevice): Deleted.
(WebCore::InspectorCanvasAgent::willConfigureSwapChain): Deleted.
(WebCore::InspectorCanvasAgent::didCreateWebGPUPipeline): Deleted.
(WebCore::InspectorCanvasAgent::willDestroyWebGPUPipeline): Deleted.
* inspector/agents/InspectorCanvasAgent.h:
* page/ProcessWarming.cpp:
(WebCore::ProcessWarming::prewarmGlobally):
* platform/Logging.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::PlatformCALayerCocoa::layerTypeForPlatformLayer):
(WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa):
* platform/graphics/cocoa/WebGPULayer.h: Removed.
* platform/graphics/cocoa/WebGPULayer.mm: Removed.
* platform/graphics/gpu/GPUBindGroup.h: Removed.
* platform/graphics/gpu/GPUBindGroupAllocator.h: Removed.
* platform/graphics/gpu/GPUBindGroupBinding.h: Removed.
* platform/graphics/gpu/GPUBindGroupDescriptor.h: Removed.
* platform/graphics/gpu/GPUBindGroupLayout.h: Removed.
* platform/graphics/gpu/GPUBlendDescriptor.h: Removed.
* platform/graphics/gpu/GPUBuffer.cpp: Removed.
* platform/graphics/gpu/GPUBuffer.h: Removed.
* platform/graphics/gpu/GPUBufferBinding.h: Removed.
* platform/graphics/gpu/GPUBufferDescriptor.h: Removed.
* platform/graphics/gpu/GPUBufferUsage.h: Removed.
* platform/graphics/gpu/GPUColor.h: Removed.
* platform/graphics/gpu/GPUColorStateDescriptor.h: Removed.
* platform/graphics/gpu/GPUColorWrite.h: Removed.
* platform/graphics/gpu/GPUCommandBuffer.h: Removed.
* platform/graphics/gpu/GPUCompareFunction.h: Removed.
* platform/graphics/gpu/GPUComputePassEncoder.h: Removed.
* platform/graphics/gpu/GPUComputePipeline.h: Removed.
* platform/graphics/gpu/GPUComputePipelineDescriptor.h: Removed.
* platform/graphics/gpu/GPUDepthStencilStateDescriptor.h: Removed.
* platform/graphics/gpu/GPUDevice.cpp: Removed.
* platform/graphics/gpu/GPUDevice.h:
(WebCore::GPUDevice::platformDevice const): Deleted.
(WebCore::GPUDevice::swapChain const): Deleted.
(WebCore::GPUDevice::setErrorScopes): Deleted.
* platform/graphics/gpu/GPUError.cpp: Removed.
* platform/graphics/gpu/GPUError.h: Removed.
* platform/graphics/gpu/GPUErrorFilter.h: Removed.
* platform/graphics/gpu/GPUErrorScopes.cpp: Removed.
* platform/graphics/gpu/GPUErrorScopes.h: Removed.
* platform/graphics/gpu/GPUExtent3D.h: Removed.
* platform/graphics/gpu/GPULimits.h: Removed.
* platform/graphics/gpu/GPULoadOp.h: Removed.
* platform/graphics/gpu/GPUObjectBase.h: Removed.
* platform/graphics/gpu/GPUOutOfMemoryError.h: Removed.
* platform/graphics/gpu/GPUPipeline.cpp: Removed.
* platform/graphics/gpu/GPUPipeline.h: Removed.
* platform/graphics/gpu/GPUPipelineDescriptorBase.h: Removed.
* platform/graphics/gpu/GPUPipelineLayout.cpp: Removed.
* platform/graphics/gpu/GPUPipelineLayout.h: Removed.
* platform/graphics/gpu/GPUPipelineLayoutDescriptor.h: Removed.
* platform/graphics/gpu/GPUPlatformTypes.h: Removed.
* platform/graphics/gpu/GPUProgrammablePassEncoder.cpp: Removed.
* platform/graphics/gpu/GPUProgrammablePassEncoder.h: Removed.
* platform/graphics/gpu/GPUProgrammableStageDescriptor.h: Removed.
* platform/graphics/gpu/GPUQueue.h: Removed.
* platform/graphics/gpu/GPURenderPassDescriptor.h: Removed.
* platform/graphics/gpu/GPURenderPassEncoder.h: Removed.
* platform/graphics/gpu/GPURenderPipeline.h: Removed.
* platform/graphics/gpu/GPURenderPipelineDescriptor.h: Removed.
* platform/graphics/gpu/GPURequestAdapterOptions.h: Removed.
* platform/graphics/gpu/GPUSampler.h: Removed.
* platform/graphics/gpu/GPUSamplerDescriptor.h: Removed.
* platform/graphics/gpu/GPUShaderModule.h: Removed.
* platform/graphics/gpu/GPUShaderModuleDescriptor.h: Removed.
* platform/graphics/gpu/GPUStoreOp.h: Removed.
* platform/graphics/gpu/GPUSwapChain.h: Removed.
* platform/graphics/gpu/GPUSwapChainDescriptor.h: Removed.
* platform/graphics/gpu/GPUTexture.h: Removed.
* platform/graphics/gpu/GPUTextureDescriptor.h: Removed.
* platform/graphics/gpu/GPUTextureFormat.h: Removed.
* platform/graphics/gpu/GPUTextureUsage.h: Removed.
* platform/graphics/gpu/GPUUtils.h: Removed.
* platform/graphics/gpu/GPUValidationError.cpp: Removed.
* platform/graphics/gpu/GPUValidationError.h: Removed.
* platform/graphics/gpu/GPUVertexAttributeDescriptor.h: Removed.
* platform/graphics/gpu/GPUVertexBufferDescriptor.h: Removed.
* platform/graphics/gpu/GPUVertexInputDescriptor.h: Removed.
* platform/graphics/gpu/cocoa/GPUBindGroupAllocatorMetal.mm: Removed.
* platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm: Removed.
* platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm: Removed.
* platform/graphics/gpu/cocoa/GPUBufferMetal.mm: Removed.
* platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm: Removed.
* platform/graphics/gpu/cocoa/GPUComputePassEncoderMetal.mm: Removed.
* platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm: Removed.
* platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
(WebCore::prewarmGPU):
(WebCore::isAcceptableDevice): Deleted.
(WebCore::GPUDevice::prewarm): Deleted.
(WebCore::GPUDevice::tryCreate): Deleted.
(WebCore::GPUDevice::GPUDevice): Deleted.
* platform/graphics/gpu/cocoa/GPUPipelineMetalConvertLayout.cpp: Removed.
* platform/graphics/gpu/cocoa/GPUPipelineMetalConvertLayout.h: Removed.
* platform/graphics/gpu/cocoa/GPUPlatformTypesMetal.h: Removed.
* platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm: Removed.
* platform/graphics/gpu/cocoa/GPUQueueMetal.mm: Removed.
* platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm: Removed.
* platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm: Removed.
* platform/graphics/gpu/cocoa/GPUSamplerMetal.mm: Removed.
* platform/graphics/gpu/cocoa/GPUShaderModuleMetal.mm: Removed.
* platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm: Removed.
* platform/graphics/gpu/cocoa/GPUTextureMetal.mm: Removed.
* platform/graphics/gpu/cocoa/GPUUtilsMetal.mm: Removed.
* platform/graphics/gpu/dawn/GPUBindGroupAllocatorDawn.cpp: Removed.
* platform/graphics/gpu/dawn/GPUBindGroupDawn.cpp: Removed.
* platform/graphics/gpu/dawn/GPUBindGroupLayoutDawn.cpp: Removed.
* platform/graphics/gpu/dawn/GPUBufferDawn.cpp: Removed.
* platform/graphics/gpu/dawn/GPUCommandBufferDawn.cpp: Removed.
* platform/graphics/gpu/dawn/GPUComputePassEncoderDawn.cpp: Removed.
* platform/graphics/gpu/dawn/GPUComputePipelineDawn.cpp: Removed.
* platform/graphics/gpu/dawn/GPUDeviceDawn.cpp: Removed.
* platform/graphics/gpu/dawn/GPUPlatformTypesDawn.h: Removed.
* platform/graphics/gpu/dawn/GPUProgrammablePassEncoderDawn.cpp: Removed.
* platform/graphics/gpu/dawn/GPUQueueDawn.cpp: Removed.
* platform/graphics/gpu/dawn/GPURenderPassEncoderDawn.cpp: Removed.
* platform/graphics/gpu/dawn/GPURenderPipelineDawn.cpp: Removed.
* platform/graphics/gpu/dawn/GPUSamplerDawn.cpp: Removed.
* platform/graphics/gpu/dawn/GPUShaderModuleDawn.cpp: Removed.
* platform/graphics/gpu/dawn/GPUSwapChainDawn.cpp: Removed.
* platform/graphics/gpu/dawn/GPUTextureDawn.cpp: Removed.
* platform/ios/DragImageIOS.mm:
* platform/mediastream/mac/WindowDisplayCapturerMac.mm:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration):
(WebCore::RenderLayerBacking::contentChanged):
2021-07-29 Andres Gonzalez <andresg_22@apple.com>
Crash at WebCore: -[WebAccessibilityObjectWrapper _accessibilityTableAncestor].
https://bugs.webkit.org/show_bug.cgi?id=228600
rdar://79910135
Reviewed by Chris Fleizach.
The cause of the crash was that [WebAccessibilityObjectWrapper
_accessibilityTableAncestor] was dereferencing self.axBackingObject
which can be null.
The same problem was present in a number of methods that are retrieving
an ancestor of a given role. This patch solves this problem by calling
_prepareAccessibilityCall before trying to dereference the backing core
object.
Avoided code repetition by adding the helper function ancestorWithRole.
* accessibility/AccessibilityObjectInterface.h:
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(ancestorWithRole):
(-[WebAccessibilityObjectWrapper _accessibilityTreeAncestor]):
(-[WebAccessibilityObjectWrapper _accessibilityDescriptionListAncestor]):
(-[WebAccessibilityObjectWrapper _accessibilityListAncestor]):
(-[WebAccessibilityObjectWrapper _accessibilityArticleAncestor]):
(-[WebAccessibilityObjectWrapper _accessibilityLandmarkAncestor]):
(-[WebAccessibilityObjectWrapper _accessibilityTableAncestor]):
(-[WebAccessibilityObjectWrapper _accessibilityIsInTableCell]):
(-[WebAccessibilityObjectWrapper _accessibilityFieldsetAncestor]):
(-[WebAccessibilityObjectWrapper _accessibilityFrameAncestor]):
2021-07-29 Jer Noble <jer.noble@apple.com>
[Cocoa|WK1] -[NSAttributeString loadFromHTML...] methods will disable bluetooth route switching
https://bugs.webkit.org/show_bug.cgi?id=228593
<rdar://81160969>
Reviewed by Eric Carlson.
NSAttributedString will use WebKitLegacy APIs to load provided HTML; in so doing, an AudioSessionIOS
singleton object is created, and -[AVAudioSession setEligibleForBTSmartRoutingConsideration:error:]
is called with a NO parameter, disabling smart routing for the calling process.
Disable this behavior if DeprecatedGlobalSettings::shouldManageAudioSessionCategory() returns false;
this setting is disabled for all WK1 clients, and enabled for WK2.
* page/DeprecatedGlobalSettings.cpp:
(WebCore::DeprecatedGlobalSettings::setShouldManageAudioSessionCategory):
(WebCore::DeprecatedGlobalSettings::shouldManageAudioSessionCategory):
* page/DeprecatedGlobalSettings.h:
(WebCore::DeprecatedGlobalSettings::setShouldManageAudioSessionCategory): Deleted.
(WebCore::DeprecatedGlobalSettings::shouldManageAudioSessionCategory): Deleted.
* platform/audio/AudioSession.h:
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::setEligibleForSmartRouting):
2021-07-29 Devin Rousso <drousso@apple.com>
[Payment Request] `additionalShippingMethods` are not used if a `paymentMethodType` is provided
https://bugs.webkit.org/show_bug.cgi?id=228599
<rdar://problem/81190366>
Reviewed by Andy Estes.
r275169 made it so that `paymentMethodType` is no longer `required` so that `additionalShippingMethods`
can be specified without having to limit it to a specific payment method type. While this
works in theory, WebKit doesn't know about the user's selected payment method type until the
user actually selects a payment method, meaning that until then the `additionalShippingMethods`
are not used. Unfortunately (until now) `PKPaymentRequestPaymentMethodUpdate` did not
support providing a `NSArray<PKShippingMethod *> *`, so there was no way to update the list
of shipping methods when the user changed their selected payment method, meaning that WebKit
would have to wait/rely on the user to change their shipping address _after_ selecting a
payment method in order for `additionalShippingMethods` to take effect.
This also fixes an issue with WebKit's implementation of the W3C Payment Request API by
allowing any generic (i.e. things not specific to Apple Pay) `shippingOptions` provided in
`PaymentDetailsUpdate` to actually be used and update the Apple Pay sheet accordingly.
Test: http/tests/paymentrequest/ApplePayModifier-paymentMethodType.https.html
* Modules/applepay/ApplePayModifier.idl:
* Modules/applepay/ApplePayModifier.h:
* Modules/applepay/ApplePayPaymentMethodUpdate.idl:
* Modules/applepay/ApplePayPaymentMethodUpdate.h:
(WebCore::ApplePayPaymentMethodUpdate::encode const):
(WebCore::ApplePayPaymentMethodUpdate::decode):
* Modules/applepay/ApplePayShippingMethodUpdate.idl:
* Modules/applepay/ApplePayShippingMethodUpdate.h:
(WebCore::ApplePayShippingMethodUpdate::encode const):
(WebCore::ApplePayShippingMethodUpdate::decode):
Add (or wrap existing) `additionalShippingMethods`/`newShippingMethods` properties.
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
(WebCore::ApplePayPaymentHandler::computeShippingMethods):
(WebCore::ApplePayPaymentHandler::detailsUpdated):
(WebCore::ApplePayPaymentHandler::shippingOptionUpdated):
(WebCore::ApplePayPaymentHandler::paymentMethodUpdated):
Also call `computeShippingMethods()` and add the result to the update.
* testing/MockPaymentCoordinator.cpp:
(WebCore::MockPaymentCoordinator::completeShippingMethodSelection):
(WebCore::MockPaymentCoordinator::completeShippingContactSelection):
(WebCore::MockPaymentCoordinator::completePaymentMethodSelection):
(WebCore::MockPaymentCoordinator::completeCouponCodeChange):
Support for testing.
2021-07-29 Alex Christensen <achristensen@webkit.org>
[ Mac ] fast/dom/webtiming-document-open.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=228571
Reviewed by Chris Dumez.
In r278391 I made PerformanceTiming::monotonicTimeToIntegerMilliseconds call MonotonicTime::approximateWallTime,
which, if called multiple times, can give slightly different values, usually differing by 1 (millisecond, in this case).
To fix this, cache the value from the first call. This uses an additional 168 bytes per frame in pages that use PerformanceTiming.
Once bug 227336 is turned on and the web is given a year or so to move to that replacement API, this whole API will be removed.
* page/PerformanceTiming.cpp:
(WebCore::PerformanceTiming::navigationStart const):
(WebCore::PerformanceTiming::unloadEventStart const):
(WebCore::PerformanceTiming::unloadEventEnd const):
(WebCore::PerformanceTiming::redirectStart const):
(WebCore::PerformanceTiming::redirectEnd const):
(WebCore::PerformanceTiming::fetchStart const):
(WebCore::PerformanceTiming::domainLookupStart const):
(WebCore::PerformanceTiming::domainLookupEnd const):
(WebCore::PerformanceTiming::connectStart const):
(WebCore::PerformanceTiming::connectEnd const):
(WebCore::PerformanceTiming::secureConnectionStart const):
(WebCore::PerformanceTiming::requestStart const):
(WebCore::PerformanceTiming::responseStart const):
(WebCore::PerformanceTiming::responseEnd const):
(WebCore::PerformanceTiming::domLoading const):
(WebCore::PerformanceTiming::domInteractive const):
(WebCore::PerformanceTiming::domContentLoadedEventStart const):
(WebCore::PerformanceTiming::domContentLoadedEventEnd const):
(WebCore::PerformanceTiming::domComplete const):
(WebCore::PerformanceTiming::loadEventStart const):
(WebCore::PerformanceTiming::loadEventEnd const):
* page/PerformanceTiming.h:
2021-07-29 Michael Catanzaro <mcatanzaro@gnome.org>
-Wreturn-type warning in SQLiteDatabase.cpp
https://bugs.webkit.org/show_bug.cgi?id=228602
Unreviewed, add missing RELEASE_ASSERT_NOT_REACHED().
* platform/sql/SQLiteDatabase.cpp:
(WebCore::checkpointModeValue):
2021-07-29 Alan Bujtas <zalan@apple.com>
[LFC][Integration] Disable hanging punctuation content
https://bugs.webkit.org/show_bug.cgi?id=228598
Reviewed by Antti Koivisto.
Currently we only check the root for hanging punctuation, but it is applicable to all elements including inline boxes.
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForChild):
2021-07-29 Kate Cheney <katherine_cheney@apple.com>
GetIdentifierStringForPreferredVoiceInListWithLocale() is deprecated in Monterey
<https://webkit.org/b/228066>
<rdar://problem/80577312>
Patch by David Kilzer.
Reviewed by David Kilzer.
* platform/mac/PlatformSpeechSynthesizerMac.mm:
(WebCore::speechSynthesisGetDefaultVoiceIdentifierForLocale):
- Switch to use
CopyIdentifierStringForPreferredVoiceInListWithLocale()
in Monterey.
- Change to return RetainPtr<> to handle lifetime of
object returned from new function.
(WebCore::PlatformSpeechSynthesizer::initializeVoiceList):
- Change varible type to 'auto' since return type of
speechSynthesisGetDefaultVoiceIdentifierForLocale()
changed.
2021-07-29 Adrian Perez de Castro <aperez@igalia.com>
[CMake] Use an imported target for the libgcrypt library
https://bugs.webkit.org/show_bug.cgi?id=228581
Reviewed by Michael Catanzaro.
No new tests needed.
* platform/GCrypt.cmake: Use the LibGcrypt::LibGcrypt imported target.
* platform/GStreamer.cmake: Remove unneeded usage of ${LIBGCRYPT_INCLUDE_DIRS} and
${LIBGCRYPT_LIBRARIES}, as those are handled now by making WebCore depend on the
LibGcrypt::LibGcrypt imported target.
2021-07-29 Michael Catanzaro <mcatanzaro@gnome.org>
[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-07-29 Youenn Fablet <youenn@apple.com>
RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer should update m_currentRotationSessionAngle
https://bugs.webkit.org/show_bug.cgi?id=228549
<rdar://80608977>
Reviewed by Eric Carlson.
Do not forget to update m_currentRotationSessionAngle when creating a new rotation session.
Also, make sure to recreate rotation session in case the pixel buffer size changes.
* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm:
(WebCore::RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer):
2021-07-29 Adrian Perez de Castro <aperez@igalia.com>
Non-unified build fixes, late July 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=228579
Unreviewed non-unified build fixes.
* Modules/webaudio/AudioContextOptions.h: Add missing <optional> header.
* html/BaseDateAndTimeInputType.cpp: Add missing "FrameView.h" header.
* page/PageConfiguration.cpp: Add missing "BroadcastChannelRegistry.h" header.
2021-07-28 Ada Chan <ada.chan@apple.com>
[WebXR] Require GL_OES_EGL_image extension for xrCompatible GL context
https://bugs.webkit.org/show_bug.cgi?id=228575
Reviewed by Dean Jackson.
Without this extension, EGLImageTargetTexture2DOES() will fail
in GraphicsContextGLOpenGL::attachIOSurfaceToSharedTexture().
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
2021-07-28 Jean-Yves Avenard <jya@apple.com>
[WebAudio] Add webm/opus container support
https://bugs.webkit.org/show_bug.cgi?id=227110
<rdar://problem/79437067>
Reviewed by Jer Noble.
Add support for webm in Web Audio.
As decoding needs to be performed in the web content process we
need to ensure that the decoders are available there. For security
reasons, com.apple.audio.AudioComponentRegistrar mach calls are blocked
which prevents registering a new audio component.
We instead register it in the UI process so that AudioComponentFetchServerRegistrations
SPI can forward the registration in the web process.
Unfortunately, for unknown reasons, this fails for Vorbis audio codec (bug 228139).
To demux the webm content, we use the existing SourceBufferParserWebM to extract all
audio packets. We then iterate over all CM Samples and decode them into PCM, performing
resampling as needed on the fly.
There are things left to fix.
- Opus and Vorbis encoder delay isn't handled (bug 228140) which leaves audible
silence at the beginning of the destination buffer.
- We can only decode mono and stereo content. Opus and Vorbis let you define a
custom channel ordering, this is particularly used with ambisonic audio (with opus 255 mode).
CoreMedia doesn't easily deal with such re-ordering as it appears to be essentially
designed for audible content. With more than 2 channels, decoding will either fail
or produce channels in the wrong order.
Test: webaudio/decode-audio-data-webm-opus.html
* Headers.cmake: Export header so that we can register the decoder in the UI process.
* WebCore.xcodeproj/project.pbxproj: same as above.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::canPlayType const): Make canPlayType(webm/audio; codecs=opus)
work if features is set.
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setWebMWebAudioEnabled):
(WebCore::RuntimeEnabledFeatures::webMWebAudioEnabled const):
* platform/MediaSample.h: Fly-by fix: remove unnecessary WEBCORE_EXPORT
* platform/audio/AudioBus.cpp:
(WebCore::AudioBus::setLength):
* platform/audio/AudioBus.h: Add setLength method. Will change the reported length
without touching the underlying storage.
* platform/audio/AudioChannel.h: Add setLength method. Will change the reported
length without touching the underlying storage.
* platform/audio/cocoa/AudioFileReaderCocoa.cpp:
(WebCore::tryCreateAudioBufferList): Fix checkedInt use to catch potential overflow
(WebCore::AudioBufferListHolder::AudioBufferListHolder): Add convenience class that
free wrapped AudioBufferList object on exit.
(WebCore::AudioBufferListHolder::~AudioBufferListHolder):
(WebCore::AudioBufferListHolder::operator bool const):
(WebCore::AudioBufferListHolder::operator-> const):
(WebCore::AudioBufferListHolder::operator* const):
(WebCore::AudioBufferListHolder::isValid const):
(WebCore::AudioFileReader::AudioFileReader):
(WebCore::AudioFileReader::isMaybeWebM const): Method to check if the buffer
contains WebM data.
(WebCore::passthroughInputDataCallback): Required for AudioConverterFillComplexBuffer.
Will feed the decoder the data to decode, splitting the multiple packets found
in the CMSampleBuffer.
(WebCore::AudioFileReader::numberOfFrames const): Return the total number of
decoded frames in the packets.
(WebCore::AudioFileReader::fileDataFormat const): Create AudioStreamBasicDescription
related to the demuxed audio track. nullopt if unsupported content.
(WebCore::AudioFileReader::clientDataFormat const):
(WebCore::AudioFileReader::createBus):
(WebCore::AudioFileReader::logChannel const):
* platform/audio/cocoa/AudioFileReaderCocoa.h:
* platform/audio/cocoa/AudioSampleDataSource.h: Remove unused typedef.
* platform/audio/cocoa/AudioSampleDataSource.mm:
(WebCore::AudioSampleDataSource::~AudioSampleDataSource): Fly-by fix, make it use
PAL softlinks
(WebCore::AudioSampleDataSource::setupConverter): Fly-by fix, make it use PAL
softlinks
* platform/gamepad/mac/HIDGamepadProvider.mm: Fly-by fix, add missing header.
* platform/graphics/TrackPrivateBase.cpp: Fly-by fix, add missing header.
* platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h:
Fly-by fix required by webkit-prepare : don't tag the whole class as WEBCORE_EXPORT.
Move constructor and destructor function definitions out-of-line to prevent
linkage errors.
* platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
(WebCore::MediaSampleAVFObjC::MediaSampleAVFObjC): Move code
* platform/graphics/cocoa/WebCoreDecompressionSession.mm: Fly-by fix, add missing header.
* platform/graphics/cocoa/WebMAudioUtilitiesCocoa.h: Export some symbols, add new
method definitions.
* platform/graphics/cocoa/WebMAudioUtilitiesCocoa.mm:
(WebCore::registerDecoderFactory): Instead of attempting to register the decoder
by dl-opening the required library, first attempting to see if the decoder is
already available. Calling AudioComponentRegister in the web content process
when the GPU process is enabled will fail due to sandbox settings. Which would
incorrectly report the codec to not be available when it was.
(WebCore::createAudioFormatDescriptionForFormat):
(WebCore::isOpusDecoderAvailable): Fly-by fix, should the method be called
on non-mac platform it would have return the unitialized value of the available
static variable.
(WebCore::registerOpusDecoderIfNeeded): Added
(WebCore::isVorbisDecoderAvailable): Same as isOpusDecoderAvailable
(WebCore::registerVorbisDecoderIfNeeded): Added
2021-07-28 Sihui Liu <sihui_liu@apple.com>
Implement IDBTransaction.durability
https://bugs.webkit.org/show_bug.cgi?id=228289
Reviewed by Darin Adler.
Spec: https://www.w3.org/TR/IndexedDB/#dom-idbtransaction-durability
https://www.w3.org/TR/IndexedDB/#dictdef-idbtransactionoptions
IDBTransaction.durability gives a hint about durability of a transaction. If it's strict, backend would try
syncing data to database file after transaction commit, which enforces durability. If it's relaxed, it means
data may stay in the OS buffer some time after transaction commit, which gives better performance. Firefox and
Chrome already implemented durability. They have different ways of setting durability, and we choose to use
TransactionOptions as spec.
Rebaselined existing tests.
New tests: storage/indexeddb/idbtransaction-durability-private.html
storage/indexeddb/idbtransaction-durability.html
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Headers.cmake:
* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::transaction):
* Modules/indexeddb/IDBDatabase.h:
* Modules/indexeddb/IDBDatabase.idl:
* Modules/indexeddb/IDBTransaction.h:
* Modules/indexeddb/IDBTransaction.idl:
* Modules/indexeddb/IDBTransactionDurability.h: Added.
* Modules/indexeddb/IDBTransactionDurability.idl: Added.
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::commitTransaction):
* Modules/indexeddb/server/SQLiteIDBTransaction.h:
(WebCore::IDBServer::SQLiteIDBTransaction::durability const):
* Modules/indexeddb/shared/IDBTransactionInfo.cpp:
(WebCore::IDBTransactionInfo::clientTransaction):
(WebCore::IDBTransactionInfo::IDBTransactionInfo):
(WebCore::IDBTransactionInfo::isolatedCopy):
* Modules/indexeddb/shared/IDBTransactionInfo.h:
(WebCore::IDBTransactionInfo::durability const):
(WebCore::IDBTransactionInfo::encode const):
(WebCore::IDBTransactionInfo::decode):
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/sql/SQLiteDatabase.cpp:
(WebCore::checkpointModeValue):
(WebCore::SQLiteDatabase::checkpoint):
(WebCore::SQLiteDatabase::useWALJournalMode):
* platform/sql/SQLiteDatabase.h:
2021-07-28 Sihui Liu <sihui_liu@apple.com>
IDBFactory.databases should not return databases with invalid version
https://bugs.webkit.org/show_bug.cgi?id=228554
Reviewed by Chris Dumez.
To get database information, we used to open all database files and read from them. To avoid opening new
connection to databases that are already opened, and to ensure we get the latest information, for database that
is already opened, we should get its information from UniqueIDBDatabase directly. If database is not opened, we
open its file and read. By doing this, we also fix the issue that no databases are returned in private browsing
(since there is no file created).
Also, version 0 means the database is just created and has not finished version change transaction (version 1
is the first valid version according to spec), so we should not return databases with version 0.
Tests: storage/indexeddb/getdatabases-private.html
storage/indexeddb/getdatabases.html
* Modules/indexeddb/server/IDBBackingStore.h:
* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::getDatabaseNameAndVersionFromOriginDirectory):
(WebCore::IDBServer::IDBServer::getAllDatabaseNamesAndVersions):
* Modules/indexeddb/server/MemoryIDBBackingStore.h:
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
(WebCore::IDBServer::UniqueIDBDatabase::filePath const):
(WebCore::IDBServer::UniqueIDBDatabase::nameAndVersion const):
* Modules/indexeddb/server/UniqueIDBDatabase.h:
2021-07-28 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Start tracking resource uses for ImageBuffers
https://bugs.webkit.org/show_bug.cgi?id=228225
Reviewed by Said Abou-Hallawa.
This is part 4 of https://bugs.webkit.org/show_bug.cgi?id=228216.
This works the same way as NativeImages/Fonts (https://bugs.webkit.org/show_bug.cgi?id=228224).
The only real difference to how ImageBuffers work today is that RemoteImageBufferProxy's destructor
doesn't directly tell the RemoteRenderingBackendProxy to release its RenderingResourceIdentifier,
but instead this codepath goes through the RemoteResourceCacheProxy which is tracking the number of
uses of the resource. This is so the RemoteResourceCacheProxy can inject the use count into the
ReleaseRemoteResource command.
Covered by existing tests.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::drawImageBuffer):
(WebCore::DisplayList::Recorder::clipToImageBuffer):
* platform/graphics/displaylists/DisplayListRecorder.h:
(WebCore::DisplayList::Recorder::Delegate::recordImageBufferUse):
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::applyImageBufferItem):
(WebCore::DisplayList::Replayer::applyItem):
2021-07-28 Eric Carlson <eric.carlson@apple.com>
[iOS] Ignore extra route change notifications
https://bugs.webkit.org/show_bug.cgi?id=228565
Reviewed by Jer Noble.
Tested manually, this only reproduces on iOS hardware.
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
(WebCore::AVAudioSessionCaptureDeviceManager::scheduleUpdateCaptureDevices): Do
nothing if m_recomputeDevices is true.
(WebCore::AVAudioSessionCaptureDeviceManager::computeCaptureDevices): Don't rebuilding
device list unless m_recomputeDevices is set. Clear m_recomputeDevices after after
rebuilding list.
2021-07-28 Ryosuke Niwa <rniwa@webkit.org>
AppHighlightStorage should not inherit privately from RefCounted
https://bugs.webkit.org/show_bug.cgi?id=228562
Reviewed by Wenson Hsieh.
AppHighlightStorage is only stored with unique_ptr. There is no reason for this class
to *privately* inherit from RefCounted.
* Modules/highlight/AppHighlightStorage.h:
2021-07-28 Ryosuke Niwa <rniwa@webkit.org>
Deploy more use of smart pointers in Document.cpp
https://bugs.webkit.org/show_bug.cgi?id=228544
A partial revert of r280390 to fix builds. AppHighlightStorage isn't really ref-counted.
* dom/Document.cpp:
(WebCore::Document::finishedParsing):
2021-07-28 Ryosuke Niwa <rniwa@webkit.org>
Deploy more use of smart pointers in Document.cpp
https://bugs.webkit.org/show_bug.cgi?id=228544
Reviewed by Darin Adler.
Deployed RefPtr in more places in Document.cpp
* dom/Document.cpp:
(WebCore::acceptsEditingFocus):
(WebCore::canAccessAncestor):
(WebCore::createHTMLElementWithNameValidation):
(WebCore::Document::adoptNode):
(WebCore::createFallbackHTMLElement):
(WebCore::Document::setVisualUpdatesAllowed):
(WebCore::Document::setTitle):
(WebCore::Document::resolveStyle):
(WebCore::Document::updateLayout):
(WebCore::Document::updateLayoutIfDimensionsOutOfDate):
(WebCore::Document::frameDestroyed):
(WebCore::Document::removeAllEventListeners):
(WebCore::Document::setBodyOrFrameset):
(WebCore::Document::implicitClose):
(WebCore::Document::isNavigationBlockedByThirdPartyIFrameRedirectBlocking):
(WebCore::Document::didRemoveAllPendingStylesheet):
(WebCore::Document::processHttpEquiv):
(WebCore::Document::processColorScheme):
(WebCore::Document::prepareMouseEvent):
(WebCore::Document::updateViewportUnitsOnResize):
(WebCore::Document::runResizeSteps):
(WebCore::Document::runScrollSteps):
(WebCore::Document::invalidateScrollbars):
(WebCore::Document::adjustFocusedNodeOnNodeRemoval):
(WebCore::Document::invalidateEventRegionsForFrame):
(WebCore::Document::invalidateRenderingDependentRegions):
(WebCore::Document::setFocusedElement):
(WebCore::Document::setBackForwardCacheState):
(WebCore::Document::documentWillBecomeInactive):
(WebCore::Document::setDesignMode):
(WebCore::Document::finishedParsing):
(WebCore::Document::initSecurityContext):
(WebCore::Document::initContentSecurityPolicy):
(WebCore::Document::updateURLForPushOrReplaceState):
(WebCore::Document::getCSSCanvasContext):
(WebCore::Document::loadEventDelayTimerFired):
(WebCore::Document::checkCompleted):
(WebCore::Document::wheelEventHandlersChanged):
(WebCore::Document::didAddWheelEventHandler):
(WebCore::Document::didRemoveWheelEventHandler):
(WebCore::Document::didAddTouchEventHandler):
(WebCore::Document::didRemoveTouchEventHandler):
(WebCore::Document::absoluteEventRegionForNode):
(WebCore::Document::absoluteRegionForEventTargets):
(WebCore::Document::updateLastHandledUserGestureTimestamp):
(WebCore::DocumentParserYieldToken::DocumentParserYieldToken):
(WebCore::DocumentParserYieldToken::~DocumentParserYieldToken):
(WebCore::Document::updateHoverActiveState):
(WebCore::Document::updateIntersectionObservations):
(WebCore::Document::bgColor const):
(WebCore::Document::setBgColor):
(WebCore::Document::fgColor const):
(WebCore::Document::setFgColor):
(WebCore::Document::alinkColor const):
(WebCore::Document::setAlinkColor):
(WebCore::Document::linkColorForBindings const):
(WebCore::Document::setLinkColorForBindings):
(WebCore::Document::vlinkColor const):
(WebCore::Document::setVlinkColor):
(WebCore::Document::dispatchSystemPreviewActionEvent):
2021-07-28 Frédéric Wang <fwang@igalia.com>
Crash in ApplyStyleCommand::applyRelativeFontStyleChange
https://bugs.webkit.org/show_bug.cgi?id=226926
Reviewed by Ryosuke Niwa.
In r179944 and r180050, special handling was added for display: grid/flex nodes in
Position::isCandidate in order to make them editable but the same logic was not added in
PositionIterator::isCandidate. This patch fixes that inconsistency as well as the
corresponding debug ASSERT and release nullptr dereference.
Tests: fast/editing/apply-relative-font-style-change-crash-001.html
fast/editing/apply-relative-font-style-change-crash-002.html
* dom/PositionIterator.cpp:
(WebCore::PositionIterator::isCandidate const): Handle flexbox and grid.
2021-07-27 Joonghun Park <jh718.park@samsung.com>
Unreviewed. Remove the build warning below since r280332.
warning: redundant move in return statement [-Wredundant-move]
No new tests, no new behaviors.
* html/DOMFormData.cpp:
(WebCore::DOMFormData::create):
2021-07-27 Devin Rousso <drousso@apple.com>
[Modern Media Controls] [macOS] Overflow button still shows as `on` even after contextmenu is dismissed
https://bugs.webkit.org/show_bug.cgi?id=228310
<rdar://problem/81124786>
Reviewed by Wenson Hsieh.
Test: media/modern-media-controls/overflow-support/button-state.html
* page/ContextMenuController.h:
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::didDismissContextMenu): Added.
* page/ContextMenuProvider.h:
(WebCore::ContextMenuProvider::didDismissContextMenu): Added.
Add plumbing from WebKit to the `ContextMenuProvider` for when the contextmenu is dismissed.
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsContextMenuProvider::didDismissContextMenu): Added.
When the contextmenu is dismissed, invoke the callback provided to `MediaControlsHost::showMediaControlsContextMenu`
as that's the signal to the `MediaController` that the contextmenu interaction is over,
which adjusts the `on` state of the `Button`.
2021-07-27 Ryosuke Niwa <rniwa@webkit.org>
[macOS] Stop away unpaired surrogate pair in findNextWordFromIndex:forward:
https://bugs.webkit.org/show_bug.cgi?id=228496
Reviewed by Darin Adler.
Replace unpaired surrogate pairs with the replacement character before calling findNextWordFromIndex:forward:
* platform/text/mac/TextBoundaries.mm:
(WebCore::findNextWordFromIndex):
2021-07-27 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Code cleanup after r280356
https://bugs.webkit.org/show_bug.cgi?id=228495
Reviewed by Wenson Hsieh.
3 things:
1. Rename cacheNativeImage()/cacheFont() to recordNativeImageUse()/recordFontUse() since it does more
than caching now
2. Mark overridden functions as final in RemoteImageBufferProxy because no class inherits from it
3. Remove unnecessary WebCore:: where it isn't necessary
No new tests because there is no behavior change.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::putPixelBuffer):
(WebCore::DisplayList::Recorder::recordNativeImageUse):
(WebCore::DisplayList::Recorder::appendStateChangeItem):
(WebCore::DisplayList::Recorder::appendDrawGlyphsItemWithCachedFont):
(WebCore::DisplayList::Recorder::drawImageBuffer):
(WebCore::DisplayList::Recorder::drawNativeImage):
(WebCore::DisplayList::Recorder::drawPattern):
(WebCore::DisplayList::Recorder::cacheNativeImage): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.h:
(WebCore::DisplayList::Recorder::Delegate::recordNativeImageUse):
(WebCore::DisplayList::Recorder::Delegate::recordFontUse):
(WebCore::DisplayList::Recorder::Delegate::cacheNativeImage): Deleted.
(WebCore::DisplayList::Recorder::Delegate::cacheFont): Deleted.
2021-07-27 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Start tracking resource uses for NativeImages and Fonts
https://bugs.webkit.org/show_bug.cgi?id=228224
Reviewed by Said Abou-Hallawa.
This is part 3 of https://bugs.webkit.org/show_bug.cgi?id=228216.
This patch triggers the infrastructure added in https://bugs.webkit.org/show_bug.cgi?id=228222 by tracking
resource use counts in the web process. RemoteResourceCacheProxy already is notified whenever a resource
is used, so it records how many of these notifications it receives, and sends that count to the GPU process
with the release message. When the GPU process replays the display lists, it also keeps track of how many
uses it encountered for the resource, via calling through the Replayer::Delegate.
Covered by existing tests.
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::applyNativeImageItem):
(WebCore::DisplayList::applySetStateItem):
(WebCore::DisplayList::applyFontItem):
(WebCore::DisplayList::Replayer::applyItem):
2021-07-27 Alex Christensen <achristensen@webkit.org>
document.referrer value is missing trailing slash
https://bugs.webkit.org/show_bug.cgi?id=215080
Reviewed by John Wilander.
This matches the behavior of Chrome and Firefox.
The solution is similar to that of bug 227795.
Covered by a few layout tests.
* dom/Document.cpp:
(WebCore::Document::referrer):
2021-07-26 Said Abou-Hallawa <said@apple.com>
Regulate the WebPage RenderingUpdates from the WebProcess to the GPUProcess
https://bugs.webkit.org/show_bug.cgi?id=227791
<rdar://78430639>
Reviewed by Simon Fraser.
Make ChromeClient decide whether a RenderingUpdate can be triggered or
should be rescheduled. Keep track of how many times RenderingUpdate was
rescheduled to ensure RenderingUpdate will be triggered anyway after a
certain number of reschedules.
* page/ChromeClient.h:
(WebCore::ChromeClient::canTriggerRenderingUpdate const):
* page/RenderingUpdateScheduler.cpp:
(WebCore::RenderingUpdateScheduler::displayRefreshFired):
* page/RenderingUpdateScheduler.h:
2021-07-26 Yusuke Suzuki <ysuzuki@apple.com>
Unreviewed, speculative revert of r280193
https://bugs.webkit.org/show_bug.cgi?id=228142
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::insertTextNode):
* html/parser/HTMLConstructionSite.h:
* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::pumpTokenizerLoop):
* html/parser/HTMLMetaCharsetParser.cpp:
(WebCore::HTMLMetaCharsetParser::checkForMetaCharset):
* html/parser/HTMLPreloadScanner.cpp:
(WebCore::HTMLPreloadScanner::scan):
* html/parser/HTMLToken.h:
(WebCore::HTMLToken::clear):
(WebCore::HTMLToken::beginStartTag):
(WebCore::HTMLToken::beginEndTag):
(WebCore::HTMLToken::shrinkToBestFit): Deleted.
* html/parser/HTMLTokenizer.h:
(WebCore::HTMLTokenizer::shrinkToBestFit): Deleted.
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::characterPredicate):
(WebCore::HTMLTreeBuilder::processFakeCharacters):
(WebCore::HTMLTreeBuilder::insertPhoneNumberLink):
(WebCore::HTMLTreeBuilder::linkifyPhoneNumbers):
(WebCore::HTMLTreeBuilder::processCharacterBuffer):
(WebCore::HTMLTreeBuilder::processCharacterBufferForInBody):
(WebCore::HTMLTreeBuilder::defaultForInTableText):
(WebCore::HTMLTreeBuilder::processTokenInForeignContent):
* html/parser/HTMLTreeBuilder.h:
2021-07-26 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Add resource use counter infrastructure to RemoteResourceCache
https://bugs.webkit.org/show_bug.cgi?id=228222
Reviewed by Said Abou-Hallawa.
This is part 2 of https://bugs.webkit.org/show_bug.cgi?id=228216.
No new tests because there is no behavior change yet. This patch is just adding infrastructure. For now, all these
use counts sent by the web process are 0 - I'll implement that part in 3 follow-up patches.
* platform/graphics/displaylists/DisplayListReplayer.h:
(WebCore::DisplayList::Replayer::Delegate::recordResourceUse):
2021-07-26 Chris Dumez <cdumez@apple.com>
Location.href setter uses wrong window to resolve relative URLs
https://bugs.webkit.org/show_bug.cgi?id=228287
Reviewed by Darin Adler.
Location::setLocation() is using "firstWindow" to resolve any input relative URL.
We rely on JSC::VM::deprecatedVMEntryGlobalObject() to get the first/entry window.
However, the test I wrote shows that we were using the wrong window as "first window"
in some cases (since this test would pass in other browsers but not in WebKit).
It turns out that JSEventListener::handleEvent() had a VMEntryScope internally that
would impact the global object being returned by JSC::VM::deprecatedVMEntryGlobalObject().
We were incorrectly using the scriptExecutionContext passed as parameter when constructing
the VMEntryScope instead of using the global object of the function we're about to call.
This bug addresses this.
Credits to Geoff Garen for identifying the issue in JSEventListener::handleEvent().
Test: http/tests/dom/window-location-set-href-relative-url.html
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* page/Location.cpp:
(WebCore::Location::setLocation):
2021-07-26 Johnson Zhou <qiaosong_zhou@apple.com>
This is responding to feedback on r280310.
https://bugs.webkit.org/show_bug.cgi?id=227718
Reviewed by Alex Christensen.
* dom/FormDataEvent.h:
(WebCore::FormDataEvent::formData const):
* html/DOMFormData.cpp:
(WebCore::DOMFormData::create):
(WebCore::DOMFormData::clone const):
(WebCore::DOMFormData::clone): Deleted.
* html/DOMFormData.h:
2021-07-26 Jean-Yves Avenard <jya@apple.com>
Video pauses after scrubbing with Touch Bar
https://bugs.webkit.org/show_bug.cgi?id=228277
rdar://80606886
Reviewed by Jer Noble.
In https://trac.webkit.org/r206487 ; in order to ensure that the playback state
was properly reflected following a seek using the touch bar, the element was paused.
It's unclear if that workaround is still required, but for now we will record if the
element was playing before the seek and if so, resume playback once the seek completes.
Now that the touch bar and Now Playing are hooked to the Media Session action handlers
the behaviour change will occur for all those components.
Test: media/media-session/play-after-seek.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement): Initialize new member in constructor.
(WebCore::HTMLMediaElement::clearSeeking):
(WebCore::HTMLMediaElement::finishSeek): Call play() once seek completes if the element
was playing before.
(WebCore::HTMLMediaElement::pause): Ensure that if pause() is called before the seek
completes, the element stays paused.
(WebCore::HTMLMediaElement::handleSeekToPlaybackPosition): Record playing state before
pausing the element.
* html/HTMLMediaElement.h: Add new boolean member.
2021-07-26 Ryosuke Niwa <rniwa@webkit.org>
Deploy smart pointers in ApplyBlockElementCommand, IndentOutdentCommand and InsertListCommand
https://bugs.webkit.org/show_bug.cgi?id=228304
Reviewed by Chris Dumez.
Use RefPtr in more places instead of raw pointers.
* editing/ApplyBlockElementCommand.cpp:
(WebCore::ApplyBlockElementCommand::formatSelection):
(WebCore::isNewLineAtPosition):
(WebCore::ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded):
(WebCore::ApplyBlockElementCommand::endOfNextParagraphSplittingTextNodesIfNeeded):
* editing/IndentOutdentCommand.cpp:
(WebCore::IndentOutdentCommand::tryIndentingAsListItem):
(WebCore::IndentOutdentCommand::indentIntoBlockquote):
(WebCore::IndentOutdentCommand::outdentParagraph):
* editing/InsertListCommand.cpp:
(WebCore::InsertListCommand::mergeWithNeighboringLists):
(WebCore::InsertListCommand::unlistifyParagraph):
(WebCore::adjacentEnclosingList):
(WebCore::InsertListCommand::listifyParagraph):
2021-07-26 Kate Cheney <katherine_cheney@apple.com>
ServiceWorkerRegistration.unregister method fails in WKWebView
https://bugs.webkit.org/show_bug.cgi?id=227524
<rdar://problem/80264108>
Reviewed by Youenn Fablet.
We should only check the app-bound domain list when registering a new
worker. Unregistering or updating an existing registration is fine because
we know that every registration has already gone through this check.
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::addRegistrationFromStore):
(WebCore::SWServer::validateRegistrationDomain):
(WebCore::SWServer::scheduleJob):
* workers/service/server/SWServer.h:
2021-07-26 Cameron McCormack <heycam@apple.com>
Don't allow descriptors to be set to CSS-wide keywords
https://bugs.webkit.org/show_bug.cgi?id=228218
<rdar://80675715>
Reviewed by Simon Fraser.
And store the parent rule type directly on
StyleRuleCSSStyleDeclaration so that we can still check it after
m_parentRule has been cleared.
* css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::StyleRuleCSSStyleDeclaration::StyleRuleCSSStyleDeclaration):
(WebCore::StyleRuleCSSStyleDeclaration::cssParserContext const):
* css/PropertySetCSSStyleDeclaration.h:
* css/parser/CSSParserFastPaths.cpp:
(WebCore::parseKeywordValue):
2021-07-26 Chris Dumez <cdumez@apple.com>
Rename activeWindow to incumbentWindow in the Location class
https://bugs.webkit.org/show_bug.cgi?id=228295
Reviewed by Darin Adler.
Rename activeWindow to incumbentWindow in the Location class, since this is the naming used
both in the HTML specification and Location.idl.
* page/Location.cpp:
(WebCore::Location::setHref):
(WebCore::Location::setProtocol):
(WebCore::Location::setHost):
(WebCore::Location::setHostname):
(WebCore::Location::setPort):
(WebCore::Location::setPathname):
(WebCore::Location::setSearch):
(WebCore::Location::setHash):
(WebCore::Location::assign):
(WebCore::Location::replace):
(WebCore::Location::reload):
(WebCore::Location::setLocation):
* page/Location.h:
2021-07-26 Frédéric Wang <fwang@igalia.com>
Crash in InsertParagraphSeparatorCommand::doApply
https://bugs.webkit.org/show_bug.cgi?id=224977
Reviewed by Ryosuke Niwa.
Because <html> elements are handled specially in Position::isCandidate() (a) and
PositionIterator::isCandidate() (b), the function InsertParagraphSeparatorCommand::doApply()
may end up in a edge case where the startBlock is a sibling of the visible position per (a)
but isFirstInBlock,isLastInBlock is true,false per (b). This leads to hitting the debug
assertion ASSERT(startBlock->firstChild()) and dereferencing a nullptr pointer in release.
This patch fixes that by exiting early if the visible position is not a descendant of the
start block.
Test: editing/inserting/insert-paragraph-separator-with-html-elements-crash.html
* editing/InsertParagraphSeparatorCommand.cpp:
(WebCore::InsertParagraphSeparatorCommand::doApply):
2021-07-26 Johnson Zhou <qiaosong_zhou@apple.com>
FormDataEvent added, and dispatched upon creation of DOMFormData or submission of HTMLFormElement.
https://bugs.webkit.org/show_bug.cgi?id=227718
Reviewed by Chris Dumez.
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/EventNames.h:
* dom/EventNames.in:
* dom/FormDataEvent.cpp: Added.
(WebCore::FormDataEvent::create):
(WebCore::FormDataEvent::FormDataEvent):
(WebCore::FormDataEvent::eventInterface const):
* dom/FormDataEvent.h: Added.
(WebCore::FormDataEvent::formData const):
* dom/FormDataEvent.idl: Added.
* dom/GlobalEventHandlers.idl:
* html/DOMFormData.cpp:
(WebCore::DOMFormData::DOMFormData):
(WebCore::DOMFormData::create):
(WebCore::DOMFormData::clone):
* html/DOMFormData.h:
(WebCore::DOMFormData::create): Deleted.
* html/HTMLAttributeNames.in:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::createEventHandlerNameMap):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::submitIfPossible):
(WebCore::HTMLFormElement::submit):
(WebCore::HTMLFormElement::constructEntryList):
* html/HTMLFormElement.h:
* loader/FormSubmission.cpp:
(WebCore::FormSubmission::create):
* loader/FormSubmission.h:
* platform/network/FormData.cpp:
(WebCore::FormData::appendNonMultiPartKeyValuePairItems):
2021-07-26 Jer Noble <jer.noble@apple.com>
[Cocoa] Playback stalls on bilibili.com
https://bugs.webkit.org/show_bug.cgi?id=228239
<rdar://80419477>
Reviewed by Eric Carlson.
Test: media/media-source/media-source-effectiveplaybackrate.html
bilibili.com will attempt to detect playback stalls by detecting when video.currentTime
returns the same value while video.paused is false. When the GPU process is enabled, we use
a heuristic to provide the answer to currentTime to avoid making synchronous calls to the
GPU process. This heuristic uses the reported playback rate of the MediaPlayerPrivate to
derive the currentTime. However, MediaPlayerPrivateAVFoundationObjC does not override the
default implementation of rate(), and so always returns a reported rate of zero.
To make the call less ambiguous, add a MediaPlayer and MediaPlayerPrivate effectiveRate()
method, which by default will just return rate(), as some ports only report the
requested rate and not the effective rate. Then add overrides for both rate() and
effectiveRate() on both MediaPlayerPrivateAVFoundationObjC and
MediaPlayerPrivateMediaSourceAVFObjC.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updatePlaybackRate):
(WebCore::HTMLMediaElement::mediaPlayerRateChanged):
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::effectiveRate const):
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::effectiveRate const):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::rate const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::effectiveRate const):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::rate const):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::effectiveRate const):
* testing/Internals.cpp:
(WebCore::Internals::isMediaElementHidden):
(WebCore::Internals::elementEffectivePlaybackRate):
* testing/Internals.h:
* testing/Internals.idl:
2021-07-26 Ada Chan <ada.chan@apple.com>
[WebXR] WebXRSession::m_visibilityState is uninitialized
https://bugs.webkit.org/show_bug.cgi?id=228286
Reviewed by Tim Horton.
WebXRSession::m_visibilityState should be initialized to XRVisibilityState::Visible.
* Modules/webxr/WebXRSession.h:
2021-07-26 Aditya Keerthi <akeerthi@apple.com>
[iOS] Page background color does not update after UIUserInterfaceLevel change
https://bugs.webkit.org/show_bug.cgi?id=228282
rdar://80490391
Reviewed by Wenson Hsieh.
The default background color of the root element is a semantic color
that adapts to changes in user interface style (light/dark mode) and
user interface level (base/elevated).
Currently, the default background color is correctly recalculated
after a change to the user interface style. However, the existing
logic does not update the color unless there is a change to the user
interface style. This behavior is incorrect, since a change to the
user interface level, without a change to the user interface style,
is ignored.
A common scenario in which a user interface level change is not
accompanied by a user interface style change, is when a WKWebView is
created and then presented as a page sheet, form sheet, or popover.
In this scenario, the default background color is currently incorrect.
To fix, ensure that the background color is recalculated if any of the
traits that affect semantic colors is changed.
Test: fast/css/ios/update-user-interface-level.html
* page/FrameView.cpp:
(WebCore::FrameView::recalculateBaseBackgroundColor):
Recalculate the background color if any of the traits that affect
semantic colors is changed, not just a change in user interface
style (light/dark mode).
* page/FrameView.h:
* testing/InternalSettings.cpp:
Added a testing hook to change the current user interface level.
(WebCore::InternalSettings::resetToConsistentState):
(WebCore::InternalSettings::setUseDarkAppearance):
(WebCore::InternalSettings::setUseElevatedUserInterfaceLevel):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:
2021-07-26 Chris Dumez <cdumez@apple.com>
XML documents end up with a unique origin in WebKit only
https://bugs.webkit.org/show_bug.cgi?id=228254
Reviewed by Darin Adler.
XML documents end up with a unique origin in WebKit only. They have a regular origin in Blink and Firefox.
This patch is aligning our behavior with other browsers.
Test: http/tests/misc/xml-document-origin.html
* xml/XMLTreeViewer.cpp:
(WebCore::XMLTreeViewer::transformDocumentToTreeView):
2021-07-26 Jer Noble <jer.noble@apple.com>
[iOS] All home screen web apps resume when any home screen web app is foregrounded
https://bugs.webkit.org/show_bug.cgi?id=228246
<rdar://72949281>
Reviewed by Eric Carlson.
Test: media/video-page-visibility-restriction.html
On iOS, home screen web apps all run from the same UIProcess, SafariViewService. So when
one Web App is foregrounded, the SafariViewService itself is foregrounded, and all WKWebViews
(one for each Web App) are foregrounded as well, allowing all Web Apps to resume audio
playback. This is not ideal; ideally, all Web Apps will be allowed to continue to play
audio in the background. But until we can fix that bug, the current behavior of pausing
audio from Web App A when A is backgrounded, and resuming audio from A when Web App B is
foregrounded feels super broken.
Add a new WKPreference/WebPreference/Setting and matching MediaElementSession restriction
that will block playback of audible media elements when the media element's page is not
visible. When adopted by SafariViewService, this would keep multiple Web Apps (and indeed
SafariViewController pages) from starting playback when any other is foregrounded.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::initializeMediaSession):
(WebCore::HTMLMediaElement::visibilityStateChanged):
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::visibilityChanged):
(WebCore::MediaElementSession::playbackStateChangePermitted const):
* html/MediaElementSession.h:
* platform/audio/PlatformMediaSession.h:
* testing/Internals.cpp:
(WebCore::Internals::setMediaElementRestrictions):
2021-07-26 Philippe Normand <pnormand@igalia.com>
[Pipewire] Muting the display capture closes the Portal session
https://bugs.webkit.org/show_bug.cgi?id=228265
Reviewed by Xabier Rodriguez-Calvar.
The session should not be closed in that case, because setting the capture state to active
again would have no effect. This patch also removes useless CRLFs from WTFLogAlways() calls
and increases the session Close call timeout to 100ms, 10ms was too low, at least for my
setup.
* platform/mediastream/gstreamer/GStreamerDisplayCaptureDeviceManager.cpp:
(WebCore::GStreamerDisplayCaptureDeviceManager::createDisplayCaptureSource):
(WebCore::GStreamerDisplayCaptureDeviceManager::stopSource):
* platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
(WebCore::GStreamerVideoCaptureSource::~GStreamerVideoCaptureSource):
(WebCore::GStreamerVideoCaptureSource::stopProducingData):
2021-07-26 Ziran Sun <zsun@igalia.com>
[css-grid] svg image as grid items should use the overriding logical width/height when defined to compute the logical height/width
https://bugs.webkit.org/show_bug.cgi?id=228105
As discussed at https://github.com/w3c/csswg-drafts/issues/6286#issuecomment-866986544, degenerate
aspect ratios derived from SVG width/height attributes fall back to viewbox aspect ratio
(whether due to negative values or zero values).
When computing the logical height/width using an intrinsic aspect ratio, RenderReplaced uses the
overridingLogicalWidth/overridingLogicalHeight whenever defined as long as the flex or
grid item has an intrinsic size. For an SVG graphic though, it's common to have an intrinsic aspect
ratio but not to have an intrinsic width or height. For this special case, we still should use
overridingLogicalWidth/overridingLogicalHeight for logical height/width calculations.
Reviewed by Javier Fernandez.
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeReplacedLogicalWidth const):
(WebCore::RenderReplaced::computeReplacedLogicalHeight const):
2021-07-24 Devin Rousso <drousso@apple.com>
[Apple Pay] Do not add coupon code `ApplePayErrorCode` values for systems that do not support it
https://bugs.webkit.org/show_bug.cgi?id=228243
Reviewed by Wenson Hsieh.
Test: http/tests/ssl/applepay/ApplePayError.html
* Modules/applepay/ApplePayErrorCode.idl:
* Modules/applepay/ApplePayErrorCode.h:
2021-07-23 Andres Gonzalez <andresg_22@apple.com>
Add a method to WebAccessibilityObjectWrapper so that clients can retrieve the text of each line and their corresponding bounding rectangles.
https://bugs.webkit.org/show_bug.cgi?id=228251
rdar://77184036
Reviewed by Chris Fleizach.
Test: accessibility/ios-simulator/element-line-rects-and-text.html
Accessibility clients often need to retrieve a line of text and its
corresponding bounding rectangle screen coordinates. There was not a
clear way of doing this. This patch provides lineRectsAndText as the
mechanism to retrieve the lines of text and their corresponding
rectangles for a given accessibility object. This is the iOS
implementation. MacOS implementation will be done in a separate patch.
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper stringsForSimpleRange:attributed:]):
(-[WebAccessibilityObjectWrapper arrayOfTextForTextMarkers:attributed:]):
(-[WebAccessibilityObjectWrapper lineRectsAndText]):
(-[WebAccessibilityObjectWrapper lineRectsForTextMarkerRange:]):
2021-07-23 Alexey Shvayka <shvaikalesh@gmail.com>
[WebIDL] Properly validate and merge descriptors in [Replaceable] setter
https://bugs.webkit.org/show_bug.cgi?id=227662
Reviewed by Sam Weinig.
The previous implementation relied on an invariant that structure property is absent
when [Replaceable] setter is called, which is no longer guaranteed after the introduction
of Object.defineProperty.
This patch replaces putDirect() with defineOwnProperty(), fixing the compliance with
invariants of internal methods [1]: an accessor property once observed as non-configurable
can't be reconfigured to have [[Value]]. Both Chrome and Firefox properly validate descriptors.
Although [[DefineOwnProperty]] failure is silently ignored by Chrome and the spec [2], WebKit now
throws a TypeError, which is a desired behavior for built-ins and was proven to be web-compatible
by Firefox. With WebKit being the second implementation that throws, the spec can be tightened.
After r264574, attributeChangeTransition() is called during defineOwnProperty(), ensuring inline
caching is correct. Also, this change adjusts `window.opener` setter [3].
[1] https://tc39.es/ecma262/#sec-invariants-of-the-essential-internal-methods
[2] https://heycam.github.io/webidl/#dfn-attribute-setter (step 4.5.5)
[3] https://html.spec.whatwg.org/multipage/browsers.html#dom-opener
Tests: fast/dom/replaceable-setter-throws-if-defineownproperty-fails.html
fast/dom/window-opener-setter-throws-if-defineownproperty-fails-1.html
fast/dom/window-opener-setter-throws-if-defineownproperty-fails-2.html
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::setOpener):
(WebCore::JSDOMWindow::setOpenDatabase):
* bindings/scripts/CodeGeneratorJS.pm:
(AttributeSetterNeedsPropertyName):
(GenerateAttributeSetterBodyDefinition):
(GenerateAttributeSetterTrampolineDefinition):
* bindings/scripts/test/JS/JSTestObj.cpp:
2021-07-23 Wenson Hsieh <wenson_hsieh@apple.com>
REGRESSION (r279751): WebContent process often crashes when hovering over content on apple.com
https://bugs.webkit.org/show_bug.cgi?id=228247
rdar://81010093
Reviewed by Tim Horton.
Add an internal testing hook that can be used to trigger text recognition for the given element. While we should
eventually combine this with another testing hook to simulate VisionKit text recognition results, the new test
using this internal hook shouldn't make its way into VisionKit anyways, so this isn't necessary for now.
See WebKit ChangeLog for more details.
Test: fast/images/text-recognition/text-recognition-in-transparent-video.html
* testing/Internals.cpp:
(WebCore::Internals::requestTextRecognition):
* testing/Internals.h:
* testing/Internals.idl:
2021-07-23 Chris Dumez <cdumez@apple.com>
SharedBuffer::takeData() is a bit dangerous
https://bugs.webkit.org/show_bug.cgi?id=228161
Reviewed by Darin Adler.
SharedBuffer::takeData() is a bit dangerous since SharedBuffer is RefCounted and several object may be sharing ownership
of the buffer. Having one owner call takeData() in case ownership is shared leads to bugs such as Bug 228096.
To address the issue, I made SharedBuffer::takeData() private and introduced a new SharedBuffer::extractData() member
function which calls takeData() only if the SharedBuffer is not shared (RefCount is 1) and falls back to calling copyData()
otherwise. I also optimized copyData() a bit by iterating over the segments to build the vector, instead of calling the
potentially very slow SharedBuffer::data().
* Modules/fetch/FetchBodyConsumer.cpp:
(WebCore::FetchBodyConsumer::takeAsBlob):
* Modules/mediarecorder/MediaRecorder.cpp:
(WebCore::createDataAvailableEvent):
* editing/WebCorePasteboardFileReader.cpp:
(WebCore::WebCorePasteboardFileReader::readBuffer):
* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::createFragmentForImageAttachment):
(WebCore::WebContentReader::readImage):
* editing/gtk/WebContentReaderGtk.cpp:
(WebCore::WebContentReader::readImage):
* html/HTMLAttachmentElement.cpp:
(WebCore::HTMLAttachmentElement::updateEnclosingImageWithData):
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::copyData):
* platform/SharedBuffer.h:
(WebCore::SharedBuffer::extractData):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::createResponseBlob):
2021-07-23 Alexey Shvayka <shvaikalesh@gmail.com>
[JSC] Call custom accessors / values with their holder's global object
https://bugs.webkit.org/show_bug.cgi?id=225997
Reviewed by Yusuke Suzuki.
This patch fixes cross-realm yet same-origin WebIDL attributes to throw errors in realm of
their accessor, while ensuring that `window.location` and `location.href` setters don't leak
cross-origin Object.prototype via thrown error.
Since Location setters relied on lexical global object to pass outgoing `document.referrer`,
they were updated to use IncumbentWindow as per spec [1]. callerGlobalObject() was reworked
to skip native / built-in callers and rely on VMEntryScope to accomodate top-level <script>
code navigating via Location setter, making the helper more versatile.
globalObjectOfClosestCodeBlock() fixed JSCustomSetterFunction instances and Location's
assign() / replace() methods to pass correct referrer.
Also, this change fixes static attributes like `PerformanceObserver.supportedEntryTypes`
to return wrappers of their realm instead of lexical.
[1] https://html.spec.whatwg.org/multipage/history.html#location-object-navigate (step 2)
Tests: imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/global-object-implicit-this-value-cross-realm.html
imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/invalid-this-value-cross-realm.html
imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/window-location-and-location-href-cross-realm-set.html
imported/w3c/web-platform-tests/performance-timeline/supportedEntryTypes-cross-realm-access.html
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::callerGlobalObject): Deleted.
* bindings/js/JSDOMGlobalObject.h:
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::incumbentDOMWindow):
* bindings/js/JSDOMWindowBase.h:
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::put):
* bindings/js/JSLocationCustom.cpp:
(WebCore::JSLocation::put):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateNamedGetterLambda):
(GenerateCallWithUsingReferences):
(GenerateCallWith):
Ensure IncumbentWindow comes before FirstWindow.
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/TestObj.idl:
Remove attributes that relied on CallFrame since custom getters don't have it.
* page/Location.idl:
Remove [LegacyUnforgeable] from ancestorOrigins because it's set on the interface.
2021-07-23 Richard Houle <rhoule@apple.com>
WebSocket traffic should be correctly assigned to either Developer or User.
https://bugs.webkit.org/show_bug.cgi?id=227564
<rdar://problem/79307301>
Reviewed by Kate Cheney.
Tests: http/tests/app-privacy-report/websocket-isappinitiated.html
http/tests/app-privacy-report/websocket-isnotappinitiated.html
* Modules/websockets/ThreadableWebSocketChannel.cpp:
(WebCore::ThreadableWebSocketChannel::webSocketConnectRequest):
2021-07-23 Aditya Keerthi <akeerthi@apple.com>
[macOS] Repainting artifacts when moving input type=range slider thumb
https://bugs.webkit.org/show_bug.cgi?id=228135
rdar://76247487
Reviewed by Tim Horton.
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::adjustSliderThumbSize const):
The size of NSSliderCell's knob increased in Big Sur. Consequently, the
knob was being painted outside of its box. Unfortunately, there is
currently no way to obtain the size programmatically, so we are forced
to update the hardcoded size.
2021-07-23 Philippe Normand <pnormand@igalia.com>
[GStreamer][1.19] Warnings due to AppSinkCallbacks struct growth
https://bugs.webkit.org/show_bug.cgi?id=228229
Reviewed by Xabier Rodriguez-Calvar.
A new callback was added, for event notifications.
* platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
(WebCore::AudioFileReader::handleNewDeinterleavePad):
* platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
(WebCore::AudioSourceProviderGStreamer::handleNewDeinterleavePad):
* platform/graphics/gstreamer/ImageDecoderGStreamer.cpp:
(WebCore::ImageDecoderGStreamer::InnerDecoder::connectDecoderPad):
2021-07-23 Devin Rousso <drousso@apple.com>
[Modern Media Controls] [macOS] Only show total duration when the elapsed time is visible
https://bugs.webkit.org/show_bug.cgi?id=228191
<rdar://problem/80529918>
Reviewed by Eric Carlson.
When a `<video>` is narrow (~250px) WebKit will drop the elapsed time, meaning that only the
scrubber and duration are visible. It's not very helpful to show just the duration because
it never changes, requiring the user to do the mental math of dividing the scrubber width
by the total duration to figure out how much time is left (and has elapsed). Showing the
remaining time is better because it at least helps the user not have to figure out how much
longer the `<video>` will play (which is more useful/actionable than knowing the duration).
Test: media/modern-media-controls/time-control/time-control.html
* Modules/modern-media-controls/controls/time-control.js:
(TimeControl):
(TimeControl.prototype.handleEvent):
(TimeControl.prototype.get _canShowDurationTimeLabel): Added.
(TimeControl.prototype._durationOrRemainingTimeLabel):
(TimeControl.prototype._performIdealLayout):
Rename `_showDurationTimeLabel` to `_shouldShowDurationTimeLabel` and add another private
getter `_canShowDurationTimeLabel` that only is true when `this.elapsedTimeLabel.visible`.
Use both to decide whether duration or remaining is shown/updated/etc..
2021-07-23 Philippe Normand <pnormand@igalia.com>
[GLib] Remove libportal dependency
https://bugs.webkit.org/show_bug.cgi?id=228056
Reviewed by Carlos Garcia Campos.
The pure-GDBus approach allows us to request the input device (Monitor or Window) depending
on the CaptureDevice type and make the mouse cursor visible in the generated video stream.
Also requesting capture support within computeCaptureDevices() was a bad idea because this
being used by the enumerateMediaDevices API could potentially spam the user with permission
popups.
* platform/GStreamer.cmake:
* platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:
* platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h:
* platform/mediastream/gstreamer/GStreamerDisplayCaptureDeviceManager.cpp: Added.
(WebCore::GStreamerDisplayCaptureDeviceManager::singleton):
(WebCore::GStreamerDisplayCaptureDeviceManager::GStreamerDisplayCaptureDeviceManager):
(WebCore::GStreamerDisplayCaptureDeviceManager::~GStreamerDisplayCaptureDeviceManager):
(WebCore::GStreamerDisplayCaptureDeviceManager::computeCaptureDevices):
(WebCore::GStreamerDisplayCaptureDeviceManager::createDisplayCaptureSource):
(WebCore::GStreamerDisplayCaptureDeviceManager::stopSource):
(WebCore::GStreamerDisplayCaptureDeviceManager::waitResponseSignal):
* platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
(WebCore::GStreamerVideoCaptureSource::createPipewireSource):
(WebCore::GStreamerVideoCaptureSource::factory):
(WebCore::GStreamerVideoCaptureSource::displayFactory):
(WebCore::GStreamerVideoCaptureSource::GStreamerVideoCaptureSource):
(WebCore::GStreamerVideoCaptureSource::stopProducingData):
* platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h:
* platform/mediastream/gstreamer/GStreamerVideoCapturer.cpp:
* platform/mediastream/gstreamer/GStreamerVideoCapturer.h:
2021-07-22 Said Abou-Hallawa <said@apple.com>
Unreviewed, reverting 280130.
https://bugs.webkit.org/show_bug.cgi?id=228212
Introduced MotionMark regression
Reverted changeset:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::simplifiedLayout):
2021-07-22 Chris Dumez <cdumez@apple.com>
The network process fails to take a locked file assertion when executing a SQLiteStatement outside a transaction
https://bugs.webkit.org/show_bug.cgi?id=228194
Reviewed by Geoffrey Garen.
The network process fails to take a locked file assertion when executing a SQLiteStatement outside a transaction.
This means we may suspend in the middle of that statement and crash due to holding locked files.
To address this, we now make sure to bump the transaction count during the sqlite3_step() call if we're not
in the middle of a transaction and the current statement is not read-only (e.g. SELECT). Note that SQLite will
implicitly create a transaction for us in such cases.
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::step):
2021-07-22 Myles C. Maxfield <mmaxfield@apple.com>
[Cocoa] ".SF Arabic" should not be able to be looked up by name (because it is dot-prefixed)
https://bugs.webkit.org/show_bug.cgi?id=228018
<rdar://problem/80691654>
Reviewed by Simon Fraser.
Dot-prefixed font names are not supported. The supported way of using SF Arabic is to use
system-ui with Arabic text. It will fall back to SF Arabic.
Test: fast/text/sf-arabic-lookup-by-name.html
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::platformFontLookupWithFamily): Special case this font name, similar to how
we have other special cases for other dot-prefixed fonts. Ideally we would change this
check to just if the leading character is a dot, but that change would be too scary at
this point in the release cycle.
2021-07-22 Yusuke Suzuki <ysuzuki@apple.com>
Rename AtomicHTMLToken to AtomHTMLToken
https://bugs.webkit.org/show_bug.cgi?id=228196
Reviewed by Geoffrey Garen.
We should rename AtomicHTMLToken to AtomHTMLToken as we did for AtomString (AtomicString => AtomString).
* WebCore.xcodeproj/project.pbxproj:
* html/parser/AtomHTMLToken.h: Renamed from Source/WebCore/html/parser/AtomicHTMLToken.h.
(WebCore::AtomHTMLToken::AtomHTMLToken):
(WebCore::AtomHTMLToken::type const):
(WebCore::AtomHTMLToken::name const):
(WebCore::AtomHTMLToken::setName):
(WebCore::AtomHTMLToken::selfClosing const):
(WebCore::AtomHTMLToken::attributes):
(WebCore::AtomHTMLToken::attributes const):
(WebCore::AtomHTMLToken::characters const):
(WebCore::AtomHTMLToken::charactersLength const):
(WebCore::AtomHTMLToken::charactersIsAll8BitData const):
(WebCore::AtomHTMLToken::comment const):
(WebCore::AtomHTMLToken::forceQuirks const):
(WebCore::AtomHTMLToken::publicIdentifier const):
(WebCore::AtomHTMLToken::systemIdentifier const):
(WebCore::AtomHTMLToken::initializeAttributes):
* html/parser/HTMLConstructionSite.cpp:
(WebCore::setAttributes):
(WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML):
(WebCore::HTMLConstructionSite::mergeAttributesFromTokenIntoElement):
(WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagInBody):
(WebCore::HTMLConstructionSite::insertHTMLBodyStartTagInBody):
(WebCore::HTMLConstructionSite::insertDoctype):
(WebCore::HTMLConstructionSite::insertComment):
(WebCore::HTMLConstructionSite::insertCommentOnDocument):
(WebCore::HTMLConstructionSite::insertCommentOnHTMLHtmlElement):
(WebCore::HTMLConstructionSite::insertHTMLHeadElement):
(WebCore::HTMLConstructionSite::insertHTMLBodyElement):
(WebCore::HTMLConstructionSite::insertHTMLFormElement):
(WebCore::HTMLConstructionSite::insertHTMLElement):
(WebCore::HTMLConstructionSite::insertHTMLElementOrFindCustomElementInterface):
(WebCore::HTMLConstructionSite::insertSelfClosingHTMLElement):
(WebCore::HTMLConstructionSite::insertFormattingElement):
(WebCore::HTMLConstructionSite::insertScriptElement):
(WebCore::HTMLConstructionSite::insertForeignElement):
(WebCore::HTMLConstructionSite::createElement):
(WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
(WebCore::HTMLConstructionSite::createHTMLElement):
(WebCore::HTMLConstructionSite::createElementFromSavedToken):
* html/parser/HTMLConstructionSite.h:
* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::constructTreeFromHTMLToken):
* html/parser/HTMLStackItem.h:
(WebCore::HTMLStackItem::HTMLStackItem):
(WebCore::HTMLStackItem::create):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::ExternalCharacterTokenBuffer):
(WebCore::HTMLTreeBuilder::constructTree):
(WebCore::HTMLTreeBuilder::processToken):
(WebCore::HTMLTreeBuilder::processDoctypeToken):
(WebCore::HTMLTreeBuilder::processFakeStartTag):
(WebCore::HTMLTreeBuilder::processFakeEndTag):
(WebCore::HTMLTreeBuilder::processFakePEndTagIfPInButtonScope):
(WebCore::shouldClose):
(WebCore::adjustSVGTagNameCase):
(WebCore::adjustAttributes):
(WebCore::adjustSVGAttributes):
(WebCore::adjustMathMLAttributes):
(WebCore::adjustForeignAttributes):
(WebCore::HTMLTreeBuilder::processStartTagForInBody):
(WebCore::HTMLTreeBuilder::insertGenericHTMLElement):
(WebCore::HTMLTreeBuilder::processTemplateStartTag):
(WebCore::HTMLTreeBuilder::processTemplateEndTag):
(WebCore::HTMLTreeBuilder::processEndOfFileForInTemplateContents):
(WebCore::HTMLTreeBuilder::processStartTagForInTable):
(WebCore::HTMLTreeBuilder::processStartTag):
(WebCore::HTMLTreeBuilder::processHtmlStartTagForInBody):
(WebCore::HTMLTreeBuilder::processBodyEndTagForInBody):
(WebCore::HTMLTreeBuilder::processAnyOtherEndTagForInBody):
(WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
(WebCore::HTMLTreeBuilder::processEndTagForInTableBody):
(WebCore::HTMLTreeBuilder::processEndTagForInRow):
(WebCore::HTMLTreeBuilder::processEndTagForInCell):
(WebCore::HTMLTreeBuilder::processEndTagForInBody):
(WebCore::HTMLTreeBuilder::processEndTagForInTable):
(WebCore::HTMLTreeBuilder::processEndTag):
(WebCore::HTMLTreeBuilder::processComment):
(WebCore::HTMLTreeBuilder::processCharacter):
(WebCore::HTMLTreeBuilder::insertPhoneNumberLink):
(WebCore::HTMLTreeBuilder::processEndOfFile):
(WebCore::HTMLTreeBuilder::defaultForBeforeHTML):
(WebCore::HTMLTreeBuilder::defaultForBeforeHead):
(WebCore::HTMLTreeBuilder::defaultForInHead):
(WebCore::HTMLTreeBuilder::defaultForInHeadNoscript):
(WebCore::HTMLTreeBuilder::defaultForAfterHead):
(WebCore::HTMLTreeBuilder::processStartTagForInHead):
(WebCore::HTMLTreeBuilder::processGenericRCDATAStartTag):
(WebCore::HTMLTreeBuilder::processGenericRawTextStartTag):
(WebCore::HTMLTreeBuilder::processScriptStartTag):
(WebCore::HTMLTreeBuilder::shouldProcessTokenInForeignContent):
(WebCore::hasAttribute):
(WebCore::HTMLTreeBuilder::processTokenInForeignContent):
(WebCore::HTMLTreeBuilder::parseError):
* html/parser/HTMLTreeBuilder.h:
* html/parser/TextDocumentParser.cpp:
(WebCore::TextDocumentParser::insertFakePreElement):
2021-07-22 Yusuke Suzuki <ysuzuki@apple.com>
Micro-optimize innerHTML
https://bugs.webkit.org/show_bug.cgi?id=228142
Reviewed by Simon Fraser.
No behavior change.
This patch does some micro optimizations revealed by the profiler when running some of Speedometer2 tests which intensively use innerHTML.
This offers improvement in jQuery-TodoMVC and Vanilla-ES2015-Babel-Webpack-TodoMVC since both are super innerHTML heavy benchmarks.
----------------------------------------------------------------------------------------------------------------------------------
| subtest | ms | ms | b / a | pValue (significance using False Discovery Rate) |
----------------------------------------------------------------------------------------------------------------------------------
| Elm-TodoMVC |126.862500 |126.687500 |0.998621 | 0.673462 |
| VueJS-TodoMVC |27.775000 |27.645833 |0.995350 | 0.741588 |
| EmberJS-TodoMVC |129.350000 |129.129167 |0.998293 | 0.624196 |
| BackboneJS-TodoMVC |51.129167 |51.204167 |1.001467 | 0.716622 |
| Preact-TodoMVC |21.870833 |21.337500 |0.975614 | 0.217771 |
| AngularJS-TodoMVC |139.854167 |140.266667 |1.002950 | 0.489838 |
| Vanilla-ES2015-TodoMVC |69.229167 |68.895833 |0.995185 | 0.238772 |
| Inferno-TodoMVC |68.391667 |68.266667 |0.998172 | 0.762281 |
| Flight-TodoMVC |77.979167 |78.166667 |1.002404 | 0.710324 |
| Angular2-TypeScript-TodoMVC |39.741667 |39.966667 |1.005662 | 0.524123 |
| VanillaJS-TodoMVC |55.416667 |55.512500 |1.001729 | 0.781447 |
| jQuery-TodoMVC |268.812500 |266.966667 |0.993133 | 0.003384 (significant) |
| EmberJS-Debug-TodoMVC |345.383333 |345.662500 |1.000808 | 0.695259 |
| React-TodoMVC |90.679167 |90.179167 |0.994486 | 0.067477 |
| React-Redux-TodoMVC |152.691667 |152.687500 |0.999973 | 0.991207 |
| Vanilla-ES2015-Babel-Webpack-TodoMVC |66.487500 |65.729167 |0.988594 | 0.000118 (significant) |
----------------------------------------------------------------------------------------------------------------------------------
a mean = 242.12319
b mean = 242.80485
pValue = 0.1992654128
(Bigger means are better.)
1.003 times better
Results ARE NOT significant
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::insertTextNode):
* html/parser/HTMLConstructionSite.h:
* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::pumpTokenizerLoop): We do not need to call `shrinkToBestFit` in fragment parsing case since
we will discard HTMLToken soon.
* html/parser/HTMLMetaCharsetParser.cpp:
(WebCore::HTMLMetaCharsetParser::checkForMetaCharset):
* html/parser/HTMLPreloadScanner.cpp:
(WebCore::HTMLPreloadScanner::scan):
* html/parser/HTMLToken.h:
(WebCore::HTMLToken::clear): We found that these `clear` calls cause performance problem according to the Instruments: we
repeatedly use this Vector, and we repeatedly allocate and deallocate this Vector unnecessarily. We use `resize(0)` instead
to avoid this allocation and deallocation.
(WebCore::HTMLToken::shrinkToBestFit): But HTMLToken is kept so long, so at some point, we would like to make backing storage
small. So, we add shrinkToBestFit and we call it only after finishing batching of HTMLToken processing.
(WebCore::HTMLToken::beginStartTag):
(WebCore::HTMLToken::beginEndTag):
* html/parser/HTMLTokenizer.h:
(WebCore::HTMLTokenizer::shrinkToBestFit):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::characterPredicate):
(WebCore::HTMLTreeBuilder::insertPhoneNumberLink):
(WebCore::HTMLTreeBuilder::linkifyPhoneNumbers):
(WebCore::HTMLTreeBuilder::processCharacterBuffer):
(WebCore::HTMLTreeBuilder::processCharacterBufferForInBody):
(WebCore::HTMLTreeBuilder::defaultForInTableText):
(WebCore::HTMLTreeBuilder::processTokenInForeignContent):
(WebCore::HTMLTreeBuilder::processFakeCharacters): Deleted. It is dead code before this patch.
* html/parser/HTMLTreeBuilder.h:
2021-07-22 Wenson Hsieh <wenson_hsieh@apple.com>
Rename EventHandler::m_textRecognitionHoverTimerFired()
https://bugs.webkit.org/show_bug.cgi?id=228183
rdar://78933684
Reviewed by Tim Horton.
When upstreaming support for Live Text in WebKit, I accidentally renamed the method
`imageExtractionTimerFired()` to `m_textRecognitionHoverTimerFired()`.
* page/EventHandler.cpp:
(WebCore::EventHandler::EventHandler):
(WebCore::EventHandler::textRecognitionHoverTimerFired):
(WebCore::EventHandler::m_textRecognitionHoverTimerFired): Deleted.
* page/EventHandler.h:
2021-07-22 Alex Christensen <achristensen@webkit.org>
XHR.send(Document) should replace mismatched surrogates with replacement character before sending
https://bugs.webkit.org/show_bug.cgi?id=228170
Reviewed by Chris Dumez.
This matches the behavior of Chrome and Firefox.
Covered by a newly passing WPT test.
* bindings/js/JSDOMConvertStrings.cpp:
(WebCore::identifierToUSVString):
(WebCore::valueToUSVString):
(WebCore::stringToUSVString): Deleted.
* bindings/js/JSDOMConvertStrings.h:
* css/parser/CSSTokenizer.cpp:
(WebCore::preprocessString):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::send):
2021-07-22 Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Compilation error with gcc version 9.3.0 (Buildroot 2020.08-14-ge5a2a90)
https://bugs.webkit.org/show_bug.cgi?id=228184
Reviewed by Chris Dumez.
Turn destructors into virtual ones for RTCRtpReceiver and RTCRtpSender.
It seems that gcc doesn't create a virtual table for these classes, while clang does. That
would the cause, when compiling clang, ImplementationLacksVTable is not needed in the IDL
file. The approach for this fix to force the virtual table creation by turning destructors
into virtual.
No new tests needed.
* Modules/mediastream/RTCRtpReceiver.h:
* Modules/mediastream/RTCRtpSender.h:
2021-07-22 Megan Gardner <megan_gardner@apple.com>
Avoid Quick Note overlay when scrolling to show a highlight
https://bugs.webkit.org/show_bug.cgi?id=228172
Reviewed by Wenson Hsieh and Tim Horton.
When scrolling to show the selected highlight after clicking on one in the QuickNote overlay,
make sure to avoid the Quick Note overlay, so that the user can actually see the highlight.
This required calculating more information about the selection rect for iOS, and also piping through
information to have the selection rect be the entire rect, rather that just the caret and the end of selection.
* Modules/highlight/AppHighlightStorage.cpp:
(WebCore::AppHighlightStorage::attemptToRestoreHighlightAndScroll):
* editing/Editor.cpp:
(WebCore::TemporarySelectionChange::setSelection):
* editing/Editor.h:
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::setSelection):
(WebCore::FrameSelection::updateAndRevealSelection):
(WebCore::FrameSelection::selectionBounds const):
* editing/FrameSelection.h:
2021-07-22 Sihui Liu <sihui_liu@apple.com>
[macOS Debug] Layout Test imported/w3c/web-platform-tests/IndexedDB/open-request-queue.html is a flaky timeout.
https://bugs.webkit.org/show_bug.cgi?id=172044
Reviewed by Chris Dumez.
We used to start handling delete request when there is still open request in flight. We should start a request
after previous requests are done, to match spec (https://www.w3.org/TR/IndexedDB/#delete-a-database) and other
browsers' behavior.
Updated and rebaselined existing tests.
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::handleDatabaseOperations):
(WebCore::IDBServer::UniqueIDBDatabase::startVersionChangeTransaction):
2021-07-22 Alan Bujtas <zalan@apple.com>
REGRESSION(r269745) Google Developers maps does not fully load
https://bugs.webkit.org/show_bug.cgi?id=228182
<rdar://79787819>
Reviewed by Antti Koivisto.
IFC integration does not support cases when the inline level element stretches as the containing block size changes.
This should include both percent and calc width/height values.
Test: fast/inline/incorrect-sizing-with-calc.html
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForChild):
2021-07-22 Frédéric Wang <fwang@igalia.com>
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 <summary> 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<TreeType>(a, b) function that
can be used for TreeType = ShadowIncludingTree as well as by WebCore::documentOrder.
* dom/Node.cpp: Explicitly instantiate commonInclusiveAncestor<ShadowIncludingTree> 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<ComposedTree>.
* dom/Position.h: Delcare new template.
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::updateStartEnd): Use treeOrder<ShadowIncludingTree>.
(WebCore::ApplyStyleCommand::removeInlineStyle): Ditto.
* editing/VisiblePosition.cpp:
(WebCore::documentOrder): Use treeOrder<ShadowIncludingTree>.
* editing/VisibleSelection.cpp:
(WebCore::VisibleSelection::setBaseAndExtentToDeepEquivalents): Use treeOrder<ShadowIncludingTree>.
(WebCore::VisibleSelection::setWithoutValidation): Ditto.
2021-07-22 Martin Robinson <mrobinson@webkit.org>
[css-scroll-snap] Pass the full target point when selecting a snap offset
https://bugs.webkit.org/show_bug.cgi?id=228023
Reviewed by Frédéric Wang.
Pass the full proposed destination scroll offset when calling closestSnapOffset. For
now, only the component in the scroll direction is used, but eventually the other
component will be used to avoid snapping to snap areas that are entirely off the screen.
No new tests. This change is simply a refactor in preparation for a behavior
change and shouldn't change behavior itself.
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::closestSnapOffsetWithInfoAndAxis):
(WebCore::LayoutScrollSnapOffsetsInfo::closestSnapOffset const):
(WebCore::FloatScrollSnapOffsetsInfo::closestSnapOffset const):
* page/scrolling/ScrollSnapOffsetsInfo.h:
* page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.cpp:
(WebCore::ScrollingTreeScrollingNodeDelegateNicosia::handleWheelEvent):
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::scroll):
(WebCore::ScrollAnimator::adjustScrollOffsetForSnappingIfNeeded):
* platform/ScrollAnimator.h:
* platform/ScrollController.cpp:
(WebCore::ScrollController::setNearestScrollSnapIndexForAxisAndOffset):
(WebCore::ScrollController::adjustScrollDestination):
(WebCore::ScrollController::updateActiveScrollSnapIndexForClientOffset):
(WebCore::ScrollController::resnapAfterLayout):
* platform/ScrollController.h:
* platform/ScrollSnapAnimatorState.cpp:
(WebCore::ScrollSnapAnimatorState::setupAnimationForState):
(WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset const):
* platform/ScrollSnapAnimatorState.h:
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::doPostThumbMoveSnapping):
2021-07-21 Alex Christensen <achristensen@webkit.org>
Add linkedOnOrAfter check for r269162
https://bugs.webkit.org/show_bug.cgi?id=228154
<rdar://78575888>
Reviewed by Geoffrey Garen.
That revision broke some programs, but only on macOS.
On iOS, we needed SecKeyProxy and WKNavigationDelegate to get client certificates to send.
Add a linkedOnOrAfter check until they update to use WKNavigationDelegate instead of default keychain behavior.
* platform/cocoa/VersionChecks.h:
2021-07-21 Miguel Gomez <magomez@igalia.com>
[GTK][WPE] Allow the user to configure the MemoryPressureHandler inside the web process
https://bugs.webkit.org/show_bug.cgi?id=222738
Reviewed by Carlos Garcia Campos.
MemoryPressureHandler::currentMemoryUsagePolicy() is now an instance method and not a class one,
so update the call in RenderLayerCompositor to use the singleton instance.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateCompositingPolicy):
2021-07-21 Chris Dumez <cdumez@apple.com>
Unreviewed, reverting r280129.
Broke the internal Monterey build bots
Reverted changeset:
"GetIdentifierStringForPreferredVoiceInListWithLocale() is
deprecated in Monterey"
https://bugs.webkit.org/show_bug.cgi?id=228066
https://commits.webkit.org/r280129
2021-07-01 Sergio Villar Senin <svillar@igalia.com>
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-21 David Kilzer <ddkilzer@apple.com>
GetIdentifierStringForPreferredVoiceInListWithLocale() is deprecated in Monterey
<https://webkit.org/b/228066>
<rdar://problem/80577312>
Reviewed by Alexey Proskuryakov.
* platform/mac/PlatformSpeechSynthesizerMac.mm:
(WebCore::speechSynthesisGetDefaultVoiceIdentifierForLocale):
- Switch to use
CopyIdentifierStringForPreferredVoiceInListWithLocale()
in Monterey.
- Change to return RetainPtr<> to handle lifetime of
object returned from new function.
(WebCore::PlatformSpeechSynthesizer::initializeVoiceList):
- Change varible type to 'auto' since return type of
speechSynthesisGetDefaultVoiceIdentifierForLocale()
changed.
2021-07-20 Myles C. Maxfield <mmaxfield@apple.com>
r280103 is not necessary on all operating systems
https://bugs.webkit.org/show_bug.cgi?id=228136
Reviewed by Alan Bujtas.
r280103 is not necessary on all operating systems.
No new tests because there is no behavior change.
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::applyFontTransforms):
2021-07-20 Said Abou-Hallawa <said@apple.com>
Make the 'targetElement' argument of the SVG animators to be a reference
https://bugs.webkit.org/show_bug.cgi?id=228132
Reviewed by Simon Fraser.
It is clear that many SVG animators functions assume the argument
'targetElement' is not nullptr. Also the caller SVGAnimateElementBase
makes sure its targetElement() is not nullptr before calling any of its
animator's functions.
* svg/SVGAnimateElementBase.cpp:
(WebCore::SVGAnimateElementBase::setTargetElement):
(WebCore::SVGAnimateElementBase::calculateFromAndToValues):
(WebCore::SVGAnimateElementBase::calculateFromAndByValues):
(WebCore::SVGAnimateElementBase::startAnimation):
(WebCore::SVGAnimateElementBase::calculateAnimatedValue):
(WebCore::SVGAnimateElementBase::applyResultsToTarget):
(WebCore::SVGAnimateElementBase::stopAnimation):
(WebCore::SVGAnimateElementBase::calculateDistance):
* svg/SVGElement.cpp:
(WebCore::SVGElement::commitPropertyChange):
* svg/properties/SVGAnimatedPropertyAnimator.h:
* svg/properties/SVGAnimatedPropertyAnimatorImpl.h:
* svg/properties/SVGAnimatedPropertyPairAnimator.h:
* svg/properties/SVGAnimatedPropertyPairAnimatorImpl.h:
* svg/properties/SVGAnimationAdditiveFunction.h:
* svg/properties/SVGAnimationAdditiveListFunctionImpl.h:
(WebCore::SVGAnimationLengthListFunction::animate):
(WebCore::SVGAnimationNumberListFunction::animate):
(WebCore::SVGAnimationPointListFunction::animate):
(WebCore::SVGAnimationTransformListFunction::animate):
* svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp:
(WebCore::SVGAnimationColorFunction::colorFromString):
(WebCore::SVGAnimationIntegerFunction::calculateDistance const):
* svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
(WebCore::SVGAnimationAngleFunction::animate):
(WebCore::SVGAnimationColorFunction::animate):
(WebCore::SVGAnimationLengthFunction::animate):
(WebCore::SVGAnimationNumberFunction::animate):
(WebCore::SVGAnimationPathSegListFunction::animate):
(WebCore::SVGAnimationRectFunction::animate):
* svg/properties/SVGAnimationDiscreteFunction.h:
(WebCore::SVGAnimationDiscreteFunction::animate):
* svg/properties/SVGAnimationDiscreteFunctionImpl.h:
* svg/properties/SVGAnimationFunction.h:
(WebCore::SVGAnimationFunction::calculateDistance const):
(WebCore::SVGAnimationFunction::addFromAndToValues):
* svg/properties/SVGAttributeAnimator.cpp:
(WebCore::SVGAttributeAnimator::isAnimatedStylePropertyAniamtor const):
(WebCore::SVGAttributeAnimator::invalidateStyle):
(WebCore::SVGAttributeAnimator::applyAnimatedStylePropertyChange):
(WebCore::SVGAttributeAnimator::removeAnimatedStyleProperty):
(WebCore::SVGAttributeAnimator::applyAnimatedPropertyChange):
* svg/properties/SVGAttributeAnimator.h:
(WebCore::SVGAttributeAnimator::setFromAndToValues):
(WebCore::SVGAttributeAnimator::setFromAndByValues):
(WebCore::SVGAttributeAnimator::calculateDistance const):
* svg/properties/SVGPrimitivePropertyAnimator.h:
* svg/properties/SVGPropertyAnimator.h:
(WebCore::SVGPropertyAnimator::adjustForInheritance const):
(WebCore::SVGPropertyAnimator::computeInheritedCSSPropertyValue const):
* svg/properties/SVGPropertyOwnerRegistry.h:
* svg/properties/SVGPropertyRegistry.h:
Fix a typo in the name of setAnimatedPropertyDirty().
* svg/properties/SVGValuePropertyAnimator.h:
* svg/properties/SVGValuePropertyAnimatorImpl.h:
* svg/properties/SVGValuePropertyListAnimator.h:
* svg/properties/SVGValuePropertyListAnimatorImpl.h:
2021-07-20 Alan Bujtas <zalan@apple.com>
Revert r272370: It delays first paint
https://bugs.webkit.org/show_bug.cgi?id=228121
<rdar://75362363>
Reviewed by Antti Koivisto.
r272370 breaks the cases when the rendering update is initiated when the layer tree is still frozen (circular dependency: visually empty check vs. rendering update)
* dom/Document.cpp:
(WebCore::Document::didInsertInDocumentShadowRoot):
* dom/Element.cpp:
(WebCore::Element::isVisibleWithoutResolvingFullStyle const):
* style/StyleScope.cpp:
(WebCore::Style::Scope::Scope):
(WebCore::Style::Scope::flushPendingSelfUpdate):
(WebCore::Style::Scope::clearPendingUpdate):
(WebCore::Style::Scope::scheduleUpdate):
(WebCore::Style::Scope::pendingUpdateTimerFired):
(WebCore::Style::Scope::insertedInDocument): Deleted.
* style/StyleScope.h:
2021-07-20 Myles C. Maxfield <mmaxfield@apple.com>
REGRESSION(r272379): Characters with no fonts that support them are drawn as two .notdef glyphs in the fast text codepath
https://bugs.webkit.org/show_bug.cgi?id=228097
<rdar://problem/80798113>
Reviewed by Alan Bujtas.
If a character is not in BMP, and we don't have a glyph for it,
we'll end up with two 0 glyphs in a row for the two surrogates of the character.
We need to make sure that, after shaping, these double-0-glyphs aren't preserved.
Test: fast/text/double-notdef-simple-text-codepath.html
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::applyFontTransforms):
2021-07-20 Myles C. Maxfield <mmaxfield@apple.com>
Use references instead of pointers in WidthIterator::advanceInternal()
https://bugs.webkit.org/show_bug.cgi?id=228099
Reviewed by Fujii Hironori.
We assert that font is non-null, so we should be able to use a reference for it instead of a pointer.
No new tests because there is no behavior change.
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advanceInternal):
2021-07-20 Fujii Hironori <Hironori.Fujii@sony.com>
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 Tim Horton <timothy_horton@apple.com>
REGRESSION (r278062): Misplaced text in Wikipedia search field
https://bugs.webkit.org/show_bug.cgi?id=228098
<rdar://problem/80495165>
Reviewed by Simon Fraser.
New test: GraphicsContextTests.DrawNativeImageDoesNotLeakCompositeOperator
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::setCGCompositeOperator):
(WebCore::GraphicsContextCG::drawNativeImage):
drawNativeImage uses CGContextStateSaver (not GraphicsContextStateSaver),
so any state changes it made must only be made to the CGContext, not
the WebCore::GraphicsContext.
However, r278062 mistakenly swapped setPlatformCompositeOperation out for
GraphicsContext::setCompositeOperation(), which mutates the state of
*both* contexts, and then (only sometimes!) depends on the state saver
to reset the state (but, of course, as mentioned, it only resets
the CGContext's state).
(WebCore::GraphicsContextCG::updateState):
2021-07-20 Said Abou-Hallawa <said@apple.com>
Make SVGPropertyAnimator::computeCSSPropertyValue() take a reference to SVGElement
https://bugs.webkit.org/show_bug.cgi?id=228093
<rdar://80789262>
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-20 Chris Dumez <cdumez@apple.com>
REGRESSION (r278702): Cannot login to appaloosa-store.com/users/sign_in
https://bugs.webkit.org/show_bug.cgi?id=228096
<rdar://80596391>
Reviewed by Alex Christensen.
r278702 added an optimization to FetchBodyConsumer::takeAsBlob() to avoid a copy of the data.
What I didn't realized when I wrote this optimization is that FetchBodyConsumer is copy-constructible
and its copy constructor gets called when calling FetchResponse.clone(). The copy constructor only
does a shallow-copy of its internal buffer so several FetchResponse objects can end up with their
FetchBodyConsumer using the same underlying SharedBuffer object. When that SharedBuffer is shared,
calling takeData() on it is unacceptable as it will disturb the body of other Fetch responses.
To address the issue, we now only call SharedBuffer::takeData() and avoid the copy when the
SharedBuffer has a RefCount of 1, meaning that is it not actually shared. In the cases where it
is shared, we copy the data, like we used to do before r278702.
Test: http/tests/fetch/response-clone-blob.html
* Modules/fetch/FetchBodyConsumer.cpp:
(WebCore::FetchBodyConsumer::takeAsBlob):
2021-07-20 Chris Lord <clord@igalia.com>
Canvas and OffscreenCanvas getContext should check if argument is an object before trying to convert it to a dictionary
https://bugs.webkit.org/show_bug.cgi?id=227792
Reviewed by Sam Weinig.
Check if options argument is an object before converting to a dictionary.
Tests: imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.html
imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.worker.html
imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.html
imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.html
imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.html
imported/w3c/web-platform-tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.html
imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d-getcontext-options.html
imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.cache.html
imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/2d.getcontext.extraargs.create.html
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getContext):
* html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::getContext):
2021-07-20 Alex Christensen <achristensen@webkit.org>
Protect m_data when iterating in CachedRawResource::didAddClient
https://bugs.webkit.org/show_bug.cgi?id=228108
<rdar://80716674>
Reviewed by Chris Dumez.
I think something is destroying m_data when its segments are being iterated.
Protect it so it doesn't get destroyed.
Also, to be on the safe side, check that the client is still a client before using it.
* loader/cache/CachedRawResource.cpp:
(WebCore::CachedRawResource::didAddClient):
2021-07-20 Sam Sneddon <gsnedders@apple.com>
Change referrer-policy default to strict-origin-when-cross-origin
https://bugs.webkit.org/show_bug.cgi?id=218909
Reviewed by Chris Dumez.
This matches the behavior of other browsers.
Covered by existing tests and web platform tests we haven't imported yet.
* dom/Document.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::effectiveReferrerPolicy const):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
* platform/ReferrerPolicy.cpp:
(WebCore::parseReferrerPolicyToken):
* platform/ReferrerPolicy.h:
2021-07-20 Philippe Normand <pnormand@igalia.com>
[GStreamer] Switch raw GstStructure pointers to GUniquePtr
https://bugs.webkit.org/show_bug.cgi?id=228106
Reviewed by Xabier Rodriguez-Calvar.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::setAudioStreamProperties):
(WebCore::MediaPlayerPrivateGStreamer::mediaLocationChanged):
(WebCore::MediaPlayerPrivateGStreamer::loadNextLocation):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2021-07-20 Ziran Sun <zsun@igalia.com>
Images as grid items should use the overridingLogicalWidth when defined to compute the logical Height
https://bugs.webkit.org/show_bug.cgi?id=228022
Reviewed by Javier Fernandez.
When computing the logical height using an intrinsic aspect ratio, RenderReplaced should use the
overridingLogicalWidth whenever defined just as how it does for flex items. This change is to
replace the use of intrinsic (non-stretched) logical width in current code with the overridingLogicalWidth.
The current code doesn't set overringLogicalWidth while the width changes while stretches along Row Axis.
This change adds the logic in.
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeReplacedLogicalHeight const):
2021-07-20 Rob Buis <rbuis@igalia.com>
Fix grid aspect-ratio tests
https://bugs.webkit.org/show_bug.cgi?id=225860
Reviewed by Javier Fernandez.
Fix various combinations of implicit/explicit stretching in inline and
block directions as tested by grid-aspect-ratio-028.html until
grid-aspect-ratio-038.html and as specified [1, 2].
Also treat explicit stretching through justify-items/align-items: stretch
like justify-self/align-self: stretch.
[1] https://drafts.csswg.org/css-grid/#grid-item-sizing
[2] //drafts.csswg.org/css-sizing-4/#aspect-ratio
* rendering/RenderBox.cpp:
(WebCore::RenderBox::hasStretchedLogicalWidth const):
(WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatio const):
* rendering/RenderBox.h:
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::selfAlignmentForChild const):
(WebCore::RenderGrid::alignSelfForChild const):
(WebCore::RenderGrid::justifySelfForChild const):
(WebCore::RenderGrid::aspectRatioPrefersInline):
(WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
(WebCore::RenderGrid::hasAutoSizeInColumnAxis const):
(WebCore::RenderGrid::hasAutoSizeInRowAxis const):
* rendering/RenderGrid.h:
2021-07-19 Sihui Liu <sihui_liu@apple.com>
Implement IDBTransaction.commit()
https://bugs.webkit.org/show_bug.cgi?id=227815
<rdar://problem/80651270>
Reviewed by Brady Eidson.
Spec: https://www.w3.org/TR/IndexedDB/#dom-idbtransaction-commit
Commit request for IDBTransaction is created automatically after all its requests are completed and success
events of those requests are fired. IDBTransaction.commit() lets client create commit request, without waiting
for the result of requests, so the commit can happen sooner.
In our implementation, if pending requests before the commit request are completed successfully, commit request
will be executed directly in the backend and dose not affect by things happening in request event handler. If
some pending request before the commit request has error, the commit request will be treated as abort request,
as commit() means no client operation, including error handling, should happen after it.
Rebaselined existing tests.
* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::didStartTransaction):
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::dispatchEvent):
(WebCore::IDBRequest::willAbortTransactionAfterDispatchingEvent const):
* Modules/indexeddb/IDBRequest.h:
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::abortDueToFailedRequest):
(WebCore::IDBTransaction::abort):
(WebCore::IDBTransaction::abortInternal):
(WebCore::IDBTransaction::stop):
(WebCore::IDBTransaction::handleOperationsCompletedOnServer):
(WebCore::IDBTransaction::commit): If commit() is called in event handler for error event, and the error is
handled before the call, we will create a commit requet. Otherwise, it is ignored as transaction will abort
due to the error.
(WebCore::IDBTransaction::commitInternal):
(WebCore::IDBTransaction::commitOnServer):
(WebCore::IDBTransaction::didCommit): didCommit used to be called after all requests are done and events are
fired. As commit request can now be handled and replied before other requests, we need to make sure complete
event of transaction is fired after success event of requests, by tracking completion of the last request before
commit request.
(WebCore::IDBTransaction::operationCompletedOnClient):
(WebCore::IDBTransaction::autoCommit):
(WebCore::IDBTransaction::internalAbort): Deleted.
* Modules/indexeddb/IDBTransaction.h:
* Modules/indexeddb/IDBTransaction.idl:
* Modules/indexeddb/client/IDBConnectionProxy.cpp:
(WebCore::IDBClient::IDBConnectionProxy::commitTransaction):
* Modules/indexeddb/client/IDBConnectionProxy.h:
* Modules/indexeddb/client/IDBConnectionToServer.cpp:
(WebCore::IDBClient::IDBConnectionToServer::commitTransaction):
* Modules/indexeddb/client/IDBConnectionToServer.h:
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::commitTransaction):
* Modules/indexeddb/server/IDBServer.h:
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
(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):
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
* loader/EmptyClients.cpp:
2021-07-19 Tim Nguyen <ntim@apple.com>
Port <dialog> close event to modern event handling code
https://bugs.webkit.org/show_bug.cgi?id=227915
Reviewed by Chris Dumez.
* html/HTMLDialogElement.cpp:
(WebCore::HTMLDialogElement::close):
(WebCore::dialogCloseEventSender): Deleted.
(WebCore::HTMLDialogElement::~HTMLDialogElement): Deleted.
(WebCore::HTMLDialogElement::dispatchPendingEvent): Deleted.
* html/HTMLDialogElement.h:
2021-07-19 Chris Dumez <cdumez@apple.com>
HTMLImageElement.decoding should reflect the decoding content attribute, limited to only known values
https://bugs.webkit.org/show_bug.cgi?id=228081
Reviewed by Alex Christensen.
HTMLImageElement.decoding should reflect the decoding content attribute, limited to only known values.
We were missing the *limited to only known values* logic:
- https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-decoding
This aligns our behavior with Firefox and Chrome.
No new tests, rebaselined existing test.
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::setDecoding):
(WebCore::HTMLImageElement::decoding const):
* html/HTMLImageElement.h:
* html/HTMLImageElement.idl:
2021-07-19 Chris Dumez <cdumez@apple.com>
FetchResponse.formData() should not reject promise if the body is null and the MIME Type is "application/x-www-form-urlencoded"
https://bugs.webkit.org/show_bug.cgi?id=228085
Reviewed by Alex Christensen.
FetchResponse.formData() should not reject promise if the body is null and the MIME Type is "application/x-www-form-urlencoded":
- https://fetch.spec.whatwg.org/#concept-body-consume-body
- https://fetch.spec.whatwg.org/#concept-body-package-data
As per the specification, we should package an empty byte sequence in this case and resolve the promise with that.
No new tests, rebaselined existing tests.
* Modules/fetch/FetchBodyConsumer.cpp:
(WebCore::FetchBodyConsumer::packageFormData):
(WebCore::resolveWithTypeAndData):
(WebCore::packageFormData): Deleted.
* Modules/fetch/FetchBodyConsumer.h:
* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::formData):
2021-07-19 Ziran Sun <zsun@igalia.com>
[css-grid] Images as grid items should use the overridingLogicalHeight when defined to compute the logical width
https://bugs.webkit.org/show_bug.cgi?id=227984
Reviewed by Javier Fernandez.
As discussed in https://github.com/w3c/csswg-drafts/issues/5713, for images as grid items, when
stretch alignment is only applied in one axis we should respect aspect-ratio on the other.
When computing the logical width using an intrinsic aspect ratio, RenderReplaced should use the
overridingLogicalHeight whenever defined just as how it does for flex items. This change is to
replace the use of intrinsic (non-stretched) logical height in current code with the overridingLogicalHeight.
This allows us to pass an additional of 9 grid WPT tests.
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeReplacedLogicalWidth const):
2021-07-19 Ziran Sun <zsun@igalia.com>
[css-grid] Use correct block-size to resolve min-content
https://bugs.webkit.org/show_bug.cgi?id=227167
Reviewed by Javier Fernandez.
When the min/max depends on block-size, We need to make sure that min/max widths are set dirty for
replaced element when block-size changes so that the correct block-size is used to get min/max widths.
Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-item-inline-contribution-001.html
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::layout):
2021-07-19 Ziran Sun <zsun@igalia.com>
[CSS-grid] Ignore the aspect-ratio of a replaced element if stretch alignments are applied to both axes
https://bugs.webkit.org/show_bug.cgi?id=227573
Reviewed by Javier Fernandez.
As discussed in https://github.com/w3c/csswg-drafts/issues/5713, for the replaced element as a grid item,
when both axes have stretch alignments applied and there is no auto margin(s) presented, the aspect ratio
should be ignored if there is any.
Part of this patch is an import of Chromium CL at
https://chromium-review.googlesource.com/c/chromium/src/+/2651651
* rendering/RenderBox.cpp:
(WebCore::RenderBox::hasStretchedLogicalHeight const):
(WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatio const):
* rendering/RenderBox.h:
2021-07-18 Sam Weinig <weinig@apple.com>
Fix canvas overflow checking to use CheckedArithmatic rather than adhoc floating point mechanism
https://bugs.webkit.org/show_bug.cgi?id=228058
Reviewed by Dean Jackson.
We have CheckedArithmatic just for this case. Use it.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::shouldAccelerate const):
(WebCore::HTMLCanvasElement::createImageBuffer const):
* html/HTMLCanvasElement.h:
2021-07-18 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] [AX] Keyboard text candidates don't update when changing selection using Switch Control
https://bugs.webkit.org/show_bug.cgi?id=228051
rdar://79944295
Reviewed by Tim Horton.
See WebKit ChangeLog for more details.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::setSelectedTextRange):
(WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange const):
Call the new EditorClient methods added below. Additionally, drive-by fix `setSelectedVisiblePositionRange` so
that it also performs a user-triggered selection change in the case where the range is not collapsed; this
matches the behavior of `setSelectedTextRange` as well.
* page/EditorClient.h:
(WebCore::EditorClient::willChangeSelectionForAccessibility):
(WebCore::EditorClient::didChangeSelectionForAccessibility):
Add new EditorClient hooks, `(will|did)ChangeSelectionForAccessibility`, that accessibility code can call before
and after it triggers a selection change; we use these two codepaths above when using the "Previous/Next
Character", "Previous/Next Word", and "Previous/Next Line" Switch Control menu actions.
2021-07-17 Alan Bujtas <zalan@apple.com>
[LFC][IFC] Move InlineLevelBox class to its own file
https://bugs.webkit.org/show_bug.cgi?id=228045
Reviewed by Sam Weinig.
LineBox class has grown a lot since the subclass of InlineLevelBox has been introduced.
It is also in preparation for merging LineBox and LineBoxGeometry classes.
* WebCore.xcodeproj/project.pbxproj:
* layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::LineBoxBuilder::setVerticalGeometryForInlineBox const):
(WebCore::Layout::LineBoxBuilder::constructAndAlignInlineLevelBoxes):
(WebCore::Layout::LineBoxBuilder::computeLineBoxHeightAndAlignInlineLevelBoxesVertically):
(WebCore::Layout::LineBoxBuilder::SimplifiedVerticalAlignment::SimplifiedVerticalAlignment):
(WebCore::Layout::LineBoxBuilder::SimplifiedVerticalAlignment::canUseSimplifiedAlignment):
(WebCore::Layout::LineBoxBuilder::SimplifiedVerticalAlignment::align):
(WebCore::Layout::LineBoxBuilder::SimplifiedVerticalAlignment::adjust):
(WebCore::Layout::InlineFormattingGeometry::inlineLevelBoxAffectsLineBox const):
* layout/formattingContexts/inline/InlineFormattingGeometry.h:
* layout/formattingContexts/inline/InlineFormattingQuirks.cpp:
(WebCore::Layout::InlineFormattingQuirks::inlineLevelBoxAffectsLineBox const):
* layout/formattingContexts/inline/InlineFormattingQuirks.h:
* layout/formattingContexts/inline/InlineLevelBox.h: Added.
(WebCore::Layout::InlineLevelBox::baseline const):
(WebCore::Layout::InlineLevelBox::descent const):
(WebCore::Layout::InlineLevelBox::LayoutBounds::height const):
(WebCore::Layout::InlineLevelBox::LayoutBounds::operator== const):
(WebCore::Layout::InlineLevelBox::layoutBounds const):
(WebCore::Layout::InlineLevelBox::hasContent const):
(WebCore::Layout::InlineLevelBox::verticalAlign const):
(WebCore::Layout::InlineLevelBox::layoutBox const):
(WebCore::Layout::InlineLevelBox::style const):
(WebCore::Layout::InlineLevelBox::isInlineBox const):
(WebCore::Layout::InlineLevelBox::isRootInlineBox const):
(WebCore::Layout::InlineLevelBox::isAtomicInlineLevelBox const):
(WebCore::Layout::InlineLevelBox::isLineBreakBox const):
(WebCore::Layout::InlineLevelBox::type const):
(WebCore::Layout::InlineLevelBox::logicalRect const):
(WebCore::Layout::InlineLevelBox::logicalTop const):
(WebCore::Layout::InlineLevelBox::logicalBottom const):
(WebCore::Layout::InlineLevelBox::logicalLeft const):
(WebCore::Layout::InlineLevelBox::logicalWidth const):
(WebCore::Layout::InlineLevelBox::logicalHeight const):
(WebCore::Layout::InlineLevelBox::setLogicalWidth):
(WebCore::Layout::InlineLevelBox::setLogicalHeight):
(WebCore::Layout::InlineLevelBox::setLogicalTop):
(WebCore::Layout::InlineLevelBox::setBaseline):
(WebCore::Layout::InlineLevelBox::setDescent):
(WebCore::Layout::InlineLevelBox::setLayoutBounds):
(WebCore::Layout::InlineLevelBox::InlineLevelBox):
(WebCore::Layout::m_type):
(WebCore::Layout::InlineLevelBox::setHasContent):
(WebCore::Layout::InlineLevelBox::hasLineBoxRelativeAlignment const):
(WebCore::Layout::InlineLevelBox::createAtomicInlineLevelBox):
(WebCore::Layout::InlineLevelBox::createInlineBox):
(WebCore::Layout::InlineLevelBox::createLineBreakBox):
(WebCore::Layout::InlineLevelBox::createGenericInlineLevelBox):
* layout/formattingContexts/inline/InlineLineBox.cpp:
(WebCore::Layout::LineBox::InlineLevelBox::InlineLevelBox): Deleted.
(WebCore::Layout::m_type): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::setBaseline): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::setDescent): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::setLayoutBounds): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::setLogicalTop): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::setLogicalHeight): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::setHasContent): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::hasLineBoxRelativeAlignment const): Deleted.
* layout/formattingContexts/inline/InlineLineBox.h:
(WebCore::Layout::LineBox::InlineLevelBox::baseline const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::descent const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::LayoutBounds::height const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::LayoutBounds::operator== const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::layoutBounds const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::hasContent const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::verticalAlign const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::layoutBox const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::style const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::isInlineBox const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::isRootInlineBox const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::isAtomicInlineLevelBox const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::isLineBreakBox const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::type const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::logicalRect const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::logicalTop const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::logicalBottom const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::logicalLeft const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::logicalWidth const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::logicalHeight const): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::setLogicalWidth): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::createAtomicInlineLevelBox): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::createInlineBox): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::createLineBreakBox): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::createGenericInlineLevelBox): Deleted.
2021-07-16 Simon Fraser <simon.fraser@apple.com>
getBoundingClientRect() returns the incorrect rectangle on elements whose parent element is set -webkit-column-count
https://bugs.webkit.org/show_bug.cgi?id=99959
rdar://80106111
Reviewed by Alan Bujtas.
getBoundingClientRect() and getClientRects() for elements inside multicol had a quick
and dirty implementation that just mapped the element center point into a column. This
resulted in odd, negative top/left in some cases.
Fix by correctly generating multiple rects for elements that span columns, following
the repaint code path that already knew how to do this correctly.
The entry point is RenderFragmentContainer::absoluteQuadsForBox() which now has a
real implementation. For each fragment that the box covers, it calls fragmentRectsForFlowContentRect()
which generates one or more rects; RenderMultiColumnSet overrides this to
compute rects for multicol.
We have to take care not to eliminate empty rects, since the API does return these.
Tested by existing tests.
* dom/Element.cpp:
(WebCore::Element::absoluteEventBounds):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::absoluteQuadsIgnoringContinuation const):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::absoluteQuads const):
* rendering/RenderFragmentContainer.cpp:
(WebCore::RenderFragmentContainer::fragmentedFlowContentRectangle):
(WebCore::RenderFragmentContainer::fragmentRectsForFlowContentRect):
* rendering/RenderFragmentContainer.h:
(WebCore::RenderFragmentContainer::absoluteQuadsForBoxInFragment): Deleted.
* rendering/RenderFragmentedFlow.cpp:
(WebCore::RenderFragmentedFlow::absoluteQuadsForBox const):
* rendering/RenderFragmentedFlow.h:
* rendering/RenderMultiColumnFlow.h:
* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::firstAndLastColumnsFromOffsets const):
(WebCore::RenderMultiColumnSet::repaintFragmentedFlowContent):
(WebCore::RenderMultiColumnSet::fragmentRectsForFlowContentRect):
(WebCore::RenderMultiColumnSet::collectLayerFragments):
* rendering/RenderMultiColumnSet.h:
2021-07-16 Kate Cheney <katherine_cheney@apple.com>
WKWebView javascript injection doesn't work if app includes WKAppBoundDomains
https://bugs.webkit.org/show_bug.cgi?id=227589
<rdar://problem/80327452>
Reviewed by Brent Fulgham.
Update service worker code to always allow workers on localhost to be
registered. Also add logic so localhost registrations aren't added
to the total count of 3 registrations.
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::addRegistration):
We only want to increment the count if this registration is not
already in the mapping, otherwise it gets double counted.
(WebCore::SWServer::removeRegistration):
Ditto for removing a registration, we should only decrement the count
if we find a matching key.
(WebCore::SWServer::validateRegistrationDomain):
(WebCore::SWServer::removeFromScopeToRegistrationMap):
Ditto.
* workers/service/server/SWServer.h:
2021-07-16 Alex Christensen <achristensen@webkit.org>
Network access prevention SPI should prevent preconnecting, and it should first allow injected bundle to change request
https://bugs.webkit.org/show_bug.cgi?id=228044
<rdar://72995136>
Reviewed by Tim Horton.
WKWebViewConfiguration._loadsFromNetwork and its successor _allowedNetworkHosts have two issues:
1. They allow link rel=preconnect to still preconnect to a host. While this doesn't reveal much information, it does reveal some.
2. It blocks loads before giving the injected bundle a chance to change the scheme of the request. This SPI is relatively new and
intended to replace the injected bundle, but the user from this radar needs to have an injected bundle make changes first.
Both problems are fixed and covered by API tests.
* loader/ResourceLoadNotifier.cpp:
(WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
* page/Page.h:
2021-07-16 Myles C. Maxfield <mmaxfield@apple.com>
Fix Apple internal build
Unreviewed.
No new tests because there is no behavior change.
* platform/mac/PlatformSpeechSynthesizerMac.mm:
(WebCore::speechSynthesisGetDefaultVoiceIdentifierForLocale):
2021-07-16 Brady Eidson <beidson@apple.com>
FetchBodySource/FetchBodyOwner cleanup
<rdar://80318044> 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-16 Alan Bujtas <zalan@apple.com>
[RenderTreeBuilder] Update the fragmented status of the renderer when it becomes in-flow
https://bugs.webkit.org/show_bug.cgi?id=228025
<rdar://80458138>
Reviewed by Antti Koivisto.
This patch ensures that we update fragmented status of the renderer when it becomes in-flow and not just when the containing block's childrenInline status needs updating.
(e.g. the block renderer goes from out-of-flow to in-flow, and the containing block already has block level children, we don't call childFlowStateChangesAndAffectsParentBlock)
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::normalizeTreeAfterStyleChange): Move the update logic out from childFlowStateChangesAndAffectsParentBlock to here and run it unconditionally.
(WebCore::RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock):
2021-07-16 Fujii Hironori <Hironori.Fujii@sony.com>
[curl] Use curl_multi_poll and curl_multi_wakeup instead of select
https://bugs.webkit.org/show_bug.cgi?id=227966
Reviewed by Don Olmstead.
libcurl 7.68.0 added curl_multi_poll and curl_multi_wakeup.
* platform/network/curl/CurlContext.cpp:
(WebCore::CurlMultiHandle::poll): Added.
(WebCore::CurlMultiHandle::wakeUp): Added.
* platform/network/curl/CurlContext.h:
* platform/network/curl/CurlRequestScheduler.cpp:
(WebCore::CurlRequestScheduler::add):
(WebCore::CurlRequestScheduler::callOnWorkerThread):
(WebCore::CurlRequestScheduler::startOrWakeUpThread):
(WebCore::CurlRequestScheduler::wakeUpThreadIfPossible): Added.
(WebCore::CurlRequestScheduler::stopThread):
(WebCore::CurlRequestScheduler::workerThread):
(WebCore::CurlRequestScheduler::startThreadIfNeeded): Deleted.
* platform/network/curl/CurlRequestScheduler.h:
2021-07-16 Myles C. Maxfield <mmaxfield@apple.com>
Make the lack of an ANGLE dylib unconditionally log
https://bugs.webkit.org/show_bug.cgi?id=228010
Reviewed by Dean Jackson.
WebCore should complain louder when all of WebGL is disabled because of a packaging misconfiguration.
No new tests because there is no behavior change.
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::create):
2021-07-16 Megan Gardner <megan_gardner@apple.com>
Pipe App Highlight scrolling through UI Process in preparation for Note Overlay avoidance.
https://bugs.webkit.org/show_bug.cgi?id=227914
Reviewed by Tim Horton.
In order to correctly avoid the note overlay that can potentially obscure the web view,
we need to pipe the scrolling through the UI process. This patch does that work
and will be followed up shortly by one that does the actual work of overlay avoidance.
For iOS, this just uses the main frame UI Scrolling that we already use, but for
mac, we need to do the last scroll in the web process after adjusting it with the overlay
information.
* Modules/highlight/AppHighlightStorage.cpp:
(WebCore::AppHighlightStorage::attemptToRestoreHighlightAndScroll):
* dom/Element.cpp:
(WebCore::Element::scrollIntoView):
* editing/Editor.cpp:
(WebCore::TemporarySelectionChange::setSelection):
* editing/Editor.h:
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::moveWithoutValidationTo):
(WebCore::FrameSelection::setSelection):
(WebCore::FrameSelection::updateAndRevealSelection):
(WebCore::FrameSelection::revealSelection):
* editing/FrameSelection.h:
* loader/EmptyClients.h:
* page/Chrome.cpp:
(WebCore::Chrome::scrollMainFrameToRevealRect const):
(WebCore::Chrome::scrollRectIntoView const): Deleted.
* page/Chrome.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::scrollMainFrameToRevealRect const):
(WebCore::ChromeClient::scrollRectIntoView const): Deleted.
* page/ScrollBehavior.cpp:
(WebCore::useSmoothScrolling):
* page/ScrollBehavior.h:
* platform/ScrollTypes.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):
* rendering/RenderLayer.h:
2021-07-16 Alexander Mikhaylenko <alexm@gnome.org>
[GTK][WPE] Support color-schemes CSS property
https://bugs.webkit.org/show_bug.cgi?id=208204
Reviewed by Adrian Perez de Castro.
Last time we tried enabling dark mode, we broke many webpages since we couldn't have diferent
controls, and more importantly, different system colors and defaults for pages that do and
don't support dark mode.
Now that we don't use GTK for this, we can try again. This time, use hardcoded system colors
and return different colors depending on StyleColor::Options::UseDarkAppearance.
To avoid dark-on-dark text on entries, we also need to enable HAVE_OS_DARK_MODE_SUPPORT for GTK
and make sure it's passed to use agent CSS. And since Adwaita controls are also used in WPE, we
need to enable it for WPE as well, and since WPE didn't have ENABLE_DARK_MODE_CSS, flip that as
well, all in lockstep.
No new tests, reenabled the existing css-dark-mode tests.
* PlatformGTK.cmake:
* PlatformWPE.cmake:
Pass HAVE_OS_DARK_MODE_SUPPORT to user agent CSS.
* css/CSSValueKeywords.in:
Expose -webkit-control-background for anything with HAVE_OS_DARK_MODE_SUPPORT.
* css/themeAdwaita.css:
(input[type="search"]::-webkit-search-results-button,):
(input[type="search"]::-webkit-search-cancel-button):
(body[dir="rtl"] input[type="search"]::-webkit-search-cancel-button):
(input[type="search"]::-webkit-search-results-button:hover,):
(input[type="search"]::-webkit-search-cancel-button:hover): Deleted.
Use mask images instead of content so we can recolor them. Change
color on hover as opacity and inherit entry's color otherwise to
make sure it's legible with dark appearance.
* page/FrameView.cpp:
(WebCore::FrameView::updateBackgroundRecursively):
Use CSSValueWindow for background instead of CSSValueAppleSystemControlBackground
when the latter is not available.
* platform/adwaita/ThemeAdwaita.cpp:
(WebCore::ThemeAdwaita::focusColor):
(WebCore::ThemeAdwaita::paintFocus):
(WebCore::ThemeAdwaita::paintArrow):
(WebCore::ThemeAdwaita::paint):
(WebCore::ThemeAdwaita::paintCheckbox):
(WebCore::ThemeAdwaita::paintRadio):
(WebCore::ThemeAdwaita::paintButton):
(WebCore::ThemeAdwaita::paintSpinButton):
* platform/adwaita/ThemeAdwaita.h:
* rendering/RenderThemeAdwaita.cpp:
(WebCore::RenderThemeAdwaita::platformFocusRingColor const):
(WebCore::RenderThemeAdwaita::systemColor const):
(WebCore::RenderThemeAdwaita::paintTextField):
(WebCore::RenderThemeAdwaita::adjustTextFieldStyle const):
(WebCore::RenderThemeAdwaita::adjustTextAreaStyle const):
(WebCore::RenderThemeAdwaita::adjustSearchFieldStyle const):
Add a border radius to the default style, so the background doesn't bleed through
the corners.
(WebCore::RenderThemeAdwaita::paintMenuList):
(WebCore::RenderThemeAdwaita::paintProgressBar):
(WebCore::RenderThemeAdwaita::paintSliderTrack):
(WebCore::RenderThemeAdwaita::paintSliderThumb):
* rendering/RenderThemeAdwaita.h:
2021-07-16 Philippe Normand <pnormand@igalia.com>
[GStreamer] RealtimeMediaSourceCenter and VideoEncoder are not libwebrtc-specific
https://bugs.webkit.org/show_bug.cgi?id=228020
Reviewed by Xabier Rodriguez-Calvar.
Those two are actually not using libwebrtc-related code, so a better place for them is
platform/mediastream/gstreamer.
* platform/GStreamer.cmake:
* platform/mediastream/gstreamer/GStreamerVideoEncoder.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoder.cpp.
(Encoders::singleton):
(Encoders::registerEncoder):
(Encoders::definition):
(webrtcVideoEncoderGetProperty):
(webrtcVideoEncoderSetBitrate):
(webrtcVideoEncoderSetEncoder):
(webrtcVideoEncoderSetFormat):
(webrtcVideoEncoderSetProperty):
(setBitrateKbitPerSec):
(setBitrateBitPerSec):
(webrtcVideoEncoderConstructed):
(webkit_webrtc_video_encoder_class_init):
* platform/mediastream/gstreamer/GStreamerVideoEncoder.h: Renamed from Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoder.h.
* platform/mediastream/gstreamer/RealtimeMediaSourceCenterGStreamer.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp.
(WebCore::RealtimeMediaSourceCenter::defaultAudioCaptureFactory):
(WebCore::RealtimeMediaSourceCenter::defaultVideoCaptureFactory):
(WebCore::RealtimeMediaSourceCenter::defaultDisplayCaptureFactory):
2021-07-16 Philippe Normand <pnormand@igalia.com>
[GStreamer] LibWebRTC files should be in libwebrtc/gstreamer
https://bugs.webkit.org/show_bug.cgi?id=227991
Reviewed by Xabier Rodriguez-Calvar.
For consistency purposes, the GStreamer backend modules used by LibWebRTC are now in
platform/mediastream/libwebrtc/gstreamer. platform/mediastream/ contains the pure GStreamer
modules related with media capture.
* platform/GStreamer.cmake:
* platform/mediastream/libwebrtc/gstreamer/GStreamerVideoCommon.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoCommon.cpp.
(WebCore::createH264Format):
(WebCore::supportedH264Formats):
* platform/mediastream/libwebrtc/gstreamer/GStreamerVideoCommon.h: Renamed from Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoCommon.h.
* platform/mediastream/libwebrtc/gstreamer/GStreamerVideoDecoderFactory.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp.
(WebCore::GStreamerVideoDecoder::GStreamerVideoDecoder):
(WebCore::GStreamerVideoDecoder::decodebinPadAddedCb):
(WebCore::GStreamerVideoDecoder::pipeline):
(WebCore::GStreamerVideoDecoder::makeElement):
(WebCore::GStreamerVideoDecoder::handleError):
(WebCore::GStreamerVideoDecoder::CreateFilter):
(WebCore::GStreamerVideoDecoder::pullSample):
(WebCore::GStreamerVideoDecoder::GetCapsForFrame):
(WebCore::GStreamerVideoDecoder::AddDecoderIfSupported):
(WebCore::GStreamerVideoDecoder::ConfigureSupportedDecoder):
(WebCore::GStreamerVideoDecoder::GstDecoderFactory):
(WebCore::GStreamerVideoDecoder::HasGstDecoder):
(WebCore::H264Decoder::H264Decoder):
(WebCore::VP8Decoder::VP8Decoder):
(WebCore::VP8Decoder::Create):
(WebCore::VP9Decoder::VP9Decoder):
(WebCore::VP9Decoder::Create):
(WebCore::GStreamerVideoDecoderFactory::CreateVideoDecoder):
(WebCore::GStreamerVideoDecoderFactory::GStreamerVideoDecoderFactory):
(WebCore::GStreamerVideoDecoderFactory::GetSupportedFormats const):
* platform/mediastream/libwebrtc/gstreamer/GStreamerVideoDecoderFactory.h: Renamed from Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.h.
* platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoder.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp.
(Encoders::singleton):
(Encoders::registerEncoder):
(Encoders::definition):
(webrtcVideoEncoderGetProperty):
(webrtcVideoEncoderSetBitrate):
(webrtcVideoEncoderSetEncoder):
(webrtcVideoEncoderSetFormat):
(webrtcVideoEncoderSetProperty):
(setBitrateKbitPerSec):
(setBitrateBitPerSec):
(webrtcVideoEncoderConstructed):
(webkit_webrtc_video_encoder_class_init):
* platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoder.h: Renamed from Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.h.
* platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoderFactory.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp.
(WebCore::GStreamerEncodedImageBuffer::create):
(WebCore::GStreamerEncodedImageBuffer::getBuffer const):
(WebCore::GStreamerEncodedImageBuffer::getVideoResolution const):
(WebCore::GStreamerEncodedImageBuffer::GStreamerEncodedImageBuffer):
(WebCore::GStreamerVideoEncoder::GStreamerVideoEncoder):
(WebCore::GStreamerVideoEncoder::pipeline):
(WebCore::GStreamerVideoEncoder::makeElement):
(WebCore::GStreamerVideoEncoder::returnFromFlowReturn):
(WebCore::GStreamerVideoEncoder::createEncoder):
(WebCore::GStreamerVideoEncoder::AddCodecIfSupported):
(WebCore::GStreamerVideoEncoder::Caps):
(WebCore::GStreamerVideoEncoder::ConfigureSupportedCodec):
(WebCore::GStreamerVideoEncoder::SetRestrictionCaps):
(WebCore::GStreamerH264Encoder::GStreamerH264Encoder):
(WebCore::GStreamerVideoEncoderFactory::CreateVideoEncoder):
(WebCore::GStreamerVideoEncoderFactory::GStreamerVideoEncoderFactory):
(WebCore::GStreamerVideoEncoderFactory::GetSupportedFormats const):
* platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoderFactory.h: Renamed from Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.h.
* platform/mediastream/libwebrtc/gstreamer/GStreamerVideoFrameLibWebRTC.cpp: Renamed from Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.cpp.
(WebCore::GStreamerSampleFromLibWebRTCVideoFrame):
(WebCore::GStreamerVideoFrameLibWebRTC::create):
(WebCore::LibWebRTCVideoFrameFromGStreamerSample):
(WebCore::GStreamerVideoFrameLibWebRTC::ToI420):
* platform/mediastream/libwebrtc/gstreamer/GStreamerVideoFrameLibWebRTC.h: Renamed from Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.h.
(WebCore::GStreamerVideoFrameLibWebRTC::GStreamerVideoFrameLibWebRTC):
(WebCore::GStreamerVideoFrameLibWebRTC::takeSample):
* platform/mediastream/libwebrtc/gstreamer/LibWebRTCProviderGStreamer.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderGStreamer.cpp.
(WebCore::LibWebRTCProvider::create):
(WebCore::LibWebRTCProvider::webRTCAvailable):
(WebCore::LibWebRTCProviderGStreamer::createDecoderFactory):
(WebCore::LibWebRTCProviderGStreamer::createEncoderFactory):
* platform/mediastream/libwebrtc/gstreamer/LibWebRTCProviderGStreamer.h: Renamed from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderGStreamer.h.
* platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp: Renamed from Source/WebCore/platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp.
(WebCore::RealtimeIncomingAudioSource::create):
(WebCore::RealtimeIncomingAudioSourceLibWebRTC::create):
(WebCore::RealtimeIncomingAudioSourceLibWebRTC::RealtimeIncomingAudioSourceLibWebRTC):
(WebCore::RealtimeIncomingAudioSourceLibWebRTC::OnData):
* platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.h: Renamed from Source/WebCore/platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.h.
* platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp: Renamed from Source/WebCore/platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp.
(WebCore::RealtimeIncomingVideoSource::create):
(WebCore::RealtimeIncomingVideoSourceLibWebRTC::create):
(WebCore::RealtimeIncomingVideoSourceLibWebRTC::RealtimeIncomingVideoSourceLibWebRTC):
(WebCore::RealtimeIncomingVideoSourceLibWebRTC::OnFrame):
* platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h: Renamed from Source/WebCore/platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h.
* platform/mediastream/libwebrtc/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp: Renamed from Source/WebCore/platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp.
(WebCore::RealtimeMediaSourceCenter::defaultAudioCaptureFactory):
(WebCore::RealtimeMediaSourceCenter::defaultVideoCaptureFactory):
(WebCore::RealtimeMediaSourceCenter::defaultDisplayCaptureFactory):
* platform/mediastream/libwebrtc/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp: Renamed from Source/WebCore/platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp.
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::RealtimeOutgoingAudioSourceLibWebRTC):
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::~RealtimeOutgoingAudioSourceLibWebRTC):
(WebCore::RealtimeOutgoingAudioSource::create):
(WebCore::libwebrtcAudioFormat):
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::audioSamplesAvailable):
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData):
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::isReachingBufferedAudioDataHighLimit):
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::isReachingBufferedAudioDataLowLimit):
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::hasBufferedEnoughData):
* platform/mediastream/libwebrtc/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h: Renamed from Source/WebCore/platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h.
* platform/mediastream/libwebrtc/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.cpp: Renamed from Source/WebCore/platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.cpp.
(WebCore::RealtimeOutgoingVideoSource::create):
(WebCore::RealtimeOutgoingVideoSourceLibWebRTC::create):
(WebCore::RealtimeOutgoingVideoSourceLibWebRTC::RealtimeOutgoingVideoSourceLibWebRTC):
(WebCore::RealtimeOutgoingVideoSourceLibWebRTC::videoSampleAvailable):
(WebCore::RealtimeOutgoingVideoSourceLibWebRTC::createBlackFrame):
* platform/mediastream/libwebrtc/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.h: Renamed from Source/WebCore/platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.h.
2021-07-15 Chris Dumez <cdumez@apple.com>
Implement 'SubmitEvent' interface
https://bugs.webkit.org/show_bug.cgi?id=202978
Reviewed by Alex Christensen.
Implement 'SubmitEvent' interface as per:
- https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submitevent
Both Chrome and Firefox already ship this.
No new tests, rebaselined existing tests.
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/EventNames.in:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::submitIfPossible):
* html/SubmitEvent.cpp: Added.
(WebCore::SubmitEvent::create):
(WebCore::SubmitEvent::SubmitEvent):
(WebCore::SubmitEvent::eventInterface const):
* html/SubmitEvent.h: Added.
(WebCore::SubmitEvent::submitter const):
* html/SubmitEvent.idl: Added.
* html/SubmitInputType.cpp:
(WebCore::SubmitInputType::handleDOMActivateEvent):
Make sure SubmitInputType::handleDOMActivateEvent() passes its element as submitter
when submitting the form. One of the subtests in html/semantics/forms/form-submission-0/implicit-submission.optional.html
covers this.
2021-07-15 Chris Dumez <cdumez@apple.com>
Add support for MediaError.message
https://bugs.webkit.org/show_bug.cgi?id=228008
Reviewed by Alex Christensen.
Add support for MediaError.message:
- https://html.spec.whatwg.org/multipage/media.html#mediaerror
Both Chrome and Firefox already support this.
No new tests, rebaselined existing test.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::noneSupported):
(WebCore::HTMLMediaElement::mediaLoadingFailedFatally):
(WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
(WebCore::HTMLMediaElement::userCancelledLoad):
* html/MediaError.h:
(WebCore::MediaError::create):
(WebCore::MediaError::message const):
(WebCore::MediaError::MediaError):
* html/MediaError.idl:
2021-07-15 Jean-Yves Avenard <jya@apple.com>
[Wk1] media/media-source/media-webm-opus-partial.html is a consistent failure (Enable VP8/VP9/Vorbis/Opus in WebKitLegacy)
https://bugs.webkit.org/show_bug.cgi?id=228005
rdar://80346720
Reviewed by Jer Noble.
There are already tests running under Wk1 that will exercise this code (and will no longer fail)
* page/RuntimeEnabledFeatures.cpp:
(WebCore::RuntimeEnabledFeatures::setVorbisDecoderEnabled):
Carry settings to PlatformMediaSessionManager
(WebCore::RuntimeEnabledFeatures::setOpusDecoderEnabled):
Carry settings to PlatformMediaSessionManager
* page/RuntimeEnabledFeatures.h:
2021-07-15 Jean-Yves Avenard <jya@apple.com>
[MSE] sequence mode is broken if GPU Process is enabled
https://bugs.webkit.org/show_bug.cgi?id=227864
<rdar://problem/80445041>
Reviewed by Jer Noble.
When the source buffer's mode is set to sequence, the timestampOffset attribute
should be updated after each appendBuffer operation. However, when the GPU process
is enabled, the timestampOffset calculations are all done in the GPU process and
its result wasn't communicated back to the WebContent process leading its value
to always be 0 on read.
Fly-by fix: the timestamp offset calculation was incorrect, per spec
https://w3c.github.io/media-source/#sourcebuffer-coded-frame-processing
step 3.5.8.3.1 we read:
// Set timestampOffset equal to group start timestamp - presentation timestamp.
but the code did otherwise.
Test: media/media-source/media-mp4-h264-sequence-mode.html
* platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::didReceiveSample): Offset m_timestampOffset by
the sample's presentation timestamp
2021-07-15 Chris Dumez <cdumez@apple.com>
Add initial support for BroadcastChannel behind a runtime flag
https://bugs.webkit.org/show_bug.cgi?id=227924
Reviewed by Sam Weinig.
Add initial support for BroadcastChannel behind a runtime flag, off by default:
- https://html.spec.whatwg.org/multipage/web-messaging.html#broadcasting-to-other-browsing-contexts
Both Firefox and Blink have been supporting BroadcastChannel for a long time.
The implementation is complete and spec-compliant. It works both in Window and Worker environments,
in WebKit1 and WebKit2. However, the feature is off-by-default because of privacy concerns that have
not been addresssed yet:
- https://github.com/whatwg/html/issues/5803
We should be able to add partioning to address the privacy concerns and ship this later on. In the mean
time though, having a working BroadcastChannel implementation in the context of layout tests is already
very useful because a lot of Web-Platform-Tests are relying on it to test other Web features. This means
better test coverage for WebKit.
Tests:
- fast/html/broadcast-channel-between-different-sessions.html
- Rebaselined WPT tests
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* dom/BroadcastChannel.cpp: Added.
(WebCore::channelToContextIdentifier):
(WebCore::BroadcastChannel::BroadcastChannel):
(WebCore::BroadcastChannel::~BroadcastChannel):
(WebCore::BroadcastChannel::postMessage):
(WebCore::BroadcastChannel::close):
(WebCore::BroadcastChannel::dispatchMessageTo):
(WebCore::BroadcastChannel::dispatchMessage):
(WebCore::BroadcastChannel::ensureOnMainThread):
(WebCore::BroadcastChannel::activeDOMObjectName const):
(WebCore::BroadcastChannel::eventListenersDidChange):
(WebCore::BroadcastChannel::virtualHasPendingActivity const):
* dom/BroadcastChannel.h: Added.
(WebCore::BroadcastChannel::create):
(WebCore::BroadcastChannel::identifier const):
(WebCore::BroadcastChannel::name const):
* dom/BroadcastChannel.idl: Added.
* dom/BroadcastChannelIdentifier.h: Added.
* dom/BroadcastChannelRegistry.h: Added.
(WebCore::BroadcastChannelRegistry::~BroadcastChannelRegistry):
* dom/DeviceOrientationAndMotionAccessController.h:
* dom/DeviceOrientationEvent.cpp:
* dom/DeviceOrientationEvent.h:
* dom/EventTargetFactory.in:
* loader/EmptyClients.cpp:
(WebCore::pageConfigurationWithEmptyClients):
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::setBroadcastChannelRegistry):
* page/Page.h:
(WebCore::Page::broadcastChannelRegistry):
* page/PageConfiguration.cpp:
(WebCore::PageConfiguration::PageConfiguration):
* page/PageConfiguration.h:
2021-07-15 Chris Dumez <cdumez@apple.com>
FetchResponse.formData() should reject promise with a TypeError if the body is null
https://bugs.webkit.org/show_bug.cgi?id=228007
Reviewed by Alex Christensen.
FetchResponse.formData() should reject promise with a TypeError if the body is null, to match
the behavior of Chrome and Firefox.
No new tests, rebaselined existing tests.
* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::formData):
2021-07-15 Chris Dumez <cdumez@apple.com>
Sync XHR 'load' event is always has total/loaded=0
https://bugs.webkit.org/show_bug.cgi?id=228004
Reviewed by Alex Christensen.
XMLHttpRequest::didReceiveData() was not calling XMLHttpRequestProgressEventThrottle::dispatchThrottledProgressEvent()
for sync XHRs because we don't want to fire 'progress' events for sync XHR. However, dispatchThrottledProgressEvent()
also updates XMLHttpRequestProgressEventThrottle's m_loaded / m_total members and we do want those to get updated for
sync XHRs, since they get used later on for the 'load' event.
No new tests, rebaselined existing test.
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::didReceiveData):
* xml/XMLHttpRequestProgressEventThrottle.cpp:
(WebCore::XMLHttpRequestProgressEventThrottle::updateProgress):
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchThrottledProgressEvent): Deleted.
* xml/XMLHttpRequestProgressEventThrottle.h:
2021-07-15 Sihui Liu <sihui_liu@apple.com>
Do not abort ongoing IDB transaction synchronously on non-imminent PrepareToSuspend message
https://bugs.webkit.org/show_bug.cgi?id=227778
<rdar://problem/80602557>
Reviewed by Chris Dumez.
* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::hasDatabaseActivitiesOnMainThread const):
* Modules/indexeddb/server/IDBServer.h:
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::hasActiveTransactions const):
* Modules/indexeddb/server/UniqueIDBDatabase.h:
2021-07-15 Peng Liu <peng.liu6@apple.com>
Reddit PiP video pauses when scrolling
https://bugs.webkit.org/show_bug.cgi?id=227999
Reviewed by Jer Noble.
Enable the `requiresUserGestureToPauseInPictureInPicture` quirk for reddit.com.
* page/Quirks.cpp:
(WebCore::Quirks::requiresUserGestureToPauseInPictureInPicture const):
2021-07-15 Megan Gardner <megan_gardner@apple.com>
Rename scrollRectIntoView to scrollContainingScrollViewsToRevealRect for clarity.
https://bugs.webkit.org/show_bug.cgi?id=227995
Reviewed by Tim Horton.
No behavior change.
* loader/EmptyClients.h:
* page/Chrome.cpp:
(WebCore::Chrome::scrollContainingScrollViewsToRevealRect const):
(WebCore::Chrome::scrollRectIntoView const): Deleted.
* page/Chrome.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::scrollContainingScrollViewsToRevealRect const):
(WebCore::ChromeClient::scrollRectIntoView const): Deleted.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):
2021-07-15 Brady Eidson <beidson@apple.com>
Use WeakPtr with UniqueIDBDatabaseConnection
<rdar://79447808> 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 Simon Fraser <simon.fraser@apple.com>
Improve multicol logging in render tree dumps, and cleanup
https://bugs.webkit.org/show_bug.cgi?id=227994
Reviewed by Alan Bujtas.
For a RenderFragmentedFlow dump the list of fragment containers, and clean up the existing
dumping of containers for a renderer inside a fragmented flow. Also dump column information
for RenderMultiColumnSet.
Use initializers for member variables in various fragmentation-related renderers.
* rendering/RenderFragmentContainer.cpp:
(WebCore::RenderFragmentContainer::RenderFragmentContainer):
* rendering/RenderFragmentContainer.h:
* rendering/RenderMultiColumnFlow.cpp:
(WebCore::RenderMultiColumnFlow::RenderMultiColumnFlow):
* rendering/RenderMultiColumnFlow.h:
* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::RenderMultiColumnSet):
* rendering/RenderMultiColumnSet.h:
* rendering/RenderObject.cpp:
(WebCore::enclosingFragmentedFlowFromRenderer):
(WebCore::RenderObject::outputRegionsInformation const):
(WebCore::RenderObject::outputRenderObject const):
2021-07-15 Brady Eidson <beidson@apple.com>
MemoryIDBBackingStore cleanup.
<rdar://79497380> 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-15 Tim Nguyen <ntim@apple.com>
<dialog> element: do not perform close() method steps when removing open attribute.
https://bugs.webkit.org/show_bug.cgi?id=227872
Reviewed by Chris Dumez.
Test: web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-open.html
The close function now follows the steps at: https://html.spec.whatwg.org/multipage/interactive-elements.html#close-the-dialog
* html/HTMLDialogElement.cpp:
(WebCore::HTMLDialogElement::show):
(WebCore::HTMLDialogElement::showModal):
(WebCore::HTMLDialogElement::close):
(WebCore::HTMLDialogElement::dispatchPendingEvent):
(WebCore::HTMLDialogElement::isOpen const): Deleted.
(WebCore::HTMLDialogElement::returnValue): Deleted.
(WebCore::HTMLDialogElement::setReturnValue): Deleted.
(WebCore::HTMLDialogElement::parseAttribute): Deleted.
(WebCore::HTMLDialogElement::isModal const): Deleted.
* html/HTMLDialogElement.h:
2021-07-15 Jer Noble <jer.noble@apple.com>
REGRESSION (r279119?): [iOS] ASSERTION FAILED: !m_impl || !m_shouldEnableAssertions || m_impl->wasConstructedOnMainThread() == isMainThread() seen with 3 WebKitLegacy media API tests
https://bugs.webkit.org/show_bug.cgi?id=227930
<rdar://problem/80545962>
Reviewed by Eric Carlson.
Dispatch to the WebThread if necessary.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
2021-07-15 Adrian Perez de Castro <aperez@igalia.com>
Non-unified build fixes, mid-July 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=227981
Unreviewed non-unified build fixes.
* accessibility/AXObjectCache.cpp: Add missing AXImage.h and RenderImage.h headers.
* bindings/js/JSIntersectionObserverCustom.cpp:
(WebCore::JSIntersectionObserverOwner::isReachableFromOpaqueRoots): Add missing namespace to
usage of JSC::jsCast<T>() template.
* bindings/js/JSResizeObserverCustom.cpp: Add missing Element.h and JSNodeCustom.h headers.
(WebCore::JSResizeObserverOwner::isReachableFromOpaqueRoots): Add missing namespace to usage
of JSC::jsCast<T>() template.
* css/CSSCrossfadeValue.h: Add missing forward declaration of Style::BuilderState.
* css/parser/CSSPropertyParserWorkerSafe.cpp: Add missing ParsingUtilities.h header.
* platform/graphics/cairo/GradientCairo.cpp: Replace GraphicsContext.h header with
GraphicsContextCairo.h to avoid errors about undefined types.
* rendering/style/RenderStyleConstants.cpp: Add missing CSSPrimitiveValueMappings.h header.
2021-07-15 Philippe Normand <pnormand@igalia.com>
[GStreamer][Pipewire] Implement getDisplayMedia() backend
https://bugs.webkit.org/show_bug.cgi?id=210926
Reviewed by Xabier Rodriguez-Calvar.
Display capture is now supported by GStreamer ports. When requested, the capture device
manager queries the host through the libportal API. The user is presented with a prompt
allowing to select either a monitor or an application window. Once selected, the manager
creates the associated CaptureDevice, passing the pipewire file descriptor along. The
existing GStreamer video capture source infrastructure is reused, leveraging the GStreamer
pipewiresrc element to generate a live video stream of the display device.
As display capture devices need to respect the aspect-ratio of the video frame, taking into
account max-{widther,height}, some code was reused from the Cocoa display capture code and
placed in RealtimeVideoCaptureSource as ensureIntrinsicSizeMaintainsAspectRatio().
Unfortunately this aspect-ratio enforcing feature is currently used only for mock capture
sources. The GStreamer pipewiresrc doesn't support caps renegotiation well yet, so we can't
comply with the aspect-ratio enforcing, for the time being.
This patch is covered by newly unskipped layout tests and API tests.
* platform/GStreamer.cmake:
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::setIntrinsicSize):
(WebCore::RealtimeMediaSource::hashedId const):
* platform/mediastream/RealtimeMediaSource.h:
* platform/mediastream/RealtimeVideoCaptureSource.cpp:
(WebCore::RealtimeVideoCaptureSource::ensureIntrinsicSizeMaintainsAspectRatio):
* platform/mediastream/RealtimeVideoCaptureSource.h:
* platform/mediastream/RealtimeVideoSource.cpp:
(WebCore::RealtimeVideoSource::sourceSettingsChanged):
* platform/mediastream/gstreamer/GStreamerAudioCapturer.cpp:
(WebCore::GStreamerAudioCapturer::GStreamerAudioCapturer):
* platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:
(WebCore::GStreamerDisplayCaptureDeviceManager::GStreamerDisplayCaptureDeviceManager):
(WebCore::GStreamerDisplayCaptureDeviceManager::~GStreamerDisplayCaptureDeviceManager):
(WebCore::GStreamerDisplayCaptureDeviceManager::computeCaptureDevices):
(WebCore::GStreamerDisplayCaptureDeviceManager::setSession):
(WebCore::GStreamerDisplayCaptureDeviceManager::sessionStarted):
(WebCore::GStreamerDisplayCaptureDeviceManager::notifyClient):
(WebCore::GStreamerDisplayCaptureDeviceManager::sessionWasClosed):
* platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h:
* platform/mediastream/gstreamer/GStreamerCapturer.cpp:
(WebCore::GStreamerCapturer::GStreamerCapturer):
(WebCore::GStreamerCapturer::Observer::~Observer):
(WebCore::GStreamerCapturer::addObserver):
(WebCore::GStreamerCapturer::removeObserver):
(WebCore::GStreamerCapturer::forEachObserver):
(WebCore::GStreamerCapturer::createSource):
* platform/mediastream/gstreamer/GStreamerCapturer.h:
(WebCore::GStreamerCapturer::Observer::sourceCapsChanged):
(WebCore::GStreamerCapturer::deviceType const):
* platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
(WebCore::GStreamerVideoCaptureSource::create):
(WebCore::GStreamerVideoCaptureSource::createPipewireSource):
(WebCore::GStreamerVideoCaptureSource::GStreamerVideoCaptureSource):
(WebCore::m_deviceType):
(WebCore::GStreamerVideoCaptureSource::~GStreamerVideoCaptureSource):
(WebCore::GStreamerVideoCaptureSource::sourceCapsChanged):
(WebCore::GStreamerVideoCaptureSource::startProducingData):
(WebCore::GStreamerVideoCaptureSource::stopProducingData):
(WebCore::m_capturer): Deleted.
* platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h:
* platform/mediastream/gstreamer/GStreamerVideoCapturer.cpp:
(WebCore::initializeDebugCategory):
(WebCore::GStreamerVideoCapturer::GStreamerVideoCapturer):
(WebCore::GStreamerVideoCapturer::createSource):
(WebCore::GStreamerVideoCapturer::setPipewireFD):
(WebCore::GStreamerVideoCapturer::setSize):
(WebCore::GStreamerVideoCapturer::setFrameRate):
* platform/mediastream/gstreamer/GStreamerVideoCapturer.h:
* platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.cpp:
(WebCore::MockRealtimeVideoSource::create):
(WebCore::MockRealtimeVideoSourceGStreamer::createMockDisplayCaptureSource):
* platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.h:
* platform/mock/MockRealtimeMediaSourceCenter.cpp:
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::capabilities):
(WebCore::MockRealtimeVideoSource::generateFrame):
* platform/mock/MockRealtimeVideoSource.h:
2021-07-15 Philippe Normand <pnormand@igalia.com> and Miguel Gomez <magomez@igalia.com>
[GStreamer][GL] A420 compositing support
https://bugs.webkit.org/show_bug.cgi?id=227953
Reviewed by Xabier Rodriguez-Calvar.
A420 is YUV+alpha in a separate component. vp9dec outputs this format for assets encoded
with alpha support. Our GL sink now supports this format and lets the TextureMapper handle the
final conversion to RGBA.
* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
* platform/graphics/gstreamer/GStreamerVideoFrameHolder.cpp:
(WebCore::GstVideoFrameHolder::platformLayerBuffer):
* platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
(WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGL::drawTexturePlanarYUV):
* platform/graphics/texmap/TextureMapperGL.h:
* platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
(WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
* platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
* platform/graphics/texmap/TextureMapperShaderProgram.cpp:
(WebCore::TextureMapperShaderProgram::create):
* platform/graphics/texmap/TextureMapperShaderProgram.h:
2021-07-14 Alex Christensen <achristensen@webkit.org>
Link against Catalyst ANGLE-shared.dylib when linking Catalyst WebCore.framework
https://bugs.webkit.org/show_bug.cgi?id=227965
<rdar://76284889>
Reviewed by Tim Horton.
r274742 put the dylib into the correct location, but when linking WebCore we are still looking in the
location of the non-Catalyst dylib, which happens to have all the symbols we are looking for so linking succeeds.
At runtime, though, we realize we are opening the wrong dylib and bad things happen.
The solution is to look in the Catalyst WebCore framework directory when WK_USE_ALTERNATE_FRAMEWORKS_DIR is YES,
which is only in the Catalyst build.
* Configurations/WebCore.xcconfig:
2021-07-14 Mark Lam <mark.lam@apple.com>
Speculative fix for failed scope.releaseAssertNoException() after calls to JSMap::create().
https://bugs.webkit.org/show_bug.cgi?id=227964
rdar://78013960
Reviewed by Yusuke Suzuki.
* bindings/js/JSDOMMapLike.cpp:
(WebCore::getBackingMap):
2021-07-14 Jer Noble <jer.noble@apple.com>
[Cocoa] Null-pointer deref in MediaKeySystemAccess::createMediaKeys()
https://bugs.webkit.org/show_bug.cgi?id=227911
<rdar://80325855>
Reviewed by Chris Dumez.
In r278481, we moved from a (timer-based) GenericTaskQueue to the document's event loop, but in so
doing, allowed the passed-in lambda to be called after the underlying object had been destroyed.
Make MediaKeySystemAccess a CanMakeWeakPtr and pass in a WeakPtr to the lambda. To ensure that the
lambda itself keeps MediaKeySystemAccess during the execution of the lambda, also add a Ref to
the object after null-checking weakThis.
* Modules/encryptedmedia/MediaKeySystemAccess.cpp:
(WebCore::MediaKeySystemAccess::createMediaKeys):
* Modules/encryptedmedia/MediaKeySystemAccess.h:
2021-07-14 Rob Buis <rbuis@igalia.com>
Rename hasOverflowClip() to prepare for the real overflow:clip
https://bugs.webkit.org/show_bug.cgi?id=227899
Reviewed by Simon Fraser.
Rename hasOverflowClip() to prepare for the real overflow:clip.
No new tests since no change in behavior.
* dom/Document.cpp:
(WebCore::Document::isBodyPotentiallyScrollable):
(WebCore::computeIntersectionState):
* dom/Element.cpp:
(WebCore::Element::scrollTo):
(WebCore::Element::scrollByUnits):
* editing/TextIterator.cpp:
(WebCore::fullyClipsContents):
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::lineOverflowWidth):
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::collectOverflow):
* page/ios/FrameIOS.mm:
(WebCore::Frame::nodeRespondingToScrollWheelEvents):
* rendering/LegacyLineLayout.cpp:
(WebCore::LegacyLineLayout::layoutLineBoxes):
(WebCore::LegacyLineLayout::addOverflowFromInlineChildren):
* rendering/RenderBlock.cpp:
(WebCore::OverflowEventDispatcher::OverflowEventDispatcher):
(WebCore::RenderBlock::endAndCommitUpdateScrollInfoAfterLayoutTransaction):
(WebCore::RenderBlock::updateScrollInfoAfterLayout):
(WebCore::RenderBlock::computeOverflow):
(WebCore::RenderBlock::paint):
(WebCore::RenderBlock::isSelectionRoot const):
(WebCore::RenderBlock::nodeAtPoint):
(WebCore::RenderBlock::addFocusRingRects):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutBlock):
(WebCore::RenderBlockFlow::adjustForBorderFit const):
* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::endPaddingWidthForCaret const):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::styleWillChange):
(WebCore::RenderBox::styleDidChange):
(WebCore::RenderBox::updateFromStyle):
(WebCore::RenderBox::scrollWidth const):
(WebCore::RenderBox::scrollHeight const):
(WebCore::RenderBox::scrollLeft const):
(WebCore::RenderBox::scrollTop const):
(WebCore::RenderBox::setScrollLeft):
(WebCore::RenderBox::setScrollTop):
(WebCore::RenderBox::setScrollPosition):
(WebCore::RenderBox::includeVerticalScrollbarSize const):
(WebCore::RenderBox::includeHorizontalScrollbarSize const):
(WebCore::RenderBox::intrinsicScrollbarLogicalWidth const):
(WebCore::RenderBox::requiresLayerWithScrollableArea const):
(WebCore::RenderBox::canBeProgramaticallyScrolled const):
(WebCore::RenderBox::usesCompositedScrolling const):
(WebCore::RenderBox::hasAutoScrollbar const):
(WebCore::RenderBox::hasAlwaysPresentScrollbar const):
(WebCore::RenderBox::scrollPosition const):
(WebCore::RenderBox::cachedSizeForOverflowClip const):
(WebCore::RenderBox::backgroundHasOpaqueTopLayer const):
(WebCore::RenderBox::pushContentsClip):
(WebCore::RenderBox::popContentsClip):
(WebCore::RenderBox::computeVisibleRectInContainer const):
(WebCore::RenderBox::createsNewFormattingContext const):
(WebCore::RenderBox::addOverflowFromChild):
(WebCore::RenderBox::addLayoutOverflow):
(WebCore::RenderBox::layoutOverflowRectForPropagation const):
* rendering/RenderBox.h:
(WebCore::RenderBox::scrollsOverflowX const):
(WebCore::RenderBox::scrollsOverflowY const):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
(WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground const):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::styleWillChange):
(WebCore::RenderElement::mayCauseRepaintInsideViewport const):
* rendering/RenderElement.h:
(WebCore::RenderElement::hasClipOrNonVisibleOverflow const):
(WebCore::RenderElement::hasClipOrOverflowClip const): Deleted.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::hitTestChildren):
* rendering/RenderFragmentContainer.cpp:
(WebCore::RenderFragmentContainer::shouldClipFragmentedFlowContent const):
(WebCore::RenderFragmentContainer::layoutOverflowRectForBoxForPropagation):
* rendering/RenderFragmentedFlow.cpp:
(WebCore::RenderFragmentedFlow::addFragmentsOverflowFromChild):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::clippedOverflowRect const):
(WebCore::RenderInline::computeVisibleRectInContainer const):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::shouldBeNormalFlowOnly const):
(WebCore::RenderLayer::updateLayerPositionsAfterScroll):
(WebCore::RenderLayer::enclosingOverflowClipLayer const):
(WebCore::RenderLayer::updateLayerPosition):
(WebCore::RenderLayer::allowsCurrentScroll const):
(WebCore::RenderLayer::canResize const):
(WebCore::RenderLayer::clipToRect):
(WebCore::RenderLayer::setupFontSubpixelQuantization):
(WebCore::RenderLayer::paintLayerContents):
(WebCore::RenderLayer::calculateClipRects const):
(WebCore::outputPaintOrderTreeRecursive):
* rendering/RenderLayerBacking.cpp:
(WebCore::clippingLayerBox):
(WebCore::RenderLayerBacking::updateCompositedBounds):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::enclosingNonStackingClippingLayer const):
(WebCore::RenderLayerCompositor::computeAncestorClippingStack const):
(WebCore::RenderLayerCompositor::clipsCompositingDescendants):
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::paintOverflowControls):
(WebCore::RenderLayerScrollableArea::updateScrollCornerStyle):
(WebCore::RenderLayerScrollableArea::updateResizerStyle):
(WebCore::RenderLayerScrollableArea::scrollByRecursively):
* rendering/RenderLayoutState.cpp:
(WebCore::RenderLayoutState::RenderLayoutState):
(WebCore::RenderLayoutState::computeOffsets):
(WebCore::RenderLayoutState::computeClipRect):
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::paint):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::addOverflowFromListMarker):
* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::addOverflowFromChildren):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::enclosingScrollableContainerForSnapping const):
(WebCore::objectIsRelayoutBoundary):
(WebCore::RenderObject::computeVisibleRectInContainer const):
(WebCore::RenderObject::outputRenderObject const):
* rendering/RenderObject.h:
(WebCore::RenderObject::hasNonVisibleOverflow const):
(WebCore::RenderObject::setHasNonVisibleOverflow):
(WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
(WebCore::RenderObject::hasOverflowClip const): Deleted.
(WebCore::RenderObject::setHasOverflowClip): Deleted.
* rendering/RenderScrollbarPart.cpp:
(WebCore::RenderScrollbarPart::styleDidChange):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::nodeAtPoint):
* rendering/RenderTableRow.h:
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::nodeAtPoint):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::canScroll const):
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::styleDidChange):
* rendering/RenderTreeAsText.cpp:
* rendering/svg/RenderSVGBlock.cpp:
(WebCore::RenderSVGBlock::updateFromStyle):
2021-07-14 Chris Dumez <cdumez@apple.com>
Fix type of exceptions thrown in the WebAudio API
https://bugs.webkit.org/show_bug.cgi?id=227959
Reviewed by Yusuke Suzuki.
The upstream webaudio web-platform-tests were updated to validate the types of
exceptions thrown by various WebAudio APIs. It became obvious that our implementation
was not always throwing the right exception type and didn't match other browsers.
This patch updates our WebAudio implementation to keep the WebAudio WPT tests passing
now that they properly validate exception types.
No new tests, re-sync'd and rebaselined existing WPT webaudio tests.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::create):
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::connect):
(WebCore::AudioNode::setChannelCount):
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::createScriptProcessor):
* Modules/webaudio/BiquadFilterNode.cpp:
(WebCore::BiquadFilterNode::getFrequencyResponse):
* Modules/webaudio/ChannelSplitterNode.cpp:
(WebCore::ChannelSplitterNode::setChannelCount):
* Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::create):
* Modules/webaudio/ScriptProcessorNode.cpp:
(WebCore::ScriptProcessorNode::setChannelCount):
2021-07-14 Devin Rousso <drousso@apple.com>
[iOS] REGRESSION(r279720): changing Subtitles to Off doesn't hide them or do anything
https://bugs.webkit.org/show_bug.cgi?id=227937
<rdar://problem/79069662>
Reviewed by Eric Carlson.
r279720 made it so that `CaptionUserPreferencesMediaAF::setCaptionDisplayMode` no longer
directly modifies `kMACaptionAppearanceDomainUser` in the WebProcess, using a cached value
as a way of preventing the WebProcess from trying to read back that value after it's set,
instead having the UIProcess send `Messages::WebProcess::SetMediaAccessibilityPreferences`
whenever this changes to update that cached value. Unfortunately, because the WebProcess
needs to read this value immediately after changing it, this IPC round trip causes the
WebProcess to read the old value, which results in no observable changes. In order to fix
this, notify `CaptionUserPreferences` that `captionPreferencesChanged` when the above IPC
message is received (which will also handle cases when the value changes outside WebKit).
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::sortedTrackListForMenu):
(WebCore::MediaControlsHost::displayNameForTrack):
(WebCore::MediaControlsHost::captionDisplayMode const):
(WebCore::MediaControlsHost::showMediaControlsContextMenu):
* dom/Document.cpp:
(WebCore::Document::registerForCaptionPreferencesChangedCallbacks):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::addTextTrack):
(WebCore::HTMLMediaElement::configureTextTrackGroup):
(WebCore::HTMLMediaElement::setSelectedTextTrack):
(WebCore::HTMLMediaElement::captionPreferencesChanged):
(WebCore::HTMLMediaElement::captionDisplayMode):
(WebCore::HTMLMediaElement::mediaPlayerPreferredAudioCharacteristics const):
* html/shadow/MediaControlTextTrackContainerElement.cpp:
(WebCore::MediaControlTextTrackContainerElement::updateActiveCuesFontSize):
(WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
* page/PageGroup.h:
(WebCore::PageGroup::captionPreferences const): Added.
* page/PageGroup.cpp:
(WebCore::PageGroup::ensureCaptionPreferences): Added.
(WebCore::PageGroup::captionPreferences): Deleted.
* platform/cocoa/PlaybackSessionModelMediaElement.mm:
(WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionOptions):
(WebCore::PlaybackSessionModelMediaElement::audioMediaSelectionOptions const):
(WebCore::PlaybackSessionModelMediaElement::legibleMediaSelectionOptions const):
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::setShouldDisplayTrackKind):
(WebCore::InternalSettings::shouldDisplayTrackKind):
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::Internals):
(WebCore::Internals::userPreferredAudioCharacteristics const):
(WebCore::Internals::setUserPreferredAudioCharacteristic):
(WebCore::Internals::captionsStyleSheetOverride):
(WebCore::Internals::setCaptionsStyleSheetOverride):
(WebCore::Internals::setPrimaryAudioTrackLanguageOverride):
(WebCore::Internals::setCaptionDisplayMode):
Rename `PageGroup::captionPreferences` to `PageGroup::ensureCaptionPreferences` so that it's
possible to get the `CaptionUserPreferences` without always creating it.
2021-07-14 Eric Carlson <eric.carlson@apple.com>
[iOS] Dynamically set capture attribution
https://bugs.webkit.org/show_bug.cgi?id=227871
rdar://70241665
Reviewed by Jer Noble.
No new tests, tested manually.
* en.lproj/Localizable.strings:
2021-07-14 Said Abou-Hallawa <said@apple.com>
RenderElement::updateFillImages must fix the clients of the CSS image whose URL is invalid
https://bugs.webkit.org/show_bug.cgi?id=227926
<rdar://80457956>
Reviewed by Simon Fraser.
Per CSS2 specs, if the value of the url() is the empty string, then it
must be resolved to the URL of the style sheet which is an invalid URI
for an image. The issue https://github.com/w3c/csswg-drafts/issues/2211
was filed to change this behavior.
In RenderElement::updateFillImages() we fix the old and new fill images
only if they are different. But we consider them equal if their URIs are
equal and they are not data URIs. If the two URIs are empty strings, the
fill images will be considered equal although their CachedImages might
be different.
We need to fix the clients of the fill images always if their CachedImages
have errorOccured() true or have hasImage() false.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::updateFillImages):
* rendering/style/StyleCachedImage.cpp:
(WebCore::StyleCachedImage::hasImage const):
* rendering/style/StyleCachedImage.h:
* rendering/style/StyleImage.h:
(WebCore::StyleImage::hasImage const):
2021-07-13 Jean-Yves Avenard <jya@apple.com>
MediaSessionManagerCocoa::ensureCodecsRegistered() isn't thread-safe
https://bugs.webkit.org/show_bug.cgi?id=227940
Reviewed by Maciej Stachowiak.
C++11 static initializers aren't thread-safe due to architectural and compilation
option choices. So we use Grand Central Dispatch's dispatch_once instead.
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::ensureCodecsRegistered):
2021-07-13 Jean-Yves Avenard <jya@apple.com>
SourceBuffer.abort() doesn't go back to state WAITING_FOR_SEGMENT properly
https://bugs.webkit.org/show_bug.cgi?id=227559
<rdar://problem/79996056>
Reviewed by Jer Noble.
Per spec, calling sourcebuffer.abort method should allow you to add a new segment
immediately after, as abort moves the append state back to WAITING_FOR_SEGMENT.
A segment can be either an init segment or a media segment.
We used to discard all further content until an init segment was encountered.
This could be problematic due to the typical use case of abort:
1- Seek to a location
2- Append a partial media segment long enough to finish seeking and display the
new content at the new position.
If multiple seeks were done in rapid succession, abort() is called right after
before starting the new seek so that we can add the new segment, regardless of what
was appended before.
YouTube applies a workaround for Safari where it will always append an init segment
after calling abort, this is different to what they do with Firefox (and likely Chrome).
To be able to resume after appending a partial media segment we must ensure that the
SourceBufferParser is always left in a sane context, and not be interrupted at some
random points. The abort() call used to interrupt the buffer parsing on the fly and
then reset things which would require a new init segment to restart.
Instead we always fully parse the pending buffer received befofe the call to abort
and drop all demuxed samples.
The SourceBufferParserAVFObjC could already properly deal with discontinuity unlike
SourceBufferParserWebM.
To ensure that buffers sent after the call to abort() are only ever processed once
the pending ones have been parsed, and in order to avoid having blocking calls
we play with the order in which tasks are scheduled.
Fly-by fixes:
- The SourceBufferParser handle two type of parser: SourceBufferParser and the
platform specific AVStreamDataParser. Rename the accessor method to more clearly
differentate which parser we are dealing with.
- The SourceBufferParserWebM and SourceBufferPrivateAVFObjC used different task dispatching
mechanisms. We make them both share the same one now found in the base class.
- If SourceBufferPrivateAVFObjC::m_hasPendingAppendCompletedCallback had been set prior an
abort() it wouldn't have been reset, causing the need for a new init segment.
- If abort() had been called while samples were pending, the source buffer content was
undefined if timestamp offset or append windows start/end were changed immediately after.
- When an error occurs during the Segment Parser Loop, we should abort and run the append
error algorithm. We instead fired an error event for each sample found in the media segment.
In a debug built it was have asserted. We can't actually abort, so instead we ignore all
further samples once an error is encountered.
Tests: media/media-source/media-mp4-h264-partial-abort.html
media/media-source/media-webm-opus-partial-abort.html
* platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
(WebCore::CDMSessionAVContentKeySession::~CDMSessionAVContentKeySession): rename method.
* platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
(WebCore::CDMSessionAVStreamSession::~CDMSessionAVStreamSession): rename method.
(WebCore::CDMSessionAVStreamSession::update): rename method.
* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm: rename method.
(WebCore::CDMSessionMediaSourceAVFObjC::addSourceBuffer): rename method.
(WebCore::CDMSessionMediaSourceAVFObjC::removeSourceBuffer): rename method.
* platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.h: rename method, remove
now unused member.
* platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::removeCodedFrames): Postpone call to ensure
we are running the remove frame algorithm once all pending frames have been processed.
(WebCore::SourceBufferParserAVFObjC::resetParserState): Remove use of m_discardSamplesUntilNextInitializationSegment.
(WebCore::SourceBufferParserAVFObjC::didParseStreamDataAsAsset): Change to base dispatch method.
(WebCore::SourceBufferParserAVFObjC::didFailToParseStreamDataWithError): Change to base dispatch method.
(WebCore::SourceBufferParserAVFObjC::didProvideMediaDataForTrackID): Change to base dispatch method.
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: Rename methods. Remove no longer used
members.
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::didParseInitializationData): No longer use a Cancellable task
as we never cancel it anymore.
(WebCore::SourceBufferPrivateAVFObjC::append): re-schedule the append task immediately to ensure
that processed packets flushed on the parser queue during abort are handled in the right order on
the main thread.
(WebCore::SourceBufferPrivateAVFObjC::appendCompleted): Check that abort wasn't called since append started
to ensure that no updateend event is incorrectly fired twice.
(WebCore::SourceBufferPrivateAVFObjC::abort): Abort is now a no-op that only set the m_abortCalled member.
(WebCore::SourceBufferPrivateAVFObjC::resetParserState): Change the order of operations so that the
SourceBufferParser is only reset after it has finished processing its data.
(WebCore::SourceBufferPrivateAVFObjC::destroyStreamDataParser): Use rename method.
(WebCore::SourceBufferPrivateAVFObjC::removedFromMediaSource): Use rename method.
(WebCore::SourceBufferPrivateAVFObjC::streamDataParser const): Renamed method from "parser"
(WebCore::SourceBufferPrivateAVFObjC::attemptToDecrypt): Use renamed method.
* platform/graphics/cocoa/SourceBufferParser.cpp:
(WebCore::callOnMainThreadCallback): Move dispatch method from SourceBufferParserWebM
(WebCore::SourceBufferParser::setCallOnClientThreadCallback):
(WebCore::SourceBufferParser::SourceBufferParser):
* platform/graphics/cocoa/SourceBufferParser.h:
* platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::SourceBufferParserWebM::SourceBufferParserWebM):
(WebCore::SourceBufferParserWebM::resetParserState): Don't clear the data set by parsing
the previous init segment. Set the parsing state to waiting for a new segment if an
init segment has been fully parsed.
(WebCore::SourceBufferParserWebM::OnElementEnd):
(WebCore::SourceBufferParserWebM::OnEbml):
(WebCore::SourceBufferParserWebM::VideoTrackData::reset):
(WebCore::SourceBufferParserWebM::VideoTrackData::consumeFrameData):
(WebCore::SourceBufferParserWebM::AudioTrackData::reset):
* platform/graphics/cocoa/SourceBufferParserWebM.h:
2021-07-13 Alex Christensen <achristensen@webkit.org>
>4K Referer should have tailing /
https://bugs.webkit.org/show_bug.cgi?id=227795
Reviewed by Chris Dumez.
This matches the behavior of other browsers.
Covered by existing tests and web platform tests we haven't imported yet.
* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::setHTTPReferrer):
2021-07-13 Said Abou-Hallawa <said@apple.com>
[CG] REGRESSION(r278863): The destination rectangle is truncated when the sub-image is used
https://bugs.webkit.org/show_bug.cgi?id=227614
<rdar://79840643>
Reviewed by Simon Fraser.
This patch gets the calculation of the destRect in the case of the sub-
image as it was before r278863.
The size of the destRect has to be equal to the backend size of the
ImageBuffer in logical coordinates.
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::drawNativeImage):
2021-07-13 Kyle Piddington <kpiddington@apple.com>
rAF driven WebGL submits excessive amount of GPU work when frames are slow
https://bugs.webkit.org/show_bug.cgi?id=227059
Reviewed by Dean Jackson.
Advertise GL_ARB_sync for the Metal backend.
Since GL_ARB_sync is core in OpenGL ES 3.0 and the Metal backend advertises OpenGL ES 3.0,
the API must be working already.
Limit in-flight WebGL frames to three frames. Do not continue preparation for display
until the commands for the oldest frame have been executed by the GPU.
This limits the impact slow frames have, especially in the
case where the compositor skip frames and WebKit would issue a new slow frame
on top of the skipped frame.
An additional change ensures that Nvidia configs, which do not support MTLEvents
to a level of conformance required (See http://crbug.com/1136673), continue to run. The more powerful eGPUs will not experience throttling to the same level as integrated GPUS.
* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/GraphicsContextGLAttributes.h:
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::waitAndUpdateOldestFrame):
* platform/graphics/angle/GraphicsContextGLANGLEUtilities.h:
(WebCore::ScopedGLFence::ScopedGLFence):
(WebCore::ScopedGLFence::~ScopedGLFence):
(WebCore::ScopedGLFence::operator=):
(WebCore::ScopedGLFence::reset):
(WebCore::ScopedGLFence::abandon):
(WebCore::ScopedGLFence::fenceSync):
(WebCore::ScopedGLFence::operator GLsync const):
(WebCore::ScopedGLFence::operator bool const):
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::InitializeEGLDisplay):
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
(WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):
(WebCore::GraphicsContextGLOpenGL::prepareForDisplay):
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
2021-07-13 Chris Dumez <cdumez@apple.com>
Revoking Blob URL after calling XMLHttpRequest::open() causes the XHR to fail
https://bugs.webkit.org/show_bug.cgi?id=227821
Reviewed by Alex Christensen.
Revoking Blob URL after calling XMLHttpRequest::open() causes the XHR to fail. This doesn't match the behavior of
other browsers and is causing WebKit to fail one of the subtests on:
- http://wpt.live/FileAPI/url/url-with-xhr.any.html
XMLHttpRequest::open() now extends the lifetime of the Blob URL as necessary in order to complete the load.
No new tests, rebaselined existing tests.
* fileapi/BlobURL.cpp:
(WebCore::URLWithBlobURLLifetimeExtension::URLWithBlobURLLifetimeExtension):
(WebCore::URLWithBlobURLLifetimeExtension::~URLWithBlobURLLifetimeExtension):
* fileapi/BlobURL.h:
(WebCore::BlobURLLifeTimeExtender::url const):
* loader/PolicyChecker.cpp:
(WebCore::FrameLoader::PolicyChecker::extendBlobURLLifetimeIfNecessary const):
(WebCore::FrameLoader::PolicyChecker::checkNavigationPolicy):
* loader/PolicyChecker.h:
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::XMLHttpRequest):
(WebCore::XMLHttpRequest::setResponseType):
(WebCore::XMLHttpRequest::open):
(WebCore::XMLHttpRequest::prepareToSend):
(WebCore::XMLHttpRequest::send):
(WebCore::XMLHttpRequest::createRequest):
* xml/XMLHttpRequest.h:
2021-07-13 Philippe Normand <pnormand@igalia.com>
[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-07-13 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK][WPE] Expose support for client certificate auth
https://bugs.webkit.org/show_bug.cgi?id=200805
Reviewed by Michael Catanzaro.
* platform/Soup.cmake:
* platform/SourcesSoup.txt:
* platform/network/Credential.h:
* platform/network/ProtectionSpaceBase.cpp:
(WebCore::ProtectionSpaceBase::isPasswordBased const):
* platform/network/ProtectionSpaceBase.h:
* platform/network/soup/AuthenticationChallenge.h:
* platform/network/soup/AuthenticationChallengeSoup.cpp:
(WebCore::protectionSpaceForClientCertificate):
(WebCore::AuthenticationChallenge::AuthenticationChallenge):
(WebCore::protectionSpaceForClientCertificatePassword):
(WebCore::AuthenticationChallenge::platformCompare):
* platform/network/soup/CertificateInfoSoup.cpp:
(WebCore::CertificateInfo::isolatedCopy const):
* platform/network/soup/CredentialSoup.cpp: Added.
(WebCore::Credential::Credential):
(WebCore::m_certificate):
(WebCore::Credential::isEmpty const):
(WebCore::Credential::platformCompare):
* platform/network/soup/CredentialSoup.h: Added.
(WebCore::Credential::Credential):
(WebCore::Credential::encodingRequiresPlatformData const):
(WebCore::Credential::certificate const):
* platform/network/soup/NetworkStorageSessionSoup.cpp:
(WebCore::authTypeFromProtectionSpaceAuthenticationScheme):
2021-07-13 Martin Robinson <mrobinson@igalia.com>
RenderLayerScrollableArea::updateScrollPosition assumes that it can scroll to the targeted scroll position
https://bugs.webkit.org/show_bug.cgi?id=227803
Reviewed by Simon Fraser.
No new tests. This is covered by an existing WPT test:
- web-platform-tests/css/css-scroll-snap/nested-scrollIntoView-snaps.html
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::scrollToOffset): Modified this method to return the snapped
scroll offset.
(WebCore::RenderLayerScrollableArea::updateScrollPosition): Instead of using the original target offset,
use the return value from scrollToOffset to adjust the output rectangle.
* rendering/RenderLayerScrollableArea.h: Update the method definition.
2021-07-13 Myles C. Maxfield <mmaxfield@apple.com>
PUA characters have the wrong advance in the fast text codepath
https://bugs.webkit.org/show_bug.cgi?id=227896
<rdar://problem/80037103>
Reviewed by Tim Horton.
There were 2 problems:
1. We were passing a UChar32 to this function:
static bool treatAsSpace(UChar c) { return c == ' ' ... }
This means that passing in U+10020 erroneously returns true
2. Because of https://bugs.webkit.org/show_bug.cgi?id=221356,
if the prevous character is in SMP, our logic to determine
the previous advance would erroneously return 0.
Test: fast/text/pua-charactersTreatedAsSpace.html
* platform/graphics/FontCascade.h:
(WebCore::FontCascade::treatAsSpace):
(WebCore::FontCascade::treatAsZeroWidthSpace):
(WebCore::FontCascade::treatAsZeroWidthSpaceInComplexScript):
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advanceInternal):
2021-07-13 Myles C. Maxfield <mmaxfield@apple.com>
Fix the Apple internal iOS Simulator build
Unreviewed.
* dom/Node.h:
2021-07-12 Fujii Hironori <Hironori.Fujii@sony.com>
[curl] Can't finish loading some websites after r271946 started throttling low priority resources
https://bugs.webkit.org/show_bug.cgi?id=227863
Reviewed by Don Olmstead.
NetworkLoadScheduler started throttling low priority resource
loading since r271946. It uses curl_easy_pause to pause the
resource loads. CURLMOPT_MAX_HOST_CONNECTIONS is set to 6 to limit
the number of connections per host. In the certain condition,
curl_multi_fdset can constantly return -1 if 6 handles of the same
host are paused.
This patch changes CurlRequest::start not to actually start the
job if it is suspended.
* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::start):
(WebCore::CurlRequest::suspend):
(WebCore::CurlRequest::resume):
(WebCore::CurlRequest::setupTransfer):
(WebCore::CurlRequest::setRequestPaused):
* platform/network/curl/CurlRequest.h:
2021-07-12 Tim Horton <timothy_horton@apple.com>
BifurcatedGraphicsContext can't draw text
https://bugs.webkit.org/show_bug.cgi?id=227883
Reviewed by Wenson Hsieh.
API test: BifurcatedGraphicsContextTests.TextInBifurcatedContext
* platform/graphics/BifurcatedGraphicsContext.cpp:
(WebCore::BifurcatedGraphicsContext::save):
(WebCore::BifurcatedGraphicsContext::restore):
(WebCore::BifurcatedGraphicsContext::paintFrameForMedia):
(WebCore::BifurcatedGraphicsContext::drawText):
(WebCore::BifurcatedGraphicsContext::drawGlyphs):
(WebCore::BifurcatedGraphicsContext::drawEmphasisMarks):
(WebCore::BifurcatedGraphicsContext::drawBidiText):
* platform/graphics/BifurcatedGraphicsContext.h:
Bifurcate a few methods I somehow missed in the original patch.
Also, call GraphicsContext's implementation of save and restore
from the overridden version, because we confusingly currently use
the top-level context's state stack.
2021-07-12 Simon Fraser <simon.fraser@apple.com>
Add a StyleSheets log channel and some logging
https://bugs.webkit.org/show_bug.cgi?id=227880
Reviewed by Alan Bujtas.
Add some logging to help debug issues when pages dynamically build style sheets.
Also make Document loggable.
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::insertRule):
(WebCore::CSSStyleSheet::deleteRule):
(WebCore::CSSStyleSheet::addRule):
(WebCore::CSSStyleSheet::debugDescription const):
* css/CSSStyleSheet.h:
* css/StyleSheet.cpp:
(WebCore::operator<<):
* css/StyleSheet.h:
* dom/Document.cpp:
(WebCore::Document::debugDescription const):
(WebCore::operator<<):
* dom/Document.h:
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::process):
(WebCore::HTMLLinkElement::debugDescription const):
* html/HTMLLinkElement.h:
* platform/Logging.h:
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::dumpProperties const):
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::imageBufferResult):
* style/StyleScope.cpp:
(WebCore::Style::Scope::addPendingSheet):
(WebCore::Style::Scope::addStyleSheetCandidateNode):
(WebCore::Style::Scope::collectActiveStyleSheets):
(WebCore::Style::Scope::updateActiveStyleSheets):
* xml/XSLStyleSheet.h:
* xml/XSLStyleSheetLibxslt.cpp:
(WebCore::XSLStyleSheet::debugDescription const):
2021-07-12 Chris Dumez <cdumez@apple.com>
Unreviewed, partial revert of r279661 to address crashes on iOS Debug.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::removeAllEventListeners):
2021-07-12 Wenson Hsieh <wenson_hsieh@apple.com>
[watchOS] Make a few additional adjustments to support system minimum layout margins
https://bugs.webkit.org/show_bug.cgi?id=227859
rdar://80113612
Reviewed by Tim Horton.
Reduce the default minimum viewport scale on watchOS to avoid horizontal scrolling when loading wide fixed-
viewport-width web content. See WebKit ChangeLog for more details.
* page/ViewportConfiguration.cpp:
(WebCore::platformDeviceWidthOverride):
(WebCore::platformMinimumScaleForWebpage):
(WebCore::shouldOverrideShrinkToFitArgument):
(WebCore::ViewportConfiguration::nativeWebpageParametersWithShrinkToFit):
(WebCore::ViewportConfiguration::webpageParameters):
2021-07-12 Tyler Wilcock <twilco.o@protonmail.com>
AX: Add ARIA role "image" as a new role, and leave "img" as a synonym
https://bugs.webkit.org/show_bug.cgi?id=224615
Reviewed by Chris Fleizach.
Test: accessibility/image-role-is-synonomous-with-img-role.html
* accessibility/AccessibilityObject.cpp:
(WebCore::initializeRoleMap):
Add "image" ARIA role as a synonym for the "img" ARIA role, both of
which map to the AccessibilityRole::Image WebCore representation.
Also hardcode the ARIA reverse role map to return "image" for
the AccessibilityRole::Image key.
2021-07-12 Alexander Mikhaylenko <alexm@gnome.org>
[GTK][WPE] Support drawing scrollbar corner
https://bugs.webkit.org/show_bug.cgi?id=227868
Reviewed by Michael Catanzaro.
With dark scrollbars supported, the lack of scroll corner for non-overlay
scrollbars becomes very noticeable. Implement it.
To properly draw them, we need to know whether scrollbars are dark, and whether
the vertical scrollbar is on the left. Hence, pass ScrollableArea to
paintScrollCorner() so we can query it.
Only cover non-system scrollbars, it would take considerable amount of work to
make it work for system as well.
* platform/ScrollView.cpp:
(WebCore::ScrollView::paintScrollCorner):
* platform/ScrollbarTheme.h:
(WebCore::ScrollbarTheme::paintScrollCorner):
(WebCore::ScrollbarTheme::defaultPaintScrollCorner):
* platform/adwaita/ScrollbarThemeAdwaita.cpp:
(WebCore::ScrollbarThemeAdwaita::paintScrollCorner):
* platform/adwaita/ScrollbarThemeAdwaita.h:
* platform/mac/ScrollbarThemeMac.h:
* platform/mac/ScrollbarThemeMac.mm:
(WebCore::ScrollbarThemeMac::paintScrollCorner):
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::paintScrollCorner):
* rendering/RenderScrollbarTheme.cpp:
(WebCore::RenderScrollbarTheme::paintScrollCorner):
* rendering/RenderScrollbarTheme.h:
2021-07-12 Carlos Alberto Lopez Perez <clopez@igalia.com>
Unreviewed, reverting r279778.
It caused unexpected text diffs on http/tests/storageAccess
tests
Reverted changeset:
"[GTK][WPE][libsoup] Test imported/w3c/web-platform-
tests/cookies/samesite/about-blank-toplevel.https.html crashes
since it was imported"
https://bugs.webkit.org/show_bug.cgi?id=227819
https://commits.webkit.org/r279778
2021-07-12 Alexander Mikhaylenko <alexm@gnome.org>
[GTK][WPE] Match Adwaita scrollbars more closely
https://bugs.webkit.org/show_bug.cgi?id=227870
Reviewed by Michael Catanzaro.
Adjust the dimensions to match GTK as closely as possible.
* platform/adwaita/ScrollbarThemeAdwaita.cpp:
(WebCore::ScrollbarThemeAdwaita::paint):
2021-07-12 Alexander Mikhaylenko <alexm@gnome.org>
[GTK] Adwaita entries should follow the system cursor blink settings
https://bugs.webkit.org/show_bug.cgi?id=227856
Reviewed by Adrian Perez de Castro.
Get the caret blink interval from GtkSettings if available, same as it was done
for the GTK theme before.
* rendering/RenderThemeAdwaita.cpp:
(WebCore::RenderThemeAdwaita::caretBlinkInterval const):
* rendering/RenderThemeAdwaita.h:
2021-07-12 Alexander Mikhaylenko <alexm@gnome.org>
[GTK4] Scrollbar click doesn't work as expected when native scrollbars are off
https://bugs.webkit.org/show_bug.cgi?id=226331
Reviewed by Carlos Garcia Campos.
Make Adwaita scrollbar theme follow the GTK setting if possible.
* platform/adwaita/ScrollbarThemeAdwaita.cpp:
(WebCore::ScrollbarThemeAdwaita::handleMousePressEvent):
2021-07-11 Chris Dumez <cdumez@apple.com>
:link and :visited pseudo-class selectors should not match <link> elements
https://bugs.webkit.org/show_bug.cgi?id=227847
Reviewed by Sam Weinig.
:link, :visited and :any-link should only match <a> and <area> elements as per:
- https://drafts.csswg.org/selectors/#the-any-link-pseudo
Blink and Gecko match the specification. However, WebKit was incorrectly matching
<link> elements too.
No new tests, rebaselined existing tests.
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::parseAttribute):
2021-07-11 Chris Dumez <cdumez@apple.com>
XMLSerializer.serializeToString() doesn't properly escape \n, \n and \t
https://bugs.webkit.org/show_bug.cgi?id=227844
Reviewed by Darin Adler.
XMLSerializer.serializeToString() doesn't properly escape \n, \n and \t.
This is causing the "check XMLSerializer.serializeToString escapes attribute values for roundtripping" subtest to fail in WebKit on:
http://wpt.live/domparsing/XMLSerializer-serializeToString.html
Chrome and Firefox both escape these and pass this WPT subtest.
The specification does not indicate we should escape those:
- https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value
But there is an open bug about this:
- https://github.com/w3c/DOM-Parsing/issues/59
No new tests, rebaselined existing test.
* editing/MarkupAccumulator.cpp:
(WebCore::elementCannotHaveEndTag):
* editing/MarkupAccumulator.h:
2021-07-10 Chris Dumez <cdumez@apple.com>
document.readyState should be "complete" after calling DOMParser.parseFromString()
https://bugs.webkit.org/show_bug.cgi?id=227846
Reviewed by Ryosuke Niwa.
document.readyState should be "complete" after calling DOMParser.parseFromString().
This is causing the following WPT test to fail in WebKit:
http://wpt.live/domparsing/xmldomparser.html
Both Gecko and Blink report the correct readyState here.
No new tests, rebaselined existing test.
* dom/Document.cpp:
(WebCore::Document::explicitClose):
explicitClose() normally calls checkCompleted() which calls FrameLoader::checkCompleted(),
which ends up setting the document's ready state to "complete" and then calling
Document::implicitClose(). However, when the document has no frame (which is the case
for a document just created via DOMParser.parseFromString()), we would call
Document::implicitClose() directly, since we don't have a FrameLoader. As a result,
the document's ready state would stay "interactive". To address the issue, we now set
the document's ready state to "complete" before calling implicitClose(), similarly to
what FrameLoader::checkCompleted() would have done.
2021-07-10 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r279803.
https://bugs.webkit.org/show_bug.cgi?id=227850
Introduce many crashes on AS-mac Debug bot
Reverted changeset:
"document.readyState should be "complete" after calling
DOMParser.parseFromString()"
https://bugs.webkit.org/show_bug.cgi?id=227846
https://commits.webkit.org/r279803
2021-07-09 Chris Dumez <cdumez@apple.com>
document.readyState should be "complete" after calling DOMParser.parseFromString()
https://bugs.webkit.org/show_bug.cgi?id=227846
Reviewed by Ryosuke Niwa.
document.readyState should be "complete" after calling DOMParser.parseFromString().
This is causing the following WPT test to fail in WebKit:
http://wpt.live/domparsing/xmldomparser.html
Both Gecko and Blink report the correct readyState here.
No new tests, rebaselined existing test.
* dom/Document.cpp:
(WebCore::Document::explicitClose):
explicitClose() normally calls checkCompleted() which calls FrameLoader::checkCompleted(),
which ends up setting the document's ready state to "complete" and then calling
Document::implicitClose(). However, when the document has no frame (which is the case
for a document just created via DOMParser.parseFromString()), we would call
Document::implicitClose() directly, since we don't have a FrameLoader. As a result,
the document's ready state would stay "interactive". To address the issue, we now set
the document's ready state to "complete" before calling implicitClose(), similarly to
what FrameLoader::checkCompleted() would have done.
2021-07-09 Chris Dumez <cdumez@apple.com>
[ITP] Improve ResourceLoadStatisticsDatabaseStore's buildList() and use it in more places
https://bugs.webkit.org/show_bug.cgi?id=227843
Reviewed by Sam Weinig.
Support passing a RegistrableDomain directly to StringBuilder::append().
* platform/RegistrableDomain.h:
2021-07-09 Ryosuke Niwa <rniwa@webkit.org>
ResizeObserver / IntersectionObserver memory leak on detached & out of reference elements
https://bugs.webkit.org/show_bug.cgi?id=227194
<rdar://problem/79839851>
Reviewed by Chris Dumez.
The memory leak was caused by ResizeObserver and IntersectionObserver keeping their respective
JS wrapper objects alive so long as there are some observed elements by having pending
activity as ActiveDOMObjects. This is not the right GC model for these JS wrapper objects
since there is no obvious end to these activities. So long as the observed nodes are alive,
ResizeObserver and IntersectionObserver may get new observation entries queued later.
To address this issue, this patch reworks the way ResizeObserver and IntersectionObserver keep
their JS wrappers alive. Namely, they're no longer ActiveDOMObjects. Instead, their JS wrappers
would use their respective observed nodes as opaque roots. i.e. so long as any of the observed
nodes are kept alive by GC, then its observer's JS wrapper is kept alive.
ResizeObserver had an additional bug that every observed node was kept using GCReachableRef,
which obviously leaked every observed node until the observations were explicitly cleared.
This patch makes only the target elements of the active observations (i.e. there are entries
to be delivered to the observer callback) are kept alive with GCReachableRef as done with
IntersectionObserver and MutationObserver.
Finally, this patch fixes the bug that IntersectionObserver wasn't keeping its root node alive.
We even had a test which was testing this erroneously behavior. The test has been rewritten to
expect the new behavior.
Tests: intersection-observer/intersection-observer-should-not-leak-observed-nodes.html
intersection-observer/root-element-deleted.html
resize-observer/resize-observer-should-not-leak-observed-nodes.html
* bindings/js/JSIntersectionObserverCustom.cpp:
(WebCore::JSIntersectionObserver::visitAdditionalChildren): Add the root node as an opaque root.
This has an effect of keeping the root node alive so long as IntersectionObserver is alive.
(WebCore::JSIntersectionObserverOwner::isReachableFromOpaqueRoots): Added.
* bindings/js/JSResizeObserverCustom.cpp:
(WebCore::JSResizeObserverOwner::isReachableFromOpaqueRoots): Added.
* dom/Document.cpp:
(WebCore::Document::updateIntersectionObservations):
* html/LazyLoadFrameObserver.cpp:
(WebCore::LazyLoadFrameObserver::isObserved const):
* html/LazyLoadImageObserver.cpp:
(WebCore::LazyLoadImageObserver::isObserved const):
* page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::create):
(WebCore::IntersectionObserver::IntersectionObserver):
(WebCore::IntersectionObserver::~IntersectionObserver):
(WebCore::IntersectionObserver::isObserving const): Added.
(WebCore::IntersectionObserver::observe):
(WebCore::IntersectionObserver::virtualHasPendingActivity const): Deleted.
(WebCore::IntersectionObserver::activeDOMObjectName const): Deleted.
(WebCore::IntersectionObserver::stop): Deleted.
(WebCore::IntersectionObserver::isReachableFromOpaqueRoots const): Added.
* page/IntersectionObserver.h:
(WebCore::IntersectionObserver::root const):
(WebCore::IntersectionObserver::observationTargets const):
(WebCore::IntersectionObserver::hasObservationTargets const):
* page/IntersectionObserver.idl:
* page/ResizeObservation.cpp:
(WebCore::ResizeObservation::create):
(WebCore::ResizeObservation::ResizeObservation):
(WebCore::ResizeObservation::targetElementDepth const):
* page/ResizeObservation.h:
(WebCore::ResizeObservation::target const):
(WebCore::ResizeObservation): Renamed m_pendingTargets to m_activeObservationTargets to reflect
the new semantics.
* page/ResizeObserver.cpp:
(WebCore::ResizeObserver::ResizeObserver):
(WebCore::ResizeObserver::observe): Don't store the new observation target with GCReachableRef as
that would result in an immediate leak of this element.
(WebCore::ResizeObserver::gatherObservations): Now that we have an active observation (i.e. there
is an entry to be delivered to the JS callback), store the target element using GCReachableRef.
This keeps the JS wrapper of this target element alive between now and when the JS callback is
notified of this element's resize. Without this GCReachableRef, JS wrapper of the element can be
erroneously collected when there is no JS reference to the element and the element is no longer in
any live document. Note that this GC behavior is already tested by existing tests. This patch
simply delays the use of GCReachableRef from when ResizeObserver started observing this element
to when we created an active observation for the element; this is because GCReachableRef like
a pending activity of ActiveDOMObject is only appropriate when there is a definite end to it.
(WebCore::ResizeObserver::isReachableFromOpaqueRoots const): Added.
(WebCore::ResizeObserver::removeAllTargets):
(WebCore::ResizeObserver::removeObservation):
(WebCore::ResizeObserver::virtualHasPendingActivity const): Deleted.
(WebCore::ResizeObserver::activeDOMObjectName const): Deleted.
(WebCore::ResizeObserver::stop): Deleted.
* page/ResizeObserver.h:
* page/ResizeObserver.idl:
2021-07-09 Aditya Keerthi <akeerthi@apple.com>
[iOS] Increase contrast for textfields, checkboxes, and radio buttons
https://bugs.webkit.org/show_bug.cgi?id=227145
<rdar://problem/79470926>
Reviewed by Wenson Hsieh.
Updated textfields, checkboxes, and radio buttons to have a
secondaryLabelColor border, ensuring a higher contrast than the
existing appearance.
Additionally, checkboxes and radio buttons have been updated
to use the system fill color when empty.
* css/html.css:
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::checkboxRadioBorderColor):
(WebCore::RenderThemeIOS::checkboxRadioBackgroundColor):
(WebCore::RenderThemeIOS::paintCheckbox):
(WebCore::RenderThemeIOS::paintRadio):
2021-07-09 Fujii Hironori <Hironori.Fujii@sony.com>
[Cairo][Win] Remove unneeded GraphicsContextPlatformPrivate
https://bugs.webkit.org/show_bug.cgi?id=227828
Reviewed by Don Olmstead.
GraphicsContextPlatformPrivate keeps HDC's transform syncing with
GraphicsContext's transform. However, WinCairo doesn't use it.
* platform/graphics/BifurcatedGraphicsContext.cpp:
* platform/graphics/BifurcatedGraphicsContext.h:
* platform/graphics/GraphicsContext.h:
* platform/graphics/NullGraphicsContext.h:
* platform/graphics/cairo/CairoOperations.cpp:
(WebCore::Cairo::State::setCTM):
(WebCore::Cairo::translate):
(WebCore::Cairo::rotate):
(WebCore::Cairo::scale):
(WebCore::Cairo::concatCTM):
(WebCore::Cairo::clip):
(WebCore::Cairo::clipPath):
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContextCairo::GraphicsContextCairo):
(WebCore::GraphicsContextCairo::save):
(WebCore::GraphicsContextCairo::restore):
(WebCore::GraphicsContextCairo::graphicsContextPrivate): Deleted.
* platform/graphics/cairo/GraphicsContextCairo.h:
* platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h: Removed.
* platform/graphics/win/GraphicsContextCairoWin.cpp:
(WebCore::GraphicsContext::releaseWindowsContext):
(WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate): Deleted.
(WebCore::GraphicsContextPlatformPrivate::flush): Deleted.
(WebCore::GraphicsContextCairo::deprecatedPrivateContext const): Deleted.
* platform/graphics/win/GraphicsContextWin.cpp:
(WebCore::GraphicsContext::getWindowsContext):
* platform/win/DragImageCairoWin.cpp:
2021-07-09 Myles C. Maxfield <mmaxfield@apple.com>
SVGImageForContainer reports true for is<SVGImage>() but it doesn't inherit from SVGImage
https://bugs.webkit.org/show_bug.cgi?id=227807
Reviewed by Said Abou-Hallawa.
It's too easy to write code like:
if (is<SVGImage>(image))
downcast<SVGImage>(image).doSomething();
Test: SVGImageCasts.SVGImageForContainerIsNotSVGImage
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::remoteSVGRootElement const):
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::effectiveImageDevicePixelRatio const):
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::drawImage):
(WebCore::CanvasRenderingContext2DBase::createPattern):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::texImageSourceHelper):
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::imageForRenderer):
(WebCore::CachedImage::hasSVGImage const):
(WebCore::CachedImage::setContainerContextForClient):
(WebCore::CachedImage::imageSizeForRenderer const):
* platform/graphics/CrossfadeGeneratedImage.cpp:
(WebCore::drawCrossfadeSubimage):
* platform/graphics/Image.cpp:
(WebCore::operator<<):
* platform/graphics/Image.h:
(WebCore::Image::isSVGImageForContainer const):
(WebCore::Image::actsLikeSVGImage const):
* platform/graphics/ImageObserver.h:
* svg/graphics/SVGImage.h:
* svg/graphics/SVGImageForContainer.cpp:
(WebCore::SVGImageForContainer::SVGImageForContainer):
* svg/graphics/SVGImageForContainer.h:
2021-07-09 Said Abou-Hallawa <said@apple.com>
SVGInlineTextBox::acquirePaintingResource() should return false if the resource can't be applied
https://bugs.webkit.org/show_bug.cgi?id=227826
<rdar://79662757>
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-09 Alan Bujtas <zalan@apple.com>
[LFC][IFC] Negative padding values are invalid (inline box)
https://bugs.webkit.org/show_bug.cgi?id=227838
Reviewed by Antti Koivisto.
Negative values for padding properties are invalid.
https://drafts.csswg.org/css-box/#padding-physical
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForChild):
2021-07-09 Chris Dumez <cdumez@apple.com>
[WebCrypto] deriveBits() incorrectly throws for PBKDF2 algorithm when the password is empty
https://bugs.webkit.org/show_bug.cgi?id=227810
Reviewed by Yusuke Suzuki.
deriveBits() was incorrectly throwing for PBKDF2 algorithm when the provided password was empty.
The reason for that was that we would pass a null key pointer to CCKeyDerivationPBKDF() in this
case and it was causing CCKeyDerivationPBKDF() to return an error, even though the key length is
0. To avoid this issue, we now pass an empty string as key to CCKeyDerivationPBKDF() instead of
a null pointer, when the length is 0.
This is causing Safari to fail subtests in the following WPT test:
- https://wpt.live/WebCryptoAPI/derive_bits_keys/pbkdf2.https.any.html?5001-6000
Empty passwords are supported by both Chrome and Firefox.
No new tests, rebaselined existing tests.
* crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
(WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2021-07-09 Jer Noble <jer.noble@apple.com>
[Cocoa] Make Coordinator playback commands more precise
https://bugs.webkit.org/show_bug.cgi?id=227756
Reviewed by Eric Carlson.
Add support for precise playback commands from MediaSessionCoordinator to the underlying MediaPlayer.
In the case where a play() command is issued to a HTMLMediaElement and:
- There is an active MediaSession
- The MediaSession's active HTMLMediaElement is the current one
- There is a pending playSession command
- That command has a hostTime parameter
- The MediaPlayer backing the element supports playing at a specific host time
Then use the MediaPlayer's playAtHostTime() facility to begin playback, synchronized with the specified
hostTime.
Add support for playAtHostTime() to both MediaPlayerPrivateAVFoundationObjC and MediaPlayerPrivateMediaSourceAVFObjC.
* Modules/mediasession/MediaSession.h:
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::playSession):
* Modules/mediasession/MediaSessionCoordinator.h:
(WebCore::MediaSessionCoordinator::currentPlaySessionCommand const):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updatePlayState):
(WebCore::HTMLMediaElement::playPlayer):
(WebCore::HTMLMediaElement::pausePlayer):
* html/HTMLMediaElement.h:
* html/MediaElementSession.h:
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::supportsPlayAtHostTime const):
(WebCore::MediaPlayer::supportsPauseAtHostTime const):
(WebCore::MediaPlayer::playAtHostTime):
(WebCore::MediaPlayer::pauseAtHostTime):
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::supportsPlayAtHostTime const):
(WebCore::MediaPlayerPrivateInterface::supportsPauseAtHostTime const):
(WebCore::MediaPlayerPrivateInterface::playAtHostTime):
(WebCore::MediaPlayerPrivateInterface::pauseAtHostTime):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::playAtHostTime):
(WebCore::MediaPlayerPrivateAVFoundationObjC::pauseAtHostTime):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setPlayerRate):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pauseInternal):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playAtHostTime):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pauseAtHostTime):
2021-07-09 Yusuke Suzuki <ysuzuki@apple.com>
Add BigInt64Array and BigUint64Array support to crypto.getRandomValues
https://bugs.webkit.org/show_bug.cgi?id=227611
Reviewed by Chris Dumez.
Tests: imported/w3c/web-platform-tests/WebCryptoAPI/getRandomValues-bigint.tentative.any.html
imported/w3c/web-platform-tests/WebCryptoAPI/getRandomValues-bigint.tentative.any.worker.html
This patch updates crypto.getRandomValues so that this function can take BigInt64Array / BigUint64Array.
We also add BigInt64Array / BigUint64Array IDL support.
* bindings/js/JSDOMConvertBufferSource.h:
(WebCore::toPossiblySharedBigInt64Array):
(WebCore::toPossiblySharedBigUint64Array):
(WebCore::toUnsharedBigInt64Array):
(WebCore::toUnsharedBigUint64Array):
(WebCore::JSConverter<IDLFloat64Array>::convert):
(WebCore::Converter<IDLBigInt64Array>::convert):
(WebCore::JSConverter<IDLBigInt64Array>::convert):
(WebCore::Converter<IDLBigUint64Array>::convert):
* bindings/scripts/CodeGenerator.pm:
* bindings/scripts/CodeGeneratorJS.pm:
(GetBaseIDLType):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjDOMConstructor::construct):
(WebCore::jsTestObjPrototypeFunction_bigInt64Body):
(WebCore::JSC_DEFINE_HOST_FUNCTION):
(WebCore::jsTestObjPrototypeFunction_bigUint64Body):
(WebCore::jsTestObjPrototypeFunction_bigInt64AllowSharedBody):
(WebCore::jsTestObjPrototypeFunction_bigUint64AllowSharedBody):
* bindings/scripts/test/TestObj.idl:
* page/Crypto.cpp:
(WebCore::Crypto::getRandomValues):
2021-07-09 Tim Nguyen <ntim@apple.com>
Make topLayerElements() use Ref instead of RefPtr
https://bugs.webkit.org/show_bug.cgi?id=227839
Reviewed by Youenn Fablet.
* dom/Document.cpp:
(WebCore::Document::addToTopLayer):
(WebCore::Document::removeFromTopLayer):
(WebCore::Document::activeModalDialog const):
* dom/Document.h:
(WebCore::Document::topLayerElements const):
2021-07-09 Alexander Mikhaylenko <alexm@gnome.org>
[GTK] Support dark scrollbars
https://bugs.webkit.org/show_bug.cgi?id=227834
Reviewed by Michael Catanzaro.
Also adjust the colors in light variant to be closer to the GTK scrollbars, and
remove an unused variable.
Unfortunately this leaves the scrollbar corner when non-overlay scrollbars are used,
but it was already broken for light scrollbars as well.
* platform/adwaita/ScrollbarThemeAdwaita.cpp:
(WebCore::ScrollbarThemeAdwaita::updateScrollbarOverlayStyle):
(WebCore::ScrollbarThemeAdwaita::paint):
* platform/adwaita/ScrollbarThemeAdwaita.h:
2021-07-09 Tim Nguyen <ntim@apple.com>
Add topLayerElements() and activeModalDialog() to Document
https://bugs.webkit.org/show_bug.cgi?id=227800
Reviewed by Antti Koivisto.
These DOM methods are a pre-requisite for a lot of dialog element accessibility work, aside from
the top layer rendering work.
* dom/Document.cpp:
(WebCore::Document::addToTopLayer):
(WebCore::Document::removeFromTopLayer):
(WebCore::Document::activeModalDialog const):
* dom/Document.h:
(WebCore::Document::topLayerElements const):
* dom/Element.cpp:
(WebCore::Element::removedFromAncestor):
* html/HTMLDialogElement.cpp:
(WebCore::HTMLDialogElement::showModal):
(WebCore::HTMLDialogElement::close):
(WebCore::HTMLDialogElement::parseAttribute):
2021-07-09 Carlos Alberto Lopez Perez <clopez@igalia.com>
[GTK][WPE][libsoup] Test imported/w3c/web-platform-tests/cookies/samesite/about-blank-toplevel.https.html crashes since it was imported
https://bugs.webkit.org/show_bug.cgi?id=227819
Reviewed by Carlos Garcia Campos.
Add missings null-checks to avoid calling soup_cookie_jar_get_cookie_list_with_same_site_info()
with a null pointer in site_for_cookies argument.
Covered by existing tests.
* platform/network/soup/NetworkStorageSessionSoup.cpp:
(WebCore::NetworkStorageSession::getRawCookies const):
(WebCore::cookiesForSession):
2021-07-08 Kate Cheney <katherine_cheney@apple.com>
Unreviewed iOS build fix after
https://trac.webkit.org/changeset/279749/webkit.
* page/PointerCaptureController.cpp:
(WebCore::PointerCaptureController::dispatchEventForTouchAtIndex):
2021-07-08 Yusuke Suzuki <ysuzuki@apple.com>
Fix StructuredClone for streams to handle BigInt64Array / BigUint64Array
https://bugs.webkit.org/show_bug.cgi?id=227571
Reviewed by Chris Dumez.
While we already support BigInt64Array / BigUint64Array handling even in DOM code,
we lack support of them only in fetch's structuredClone code (which is specialized one
to make it fast by bypassing serialization / deserialization).
This patch fixes the issue to complete BigInt64Array / BigUint64Array in all DOM code.
* Modules/streams/ReadableStreamInternals.js:
(readableStreamTeePullFunction):
(doStructuredClone): Deleted.
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::addBuiltinGlobals):
* bindings/js/StructuredClone.cpp:
(WebCore::JSC_DEFINE_HOST_FUNCTION):
* bindings/js/StructuredClone.h:
* bindings/js/WebCoreBuiltinNames.h:
2021-07-08 Chris Dumez <cdumez@apple.com>
Make sure SVG SMIL animations do not run in processes without any pages
https://bugs.webkit.org/show_bug.cgi?id=227720
<rdar://79625708>
Reviewed by Simon Fraser.
Make sure SVG SMIL animations do not run in processes without any pages.
We have seen traces / logging indicating that SVG SMIL animations may run in cached WebProcesses, thus
using CPU unnecessarily. Cached WebProcesses have no WebPage so this patch adds assertions to catch cases
where those animations run when there is no Page (and early returns in release to avoid doing unnecessary
work).
* page/Page.cpp:
(WebCore::Page::nonUtilityPageCount):
(WebCore::m_httpsUpgradeEnabled):
(WebCore::Page::~Page):
(WebCore::Page::isOnlyNonUtilityPage const):
* page/Page.h:
* svg/animation/SMILTimeContainer.cpp:
(WebCore::SMILTimeContainer::begin):
(WebCore::SMILTimeContainer::resume):
(WebCore::SMILTimeContainer::setElapsed):
(WebCore::SMILTimeContainer::startTimer):
(WebCore::SMILTimeContainer::updateAnimations):
2021-07-08 Chris Dumez <cdumez@apple.com>
[IndexedDB] KeyPath validity checks should happen on the cloned value, not the original one
https://bugs.webkit.org/show_bug.cgi?id=227813
Reviewed by Geoffrey Garen.
KeyPath validity checks should happen on the cloned value, not the original one:
- https://www.w3.org/TR/IndexedDB/#add-or-put (Step 11.1)
- https://www.w3.org/TR/IndexedDB/#dom-idbcursor-update (Step 9.1)
This was causing the following WPT test to fail in WebKit:
https://wpt.live/IndexedDB/clone-before-keypath-eval.html
This test is passing in Chrome and Gecko.
No new tests, rebaselined existing test.
* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::update):
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::putForCursorUpdate):
(WebCore::IDBObjectStore::putOrAdd):
* Modules/indexeddb/IDBObjectStore.h:
2021-07-08 Simon Fraser <simon.fraser@apple.com>
Make backingProviderLayerCanIncludeLayer() a member function of BackingSharingState
https://bugs.webkit.org/show_bug.cgi?id=227818
Reviewed by Alan Bujtas.
Minor code refactor, no behavior change.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::BackingSharingState::canIncludeLayer const):
(WebCore::RenderLayerCompositor::computeCompositingRequirements):
(WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
(WebCore::backingProviderLayerCanIncludeLayer): Deleted.
2021-07-08 Ryosuke Niwa <rniwa@webkit.org>
Remove more custom binding code with GenerateAddOpaqueRoot
https://bugs.webkit.org/show_bug.cgi?id=227789
Reviewed by Chris Dumez.
Use GenerateAddOpaqueRoot extended IDL option to remove more custom bindings code.
Also made GenerateAddOpaqueRoot default to use wrapped object's opaqueRoot function.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSAbortControllerCustom.cpp: Removed.
* bindings/js/JSAudioTrackCustom.cpp: Removed.
* bindings/js/JSAudioTrackListCustom.cpp: Removed.
* bindings/js/JSTextTrackCustom.cpp: Removed.
* bindings/js/JSTextTrackListCustom.cpp: Removed.
* bindings/js/JSVideoTrackCustom.cpp: Removed.
* bindings/js/JSVideoTrackListCustom.cpp: Removed.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
* dom/AbortController.h:
* dom/AbortController.idl:
* html/track/AudioTrack.idl:
* html/track/AudioTrackList.idl:
* html/track/TextTrack.idl:
* html/track/TextTrackList.idl:
* html/track/TrackBase.cpp:
(WebCore::TrackBase::opaqueRoot): Added.
* html/track/TrackBase.h:
* html/track/TrackListBase.cpp:
(WebCore::TrackListBase::opaqueRoot const): Added.
* html/track/TrackListBase.h:
* html/track/VideoTrack.idl:
* html/track/VideoTrackList.idl:
2021-07-08 Alex Christensen <achristensen@webkit.org>
Fix some whitespace handling issues in URL setters
https://bugs.webkit.org/show_bug.cgi?id=227806
Reviewed by Chris Dumez.
Covered by newly passing wpt tests.
* dom/Element.cpp:
(WebCore::Element::getURLAttribute const):
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::href const):
Don't remove whitespace before giving to completeURL, which will do that for us if it's a valid URL.
If it's not a valid URL, we want the original string, not the trimmed string.
* html/URLDecomposition.cpp:
(WebCore::parsePort):
Parse ports more like the URLParser, which ignores tabs and newlines.
2021-07-08 Cameron McCormack <heycam@apple.com>
Stop GraphicsLayerCA::recursiveCommitChanges recursion once cMaxLayerTreeDepth is reached
https://bugs.webkit.org/show_bug.cgi?id=227738
<rdar://42584284>
Reviewed by Simon Fraser.
To avoid stack overflow in some configurations, stop
recursiveCommitChange recursion when we reach the same level that we
stop hooking up PlatformCALayers. This will leave GraphicsLayerCAs in
the tree with m_uncommittedChanges, but if we ever do another call to
recursiveCommitChange where the GraphicsLayerCA is now at an
appropriate depth (because some ancestors lost their structural
layers, for example), then we'll process the uncommitted changes at
that point.
Pull up the increment of commitState.treeDepth from
commitLayerChangesBeforeSublayers to recursiveCommitChanges so that
the commitLayerChangesBeforeSublayers call for a mask layer doesn't
contribute to the depth count.
Use structuralLayerPurpose() rather than null-checking
m_structuralLayer to determine whether we count an additional depth
level, since m_structuralLayer reflects whether we already have a
structural layer (which may or may not go away), and
structuralLayerPurpose() can tell us whether we will have a structural
layer.
Test: fast/layers/deep-layer-update.html
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::recursiveCommitChanges):
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
2021-07-08 Wenson Hsieh <wenson_hsieh@apple.com>
[Live Text] Selection is misaligned on some images on twitter.com
https://bugs.webkit.org/show_bug.cgi?id=227775
rdar://77142364
Reviewed by Tim Horton.
On Twitter, image thumbnails consist of fully transparent image elements (`opacity: 0;`) that are overlaid over
`div` elements with a background image. The images for some of these transparent image elements sometimes don't
match the background image behind it (namely, the image is stretched to exactly fit the bounds of the
transparent image element in a way that does not preserve aspect ratio, whereas the background image is cropped
to cover the `div`). As such, Live Text in these image elements ends up misaligned against the background image
(which is actually visible to the user).
To address this, special case fully transparent images such that we take a snapshot of the page using the
absolute bounds of the transparent image and run OCR over this snapshot, instead of using the image data as-is.
Test: fast/images/text-recognition/image-overlay-in-transparent-image.html
* html/HTMLElement.cpp:
(WebCore::HTMLElement::containerRectForTextRecognition):
(WebCore::HTMLElement::updateWithTextRecognitionResult):
* html/HTMLElement.h:
* page/Page.cpp:
(WebCore::Page::updateElementsWithTextRecognitionResults):
2021-07-08 Kate Cheney <katherine_cheney@apple.com>
Clean up App Privacy Report code
https://bugs.webkit.org/show_bug.cgi?id=227326
<rdar://problem/79696849>
Reviewed by Brent Fulgham.
Tests: http/tests/app-privacy-report/attribution-load-url.html
http/tests/app-privacy-report/attribution-ping-load.html
http/tests/app-privacy-report/attribution-post-request.html
http/tests/app-privacy-report/attribution-preflight-async.html
http/tests/app-privacy-report/attribution-preflight-sync.html
http/tests/app-privacy-report/attribution-speculative-revalidation.html
Rename App Privacy Report code to better align with the code's purpose
of attributing loads to the app or not. The default value should
be app initiated based on the documentation, so this patch also adjusts
the default value as needed.
* loader/CrossOriginAccessControl.cpp:
(WebCore::createAccessControlPreflightRequest):
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::lastNavigationWasAppInitiated const):
(WebCore::DocumentLoader::setLastNavigationWasAppInitiated):
(WebCore::DocumentLoader::lastNavigationWasAppBound const): Deleted.
(WebCore::DocumentLoader::setLastNavigationWasAppBound): Deleted.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::load):
(WebCore::FrameLoader::updateRequestAndAddExtraFields):
* loader/FrameLoader.h:
* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::setAsIsolatedCopy):
* platform/network/ResourceRequestBase.h:
(WebCore::ResourceRequestBase::isAppInitiated const):
(WebCore::ResourceRequestBase::setIsAppInitiated):
(WebCore::ResourceRequestBase::ResourceRequestBase):
(WebCore::ResourceRequestBase::encodeBase const):
(WebCore::ResourceRequestBase::decodeBase):
(WebCore::ResourceRequestBase::isAppBound const): Deleted.
(WebCore::ResourceRequestBase::setIsAppBound): Deleted.
* testing/ServiceWorkerInternals.cpp:
(WebCore::ServiceWorkerInternals::lastNavigationWasAppInitiated):
(WebCore::ServiceWorkerInternals::lastNavigationWasAppBound): Deleted.
* testing/ServiceWorkerInternals.h:
* testing/ServiceWorkerInternals.idl:
* workers/service/ServiceWorkerClientData.cpp:
(WebCore::ServiceWorkerClientData::isolatedCopy const):
(WebCore::ServiceWorkerClientData::from):
* workers/service/ServiceWorkerClientData.h:
(WebCore::ServiceWorkerClientData::encode const):
(WebCore::ServiceWorkerClientData::decode):
* workers/service/ServiceWorkerContextData.cpp:
(WebCore::ServiceWorkerContextData::isolatedCopy const):
* workers/service/ServiceWorkerContextData.h:
(WebCore::ServiceWorkerContextData::encode const):
(WebCore::ServiceWorkerContextData::decode):
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
(WebCore::ServiceWorkerThreadProxy::setLastNavigationWasAppInitiated):
(WebCore::ServiceWorkerThreadProxy::lastNavigationWasAppInitiated):
(WebCore::ServiceWorkerThreadProxy::setLastNavigationWasAppBound): Deleted.
(WebCore::ServiceWorkerThreadProxy::lastNavigationWasAppBound): Deleted.
* workers/service/context/ServiceWorkerThreadProxy.h:
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::importRecords):
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::startScriptFetch):
(WebCore::SWServer::updateWorker):
(WebCore::SWServer::clientIsAppInitiatedForRegistrableDomain):
(WebCore::SWServer::updateAppInitiatedValueForWorkers):
(WebCore::SWServer::registerServiceWorkerClient):
(WebCore::SWServer::unregisterServiceWorkerClient):
(WebCore::SWServer::clientIsAppBoundForRegistrableDomain): Deleted.
(WebCore::SWServer::updateAppBoundValueForWorkers): Deleted.
* workers/service/server/SWServer.h:
* workers/service/server/SWServerRegistration.cpp:
(WebCore::SWServerRegistration::scheduleSoftUpdate):
* workers/service/server/SWServerRegistration.h:
(WebCore::SWServerRegistration::isAppInitiated):
(WebCore::SWServerRegistration::isAppBound): Deleted.
* workers/service/server/SWServerToContextConnection.h:
* workers/service/server/SWServerWorker.cpp:
(WebCore::m_lastNavigationWasAppInitiated):
(WebCore::SWServerWorker::contextData const):
(WebCore::SWServerWorker::updateAppInitiatedValue):
(WebCore::m_lastNavigationWasAppBound): Deleted.
(WebCore::SWServerWorker::updateAppBoundValue): Deleted.
* workers/service/server/SWServerWorker.h:
2021-07-08 Ryosuke Niwa <rniwa@webkit.org>
Deploy smart pointers in PointerCaptureController
https://bugs.webkit.org/show_bug.cgi?id=227352
Reviewed by Wenson Hsieh.
Deployed Ref/RefPtr in more places in PointerCaptureController.
Also made PointerCaptureController::CapturingData ref counted.
* page/PointerCaptureController.cpp:
(WebCore::PointerCaptureController::pointerCaptureElement const):
(WebCore::PointerCaptureController::setPointerCapture):
(WebCore::PointerCaptureController::releasePointerCapture):
(WebCore::PointerCaptureController::hasPointerCapture):
(WebCore::PointerCaptureController::pointerLockWasApplied):
(WebCore::PointerCaptureController::elementWasRemoved):
(WebCore::PointerCaptureController::reset):
(WebCore::PointerCaptureController::updateHaveAnyCapturingElement):
(WebCore::PointerCaptureController::hasCancelledPointerEventForIdentifier const):
(WebCore::PointerCaptureController::preventsCompatibilityMouseEventsForIdentifier const):
(WebCore::hierarchyHasCapturingEventListeners):
(WebCore::PointerCaptureController::dispatchEventForTouchAtIndex):
(WebCore::PointerCaptureController::pointerEventForMouseEvent):
(WebCore::PointerCaptureController::pointerEventWillBeDispatched):
(WebCore::PointerCaptureController::ensureCapturingDataForPointerEvent):
(WebCore::PointerCaptureController::pointerEventWasDispatched):
(WebCore::PointerCaptureController::cancelPointer):
(WebCore::PointerCaptureController::processPendingPointerCapture):
* page/PointerCaptureController.h:
(WebCore::PointerCaptureController::CapturingData::create):
(WebCore::PointerCaptureController::CapturingData::CapturingData):
2021-07-08 Simon Fraser <simon.fraser@apple.com>
Scrollbar hidden when scroller has a negative z-index child
https://bugs.webkit.org/show_bug.cgi?id=227545
Reviewed by Alan Bujtas.
The code to ensure that overflow:scroll scrollbars appeared on top of composited descendant
layers had incorrect behavior if the only descendant had negative z-index; it would move the
overflow controls container layer to be after that descendant, and thus behind foreground
content.
Fix by inserting the overflow controls container layer in front of the frontmost of the
descendant and the scroller itself.
Test: compositing/scrolling/async-overflow-scrolling/negative-z-in-scroller-hidden-scrollbar.html
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::adjustOverflowScrollbarContainerLayers):
2021-07-08 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com>
[OpenSSL] Implement HKDF and PBKDF2 support
https://bugs.webkit.org/show_bug.cgi?id=227656
Reviewed by Fujii Hironori.
* crypto/openssl/CryptoAlgorithmHKDFOpenSSL.cpp:
(WebCore::CryptoAlgorithmHKDF::platformDeriveBits): Implemented with HKDF().
* crypto/openssl/CryptoAlgorithmPBKDF2OpenSSL.cpp:
(WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
* crypto/openssl/CryptoAlgorithmRegistryOpenSSL.cpp: Implemented with PKCS5_PBKDF2_HMAC().
(WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Register HKDF and PBKDF2.
2021-07-08 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Draw PDFs using an intermediate ImageBuffer when using the GPU process
https://bugs.webkit.org/show_bug.cgi?id=227550
Reviewed by Tim Horton.
When drawing PDFs, we usually already have a cached ImageBuffer of the contents of the PDF.
However, in the situation where we don't have this cached ImageBuffer, we can't just draw
the PDF into the platformContext when we're using the GPU Process. So, instead, we need to
draw the PDF into an intermediate ImageBuffer and then send that to the GPU Process.
When we have a fully functional custom CGContext, we can use that to send all the PDF drawing
commands to the GPU Process, and this patch should then be reverted.
Test: fast/images/pdf-in-canvas.html
* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::draw):
* platform/mac/LocalCurrentGraphicsContextMac.mm:
(WebCore::LocalCurrentGraphicsContext::LocalCurrentGraphicsContext):
2021-07-08 Yusuke Suzuki <ysuzuki@apple.com>
Use JSC::Yarr::flagsString to get string representation of RegExp flags
https://bugs.webkit.org/show_bug.cgi?id=227790
Reviewed by Keith Miller.
This patch uses JSC::Yarr::flagsString function to retrieve string representation of
RegExp flags. This allows JSC to add flags without changing WebCore code.
Covered by existing tests.
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::dumpIfTerminal):
2021-07-08 Megan Gardner <megan_gardner@apple.com>
Add logging for legacy AppHighlight decoding to aid in future debugging.
https://bugs.webkit.org/show_bug.cgi?id=227591
Reviewed by Tim Horton.
* Modules/highlight/AppHighlightRangeData.cpp:
(WebCore::AppHighlightRangeData::decode):
* platform/Logging.h:
2021-07-08 Chris Dumez <cdumez@apple.com>
[WebCrypto] deriveBits() fails if length is not a multiple of 8 for ECDH algorithm
https://bugs.webkit.org/show_bug.cgi?id=227796
Reviewed by Alex Christensen.
deriveBits() fails if length is not a multiple of 8 for ECDH algorithm. This doesn't match
the specification or the behavior of Chrome.
No new tests, rebaselined existing tests.
* crypto/algorithms/CryptoAlgorithmECDH.cpp:
(WebCore::CryptoAlgorithmECDH::deriveBits):
2021-07-08 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Canvas image rendering can render arbitrary DOM content in the GPU process, which is against policy (for now)
https://bugs.webkit.org/show_bug.cgi?id=227519
<rdar://problem/76678163>
Reviewed by Darin Adler.
Rendering arbitrary DOM content in the GPU process isn't supported yet, but canvas rendering is. However,
canvas has a drawImage() function which can accept an HTMLImageElement as its source, and an HTMLImageElement
can have an SVG document as its source, which would end up triggering our DOM codepath in canvas and thus
in the GPU process.
This patch disables this for now, by rendering the SVG into an ImageBuffer and then drawing the ImageBuffer
in the GPU process. When we eventually implement arbitrary DOM rendering in the GPU process, this patch will
need to be reverted.
Test: fast/images/svg-mask-in-canvas.html
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::nativeImage):
(WebCore::SVGImage::draw):
(WebCore::SVGImage::drawAsNativeImage):
* svg/graphics/SVGImage.h:
2021-07-08 Antti Koivisto <antti@apple.com>
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-08 Per Arne <pvollan@apple.com>
Set Caption preferences in the UI process
https://bugs.webkit.org/show_bug.cgi?id=227742
<rdar://79040526>
Reviewed by Eric Carlson.
Add a Caption user preferences delegate, which can be subclassed to perform the work in the UI process.
No new tests, since this is not trivial to add a test for. This has been manually tested.
* WebCore.xcodeproj/project.pbxproj:
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::captionPreferencesDelegate):
(WebCore::CaptionUserPreferencesMediaAF::captionDisplayMode const):
(WebCore::CaptionUserPreferencesMediaAF::platformSetCaptionDisplayMode):
(WebCore::CaptionUserPreferencesMediaAF::setCaptionDisplayMode):
(WebCore::CaptionUserPreferencesMediaAF::setCaptionPreferencesDelegate):
(WebCore::CaptionUserPreferencesMediaAF::platformSetPreferredLanguage):
(WebCore::CaptionUserPreferencesMediaAF::setPreferredLanguage):
* page/CaptionUserPreferencesMediaAF.h:
* platform/CaptionPreferencesDelegate.h: Added.
(WebCore::CaptionPreferencesDelegate::~CaptionPreferencesDelegate):
(WebCore::CaptionPreferencesDelegate::setDisplayMode):
2021-07-08 Martin Robinson <mrobinson@igalia.com>
[css-scroll-snap] scroll-snap-align should use the box's writing-mode when the box is larger than the snapport
https://bugs.webkit.org/show_bug.cgi?id=227743
Reviewed by Simon Fraser.
No new tests. This fixes an existing WPT test:
- imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/scroll-snap-writing-mode-000.html
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::axesFlippedForWritingModeAndDirection): Added this helper which abstracts the process of
determining if the x-axis and y-axis are flipped given the style's writing mode and text direction.
(WebCore::updateSnapOffsetsForScrollableArea): When the inline axis of the box defining the snap area
is larger than the snapport, we use the box's writing mode and text-direction to determine if the
x-axis and y-axis are flipped.
2021-07-08 Fujii Hironori <Hironori.Fujii@sony.com>
Merge Cairo::save and Cairo::restore into GraphicsContextCairo's methods
https://bugs.webkit.org/show_bug.cgi?id=227784
Reviewed by Žan Doberšek.
Cairo::save and Cairo::restore should be GraphicsContextCairo's
methods.
* platform/graphics/cairo/CairoOperations.cpp:
(WebCore::Cairo::fillShadowBuffer):
(WebCore::Cairo::save): Deleted.
(WebCore::Cairo::restore): Deleted.
* platform/graphics/cairo/CairoOperations.h:
* platform/graphics/cairo/GradientCairo.cpp:
(WebCore::Gradient::fill):
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContextCairo::save):
(WebCore::GraphicsContextCairo::restore):
(WebCore::GraphicsContextCairo::fillRect):
(WebCore::GraphicsContextCairo::saveInternal): Deleted.
(WebCore::GraphicsContextCairo::restoreInternal): Deleted.
* platform/graphics/cairo/GraphicsContextCairo.h:
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
(Nicosia::CairoOperationRecorder::fillRect):
(Nicosia::CairoOperationRecorder::save):
(Nicosia::CairoOperationRecorder::restore):
2021-07-07 Cameron McCormack <heycam@apple.com>
Add logging for GraphicsLayerCA::m_uncommittedChanges
https://bugs.webkit.org/show_bug.cgi?id=227783
Reviewed by Simon Fraser.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::layerChangeAsString):
(WebCore::GraphicsLayerCA::dumpLayerChangeFlags):
(WebCore::GraphicsLayerCA::dumpAdditionalProperties const):
* platform/graphics/ca/GraphicsLayerCA.h:
2021-07-07 John Wilander <wilander@apple.com>
PCM: Add error logging for CryptoKit operations
https://bugs.webkit.org/show_bug.cgi?id=227731
<rdar://80221057>
Reviewed by Brent Fulgham.
Resolves three FIXMEs for error logging in PCM's CryptoKit operations.
No new tests. Only added logging.
* loader/PrivateClickMeasurement.h:
* loader/cocoa/PrivateClickMeasurementCocoa.mm:
(WebCore::PrivateClickMeasurement::calculateAndUpdateSourceUnlinkableToken):
(WebCore::PrivateClickMeasurement::calculateAndUpdateSourceSecretToken):
2021-07-07 Chris Dumez <cdumez@apple.com>
Our structured cloning implementation does not encode all of RegExp's flags
https://bugs.webkit.org/show_bug.cgi?id=227779
Reviewed by Yusuke Suzuki.
Our structured cloning implementation does not encode all of RegExp's flags.
In particular, we are failing to encode the 'y', 'u', 's' and 'd' flags.
This is causing one of the checks to fail in WebKit on:
- http://wpt.live/IndexedDB/structured-clone.any.html?61-80
That subtest is passing in Firefox and Chrome.
Test: fast/dom/Window/post-message-regexp.html
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::dumpIfTerminal):
2021-07-07 Alan Bujtas <zalan@apple.com>
[LFC][IFC] Add support for partially trimmed trailing whitespace
https://bugs.webkit.org/show_bug.cgi?id=227688
Reviewed by Antti Koivisto.
This patch fixes the case when as a result of the partially trimmed overflow content,
we don't need to conditionally hang the trailing end anymore.
https://drafts.csswg.org/css-text-3/#valdef-white-space-pre
"If white-space is set to pre-wrap, the UA must (unconditionally)
...
It may also visually collapse the character advance widths of any that would otherwise overflow."
* layout/formattingContexts/inline/InlineLine.cpp:
(WebCore::Layout::Line::visuallyCollapsePreWrapOverflowContent):
(WebCore::Layout::Line::Run::removeTrailingWhitespace):
(WebCore::Layout::Line::Run::visuallyCollapseTrailingWhitespace):
* layout/formattingContexts/inline/InlineLine.h:
2021-07-07 Chris Dumez <cdumez@apple.com>
[WebCrypto] Support Elliptic Curve P-521 on Mac
https://bugs.webkit.org/show_bug.cgi?id=216755
<rdar://problem/69667220>
Reviewed by Alex Christensen.
Add support for Elliptic Curve P-521 in WebCrypto for ECDSA and ECDH, on macOS.
Both Gecko and Blink already support this.
No new tests, rebaselined existing tests.
* crypto/mac/CryptoAlgorithmECDHMac.cpp:
(WebCore::CryptoAlgorithmECDH::platformDeriveBits):
* crypto/mac/CryptoAlgorithmECDSAMac.cpp:
Use std::ceil() when converting bits to bytes since 521 is not a multiple of 8.
This is as per Section 2.3.4 of http://www.secg.org/sec1-v2.pdf, which indicates
we should use ceil().
(WebCore::signECDSA):
Stop assuming the length can be encoded in a single byte as this is not true with
P-521 (values >= 128 require 2 bytes).
(WebCore::verifyECDSA):
Do not reject the promise when CCECCryptorVerifyHash() fails and instead return
false to indicate that the signature fails. This was needed to pass a few more
WPT checks. We do not do much validation on r and s before passing them to
CommonCrypto and CCECCryptorVerifyHash() may return a kCCNotVerified error when
the input signature is invalid (invalid signatures are tested by WPT tests).
(WebCore::CryptoAlgorithmECDSA::platformSign):
(WebCore::CryptoAlgorithmECDSA::platformVerify):
* crypto/mac/CryptoKeyECMac.cpp:
(WebCore::doesUncompressedPointMatchNamedCurve):
(WebCore::doesFieldElementMatchNamedCurve):
(WebCore::getKeySizeFromNamedCurve):
(WebCore::CryptoKeyEC::platformSupportedCurve):
(WebCore::CryptoKeyEC::platformExportRaw const):
(WebCore::CryptoKeyEC::platformAddFieldElements const):
(WebCore::getOID):
(WebCore::CryptoKeyEC::platformExportSpki const):
(WebCore::CryptoKeyEC::platformImportPkcs8):
(WebCore::CryptoKeyEC::platformExportPkcs8 const):
Add support for P-521 and use std::ceil() when converting bits to bytes since
521 is not a multiple of 8.
2021-07-07 Chris Dumez <cdumez@apple.com>
[IndexedDB] Transaction should be inactive during structured clone
https://bugs.webkit.org/show_bug.cgi?id=227773
Reviewed by Geoffrey Garen.
Transaction should be inactive during structured clone, as per:
- https://w3c.github.io/IndexedDB/#clone
Gecko and Blink match the specification.
No new tests, rebaselined existing tests.
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::putOrAdd):
2021-07-07 Cameron McCormack <heycam@apple.com>
Remove unused LayerChange::TilesAdded enum value
https://bugs.webkit.org/show_bug.cgi?id=227736
Reviewed by Simon Fraser.
* platform/graphics/ca/GraphicsLayerCA.h:
2021-07-07 Chris Dumez <cdumez@apple.com>
IDBObjectStore.keyPath should keep returning the same object
https://bugs.webkit.org/show_bug.cgi?id=227770
Reviewed by Darin Adler.
IDBObjectStore.keyPath should keep returning the same object to match other
browser engines (Gecko and Blink).
No new tests, rebaselined existing tests.
* Modules/indexeddb/IDBObjectStore.idl:
2021-07-07 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com>
[OpenSSL] Implement CryptoAlgorithmEC*
https://bugs.webkit.org/show_bug.cgi?id=227655
Reviewed by Don Olmstead.
Implement elliptic curve support in WebCrypto. This patch enables ECDH
and ECDSA algorithms as well as EC key import, export, and generation.
Note that low level ASN1 API is used in CryptoKeyEC.cpp to import
public EC keys in the SPKI format because currently OpenSSL doesn't
have the Object ID of the ecDH algorithm and it fails to load ecDH
keys with d2iPUBKEY().
* crypto/keys/CryptoKeyEC.h:
* crypto/openssl/CryptoAlgorithmECDHOpenSSL.cpp:
(WebCore::CryptoAlgorithmECDH::platformDeriveBits):
* crypto/openssl/CryptoAlgorithmECDSAOpenSSL.cpp:
(WebCore::CryptoAlgorithmECDSA::platformSign):
(WebCore::CryptoAlgorithmECDSA::platformVerify):
* crypto/openssl/CryptoAlgorithmRegistryOpenSSL.cpp:
(WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
* crypto/openssl/CryptoKeyECOpenSSL.cpp:
(WebCore::curveIdentifier):
(WebCore::curveSize):
(WebCore::createECKey):
(WebCore::verifyCurve):
(WebCore::CryptoKeyEC::keySizeInBits const):
(WebCore::CryptoKeyEC::platformSupportedCurve):
(WebCore::CryptoKeyEC::platformGeneratePair):
(WebCore::CryptoKeyEC::platformImportRaw):
(WebCore::CryptoKeyEC::platformImportJWKPublic):
(WebCore::CryptoKeyEC::platformImportJWKPrivate):
(WebCore::ecPublicKeyIdentifier):
(WebCore::ecDHIdentifier):
(WebCore::supportedAlgorithmIdentifier):
(WebCore::CryptoKeyEC::platformImportSpki):
(WebCore::CryptoKeyEC::platformImportPkcs8):
(WebCore::CryptoKeyEC::platformExportRaw const):
(WebCore::CryptoKeyEC::platformAddFieldElements const):
(WebCore::CryptoKeyEC::platformExportSpki const):
(WebCore::CryptoKeyEC::platformExportPkcs8 const):
* crypto/openssl/CryptoKeyRSAOpenSSL.cpp:
(WebCore::CryptoKeyRSA::importSpki):
(WebCore::CryptoKeyRSA::importPkcs8):
(WebCore::CryptoKeyRSA::exportSpki const):
(WebCore::CryptoKeyRSA::exportPkcs8 const):
(WebCore::CryptoKeyRSA::algorithm const):
(WebCore::CryptoKeyRSA::exportData const):
* crypto/openssl/OpenSSLCryptoUniquePtr.h:
(WebCore::OpenSSLCryptoPtrDeleter<EC_KEY>::operator() const):
(WebCore::OpenSSLCryptoPtrDeleter<EC_POINT>::operator() const):
(WebCore::OpenSSLCryptoPtrDeleter<ECDSA_SIG>::operator() const):
(WebCore::OpenSSLCryptoPtrDeleter<ASN1_SEQUENCE_ANY>::operator() const):
* crypto/openssl/OpenSSLUtilities.cpp:
(WebCore::convertToBytes):
(WebCore::convertToBytesExpand):
(WebCore::convertToBigNumber):
* crypto/openssl/OpenSSLUtilities.h:
2021-07-07 Alex Christensen <achristensen@webkit.org>
DOMURL's href setter should use empty URL as base URL
https://bugs.webkit.org/show_bug.cgi?id=227772
Reviewed by Yusuke Suzuki.
This matches Chrome and Firefox.
* html/DOMURL.cpp:
(WebCore::DOMURL::setHref):
2021-07-07 Alan Bujtas <zalan@apple.com>
[LFC][IFC] Unexpected content wrap when the containing block width is fixed
https://bugs.webkit.org/show_bug.cgi?id=227746
Reviewed by Antti Koivisto.
Test: fast/inline/inline-content-should-fit-the-line.html
While we resolved the relative Length value, the float -> LayoutUnit conversion implicitly floors the return value.
This flooring causes unexpected content wrap when the type we use for the measured width does not match the precision of the LayoutUnit.
* layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::processInlineContent):
2021-07-07 Alan Bujtas <zalan@apple.com>
[Legacy line layout] Inline content on subpixel position makes the table cell scroll
https://bugs.webkit.org/show_bug.cgi?id=227594
<rdar://74884402>
Reviewed by Simon Fraser.
The root inlinebox is supposed to fit the [top, top + maxHeight] space as it is computed based
on the inline level boxes. However due to the integral rounding on the root inlinebox's logical top,
it may accidentally leak out of the containing block and trigger unintended layout overflow.
This patch ensures that we don't stretch the line (top/bottom) with the integral positioned root inlinebox.
Test: fast/inline/hidpi-root-inlinebox-integral-rounding-table-simple.html
* rendering/LegacyInlineFlowBox.cpp:
(WebCore::LegacyInlineFlowBox::placeBoxesInBlockDirection):
2021-07-07 Chris Dumez <cdumez@apple.com>
IDBIndex.keyPath should keep returning the same object
https://bugs.webkit.org/show_bug.cgi?id=227758
Reviewed by Geoffrey Garen.
IDBIndex.keyPath should keep returning the same object to match other browser
engines (Gecko and Blink).
No new tests, rebaselined existing tests.
* Modules/indexeddb/IDBIndex.idl:
2021-07-07 Alex Christensen <achristensen@webkit.org>
Allow setting empty hosts of URLs with non-special schemes
https://bugs.webkit.org/show_bug.cgi?id=227752
Reviewed by Chris Dumez.
asdf:/// is fine.
http:/// is not fine.
* html/URLDecomposition.cpp:
(WebCore::URLDecomposition::setHost):
(WebCore::URLDecomposition::setHostname):
(WebCore::URLDecomposition::hash const):
2021-07-07 Ryosuke Niwa <rniwa@webkit.org>
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-07 Aditya Keerthi <akeerthi@apple.com>
[iOS] Inconsistent styling for input[type="submit"] and button[type="submit"]
https://bugs.webkit.org/show_bug.cgi?id=227043
<rdar://problem/79629354>
Reviewed by Wenson Hsieh.
In iOS 15, submit buttons have a different appearance from standard
buttons, matching UIKit's "preferred" button style.
Previously, all buttons had the same styling, which meant that
input[type="submit"] and button[type="submit"] had the same
appearance by default. The changes made for iOS 15 were applied to
input[type="submit"], but not button[type="submit"], leading to
inconsistent styling.
Test: fast/forms/ios/form-control-refresh/button/button-type-submit.html
* css/html.css:
Ensure the different style applied to input[type="submit"] also applies
to button[type="submit"].
Additionally, apply the new style to button[type="menu"]. This type is
unsupported, but should have the same appearance as a submit button,
according to the button-type-menu-historical.html web platform test.
2021-07-07 Fujii Hironori <Hironori.Fujii@sony.com>
[Cairo] Merge PlatformContextCairo into GraphicsContextCairo
https://bugs.webkit.org/show_bug.cgi?id=227721
Reviewed by Don Olmstead.
PlatformContextCairo was introduced to separate Cairo specific
code from the platform-independent GraphicsContext class. However,
GraphicsContext is a abstract class since r278062. And,
GraphicsContextCairo is a Cairo specific concrete class.
Some modifications are needed to merge PlatformContextCairo into
GraphicsContextCairo. Renamed m_state to m_cairoState. Renamed
save() and restore() to saveInternal() and restoreInternal().
* platform/Cairo.cmake:
* platform/SourcesCairo.txt:
* platform/graphics/GraphicsContext.h:
* platform/graphics/cairo/CairoOperations.cpp:
(WebCore::Cairo::drawShadowLayerBuffer):
(WebCore::Cairo::drawShadowImage):
(WebCore::Cairo::fillShadowBuffer):
(WebCore::Cairo::drawPathShadow):
(WebCore::Cairo::fillCurrentCairoPath):
(WebCore::Cairo::drawGlyphsShadow):
(WebCore::Cairo::computeLineBoundsAndAntialiasingModeForText):
(WebCore::Cairo::State::setStrokeThickness):
(WebCore::Cairo::State::setStrokeStyle):
(WebCore::Cairo::State::setCompositeOperation):
(WebCore::Cairo::State::setShouldAntialias):
(WebCore::Cairo::State::setCTM):
(WebCore::Cairo::State::getCTM):
(WebCore::Cairo::State::getClipBounds):
(WebCore::Cairo::State::roundToDevicePixels):
(WebCore::Cairo::State::isAcceleratedContext):
(WebCore::Cairo::ShadowState::isRequired const):
(WebCore::Cairo::setLineCap):
(WebCore::Cairo::setLineDash):
(WebCore::Cairo::setLineJoin):
(WebCore::Cairo::setMiterLimit):
(WebCore::Cairo::fillRect):
(WebCore::Cairo::fillRoundedRect):
(WebCore::Cairo::fillRectWithRoundedHole):
(WebCore::Cairo::fillPath):
(WebCore::Cairo::strokeRect):
(WebCore::Cairo::strokePath):
(WebCore::Cairo::clearRect):
(WebCore::Cairo::drawGlyphs):
(WebCore::Cairo::drawPlatformImage):
(WebCore::Cairo::drawPattern):
(WebCore::Cairo::drawSurface):
(WebCore::Cairo::drawRect):
(WebCore::Cairo::drawLine):
(WebCore::Cairo::drawLinesForText):
(WebCore::Cairo::drawDotsForDocumentMarker):
(WebCore::Cairo::drawEllipse):
(WebCore::Cairo::drawFocusRing):
(WebCore::Cairo::save):
(WebCore::Cairo::restore):
(WebCore::Cairo::translate):
(WebCore::Cairo::rotate):
(WebCore::Cairo::scale):
(WebCore::Cairo::concatCTM):
(WebCore::Cairo::beginTransparencyLayer):
(WebCore::Cairo::endTransparencyLayer):
(WebCore::Cairo::clip):
(WebCore::Cairo::clipOut):
(WebCore::Cairo::clipPath):
(WebCore::Cairo::clipToImageBuffer):
* platform/graphics/cairo/CairoOperations.h:
* platform/graphics/cairo/FontCairo.cpp:
* platform/graphics/cairo/GradientCairo.cpp:
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContextCairo::GraphicsContextCairo):
(WebCore::GraphicsContextCairo::platformContext const):
(WebCore::GraphicsContextCairo::save):
(WebCore::GraphicsContextCairo::restore):
(WebCore::GraphicsContextCairo::drawRect):
(WebCore::GraphicsContextCairo::drawNativeImage):
(WebCore::GraphicsContextCairo::drawLine):
(WebCore::GraphicsContextCairo::drawEllipse):
(WebCore::GraphicsContextCairo::fillPath):
(WebCore::GraphicsContextCairo::strokePath):
(WebCore::GraphicsContextCairo::fillRect):
(WebCore::GraphicsContextCairo::clip):
(WebCore::GraphicsContextCairo::clipPath):
(WebCore::GraphicsContextCairo::clipToImageBuffer):
(WebCore::GraphicsContextCairo::drawFocusRing):
(WebCore::GraphicsContextCairo::drawLinesForText):
(WebCore::GraphicsContextCairo::drawDotsForDocumentMarker):
(WebCore::GraphicsContextCairo::roundToDevicePixels):
(WebCore::GraphicsContextCairo::translate):
(WebCore::GraphicsContextCairo::updateState):
(WebCore::GraphicsContextCairo::concatCTM):
(WebCore::GraphicsContextCairo::setCTM):
(WebCore::GraphicsContextCairo::beginTransparencyLayer):
(WebCore::GraphicsContextCairo::endTransparencyLayer):
(WebCore::GraphicsContextCairo::clearRect):
(WebCore::GraphicsContextCairo::strokeRect):
(WebCore::GraphicsContextCairo::setLineCap):
(WebCore::GraphicsContextCairo::setLineDash):
(WebCore::GraphicsContextCairo::setLineJoin):
(WebCore::GraphicsContextCairo::setMiterLimit):
(WebCore::GraphicsContextCairo::clipOut):
(WebCore::GraphicsContextCairo::rotate):
(WebCore::GraphicsContextCairo::scale):
(WebCore::GraphicsContextCairo::fillRoundedRectImpl):
(WebCore::GraphicsContextCairo::fillRectWithRoundedHole):
(WebCore::GraphicsContextCairo::drawPattern):
(WebCore::GraphicsContextCairo::drawGlyphs):
(WebCore::GraphicsContextCairo::cr const):
(WebCore::GraphicsContextCairo::layers):
(WebCore::GraphicsContextCairo::saveInternal):
(WebCore::GraphicsContextCairo::restoreInternal):
(WebCore::GraphicsContextCairo::pushImageMask):
(WebCore::GraphicsContextCairo::graphicsContextPrivate):
(WebCore::GraphicsContextCairo::~GraphicsContextCairo): Deleted.
* platform/graphics/cairo/GraphicsContextCairo.h:
* platform/graphics/cairo/GraphicsContextGLCairo.cpp:
* platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
* platform/graphics/cairo/ImageBufferCairoBackend.cpp:
* platform/graphics/cairo/PlatformContextCairo.cpp: Removed.
* platform/graphics/cairo/PlatformContextCairo.h: Removed.
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
(Nicosia::contextForReplay):
* platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp:
* platform/graphics/nicosia/cairo/NicosiaPaintingOperationReplayCairo.h:
(Nicosia::PaintingOperationReplayCairo::PaintingOperationReplayCairo):
* platform/graphics/win/Direct2DOperations.h:
* platform/graphics/win/GraphicsContextCairoWin.cpp:
(WebCore::GraphicsContextCairo::GraphicsContextCairo):
(WebCore::drawBitmapToContext):
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
* platform/gtk/ScrollbarThemeGtk.cpp:
* platform/win/DragImageCairoWin.cpp:
(WebCore::deallocContext):
(WebCore::allocImage):
(WebCore::scaleDragImage):
(WebCore::createDragImageFromImage):
2021-07-07 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r279271.
https://bugs.webkit.org/show_bug.cgi?id=227764
Gmail labels (folders) aren't visible on left side anymore
Reverted changeset:
"[css-flexbox] Do not clamp flex base size with
{min|max}-{height|width}"
https://bugs.webkit.org/show_bug.cgi?id=225590
https://commits.webkit.org/r279271
2021-07-07 Alex Christensen <achristensen@webkit.org>
Use more Span
https://bugs.webkit.org/show_bug.cgi?id=227606
Reviewed by Darin Adler.
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::showCertificate):
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::decoder const):
* platform/network/cf/CertificateInfoCFNet.cpp:
(WTF::Persistence::encodeCFData):
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::importRecords):
* workers/service/server/SWScriptStorage.cpp:
(WebCore::SWScriptStorage::store):
2021-07-07 Tim Nguyen <ntim@apple.com>
Use setBooleanAttribute instead of setAttributeWithoutSynchronization(X, Y ? emptyAtom() : nullAtom());
https://bugs.webkit.org/show_bug.cgi?id=227745
Reviewed by Antti Koivisto.
It's easier to read and attribute sync doesn't make a difference here (it only does for style & SVG attributes).
Also clean up HTMLDialogElement to remove intermediary `setOpen` method.
* html/HTMLDialogElement.cpp:
(WebCore::HTMLDialogElement::show):
(WebCore::HTMLDialogElement::showModal):
(WebCore::HTMLDialogElement::close):
(WebCore::HTMLDialogElement::parseAttribute):
(WebCore::HTMLDialogElement::setOpen): Deleted.
* html/HTMLDialogElement.h:
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::setMultiple):
2021-07-07 Chris Dumez <cdumez@apple.com>
SubtleCrypto should only be exposed to secure contexts
https://bugs.webkit.org/show_bug.cgi?id=227725
Reviewed by Darin Adler.
SubtleCrypto should only be exposed to secure contexts:
- https://www.w3.org/TR/WebCryptoAPI/#dfn-Crypto
Gecko and Blink match the specification.
This was causing WebKit to fail the WebCryptoAPI/historical.any.html WPT test.
Test: http/wpt/crypto/historical.html
* crypto/CryptoKey.idl:
* crypto/SubtleCrypto.idl:
* page/Crypto.idl:
2021-07-07 Chris Lord <clord@igalia.com>
[WPE] Fieldset elements can incorrectly get treated as opaque with async scrolling overflow areas enabled
https://bugs.webkit.org/show_bug.cgi?id=227679
Reviewed by Simon Fraser.
Don't treat fieldset elements as opaque as their background shape is
determined by its children and can be non-rectangular.
No new tests, covered by existing tests.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::backgroundIsKnownToBeOpaqueInRect const):
2021-07-06 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r279628.
https://bugs.webkit.org/show_bug.cgi?id=227737
Test does not work since it relies on r279546, which is
reverted due to Speedometer regression
Reverted changeset:
"SubtleCrypto should only be exposed to secure contexts"
https://bugs.webkit.org/show_bug.cgi?id=227725
https://commits.webkit.org/r279628
2021-07-06 Yusuke Suzuki <ysuzuki@apple.com>
Unreviewed, need CryptoKey and SubtleCrypto names
* bindings/js/WebCoreBuiltinNames.h:
2021-07-06 Simon Fraser <simon.fraser@apple.com>
REGRESSION (r262237) Safari 14.x shows graphics artifacts when scrolling, using drop-down menus or just moving the mouse
https://bugs.webkit.org/show_bug.cgi?id=220892
<rdar://73538454>
Reviewed by Alan Bujtas.
Fix an issue with backing sharing where a composited layer needs to interrupted a backing
sharing sequence. In some cases, a layer that became composited via an indirect reason
(like overflow positioning) would not interrupt a backing sharing sequence, leaving a dangling
layer that ended up painting into the wrong ancestor.
The fix is to ensure that BackingSharingState::updateBeforeDescendantTraversal() and
BackingSharingState::updateAfterDescendantTraversal() have the same behavior when a layer
becomes composited (thus interrupting the sequence). However, we also have ensure that
updateAfterDescendantTraversal() doesn't erroeously interrupt the sequence when the sequence
was initiated by some descendant, hence the check against the preDescendantProviderCandidate.
Test: compositing/shared-backing/backing-sharing-compositing-change.html
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::BackingSharingState::endBackingSharingSequence):
(WebCore::RenderLayerCompositor::BackingSharingState::updateBeforeDescendantTraversal):
(WebCore::RenderLayerCompositor::BackingSharingState::updateAfterDescendantTraversal):
(WebCore::RenderLayerCompositor::computeCompositingRequirements):
(WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
2021-07-06 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r279546, r279554, r279558 and r279567.
https://bugs.webkit.org/show_bug.cgi?id=227732
Speedometer/jQuery-TodoMVC 2-3% regression
Reverted changesets:
"[WebIDL] Rework runtime enabled properties leveraging
PropertyCallback"
https://bugs.webkit.org/show_bug.cgi?id=227275
https://commits.webkit.org/r279546
"[WebIDL] Generate constructor's hash table in
GenerateConstructorHelperMethods"
https://bugs.webkit.org/show_bug.cgi?id=227668
https://commits.webkit.org/r279554
"[WebIDL] Simplify generation of runtime conditionally read-
write attributes"
https://bugs.webkit.org/show_bug.cgi?id=227672
https://commits.webkit.org/r279558
"Use AbortSignal's [PrivateIdentifier] whenSignalAborted()
static method"
https://bugs.webkit.org/show_bug.cgi?id=227673
https://commits.webkit.org/r279567
2021-07-06 Alex Christensen <achristensen@webkit.org>
imported/w3c/web-platform-tests/fetch/api/credentials/authentication-basic.any*.html are crashing in debug
https://bugs.webkit.org/show_bug.cgi?id=227310
Reviewed by Chris Dumez.
In r228486 we blocked cross-origin requests from asking for credentials, and we wanted to add a console log for web developers
to see why they could no longer ask for credentials. r228703 loosened that to allow main resources to request credentials,
and it added an incorrect assertion before logging. ResourceLoader::isAllowedToAskUserForCredentials has two other reasons
why credentials could be blocked, and there is no reason to log in those cases because that is standard web behavior, as seen by
running the tests in Chrome and Firefox and seeing no console log. This removes the logs in cases where other browsers also
have the same behavior and do not log, and removes the incorrect assertion.
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::didBlockAuthenticationChallenge):
2021-07-06 Chris Dumez <cdumez@apple.com>
SubtleCrypto should only be exposed to secure contexts
https://bugs.webkit.org/show_bug.cgi?id=227725
Reviewed by Darin Adler.
SubtleCrypto should only be exposed to secure contexts:
- https://www.w3.org/TR/WebCryptoAPI/#dfn-Crypto
Gecko and Blink match the specification.
This was causing WebKit to fail the WebCryptoAPI/historical.any.html WPT test.
Test: http/wpt/crypto/historical.html
* crypto/CryptoKey.idl:
* crypto/SubtleCrypto.idl:
* page/Crypto.idl:
2021-07-06 Ryosuke Niwa <rniwa@webkit.org>
Deploy smart pointers in EventHandler and UserInputBridge
https://bugs.webkit.org/show_bug.cgi?id=227481
<rdar://problem/79906757>
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-07-06 Kimmo Kinnunen <kkinnunen@apple.com>
WebGL video to texture upload spends time clearing the uploaded-to texture
https://bugs.webkit.org/show_bug.cgi?id=227582
<rdar://problem/80020335>
Reviewed by Kenneth Russell.
Disable robust resource initiaization for the shared ANGLE context that is used
to copy video frames to WebGL textures. Otherwise ANGLE would spend time
initializing the texture in `gl::DrawArrays`.
No new tests, we currently do not have WebGL perf tests.
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::texImage2DDirect):
Add the direct texImage2D call so that the texture seed can be
somehow updated. This will be removed once the texture image version
management is fixed to be a bit more robust.
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
* platform/graphics/cv/GraphicsContextGLCVANGLE.cpp:
(WebCore::GraphicsContextGLCVANGLE::copyPixelBufferToTexture):
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
2021-07-06 Simon Fraser <simon.fraser@apple.com>
RenderLayer does not need a virtual destructor
https://bugs.webkit.org/show_bug.cgi?id=227706
Reviewed by Tim Horton.
The virtual destructor was a holdover from when RenderLayer inherited from
ScrollableArea.
* rendering/RenderLayer.h:
2021-07-06 Truitt Savell <tsavell@apple.com>
Unreviewed, reverting r279542.
Casued 4 test crashes
Reverted changeset:
"SourceBuffer.abort() doesn't go back to state
WAITING_FOR_SEGMENT properly"
https://bugs.webkit.org/show_bug.cgi?id=227559
https://commits.webkit.org/r279542
2021-07-06 Chris Dumez <cdumez@apple.com>
Make sure PlatformCALayer gets destroyed on the main thread
https://bugs.webkit.org/show_bug.cgi?id=227714
Reviewed by Geoffrey Garen.
Make sure PlatformCALayer gets destroyed on the main thread as we have evidence this is
not always the case and its destructor is definitely not safe to call on a non-main
thread.
* platform/graphics/ca/PlatformCALayer.h:
2021-07-06 Jer Noble <jer.noble@apple.com>
MediaPlayer may be left in a non-visible state
https://bugs.webkit.org/show_bug.cgi?id=227711
Reviewed by Eric Carlson.
Prospective fix for possible edge-case behavior. MediaPlayer defaults to non-visible state
at creation time, but that visibility state is set to true in two places:
- When the Page's visibility state changes
- During layout
If the MediaPlayer is created (or re-created) after the Page's visibility state, or (somehow)
layout does not occur, the MediaPlayer can be left thinking it is not visible, which could
cause downstream effects like a failure to render video content.
Rather than wait for layout to occur, or for the Page's visibility state to change, always
set the visibility state immediately after creating the MediaPlayer object.
No test, as it's unclear what edge case may cause this problem to occur; could be a result of
re-creating the remote MediaPlayer after a GPU process crash; could be a specific page behavior
when switching media sources; could only occur in fullscreen mode.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::createMediaPlayer:
2021-07-06 Wenson Hsieh <wenson_hsieh@apple.com>
[Live Text] Extraneous spaces when copying or translating Chinese and Japanese text in WebKit
https://bugs.webkit.org/show_bug.cgi?id=227674
rdar://79669807
Reviewed by Tim Horton.
See WebKit/ChangeLog for more details.
Test: fast/images/text-recognition/image-overlay-text-without-leading-whitespace.html
* html/HTMLElement.cpp:
(WebCore::HTMLElement::updateWithTextRecognitionResult):
For each recognized word in text, only append a trailing newline in the text content of the text container
element if `hasLeadingWhitespace` is set. Drive-by fix: additionally remove logic to append a line break when
computing and applying CSS transforms to text container elements.
* platform/TextRecognitionResult.h:
(WebCore::TextRecognitionWordData::TextRecognitionWordData):
(WebCore::TextRecognitionWordData::encode const):
(WebCore::TextRecognitionWordData::decode):
Add a per-word `hasLeadingWhitespace` flag.
* testing/Internals.cpp:
(WebCore::makeDataForLine):
* testing/Internals.h:
* testing/Internals.idl:
2021-07-06 Youenn Fablet <youenn@apple.com>
Unable to use 'data:application/javascript' url for Worker
https://bugs.webkit.org/show_bug.cgi?id=225716
<rdar://problem/78222538>
Reviewed by Alex Christensen.
As per https://fetch.spec.whatwg.org/#main-fetch step 11, same origin fetch for data URL should succeed.
Update AbstractWorker to let such URLs trigger loads and update WorkerScriptLoader to enable those loads.
Covered by rebased tests.
* workers/AbstractWorker.cpp:
(WebCore::AbstractWorker::resolveURL):
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadAsynchronously):
2021-07-06 Alex Christensen <achristensen@webkit.org>
loadSimulatedRequest: should do same delegate callbacks as loadHTMLString and loadData
https://bugs.webkit.org/show_bug.cgi?id=227599
Reviewed by Chris Dumez.
* loader/SubstituteData.h:
2021-07-06 Chris Dumez <cdumez@apple.com>
Add assertions in LayerPool to help debug <rdar://80184576>
https://bugs.webkit.org/show_bug.cgi?id=227710
Reviewed by Simon Fraser.
* platform/graphics/ca/LayerPool.cpp:
(WebCore::LayerPool::LayerPool):
(WebCore::LayerPool::~LayerPool):
(WebCore::LayerPool::addLayer):
(WebCore::LayerPool::takeLayerWithSize):
(WebCore::LayerPool::pruneTimerFired):
(WebCore::LayerPool::drain):
* platform/graphics/ca/LayerPool.h:
2021-07-06 Chris Dumez <cdumez@apple.com>
Unreviewed, reverting r279495.
Seems to have caused a ~2% PLT5 regression
Reverted changeset:
"[macOS] Suspend WebProcesses that are in the process cache"
https://bugs.webkit.org/show_bug.cgi?id=227269
https://commits.webkit.org/r279495
2021-07-06 Youenn Fablet <youenn@apple.com>
Remove MediaStreamTrack.onconstrainederror
https://bugs.webkit.org/show_bug.cgi?id=227696
Reviewed by Eric Carlson.
Covered by updated tests.
* Modules/mediastream/MediaStreamTrack.idl:
* dom/EventNames.h:
Remove never used/deprecated event handler.
2021-07-06 Youenn Fablet <youenn@apple.com>
Set kVTCompressionPropertyKey_MaxKeyFrameInterval in VideoSampleBufferCompressor
https://bugs.webkit.org/show_bug.cgi?id=227680
<rdar://78027782>
Reviewed by Eric Carlson.
Set kVTCompressionPropertyKey_MaxKeyFrameInterval in addition to kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration.
Manually tested.
* platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm:
(WebCore::VideoSampleBufferCompressor::initCompressionSession):
2021-07-06 Fujii Hironori <Hironori.Fujii@sony.com>
[curl][Win] very high CPU load on page with WebSocket
https://bugs.webkit.org/show_bug.cgi?id=227428
<rdar://problem/80150503>
Reviewed by Don Olmstead.
curl_socket_t is UINT_PTR on Windows while it is int on other
platforms. CurlStream::appendMonitoringFd was failing to update
`maxfd` because the following condition can't be true on Windows.
> if (maxfd < *socket)
> maxfd = *socket;
As the result, ::select was not called, and CurlStreamScheduler's
thread ran busy.
* platform/network/curl/CurlStream.cpp:
(WebCore::CurlStream::appendMonitoringFd): Added static_cast.
2021-07-06 Fujii Hironori <Hironori.Fujii@sony.com>
[curl][Win] wss: WebSocket doesn't work since r271170
https://bugs.webkit.org/show_bug.cgi?id=227694
Reviewed by Don Olmstead.
r271170 started to use CURLSSLOPT_NATIVE_CA for https for Windows.
However, I forgot to set the flag to WebSocket curl handles.
* platform/network/curl/CurlContext.cpp:
(WebCore::CurlHandle::enableSSLForHost):
(WebCore::CurlHandle::enableHttp):
2021-07-05 Wenson Hsieh <wenson_hsieh@apple.com>
Live Text should not be visible in video thumbnail images behind "Skip Ad" button on YouTube
https://bugs.webkit.org/show_bug.cgi?id=227692
Reviewed by Darin Adler.
Force `text-shadow: none;` for image overlay text, such that Live Text injected into image elements isn't
visible to the user when the containing image element has a text shadow.
Test: fast/images/text-recognition/image-overlay-with-text-shadow.html
* html/shadow/imageOverlay.css:
(div#image-overlay):
2021-07-05 Alan Bujtas <zalan@apple.com>
[LFC][IFC] Add support for conditionally hanging glyph
https://bugs.webkit.org/show_bug.cgi?id=227676
Reviewed by Antti Koivisto.
When a glyph at the end edge of a line hangs, it is not considered when measuring the lines contents alignment.
If white-space is set to pre-wrap, the UA must (unconditionally) hang the trailing sequence,
unless the sequence is followed by a forced line break, in which case it must conditionally hang the sequence instead
(hang only if it does not otherwise fit in the line prior to justification).
e.g.
<div style="white-space: pre-wrap; width: 5ch; text-align: center"> 0 </p>
We center the _0_ content as the trailing whitespace does not hang here.
* layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::hangingGlyphWidth): No need for the struct. We can handle it by returning the hanging content width.
(WebCore::Layout::horizontalAlignmentOffset):
(WebCore::Layout::HangingTrailingWhitespaceContent::width const): Deleted.
(WebCore::Layout::HangingTrailingWhitespaceContent::isConditional const): Deleted.
(WebCore::Layout::HangingTrailingWhitespaceContent::setIsConditional): Deleted.
(WebCore::Layout::HangingTrailingWhitespaceContent::expand): Deleted.
(WebCore::Layout::HangingTrailingWhitespaceContent::reset): Deleted.
(WebCore::Layout::collectHangingTrailingWhitespaceContent): Deleted.
2021-07-05 Alexey Shvayka <shvaikalesh@gmail.com>
Use AbortSignal's [PrivateIdentifier] whenSignalAborted() static method
https://bugs.webkit.org/show_bug.cgi?id=227673
Reviewed by Youenn Fablet.
Enabled by refactoring in r279546, this change removes handcrafted @whenSignalAborted()
global function in favor of using equivalent generated [PrivateIdentifier] static method.
The generated method checks its arguments more strictly (as per WebIDL spec):
a TypeError is thrown for invalid AbortSignal argument, which progresses the WPT.
Test: imported/w3c/web-platform-tests/streams/piping/pipe-through.any.js
* Modules/streams/ReadableStreamInternals.js:
(readableStreamPipeToWritableStream):
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::addBuiltinGlobals):
2021-07-05 Martin Robinson <mrobinson@webkit.org>
[css-scroll-snap] Triggering a layout during scroll causes jittery scrolling on Mac when dragging the scrollbar
https://bugs.webkit.org/show_bug.cgi?id=227478
Reviewed by Simon Fraser.
When dragging the scrollbar thumb, wait to resnap after layout for a
given axis until the mouse button is up on the scrollbar. This prevents
the layout and the scrollbar from fighting to set the scroll position
which causes some pretty terrible jitter in this case.
Test: css3/scroll-snap/scroll-snap-drag-scrollbar-thumb-with-relayouts.html
* platform/ScrollAnimationSmooth.cpp:
(WebCore::ScrollAnimationSmooth::updatePerAxisData): Fix an issue where the new position
was calculated incorrectly. This did not cause the animation to land on the wrong place,
but did cause a very janky animation progression when retriggering animations to the
same location.
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::retargetRunningAnimation): Added this helper, which retargets a
a running animation to allow for a smooth transition during relayouts.
* platform/ScrollAnimator.h: Added new method definition.
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::resnapAfterLayout): Only snap after layout when the user is not
currently interacting with the scrollbar. Once the scrollbar isn't being interacted with,
snapping will occur already. When there is already some sort of animation in progress,
smoothly transition that animation to land on the new position instead of snapping there
immediately.
2021-07-04 Alexey Shvayka <shvaikalesh@gmail.com>
[WebIDL] Simplify generation of runtime conditionally read-write attributes
https://bugs.webkit.org/show_bug.cgi?id=227672
Reviewed by Sam Weinig.
This patch introduces HashTableValue::makeReadOnlyCopy() to avoid manually
generating & putting a JSValue for an attribute, which is non-trivial to
do right while supporting all kinds of accelerated / built-in attributes.
Also, removes incorrect `classForThis` argument from `entries` reification.
No new tests, no behavior change.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
* bindings/scripts/test/JS/*: Updated.
2021-07-04 Alexey Shvayka <shvaikalesh@gmail.com>
[WebIDL] Generate constructor's hash table in GenerateConstructorHelperMethods
https://bugs.webkit.org/show_bug.cgi?id=227668
Reviewed by Sam Weinig.
This change moves generation of constructor's hash table to GenerateConstructorHelperMethods,
right before it is used to define the constructor's s_info, which is nicer than inferring
table's name and more precise than using ConstructorHasProperties.
Also, makes $generatingLegacyFactoryFunction bool-ish and removes unused $protoClassName parameter.
No new tests, no behavior change.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
(GenerateCallbackImplementationContent):
(GenerateConstructorDefinitions):
(GenerateConstructorDefinition):
(GenerateConstructorHelperMethods):
(ConstructorHasProperties): Deleted.
* bindings/scripts/test/JS/*: Updated.
2021-07-04 Eric Carlson <eric.carlson@apple.com>
WebAudio auto-play policy should come from top document
https://bugs.webkit.org/show_bug.cgi?id=227593
rdar://76920375
Reviewed by Chris Dumez.
Tests: media/auto-play-video-in-about-blank-iframe.html
media/auto-play-web-audio-in-about-blank-iframe.html
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::constructCommon): Get auto-play policy from document()->topDocument().
* testing/Internals.cpp:
(WebCore::Internals::setDocumentAutoplayPolicy): New method to test auto-play policy.
* testing/Internals.h:
* testing/Internals.idl:
2021-07-04 Zalan Bujtas <zalan@apple.com>
[LFC][TFC] Cleanup computedPreferredWidthForColumns and distributeAvailableSpace functions
https://bugs.webkit.org/show_bug.cgi?id=227669
Reviewed by Antti Koivisto.
Let's create some sub-scopes within these long functions to make them read better.
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns):
* layout/formattingContexts/table/TableLayout.cpp:
(WebCore::Layout::distributeAvailableSpace):
2021-07-04 Alan Bujtas <zalan@apple.com>
[LFC][TFC] 100% percent width column(s) make the table stretch
https://bugs.webkit.org/show_bug.cgi?id=227667
Reviewed by Antti Koivisto.
This patch addresses the odd transition of going from 99% to 100% in accumulated percent width.
Test: fast/layoutformattingcontext/table-space-width-100-percent-quirk.html
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns):
2021-07-01 Dean Jackson <dino@apple.com>
Move BottomControlsBarHeight and InsideMargin to be computed at runtime
https://bugs.webkit.org/show_bug.cgi?id=227505
<rdar://problem/79932256>
Reviewed by Devin Rousso.
Rather than having two JS constants that have to be kept in sync
with CSS, simply retrieve the value from the computed style.
No change in behaviour.
* Modules/modern-media-controls/controls/inline-media-controls.js:
(InlineMediaControls.prototype.layout):
* Modules/modern-media-controls/controls/media-controls.css:
(:host(audio), :host(video.media-document.audio), *):
* Modules/modern-media-controls/controls/layout-node.js: Add two helpers to
retrive computed style values.
2021-07-03 Alexey Shvayka <shvaikalesh@gmail.com>
[WebIDL] Rework runtime enabled properties leveraging PropertyCallback
https://bugs.webkit.org/show_bug.cgi?id=227275
Reviewed by Saam Barati.
This performance-neutral change makes implementation of runtime enabled properties independent
of eager property reification, slightly optimizing DOM global objects initialization.
A follow-up patch (webkit.org/b/158557) will remove eager property reification of WebIDL
constructors / prototypes, further reducing CPU usage and memory cost on page load.
Provided we reify properties without creating transitions and avoid conversion to a cacheable
dictionary, that should not regress performance & memory usage as well. Non-reified custom
accessors / values are inline-cached, even through JSProxy. DOM methods are reified on first
lookup; the same approach is used for multiple hot JSC built-ins (e.g. StringPrototype).
A huge refactoring was required to keep generation of lazy property callbacks within a single
function. Handling of private identifiers was decoupled from public ones, while hash table
generation for constructors / prototypes / instances was merged into GenerateHashTable.
This approach preserves HashTable's immutability while avoiding addition of extra checks to
entry lookup and memory usage increase. Another important advantage: a feature that was
enabled after its interface was created, immediately becomes usable (no page reload needed).
Also, this change removes all usages of DeletePropertyModeScope from WebCore, which was used
to disable non-configurable constants at runtime, allowing its complete removal in the future.
No new tests, no behavior change.
* bindings/js/JSDOMBuiltinConstructor.h:
* bindings/js/JSDOMConstructor.h:
* bindings/js/JSDOMConstructorNotCallable.h:
* bindings/js/JSDOMConstructorNotConstructable.h:
* bindings/scripts/CodeGeneratorJS.pm:
Extract IDLInterface::className() to avoid passing $className as an argument.
(InstanceOperationCount): Deleted.
(PrototypeOperationCount): Deleted.
(InstancePropertyCount): Deleted.
(PrototypePropertyCount): Deleted.
(PrototypeHasStaticPropertyTable): Deleted.
(ConstructorHasProperties):
(PrototypeHasProperties):
(InstanceHasProperties):
Remove *Count helpers because they were incorrect with constants, overloads, private identifiers,
and Symbol.iterator. Instead, do the count in GeneratePropertiesHashTable to avoid duplicate checks.
(GeneratePropertiesHashTable):
(GenerateHashTableValueArray):
- Compute $hasSetterOrReadonlyProperties early because it's impossible to detect runtime enabled accessors,
which are concealed behind PropertyAttribute::PropertyCallback, in GenerateHashTableValueArray.
- Set HashTable.hasSetterOrReadonlyProperties to `true` if a read-only value (constant) was seen.
(GenerateRuntimeEnableConditionalString):
Always use provided $globalObjectPtr parameter.
(GenerateHashTable):
- Simplify name inference for HashTable's values / indices since hash table names never include ":".
- Nicely simplify generation of hash table kind comment.
- Set HashTable.classForThis to `nullptr` for constructors because they can't have DOMAttribute properties.
(GenerateImplementation):
- Set ReadOnly attribute for runtime read-only accessors that shadow setter from static hash table.
- Reify "entries" property of an iterable interface to ensure its identity with Symbol.iterator method.
(GeneratePrivateIdentifiers):
- Add support for accelerated DOM attributes, which are rather common.
- Add support for static operations, which we have a use case for (see @whenSignalAborted).
(GeneratePrototypeDeclaration):
Set HasStaticPropertyTable structure flag for global interfaces as well, progressing idlharness.js test.
(GenerateConstructorHelperMethods):
Ensure that HasStaticPropertyTable structure flag is set for constructors as well.
(StringifyJSCAttributes):
(GetJSCAttributesForAttribute):
(ShouldBeOnInstance):
(GenerateHeader):
(GetAttributeGetter):
(GetAttributeSetter):
(GetAttributeJSValue):
(GetOperationJSValue):
(GenerateLazyPropertyCallbacks):
(GenerateCallbackImplementationContent):
(GetRuntimeEnabledStaticProperties): Deleted.
* bindings/scripts/test/JS/*: Updated.
* bindings/scripts/test/DOMWindowConstructors.idl:
* bindings/scripts/test/TestEnabledBySetting.idl:
* bindings/scripts/test/TestObj.idl:
Cover [PrivateIdentifiers] with accelerated DOM attributes, static operations, and constructors.
2021-07-03 Alan Bujtas <zalan@apple.com>
REGRESSION (r278377): incorrect hit-testing with clip-path()
https://bugs.webkit.org/show_bug.cgi?id=227624
<rdar://problem/79845896>
Reviewed by Simon Fraser.
Use the correct coordinate space for clip-path based hittesting.
1. The hittest location is in the coordinate space of the painting root (hittesting is similar to painting in this context).
2. RenderBox::hitTestClipPath's accumulatedOffset (as the name implies) should include the offset from the (paint) hittest root.
3. The clip-path intersecting takes coordinates relative to the containing block.
Test: fast/clip/hit-test-with-clip-path.html
* rendering/RenderBox.cpp:
(WebCore::RenderBox::hitTestVisualOverflow const):
(WebCore::RenderBox::hitTestClipPath const): Make the hittest root coordinates relative to the containing block.
(WebCore::RenderBox::hitTestBorderRadius const):
* rendering/RenderBox.h: Let's not use locationInContainer name as it is way too generic and misleading.
* rendering/RenderLayer.cpp: Compute and pass in proper accumulated offset value.
(WebCore::RenderLayer::hitTestLayer):
2021-07-03 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Add support for priority list of width types when expanding columns
https://bugs.webkit.org/show_bug.cgi?id=227627
Reviewed by Antti Koivisto.
When expanding the columns to use the extra space available, we need to prioritize certain columns
with specific width types: fixed > percent > relative > auto
This is _almost_ the reversed version of the shrinking priority list (but not quite).
Now we can have mixed column types across multiple rows with expanding and shrinking columns.
Test: fast/layoutformattingcontext/table-space-mixed-width-type-simple3.html
* layout/formattingContexts/table/TableLayout.cpp:
(WebCore::Layout::distributeAvailableSpace):
2021-07-03 Jean-Yves Avenard <jya@apple.com>
SourceBuffer.abort() doesn't go back to state WAITING_FOR_SEGMENT properly
https://bugs.webkit.org/show_bug.cgi?id=227559
<rdar://problem/79996056>
Reviewed by Eric Carlson.
Per spec, calling sourcebuffer.abort method should allow you to add a new segment
immediately after, as abort moves the append state back to WAITING_FOR_SEGMENT.
A segment can be either an init segment or a media segment.
We used to discard all further content until an init segment was encountered.
This could be problematic due to the typical use case of abort:
1- Seek to a location
2- Append a partial media segment long enough to finish seeking and display the
new content at the new position.
If multiple seeks were done in rapid succession, abort() is called right after
before starting the new seek so that we can add the new segment, regardless of what
was appended before.
YouTube applies a workaround for Safari where it will always append an init segment
after calling abort, this is different to what they do with Firefox (and likely Chrome).
To be able to resume after appending a partial media segment we must ensure that the
SourceBufferParser is always left in a sane context, and not be interrupted at some
random points. The abort() call used to interrupt the buffer parsing on the fly and
then reset things which would require a new init segment to restart.
Instead we always fully parse the pending buffer received befofe the call to abort.
The SourceBufferParserAVFObjC could already properly deal with discontinuity unlike
SourceBufferParserWebM.
To ensure that buffers sent after the call to abort() are only ever processed once
the pending ones have been parsed, and in order to avoid having blocking calls
we play with the order in which tasks are scheduled.
Fly-by fixes:
- The SourceBufferParser handle two types of parser: SourceBufferParser and the
platform specific AVStreamDataParser. Rename the accessor method to more clearly
differentate which parser we are dealing with.
- The SourceBufferParserWebM and SourceBufferPrivateAVFObjC used different task dispatching
mechanisms. We make them both share the same one now found in the base class.
Tests: media/media-source/media-mp4-h264-partial-abort.html
media/media-source/media-webm-opus-partial-abort.html
* platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
(WebCore::CDMSessionAVContentKeySession::~CDMSessionAVContentKeySession): rename method.
* platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
(WebCore::CDMSessionAVStreamSession::~CDMSessionAVStreamSession): rename method.
(WebCore::CDMSessionAVStreamSession::update): rename method.
* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm: rename method.
(WebCore::CDMSessionMediaSourceAVFObjC::addSourceBuffer): rename method.
(WebCore::CDMSessionMediaSourceAVFObjC::removeSourceBuffer): rename method.
* platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.h: rename method, remove
now unused member.
* platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::removeCodedFrames): Postpone call to ensure
we are running the remove frame algorithm once all pending frames have been processed.
(WebCore::SourceBufferParserAVFObjC::resetParserState): Remove use of m_discardSamplesUntilNextInitializationSegment.
(WebCore::SourceBufferParserAVFObjC::didParseStreamDataAsAsset): Change to base dispatch method.
(WebCore::SourceBufferParserAVFObjC::didFailToParseStreamDataWithError): Change to base dispatch method.
(WebCore::SourceBufferParserAVFObjC::didProvideMediaDataForTrackID): Change to base dispatch method.
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: Rename methods. Remove no longer used
members.
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::didParseInitializationData): No longer use a Cancellable task
as we never cancel it anymore.
(WebCore::SourceBufferPrivateAVFObjC::append): re-schedule the append task immediately to ensure
that processed packets flushed on the parser queue during abort are handled in the right order on
the main thread.
(WebCore::SourceBufferPrivateAVFObjC::appendCompleted): Check that abort wasn't called since append started
to ensure that no updateend event is incorrectly fired twice.
(WebCore::SourceBufferPrivateAVFObjC::abort): Abort is now a no-op that only set the m_abortCalled member.
(WebCore::SourceBufferPrivateAVFObjC::resetParserState): Change the order of operations so that the
SourceBufferParser is only reset after it has finished processing its data.
(WebCore::SourceBufferPrivateAVFObjC::destroyStreamDataParser): Use rename method.
(WebCore::SourceBufferPrivateAVFObjC::removedFromMediaSource): Use rename method.
(WebCore::SourceBufferPrivateAVFObjC::streamDataParser const): Renamed method from "parser"
(WebCore::SourceBufferPrivateAVFObjC::attemptToDecrypt): Use renamed method.
* platform/graphics/cocoa/SourceBufferParser.cpp:
(WebCore::callOnMainThreadCallback): Move dispatch method from SourceBufferParserWebM
(WebCore::SourceBufferParser::setCallOnClientThreadCallback):
(WebCore::SourceBufferParser::SourceBufferParser):
* platform/graphics/cocoa/SourceBufferParser.h:
* platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::SourceBufferParserWebM::SourceBufferParserWebM):
(WebCore::SourceBufferParserWebM::resetParserState): Don't clear the data set by parsing
the previous init segment. Set the parsing state to waiting for a new segment if an
init segment has been fully parsed.
(WebCore::SourceBufferParserWebM::OnElementEnd):
(WebCore::SourceBufferParserWebM::OnEbml):
(WebCore::SourceBufferParserWebM::VideoTrackData::reset):
(WebCore::SourceBufferParserWebM::VideoTrackData::consumeFrameData):
(WebCore::SourceBufferParserWebM::AudioTrackData::reset):
* platform/graphics/cocoa/SourceBufferParserWebM.h:
2021-07-02 Joonghun Park <jh718.park@samsung.com>
Unreviewed. Remove the build warning below since r279498.
warning: redundant move in return statement [-Wredundant-move]
No new tests, no new behavioral changes.
* css/parser/CSSPropertyParserWorkerSafe.cpp:
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceUnicodeRange):
2021-07-02 Chris Dumez <cdumez@apple.com>
[MacOS wk1] crypto/workers/subtle/hrsa-postMessage-worker.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=227540
<rdar://problem/79977662>
Reviewed by Geoffrey Garen.
The test was sending 2 messages to the worker, the first one with the public key
and the second one for the private key. As the worker would receive those messages,
it would do some checks synchronously and post a message back to the main thread
script with the result. As we could see from the test's expected results, the
main thread script would usually (although flakily) receive the result for the
private key *before* the result for the public key, which was wrong.
The reason for this was that serializing / deserializing the crypto key would
spin the worker's run loop and the worker would thus process incoming messages
while serializing / deserializing a crypto key from a previous message.
To address the issue, we now use a BinarySemaphore to wait for the main thread
to finish the wrapping / unwrapping, instead of spinning the run loop.
No new tests, unskipped existing test.
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::wrapCryptoKey):
(WebCore::WorkerGlobalScope::unwrapCryptoKey):
2021-07-02 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Keep track of both the fixed and percent maximum values for each column
https://bugs.webkit.org/show_bug.cgi?id=227491
Reviewed by Antti Koivisto.
This patch is in preparation for supporting mixed column width types when each row
has diffrent type of widths (e.g <tr><td style="width: 100px;"></td></tr><tr><td style="width: 10%;"></td></tr>)
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns):
2021-07-02 Alan Bujtas <zalan@apple.com>
[LFC][TFC] TableGrid::Column holds both the computed and the used width values
https://bugs.webkit.org/show_bug.cgi?id=227488
Reviewed by Antti Koivisto.
This patch cleans up TableGrid::Column interface to ensure we don't confused
the computed and the used widths for columns.
This is also in prepartion for adding mixed width type support.
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::setUsedGeometryForCells):
(WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns):
(WebCore::Layout::TableFormattingContext::computeAndDistributeExtraSpace):
* layout/formattingContexts/table/TableFormattingGeometry.cpp:
(WebCore::Layout::TableFormattingGeometry::horizontalSpaceForCellContent const):
* layout/formattingContexts/table/TableGrid.cpp:
(WebCore::Layout::TableGrid::Column::setLogicalWidth): Deleted.
(WebCore::Layout::TableGrid::Column::logicalWidth const): Deleted.
(WebCore::Layout::TableGrid::Column::setLogicalLeft): Deleted.
(WebCore::Layout::TableGrid::Column::logicalLeft const): Deleted.
* layout/formattingContexts/table/TableGrid.h:
(WebCore::Layout::TableGrid::Column::usedLogicalRight const):
(WebCore::Layout::TableGrid::Column::computedLogicalWidth const):
(WebCore::Layout::TableGrid::Columns::logicalWidth const):
(WebCore::Layout::TableGrid::Column::setComputedLogicalWidth):
(WebCore::Layout::TableGrid::Column::setUsedLogicalWidth):
(WebCore::Layout::TableGrid::Column::usedLogicalWidth const):
(WebCore::Layout::TableGrid::Column::setUsedLogicalLeft):
(WebCore::Layout::TableGrid::Column::usedLogicalLeft const):
(WebCore::Layout::TableGrid::Column::logicalRight const): Deleted.
(WebCore::Layout::TableGrid::Column::fixedWidth const): Deleted.
(WebCore::Layout::TableGrid::Column::percent const): Deleted.
(WebCore::Layout::TableGrid::Column::setFixedWidth): Deleted.
(WebCore::Layout::TableGrid::Column::setPercent): Deleted.
* layout/formattingContexts/table/TableLayout.cpp:
(WebCore::Layout::TableFormattingContext::TableLayout::distributedHorizontalSpace):
2021-07-02 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r279487.
https://bugs.webkit.org/show_bug.cgi?id=227626
Added broken ios-wk2 test
Reverted changeset:
"WebAudio auto-play policy should come from top document"
https://bugs.webkit.org/show_bug.cgi?id=227593
https://commits.webkit.org/r279487
2021-07-02 Youenn Fablet <youenn@apple.com>
Make LocalSampleBufferDisplayLayer::requestNotificationWhenReadyForVideoData hop to main thread before hopping to processing thread
https://bugs.webkit.org/show_bug.cgi?id=227444
<rdar://79413368>
Reviewed by Chris Dumez.
It is safer to hop to main thread in requestNotificationWhenReadyForVideoData callback so that we can check weakThis safely.
When in main thread, hop to processing thread if LocalSampleBufferDisplayLayer is alive.
* platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:
(WebCore::LocalSampleBufferDisplayLayer::~LocalSampleBufferDisplayLayer):
(WebCore::LocalSampleBufferDisplayLayer::requestNotificationWhenReadyForVideoData):
2021-06-30 Darin Adler <darin@apple.com>
CSS parser using a token for Unicode ranges, but recent CSS specification says it should not
https://bugs.webkit.org/show_bug.cgi?id=227569
Reviewed by Sam Weinig.
Tests: imported/w3c/web-platform-tests/css/css-syntax/unicode-range-selector.html
imported/w3c/web-platform-tests/css/css-syntax/urange-parsing.html
* css/parser/CSSParserToken.cpp:
(WebCore::CSSParserToken::CSSParserToken): Change the NumberToken constructor to
take a StringView so we can recover the original text if we need to parse it as
part of a Unicode range.
(WebCore::mergeIfAdjacent): Added. Helper used by convertToDimensionWithUnit.
(WebCore::CSSParserToken::convertToDimensionWithUnit): If the number token string
is adjacent to the dimension, then store the string containing both, so it can
be used if we need to parse it as part of a Unicode range. If the string is long,
then don't bother because a long string can't be part of such a range anyway. We
use 4 bits for the length, so can handle lengths in the range [1,15].
(WebCore::CSSParserToken::originalText const): Added. Used to recover the original
text for Unicode range parsing.
(WebCore::CSSParserToken::unitString const): Added. Used to get just the unit part
of the string for DimensionToken, since the full string now can include the number
as well in some cases (see above).
(WebCore::CSSParserToken::copyWithUpdatedString const): Changed the argument type
to StringView instead of using const& and added an assertion since this is only
safe if we are moving the backing characters, not changing the string contents.
(WebCore::CSSParserToken::valueDataCharRawEqual const): Deleted.
(WebCore::CSSParserToken::operator== const): Use StringView == operator instead of
our own valueDataCharRawEqual function. Also use unitString for DimensionToken.
(WebCore::CSSParserToken::serialize const): Use unitString for DimensionToken.
* css/parser/CSSParserToken.h: Updated for the above. Also deleted
UnicodeRangeToken, unicodeRangeStart, unicodeRangeEnd, and m_unicodeRange.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeResolutionCSSPrimitiveValueWithKnownTokenTypeDimension):
Use unitString for DimensionToken.
(WebCore::CSSPropertyParserHelpers::parseHexColor): Ditto.
* css/parser/CSSPropertyParserWorkerSafe.cpp:
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeOptionalDelimiter): Added.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeIdentifier): Added.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeAndAppendOptionalNumber): Added.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeAndAppendOptionalDelimiter): Added.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeAndAppendOptionalQuestionMarks): Added.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeUnicodeRangeString): Added.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeUnicodeRange): Added. Along with the
functions above, this implements the CSS specification's algorithm for consuming a Unicode
range, based on existing tokens without requiring a <urange> token.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceUnicodeRange): Call
the new consumeUnicodeRange function from this file instead of the old one that
depended on a <urange> token. Also refactored to use auto and to do the validity
check for the range as specified.
* css/parser/CSSSelectorParser.cpp:
(WebCore::consumeANPlusB): Use unitString for DimensionToken.
* css/parser/CSSTokenizer.cpp:
(WebCore::CSSTokenizer::letterU): Deleted.
(WebCore::CSSTokenizer::consumeNumber): Added code to pass in the original text
when constructing a NumberToken.
(WebCore::CSSTokenizer::consumeUnicodeRange): Deleted.
* css/parser/CSSTokenizer.h: Deleted consumeUnicodeRange.
* css/parser/SizesCalcParser.cpp:
(WebCore::SizesCalcParser::calcToReversePolishNotation): Removed case for
UnicodeRangeToken.
* dom/ConstantPropertyMap.cpp:
(WebCore::variableDataForPositivePixelLength): Pass a null StringView for the
original text when constructing a NumberToken. This is OK for now since this token
won't ever be parsed as part of a Unicode range, and we can change it if we ever
need to support originalText for any other cases.
(WebCore::variableDataForPositiveDuration): Ditto.
2021-07-01 Ben Nham <nham@apple.com>
Unreviewed, reverting r279172.
Broke WebGL context construction on some devices.
Reverted changeset:
"rAF driven WebGL submits excessive amount of GPU work when frames are slow"
https://bugs.webkit.org/show_bug.cgi?id=227059
https://commits.webkit.org/r279172
2021-07-01 Jean-Yves Avenard <jya@apple.com>
[Cocoa] Last few seconds of 'audio/webm; codecs=vorbis' appended to a SampleBuffer are not played
https://bugs.webkit.org/show_bug.cgi?id=226069
rdar://79951528
Reviewed by Jer Noble.
Source/WebCore:
When parsing samples from a WebM file, the samples emitted by the parser can be very short in
duration, which is ineffecient both in storage costs in our SampleMap, as well as in decoding
CPU costs, as each sample must be fed into the decoder separately. So the parser will group
together these small samples into a larger "meta sample" with a duration no shorter than 2s.
However, at the end of a file, no more sample data will be appended, up to 2s of audio data
will not be emitted from the parser.
At the end of an append, always flush audio track data to ensure that all parsed samples are
emitted, regardless of their collective duration.
Drive-by Fixes:
- The logic to handle a partial frame was incorrect. libwebm will always progress and call
Callback's OnFrame even with partial content as soon as the frame size has been determined.
bytesRemaining actually contains how many bytes there are available to read and that the
Callback should attempt to fetch.
The Callback should then return Status::kOkPartial if the full frame hasn't been seen yet
or Status::kOkCompleted if it has. kWouldBlock indicates that we do not have information to
read. kOkPartial and kWouldBlock indicates that libwebm should
retry later to complete the current frame. All other codes indicate an error.
- createSampleBuffer() would use the entire m_packetsData to create a CMSampleBuffer, even if partial
data was read but not yet complete. Only use the fully parsed data to create the CMSampleBuffer.
When the fully parsed packets are removed from packetsData; adjust the offset of the start of the
current partial data (this was the primary cause for bug 227499 that caused the first backout)
- consumeFrameData() would only increase the size of m_packetsData when m_currentPacketSize was
unset, which would leave the buffer zeroed when partial sample data was present. Always grow
m_packetsData to be large enough to receive the read data.
- The Read() method would not return the correct number of bytes read (0) when a null destination
buffer was passed in.
- Bug 227382 - SourceBufferParserWebM::StreamingVectorReader Read() returns an incorrect value
for numActuallyRead when moving to the next segment.
Test: media/media-source/media-vorbis-partial.html
media/media-source/media-opus-partial.html
* platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::SourceBufferParserWebM::appendData):
(WebCore::SourceBufferParserWebM::VideoTrackData::consumeFrameData):
(WebCore::SourceBufferParserWebM::VideoTrackData::createSampleBuffer):
(WebCore::SourceBufferParserWebM::AudioTrackData::consumeFrameData):
(WebCore::SourceBufferParserWebM::AudioTrackData::createSampleBuffer):
* platform/graphics/cocoa/SourceBufferParserWebM.h: Rename some members to better indicate what
they contain. Move some members to the base class as they are always used by Video and Audio.
LayoutTests:
* platform/mac/TestExpectations:
* media/media-source/content/test-vorbis-manifest.json: Added.
* media/media-source/content/test-vorbis.webm: Added.
* media/media-source/content/test-opus-manifest.json: Added.
* media/media-source/content/test-opus.webm: Added.
* media/media-source/media-vorbis-partial-expected.txt: Added.
* media/media-source/media-vorbis-partial.html: Added.
* media/media-source/media-opus-partial-expected.txt: Added.
* media/media-source/media-opus-partial.html: Added.
2021-07-01 John Wilander <wilander@apple.com>
PCM: Change import from CryptoKitCBridging to CryptoKitPrivate
https://bugs.webkit.org/show_bug.cgi?id=227556
<rdar://79992592>
Reviewed by Alex Christensen.
Patch by Frederic Jacobs.
No new tests since no functionality is changed.
* loader/cocoa/PrivateClickMeasurementCocoa.mm:
Changed import from CryptoKitCBridgingSoftLink.h to CryptoKitPrivateSoftLink.h.
2021-07-01 Alex Christensen <achristensen@webkit.org>
Align beacon CORS mode with Chrome and Firefox
https://bugs.webkit.org/show_bug.cgi?id=227590
Reviewed by Chris Dumez.
This follows https://w3c.github.io/beacon/#sec-processing-model step 6.3.
Now we pass a WPT test that Chrome and Firefox already passed.
* Modules/beacon/NavigatorBeacon.cpp:
(WebCore::NavigatorBeacon::sendBeacon):
2021-07-01 Amir Mark Jr <amir_mark@apple.com>
Unreviewed, reverting r279481.
Broke a pre-existing test
Reverted changeset:
"Move BottomControlsBarHeight and InsideMargin to be computed
at runtime"
https://bugs.webkit.org/show_bug.cgi?id=227505
https://commits.webkit.org/r279481
2021-07-01 Eric Carlson <eric.carlson@apple.com>
WebAudio auto-play policy should come from top document
https://bugs.webkit.org/show_bug.cgi?id=227593
rdar://76920375
Reviewed by Chris Dumez.
Tests: media/auto-play-video-in-about-blank-iframe.html
media/auto-play-web-audio-in-about-blank-iframe.html
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::constructCommon): Get auto-play policy from document()->topDocument().
* testing/Internals.cpp:
(WebCore::Internals::setDocumentAutoplayPolicy): New method to test auto-play policy.
* testing/Internals.h:
* testing/Internals.idl:
2021-07-01 Youenn Fablet <youenn@apple.com>
Disable relay for UDP sockets when not needed
https://bugs.webkit.org/show_bug.cgi?id=227253
Reviewed by Eric Carlson.
* Modules/mediastream/PeerConnectionBackend.h:
(WebCore::PeerConnectionBackend::shouldFilterICECandidates const):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::setConfiguration):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
(WebCore::LibWebRTCMediaEndpoint::rtcSocketFactory):
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::LibWebRTCPeerConnectionBackend::disableICECandidateFiltering):
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:
2021-07-01 Dean Jackson <dino@apple.com>
Move BottomControlsBarHeight and InsideMargin to be computed at runtime
https://bugs.webkit.org/show_bug.cgi?id=227505
<rdar://problem/79932256>
Reviewed by Devin Rousso.
Rather than having two JS constants that have to be kept in sync
with CSS, simply retrieve the value from the computed style.
No change in behaviour.
* Modules/modern-media-controls/controls/inline-media-controls.js:
(InlineMediaControls.prototype.layout):
* Modules/modern-media-controls/controls/media-controls.css:
(:host(audio), :host(video.media-document.audio), *):
* Modules/modern-media-controls/controls/layout-node.js: Add two helpers to
retrive computed style values.
2021-07-01 Brady Eidson <beidson@apple.com>
HIDGamepadProvider adds an extra 50ms to all inputs
<rdar://70315838> and https://bugs.webkit.org/show_bug.cgi?id=217742
Reviewed by Alex Christensen.
No new tests.
Tried to write an API test to drive inputs in the delay range, but that was way too fragile
on a local developer machine, much less a bot that's under load.
These input delays were an early best-effort to get input to line up with RaF, which the spec
mentions as a goal.
Not sure how 50 slipped in for HID, vs the 16 on GCF.
Whether or not lining up perfectly with RaF is actually a useful goal, in the meantime driving
input as quickly as possible seems much more desirable.
We still want to coalesce multiple close together inputs into 1 logical event to smooth out jitter
with certain devices, and reduce IPC and DOM object churn during rapid input (or with buggy devices).
In testing with what I have on my desk, using a true 0-delay timer for that was not desirable.
But 1ms seems peachy keen.
* platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
* platform/gamepad/mac/HIDGamepadProvider.mm:
2021-07-01 Dean Jackson <dino@apple.com>
Add a layoutTrait for an additional controls scale factor
https://bugs.webkit.org/show_bug.cgi?id=227561
<rdar://problem/79997951>
Reviewed by Anders Carlsson.
Allow controls with different layout traits to apply
a scale factor to their buttons.
No change in behaviour.
* Modules/modern-media-controls/controls/button.js:
(Button.prototype._updateImageMetrics):
(Button):
* Modules/modern-media-controls/controls/layout-traits.js:
(LayoutTraits.prototype.additionalControlScaleFactor):
(LayoutTraits):
2021-07-01 Antoine Quint <graouts@webkit.org>
[Model] Restrict IPC calls to ARKit SPI availability and runtime flag
https://bugs.webkit.org/show_bug.cgi?id=227581
Reviewed by Tim Horton.
Guard all IPC calls related to <model> by the most appropriate platform-specific flag
and also ensure that those calls don't do anything unless the runtime flag is also
enabled.
* Modules/model-element/HTMLModelElement.cpp:
* Modules/model-element/HTMLModelElement.h:
* Modules/model-element/HTMLModelElementCocoa.mm:
(WebCore::HTMLModelElement::inlinePreviewDidObtainContextId):
* loader/EmptyClients.cpp:
(WebCore::EmptyChromeClient::modelElementDidCreatePreview const):
* loader/EmptyClients.h:
* page/ChromeClient.h:
2021-07-01 Youenn Fablet <youenn@apple.com>
ReadableStream.getReader do not throw a proper exception when parameter is of wrong type
https://bugs.webkit.org/show_bug.cgi?id=226220
<rdar://problem/78711382>
Reviewed by Chris Dumez.
Covered by rebased tests.
* Modules/streams/ReadableStream.js:
(getReader):
Tighten option parameter check.
In case mode is bad, fire a type error instead of range error.
2021-07-01 Amir Mark Jr <amir_mark@apple.com>
Unreviewed, reverting r279452.
Broke MacOS build
Reverted changeset:
"PCM: Change import from CryptoKitCBridging to
CryptoKitPrivate"
https://bugs.webkit.org/show_bug.cgi?id=227556
https://commits.webkit.org/r279452
2021-07-01 Alan Bujtas <zalan@apple.com>
VisiblePosition::absoluteSelectionBoundsForLine fails on multiline vertical-rl content
https://bugs.webkit.org/show_bug.cgi?id=227543
<rdar://79887141>
Reviewed by Simon Fraser.
absoluteSelectionBoundsForLine flips the line's logical rect for the writing mode (horizontal vs. vertical)
but not for the block flow direction (ltr vs. rtl).
This adjustment is very similar to what we do in absoluteCaretBounds (see absoluteBoundsForLocalCaretRect).
* editing/VisiblePosition.cpp:
(WebCore::VisiblePosition::absoluteSelectionBoundsForLine const):
* testing/Internals.cpp:
(WebCore::Internals::absoluteLineRectFromPoint):
* testing/Internals.h:
* testing/Internals.idl:
2021-07-01 Carlos Garcia Campos <cgarcia@igalia.com>
REGRESSION(r278062): [Nicosia] Threaded rendering is broken since r278062
https://bugs.webkit.org/show_bug.cgi?id=227578
Reviewed by Žan Doberšek.
Since r278062 NicosiaCairoOperationRecorder is a GraphicsContext class, so we need to bring back things
previously done by the base class and chain up to base class save/restore and being/end transparency.
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
(Nicosia::CairoOperationRecorder::fillPath):
(Nicosia::CairoOperationRecorder::strokePath):
(Nicosia::CairoOperationRecorder::drawLine):
(Nicosia::CairoOperationRecorder::drawLinesForText):
(Nicosia::CairoOperationRecorder::drawFocusRing):
(Nicosia::CairoOperationRecorder::save):
(Nicosia::CairoOperationRecorder::restore):
(Nicosia::CairoOperationRecorder::beginTransparencyLayer):
(Nicosia::CairoOperationRecorder::endTransparencyLayer):
2021-07-01 Youenn Fablet <youenn@apple.com>
[Cocoa] Migrate WebRTC UDP socket handling to NW API
https://bugs.webkit.org/show_bug.cgi?id=227210
Reviewed by Eric Carlson.
Add infrastructure to new experimental feature flag for NW backed UDP sockets.
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::webRTCPlatformTCPSocketsEnabled const):
(WebCore::RuntimeEnabledFeatures::setWebRTCPlatformTCPSocketsEnabled):
(WebCore::RuntimeEnabledFeatures::webRTCPlatformUDPSocketsEnabled const):
(WebCore::RuntimeEnabledFeatures::setWebRTCPlatformUDPSocketsEnabled):
2021-07-01 Carlos Garcia Campos <cgarcia@igalia.com>
[Cairo] Simplify GraphicsContextCairo creation
https://bugs.webkit.org/show_bug.cgi?id=227575
Reviewed by Žan Doberšek.
Remove the constructors taking a PlatformContextCairo and add two that receive a RefPtr<cairo_t>&& and
cairo_surface_t*. In both cases the PlatformContextCairo is created, so it's now always owned and callers don't
need to create it.
No change in behavior, covered by existing tests.
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContextCairo::GraphicsContextCairo):
(WebCore::GraphicsContextCairo::drawLine):
* platform/graphics/cairo/GraphicsContextCairo.h:
* platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp:
(WebCore::ImageBufferCairoSurfaceBackend::ImageBufferCairoSurfaceBackend):
(WebCore::ImageBufferCairoSurfaceBackend::context const):
* platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h:
* platform/graphics/cairo/NativeImageCairo.cpp:
* platform/graphics/cairo/PlatformContextCairo.cpp:
(WebCore::PlatformContextCairo::PlatformContextCairo):
* platform/graphics/cairo/PlatformContextCairo.h:
(WebCore::PlatformContextCairo::cr const):
(WebCore::PlatformContextCairo::cr): Deleted.
(WebCore::PlatformContextCairo::setCr): Deleted.
* platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp:
(Nicosia::PaintingContextCairo::ForPainting::ForPainting):
(Nicosia::PaintingContextCairo::ForPainting::~ForPainting):
(Nicosia::PaintingContextCairo::ForPainting::replay):
* platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.h:
* platform/graphics/win/GraphicsContextCairoWin.cpp:
(WebCore::GraphicsContextCairo::GraphicsContextCairo):
* platform/graphics/win/ImageCairoWin.cpp:
(WebCore::BitmapImage::getHBITMAPOfSize):
2021-07-01 Youenn Fablet <youenn@apple.com>
RealtimeIncomingAudioSourceCocoa should support other sample rate than 48000
https://bugs.webkit.org/show_bug.cgi?id=227439
Reviewed by Eric Carlson.
We reduced memory allocations by early allocating buffers for the most often used sample rate (48000), but this broke other sample rates, like for G722.
Make sure to update sample rate and buffers if it is not 48000.
Since the initial OnData call is often with a sample rate of 16000 and switches to 48000 after a few calls, early return for a few initial calls (20) or if sample rate is not 16000.
Covered by updated test.
* platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:
(WebCore::RealtimeIncomingAudioSourceCocoa::OnData):
* platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.h:
2021-07-01 Emilio Cobos Álvarez <emilio@crisal.io>
Support unprefixed :autofill pseudo-class.
https://bugs.webkit.org/show_bug.cgi?id=220459
Reviewed by Antti Koivisto.
Tests: web-platform-tests/html/semantics/selectors/pseudo-classes/autofill.html
* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText const):
* css/SelectorPseudoClassAndCompatibilityElementMap.in:
2021-07-01 Tim Nguyen <ntim@apple.com>
Change `typedef EventSender<X> Y` to `using Y = EventSender<X>`
https://bugs.webkit.org/show_bug.cgi?id=227570
Reviewed by Antti Koivisto.
This is for consistency with HTMLDialogElement.h, HTMLStyleElement.h and SVGSMILElement.h.
* html/HTMLDetailsElement.h:
* html/HTMLLinkElement.h:
* loader/ImageLoader.h:
2021-06-30 John Wilander <wilander@apple.com>
PCM: Change import from CryptoKitCBridging to CryptoKitPrivate
https://bugs.webkit.org/show_bug.cgi?id=227556
<rdar://79992592>
Reviewed by Alex Christensen.
Patch by Frederic Jacobs.
No new tests since no functionality is changed.
* loader/cocoa/PrivateClickMeasurementCocoa.mm:
Changed import from CryptoKitCBridgingSoftLink.h to CryptoKitPrivateSoftLink.h.
2021-06-30 Antoine Quint <graouts@webkit.org>
[Model] [macOS] Add support for rendering model resources
https://bugs.webkit.org/show_bug.cgi?id=227530
<rdar://problem/79968206>
Reviewed by Dean Jackson.
On macOS, ASVInlinePreview requires an instance in both the WebProcess and the UIProcess to exist with a matching UUID.
On the WebCore side, in the WebProcess, after writing the model resource as a file to disk, we create an instance when a
<model> element is created and message the UIProcess through the ChromeClient providing the UUID generated for it. When
the UIProcess is done processing this message, it will reply with another message which calls into
HTMLModelElement::inlinePreviewDidObtainContextId() with the matching UUID and a context ID for the remote context.
We can then set that remote context ID on our ASVInlinePreview instance.
We also introduce a HTMLModelElement::platformLayer() method such that RenderLayerBacking::updateConfiguration() can call
it to host the ASVInlinePreview layer.
* Modules/model-element/HTMLModelElement.cpp:
(WebCore::HTMLModelElement::~HTMLModelElement):
(WebCore::HTMLModelElement::setSourceURL):
(WebCore::HTMLModelElement::notifyFinished):
* Modules/model-element/HTMLModelElement.h:
* Modules/model-element/HTMLModelElementCocoa.mm: Added.
(WebCore::HTMLModelElement::createFile):
(WebCore::HTMLModelElement::clearFile):
(WebCore::HTMLModelElement::modelDidChange):
(WebCore::HTMLModelElement::inlinePreviewDidObtainContextId):
(WebCore::HTMLModelElement::platformLayer const):
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* loader/EmptyClients.cpp:
(WebCore::EmptyChromeClient::modelElementDidCreatePreview const):
* loader/EmptyClients.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::modelElementDidCreatePreview const):
* platform/Logging.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration):
2021-06-30 Megan Gardner <megan_gardner@apple.com>
Add ID and versioning support for AppHighlights
https://bugs.webkit.org/show_bug.cgi?id=227279
Reviewed by Tim Horton.
AppHighlights.AppHighlightRestoreFromStorage
AppHighlights.AppHighlightCreateAndRestoreAndDropBytes
AppHighlights.AppHighlightCreateAndRestoreWithLaterVersion
AppHighlights.AppHighlightCreateAndRestoreWithExtraBytes
AppHighlights.AppHighlightRestoreFromStorageV0
AppHighlights.AppHighlightRestoreFromStorageV1
Reformat the storage of Highlight Data to allow for accurate deletion of active
highlights, as well as making them more robust and future-proof. Support decoding v0
highlights as well.
* Modules/highlight/AppHighlightRangeData.cpp:
(WebCore::AppHighlightRangeData::NodePathComponent::decode):
(WebCore::AppHighlightRangeData::encode const):
(WebCore::AppHighlightRangeData::decode):
* Modules/highlight/AppHighlightRangeData.h:
(WebCore::AppHighlightRangeData::NodePathComponent::NodePathComponent):
(WebCore::AppHighlightRangeData::AppHighlightRangeData):
(WebCore::AppHighlightRangeData::identifier const):
(WebCore::AppHighlightRangeData::startOffset const):
(WebCore::AppHighlightRangeData::endOffset const):
* Modules/highlight/AppHighlightStorage.cpp:
(WebCore::createAppHighlightRangeData):
2021-06-30 Ryosuke Niwa <rniwa@webkit.org>
RemotePlayback must keep its media element alive when there is a pending activity
https://bugs.webkit.org/show_bug.cgi?id=227471
<rdar://79694015>
Reviewed by Geoffrey Garen.
Fixed the bug that the media element's JS wrapper can be collected while there is still
a pending activity for RemotePlayback. In fact, the newly added test demonstrates that
the media element can be deleted without this patch.
This patch also introduces new extended IDL interface attribute GenerateAddOpaqueRoot
to make adding an opaque root as a part of visitChildren easy in the DOM code.
Test: media/remoteplayback-watch-availability-gc.html
* Modules/remoteplayback/RemotePlayback.cpp:
(WebCore::RemotePlayback::ownerNode const):
* Modules/remoteplayback/RemotePlayback.h:
* Modules/remoteplayback/RemotePlayback.idl:
* bindings/scripts/CodeGeneratorJS.pm:
(InstanceNeedsVisitChildren):
(GenerateImplementation):
* bindings/scripts/IDLAttributes.json:
* bindings/scripts/test/BindingTestGlobalConstructors.idl:
* bindings/scripts/test/JS/JSTestGenerateAddOpaqueRoot.cpp: Added.
(WebCore::JSTestGenerateAddOpaqueRootDOMConstructor::prototypeForStructure):
(WebCore::JSTestGenerateAddOpaqueRootDOMConstructor::initializeProperties):
(WebCore::JSTestGenerateAddOpaqueRootPrototype::finishCreation):
(WebCore::JSTestGenerateAddOpaqueRoot::JSTestGenerateAddOpaqueRoot):
(WebCore::JSTestGenerateAddOpaqueRoot::finishCreation):
(WebCore::JSTestGenerateAddOpaqueRoot::createPrototype):
(WebCore::JSTestGenerateAddOpaqueRoot::prototype):
(WebCore::JSTestGenerateAddOpaqueRoot::getConstructor):
(WebCore::JSTestGenerateAddOpaqueRoot::destroy):
(WebCore::JSC_DEFINE_CUSTOM_GETTER):
(WebCore::jsTestGenerateAddOpaqueRoot_someAttributeGetter):
(WebCore::JSTestGenerateAddOpaqueRoot::subspaceForImpl):
(WebCore::JSTestGenerateAddOpaqueRoot::visitChildrenImpl):
(WebCore::JSTestGenerateAddOpaqueRoot::analyzeHeap):
(WebCore::JSTestGenerateAddOpaqueRootOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestGenerateAddOpaqueRootOwner::finalize):
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
(WebCore::JSTestGenerateAddOpaqueRoot::toWrapped):
* bindings/scripts/test/JS/JSTestGenerateAddOpaqueRoot.h: Added.
(WebCore::JSTestGenerateAddOpaqueRoot::create):
(WebCore::JSTestGenerateAddOpaqueRoot::createStructure):
(WebCore::JSTestGenerateAddOpaqueRoot::subspaceFor):
(WebCore::wrapperOwner):
(WebCore::wrapperKey):
(WebCore::toJS):
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::jsTestGlobalObject_TestGenerateAddOpaqueRootConstructorGetter):
(WebCore::JSC_DEFINE_CUSTOM_GETTER):
* bindings/scripts/test/SupplementalDependencies.dep:
* bindings/scripts/test/TestGenerateAddOpaqueRoot.idl: Added.
* testing/Internals.cpp:
(WebCore::Internals::isElementAlive const):
(WebCore::Internals::mediaElementCount):
* testing/Internals.h:
* testing/Internals.idl:
2021-06-30 Alex Christensen <achristensen@webkit.org>
REGRESSION(r278391) Sometimes load durations show up as large negative numbers in WebInspector
https://bugs.webkit.org/show_bug.cgi?id=227413
<rdar://79801896>
Reviewed by Chris Dumez.
In r278391 I changed the meaning of members of NetworkLoadMetrics from Seconds deltas from fetchStart
to the MonotonicTime at which each event occurred. I also changed InspectorNetworkAgent::didFinishLoading
accordingly, but I overlooked the fact that sometimes we get empty NetworkLoadMetrics that have been marked as complete,
such as from NetworkResourceLoader::didFinishWithRedirectResponse which indicates that it is complete but
members such as responseEnd are still 0. Rather than check if it is complete, check if the member is nonzero.
The layout test http/tests/inspector/network/resource-timing.html would fail on AS Macs when run after other tests before this change.
* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::didFinishLoading):
2021-06-30 Ryosuke Niwa <rniwa@webkit.org>
Use WeakHashMap and WeakPtr with Node in more places
https://bugs.webkit.org/show_bug.cgi?id=227192
<rdar://problem/79828322>
Reviewed by Geoffrey Garen.
Deploy WeakHashMap and WeakPtr with Node/Element in more places.
* dom/Document.cpp:
(WebCore::Document::elementForAccessKey):
(WebCore::Document::buildAccessKeyCache):
(WebCore::Document::registerForVisibilityStateChangedCallbacks):
(WebCore::Document::unregisterForVisibilityStateChangedCallbacks):
(WebCore::Document::visibilityStateChanged):
* dom/Document.h:
* dom/VisibilityChangeClient.h:
* html/FormController.cpp:
(WebCore::FormKeyGenerator::formKey):
(WebCore::FormKeyGenerator::willDeleteForm):
* html/HTMLAnchorElement.cpp:
(WebCore::rootEditableElementMap):
(WebCore::HTMLAnchorElement::rootEditableElementForSelectionOnMouseDown const):
(WebCore::HTMLAnchorElement::clearRootEditableElementForSelectionOnMouseDown):
(WebCore::HTMLAnchorElement::setRootEditableElementForSelectionOnMouseDown):
* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::bind):
(WebCore::InspectorDOMAgent::unbind):
(WebCore::InspectorDOMAgent::nodeForId):
(WebCore::InspectorDOMAgent::pushNodePathToFrontend):
(WebCore::InspectorDOMAgent::boundNodeId):
(WebCore::InspectorDOMAgent::willDestroyDOMNode):
(WebCore::InspectorDOMAgent::mediaMetricsTimerFired):
* inspector/agents/InspectorDOMAgent.h:
* inspector/agents/InspectorLayerTreeAgent.cpp:
(WebCore::InspectorLayerTreeAgent::bindPseudoElement):
(WebCore::InspectorLayerTreeAgent::unbindPseudoElement):
* inspector/agents/InspectorLayerTreeAgent.h:
* style/StyleSharingResolver.h:
2021-06-30 venky dass <yaranamavenkataramana@apple.com>
Updated to use smart pointers in MutationObserver.
https://bugs.webkit.org/show_bug.cgi?id=227518
Reviewed by Ryosuke Niwa.
* dom/MutationObserver.cpp:
(WebCore::MutationObserver::~MutationObserver):
(WebCore::MutationObserver::disconnect):
(WebCore::MutationObserver::observationStarted):
(WebCore::MutationObserver::observationEnded):
(WebCore::MutationObserver::isReachableFromOpaqueRoots const):
(WebCore::MutationObserver::deliver):
* dom/MutationObserver.h:
* dom/MutationObserverRegistration.h:
2021-06-30 Truitt Savell <tsavell@apple.com>
Unreviewed, reverting r279405.
Casued 50+ webrtc crashes on Big Sur Debug
Reverted changeset:
"[Cocoa] Migrate WebRTC UDP socket handling to NW API"
https://bugs.webkit.org/show_bug.cgi?id=227210
https://commits.webkit.org/r279405
2021-06-30 Darin Adler <darin@apple.com>
CSS specification prohibits numbers with trailing decimal point (e.g. "1.px"), but we allow them
https://bugs.webkit.org/show_bug.cgi?id=227517
Reviewed by Sam Weinig.
Test: imported/w3c/web-platform-tests/css/css-syntax/decimal-points-in-numbers.html
* css/parser/CSSParserFastPaths.cpp:
(WebCore::parseCSSNumber): Added. Checks for the trailing decimal point. Also uses
std::optional instead of a bool plus an out argument; should refactor the other functions
to work that way at some point.
(WebCore::parseSimpleLength): Use parseCSSNumber and isASCIIAlphaCaselessEqual.
(WebCore::parseSimpleAngle): Ditto.
(WebCore::parseTransformNumberArguments): Ditto.
2021-06-30 Kimmo Kinnunen <kkinnunen@apple.com>
toDataURL image upside down if premultipliedAlpha=false
https://bugs.webkit.org/show_bug.cgi?id=156129
<rdar://problem/53942867>
Reviewed by Kenneth Russell.
Flip the result `PixelBuffer` of `GraphicsContextGL::paintRenderingResultsToPixelBuffer()`
along the y-axis manually with memcpy.
ReadPixels returns the pixels upside down.
The `PixelBuffer` code-path is only used for reading unpremultiplied
image contents so that `toDataURL()` can encode the premultipliedAlpha=false
WebGL content as was rendered.
Other code-paths, such as Context2D.drawImage and drawing to the document,
use `GraphicsContextGL::paintRenderingResultsToCanvas()`.
In those cases y-flip is done by constructing a `ImageBuffer` for the PixelBuffer
and then using y-flip transform to draw the `ImageBuffer` to the target `ImageBuffer`
using `GraphicsContext`.
Fixes webgl/1.0.x/conformance/canvas/to-data-url-test.html
* platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
(WebCore::GraphicsContextGLOpenGL::paintRenderingResultsToPixelBuffer):
2021-06-30 Antoine Quint <graouts@webkit.org>
[Model] [iOS] Add support for displaying <model> in fullscreen
https://bugs.webkit.org/show_bug.cgi?id=227443
<rdar://problem/79859937>
Reviewed by Sam Weinig.
Expose a new enterFullscreen() method on HTMLModelElement allowing to enter a fullscreen AR experience
where the resource may be displayed in the user's environment. This differs from the existing
Element.requestFullscreen() method since the experience is provided by the platform and we're not
presenting the inline <model> element in a fullscreen window.
From the WebProcess side, this requires obtaining a reference to the content layer for the <model> element
and sending it in an IPC message to the UIProcess.
* Modules/model-element/HTMLModelElement.cpp:
(WebCore::HTMLModelElement::enterFullscreen):
* Modules/model-element/HTMLModelElement.h:
* Modules/model-element/HTMLModelElement.idl:
* loader/EmptyClients.cpp:
(WebCore::EmptyChromeClient::takeModelElementFullscreen const):
* loader/EmptyClients.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::takeModelElementFullscreen const):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::contentsLayerIDForModel const):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::contentsLayerIDForModel const):
* platform/graphics/ca/GraphicsLayerCA.h:
2021-06-30 Tim Nguyen <ntim@apple.com>
Add modal dialog UA styles
https://bugs.webkit.org/show_bug.cgi?id=226175
Reviewed by Antti Koivisto.
This adds an :-internal-modal-dialog pseudo class and a test to make sure it does not leak.
This improves WPT results a lot and expectations have been updated. Some tests start failing,
but those are mainly top-layer related (which isn't implemented yet).
* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText const):
* css/CSSSelector.h:
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne const):
* css/SelectorCheckerTestFunctions.h:
(WebCore::matchesModalDialogPseudoClass):
* css/SelectorPseudoClassAndCompatibilityElementMap.in:
* css/dialog.css:
(dialog:-internal-modal-dialog):
* css/parser/CSSSelectorParser.cpp:
(WebCore::CSSSelectorParser::consumePseudo):
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::JSC_DEFINE_JIT_OPERATION):
(WebCore::SelectorCompiler::addPseudoClassType):
* html/HTMLDialogElement.cpp:
(WebCore::HTMLDialogElement::showModal):
(WebCore::HTMLDialogElement::parseAttribute):
(WebCore::HTMLDialogElement::isModal const):
* html/HTMLDialogElement.h:
2021-06-30 Carlos Garcia Campos <cgarcia@igalia.com>
REGRESSION(r278884): [Nicosia] Fix empty stack check in CairoOperationRecorder::restore()
https://bugs.webkit.org/show_bug.cgi?id=227525
Reviewed by Myles C. Maxfield.
We keep our own state stack, with a state added at construction, so we should check our stack instead.
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
(Nicosia::CairoOperationRecorder::restore):
2021-06-30 Tim Nguyen <ntim@apple.com>
Support -internal- prefix for pseudo classes and rename :-webkit-direct-focus to :-internal-direct-focus
https://bugs.webkit.org/show_bug.cgi?id=227522
Reviewed by Antti Koivisto.
:-webkit-direct-focus was already UA-sheet only, so I took an opportunity to rename it here, also just to
test that the script is working. Test updated accordingly.
* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText const):
* css/SelectorPseudoClassAndCompatibilityElementMap.in:
* css/html.css:
(:-internal-direct-focus):
(:-webkit-direct-focus): Deleted.
* css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
(enumerablePseudoType):
2021-06-30 Tim Nguyen <ntim@apple.com>
Implement support for <dialog> element close event
https://bugs.webkit.org/show_bug.cgi?id=227493
Reviewed by Antti Koivisto.
With this change, the m_isOpen flag of HTMLDialogElement is only changed on attribute change, so attribute changes can
be detected more easily to fire this new "close" event.
Test: web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-close.html
Adjusted existing test expectations for new `close` event.
* dom/GlobalEventHandlers.idl:
* html/HTMLAttributeNames.in:
* html/HTMLDialogElement.cpp:
(WebCore::dialogCloseEventSender):
(WebCore::HTMLDialogElement::~HTMLDialogElement):
(WebCore::HTMLDialogElement::show):
(WebCore::HTMLDialogElement::showModal):
(WebCore::HTMLDialogElement::close):
(WebCore::HTMLDialogElement::dispatchPendingEvent):
(WebCore::HTMLDialogElement::parseAttribute):
(WebCore::HTMLDialogElement::setOpen):
(WebCore::HTMLDialogElement::toggleOpen): Deleted.
* html/HTMLDialogElement.h:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::createEventHandlerNameMap):
2021-06-30 Youenn Fablet <youenn@apple.com>
[Cocoa] Migrate WebRTC UDP socket handling to NW API
https://bugs.webkit.org/show_bug.cgi?id=227210
Reviewed by Eric Carlson.
Add infrastructure to new experimental feature flag for NW backed UDP sockets.
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::webRTCPlatformTCPSocketsEnabled const):
(WebCore::RuntimeEnabledFeatures::setWebRTCPlatformTCPSocketsEnabled):
(WebCore::RuntimeEnabledFeatures::webRTCPlatformUDPSocketsEnabled const):
(WebCore::RuntimeEnabledFeatures::setWebRTCPlatformUDPSocketsEnabled):
2021-06-30 Carlos Garcia Campos <cgarcia@igalia.com>
[SOUP] Implement CertificateInfo::summary
https://bugs.webkit.org/show_bug.cgi?id=227484
Reviewed by Michael Catanzaro.
GLib now provides API to get the information required to fill the CertificateSummary.
* platform/network/soup/CertificateInfo.h:
(WebCore::CertificateInfo::summary const): Deleted.
* platform/network/soup/CertificateInfoSoup.cpp:
(WebCore::CertificateInfo::summary const):
2021-06-29 Tim Nguyen <ntim@apple.com>
Implement form[method=dialog]
https://bugs.webkit.org/show_bug.cgi?id=226172
Reviewed by Chris Dumez.
Marked relevant WPT as pass & unskipped relevant test.
* html/HTMLFormControlElement.h:
(WebCore::HTMLFormControlElement::resultForDialogSubmit const):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::submit):
(WebCore::HTMLFormElement::submitDialog):
* html/HTMLFormElement.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::resultForDialogSubmit const):
* html/HTMLInputElement.h:
* html/ImageInputType.cpp:
(WebCore::ImageInputType::resultForDialogSubmit const):
* html/ImageInputType.h:
* html/InputType.cpp:
(WebCore::InputType::resultForDialogSubmit const):
* html/InputType.h:
* loader/FormSubmission.cpp:
(WebCore::FormSubmission::Attributes::parseMethodType):
(WebCore::FormSubmission::FormSubmission):
(WebCore::FormSubmission::create):
(WebCore::FormSubmission::populateFrameLoadRequest):
(WebCore::FormSubmission::requestURL const):
* loader/FormSubmission.h:
(WebCore::FormSubmission::Attributes::methodString):
(WebCore::FormSubmission::data const):
(WebCore::FormSubmission::returnValue const):
2021-06-29 Johnson Zhou <qiaosong_zhou@apple.com>
Encoding specified in the 'charset' attribute should have precedence over 'content' attribute
https://bugs.webkit.org/show_bug.cgi?id=227464
Reviewed by Geoffrey Garen.
Puts precedence on 'charset' attribute by breaking out of the parsing process.
This test passes Firefox and Chrome. Tested using
http://wpt.live/html/syntax/parsing/meta-inhead-insertion-mode.html
* html/parser/HTMLMetaCharsetParser.cpp:
(WebCore::HTMLMetaCharsetParser::encodingFromMetaAttributes):
2021-06-29 Darin Adler <darin@apple.com>
CSS style sheets loaded by HTMLLinkElement do not fall back correctly when charset is an invalid encoding name
https://bugs.webkit.org/show_bug.cgi?id=227498
Reviewed by Sam Weinig.
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::process): Check for invalid text encoding names rather than
just empty string.
2021-06-29 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r279250.
https://bugs.webkit.org/show_bug.cgi?id=227499
Sometimes causes YouTube audio to cut out
Reverted changeset:
"[Cocoa] Last few seconds of 'audio/webm; codecs=vorbis'
appended to a SampleBuffer are not played"
https://bugs.webkit.org/show_bug.cgi?id=226069
https://commits.webkit.org/r279250
2021-06-29 Alex Christensen <achristensen@webkit.org>
xhr.send(URLSearchParams) should align default Content-Type header field with Chrome and Firefox
https://bugs.webkit.org/show_bug.cgi?id=227477
Reviewed by Chris Dumez.
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::send):
* xml/XMLHttpRequest.h:
* xml/XMLHttpRequest.idl:
2021-06-29 Michael Catanzaro <mcatanzaro@gnome.org>
Fix more -Wreturn-type warnings
https://bugs.webkit.org/show_bug.cgi?id=227497
Unreviewed. This is getting stupid.
* page/EventHandler.cpp:
(WebCore::EventHandler::scrollDistance):
(WebCore::EventHandler::handleKeyboardScrolling):
* page/KeyboardScroll.cpp:
(WebCore::unitVectorForScrollDirection):
2021-06-29 Rob Buis <rbuis@igalia.com>
Nullptr crash in HTMLStackItem::create via DocumentFragment::parseHTML
https://bugs.webkit.org/show_bug.cgi?id=227390
Reviewed by Ryosuke Niwa.
DOM manipulation can mean document.body() can return null, causing the
crash/ASSERT in DocumentFragment::parseHTML in the test case. Since the
only use of it was to force InBody insertion mode, instead use a fake body element.
Test: editing/pasteboard/paste-create-fragment-crash.html
* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::createFragment):
2021-06-29 Rob Buis <rbuis@igalia.com>
Crash in SharedBuffer::data
https://bugs.webkit.org/show_bug.cgi?id=227173
Reviewed by Ryosuke Niwa.
Null check data in openFunc.
Test: fast/xsl/xslt-transformToDocument-crash.html
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::openFunc):
2021-06-29 Kimmo Kinnunen <kkinnunen@apple.com>
OES_texture_float should implicitly enable EXT_float_blend
https://bugs.webkit.org/show_bug.cgi?id=227456
<rdar://79804439>
Reviewed by Kenneth Russell.
Tested by webgl/1.0.x/conformance/extensions/oes-texture-float.html
* html/canvas/OESTextureFloat.cpp:
(WebCore::OESTextureFloat::OESTextureFloat):
Request EXT_float_blend when user requests OES_texture_float.
WEBGL_color_buffer_float and EXT_color_buffer_float already have
the code.
2021-06-29 Youenn Fablet <youenn@apple.com>
Remove RemoteAudioMediaStreamTrackRenderer and RemoteAudioMediaStreamTrackRendererManager
https://bugs.webkit.org/show_bug.cgi?id=227438
Reviewed by Eric Carlson.
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererInternalUnit.cpp:
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::start):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::stop):
Add some logging.
2021-06-29 Antti Koivisto <antti@apple.com>
Enable Probabilistic Guard Malloc for RuleData and RuleFeature vectors
https://bugs.webkit.org/show_bug.cgi?id=227446
Reviewed by Geoffrey Garen.
Help for catching a crash.
* style/RuleFeature.cpp:
(WebCore::Style::RuleFeatureSet::collectFeatures):
(WebCore::Style::RuleFeatureSet::add):
* style/RuleFeature.h:
* style/RuleSet.h:
* style/StyleScopeRuleSets.cpp:
(WebCore::Style::makeRuleSet):
(WebCore::Style::ensureInvalidationRuleSets):
2021-06-29 Martin Robinson <mrobinson@igalia.com>
CSS scroll snap should allow scrolling to the middle of snap areas that overflow the snapport
https://bugs.webkit.org/show_bug.cgi?id=223021
<rdar://problem/75518606>
Reviewed by Simon Fraser.
No new tests. This is covered by existing tests and, in particular, a WPT test:
- web-platform-tests/css/css-scroll-snap/overflowing-snap-areas.html
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::searchForPotentialSnapPoints): Record when the target snap offset happens to
fall in the interior of a snap area that overflows the snap port.
(WebCore::closestSnapOffsetWithInfoAndAxis): When this happens and we are in a spec-compliant
sitaution, just snap to the original target offset.
2021-06-28 Xabier Rodriguez Calvar <calvaris@igalia.com>
[GStreamer][EME] Fix resources release when a MediaKeySession is closed
https://bugs.webkit.org/show_bug.cgi?id=227403
Reviewed by Philippe Normand.
Thunder sessions should be a BoxPtr, already when stored at the
CDMInstanceSessionThunder, it does not make sense to store then in
a unique_ptr. This way the same session lives in the
MediaKeySession wrapper (CDMInstanceSessionThunder) and inside the
KeyStores.
Removed the CDMInstanceProxy key store. It is not needed.
When a session is closed in Thunder, there should be a cascade to
remove it from the other synced stores, that's why we introduce
the removeAllKeysFrom logic.
Regular key stores do not manage key session references
anymore. They are only needed in the CDMProxy class, which is
where the keys are shared among different sessions. We were
managing key session references in other stores and they were
messing up with the key references in the CDMProxy class. In
those cases, a key kept in a local store could have a reference
that would prevent the CDMProxy key store from removing it when
asked from it. There were also cases of removing keys from local
stores that were creating negative reference numbers, which
created the opposite effect, this is, leaving in place keys in the
CDMProxy store that should be released.
* platform/encryptedmedia/CDMProxy.cpp:
(WebCore::KeyStore::merge): Simplified to just add keys.
(WebCore::KeyStore::add): Adds references (if needed) and merges
if needed.
(WebCore::KeyStore::unrefAllKeys): Renamed. Unrefs all keys from a
store by copying itself and calling unrefAllKeysFrom that copy.
(WebCore::KeyStore::unref): Renamed. Uses proper refefencing.
(WebCore::CDMProxy::unrefAllKeysFrom): Method to unref all keys
that are contained in some other store.
(WebCore::CDMInstanceProxy::mergeKeysFrom): There is no more key
store in this class.
(WebCore::CDMInstanceProxy::unrefAllKeysFrom): Renamed. Calls the
CDMproxy to unref the keys from there.
* platform/encryptedmedia/CDMProxy.h:
(WebCore::KeyHandle::mergeKeyInto): Merges one key into self by
copying status, data and summing reference count.
(WebCore::KeyHandle::numSessionReferences const): Turn int.
(WebCore::KeyHandle::hasReferences const): Added.
(WebCore::KeyStore::addSessionReferenceTo const):
(WebCore::KeyStore::removeSessionReferenceFrom const): Helpers to
check if the store is reference counted or not. Default is do
nothing and but the ReferenceAwareKeyStore redefines them to do
reference counting.
(WebCore::KeyStore::unrefAllKeys): Deleted.
* platform/encryptedmedia/clearkey/CDMClearKey.cpp:
(WebCore::CDMInstanceSessionClearKey::updateLicense):
(WebCore::CDMInstanceSessionClearKey::removeSessionData): Use
renamed methods.
* platform/graphics/gstreamer/eme/CDMThunder.h:
* platform/graphics/gstreamer/eme/CDMThunder.cpp:
(WebCore::CDMInstanceSessionThunder::status const):
(WebCore::CDMInstanceSessionThunder::keyUpdatedCallback):
(WebCore::CDMInstanceSessionThunder::requestLicense):
(WebCore::CDMInstanceSessionThunder::updateLicense):
(WebCore::CDMInstanceSessionThunder::removeSessionData):
(WebCore::CDMInstanceSessionThunder::loadSession): Use BoxPtr in
the session.
(WebCore::CDMInstanceSessionThunder::closeSession): Close the
current session, release the BoxPtr, notify the instance and
therefore the proxy to unref all they key IDs in this session and
empty the local key store.
2021-06-28 Darin Adler <darin@apple.com>
CSS parser "consume declaration" algorithm does not handle whitespace correctly
https://bugs.webkit.org/show_bug.cgi?id=227368
Reviewed by Sam Weinig.
Test: imported/w3c/web-platform-tests/css/css-syntax/declarations-trim-whitespace.html
To avoid creating regressions in CSS variable behavior, had to make
changes there to handle whitespace correctly at the same time as the
change to the "consume declaration" algorithm.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::customPropertyValue): Restructured
to not have a case for each variant custom value type. This lets us
support the new Empty value type without extra code here.
* css/CSSCustomPropertyValue.cpp:
(WebCore::CSSCustomPropertyValue::createEmpty): Added. Used for a new
Empty value type for properties that have empty string as their value,
which is a new capability added to the CSS specification.
(WebCore::CSSCustomPropertyValue::equals const): Removed unneeded pointer
comparison optimization. Added support for Empty value.
(WebCore::CSSCustomPropertyValue::customCSSText const): Updated to use
null string for m_stringValue instead of a separate m_serialized flag.
Added support for Empty value.
(WebCore::CSSCustomPropertyValue::tokens const): Added support for
Empty value. Also call directly to customCSSText instead of calling
through cssText.
* css/CSSCustomPropertyValue.h: Updated for the above, adding Empty value.
Removed m_serialized. Greatly simplified the copy constructor since Ref
now has a copy constructor.
* css/CSSVariableReferenceValue.cpp:
(WebCore::resolveVariableFallback): Consume whitespace after the comma,
matching what is now called for in the CSS specification.
* css/calc/CSSCalcExpressionNodeParser.cpp:
(WebCore::CSSCalcExpressionNodeParser::parseCalcFunction): Use
consumeCommaIncludingWhitespace to simplify the code. No behavior change,
just refactoring.
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeDeclaration): Updated algorithm to match
the CSS specification, trimming whitespace correctly.
(WebCore::CSSParserImpl::consumeCustomPropertyValue): Added support for
a custom property value with no declaration value, as now called for in
the CSS specification, using CSSCustomPropertyValue::createEmpty.
* css/parser/CSSVariableParser.cpp:
(WebCore::isValidVariableReference): Allow empty fallback, as now called
for in the CSS specification.
(WebCore::isValidConstantReference): Ditto.
2021-06-28 Dana Estra <destra@apple.com>
Refactor MacOS keyboard scrolling and use KeyboardScroll struct
https://bugs.webkit.org/show_bug.cgi?id=226986
Reviewed by Tim Horton.
No tests yet.
* page/EventHandler.cpp:
(WebCore::EventHandler::defaultSpaceEventHandler):
Added usage of switch EventDrivenSmoothKeyboardScrolling
that when enabled sends KeyboardEvent to
HandleKeyboardScrolling.
(WebCore::EventHandler::scrollDistance):
(WebCore::EventHandler::handleKeyboardScrolling):
Makes KeyboardScroll and calls scrollRecursively.
(WebCore::EventHandler::defaultArrowEventHandler):
Added usage of switch EventDrivenSmoothKeyboardScrolling
that when enabled sends KeyboardEvent to
HandleKeyboardScrolling.
* page/EventHandler.h:
* page/KeyboardScroll.cpp: Added.
* page/KeyboardScroll.h: Added.
2021-06-28 Wenson Hsieh <wenson_hsieh@apple.com>
Live Text selections inside images is misaligned when "object-fit" is not "fill"
https://bugs.webkit.org/show_bug.cgi?id=227453
Reviewed by Tim Horton.
We currently use the bounds of the image overlay host element when injecting transformed Live Text into image
element UA shadow roots. However, this causes text to lay out in the wrong place relative to the image when
using any "object-fit" values that are not "fill". To address this, use the `replacedContentRect()` of the image
renderer when injecting OCR text quads instead.
Tests: fast/images/text-recognition/image-overlay-object-fit-change.html
fast/images/text-recognition/image-overlay-object-fit.html
* html/HTMLElement.cpp:
(WebCore::HTMLElement::updateWithTextRecognitionResult): See description above for more details.
* page/Page.cpp:
(WebCore::Page::updateElementsWithTextRecognitionResults):
We also refactor this code so that we don't immediately try to update text recognition results, and instead
queue an internal async task to do so. Immediately performing the update here can potentially cause a debug
assertion due to leaving us in a state where we require layout immediately after a rendering update.
(WebCore::Page::cacheTextRecognitionResult):
Additionally adjust the text recognition result caching mechanism to update image overlay content when changing
the replaced content rect, rather than the element's offset width or height. This ensures that changing CSS
"object-fit" values dynamically for images with Live Text causes Live Text bounds to stay up to date.
* page/Page.h:
2021-06-28 Sam Weinig <weinig@apple.com>
[Modern Media Controls] Support customizing the media controls via WebKitAdditions
https://bugs.webkit.org/show_bug.cgi?id=227433
Reviewed by Eric Carlson.
- Support adding additional style sheets and scripts to the media controls
via ADDITIONAL_MODERN_MEDIA_CONTROLS_STYLE_SHEETS and ADDITIONAL_MODERN_MEDIA_CONTROLS_SCRIPTS
variables in DerivedSources.make
- Support overriding default layout traits object class name in MediaControlsHost.
* DerivedSources.make:
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::layoutTraitsClassName const):
2021-06-28 Jean-Yves Avenard <jya@apple.com>
Not all uses of AudioToolbox framework use soft linking
https://bugs.webkit.org/show_bug.cgi?id=227250
<rdar://problem/79606090>
Reviewed by Eric Carlson.
Unify AudioToolbox, CoreMedia, VideoToolbox and MediaToolbox's method
definitions and their use, ensuring that they are always soft-linked.
Unified builds and the inconsistent use of explicitly using the PAL namespace
caused some calls to be ambiguous leading to compilation errors; some
code would also use the softlinked methods while others called into the frameworks
directly.
To get around those we ensure that any calls to AudioToolbox or CoreMedia is always using
the fully resolved PAL name.
Remove unnecessary `using namespace PAL;` statements wherever applicable.
No change in observable behavior.
* Modules/mediastream/PeerConnectionBackend.cpp:
* Modules/plugins/QuickTimePluginReplacement.mm:
* Modules/webaudio/MediaStreamAudioSourceCocoa.cpp:
(WebCore::MediaStreamAudioSource::consumeAudio):
* dom/Document.cpp:
* html/HTMLCanvasElement.cpp:
* html/HTMLMediaElement.cpp:
* platform/audio/AudioFileReader.h:
* platform/audio/cocoa/AudioFileReaderCocoa.cpp:
(WebCore::AudioFileReader::AudioFileReader):
(WebCore::AudioFileReader::~AudioFileReader):
(WebCore::AudioFileReader::createBus):
(WebCore::createBusFromAudioFile): Deleted.
* platform/audio/cocoa/AudioFileReaderCocoa.h:
* platform/audio/cocoa/AudioOutputUnitAdaptor.cpp:
(WebCore::AudioOutputUnitAdaptor::~AudioOutputUnitAdaptor):
(WebCore::AudioOutputUnitAdaptor::start):
(WebCore::AudioOutputUnitAdaptor::stop):
* platform/audio/cocoa/AudioSampleBufferList.cpp:
(WebCore::AudioSampleBufferList::copyFrom):
* platform/audio/cocoa/AudioSampleDataSource.mm:
* platform/audio/cocoa/WebAudioBufferList.cpp:
(WebCore::WebAudioBufferList::WebAudioBufferList):
* platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
(WebCore::AudioFileReader::decodeAudioForBusCreation):
(WebCore::createBusFromAudioFile): Deleted.
* platform/audio/ios/AudioOutputUnitAdaptorIOS.cpp:
(WebCore::AudioOutputUnitAdaptor::configure):
* platform/audio/mac/AudioOutputUnitAdaptorMac.cpp:
(WebCore::AudioOutputUnitAdaptor::configure):
* platform/cocoa/MediaUtilities.cpp:
(WebCore::createAudioFormatDescription):
(WebCore::createAudioSampleBuffer):
* platform/graphics/RemoteVideoSample.cpp:
(WebCore::RemoteVideoSample::create):
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::create):
(WebCore::AudioSourceProviderAVFObjC::provideInput):
(WebCore::AudioSourceProviderAVFObjC::createMixIfNeeded):
(WebCore::AudioSourceProviderAVFObjC::finalizeCallback):
(WebCore::AudioSourceProviderAVFObjC::prepareCallback):
(WebCore::AudioSourceProviderAVFObjC::unprepareCallback):
(WebCore::AudioSourceProviderAVFObjC::processCallback):
(WebCore::AudioSourceProviderAVFObjC::prepare):
(WebCore::AudioSourceProviderAVFObjC::process):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageGenerator):
(WebCore::MediaPlayerPrivateAVFoundationObjC::getStartDate const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::currentMediaTime const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformBufferedTimeRanges const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformMinTimeSeekable const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformMaxTimeSeekable const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformMaxTimeLoaded const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect):
(WebCore::MediaPlayerPrivateAVFoundationObjC::isAvailable):
(WebCore::MediaPlayerPrivateAVFoundationObjC::metadataGroupDidArrive):
(WebCore::MediaPlayerPrivateAVFoundationObjC::metadataDidArrive):
(WebCore::MediaPlayerPrivateAVFoundationObjC::performTaskAtMediaTime):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::EffectiveRateChangedListener::stop):
(WebCore::EffectiveRateChangedListener::EffectiveRateChangedListener):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::isAvailable):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::currentMediaTime const):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCurrentTimeDidChangeCallback):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastPixelBuffer):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::streamSession):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::performTaskAtMediaTime):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable):
(WebCore::videoTransformationMatrix):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateCurrentFrameImage):
* platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
(WTF::CFTypeTrait<CMSampleBufferRef>::typeID):
(WebCore::MediaSampleAVFObjC::createImageSample):
(WebCore::MediaSampleAVFObjC::presentationTime const):
(WebCore::MediaSampleAVFObjC::decodeTime const):
(WebCore::MediaSampleAVFObjC::duration const):
(WebCore::MediaSampleAVFObjC::sizeInBytes const):
(WebCore::MediaSampleAVFObjC::videoPixelFormat const):
(WebCore::isCMSampleBufferAttachmentRandomAccess):
(WebCore::doesCMSampleBufferHaveSyncInfo):
(WebCore::isCMSampleBufferRandomAccess):
(WebCore::isCMSampleBufferAttachmentNonDisplaying):
(WebCore::isCMSampleBufferNonDisplaying):
(WebCore::MediaSampleAVFObjC::presentationSize const):
(WebCore::MediaSampleAVFObjC::offsetTimestampsBy):
(WebCore::MediaSampleAVFObjC::setTimestamps):
(WebCore::MediaSampleAVFObjC::isDivisable const):
(WebCore::MediaSampleAVFObjC::divide):
(WebCore::MediaSampleAVFObjC::createNonDisplayingCopy const):
(WebCore::MediaSampleAVFObjC::getRGBAImageData const):
(WebCore::setSampleBufferAsDisplayImmediately):
(WebCore::MediaSampleAVFObjC::isHomogeneous const):
(WebCore::MediaSampleAVFObjC::divideIntoHomogeneousSamples):
(WebCore::MediaSampleAVFObjC::cloneSampleBufferAndSetAsDisplayImmediately):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::bufferWasConsumedCallback):
(WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::rendererWasAutomaticallyFlushed):
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
(WebCore::SourceBufferPrivateAVFObjC::canSetMinimumUpcomingPresentationTime const):
(WebCore::SourceBufferPrivateAVFObjC::setMinimumUpcomingPresentationTime):
* platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::SourceBufferParserWebM::OnFrame):
(WebCore::SourceBufferParserWebM::VideoTrackData::consumeFrameData):
(WebCore::SourceBufferParserWebM::VideoTrackData::createSampleBuffer):
(WebCore::SourceBufferParserWebM::AudioTrackData::consumeFrameData):
(WebCore::SourceBufferParserWebM::AudioTrackData::createSampleBuffer):
* platform/graphics/cocoa/VP9UtilitiesCocoa.mm:
(WebCore::convertToCMColorPrimaries):
(WebCore::convertToCMTransferFunction):
(WebCore::convertToCMYCbCRMatrix):
(WebCore::createFormatDescriptionFromVPCodecConfigurationRecord):
* platform/graphics/cocoa/WebCoreDecompressionSession.mm:
(WTF::CFTypeTrait<CMSampleBufferRef>::typeID):
(WebCore::WebCoreDecompressionSession::setTimebase):
(WebCore::WebCoreDecompressionSession::enqueueSample):
(WebCore::WebCoreDecompressionSession::shouldDecodeSample):
(WebCore::WebCoreDecompressionSession::ensureDecompressionSessionForSample):
(WebCore::WebCoreDecompressionSession::decodeSample):
(WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
(WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
(WebCore::WebCoreDecompressionSession::automaticDequeue):
(WebCore::WebCoreDecompressionSession::enqueueDecodedSample):
(WebCore::WebCoreDecompressionSession::isReadyForMoreMediaData const):
(WebCore::WebCoreDecompressionSession::notifyWhenHasAvailableVideoFrame):
(WebCore::WebCoreDecompressionSession::imageForTime):
(WebCore::WebCoreDecompressionSession::flush):
(WebCore::WebCoreDecompressionSession::getDecodeTime):
(WebCore::WebCoreDecompressionSession::getPresentationTime):
(WebCore::WebCoreDecompressionSession::getDuration):
(WebCore::WebCoreDecompressionSession::compareBuffers):
(WebCore::WebCoreDecompressionSession::updateQosWithDecodeTimeStatistics):
* platform/graphics/cv/ImageTransferSessionVT.mm:
(WebCore::ImageTransferSessionVT::createPixelBuffer):
(WebCore::ImageTransferSessionVT::convertCMSampleBuffer):
(WebCore::ImageTransferSessionVT::createCMSampleBuffer):
* platform/ios/PlaybackSessionInterfaceAVKit.mm:
(WebCore::PlaybackSessionInterfaceAVKit::seekableRangesChanged):
* platform/mac/VideoFullscreenInterfaceMac.mm:
* platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp:
(WebCore::MediaRecorderPrivateAVFImpl::videoSampleAvailable):
* platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm:
(WebCore::AudioSampleBufferCompressor::~AudioSampleBufferCompressor):
(WebCore::AudioSampleBufferCompressor::initialize):
(WebCore::AudioSampleBufferCompressor::finish):
(WebCore::AudioSampleBufferCompressor::initAudioConverterForSourceFormatDescription):
(WebCore::AudioSampleBufferCompressor::attachPrimingTrimsIfNeeded):
(WebCore::AudioSampleBufferCompressor::gradualDecoderRefreshCount):
(WebCore::AudioSampleBufferCompressor::sampleBufferWithNumPackets):
(WebCore::AudioSampleBufferCompressor::provideSourceDataNumOutputPackets):
(WebCore::AudioSampleBufferCompressor::processSampleBuffersUntilLowWaterTime):
(WebCore::AudioSampleBufferCompressor::processSampleBuffer):
(WebCore::AudioSampleBufferCompressor::getOutputSampleBuffer):
(WebCore::AudioSampleBufferCompressor::takeOutputSampleBuffer):
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
(WebCore::MediaRecorderPrivateWriter::MediaRecorderPrivateWriter):
(WebCore::MediaRecorderPrivateWriter::processNewCompressedVideoSampleBuffers):
(WebCore::MediaRecorderPrivateWriter::processNewCompressedAudioSampleBuffers):
(WebCore::MediaRecorderPrivateWriter::startAssetWriter):
(WebCore::MediaRecorderPrivateWriter::appendCompressedVideoSampleBuffer):
(WebCore::appendEndsPreviousSampleDurationMarker):
(WebCore::copySampleBufferWithCurrentTimeStamp):
(WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer):
(WebCore::MediaRecorderPrivateWriter::appendAudioSampleBuffer):
(WebCore::MediaRecorderPrivateWriter::completeFetchData):
(WebCore::MediaRecorderPrivateWriter::pause):
(WebCore::MediaRecorderPrivateWriter::resume):
* platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm:
(WebCore::VideoSampleBufferCompressor::~VideoSampleBufferCompressor):
(WebCore::VideoSampleBufferCompressor::initialize):
(WebCore::VideoSampleBufferCompressor::finish):
(WebCore::VideoSampleBufferCompressor::videoCompressionCallback):
(WebCore::VideoSampleBufferCompressor::vtProfileLevel const):
(WebCore::VideoSampleBufferCompressor::initCompressionSession):
(WebCore::VideoSampleBufferCompressor::processSampleBuffer):
(WebCore::VideoSampleBufferCompressor::getOutputSampleBuffer):
(WebCore::VideoSampleBufferCompressor::takeOutputSampleBuffer):
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererInternalUnit.cpp:
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::start):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::stop):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::createAudioUnitIfNeeded):
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::setSessionSizeAndFrameRate):
(WebCore::AVVideoCaptureSource::frameDurationForFrameRate):
(WebCore::AVVideoCaptureSource::generatePresets):
* platform/mediastream/mac/CoreAudioCaptureDevice.cpp:
(WebCore::CoreAudioCaptureDevice::deviceClock):
* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioSharedUnit::setupAudioUnit):
(WebCore::CoreAudioSharedUnit::configureMicrophoneProc):
(WebCore::CoreAudioSharedUnit::configureSpeakerProc):
(WebCore::CoreAudioSharedUnit::cleanupAudioUnit):
(WebCore::CoreAudioSharedUnit::reconfigureAudioUnit):
(WebCore::CoreAudioSharedUnit::startInternal):
(WebCore::CoreAudioSharedUnit::stopInternal):
(WebCore::CoreAudioSharedUnit::defaultInputDevice):
* platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
* platform/mediastream/mac/MockAudioSharedUnit.mm:
(WebCore::MockAudioSharedUnit::reconfigure):
(WebCore::MockAudioSharedUnit::emitSampleBuffers):
* platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
* platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:
(WebCore::RealtimeIncomingAudioSourceCocoa::OnData):
* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
(WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
(WebCore::RealtimeOutgoingVideoSourceCocoa::videoSampleAvailable):
* platform/mediastream/mac/WindowDisplayCapturerMac.mm:
2021-06-27 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r279322.
https://bugs.webkit.org/show_bug.cgi?id=227434
Reverted changeset:
"Not all uses of AudioToolbox framework use soft linking"
https://bugs.webkit.org/show_bug.cgi?id=227250
https://commits.webkit.org/r279322
2021-06-27 Jean-Yves Avenard <jya@apple.com>
Not all uses of AudioToolbox framework use soft linking
https://bugs.webkit.org/show_bug.cgi?id=227250
<rdar://problem/79606090>
Reviewed by Eric Carlson.
Unify AudioToolbox, CoreMedia, VideoToolbox and MediaToolbox's method
definitions and their use, ensuring that they are always soft-linked.
Unified builds and the inconsistent use of explicitly using the PAL namespace
caused some calls to be ambiguous leading to compilation errors; some
code would also use the softlinked methods while others called into the frameworks
directly.
To get around those we ensure that any calls to AudioToolbox or CoreMedia is always using
the fully resolved PAL name.
Remove unnecessary `using namespace PAL;` statements wherever applicable.
No change in observable behavior.
* Modules/mediastream/PeerConnectionBackend.cpp:
* Modules/plugins/QuickTimePluginReplacement.mm:
* Modules/webaudio/MediaStreamAudioSourceCocoa.cpp:
(WebCore::MediaStreamAudioSource::consumeAudio):
* dom/Document.cpp:
* html/HTMLCanvasElement.cpp:
* html/HTMLMediaElement.cpp:
* platform/audio/AudioFileReader.h:
* platform/audio/cocoa/AudioFileReaderCocoa.cpp:
(WebCore::AudioFileReader::AudioFileReader):
(WebCore::AudioFileReader::~AudioFileReader):
(WebCore::AudioFileReader::createBus):
(WebCore::createBusFromAudioFile): Deleted.
* platform/audio/cocoa/AudioFileReaderCocoa.h:
* platform/audio/cocoa/AudioOutputUnitAdaptor.cpp:
(WebCore::AudioOutputUnitAdaptor::~AudioOutputUnitAdaptor):
(WebCore::AudioOutputUnitAdaptor::start):
(WebCore::AudioOutputUnitAdaptor::stop):
* platform/audio/cocoa/AudioSampleBufferList.cpp:
(WebCore::AudioSampleBufferList::copyFrom):
* platform/audio/cocoa/AudioSampleDataSource.mm:
* platform/audio/cocoa/WebAudioBufferList.cpp:
(WebCore::WebAudioBufferList::WebAudioBufferList):
* platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
(WebCore::AudioFileReader::decodeAudioForBusCreation):
(WebCore::createBusFromAudioFile): Deleted.
* platform/audio/ios/AudioOutputUnitAdaptorIOS.cpp:
(WebCore::AudioOutputUnitAdaptor::configure):
* platform/audio/mac/AudioOutputUnitAdaptorMac.cpp:
(WebCore::AudioOutputUnitAdaptor::configure):
* platform/cocoa/MediaUtilities.cpp:
(WebCore::createAudioFormatDescription):
(WebCore::createAudioSampleBuffer):
* platform/graphics/RemoteVideoSample.cpp:
(WebCore::RemoteVideoSample::create):
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::create):
(WebCore::AudioSourceProviderAVFObjC::provideInput):
(WebCore::AudioSourceProviderAVFObjC::createMixIfNeeded):
(WebCore::AudioSourceProviderAVFObjC::finalizeCallback):
(WebCore::AudioSourceProviderAVFObjC::prepareCallback):
(WebCore::AudioSourceProviderAVFObjC::unprepareCallback):
(WebCore::AudioSourceProviderAVFObjC::processCallback):
(WebCore::AudioSourceProviderAVFObjC::prepare):
(WebCore::AudioSourceProviderAVFObjC::process):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageGenerator):
(WebCore::MediaPlayerPrivateAVFoundationObjC::getStartDate const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::currentMediaTime const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformBufferedTimeRanges const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformMinTimeSeekable const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformMaxTimeSeekable const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformMaxTimeLoaded const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect):
(WebCore::MediaPlayerPrivateAVFoundationObjC::isAvailable):
(WebCore::MediaPlayerPrivateAVFoundationObjC::metadataGroupDidArrive):
(WebCore::MediaPlayerPrivateAVFoundationObjC::metadataDidArrive):
(WebCore::MediaPlayerPrivateAVFoundationObjC::performTaskAtMediaTime):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::EffectiveRateChangedListener::stop):
(WebCore::EffectiveRateChangedListener::EffectiveRateChangedListener):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::isAvailable):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::currentMediaTime const):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCurrentTimeDidChangeCallback):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastPixelBuffer):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::streamSession):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::performTaskAtMediaTime):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable):
(WebCore::videoTransformationMatrix):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateCurrentFrameImage):
* platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
(WTF::CFTypeTrait<CMSampleBufferRef>::typeID):
(WebCore::MediaSampleAVFObjC::createImageSample):
(WebCore::MediaSampleAVFObjC::presentationTime const):
(WebCore::MediaSampleAVFObjC::decodeTime const):
(WebCore::MediaSampleAVFObjC::duration const):
(WebCore::MediaSampleAVFObjC::sizeInBytes const):
(WebCore::MediaSampleAVFObjC::videoPixelFormat const):
(WebCore::isCMSampleBufferAttachmentRandomAccess):
(WebCore::doesCMSampleBufferHaveSyncInfo):
(WebCore::isCMSampleBufferRandomAccess):
(WebCore::isCMSampleBufferAttachmentNonDisplaying):
(WebCore::isCMSampleBufferNonDisplaying):
(WebCore::MediaSampleAVFObjC::presentationSize const):
(WebCore::MediaSampleAVFObjC::offsetTimestampsBy):
(WebCore::MediaSampleAVFObjC::setTimestamps):
(WebCore::MediaSampleAVFObjC::isDivisable const):
(WebCore::MediaSampleAVFObjC::divide):
(WebCore::MediaSampleAVFObjC::createNonDisplayingCopy const):
(WebCore::MediaSampleAVFObjC::getRGBAImageData const):
(WebCore::setSampleBufferAsDisplayImmediately):
(WebCore::MediaSampleAVFObjC::isHomogeneous const):
(WebCore::MediaSampleAVFObjC::divideIntoHomogeneousSamples):
(WebCore::MediaSampleAVFObjC::cloneSampleBufferAndSetAsDisplayImmediately):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::bufferWasConsumedCallback):
(WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::rendererWasAutomaticallyFlushed):
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
(WebCore::SourceBufferPrivateAVFObjC::canSetMinimumUpcomingPresentationTime const):
(WebCore::SourceBufferPrivateAVFObjC::setMinimumUpcomingPresentationTime):
* platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::SourceBufferParserWebM::OnFrame):
(WebCore::SourceBufferParserWebM::VideoTrackData::consumeFrameData):
(WebCore::SourceBufferParserWebM::VideoTrackData::createSampleBuffer):
(WebCore::SourceBufferParserWebM::AudioTrackData::consumeFrameData):
(WebCore::SourceBufferParserWebM::AudioTrackData::createSampleBuffer):
* platform/graphics/cocoa/VP9UtilitiesCocoa.mm:
(WebCore::convertToCMColorPrimaries):
(WebCore::convertToCMTransferFunction):
(WebCore::convertToCMYCbCRMatrix):
(WebCore::createFormatDescriptionFromVPCodecConfigurationRecord):
* platform/graphics/cocoa/WebCoreDecompressionSession.mm:
(WTF::CFTypeTrait<CMSampleBufferRef>::typeID):
(WebCore::WebCoreDecompressionSession::setTimebase):
(WebCore::WebCoreDecompressionSession::enqueueSample):
(WebCore::WebCoreDecompressionSession::shouldDecodeSample):
(WebCore::WebCoreDecompressionSession::ensureDecompressionSessionForSample):
(WebCore::WebCoreDecompressionSession::decodeSample):
(WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
(WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
(WebCore::WebCoreDecompressionSession::automaticDequeue):
(WebCore::WebCoreDecompressionSession::enqueueDecodedSample):
(WebCore::WebCoreDecompressionSession::isReadyForMoreMediaData const):
(WebCore::WebCoreDecompressionSession::notifyWhenHasAvailableVideoFrame):
(WebCore::WebCoreDecompressionSession::imageForTime):
(WebCore::WebCoreDecompressionSession::flush):
(WebCore::WebCoreDecompressionSession::getDecodeTime):
(WebCore::WebCoreDecompressionSession::getPresentationTime):
(WebCore::WebCoreDecompressionSession::getDuration):
(WebCore::WebCoreDecompressionSession::compareBuffers):
(WebCore::WebCoreDecompressionSession::updateQosWithDecodeTimeStatistics):
* platform/graphics/cv/ImageTransferSessionVT.mm:
(WebCore::ImageTransferSessionVT::createPixelBuffer):
(WebCore::ImageTransferSessionVT::convertCMSampleBuffer):
(WebCore::ImageTransferSessionVT::createCMSampleBuffer):
* platform/ios/PlaybackSessionInterfaceAVKit.mm:
(WebCore::PlaybackSessionInterfaceAVKit::seekableRangesChanged):
* platform/mac/VideoFullscreenInterfaceMac.mm:
* platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp:
(WebCore::MediaRecorderPrivateAVFImpl::videoSampleAvailable):
* platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm:
(WebCore::AudioSampleBufferCompressor::~AudioSampleBufferCompressor):
(WebCore::AudioSampleBufferCompressor::initialize):
(WebCore::AudioSampleBufferCompressor::finish):
(WebCore::AudioSampleBufferCompressor::initAudioConverterForSourceFormatDescription):
(WebCore::AudioSampleBufferCompressor::attachPrimingTrimsIfNeeded):
(WebCore::AudioSampleBufferCompressor::gradualDecoderRefreshCount):
(WebCore::AudioSampleBufferCompressor::sampleBufferWithNumPackets):
(WebCore::AudioSampleBufferCompressor::provideSourceDataNumOutputPackets):
(WebCore::AudioSampleBufferCompressor::processSampleBuffersUntilLowWaterTime):
(WebCore::AudioSampleBufferCompressor::processSampleBuffer):
(WebCore::AudioSampleBufferCompressor::getOutputSampleBuffer):
(WebCore::AudioSampleBufferCompressor::takeOutputSampleBuffer):
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
(WebCore::MediaRecorderPrivateWriter::MediaRecorderPrivateWriter):
(WebCore::MediaRecorderPrivateWriter::processNewCompressedVideoSampleBuffers):
(WebCore::MediaRecorderPrivateWriter::processNewCompressedAudioSampleBuffers):
(WebCore::MediaRecorderPrivateWriter::startAssetWriter):
(WebCore::MediaRecorderPrivateWriter::appendCompressedVideoSampleBuffer):
(WebCore::appendEndsPreviousSampleDurationMarker):
(WebCore::copySampleBufferWithCurrentTimeStamp):
(WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer):
(WebCore::MediaRecorderPrivateWriter::appendAudioSampleBuffer):
(WebCore::MediaRecorderPrivateWriter::completeFetchData):
(WebCore::MediaRecorderPrivateWriter::pause):
(WebCore::MediaRecorderPrivateWriter::resume):
* platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm:
(WebCore::VideoSampleBufferCompressor::~VideoSampleBufferCompressor):
(WebCore::VideoSampleBufferCompressor::initialize):
(WebCore::VideoSampleBufferCompressor::finish):
(WebCore::VideoSampleBufferCompressor::videoCompressionCallback):
(WebCore::VideoSampleBufferCompressor::vtProfileLevel const):
(WebCore::VideoSampleBufferCompressor::initCompressionSession):
(WebCore::VideoSampleBufferCompressor::processSampleBuffer):
(WebCore::VideoSampleBufferCompressor::getOutputSampleBuffer):
(WebCore::VideoSampleBufferCompressor::takeOutputSampleBuffer):
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererInternalUnit.cpp:
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::start):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::stop):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::createAudioUnitIfNeeded):
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::setSessionSizeAndFrameRate):
(WebCore::AVVideoCaptureSource::frameDurationForFrameRate):
(WebCore::AVVideoCaptureSource::generatePresets):
* platform/mediastream/mac/CoreAudioCaptureDevice.cpp:
(WebCore::CoreAudioCaptureDevice::deviceClock):
* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioSharedUnit::setupAudioUnit):
(WebCore::CoreAudioSharedUnit::configureMicrophoneProc):
(WebCore::CoreAudioSharedUnit::configureSpeakerProc):
(WebCore::CoreAudioSharedUnit::cleanupAudioUnit):
(WebCore::CoreAudioSharedUnit::reconfigureAudioUnit):
(WebCore::CoreAudioSharedUnit::startInternal):
(WebCore::CoreAudioSharedUnit::stopInternal):
(WebCore::CoreAudioSharedUnit::defaultInputDevice):
* platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
* platform/mediastream/mac/MockAudioSharedUnit.mm:
(WebCore::MockAudioSharedUnit::reconfigure):
(WebCore::MockAudioSharedUnit::emitSampleBuffers):
* platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
* platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:
(WebCore::RealtimeIncomingAudioSourceCocoa::OnData):
* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
(WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
(WebCore::RealtimeOutgoingVideoSourceCocoa::videoSampleAvailable):
* platform/mediastream/mac/WindowDisplayCapturerMac.mm:
2021-06-27 Rob Buis <rbuis@igalia.com>
Treat image data url's as not identical
https://bugs.webkit.org/show_bug.cgi?id=226924
Reviewed by Said Abou-Hallawa.
Treat image data url's as not identical
in fillImagesAreIdentical.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::updateFillImages):
* rendering/style/StyleCachedImage.cpp:
(WebCore::StyleCachedImage::usesDataProtocol const):
* rendering/style/StyleCachedImage.h:
* rendering/style/StyleCursorImage.cpp:
(WebCore::StyleCursorImage::usesDataProtocol const):
* rendering/style/StyleCursorImage.h:
* rendering/style/StyleImage.h:
(WebCore::StyleImage::usesDataProtocol const):
2021-06-27 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS 15] Fix the internal build after rdar://76549109
https://bugs.webkit.org/show_bug.cgi?id=227430
rdar://79832425
Reviewed by Sam Weinig.
Fix the build by replacing the use of the `UIFloatIsZero` macro with its actual definition. The immediate cause
of this build failure is a UIKit change that changed the definition of `UIFloatIsZero`, such that we end up
redefining `UIFloatIsZero` in HTMLConverter.mm. However, since `UIFloatIsZero` is specific to iOS family and
HTMLConverter is used only in this one place on both macOS and iOS, it makes more sense to simply use the macro
definition itself.
* editing/cocoa/HTMLConverter.mm:
(HTMLConverter::computedAttributesForElement):
2021-06-27 Peng Liu <peng.liu6@apple.com>
Backgrounding and returning to a FaceTime call in MobileSafari leads to a blank black sreen
https://bugs.webkit.org/show_bug.cgi?id=227406
Reviewed by Eric Carlson.
The `RequireUserGestureForFullscreen` restriction will be kept in a `MediaElementSession`
if the corresponding media element is `autoplay`. Therefore, the request to enter
picture-in-picture from the UI process will be ignored by the media element, and the
state machine managing video presentation mode in the UI process will be an inconsistent state.
This patch creates a `UserGestureIndicator` before requesting the media element
to change its presentation mode to make sure the request will be handled.
* platform/cocoa/VideoFullscreenModelVideoElement.mm:
(WebCore::VideoFullscreenModelVideoElement::fullscreenModeChanged):
2021-06-27 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Add support for shrinking over-constrained columns based on the width type priority list
https://bugs.webkit.org/show_bug.cgi?id=227426
Reviewed by Antti Koivisto.
Let's take the priority list into use when shrinking the columns in an over-constrained context.
e.g.
<div style="width: 100px">
<table><tr><td style="width: 90%""></td><td style="width: 400px;"></td><td style="width: 100px;"></td></tr></table>
</div>
While the second and the third columns have the preferred width of 400px and 100px respectively, we can't accommodate
them as the containing block (<div>) sets a 100px horizontal constraint on the table content and the first column already takes up 90px space.
Now we start shrinking the columns using the following priority list: auto < relative < fixed < percent (ignoring the actual column order).
The preferred width of the table (assume 0px border spacing and padding) is 90px + 400px + 100px. It produces a -490px
available space. This negative space needs to be distributed among the columns staring with the fixed sized ones.
The fixed sized columns have a flex space of 500px which covers the -490px gap. Based on their 4:1 distribution ratio, they'll end
up with 8px and 2px and the percent column stays at 90px.
Tests: fast/layoutformattingcontext/table-space-shinking-mixed-width-type-simple.html
fast/layoutformattingcontext/table-space-shinking-mixed-width-type-simple2.html
* layout/formattingContexts/table/TableLayout.cpp:
(WebCore::Layout::distributeAvailableSpace):
(WebCore::Layout::TableFormattingContext::TableLayout::distributedHorizontalSpace):
(WebCore::Layout::TableFormattingContext::TableLayout::distributedVerticalSpace):
2021-06-27 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Rename GridSpace::preferredSpace to preferredSize
https://bugs.webkit.org/show_bug.cgi?id=227425
Reviewed by Antti Koivisto.
It is a more descriptive name.
* layout/formattingContexts/table/TableLayout.cpp:
(WebCore::Layout::GridSpace::isEmpty const):
(WebCore::Layout::operator-):
(WebCore::Layout::operator+=):
(WebCore::Layout::operator/):
(WebCore::Layout::distributeAvailableSpace):
(WebCore::Layout::TableFormattingContext::TableLayout::distributedHorizontalSpace): preferredWidth is the same in both cases.
2021-06-27 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Introduce a priority order for the grid types
https://bugs.webkit.org/show_bug.cgi?id=227417
Reviewed by Antti Koivisto.
Extra space distribution is based on a priority list with percent columns having the highest priority
and auto columns having the lowest (percent > fixed > relative > auto).
* layout/formattingContexts/table/TableLayout.cpp:
(WebCore::Layout::distributeAvailableSpace):
2021-06-27 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Introduce GridSpace::type
https://bugs.webkit.org/show_bug.cgi?id=227409
Reviewed by Antti Koivisto.
This is in preparation for supporting mixed width/height types (percent/fixed/relative/auto).
Available space distribution is based on type priority (e.g. percent value takes precedence over fixed width).
* layout/formattingContexts/table/TableLayout.cpp:
(WebCore::Layout::distributeAvailableSpace):
(WebCore::Layout::TableFormattingContext::TableLayout::distributedHorizontalSpace):
(WebCore::Layout::TableFormattingContext::TableLayout::distributedVerticalSpace):
(WebCore::Layout::max): Deleted.
2021-06-27 Philippe Normand <pnormand@igalia.com>
[GStreamer] SleepDisabler not destroyed when video playback stops
https://bugs.webkit.org/show_bug.cgi?id=219353
Reviewed by Eric Carlson.
In GStreamer ports the SleepDisabler remained active after EOS because
HTMLMediaElement::updateSleepDisabling() was not being triggered. An explicit clean-up upon
the ended event in the media element is better than any other implicit action.
Test: media/video-ended-does-not-hold-sleep-assertion.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::dispatchEvent):
2021-06-27 Antoine Quint <graouts@webkit.org>
[Model] [iOS] Add support for rendering model resources
https://bugs.webkit.org/show_bug.cgi?id=227392
<rdar://problem/79770136>
Reviewed by Tim Horton.
Ensure the anchor point is set correctly for model content layers, otherwise the preview layer shows
its center at the corner of the parent layer's origin.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setContentsToModel):
2021-06-26 Joonghun Park <jh718.park@samsung.com>
Unreviewed. Remove the build warnings below since r279050.
warning: redundant move in return statement [-Wredundant-move]
No new tests, no new behavioral changes.
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeCounterStyleAdditiveSymbols):
* css/parser/CSSPropertyParserWorkerSafe.cpp:
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcURI):
2021-06-26 Sam Weinig <weinig@apple.com>
[Modern Media Controls] Modern media controls should not need to know about specific platforms in shared code
https://bugs.webkit.org/show_bug.cgi?id=227423
Reviewed by Eric Carlson.
Rather than requiring the shared media control classes to know specifics about
the various platforms via the LayoutTraits flags, we now abstract those decisions
via a new polymorphic LayoutTraits class, which each platform subclasses and
implements.
This will gives better separation and will allow easier experimentation with new
control patterns.
* DerivedSources-input.xcfilelist:
* DerivedSources.make:
* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* Modules/modern-media-controls/js-files:
Adds new files for layout traits and its subclasses.
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::layoutTraitsClassName const):
(WebCore::MediaControlsHost::platform const): Deleted.
* Modules/mediacontrols/MediaControlsHost.h:
* Modules/mediacontrols/MediaControlsHost.idl:
Replace platform accessor with a new layoutTraitsClassName, which allows
the platform to spcecify which of the trait subclasses to use.
* Modules/modern-media-controls/controls/layout-traits.js: Added.
* Modules/modern-media-controls/controls/ios-layout-traits.js: Added.
* Modules/modern-media-controls/controls/macos-layout-traits.js: Added.
* Modules/modern-media-controls/controls/watchos-layout-traits.js: Added.
Add new layout trait files.
* Modules/modern-media-controls/controls/fullscreen-button.js:
* Modules/modern-media-controls/controls/icon-service.js:
* Modules/modern-media-controls/controls/ios-inline-media-controls.js:
* Modules/modern-media-controls/controls/layout-item.js:
* Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
* Modules/modern-media-controls/controls/macos-inline-media-controls.js:
* Modules/modern-media-controls/controls/media-controls.js:
* Modules/modern-media-controls/controls/play-pause-button.js:
* Modules/modern-media-controls/controls/time-control.js:
* Modules/modern-media-controls/controls/watchos-media-controls.js:
* Modules/modern-media-controls/media/media-controller.js:
* Modules/modern-media-controls/media/tracks-support.js:
Replace explicit checks for platform with queries to the layout traits interface.
2021-06-26 Dean Jackson <dino@apple.com>
Build fix for iOS Simulator. MTLSharedTexture is not available
on that configuration.
* Modules/webxr/WebXROpaqueFramebuffer.cpp:
(WebCore::WebXROpaqueFramebuffer::startFrame):
(WebCore::WebXROpaqueFramebuffer::endFrame):
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
2021-06-25 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Remove redundant struct ResolvedItem
https://bugs.webkit.org/show_bug.cgi?id=227405
Reviewed by Sam Weinig.
* layout/formattingContexts/table/TableLayout.cpp:
(WebCore::Layout::distributeAvailableSpace):
2021-06-25 Myles C. Maxfield <mmaxfield@apple.com>
[macOS] WebGL content is unable to use the discrete GPU
https://bugs.webkit.org/show_bug.cgi?id=227408
<rdar://problem/79216506>
Reviewed by Dean Jackson.
Simply pass along the power preference into ANGLE. This is read in
DisplayMtl::getMetalDeviceMatchingAttribute().
No new tests. I _think_ this is untestable, because the web exposed power preference is being set correctly.
Were correctly reporting to the web content that they have successfully asked for a high power context.
Were just not honoring that internally. If the test is a performance test, or checks the renderer string,
that test would be hardware-dependent, and couldnt be a regular layout test.
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::InitializeEGLDisplay):
2021-06-25 Myles C. Maxfield <mmaxfield@apple.com>
[macOS] -[NSString _web_widthWithFont:] returns 0
https://bugs.webkit.org/show_bug.cgi?id=227385
<rdar://problem/79430938>
Reviewed by Simon Fraser.
Simply take the iOS codepath on macOS.
Test: WebKitLegacyStringWidth.ThaiWidthForWeb
* platform/graphics/FontCascade.cpp:
* platform/graphics/coretext/FontCascadeCoreText.cpp:
(WebCore::FontCascade::FontCascade):
2021-06-22 Dean Jackson <dino@apple.com>
Add support for MTLSharedTextures in WebXR
https://bugs.webkit.org/show_bug.cgi?id=227245
<rdar://problem/79591620>
Reviewed by Tim Horton.
Sometimes, the IOSurface passed to WebXR come from a shared MTLTexture. In
this case we can't treat the IOSurface data as a regular single-plane
image. Instead we should use it to recreate the MTLTexture and then
bind that to WebGL's framebuffer.
* Modules/webxr/WebXROpaqueFramebuffer.cpp: Use some new binding methods on GraphicsContextGLOpenGL
if given a shared texture.
(WebCore::WebXROpaqueFramebuffer::startFrame):
(WebCore::WebXROpaqueFramebuffer::endFrame):
* Modules/webxr/WebXROpaqueFramebuffer.h:
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: New methods to link an
IOSurface to a GL texture, going through a MTLSharedTexture.
(WebCore::GraphicsContextGLOpenGL::attachIOSurfaceToSharedTexture):
(WebCore::GraphicsContextGLOpenGL::detachIOSurfaceFromSharedTexture):
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* platform/xr/PlatformXR.h: Add a new "isShared" member to LayerData
to differentiate between normal IOSurfaces and those that came
from a shared texture.
(PlatformXR::Device::FrameData::LayerData::encode const):
(PlatformXR::Device::FrameData::LayerData::decode):
2021-06-25 Alex Christensen <achristensen@webkit.org>
Fix null crash in AudioMediaStreamTrackRendererCocoa::start
https://bugs.webkit.org/show_bug.cgi?id=227386
<rdar://79045120>
Reviewed by Youenn Fablet.
AudioMediaStreamTrackRendererInternalUnitManager::Proxy::~Proxy calls those callbacks with nullptr.
So can LocalAudioMediaStreamTrackRendererInternalUnit::retrieveFormatDescription when createAudioUnitIfNeeded
has an early return or hasn't been called yet.
When this happens, let's not crash.
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererCocoa.cpp:
(WebCore::AudioMediaStreamTrackRendererCocoa::start):
2021-06-25 Philippe Normand <pnormand@igalia.com>
WIRELESS_PLAYBACK_TARGET guards protect unrelated code
https://bugs.webkit.org/show_bug.cgi?id=227404
Reviewed by Eric Carlson.
The dispatchEvent(), addEventListener() and removeEventListener() are now unconditionally
implemented. The WIRELESS_PLAYBACK_TARGET guards were refactored to enclose only the code
specific to this feature.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent):
(WebCore::HTMLMediaElement::setWirelessPlaybackTarget):
(WebCore::HTMLMediaElement::setShouldPlayToPlaybackTarget):
(WebCore::HTMLMediaElement::playbackTargetPickerWasDismissed):
(WebCore::HTMLMediaElement::remoteHasAvailabilityCallbacksChanged):
(WebCore::HTMLMediaElement::addEventListener):
(WebCore::HTMLMediaElement::removeEventListener):
* html/HTMLMediaElement.h:
2021-06-25 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, reverting r279208.
https://bugs.webkit.org/show_bug.cgi?id=227381
Broke the Apple Windows build.
Reverted changeset:
"Not all uses of AudioToolbox framework use soft linking"
https://bugs.webkit.org/show_bug.cgi?id=227250
https://trac.webkit.org/changeset/279208
2021-06-25 Sergio Villar Senin <svillar@igalia.com>
[css-flexbox] Improve computation of intrinsic sizes of flex items with aspect ratio
https://bugs.webkit.org/show_bug.cgi?id=227395
Reviewed by Rob Buis.
Before computing the intrinsic sizes of flex items we first clear the overriding sizes of the item
that might have been set before in order to get the proper intrinsic size. However there is one
situation in which having an overriding size is desirable and it's when the cross size should
be set to the flex container's definite cross size. That's one of the exceptions for definite/indefinite
sizes mentioned in the specs (see https://drafts.csswg.org/css-flexbox/#definite-sizes).
In the aforementioned case we should temporarily set that overriding size in the cross axis so that
the intrinsic size could be computed with that constrain.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeChildIntrinsicLogicalWidths const): Set the overriding size
in the cross axis to compute the intrinsic size.
(WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing const):
(WebCore::RenderFlexibleBox::childCrossSizeShouldUseContainerCrossSize const): Added a missing check,
the cross size of the child must be auto, otherwise the rule does not apply.
(WebCore::RenderFlexibleBox::computeCrossSizeForChildUsingContainerCrossSize const): Refactored from
computeMainSizeFromAspectRatioUsing() as it's now used in two different places.
* rendering/RenderFlexibleBox.h:
2021-06-25 Philippe Normand <pnormand@igalia.com>
[GStreamer] TextCombiner has unlinked internal encoders
https://bugs.webkit.org/show_bug.cgi?id=227362
Reviewed by Xabier Rodriguez-Calvar.
Each combiner pad can receive multiple caps events for the same stream, so we can't really
rely on those to modify the internal topology of the combiner. Instead we can check the
sticky events from the pad chain function, this is done at most once per pad. In case a caps
event was sticked to the pad, the combiner now reacts properly.
This issue was detected while running
media/track/in-band/track-in-band-kate-ogg-cues-added-once.html with playbin3 enabled. 6
different encoders where added to the combiner while only 2 are needed actually.
* platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
(webKitTextCombinerHandleCaps):
* platform/graphics/gstreamer/TextCombinerGStreamer.h:
* platform/graphics/gstreamer/TextCombinerPadGStreamer.cpp:
(webkitTextCombinerPadChain):
(webkitTextCombinerPadConstructed):
2021-06-17 Sergio Villar Senin <svillar@igalia.com>
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-25 Philippe Normand <pnormand@igalia.com>
[GStreamer] Build warnings in AudioFileReader since r279123
https://bugs.webkit.org/show_bug.cgi?id=227348
Reviewed by Xabier Rodriguez-Calvar.
Simplify the code handling the giostreamsrc creation, now that it is the only option possible.
* platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
(WebCore::AudioFileReader::decodeAudioForBusCreation):
2021-06-25 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r279266.
https://bugs.webkit.org/show_bug.cgi?id=227402
Causes crash loop
Reverted changeset:
"Remove references to order files"
https://bugs.webkit.org/show_bug.cgi?id=227377
https://trac.webkit.org/changeset/279266
2021-06-25 Ziran Sun <zsun@igalia.com>
[css-grid] Consider container's writing mode to get grid item's margin
https://bugs.webkit.org/show_bug.cgi?id=226877
Reviewed by Sergio Villar Senin.
When computing the logical offset of a non-static absolute positioned grid item, we need
to pass its container's style in order to resolve the child margin correctly, especially
for the case when the item has flipped block writing mode (vertical-rl).
This change is an import of the Chromium change at
https://chromium-review.googlesource.com/c/chromium/src/+/2577365
* rendering/RenderBox.h:
(WebCore::RenderBox::marginLogicalLeft const):
(WebCore::RenderBox::marginLogicalRight const):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::logicalOffsetForOutOfFlowChild const):
2021-06-25 Philippe Normand <pnormand@igalia.com>
[GStreamer] Minor debugging improvements in mediastream source element
https://bugs.webkit.org/show_bug.cgi?id=227396
Reviewed by Xabier Rodriguez-Calvar.
* platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: Give representative name to
the appsrc elements embedded in the MediaStreamSource element. Also add logging calls
related with tracks observation.
2021-06-25 Sergio Villar Senin <svillar@igalia.com>
[css-flexbox] Cleanup OverridingSizesScope RAII class
https://bugs.webkit.org/show_bug.cgi?id=227394
Reviewed by Rob Buis.
In r279268 we added a new RAII class which adds an overriding sizes free scope to perform
layout computations. That class heavily uses the different set/get/clear methods for overriding
sizes. We can use a macro with subsitutions there to reduce the amount of required code.
Also moving the computeChildIntrinsicLogicalWidths() method to the private section as it does
not require protected visibility.
No new tests as it's just a code refactoring that does not modify the functionality.
* rendering/RenderFlexibleBox.cpp:
(WebCore::OverridingSizesScope::OverridingSizesScope):
(WebCore::OverridingSizesScope::~OverridingSizesScope):
(WebCore::OverridingSizesScope::setOrClearOverridingSize): Deleted.
* rendering/RenderFlexibleBox.h:
2021-06-25 Martin Robinson <mrobinson@webkit.org>
[css-scroll-snap] Simplify snap point selection helpers
https://bugs.webkit.org/show_bug.cgi?id=227062
Reviewed by Frédéric Wang.
Combine indicesOfNearestSnapOffsets and findFirstSnapStopOffsetBetweenOriginAndDestination
and have the helper return the geometric previous and next snap points. This makes the
code a bit easier to read, slightly more efficient, and prepares for looking at
the geometric previous and next snap points for certain upcoming CSS Scroll Snap features.
Previously, indicesOfNearestSnapOffsets used a binary search and findFirstSnapStopOffsetBetweenOriginAndDestination
used a linear search. This change replaces these two functions with a single linear search.
While findFirstSnapStopOffsetBetweenOriginAndDestination is only called for directional scrolling,
directional scrolling is more common than non-directional scrolling (which is typically only called
by scrollIntoView() and other JS scrolling APIs). I have tested this change with a large table of
snap points and performance does not seem to be changed. In addition, a future change should mean
that this searchForPotentialSnapPoints should be called much less.
No new tests. This should not change behavior in any way.
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::searchForPotentialSnapPoints): Added this new helper which is the combination
of indicesOfNearestSnapOffsets and findFirstSnapStopOffsetBetweenOriginAndDestination.
(WebCore::closestSnapOffsetWithInfoAndAxis): Use the new helper.
2021-06-14 Sergio Villar Senin <svillar@igalia.com>
[css-flexbox] Do not clamp flex base size with {min|max}-{height|width}
https://bugs.webkit.org/show_bug.cgi?id=225590
Reviewed by Alan Bujtas.
When computing flex base size we should not clamp it with neither min-{height|width}
nor max-{height|width}. That would be done later and will be called the hypothetical
main size.
For most of the cases we were already doing it, however there are some particular cases
in which we have to call the generic layout code which does clamp the sizes using min
and max sizes. In order to make those code paths work, we reset the min|max values to
their initial ones (so they effectively become inactive) and then we set the original
values back after computing the base size.
* rendering/RenderFlexibleBox.cpp:
(WebCore::ScopedUnboundedBox::ScopedUnboundedBox): New scoped class that sets min|max sizes
to their initial values on instantiation and restores the original values on destruction.
(WebCore::ScopedUnboundedBox::~ScopedUnboundedBox):
(WebCore::RenderFlexibleBox::constructFlexItems): Wrap the base size computation with a
ScopedUnboundedBox.
2021-06-09 Sergio Villar Senin <svillar@igalia.com>
[css-flexbox] Move flex item preferred width computation specifics to RenderFlexibleBox class
https://bugs.webkit.org/show_bug.cgi?id=226822
Reviewed by Alan Bujtas.
RenderBlock had some specific code for flex items that cleared the overriding sizes before
computing the {min|max}PreferredWidths and then restored them afterwards. That is done to
properly compute flex items intrinsic sizes. That code is flexbox specific so we better move
it to RenderFlexibleBox. In order to do that a new virtual method was added to RenderBlock which
just calls minPreferredLogicalWidth() and maxPreferredLogicalWidth() for every block except
flexbox containers.
In the case of flexbox containers, it wraps those calls with a RAII class that properly
clears the overriding sizes on instantiation and clears them on destruction. Now that the RAII
class is available we use it also for another existing code path that requires to
temporarily set an overriding size in a given scope.
No need for new tests as there is no change in behaviour.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeChildIntrinsicLogicalWidths const): New virtual method.
(WebCore::RenderBlock::computeChildPreferredLogicalWidths const): Call computeChildIntrinsicLogicalWidths().
* rendering/RenderBlock.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::OverridingSizesScope::OverridingSizesScope): New RAII class to set/clear overriding sizes in a scope.
(WebCore::OverridingSizesScope::~OverridingSizesScope):
(WebCore::OverridingSizesScope::setOrClearOverridingSize):
(WebCore::RenderFlexibleBox::computeChildIntrinsicLogicalWidths const): Redefinition for flexbox containers.
(WebCore::RenderFlexibleBox::childIntrinsicLogicalHeight const): Removed constness from attribute.
(WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth): Ditto.
(WebCore::RenderFlexibleBox::crossAxisIntrinsicExtentForChild): Ditto.
* rendering/RenderFlexibleBox.h:
2021-06-24 Antoine Quint <graouts@webkit.org>
[Model] Create a sandbox extension for a temporary directory to store model resources
https://bugs.webkit.org/show_bug.cgi?id=227359
Reviewed by Tim Horton.
The SPIs we will use to render <model> resources expect a file URL to load and render the model.
Before we adopt these SPIs, we extend the sandbox to allow writing to a temporary directory where
we will store these resources.
* Modules/model-element/HTMLModelElement.cpp:
(WebCore::sharedModelElementCacheDirectory):
(WebCore::HTMLModelElement::setModelElementCacheDirectory):
(WebCore::HTMLModelElement::modelElementCacheDirectory):
* Modules/model-element/HTMLModelElement.h:
2021-06-24 Sihui Liu <sihui_liu@apple.com>
Remove references to order files
https://bugs.webkit.org/show_bug.cgi?id=227377
rdar://76070556
Reviewed by Mark Lam.
We don't need to refer to order files on iOS now.
* Configurations/WebCore.xcconfig:
2021-06-24 Venky Dass <yaranamavenkataramana@apple.com>
Crash in IDBTransaction::dispatchEvent when m_openDBRequest is null.
https://bugs.webkit.org/show_bug.cgi?id=226885
Reviewed by Sihui Liu.
Added a test to create null openDBRequest so that it can crash.
Test: storage/indexeddb/request-with-null-open-db-request.html
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::dispatchEvent):
2021-06-24 Jer Noble <jer.noble@apple.com>
[Cocoa] Last few seconds of 'audio/webm; codecs=vorbis' appended to a SampleBuffer are not played
https://bugs.webkit.org/show_bug.cgi?id=226069
<rdar://78004793>
Reviewed by Eric Carlson.
Test: platform/mac-bigsur/media/media-source/media-vorbis-partial.html
When parsing samples from a WebM file, the samples emitted by the parser can be very short in
duration, which is ineffecient both in storage costs in our SampleMap, as well as in decoding
CPU costs, as each sample must be fed into the decoder separately. So the parser will group
together these small samples into a larger "meta sample" with a duration no shorter than 2s.
However, at the end of a file, no more sample data will be appended, up to 2s of audio data
will not be emitted from the parser.
At the end of an append, always flush audio track data to ensure that all parsed samples are
emitted, regardless of their collective duration.
Drive-by Fixes:
- createSampleBuffer() would completely empty m_packetData, which would corrupt the parser state
in the case where there was partial frame data read (because that partial data would be cleared)
Instead, remove only the data from the m_packetData that actually went into the CMSampleBuffer
- createSampleBuffer() would use the entire m_packetData to create a CMSampleBuffer, even if partial
data was read but not yet complete. Only use the fully parsed data to create the CMSampleBuffer.
- consumeFrameData() would only increase the size of m_packetData when m_currentPacketSize was
unset, which would leave the buffer zeroed when partial sample data was present. Always grow
m_packetData to be large enough to receive the read data.
- The Read() method would not return the correct number of bytes read (0) when a null destination
buffer was passed in.
* platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::SourceBufferParserWebM::appendData):
(WebCore::SourceBufferParserWebM::AudioTrackData::consumeFrameData):
(WebCore::SourceBufferParserWebM::AudioTrackData::createSampleBuffer):
2021-06-24 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r275633.
https://bugs.webkit.org/show_bug.cgi?id=227373
Revert to see if this was the cause for some crashes seen
lately
Reverted changeset:
"Reduce Vector<> wasted capacity in some RuleSet code"
https://bugs.webkit.org/show_bug.cgi?id=224160
https://trac.webkit.org/changeset/275633
2021-06-24 Dmitry Kalinkin <dmitry.kalinkin+webkit@gmail.com>
Use <cmath> instead of <math.h>
https://bugs.webkit.org/show_bug.cgi?id=225856
This is needed to avoid ambiguity between abs and std::abs observed on
vanilla clang 7.1.0.
Reviewed by Fujii Hironori.
* platform/graphics/ColorComponents.h:
2021-06-24 Darin Adler <darin@apple.com>
CSS parser does not handle unpaired surrogates correctly
https://bugs.webkit.org/show_bug.cgi?id=227357
Reviewed by Sam Weinig.
Tests: imported/w3c/web-platform-tests/css/css-syntax/input-preprocessing.html
* bindings/js/JSDOMConvertStrings.cpp:
(WebCore::stringToUSVString): Made non-inline to be used outside this file.
* bindings/js/JSDOMConvertStrings.h: Added stringToUSVString.
* css/parser/CSSTokenizer.cpp:
(WebCore::preprocessString): Call stringToUSVString to convert unpaired
surrogates to replacement characters.
2021-06-24 Sihui Liu <sihui_liu@apple.com>
IndexedDB prints error log about blob files when there is no error
https://bugs.webkit.org/show_bug.cgi?id=227092
Reviewed by Chris Dumez.
We should try opening database if file exists, and try getting blob files only if database is opened.
API test: IndexedDB.StoreBlobThenDeleteDatabase
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::deleteBackingStore):
2021-06-24 Kimmo Kinnunen <kkinnunen@apple.com>
Using a video as a source for a WebGL texture is slow and hangs on iOS 15
https://bugs.webkit.org/show_bug.cgi?id=227081
Reviewed by Eric Carlson.
Video frame transfer from GPU process to Web process would fail when
WebGL tried to copy the video frame to a texture. The failure was
artificial, due to use of WebCore::IOSurface as a unneeeded helper
to convert CVPixelBufferRef to cross-process object.
This would cause performance regression when WebGL would
fall back to software conversion fallback. This callback did work
as it obtains the image through "get last frame as native image"
API.
* platform/cocoa/CoreVideoSoftLink.cpp:
* platform/graphics/cocoa/IOSurface.h:
* platform/graphics/cocoa/IOSurface.mm:
Remove CVPixelBufferRef -> WebCore::IOSurface conversion function.
Remove WebCore::IOSurface -> CVPixelBufferRef conversion function.
These were used in WebKit IPC serialization for CVPixelBufferRef.
However, this is incorrect behavior as CVPixelBufferRef
is not always compatible with WebCore::IOSurface. IOSurfaceRef
has always a destination color space. This would be missing from
CVPixelBufferRef. The code is moved to the IPC serialization
functions.
2021-06-24 Alan Bujtas <zalan@apple.com>
[IFC][Integration] Text selection flashing to end of paragraph
https://bugs.webkit.org/show_bug.cgi?id=227158
<rdar://79138828>
Reviewed by Antti Koivisto.
The "find the line for this position" code in RenderText::positionForPoint() expects adjoining lines boxes (i.e. no gaps between the lines). This function is called by hittesting as part of the text selection process.
This patch implements the legacy behavior by
1. expanding the "selection top" all the way to the (selection)bottom of the previous line.
2. ensures that the first line's computed offset is ignored when the containing block has no border/padding.
Test: fast/events/touch/ios/hidpi-selection-when-content-is-on-subpixel.html
* layout/integration/LayoutIntegrationLineIteratorModernPath.h:
(WebCore::LayoutIntegration::LineIteratorModernPath::selectionTop const):
(WebCore::LayoutIntegration::LineIteratorModernPath::selectionTopForHitTesting const):
2021-06-24 Martin Robinson <mrobinson@webkit.org>
[css-scroll-snap] Remove ENABLE_SCROLL_SNAP compile-time option
https://bugs.webkit.org/show_bug.cgi?id=227067
Reviewed by Simon Fraser.
Remove compile-time ENABLE_SCROLL_SNAP configuration option.
No new tests. This should not change behavior in any way.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSPrimitiveValueMappings.h:
* css/CSSProperties.json:
* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseSingleValue):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleWheelEventInAppropriateEnclosingBox):
* page/FrameView.cpp:
(WebCore::FrameView::updateScrollingCoordinatorScrollSnapProperties const):
(WebCore::FrameView::performPostLayoutTasks):
* page/FrameView.h:
* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::processWheelEventForScrollSnap):
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::setStateScrollingNodeSnapOffsetsAsFloat):
(WebCore::AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
(WebCore::AsyncScrollingCoordinator::updateScrollSnapPropertiesWithFrameView):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
* page/scrolling/ScrollSnapOffsetsInfo.h:
* page/scrolling/ScrollingMomentumCalculator.cpp:
* page/scrolling/ScrollingMomentumCalculator.h:
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
(WebCore::ScrollingStateScrollingNode::applicableProperties const):
(WebCore::ScrollingStateScrollingNode::setCurrentVerticalSnapPointIndex):
(WebCore::ScrollingStateScrollingNode::dumpProperties const):
* page/scrolling/ScrollingStateScrollingNode.h:
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
(WebCore::ScrollingTreeScrollingNode::dumpProperties const):
(WebCore::ScrollingTreeScrollingNode::setCurrentVerticalSnapPointIndex):
* page/scrolling/ScrollingTreeScrollingNode.h:
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
* page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
* page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
(WebCore::ScrollingTreeScrollingNodeDelegateMac::updateFromStateNode):
(WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent):
(WebCore::ScrollingTreeScrollingNodeDelegateMac::viewportSize const):
* page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.cpp:
(WebCore::ScrollingTreeScrollingNodeDelegateNicosia::handleWheelEvent):
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::ScrollAnimator):
(WebCore::ScrollAnimator::~ScrollAnimator):
(WebCore::ScrollAnimator::scroll):
(WebCore::ScrollAnimator::resnapAfterLayout):
(WebCore::ScrollAnimator::handleWheelEvent):
(WebCore::ScrollAnimator::updateActiveScrollSnapIndexForOffset):
(WebCore::ScrollAnimator::notifyPositionChanged):
(WebCore::ScrollAnimator::pageScaleFactor const):
(WebCore::ScrollAnimator::scrollControllerAnimationTimerFired):
(WebCore::ScrollAnimator::adjustScrollOffsetForSnappingIfNeeded):
* platform/ScrollAnimator.h:
* platform/ScrollController.cpp:
(WebCore::ScrollController::usesScrollSnap const):
(WebCore::ScrollController::resnapAfterLayout):
* platform/ScrollController.h:
* platform/ScrollSnapAnimatorState.cpp:
* platform/ScrollSnapAnimatorState.h:
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::doPostThumbMoveSnapping):
* platform/ScrollableArea.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::isScrollSnapInProgress const):
(WebCore::ScrollAnimatorMac::didBeginScrollGesture const):
(WebCore::ScrollAnimatorMac::didEndScrollGesture const):
(WebCore::gestureShouldBeginSnap):
(WebCore::ScrollAnimatorMac::allowsVerticalStretching const):
(WebCore::ScrollAnimatorMac::allowsHorizontalStretching const):
* platform/mac/ScrollController.mm:
(WebCore::ScrollController::stopAllTimers):
(WebCore::ScrollController::handleWheelEvent):
(WebCore::ScrollController::isScrollSnapInProgress const):
(WebCore::ScrollController::updateScrollSnapAnimatingState):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::willBeDestroyed):
(WebCore::RenderBox::styleWillChange):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateScrollSnapPropertiesWithFrameView const):
* rendering/RenderLayerCompositor.h:
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::styleDidChange):
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::updateScrollInfoAfterLayout):
(WebCore::RenderLayerScrollableArea::isScrollSnapInProgress const):
* rendering/RenderLayerScrollableArea.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::unregisterBoxWithScrollSnapPositions):
* rendering/RenderView.h:
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeRequiresLayout const):
(WebCore::RenderStyle::setScrollPaddingRight):
(WebCore::RenderStyle::hasSnapPosition const):
* rendering/style/RenderStyle.h:
* rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<):
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator== const):
* rendering/style/StyleRareNonInheritedData.h:
* rendering/style/StyleScrollSnapPoints.h:
* style/StyleBuilderConverter.h:
* testing/Internals.cpp:
(WebCore::Internals::isScrollSnapInProgress):
* testing/Internals.h:
* testing/Internals.idl:
2021-06-24 Enrique Ocaña González <eocanha@igalia.com>
[GTK] media/muted-video-is-playing-audio.html is timing out
https://bugs.webkit.org/show_bug.cgi?id=208321
Reviewed by Xabier Rodriguez-Calvar.
Added setPageMediaVolume() API to set the Page mediaVolume. This was 0
by default and a way to set it to a non-zero value was needed in order
to prevent a zero effectiveVolume in HTMLMediaElement.
* testing/Internals.cpp:
(WebCore::Internals::setPageMediaVolume): Set the Page mediaVolume.
* testing/Internals.h: Added setPageMediaVolume().
* testing/Internals.idl: Ditto.
2021-06-23 Jean-Yves Avenard <jya@apple.com>
Not all uses of AudioToolbox framework use soft linking
https://bugs.webkit.org/show_bug.cgi?id=227250
<rdar://problem/79606090>
Reviewed by Eric Carlson.
Unify AudioToolbox, CoreMedia, VideoToolbox and MediaToolbox's method
definitions and their use, ensuring that they are always soft-linked.
Unified builds and the inconsistent use of explicitly using the PAL namespace
caused some calls to be ambiguous leading to compilation errors; some
code would also use the softlinked methods while others called into the frameworks
directly.
To get around those we ensure that any calls to AudioToolbox or CoreMedia is always using
the fully resolved PAL name.
Remove unnecessary `using namespace PAL;` statements wherever applicable.
No change in observable behavior.
* Modules/mediastream/PeerConnectionBackend.cpp:
* Modules/plugins/QuickTimePluginReplacement.mm:
* Modules/webaudio/MediaStreamAudioSourceCocoa.cpp:
(WebCore::MediaStreamAudioSource::consumeAudio):
* dom/Document.cpp:
* html/HTMLCanvasElement.cpp:
* html/HTMLMediaElement.cpp:
* platform/audio/AudioFileReader.h:
* platform/audio/cocoa/AudioFileReaderCocoa.cpp:
(WebCore::AudioFileReader::AudioFileReader):
(WebCore::AudioFileReader::~AudioFileReader):
(WebCore::AudioFileReader::createBus):
(WebCore::createBusFromAudioFile): Deleted.
* platform/audio/cocoa/AudioFileReaderCocoa.h:
* platform/audio/cocoa/AudioOutputUnitAdaptor.cpp:
(WebCore::AudioOutputUnitAdaptor::~AudioOutputUnitAdaptor):
(WebCore::AudioOutputUnitAdaptor::start):
(WebCore::AudioOutputUnitAdaptor::stop):
* platform/audio/cocoa/AudioSampleBufferList.cpp:
(WebCore::AudioSampleBufferList::copyFrom):
* platform/audio/cocoa/AudioSampleDataSource.mm:
* platform/audio/cocoa/WebAudioBufferList.cpp:
(WebCore::WebAudioBufferList::WebAudioBufferList):
* platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
(WebCore::AudioFileReader::decodeAudioForBusCreation):
(WebCore::createBusFromAudioFile): Deleted.
* platform/audio/ios/AudioOutputUnitAdaptorIOS.cpp:
(WebCore::AudioOutputUnitAdaptor::configure):
* platform/audio/mac/AudioOutputUnitAdaptorMac.cpp:
(WebCore::AudioOutputUnitAdaptor::configure):
* platform/cocoa/MediaUtilities.cpp:
(WebCore::createAudioFormatDescription):
(WebCore::createAudioSampleBuffer):
* platform/graphics/RemoteVideoSample.cpp:
(WebCore::RemoteVideoSample::create):
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::create):
(WebCore::AudioSourceProviderAVFObjC::provideInput):
(WebCore::AudioSourceProviderAVFObjC::createMixIfNeeded):
(WebCore::AudioSourceProviderAVFObjC::finalizeCallback):
(WebCore::AudioSourceProviderAVFObjC::prepareCallback):
(WebCore::AudioSourceProviderAVFObjC::unprepareCallback):
(WebCore::AudioSourceProviderAVFObjC::processCallback):
(WebCore::AudioSourceProviderAVFObjC::prepare):
(WebCore::AudioSourceProviderAVFObjC::process):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageGenerator):
(WebCore::MediaPlayerPrivateAVFoundationObjC::getStartDate const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::currentMediaTime const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformBufferedTimeRanges const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformMinTimeSeekable const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformMaxTimeSeekable const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformMaxTimeLoaded const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect):
(WebCore::MediaPlayerPrivateAVFoundationObjC::isAvailable):
(WebCore::MediaPlayerPrivateAVFoundationObjC::metadataGroupDidArrive):
(WebCore::MediaPlayerPrivateAVFoundationObjC::metadataDidArrive):
(WebCore::MediaPlayerPrivateAVFoundationObjC::performTaskAtMediaTime):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::EffectiveRateChangedListener::stop):
(WebCore::EffectiveRateChangedListener::EffectiveRateChangedListener):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::isAvailable):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::currentMediaTime const):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCurrentTimeDidChangeCallback):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastPixelBuffer):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::streamSession):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::performTaskAtMediaTime):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable):
(WebCore::videoTransformationMatrix):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateCurrentFrameImage):
* platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
(WTF::CFTypeTrait<CMSampleBufferRef>::typeID):
(WebCore::MediaSampleAVFObjC::createImageSample):
(WebCore::MediaSampleAVFObjC::presentationTime const):
(WebCore::MediaSampleAVFObjC::decodeTime const):
(WebCore::MediaSampleAVFObjC::duration const):
(WebCore::MediaSampleAVFObjC::sizeInBytes const):
(WebCore::MediaSampleAVFObjC::videoPixelFormat const):
(WebCore::isCMSampleBufferAttachmentRandomAccess):
(WebCore::doesCMSampleBufferHaveSyncInfo):
(WebCore::isCMSampleBufferRandomAccess):
(WebCore::isCMSampleBufferAttachmentNonDisplaying):
(WebCore::isCMSampleBufferNonDisplaying):
(WebCore::MediaSampleAVFObjC::presentationSize const):
(WebCore::MediaSampleAVFObjC::offsetTimestampsBy):
(WebCore::MediaSampleAVFObjC::setTimestamps):
(WebCore::MediaSampleAVFObjC::isDivisable const):
(WebCore::MediaSampleAVFObjC::divide):
(WebCore::MediaSampleAVFObjC::createNonDisplayingCopy const):
(WebCore::MediaSampleAVFObjC::getRGBAImageData const):
(WebCore::setSampleBufferAsDisplayImmediately):
(WebCore::MediaSampleAVFObjC::isHomogeneous const):
(WebCore::MediaSampleAVFObjC::divideIntoHomogeneousSamples):
(WebCore::MediaSampleAVFObjC::cloneSampleBufferAndSetAsDisplayImmediately):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::bufferWasConsumedCallback):
(WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::rendererWasAutomaticallyFlushed):
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
(WebCore::SourceBufferPrivateAVFObjC::canSetMinimumUpcomingPresentationTime const):
(WebCore::SourceBufferPrivateAVFObjC::setMinimumUpcomingPresentationTime):
* platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::SourceBufferParserWebM::OnFrame):
(WebCore::SourceBufferParserWebM::VideoTrackData::consumeFrameData):
(WebCore::SourceBufferParserWebM::VideoTrackData::createSampleBuffer):
(WebCore::SourceBufferParserWebM::AudioTrackData::consumeFrameData):
(WebCore::SourceBufferParserWebM::AudioTrackData::createSampleBuffer):
* platform/graphics/cocoa/VP9UtilitiesCocoa.mm:
(WebCore::convertToCMColorPrimaries):
(WebCore::convertToCMTransferFunction):
(WebCore::convertToCMYCbCRMatrix):
(WebCore::createFormatDescriptionFromVPCodecConfigurationRecord):
* platform/graphics/cocoa/WebCoreDecompressionSession.mm:
(WTF::CFTypeTrait<CMSampleBufferRef>::typeID):
(WebCore::WebCoreDecompressionSession::setTimebase):
(WebCore::WebCoreDecompressionSession::enqueueSample):
(WebCore::WebCoreDecompressionSession::shouldDecodeSample):
(WebCore::WebCoreDecompressionSession::ensureDecompressionSessionForSample):
(WebCore::WebCoreDecompressionSession::decodeSample):
(WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
(WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
(WebCore::WebCoreDecompressionSession::automaticDequeue):
(WebCore::WebCoreDecompressionSession::enqueueDecodedSample):
(WebCore::WebCoreDecompressionSession::isReadyForMoreMediaData const):
(WebCore::WebCoreDecompressionSession::notifyWhenHasAvailableVideoFrame):
(WebCore::WebCoreDecompressionSession::imageForTime):
(WebCore::WebCoreDecompressionSession::flush):
(WebCore::WebCoreDecompressionSession::getDecodeTime):
(WebCore::WebCoreDecompressionSession::getPresentationTime):
(WebCore::WebCoreDecompressionSession::getDuration):
(WebCore::WebCoreDecompressionSession::compareBuffers):
(WebCore::WebCoreDecompressionSession::updateQosWithDecodeTimeStatistics):
* platform/graphics/cv/ImageTransferSessionVT.mm:
(WebCore::ImageTransferSessionVT::createPixelBuffer):
(WebCore::ImageTransferSessionVT::convertCMSampleBuffer):
(WebCore::ImageTransferSessionVT::createCMSampleBuffer):
* platform/ios/PlaybackSessionInterfaceAVKit.mm:
(WebCore::PlaybackSessionInterfaceAVKit::seekableRangesChanged):
* platform/mac/VideoFullscreenInterfaceMac.mm:
* platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp:
(WebCore::MediaRecorderPrivateAVFImpl::videoSampleAvailable):
* platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm:
(WebCore::AudioSampleBufferCompressor::~AudioSampleBufferCompressor):
(WebCore::AudioSampleBufferCompressor::initialize):
(WebCore::AudioSampleBufferCompressor::finish):
(WebCore::AudioSampleBufferCompressor::initAudioConverterForSourceFormatDescription):
(WebCore::AudioSampleBufferCompressor::attachPrimingTrimsIfNeeded):
(WebCore::AudioSampleBufferCompressor::gradualDecoderRefreshCount):
(WebCore::AudioSampleBufferCompressor::sampleBufferWithNumPackets):
(WebCore::AudioSampleBufferCompressor::provideSourceDataNumOutputPackets):
(WebCore::AudioSampleBufferCompressor::processSampleBuffersUntilLowWaterTime):
(WebCore::AudioSampleBufferCompressor::processSampleBuffer):
(WebCore::AudioSampleBufferCompressor::getOutputSampleBuffer):
(WebCore::AudioSampleBufferCompressor::takeOutputSampleBuffer):
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
(WebCore::MediaRecorderPrivateWriter::MediaRecorderPrivateWriter):
(WebCore::MediaRecorderPrivateWriter::processNewCompressedVideoSampleBuffers):
(WebCore::MediaRecorderPrivateWriter::processNewCompressedAudioSampleBuffers):
(WebCore::MediaRecorderPrivateWriter::startAssetWriter):
(WebCore::MediaRecorderPrivateWriter::appendCompressedVideoSampleBuffer):
(WebCore::appendEndsPreviousSampleDurationMarker):
(WebCore::copySampleBufferWithCurrentTimeStamp):
(WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer):
(WebCore::MediaRecorderPrivateWriter::appendAudioSampleBuffer):
(WebCore::MediaRecorderPrivateWriter::completeFetchData):
(WebCore::MediaRecorderPrivateWriter::pause):
(WebCore::MediaRecorderPrivateWriter::resume):
* platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm:
(WebCore::VideoSampleBufferCompressor::~VideoSampleBufferCompressor):
(WebCore::VideoSampleBufferCompressor::initialize):
(WebCore::VideoSampleBufferCompressor::finish):
(WebCore::VideoSampleBufferCompressor::videoCompressionCallback):
(WebCore::VideoSampleBufferCompressor::vtProfileLevel const):
(WebCore::VideoSampleBufferCompressor::initCompressionSession):
(WebCore::VideoSampleBufferCompressor::processSampleBuffer):
(WebCore::VideoSampleBufferCompressor::getOutputSampleBuffer):
(WebCore::VideoSampleBufferCompressor::takeOutputSampleBuffer):
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererInternalUnit.cpp:
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::start):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::stop):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::createAudioUnitIfNeeded):
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::setSessionSizeAndFrameRate):
(WebCore::AVVideoCaptureSource::frameDurationForFrameRate):
(WebCore::AVVideoCaptureSource::generatePresets):
* platform/mediastream/mac/CoreAudioCaptureDevice.cpp:
(WebCore::CoreAudioCaptureDevice::deviceClock):
* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioSharedUnit::setupAudioUnit):
(WebCore::CoreAudioSharedUnit::configureMicrophoneProc):
(WebCore::CoreAudioSharedUnit::configureSpeakerProc):
(WebCore::CoreAudioSharedUnit::cleanupAudioUnit):
(WebCore::CoreAudioSharedUnit::reconfigureAudioUnit):
(WebCore::CoreAudioSharedUnit::startInternal):
(WebCore::CoreAudioSharedUnit::stopInternal):
(WebCore::CoreAudioSharedUnit::defaultInputDevice):
* platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
* platform/mediastream/mac/MockAudioSharedUnit.mm:
(WebCore::MockAudioSharedUnit::reconfigure):
(WebCore::MockAudioSharedUnit::emitSampleBuffers):
* platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
* platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:
(WebCore::RealtimeIncomingAudioSourceCocoa::OnData):
* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
(WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
(WebCore::RealtimeOutgoingVideoSourceCocoa::videoSampleAvailable):
* platform/mediastream/mac/WindowDisplayCapturerMac.mm:
2021-06-23 Jean-Yves Avenard <jya@apple.com>
Remove #include <wtf/Optional.h>
https://bugs.webkit.org/show_bug.cgi?id=227335
Reviewed by Darin Adler.
* Modules/mediasession/MediaSessionCoordinatorPrivate.h:
2021-06-23 Peng Liu <peng.liu6@apple.com>
[iPadOS] A video cannot enter picture-in-picture when Safari is suspended
https://bugs.webkit.org/show_bug.cgi?id=227325
Reviewed by Eric Carlson.
When an element goes into the element fullscreen mode, a descendant video element
gains the ability to automatically enter picture-in-picture on application suspend.
However, the video element may lose the ability after some stress tests.
The root cause is related to `m_restoringFullscreenForPictureInPictureStop`.
Under stress tests, `-[AVPlayerViewController enterFullScreenAnimated:completionHandler]`
may call the completion handler with `success == NO`. The current implementation
will keep `m_restoringFullscreenForPictureInPictureStop` with a wrong value,
so that the video cannot enter picture-in-picture automatically when the browser
is suspended.
This patch removes `m_restoringFullscreenForPictureInPictureStop` since it is not needed
after r269557.
Manually tested.
* platform/ios/VideoFullscreenInterfaceAVKit.h:
* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(VideoFullscreenInterfaceAVKit::willStopPictureInPicture):
(VideoFullscreenInterfaceAVKit::didStopPictureInPicture):
(VideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler):
(VideoFullscreenInterfaceAVKit::doEnterFullscreen):
(VideoFullscreenInterfaceAVKit::enterFullscreenHandler):
2021-06-23 Alex Christensen <achristensen@webkit.org>
Fix some PerformanceNavigationTiming bugs
https://bugs.webkit.org/show_bug.cgi?id=227329
Reviewed by Chris Dumez.
Test: imported/w3c/web-platform-tests/navigation-timing/buffered-flag.window.html
This fixes two bugs:
1. We need to delay the PerformanceObserver event until didFinishNavigation time, which is after iframes have also finished loading.
2. We need to remember whether we've added the PerformanceNavigationTiming to a PerformanceObserver's list to avoid duplicate entries.
This fixes two WPT tests that were passed by Chrome and Firefox.
PerformanceNavigationTiming is still an off-by-default experimental feature, so this won't affect anything yet.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
* page/Performance.cpp:
(WebCore::Performance::appendBufferedEntriesByType const):
(WebCore::Performance::registerPerformanceObserver):
(WebCore::Performance::scheduleNavigationObservationTaskIfNeeded):
* page/Performance.h:
* page/PerformanceObserver.cpp:
(WebCore::PerformanceObserver::observe):
* page/PerformanceObserver.h:
(WebCore::PerformanceObserver::hasNavigationTiming const):
(WebCore::PerformanceObserver::addedNavigationTiming):
2021-06-23 Truitt Savell <tsavell@apple.com>
Fix iOS Debug testing be removing the assert added in r279119
https://bugs.webkit.org/show_bug.cgi?id=227227
Reviewed by Eric Carlson.
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::setEligibleForSmartRouting):
2021-06-23 Jer Noble <jer.noble@apple.com>
[Cocoa] Make the hostTime parameter to playSession a Monotonic time
https://bugs.webkit.org/show_bug.cgi?id=226515
Reviewed by Youenn Fablet.
Fire the playSession action handler at approximately the hostTime indicated by the MediaSessionCoordinatorPrivate.
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::playSession):
* Modules/mediasession/MediaSessionCoordinator.h:
* Modules/mediasession/MediaSessionCoordinatorPrivate.h:
(WebCore::MediaSessionCoordinatorClient::playSession):
2021-06-23 Mark Lam <mark.lam@apple.com>
Remove unneeded explicit exception checks in ScriptModuleLoader::evaluate().
https://bugs.webkit.org/show_bug.cgi?id=227302
Reviewed by Yusuke Suzuki.
A RELEASE_AND_RETURN will do because we're just propagating the exception to the
client in both cases.
* bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::evaluate):
2021-06-23 Kimmo Kinnunen <kkinnunen@apple.com>
rAF driven WebGL submits excessive amount of GPU work when frames are slow
https://bugs.webkit.org/show_bug.cgi?id=227059
<rdar://problem/79385858>
Reviewed by Kenneth Russell.
Limit in-flight WebGL frames to three frames. Do not continue preparation for display
until the commands for the oldest frame have been executed by the GPU.
This limits the impact slow frames have, especially in the
case where the compositor skip frames and WebKit would issue a new slow frame
on top of the skipped frame.
No new tests, tested manually with the pages referenced from the bugs.
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::waitAndUpdateOldestFrame):
* platform/graphics/angle/GraphicsContextGLANGLEUtilities.h:
(WebCore::ScopedGLFence::ScopedGLFence):
(WebCore::ScopedGLFence::operator=):
(WebCore::ScopedGLFence::~ScopedGLFence):
(WebCore::ScopedGLFence::reset):
(WebCore::ScopedGLFence::abandon):
(WebCore::ScopedGLFence::fenceSync):
(WebCore::ScopedGLFence::operator GLsync const):
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
(WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):
(WebCore::GraphicsContextGLOpenGL::prepareForDisplay):
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
2021-06-23 Andres Gonzalez <andresg_22@apple.com>
Accessibility support for image text recognition.
https://bugs.webkit.org/show_bug.cgi?id=224280
rdar://76348740
Reviewed by Chris Fleizach.
Test: accessibility/ios-simulator/image-overlay-elements.html
Exposes to accessibility clients the elements created by
WebPage::requestTextRecognition for static images. This allows clients
to present the recognized text in images to assistive technology users.
- Added a new AXObject subclass, AXImage, to encapsulate this functionality.
This class can be expanded to offload some of the image specific code
contained in AccessibilityRenderObject, AccessibilityNodeObject,
AccessibilityObject and others.
- Since requestTextRecognition is an async call, added an AXNotification
to notify clients when the image overlay elements are available for
consumption.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AXImage.cpp: Added.
(WebCore::AXImage::AXImage):
(WebCore::AXImage::create):
(WebCore::AXImage::roleValue const):
(WebCore::AXImage::imageOverlayElements):
* accessibility/AXImage.h: Added.
* accessibility/AXLogger.cpp:
(WebCore::operator<<):
* accessibility/AXObjectCache.cpp:
(WebCore::isSimpleImage): Determines whether a given element is a static
image.
(WebCore::createFromRenderer): Instantiate an AXImage object when
appropriate.
* accessibility/AXObjectCache.h:
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::canHaveChildren const): Images can
have children.
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityObjectInterface.h:
* accessibility/ios/AXObjectCacheIOS.mm:
(WebCore::AXObjectCache::notificationPlatformName):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityElements]):
(-[WebAccessibilityObjectWrapper accessibilityImageOverlayElements]):
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::isAXImageInstance const):
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::postPlatformNotification):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2021-06-18 Mark Lam <mark.lam@apple.com>
Add missing exception checks in ScriptModuleLoader and JSDOMPromiseDeferred.
https://bugs.webkit.org/show_bug.cgi?id=221374
rdar://problem/68911404
Reviewed by Yusuke Suzuki.
Based on patch by Frédéric Wang <fwang@igalia.com>.
When an import call fails, ScriptModuleLoader::notifyFinished() rejects the
deferred promise with either a call to
DeferredPromise::reject(ExceptionCode, const String&, RejectAsHandled) or a call to
rejectToPropagateNetworkError() / DeferredPromise::rejectWithCallback(). When it
succeeds, it calls DeferredPromise::resolveWithPromise(). These correspond to three
places where we enter the VM. Catch scopes are thus added to handle uncaught
exceptions for DeferredPromise.
Currently, this logic for uncaught exceptions is already duplicated at several
places in the code, and is likely needed for other places too in follow-up work.
This patch however covers all the rejection and resolution calls from
ScriptModuleLoader. Additionally, it handles missing exception checks in
ScriptModuleLoader::evaluate.
Test: js/dom/modules/missing-exception-check-for-import.html
* bindings/js/JSDOMPromiseDeferred.cpp:
(WebCore::DeferredPromise::reject):
(WebCore::DeferredPromise::handleTerminationExceptionIfNeeded):
(WebCore::DeferredPromise::handleUncaughtException):
* bindings/js/JSDOMPromiseDeferred.h:
(WebCore::DeferredPromise::resolveWithCallback):
(WebCore::DeferredPromise::rejectWithCallback):
* bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::evaluate):
2021-06-21 Darin Adler <darin@apple.com>
Improve more of the CSS list style implementations
https://bugs.webkit.org/show_bug.cgi?id=227206
Reviewed by Antti Koivisto.
Added support for 12 new values for list-style-type: disclosure-closed,
disclosure-open, ethiopic-numeric, japanese-formal, japanese-informal,
korean-hangul-formal, korean-hanja-formal, korean-hanja-informal,
simp-chinese-formal, simp-chinese-informal, trad-chinese-informal,
and trad-chinese-formal.
Improved implementation to match specification more closely for a few
existing values for list-style-type: armenian, cjk-ideographic, hebrew,
lower-armenian, lower-roman, upper-armenian, and upper-roman.
Fixed a rendering issue where we would position list items incorrectly
in list-style-position:inside cases because of measuring the list marker
widths and the list marker suffix widths separately and adding them
instead of measuring them together. This was causing some of the
Web Platform Tests, done using ref tests, to fail.
* accessibility/AccessibilityObject.cpp:
(WebCore::listMarkerTextForNode): Updated since
RenderListItem::markerTextWithSuffix now returns a StringView.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::stringValue const): Updated
to call RenderListMarker::textWithoutSuffix.
* accessibility/atk/WebKitAccessibleHyperlink.cpp:
(rangeLengthForObject): Ditto.
* accessibility/atk/WebKitAccessibleInterfaceText.cpp:
(accessibilityObjectLength): Ditto.
(webkitAccessibleTextGetText): Updated since
RenderListItem::markerTextWithSuffix now returns a StringView.
* css/CSSPrimitiveValueMappings.h:
(WebCore::toCSSValueID): Factored this out into a separate helper.
Also made it take advantage of the relationship between the enumeration
and the CSS value keywords that the code in the other direction already
was relying on so we don't have to list all the keywords.
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Refactored to call the
toCSSValueID function.
* css/CSSValueKeywords.in: Added 12 new list-type-style constants:
disclosure-open, disclosure-closed, japanese-informal, japanese-formal,
korean-hangul-formal, korean-hanja-informal, korean-hanja-formal,
simp-chinese-informal, simp-chinese-formal, trad-chinese-informal,
trad-chinese-formal, and ethiopic-numeric.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::isPredefinedCounterStyle): Updated
since the last predefined counter style is EthiopicNumeric.
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::markerTextWithoutSuffix const): Renamed from
markerText, and changed to return a StringView.
(WebCore::RenderListItem::markerTextWithSuffix const): Return a StringView.
* rendering/RenderListItem.h: Updated for the above.
* rendering/RenderListMarker.cpp:
(WebCore::toRoman): Deleted.
(WebCore::toAlphabeticOrNumeric): Tweaked to use compile time instead of
runtime checks for alphabetic vs. numeric.
(WebCore::toSymbolic): Updated for above.
(WebCore::toAlphabetic): Ditto.
(WebCore::toNumeric): Ditto.
(WebCore::toHebrewUnder1000): Deleted.
(WebCore::toHebrew): Deleted.
(WebCore::toArmenianUnder10000): Deleted.
(WebCore::toArmenian): Deleted.
(WebCore::toGeorgian): Deleted.
(WebCore::toCJKIdeographic): Added handling for negative numbers and also
tweaked coding style a bit.
(WebCore::toPredefinedAdditiveSystem): Added. Implements the additive
system concept, which we use below to re-implement Hebrew, Armenian,
Georgian, Japanese, and Korean styles.
(WebCore::toEthiopicNumeric): Added.
(WebCore::effectiveListMarkerType): Added the new styles. Also updated the
allowable values for CJKIdeographic to allow negative numbers, and for Hebrew
to no longer allow 0 or numbers over 10999. Also sorted the sections by the
name of the first list style type in each section.
(WebCore::listMarkerSuffix): Changed to return a StringView instead of a
UChar, and include the trailing space. Choose the suffix based on the
specified type and not the effective type, so fallback does not cause the
suffix to fall back. Added the new types.
(WebCore::suffixRequiresSpace): Deleted.
(WebCore::listMarkerText): Added implementations for all the new types.
Also updated the implementation of CJKIdeographic, LowerRoman, UpperRoman,
Armenian, UpperArmenian, LowerArmenian, Georgian, and Hebrew to match a
newer CSS specification draft, and in most cases was able to use
toPredefinedAdditiveSystem instead of language-specific functions.
(WebCore::RenderListMarker::createInlineBox): Stop using the isText function,
which was only used here.
(WebCore::RenderListMarker::paint): Updated for the name change of
relativeMarkerRect. Removed unneeded special case for ListStyleType::None.
Use the new RenderListMarker::textRun function, moving all the code that
deals with direction and suffix in there.
(WebCore::reversed): Added. Helper used by textRun.
(WebCore::RenderListMarker::textRun const): Added. Composes a TextRun for
drawing or measuring text. By using the same function in all those places,
we guarantee we measure the text together instead of in pieces, which fixes
some layout errors leading to test failures that measuring separately and
adding the results together was causing.
(WebCore::RenderListMarker::addOverflowFromListMarker): Use the data
member m_lineOffsetForListItem instead of the lineOffsetForListItem
function, which was only used here.
(WebCore::RenderListMarker::updateMarginsAndContent): Moved the check of
preferredLogicalWidthsDirty and the comment about it here.
(WebCore::RenderListMarker::updateContent): Moved check of
preferredLogicalWidthsDirty out of this function since one caller asserts
it, and so the other caller can do the check itself. Added code to set
m_textWithSuffix, m_textWithoutSuffixLength, and m_textIsLeftToRightDirection.
Removed unneeded special cases for ListStyleType::None, Circle, Disc, and
Square, which are all handled correctly by the main algorithm. Added a FIXME
about the inadequacy of our bidi algorithm implementation for the general case.
(WebCore::RenderListMarker::computePreferredLogicalWidths): Use the new
textRun function, allowing us to remove some special case code, including
the special cases for ListStyleType::None, Asterisks, Footnotes, and String.
(WebCore::RenderListMarker::updateMargins): Removed unneeded special case for
ListStyleType::None, and updated string empty checks for the new name of the
m_textWithSuffix data member.
(WebCore::RenderListMarker::suffix const): Deleted.
(WebCore::RenderListMarker::relativeMarkerRect): Renamed from
getRelativeMarkerRect. Use the new textRun function, allowing us to remove
some special case code, including the special cases for ListTyleType::None,
Asterisks, Footnotes, and String.
(WebCore::RenderListMarker::textWithoutSuffix const): Added.
* rendering/RenderListMarker.h: Marked functions as final instead of just
override. Got rid of unneeded suffix and lineOffsetForListItem functions.
Renamed text ot textWithoutSuffix and added textWithSuffix. Added textRun
private member function. Replaced m_text with m_textWithSuffix,
m_textWithoutSuffixLength, and m_textIsLeftToRightDirection.
* rendering/RenderTreeAsText.cpp:
(WebCore::RenderTreeAsText::writeRenderObject): Use textWithoutSuffix.
(WebCore::markerTextForListItem): Use markerTextWithoutSuffix.
* rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<): Use getValueName from CSSValueKeywords.h and
toCSSValueID to avoid repeating the names of all the list style types here.
* rendering/style/RenderStyleConstants.h: Added the 12 new list style types.
2021-06-22 Wenson Hsieh <wenson_hsieh@apple.com>
[Live Text] [macOS] Add an internal option to disable inline text selection in images
https://bugs.webkit.org/show_bug.cgi?id=227265
rdar://79460142
Reviewed by Tim Horton.
Add support for the new feature flag. See WebKit/ChangeLog for more details.
* en.lproj/Localizable.strings:
Add additional localizable strings to represent each of the possible titles for the "Quick Look"/"Look Up"
context menu item. When inline text selection is enabled, the item shows up as "Look Up", and is only added if
we actually discover visual search results.
However, when inline text selection is disabled, this item will always be added to the context menu under the
title "Quick Look", and will be retitled to either "Look Up in Quick Look" or "Select Text in Quick Look" once
either visual search results or text is recognized, respectively.
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
(WebCore::ContextMenuController::populate):
In the case where inline text selection is disabled, add the Quick Look item to the end of the context menu,
after a separator. Note that in the case where inline text selection is enabled, it doesn't actually matter
where we add this item, since it is automatically removed and only reinserted if we find visual search results
for the image.
(WebCore::ContextMenuController::checkOrEnableIfNeeded const):
Rename the existing ContextMenuItemTagLookUpImage to ContextMenuItemTagQuickLookImage, since it is no longer
limited to the visual look up feature.
* page/EventHandler.cpp:
(WebCore::EventHandler::updateMouseEventTargetNode):
Consult the feature flag and avoid kicking off the text recognition timer if inline text selection is disabled.
* platform/ContextMenuItem.cpp:
(WebCore::isValidContextMenuAction):
* platform/ContextMenuItem.h:
* platform/LocalizedStrings.h:
* platform/cocoa/LocalizedStringsCocoa.mm:
(WebCore::contextMenuItemTagQuickLookImage):
(WebCore::contextMenuItemTagQuickLookImageForTextSelection):
(WebCore::contextMenuItemTagQuickLookImageForVisualSearch):
2021-06-22 Devin Rousso <drousso@apple.com>
REGRESSION: [iOS] ASSERTION FAILED: pixelBuffer->data().length() >= 4 under WebCore::sampleColor
https://bugs.webkit.org/show_bug.cgi?id=227256
<rdar://problem/79584286>
Unreviewed, speculative internal test fix.
* page/PageColorSampler.cpp:
(WebCore::sampleColor):
It seems like sometimes the `PixelBuffer` can have a `length()` of `0`. Instead of only
having an `ASSERT` that there are enough items, actually early-return.
2021-06-22 Eric Carlson <eric.carlson@apple.com>
[Cocoa] AVPlayer periodic time observer callback should use weakPtr
https://bugs.webkit.org/show_bug.cgi?id=227264
rdar://79269047
Reviewed by Jer Noble.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
2021-06-22 Alan Bujtas <zalan@apple.com>
[RenderTreeBuilder] ASSERTION FAILED: m_renderer in FloatingObject::renderer()
https://bugs.webkit.org/show_bug.cgi?id=227260
<rdar://77329323>
Reviewed by Antti Koivisto.
This is a very similar to webkit.org/b/224996, where moving subtrees around fails to invalidate floating object sets in sibling blocks.
(see the Changelog entry for more details on how sibling invalidation works).
In this case the anonymous parent block is destroyed as it is no longer needed (and we move all its descendants out first). However this
block has an intruding float and this float is also registered in the sibling blocks.
Test: fast/block/float-assert-when-anon-parent-is-destroyed.html
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::moveChildren):
(WebCore::RenderTreeBuilder::removeFloatingObjects):
* rendering/updating/RenderTreeBuilder.h:
* rendering/updating/RenderTreeBuilderBlock.cpp:
(WebCore::RenderTreeBuilder::Block::removeLeftoverAnonymousBlock):
2021-06-22 Jer Noble <jer.noble@apple.com>
Unreviewed tvOS build fix after r279119: add PLATFORM(IOS) guards to exclude tvOS and Catalyst builds.
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::setEligibleForSmartRouting):
2021-06-22 Simon Fraser <simon.fraser@apple.com>
REGRESSION (Safari 14): Submenus on https://codelearn.cat don't show
https://bugs.webkit.org/show_bug.cgi?id=225467
<rdar://problem/77612276>
Reviewed by Alan Bujtas.
RenderBox::requiresLayerWithScrollableArea() is called via RenderLayer::styleChanged()
which is before layout, yet requiresLayerWithScrollableArea() was consulting layout-dependent
state under hasHorizontalOverflow() || hasVerticalOverflow(). This resulted in composited
scrolling layers sticking around after overflow style changed from `scroll` to `visible`.
Fix by just removing the "has overflow" checks; we make RenderLayerScrollableArea
for any non-visible overflow anyway. scrollsOverflow() checks hasOverflowClip(),
so all we need is a hasOverflowClip() check.
Remove some redundant comments and add a FIXME about layers which get RenderLayerScrollableAreas
but don't need them.
Test: compositing/overflow/overflow-scroll-to-visible.html
* rendering/RenderBox.cpp:
(WebCore::RenderBox::requiresLayerWithScrollableArea const):
2021-06-22 Chris Dumez <cdumez@apple.com>
CSSStyleDeclaration.getPropertyPriority() should return the empty string for invalid CSS properties
https://bugs.webkit.org/show_bug.cgi?id=227257
Reviewed by Geoffrey Garen.
CSSStyleDeclaration.getPropertyPriority() should return the empty string for invalid CSS properties,
not null. Corresponding specification:
- https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertyvalue
Gecko and Blink match the specification here so changing our behavior improves compatibility.
Also use CSSOMString instead of DOMString in the CSSStyleDeclaration IDL to match the specification,
since I was modifying the IDL.
Test: fast/css/CSSStyleDeclaration-getPropertyPriority-invalid-property.html
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyPriority):
* css/CSSStyleDeclaration.idl:
* css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::PropertySetCSSStyleDeclaration::getPropertyPriority):
2021-06-22 Jean-Yves Avenard <jya@apple.com>
Remove unused method in AudioFileReader
https://bugs.webkit.org/show_bug.cgi?id=227208
Reviewed by Chris Dumez.
Remove two unused methods in AudioFileReader and their related constructors.
* platform/audio/AudioFileReader.h:
* platform/audio/cocoa/AudioFileReaderCocoa.cpp:
* platform/audio/cocoa/AudioFileReaderCocoa.h:
* platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
(WebCore::AudioFileReader::decodeAudioForBusCreation):
2021-06-22 Jer Noble <jer.noble@apple.com>
[Cocoa] iOS device steals BT headphones from other devices during silent playback
https://bugs.webkit.org/show_bug.cgi?id=227227
<rdar://78792479>
Reviewed by Eric Carlson.
Explicitly disable smart routing when WebKit itself does not explicitly activate its AVAudioSession.
The audio session will be implicitly activated even for audio-less or silent media playback, and
this will prevent headsets from being "stolen" when that session is implicitly activated.
* platform/audio/ios/AudioSessionIOS.h:
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::setEligibleForSmartRouting):
(WebCore::AudioSessionIOS::AudioSessionIOS):
(WebCore::AudioSessionIOS::tryToSetActiveInternal):
2021-06-22 Rob Buis <rbuis@igalia.com>
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-21 Yusuke Suzuki <ysuzuki@apple.com>
Shrink sizeof(RegisteredEventListener)
https://bugs.webkit.org/show_bug.cgi?id=227230
Reviewed by Geoffrey Garen.
This patch changes the ordering of members of RegisteredEventListener to make it small from 24 to 16.
* dom/RegisteredEventListener.h:
(WebCore::RegisteredEventListener::RegisteredEventListener):
(): Deleted.
2021-06-22 Frédéric Wang <fwang@igalia.com>
Nullptr crash in null ptr deref in ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline
https://bugs.webkit.org/show_bug.cgi?id=226799
Reviewed by Ryosuke Niwa.
Various places in ReplaceSelectionCommand::doApply() may execute mutation events and lead
to nodes being removed. This patch adds one more early return after the call to
makeInsertedContentRoundTrippableWithHTMLTreeBuilder() to ensure that the function
removeRedundantStylesAndKeepStyleSpanInline() is properly executed.
Test: fast/editing/paste-and-indent-microtask-crash.html
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::doApply):
2021-06-22 Cathie Chen <cathiechen@igalia.com>
Implement width and height attributes on source elements of <picture>
https://bugs.webkit.org/show_bug.cgi?id=222368
Reviewed by Darin Adler.
According to [1], the source element supports dimension attributes. The img element can use the width
and height attributes of the source element to determine its rendered dimensions and aspect-ratio.
In order to implement this, add m_sourceElement to HTMLImageElement to indicate the source element that
is selected. Also add invalidateAttributeMapping() to synchronize with the changes of source's attributes
to the img element. Then add collectExtraStyleForPresentationalHints() to collect style from source attributes.
[1] https://html.spec.whatwg.org/#the-source-element
* dom/ElementData.h:
* dom/StyledElement.cpp:
(WebCore::StyledElement::rebuildPresentationalHintStyle): collectExtraStyleForPresentationalHints() when rebuild.
* dom/StyledElement.h:
(WebCore::StyledElement::collectExtraStyleForPresentationalHints): Add an interface to collect extra style from other elements.
* html/HTMLElement.cpp:
(WebCore::HTMLElement::applyAspectRatioFromWidthAndHeightAttributesToStyle): Add width and height attributes as input variables.
* html/HTMLElement.h:
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLImageElement::collectExtraStyleForPresentationalHints): If source element has width or height attributes, apply them
to width, height and aspect-ratio of the style.
(WebCore::HTMLImageElement::bestFitSourceFromPictureElement): Keep the source element.
(WebCore::HTMLImageElement::selectImageSource): Reset the source element to null if no candidate is found.
(WebCore::HTMLImageElement::sourceElement const):
(WebCore::HTMLImageElement::setSourceElement):
(WebCore::HTMLImageElement::invalidateAttributeMapping): Invalidate the presentationalHintStyle.
* html/HTMLImageElement.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::collectPresentationalHintsForAttribute):
* html/HTMLPictureElement.cpp:
(WebCore::HTMLPictureElement::sourceDimensionAttributesChanged): Call invalidateAttributeMapping if source element's attributes are changed.
* html/HTMLPictureElement.h:
* html/HTMLSourceElement.cpp:
(WebCore::HTMLSourceElement::attributeChanged): Call sourceDimensionAttributesChanged if width or height attributes are changed.
* html/HTMLSourceElement.h:
* html/HTMLSourceElement.idl:
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::collectPresentationalHintsForAttribute):
2021-06-21 Jean-Yves Avenard <jya@apple.com>
Safari 15 breaks all Web Audio content using WebM Opus
https://bugs.webkit.org/show_bug.cgi?id=226922
rdar://79218243
Reviewed by Eric Carlson.
Temporarily reports that neither Opus and Vorbis audio codec are supported to allow
webaudio sites to fallback to other containers. The content will continue to play
as before. Will be reverted once bug 227110 lands.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::canPlayType const):
2021-06-21 Jean-Yves Avenard <jya@apple.com>
Merge AudioFileReaderMac and AudioFileReaderIOS into AudioFileReaderCocoa
https://bugs.webkit.org/show_bug.cgi?id=227205
<rdar://problem/79549527>
Reviewed by Chris Dumez.
Merge AudioFileReaderIOS and AudioFileReaderMac into AudioFileReaderCocoa.
No change in functionality.
* PlatformMac.cmake:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/audio/cocoa/AudioFileReaderCocoa.cpp:
(WebCore::tryCreateAudioBufferList): make method static as it's not used elsewhere.
(WebCore::destroyAudioBufferList): make method static as it's not used elsewhere.
(WebCore::validateAudioBufferList): make method static as it's not used elsewhere.
(WebCore::AudioFileReader::AudioFileReader):
(WebCore::AudioFileReader::~AudioFileReader):
(WebCore::AudioFileReader::readProc):
(WebCore::AudioFileReader::getSizeProc):
(WebCore::AudioFileReader::createBus):
(WebCore::createBusFromAudioFile):
(WebCore::createBusFromInMemoryAudioFile):
* platform/audio/cocoa/AudioFileReaderCocoa.h:
(WebCore::AudioFileReader::data const):
(WebCore::AudioFileReader::dataSize const):
* platform/audio/ios/AudioFileReaderIOS.cpp: Removed.
* platform/audio/ios/AudioFileReaderIOS.h: Removed.
* platform/audio/mac/AudioFileReaderMac.cpp: Removed.
* platform/audio/mac/AudioFileReaderMac.h: Removed.
2021-06-21 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] [WebKitLegacy] Non-actionable "Look Up" action appears when right clicking images
https://bugs.webkit.org/show_bug.cgi?id=227240
Reviewed by Devin Rousso.
The "Look Up" action currently appears in legacy WebKit, despite visual search not being supported in WebKit1.
Add and consult a context menu client hook to avoid inserting this item when its functionality is unsupported.
Test: fast/events/contextmenu-lookup-action-for-image.html
* loader/EmptyClients.cpp:
* page/ContextMenuClient.h:
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::populate):
2021-06-21 Aditya Keerthi <akeerthi@apple.com>
[iOS] Update textfield border color to match specification
https://bugs.webkit.org/show_bug.cgi?id=227135
<rdar://problem/79456679>
Reviewed by Maciej Stachowiak.
* css/html.css:
(input, textarea):
Use the system opaque separator color for textfield borders, as it has
better visibility compared to the system fill color.
* rendering/RenderThemeIOS.mm:
(WebCore::cssValueSystemColorInformationList):
Define CSSValueAppleSystemOpaqueSeparator using separatorColor composited
on top of a solid color, rather than using opaqueSeparatorColor, since
the latter currently lacks an Increase Contrast variant. Note that the
colors are equivalent with regular contrast.
2021-06-21 Don Olmstead <don.olmstead@sony.com>
Non-unified build fixes late June 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=227241
Unreviewed non-unified build fixes.
* css/CSSCrossfadeValue.h:
* css/CSSCursorImageValue.cpp:
* css/CSSImageValue.cpp:
* css/parser/CSSParserFastPaths.h:
* css/parser/CSSPropertyParserWorkerSafe.cpp:
2021-06-21 Chris Dumez <cdumez@apple.com>
Use double instead of float where appropriate in HTML Canvas IDL
https://bugs.webkit.org/show_bug.cgi?id=227238
Reviewed by Sam Weinig.
There are a lot of places in our HTML Canvas IDL where we're using float type, even though
the specification is using double. This patch fixes those.
* html/canvas/CanvasCompositing.idl:
* html/canvas/CanvasDrawImage.idl:
* html/canvas/CanvasDrawPath.idl:
* html/canvas/CanvasGradient.cpp:
(WebCore::CanvasGradient::addColorStop):
* html/canvas/CanvasGradient.h:
* html/canvas/CanvasGradient.idl:
* html/canvas/CanvasPathDrawingStyles.idl:
* html/canvas/CanvasRect.idl:
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::fillText):
(WebCore::CanvasRenderingContext2D::strokeText):
(WebCore::CanvasRenderingContext2D::drawTextInternal):
* html/canvas/CanvasRenderingContext2D.h:
* html/canvas/CanvasRenderingContext2D.idl:
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::setLineWidth):
(WebCore::CanvasRenderingContext2DBase::setMiterLimit):
(WebCore::lineDashSequenceIsValid):
(WebCore::CanvasRenderingContext2DBase::setLineDash):
(WebCore::CanvasRenderingContext2DBase::setWebkitLineDash):
(WebCore::CanvasRenderingContext2DBase::setLineDashOffset):
(WebCore::CanvasRenderingContext2DBase::setGlobalAlpha):
(WebCore::CanvasRenderingContext2DBase::scale):
(WebCore::CanvasRenderingContext2DBase::rotate):
(WebCore::CanvasRenderingContext2DBase::translate):
(WebCore::CanvasRenderingContext2DBase::transform):
(WebCore::CanvasRenderingContext2DBase::setTransform):
(WebCore::validateRectForCanvas):
(WebCore::CanvasRenderingContext2DBase::isPointInPath):
(WebCore::CanvasRenderingContext2DBase::isPointInStroke):
(WebCore::CanvasRenderingContext2DBase::isPointInPathInternal):
(WebCore::CanvasRenderingContext2DBase::isPointInStrokeInternal):
(WebCore::CanvasRenderingContext2DBase::clearRect):
(WebCore::CanvasRenderingContext2DBase::fillRect):
(WebCore::CanvasRenderingContext2DBase::strokeRect):
(WebCore::CanvasRenderingContext2DBase::canDrawText):
(WebCore::CanvasRenderingContext2DBase::drawText):
(WebCore::CanvasRenderingContext2DBase::drawTextUnchecked):
* html/canvas/CanvasRenderingContext2DBase.h:
(WebCore::CanvasRenderingContext2DBase::lineWidth const):
(WebCore::CanvasRenderingContext2DBase::miterLimit const):
(WebCore::CanvasRenderingContext2DBase::getLineDash const):
(WebCore::CanvasRenderingContext2DBase::webkitLineDash const):
(WebCore::CanvasRenderingContext2DBase::lineDashOffset const):
(WebCore::CanvasRenderingContext2DBase::globalAlpha const):
* html/canvas/CanvasShadowStyles.idl:
* html/canvas/CanvasText.idl:
* html/canvas/CanvasTransform.idl:
* html/canvas/OffscreenCanvasRenderingContext2D.cpp:
(WebCore::OffscreenCanvasRenderingContext2D::fillText):
(WebCore::OffscreenCanvasRenderingContext2D::strokeText):
* html/canvas/OffscreenCanvasRenderingContext2D.h:
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::processArgument):
* inspector/InspectorCanvasCallTracer.h:
2021-06-21 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo] Turn ENABLE_SHAREABLE_RESOURCE on
https://bugs.webkit.org/show_bug.cgi?id=227011
Reviewed by Don Olmstead.
* loader/cache/CachedResource.cpp:
* loader/cache/CachedResource.h:
2021-06-21 Chris Dumez <cdumez@apple.com>
Too much CPU time is spent under MemoryPressureHandler::currentMemoryUsagePolicy()
https://bugs.webkit.org/show_bug.cgi?id=227001
Reviewed by Simon Fraser.
Make it so that RenderLayerCompositor::updateCompositingPolicy() queries MemoryPressureHandler::currentMemoryUsagePolicy()
at most once every 2 seconds given that the call is expensive. It can currently get called several times a second and
shows on CPU profiles.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateCompositingPolicy):
2021-06-21 Megan Gardner <megan_gardner@apple.com>
AppHighlights disappear on page reload
https://bugs.webkit.org/show_bug.cgi?id=227141
rdar://78190331
Reviewed by Devin Rousso.
Preserve the state of highlight visibility so that is correct on page-reload.
* dom/Document.cpp:
(WebCore::Document::appHighlightRegister):
* page/ChromeClient.h:
(WebCore::ChromeClient::appHighlightsVisiblility const):
2021-06-21 Rob Buis <rbuis@igalia.com>
CSSOM test for serializing font-variant fails
https://bugs.webkit.org/show_bug.cgi?id=226770
Reviewed by Darin Adler.
Implement font-variant serializing according to:
https://drafts.csswg.org/cssom/#serializing-css-values
* css/StyleProperties.cpp:
(WebCore::StyleProperties::getPropertyValue const):
(WebCore::StyleProperties::appendFontLonghandValueIfExplicit const):
(WebCore::StyleProperties::fontVariantValue const):
* css/StyleProperties.h:
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFontVariantEastAsian):
(WebCore::CSSPropertyParser::consumeFontVariantShorthand):
2021-06-21 Alan Bujtas <zalan@apple.com>
Remove redundant HitTestLocation(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
https://bugs.webkit.org/show_bug.cgi?id=227186
Reviewed by Sam Weinig.
Let's use the LayoutRect based c'tor at the only callsite (Internals).
* page/EventHandler.cpp:
(WebCore::EventHandler::hitTestResultAtPoint const):
* page/EventHandler.h:
* rendering/HitTestLocation.cpp:
(WebCore::HitTestLocation::HitTestLocation):
(WebCore::rectForPoint): Deleted.
(WebCore::m_isRectBased): Deleted.
* rendering/HitTestLocation.h:
* rendering/HitTestResult.cpp:
* rendering/HitTestResult.h:
* testing/Internals.cpp:
(WebCore::Internals::nodesFromRect const):
2021-06-20 Alan Bujtas <zalan@apple.com>
HitTestLocation::m_boundingBox should be able hold subpixel values
https://bugs.webkit.org/show_bug.cgi?id=227185
Reviewed by Sam Weinig.
This is in preparation for supporting non-integral area hi-testing (e.g. on 2x displays).
No functionality change yet.
* rendering/HitTestLocation.cpp:
(WebCore::rectForPoint):
* rendering/HitTestLocation.h:
(WebCore::HitTestLocation::boundingBox const):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::hitTestCulledInline):
2021-06-20 Wenson Hsieh <wenson_hsieh@apple.com>
[Live Text] Mouse events should only trigger text recognition if the cursor is moving
https://bugs.webkit.org/show_bug.cgi?id=227181
rdar://79469827
Reviewed by Tim Horton.
Make a slight adjustment to how we trigger the text recognition timer when hovering over images; instead of
allowing any non-synthetic mouse event to kick off the timer, limit it to only mouse events with horizontal or
vertical movement deltas.
To implement this, we remove some `ENABLE(POINTER_LOCK)` guards around PlatformMouseEvent's movement delta, and
check whether the movement delta is nonzero in EventHandler when determining whether to start the text
recognition timer.
* page/EventHandler.cpp:
(WebCore::EventHandler::updateMouseEventTargetNode):
Check for a nonzero movement delta in place of the synthetic click type; since all synthetic mouse events are
created with no horizontal or vertical delta, since new movement delta check obviates the need for checking the
synthetic click type.
Additionally, we invert the conditional here so that if any mouse events are detected over content that is not
an image, we'll immediately stop the timer; however, if the mouse event is over an image, we'll only kick off
the timer if the movement delta is additionally nonzero.
* platform/PlatformMouseEvent.h:
(WebCore::PlatformMouseEvent::globalPosition const):
(WebCore::PlatformMouseEvent::movementDelta const):
* platform/mac/PlatformEventFactoryMac.mm:
(WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
2021-06-20 Alan Bujtas <zalan@apple.com>
Move rectForPoint() static function out from the HitTestLocation class
https://bugs.webkit.org/show_bug.cgi?id=227182
Reviewed by Sam Weinig.
This function implicitly enlarges the hit test area which may trigger unexpected behavior.
It's better to not have it on the class's public interface.
* rendering/HitTestLocation.cpp:
(WebCore::rectForPoint):
(WebCore::HitTestLocation::rectForPoint): Deleted.
* rendering/HitTestLocation.h:
* rendering/LegacyEllipsisBox.cpp:
(WebCore::LegacyEllipsisBox::nodeAtPoint): While this may be a functionality change where we
replace the previously set area padding with 0 (actually 1px), I don't think that's what this is about.
* testing/Internals.cpp:
(WebCore::Internals::nodesFromRect const):
2021-06-20 Alan Bujtas <zalan@apple.com>
Remove HitTestLocation(FloatPoint) c'tor
https://bugs.webkit.org/show_bug.cgi?id=227179
Reviewed by Sam Weinig.
FloatPoint are used to store pixed snapped coordinate values in the rendering code.
This is in preparation for supporting non-integral HitTestLocation intersect.
* rendering/HitTestLocation.cpp:
* rendering/HitTestLocation.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hitTestLayerByApplyingTransform):
* rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::nodeAtFloatPoint):
* rendering/svg/RenderSVGForeignObject.cpp:
(WebCore::RenderSVGForeignObject::nodeAtFloatPoint):
* rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::nodeAtFloatPoint):
* rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::nodeAtFloatPoint):
2021-06-20 Darin Adler <darin@apple.com>
CSS counter style improvements for Armenian, Tamil, and some CJK styles
https://bugs.webkit.org/show_bug.cgi?id=227190
Reviewed by Sam Weinig.
* css/CSSPrimitiveValueMappings.h: Added CJKDecimal and Tamil.
Also updated for name changes of Cjk to CJK.
* css/CSSValueKeywords.in: Added cjk-decimal and tamil.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::isPredefinedCounterStyle):
Updated since the last predefined counter style is now Tamil.
* rendering/RenderListMarker.cpp: Tweak coding style a bit, using
constexpr and auto and removing some unneeded explicit type names.
(WebCore::effectiveListMarkerType): Added Tamil. Corrected range
for Armenian, LowerArmenian, and UpperArmenian to be 1-9999.
Added CJKDecimal. Updated for name changes of Cjk to CJK.
(WebCore::listMarkerSuffix): Addded Tamil. Corrected suffix for
multiple types to be ideographic comma instead of period.
(WebCore::suffixRequiresSpace): Added. Used so we don't add a space
after all suffixes.
(WebCore::listMarkerText): Added CJKDecimal and Tamil.
(WebCore::RenderListMarker::paint): Removed all the cases for the
many list style types that just paint as text, using default instead.
Call suffixRequiresSpace and don't add a space if not needed.
(WebCore::RenderListMarker::updateContent): Removed all the cases for
the many list style types that are text based, using default instead.
(WebCore::RenderListMarker::computePreferredLogicalWidths): Removed
all the cases for the many list style types that are text based, using
default instead. Call suffixRequiresSpace and don't include the space
if not needed.
(WebCore::RenderListMarker::suffix const): Call suffixRequiresSpace
and don't include a space if not needed.
(WebCore::RenderListMarker::getRelativeMarkerRect): Removed all the
cases for the many list style types that are text based, using default
instead. Call suffixRequiresSpace and don't include the space if not
needed.
* rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<): Added CJKDecimal and Tamil. Also sorted the
list styles alphabetically.
* rendering/style/RenderStyleConstants.h: Added CJKDecimal and
Tamil and use CJK instead of Cjk in names of the other styles.
2021-06-20 Yusuke Suzuki <ysuzuki@apple.com>
Skip shadow-root creation for input element if it is not necessary
https://bugs.webkit.org/show_bug.cgi?id=227189
Reviewed by Maciej Stachowiak.
Test: fast/forms/checkbox-child-hidden.html
Cherry-pick Chromium optimizations[1,2] for input element and extend the coverage for more types.
Some of input element (e.g. checkbox) do not need to create a shadow-root since they do not have shadow-subtree.
This patch optimizes input element creation by skipping creation of shadow-root for these input types.
Since HTMLTextFormControlElement::childShouldCreateRenderer creates renderer only for children under shadow-root,
we do not need to consider about the case appending an element to checkbox etc. They will not get renderers.
We also replace HTMLInputElement related class' override with final if they are final to make class-hierarchy more explicit
and not to miss the change that needs to be done in the derived classes.
On M1 MBP, this patch improves Speedometer2 by 0.8%.
[1]: https://chromium-review.googlesource.com/c/chromium/src/+/773180
[2]: https://chromium-review.googlesource.com/c/chromium/src/+/826426 (but this is not necessary in WebKit since HTMLTextFormControlElement::childShouldCreateRenderer does the right thing elegantly)
* dom/Element.cpp:
(WebCore::Element::ensureUserAgentShadowRoot):
(WebCore::Element::createUserAgentShadowRoot):
* dom/Element.h:
* html/BaseDateAndTimeInputType.cpp:
(WebCore::BaseDateAndTimeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
* html/BaseDateAndTimeInputType.h:
(WebCore::BaseDateAndTimeInputType::BaseDateAndTimeInputType):
* html/ColorInputType.cpp:
(WebCore::ColorInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
* html/ColorInputType.h:
* html/FileInputType.cpp:
(WebCore::FileInputType::FileInputType):
(WebCore::FileInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::create):
(WebCore::HTMLInputElement::createShadowSubtreeAndUpdateInnerTextElementEditability):
(WebCore::HTMLInputElement::updateType): It is possible that shadow root is already created for the previous InputType.
So we should use ensureUserAgentShadowRoot.
(WebCore::HTMLInputElement::initializeInputType): Since this is called at initialization time, we can use createUserAgentShadowRoot
instead of ensureUserAgentShadowRoot.
(WebCore::HTMLInputElement::didAddUserAgentShadowRoot): Deleted. Clean up the logic instead of relying on this callback.
Since HTMLInputElement can replace InputType, while we need to create shadow-subtree when InputType is replaced,
this callback could not be called since shadow-root is already created for the previous InputType. Not relying on this
callback makes the logic much simpler: explicitly create shadow-root and shadow-subtree.
* html/HTMLInputElement.h:
* html/InputType.h:
(WebCore::InputType::needsShadowSubtree const): Since this is in the critical path, we need this super optimized implementation.
Button, checkbox, hidden, image, radio, reset, and submit do not require shadow root.
* html/RangeInputType.cpp:
(WebCore::RangeInputType::RangeInputType):
(WebCore::RangeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
* html/SearchInputType.cpp:
(WebCore::SearchInputType::SearchInputType):
(WebCore::SearchInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::TextFieldInputType):
(WebCore::TextFieldInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
2021-06-19 Darin Adler <darin@apple.com>
Fix CSS serialization issues affecting css-counter-styles tests
https://bugs.webkit.org/show_bug.cgi?id=226708
Reviewed by Antti Koivisto.
Fix two serialization isssues affecting css-counter-styles tests:
1) URLs were serializing the full resolved URL, rather than the
partial URL string from the style sheet.
2) Items in additive-symbols that had both an integer and a string
would incorrectly serialize with a comma within the item.
* css/CSSCrossfadeValue.cpp:
(WebCore::CSSCrossfadeValue::valueWithStylesResolved): Added.
Calls resolveImageStyles on the image values.
* css/CSSCrossfadeValue.h: Updated for the above.
* css/CSSCursorImageValue.cpp:
(WebCore::CSSCursorImageValue::CSSCursorImageValue): Changed the hot spot
to use std::optional instead of a separate boolean.
(WebCore::CSSCursorImageValue::create): Moved this out of the header
because it's not better for inlining to have it there.
(WebCore::CSSCursorImageValue::customCSSText const): Updated for the
m_hotSpot changes.
(WebCore::CSSCursorImageValue::updateCursorElement): Removed unneeded
check of hasFragmentIdentifier, which is already done by the
SVGURIReference::targetElementFromIRIString function. Updated to use
m_originalSpecifiedURLString, and added a FIXME about the strange way
this just keeps accumulating more and more clients in a set, but did
not change that behavior.
(WebCore::CSSCursorImageValue::cursorElementRemoved): Added a FIXME.
(WebCore::CSSCursorImageValue::cursorElementChanged): Updated for the
change to m_hotSpot and addded some FIXME.
(WebCore::CSSCursorImageValue::equals const): Updated for the m_hotSpot
change; much simpler since std::optional does the right thing.
(WebCore::CSSCursorImageValue::valueWithStylesResolved): Added.
Calls resolveImageStyles on the image value.
* css/CSSCursorImageValue.h: Updated for the above changes.
* css/CSSFilterImageValue.cpp:
(WebCore::CSSFilterImageValue::valueWithStylesResolved): Added.
Calls resolveImageStyles on the image value and also calls
createFilterOperations.
* css/CSSFilterImageValue.h: Updated for the above.
* css/CSSGradientValue.cpp:
(WebCore::CSSGradientValue::valueWithStylesResolved): Renamed from
gradientWithStylesResolved.
* css/CSSGradientValue.h: Updated for the above.
* css/CSSImageSetValue.cpp:
(WebCore::CSSImageSetValue::valueWithStylesResolved): Renamed from
imageSetWithStylesResolved. Optimized the case where the resolved
version is not different to re-use the original CSSImageSetValue.
* css/CSSImageSetValue.h: Updated for the above.
* css/CSSImageValue.cpp:
(WebCore::operator==): Added. Check if two ResolvedURL are equal.
(WebCore::makeResolvedURL): Added. Make a ResolvedURL from an
existing URL without the original specified string.
(WebCore::CSSImageValue::CSSImageValue): Take ResolvedURL instead
of a URL. Also updated to use std::optional instead of a separate
m_accessedImage boolean.
(WebCore::CSSImageValue::create): Added an overload that takes
ResolvedURL argument and also moved here from the header since we
don't get any benefit from inlining.
(WebCore::CSSImageValue::isPending const): Updates since m_cachedImage
is now a std::optional, and the std::nullopt case is used for this.
(WebCore::CSSImageValue::reresolvedURL const): Added. Used so we can
share code between the following functions.
(WebCore::CSSImageValue::valueWithStylesResolved): Added. Computes
the fully resolved URL and makes a new image value if needed that
always uses it. Also points the new value at the old one so we can
update m_cachedImage in both.
(WebCore::CSSImageValue::loadImage): Use the new reresolvedURL function.
Also update m_cachedImage in any underlying objects.
(WebCore::CSSImageValue::traverseSubresources): Updated for change
to m_cachedImage.
(WebCore::CSSImageValue::equals const): Updated for change to use
ResolvedURL.
(WebCore::CSSImageValue::customCSSText const): Ditto. This is the
only place where we use specifiedURLString.
(WebCore::CSSImageValue::createDeprecatedCSSOMWrapper const): Updated
for change from m_url.
(WebCore::CSSImageValue::knownToBeOpaque const): Updated for change
to m_cachedImage.
* css/CSSImageValue.h: Added ResolvedURL, new create
overloads. Replaced url() function with location() function, which
returns a string. Note that this always returns the resolved string,
only customCSSText returns the original string. Replaced m_url with
m_location, eliminated m_accessedImage and made m_cachedImage use
std::optional instead. Added m_unresolvedValue.
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::completeURL const): Deleted unused function.
* css/StyleSheetContents.h: Ditto.
* css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::completeURL const): Updated to return
ResolvedURL instead of a URL.
* css/parser/CSSParserContext.h: Ditto.
* css/parser/CSSParserIdioms.cpp:
(WebCore::completeURL): Deleted unused function.
* css/parser/CSSParserIdioms.h: Ditto.
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeCursor): Use std::optional for the hot spot.
(WebCore::consumeCounterStyleAdditiveSymbols): Put the integer/symbol
pair into a separate space-separated list instead of appending both
to the top level command-separated list. Also removed support for
non-standard "image without symbol" and "symbol without image".
Neither the specification nor the web platform tests currently call
for that.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeImage): Call the new
overload of CSSImageValue::create, passing a ResolvedURL.
* css/parser/CSSPropertyParserWorkerSafe.cpp:
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcURI):
Update for the change to completeURL and refactor a bit. Later we could
make the same kind of fix for CSSFontFaceSrcValue that we did in this
patch for CSSImageValue, but did not try that for now.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::addCursor): Updated to take a std::optional for
the hot spot.
* rendering/style/RenderStyle.h: Ditto.
* rendering/style/StyleCachedImage.cpp:
(WebCore::StyleCachedImage::imageURL): Updated for CSSImageValue::imageURL.
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueContent): Call
resolveImageStyles consistently.
* style/StyleBuilderState.cpp:
(WebCore::Style::BuilderState::resolveImageStyles): Call the new
valueWithStylesResolved function on all the different image value
types. This unifies the approach across all 6 classes.
(WebCore::Style::BuilderState::createStyleImage): Tweaked style.
2021-06-18 Chris Dumez <cdumez@apple.com>
[WebIDL] Assigning a value outside the float range to a 'float' attribute should throw a TypeError
https://bugs.webkit.org/show_bug.cgi?id=227146
Reviewed by Sam Weinig.
Assigning a value outside the float range to a 'float' attribute should throw a TypeError, as per:
- https://heycam.github.io/webidl/#es-float
Blink follows the specification but WebKit was just casting the double to a float. This patch
addresses this issue.
This patch also makes sure that values outside the float range properly get resolved to -Infinity
or Infinity if the attribute is of type 'unrestricted float', as per:
- https://heycam.github.io/webidl/#es-unrestricted-float
No new tests, updated existing tests.
* bindings/js/JSDOMConvertNumbers.h:
(WebCore::Converter<IDLFloat>::convert):
(WebCore::Converter<IDLUnrestrictedFloat>::convert):
* testing/TypeConversions.h:
(WebCore::TypeConversions::testFloat const):
(WebCore::TypeConversions::setTestFloat):
(WebCore::TypeConversions::testUnrestrictedFloat const):
(WebCore::TypeConversions::setTestUnrestrictedFloat):
* testing/TypeConversions.idl:
2021-06-18 Soujyu TANAKA <soujyu.tanaka@access-company.com>
[Curl] Add curl option CURLOPT_NOSIGNAL to omit numerous sigaction calls
https://bugs.webkit.org/show_bug.cgi?id=227118
Reviewed by Fujii Hironori.
As we increase file handles registered by curl_multi_add_handle(),
number of times of sigaction executions in Curl grows rapidly. That can
cause unignorable download speed drop.
With a curl option CURLOPT_NOSIGNAL enabled, Curl doesn't use the
syscall to ignore SIGPIPE signals. It's safe as long as we configure to
prevent SIGPIPE from being triggered.
No new tests.
* platform/network/curl/CurlContext.cpp:
(WebCore::CurlHandle::CurlHandle):
2021-06-18 Oriol Brufau <obrufau@igalia.com>
[css-logical] Fix cssom "set a CSS declaration" for logical properties
https://bugs.webkit.org/show_bug.cgi?id=226461
Reviewed by Antti Koivisto.
Test: imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-setter-logical.html
Before this patch, setting a value to a property already in the list of
declarations, would just update its value, without reordering.
The problem was that the order is important when there is a mix of
logical and physical properties:
el.style.paddingTop = "1px";
el.style.paddingBlockStart = "2px";
el.style.cssText; // "padding-top: 1px; padding-block-start: 2px"
el.style.paddingTop = "3px";
el.style.cssText; // "padding-top: 3px; padding-block-start: 2px"
getComputedStyle(el).paddingTop; // "2px" -- no effect!
Therefore, this patch implements this part of the spec:
> If there are CSS declarations in declarations whose property name is
> in the same logical property group as property, but has a different
> mapping logic, target declaration must be at an index after all of
> those CSS declarations.
This change is based on this Chromium CL:
https://chromium-review.googlesource.com/c/chromium/src/+/2575081/
* css/CSSProperty.h:
* css/StyleProperties.cpp:
(WebCore::MutableStyleProperties::canUpdateInPlace const):
(WebCore::MutableStyleProperties::setProperty):
* css/StyleProperties.h:
* css/makeprop.pl:
2021-06-18 Peng Liu <peng.liu6@apple.com>
[iOS] Fullscreen video playback gets stuck after interacting with the playback controls
https://bugs.webkit.org/show_bug.cgi?id=227047
Reviewed by Eric Carlson.
When we scrub a playing video, the video element may enter a temporarily stalled
state - the player is still playing, but it does not have enough data. In WebKit,
the `rate` of the player will be 0. But we cannot set the rate of `WebAVPlayerController`
to 0 in this case, because AVKit will believe the video playback is paused when
its rate is 0. In r261587, we defined a magic rate (0.00000001f) for this case.
Unfortunately, with the changes in r275956, `WebAVPlayerController` will
align its `defaultPlaybackRate` with `rate` when `rate` is not 0. Under stress
tests, e.g., keep scrubbing a video, a video element will eventually enter a state
in which both `defaultPlaybackRate` and `rate` are the magic rate. And the video
appears to be stuck for users.
To fix the issue, this patch removes the magic rate and defines a new state: `stalled`.
A video will be in the stalled state when it is playing but does not have enough data.
WebKit will only change the rate of `WebAVPlayerController` when the video
is not stalled.
To avoid potential problems due to the conversions between "float" and "double"
back and forth, this patch updates the types of `playbackRate` and `defaultPlaybackRate`.
* platform/cocoa/PlaybackSessionModel.h:
(WebCore::PlaybackSessionModelClient::rateChanged):
* platform/cocoa/PlaybackSessionModelMediaElement.h:
* platform/cocoa/PlaybackSessionModelMediaElement.mm:
(WebCore::PlaybackSessionModelMediaElement::updateForEventName):
(WebCore::PlaybackSessionModelMediaElement::setDefaultPlaybackRate):
(WebCore::PlaybackSessionModelMediaElement::setPlaybackRate):
(WebCore::PlaybackSessionModelMediaElement::defaultPlaybackRate const):
(WebCore::PlaybackSessionModelMediaElement::playbackRate const):
* platform/ios/PlaybackSessionInterfaceAVKit.h:
* platform/ios/PlaybackSessionInterfaceAVKit.mm:
(WebCore::PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit):
(WebCore::PlaybackSessionInterfaceAVKit::rateChanged):
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(VideoFullscreenControllerContext::rateChanged):
(VideoFullscreenControllerContext::setDefaultPlaybackRate):
(VideoFullscreenControllerContext::setPlaybackRate):
(VideoFullscreenControllerContext::isStalled const):
(VideoFullscreenControllerContext::defaultPlaybackRate const):
(VideoFullscreenControllerContext::playbackRate const):
* platform/mac/PlaybackSessionInterfaceMac.h:
* platform/mac/PlaybackSessionInterfaceMac.mm:
(WebCore::PlaybackSessionInterfaceMac::rateChanged):
* platform/mac/VideoFullscreenInterfaceMac.h:
* platform/mac/VideoFullscreenInterfaceMac.mm:
(WebCore::VideoFullscreenInterfaceMac::rateChanged):
2021-06-18 Philippe Normand <pnormand@igalia.com>
[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-06-18 Carlos Alberto Lopez Perez <clopez@igalia.com>
[LFC][WPE] Build failure with GCC 8.x
https://bugs.webkit.org/show_bug.cgi?id=227166
Reviewed by Alan Bujtas.
The build fails with the error: converting to 'std::in_place_t' from initializer list
would use explicit constructor 'constexpr std::in_place_t::in_place_t()'
No new tests, is a build fix.
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::prepareLayoutState):
2021-06-18 Philippe Normand <pnormand@igalia.com>
[GStreamer] imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-MediaElement-srcObject.https.html is failing since r273645
https://bugs.webkit.org/show_bug.cgi?id=223508
Reviewed by Xabier Rodriguez-Calvar.
Per spec, prevent seeks, playback rate changes and preload state updates on media elements backed by
the GStreamer MediaStream source element.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::seek):
(WebCore::MediaPlayerPrivateGStreamer::updatePlaybackRate):
(WebCore::MediaPlayerPrivateGStreamer::setPreload):
(WebCore::MediaPlayerPrivateGStreamer::maxMediaTimeSeekable const):
2021-06-18 Philippe Normand <pnormand@igalia.com>
[WebRTC][GStreamer] fast/mediastream/MediaStream-video-element-remove-track.html is failing
https://bugs.webkit.org/show_bug.cgi?id=191886
Reviewed by Xabier Rodriguez-Calvar.
Trigger source pad removal in the mediastream source element when a track has been removed.
* platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
(WebKitMediaStreamObserver::didRemoveTrack):
2021-06-17 Said Abou-Hallawa <said@apple.com>
[Cocoa] Disable hardware decoding in the WebProcess
https://bugs.webkit.org/show_bug.cgi?id=226869
<rdar://77548905>
Reviewed by Per Arne Vollan and Simon Fraser.
Pass kCGImageSourceEnableRestrictedDecoding : kCFBooleanTrue when decoding
an image frame.
Test: fast/images/heic-as-background-image.html
* platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::createImageSourceOptions):
2021-06-17 Chris Dumez <cdumez@apple.com>
Add support for IDBCursor.request
https://bugs.webkit.org/show_bug.cgi?id=227152
Reviewed by Geoffrey Garen.
Add support for IDBCursor.request:
- https://w3c.github.io/IndexedDB/#dom-idbcursor-request
Both Blink and Gecko already support this.
No new tests, rebaselined existing tests.
* Modules/indexeddb/IDBCursor.idl:
2021-06-17 Chris Dumez <cdumez@apple.com>
Enable some more release logging in for ephemeral sessions
https://bugs.webkit.org/show_bug.cgi?id=227142
Reviewed by Eric Carlson.
Enable some more release logging in for ephemeral sessions, to faciliate debugging.
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::SWServer):
2021-06-17 Ryosuke Niwa <rniwa@webkit.org>
Crash in WebCore::SlotAssignment::assignedNodesForSlot
https://bugs.webkit.org/show_bug.cgi?id=224408
<rdar://problem/76805764>
Reviewed by Michael Catanzaro.
Like webkit.org/b/225684, the release assertion failure was caused by RenderTreeUpdater::tearDownRenderers
traversing the slot element for which we're currently calling Element::insertedIntoAncestor but had not yet
called SlotAssignment::addSlotElementByName.
Fixed the bug by returning early in SlotAssignment::assignedNodesForSlot when this condition holds,
which is when the shadow root is connected to a document and HTMLSlotElement is in the middle of
HTMLSlotElement::insertedIntoAncestor.
It's not the most elegant solution but staying safe for now.
Test: fast/shadow-dom/insert-slot-child-of-shadow-host-render-tree-invalidation-crash.html
* dom/SlotAssignment.cpp:
(WebCore::SlotAssignment::assignedNodesForSlot):
* html/HTMLSlotElement.cpp:
(WebCore::HTMLSlotElement::insertedIntoAncestor):
* html/HTMLSlotElement.h:
(WebCore::HTMLSlotElement::isInInsertedIntoAncestor): Added.
2021-06-17 Kate Cheney <katherine_cheney@apple.com>
Storage Access quirks should prompt up to twice if a user does not allow storage access
https://bugs.webkit.org/show_bug.cgi?id=227099
<rdar://problem/79409843>
Reviewed by John Wilander.
Remove hasDeniedCrossPageStorageAccess functions. They are not needed
now that we are aligning storage access quirks with non-quirks by
using maxNumberOfTimesExplicitlyDeniedStorageAccess.
* dom/DocumentStorageAccess.cpp:
(WebCore::DocumentStorageAccess::requestStorageAccessQuickCheck):
(WebCore::DocumentStorageAccess::requestStorageAccessForNonDocumentQuirk):
* dom/DocumentStorageAccess.h:
* dom/Element.cpp:
(WebCore::Element::dispatchMouseEvent):
* dom/Element.h:
* loader/ResourceLoadObserver.h:
(WebCore::ResourceLoadObserver::hasHadUserInteraction const):
(WebCore::ResourceLoadObserver::setHasDeniedCrossPageStorageAccess): Deleted.
(WebCore::ResourceLoadObserver::hasDeniedCrossPageStorageAccess const): Deleted.
* page/Quirks.cpp:
(WebCore::isStorageAccessQuirkDomainAndElement):
(WebCore::Quirks::requestStorageAccessAndHandleClick const):
(WebCore::Quirks::triggerOptionalStorageAccessQuirk const):
(WebCore::hasDeniedCrossPageStorageAccess): Deleted.
* page/Quirks.h:
2021-06-17 Aditya Keerthi <akeerthi@apple.com>
REGRESSION (r277067): Incorrect text color for default-button appearance
https://bugs.webkit.org/show_bug.cgi?id=227129
<rdar://problem/79032808>
Reviewed by Tim Horton.
Buttons styled with '-webkit-appearance: default-button' currently rely
on the CSS value 'activebuttontext' for their text color. r277067
updated the color to use system colors, for consistency with the rest
of the platform.
In macOS Monterey, the 'activebuttontext' color and the default button
text color are not equivalent. 'Active' buttons no longer use
NSBackgroundStyleEmphasized, while default buttons still do.
Consequently, default buttons are rendered with an incorrect text color.
To fix, use the correct system color for the text color of default
buttons. To avoid changing the behavior of platforms other than
macOS, the 'activebuttontext' color remains the default text color
specified in RenderTheme.
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::defaultButtonTextColor const):
(WebCore::RenderTheme::platformDefaultButtonTextColor const):
* rendering/RenderTheme.h:
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::platformDefaultButtonTextColor const):
* rendering/TextPaintStyle.cpp:
(WebCore::computeTextPaintStyle):
2021-06-17 Enrique Ocaña González <eocanha@igalia.com>
[GTK] Unexpected timeout in http/tests/media/video-play-stall-seek.html
https://bugs.webkit.org/show_bug.cgi?id=196198
Reviewed by Philippe Normand.
Increased default GstDowloadBuffer size to prevent a race condition. To do that, we need
to set the buffer-size of GstUriDecodebin (that will set the GstMultiQueue size, so we use
the default value that would be used if no changes had been made, and also leaves
GstDownloadBuffer size untouched, which wouldn't happen if no buffer-size had been set)
and then set the desired max-size-bytes on GstDownloadBuffer.
The race condition was that some times the player private readyState went up to
HAVE_ENOUGH_DATA and then back to HAVE_CURRENT_DATA (triggering the expected waiting event),
and some others times went directly to HAVE_CURRENT_DATA (no waiting event, test stalled).
Increasing the buffer size gave more time for the double transition to happen.
Still, these changes weren't enough to get the test passing, as with these changes the
multiqueue sucked all the data, downloadbuffer fell to a low percentage and updateStates()
paused the pipeline for rebuffering. The pipeline won't ever be unpaused because at that
point WebKitWebSrc has reached EOS (no more file to download, a side effect of the current
libsoup behaviour) and the buffering won't ever go up again (and trigger the unpause).
This was solved by setting the downloadbuffer high-percent property to 0 when a seek
is done after EOS has been received by WebKitWebSrc. This effectively forces the
downloadbuffer to report 100% buffered, which unpauses the pipeline and lets the playback
continue after seek.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::doSeek): Set high-percent when seeking after WebKitWebSrc EOS.
(WebCore::MediaPlayerPrivateGStreamer::sourceSetup): Manually set buffer-size to its default value.
(WebCore::MediaPlayerPrivateGStreamer::handleMessage): Receive the custom EOS message from WebKitWebSrc and remember it.
(WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback): Manully set max-size-bytes to a higher than default value.
(WebCore::MediaPlayerPrivateGStreamer::downloadBufferFileCreatedCallback): Don't clean the reference to the downloadbuffer, as it'll be needed later.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Added m_hasWebKitWebSrcSentEOS to remember the EOS condition.
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webKitWebSrcCreate): Notify the EOS condition using the bus, so the player private can handle it.
(CachedResourceStreamingClient::loadFailed): Extra useful logs.
(CachedResourceStreamingClient::loadFinished): Ditto.
2021-06-17 Oriol Brufau <obrufau@igalia.com>
[css-logical] Implement logical property groups
https://bugs.webkit.org/show_bug.cgi?id=226878
Reviewed by Antti Koivisto.
In order to have proper CSSOM support for logical properties, we will
need to determine whether two properties belong to the same logical
property group but with a different mapping logic.
Before this patch, we only knew the physical properties belonging to the
same logical property group as a given logical property. But given a
physical property, we didn't know if there were logical properties that
could map to it.
Therefore this patch changes CSSProperties.json so that both logical and
physical properties specify their logical property group.
The code for resolving a logical property into its physical equivalent
is now automatically generated.
The CSSOM fix will be done in a follow-up (bug 226461).
This patch introduces no behavior changes.
* css/CSSProperties.json:
* css/CSSProperty.cpp:
* css/makeprop.pl:
(nameToId):
(addProperty):
* platform/RectEdges.h:
(WebCore::RectEdges::before):
(WebCore::RectEdges::after):
(WebCore::RectEdges::start):
(WebCore::RectEdges::end):
(WebCore::RectEdges::before const):
(WebCore::RectEdges::after const):
(WebCore::RectEdges::start const):
(WebCore::RectEdges::end const):
* platform/text/WritingMode.h:
(WebCore::mapLogicalAxisToPhysicalAxis):
2021-06-17 Enrique Ocaña González <eocanha@igalia.com>
[GStreamer] Refactor MediaPlayerPrivateGStreamer::notifyPlayerOf*
https://bugs.webkit.org/show_bug.cgi?id=204686
Unreviewed WPE/GTK debug build fix.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfTrack): Removed assert left there from a previous version of the patch.
2021-06-17 Youenn Fablet <youenn@apple.com>
Fix RTCDataChannelInit::decode
https://bugs.webkit.org/show_bug.cgi?id=226968
Reviewed by Eric Carlson.
Test: imported/w3c/web-platform-tests/webrtc-extensions/transfer-datachannel-service-worker.https.html
* platform/mediastream/RTCDataChannelHandler.h:
(WebCore::RTCDataChannelInit::decode):
Make sure to use optionals of optionals.
2021-06-17 Enrique Ocaña González <eocanha@igalia.com>
[GStreamer] Refactor MediaPlayerPrivateGStreamer::notifyPlayerOf*
https://bugs.webkit.org/show_bug.cgi?id=204686
Reviewed by Philippe Normand.
Refactored the notifyPlayerOf{Audio,Video,Text} family of methods into a single notifyPlayerOfTrack() one.
Some Variant variables are needed in order to make several incompatible types work together and to auto-detect the type of track as an enum.
Covered by existing tests.
* platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
(WebCore::InbandTextTrackPrivateGStreamer::create): Added method with a signature similar to the ones used by {Audio,Video}TrackPrivateGStreamer, so that it fits into the notifyPlayerOfTrack() template code.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfTrack): Template method that unifies the old notifyPlayerOf{Audio,Video,Text}() implementations.
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Deleted. Refactored into notifyPlayerOfTrack().
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::audioChangedCallback): Call the new notifyPlayerOfTrack() refactored implementation.
(WebCore::MediaPlayerPrivateGStreamer::textChangedCallback): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::videoChangedCallback): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks): Deleted. Now implemented directly inside notifyPlayerOfTrack().
(WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Deleted notifyPlayerOf{Audio,Video,Text}(), added notifyPlayerOfTrack(), deleted purgeInvalid{Audio,Video,Text}Tracks().
2021-06-17 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r278978.
https://bugs.webkit.org/show_bug.cgi?id=227115
The patch seems to be breaking the Debian and Ubuntu builds.
Reverted changeset:
"[GStreamer] Refactor
MediaPlayerPrivateGStreamer::notifyPlayerOf*"
https://bugs.webkit.org/show_bug.cgi?id=204686
https://trac.webkit.org/changeset/278978
2021-06-17 Enrique Ocaña González <eocanha@igalia.com>
[GStreamer] Refactor MediaPlayerPrivateGStreamer::notifyPlayerOf*
https://bugs.webkit.org/show_bug.cgi?id=204686
Reviewed by Philippe Normand.
Refactored the notifyPlayerOf{Audio,Video,Text} family of methods into a single notifyPlayerOfTrack() one.
Some Variant variables are needed in order to make several incompatible types work together and to auto-detect the type of track as an enum.
Covered by existing tests.
* platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
(WebCore::InbandTextTrackPrivateGStreamer::create): Added method with a signature similar to the ones used by {Audio,Video}TrackPrivateGStreamer, so that it fits into the notifyPlayerOfTrack() template code.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfTrack): Template method that unifies the old notifyPlayerOf{Audio,Video,Text}() implementations.
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Deleted. Refactored into notifyPlayerOfTrack().
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::audioChangedCallback): Call the new notifyPlayerOfTrack() refactored implementation.
(WebCore::MediaPlayerPrivateGStreamer::textChangedCallback): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::videoChangedCallback): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks): Deleted. Now implemented directly inside notifyPlayerOfTrack().
(WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Deleted notifyPlayerOf{Audio,Video,Text}(), added notifyPlayerOfTrack(), deleted purgeInvalid{Audio,Video,Text}Tracks().
2021-06-16 Myles C. Maxfield <mmaxfield@apple.com>
Make FontFaceSet::Iterator's bounds check more robust
https://bugs.webkit.org/show_bug.cgi?id=227048
<rdar://problem/78871890>
Reviewed by Simon Fraser.
We were checking for one specific bad value, when we should have been checking for all bad values.
* css/FontFaceSet.cpp:
(WebCore::FontFaceSet::Iterator::next):
2021-06-16 Chris Dumez <cdumez@apple.com>
Document's execCommand() / queryCommand*() should throw an exception on non-HTML/XHTML documents
https://bugs.webkit.org/show_bug.cgi?id=227016
Reviewed by Darin Adler.
Update Document's execCommand() / queryCommand*() to throw an InvalidStateError when the document
is not an HTML/XHTML document. This matches Blink's behavior. Firefox is even stricter and throws
for all non HTML documents (including XHTML).
Test: fast/dom/Document/document-execcommand.html
* dom/Document.cpp:
(WebCore::Document::execCommand):
(WebCore::Document::queryCommandEnabled):
(WebCore::Document::queryCommandIndeterm):
(WebCore::Document::queryCommandState):
(WebCore::Document::queryCommandSupported):
(WebCore::Document::queryCommandValue):
* dom/Document.h:
2021-06-16 Cameron McCormack <heycam@apple.com>
Make RenderLayer::hitTestLayer not assume its renderer is a RenderBox
https://bugs.webkit.org/show_bug.cgi?id=227004
<rdar://79265788>
Reviewed by Simon Fraser.
An inline box might have a clip-path on it, so we can't assume that
the layer's renderer is a RenderBox. Avoid the assertion by hit testing
incorrectly for now.
Test: css3/masking/clip-path-hit-test-on-inline-iframe-parent.html
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hitTestLayer):
2021-06-16 Chris Dumez <cdumez@apple.com>
Protect Element before calling dispatchMouseEvent() on it
https://bugs.webkit.org/show_bug.cgi?id=226767
<rdar://problem/79009112>
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-06-16 Peng Liu <peng.liu6@apple.com>
Some http/tests/ are crashing with ASSERTION FAILED: isInRoutingArbitrationForToken(token) || m_setupArbitrationOngoing
https://bugs.webkit.org/show_bug.cgi?id=226896
Reviewed by Darin Adler.
A follow-up patch to fix an issue in r278922. Remove the call to `contains()`
before `remove()` on a `WeakHashSet`.
* platform/audio/mac/SharedRoutingArbitrator.mm:
(WebCore::SharedRoutingArbitrator::endRoutingArbitrationForToken):
2021-06-16 Chris Dumez <cdumez@apple.com>
FileReader.readAsArrayBuffer misses checking for the type of blob param
https://bugs.webkit.org/show_bug.cgi?id=226640
<rdar://problem/79193198>
Reviewed by Youenn Fablet.
The Blob parameter to FileReader.readAsArrayBuffer / readAsBinaryString / readAsText / readAsDataURL
should not be nullable as per the specification:
- https://w3c.github.io/FileAPI/#APIASynch
This patch aligns us with the specification and with the behavior of both Blink and Gecko.
Test: fast/files/filereader-invalid-blob.html
* fileapi/FileReader.cpp:
(WebCore::FileReader::readAsArrayBuffer):
(WebCore::FileReader::readAsBinaryString):
(WebCore::FileReader::readAsText):
(WebCore::FileReader::readAsDataURL):
* fileapi/FileReader.h:
* fileapi/FileReader.idl:
2021-06-16 Sihui Liu <sihui_liu@apple.com>
Add lock for static cursorMap in MemoryCursor
https://bugs.webkit.org/show_bug.cgi?id=226806
Reviewed by Chris Dumez.
As cursorMap can be accessed from multiple WorkQueues.
* Modules/indexeddb/server/MemoryCursor.cpp:
(WebCore::IDBServer::MemoryCursor::MemoryCursor):
(WebCore::IDBServer::MemoryCursor::~MemoryCursor):
(WebCore::IDBServer::MemoryCursor::cursorForIdentifier):
2021-06-16 Timothy Hatcher <timothy@apple.com>
REGRESSION (r273329): Logging of most errors like CSP and promise rejections fail logging to the system console
https://bugs.webkit.org/show_bug.cgi?id=227080
Unreviewed, reverting r273329.
* dom/Document.cpp:
(WebCore::Document::didLogMessage):
* page/PageConsoleClient.cpp:
(WebCore::PageConsoleClient::addMessage):
2021-06-16 Kimmo Kinnunen <kkinnunen@apple.com>
WebGL2 clientWaitSync does not flush when requested
https://bugs.webkit.org/show_bug.cgi?id=227064
Reviewed by Kenneth Russell.
Flush when clientWaitSync is called with SYNC_FLUSH_COMMANDS_BIT.
Theoretically the sync object might not be inserted to the command
buffer unless the wait flushes or client ensures flush by other
means.
No new tests, hard to observe externally.
* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::clientWaitSync):
2021-06-16 Chris Dumez <cdumez@apple.com>
[Hardening] Better protect against overflows in the WebAudioBufferList constructor
https://bugs.webkit.org/show_bug.cgi?id=227077
<rdar://problem/78222665>
Reviewed by Geoffrey Garen.
Make sure `sizeof(AudioBuffer) * std::max(1U, bufferCount)` doesn't overflow.
* platform/audio/cocoa/WebAudioBufferList.cpp:
(WebCore::WebAudioBufferList::WebAudioBufferList):
2021-06-16 Philippe Normand <pnormand@igalia.com>
[GStreamer] gst_element_get_request_pad deprecated in 1.20
https://bugs.webkit.org/show_bug.cgi?id=226974
Reviewed by Xabier Rodriguez-Calvar.
In GStreamer 1.20 gst_element_get_request_pad() was renamed to gst_element_request_pad_simple(),
so create an alias for older versions.
* platform/graphics/gstreamer/GStreamerAudioMixer.cpp:
(WebCore::GStreamerAudioMixer::registerProducer):
* platform/graphics/gstreamer/GStreamerCommon.h:
2021-06-16 Tim Nguyen <ntim@apple.com>
Make CSS.supports() return false for internal CSS properties
https://bugs.webkit.org/show_bug.cgi?id=224930
Reviewed by Antti Koivisto.
Test: LayoutTests/fast/backgrounds/background-repeat-x-y-parse.html
Examples that are now rejected:
CSS.supports("background-repeat-x: inherit")
CSS.supports("background-repeat-x", "inherit")
CSS.supports("background-repeat-y: inherit")
CSS.supports("background-repeat-y", "inherit")
* css/DOMCSSNamespace.cpp:
(WebCore::DOMCSSNamespace::supports):
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeDeclaration):
2021-06-16 Toshio Ogasawara <toshio.ogasawara@access-company.com>
[MSE] Crash when getting audioTracks, videoTracks, textTracks of sourceBuffer after executing MediaSource::removeSourceBuffer()
https://bugs.webkit.org/show_bug.cgi?id=227018
Reviewed by Eric Carlson.
Fixed not to refer to m_source when isRemoved() is true in SourceBuffer::videoTracks(),
SourceBuffer::audioTracks(), SourceBuffer::textTracks().
Test: media/media-source/media-source-get-tracks-crash.html
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::videoTracks):
(WebCore::SourceBuffer::audioTracks):
(WebCore::SourceBuffer::textTracks):
2021-06-16 Alan Bujtas <zalan@apple.com>
Content moves up when hovering over a link on Hacker News
https://bugs.webkit.org/show_bug.cgi?id=226852
<rdar://78537231>
Reviewed by Antti Koivisto.
Legacy line layout integral-rounds the root inline box's vertical position and this integral position
gets propagated down to the descendant inline boxes when descendantsHaveSameLineHeightAndBaseline() is true.
See LegacyInlineFlowBox::addToLine and LegacyInlineFlowBox::placeBoxesInBlockDirection for more details.
This patch attempts to mirror this behavior in IFC.
Test: fast/inline/hidpi-legacy-integral-rounding-on-inline-boxes.html
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::InlineContentBuilder::computeLineLevelVisualAdjustmentsForRuns const):
2021-06-16 Frederic Wang <fwang@igalia.com>
Nullptr crash in positionInParentBeforeNode via InsertTextCommand::doApply
https://bugs.webkit.org/show_bug.cgi?id=226870
Reviewed by Ryosuke Niwa.
deleteSelection call In InsertTextCommand::doApply() can make the endingSelection() orphan.
If that happens, exit early to avoid dereferencing a nullptr pointer later.
Test: fast/editing/insert-text-orphaned-summary-crash.html
* editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::doApply):
2021-06-16 Per Arne <pvollan@apple.com>
Update Media Accessibility preferences in the WebContent process from the UI process
https://bugs.webkit.org/show_bug.cgi?id=227031
<rdar://78614882>
Reviewed by Eric Carlson.
Due to stricter sandboxing in the WebContent process, Media Accessibility preferences should be updated from the UI process.
The preferences for caption display mode and preferred caption languages are being cached, and the cached value will be used
if it has been set.
* WebCore.xcodeproj/project.pbxproj:
* page/CaptionUserPreferences.h:
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::cachedCaptionDisplayMode):
(WebCore::cachedPreferredLanguages):
(WebCore::CaptionUserPreferencesMediaAF::captionDisplayMode const):
(WebCore::CaptionUserPreferencesMediaAF::platformCaptionDisplayMode):
(WebCore::CaptionUserPreferencesMediaAF::setCachedCaptionDisplayMode):
(WebCore::CaptionUserPreferencesMediaAF::preferredLanguages const):
(WebCore::CaptionUserPreferencesMediaAF::platformPreferredLanguages):
(WebCore::CaptionUserPreferencesMediaAF::setCachedPreferredLanguages):
* page/CaptionUserPreferencesMediaAF.h:
2021-06-16 Philippe Normand <pnormand@igalia.com>
[GStreamer] clang analysis: Unlocked access in ImageDecoderGStreamer.cpp
https://bugs.webkit.org/show_bug.cgi?id=226495
Reviewed by Adrian Perez de Castro.
Remove unlocked access to the the m_messageDispatched instance variable. Also there is no
need to wait on the condition if the dispatching happens synchronously in the current
thread. No need to notify the condition either before dispatching, the only call to wait()
is after the asynchronous dispatch has been scheduled.
* platform/graphics/gstreamer/ImageDecoderGStreamer.cpp:
(WebCore::ImageDecoderGStreamer::InnerDecoder::preparePipeline):
2021-06-16 Martin Robinson <mrobinson@webkit.org>
Replace invalidSnapOffsetIndex with std::optional<unsigned>
https://bugs.webkit.org/show_bug.cgi?id=226654
Reviewed by Simon Fraser.
Use std::optional<unsigned> in order to represent the situation
where we do not have a snap point selected rather than UINT_MAX.
No new tests. This should not change behavior.
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::setActiveScrollSnapIndices):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::indicesOfNearestSnapOffsets): Return a std::pair instead of splitting the
return values into the argument list.
(WebCore::closestSnapOffsetWithInfoAndAxis):
(WebCore::LayoutScrollSnapOffsetsInfo::closestSnapOffset const):
(WebCore::FloatScrollSnapOffsetsInfo::closestSnapOffset const):
* page/scrolling/ScrollSnapOffsetsInfo.h:
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::setCurrentHorizontalSnapPointIndex):
(WebCore::ScrollingStateScrollingNode::setCurrentVerticalSnapPointIndex):
(WebCore::ScrollingStateScrollingNode::dumpProperties const):
* page/scrolling/ScrollingStateScrollingNode.h:
(WebCore::ScrollingStateScrollingNode::currentHorizontalSnapPointIndex const):
(WebCore::ScrollingStateScrollingNode::currentVerticalSnapPointIndex const):
* page/scrolling/ScrollingTree.h:
(WebCore::ScrollingTree::setActiveScrollSnapIndices):
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::dumpProperties const):
* page/scrolling/ScrollingTreeScrollingNode.h: Move some methods into the
source file to satisfy the style checker. WEBCORE_EXPORT is applied to the
entire class declaration.
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::currentSnapPointIndicesDidChange):
(WebCore::ThreadedScrollingTree::setActiveScrollSnapIndices):
* page/scrolling/ThreadedScrollingTree.h:
* page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
* page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
(WebCore::ScrollingTreeScrollingNodeDelegateMac::activeScrollSnapIndexForAxis const):
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::activeScrollSnapIndexForAxis const):
(WebCore::ScrollAnimator::setActiveScrollSnapIndexForAxis):
* platform/ScrollAnimator.h:
* platform/ScrollController.cpp:
(WebCore::ScrollController::activeScrollSnapIndexForAxis const):
(WebCore::ScrollController::setActiveScrollSnapIndexForAxis): When there is no new
snap index, we need to actively change the value to std::nullopt. This wasn't
necessary because ScrollableArea was covering up this case in the past as a side-effect.
(WebCore::ScrollController::setNearestScrollSnapIndexForAxisAndOffset):
(WebCore::ScrollController::resnapAfterLayout): Also resnap if the snapped index is
greater than the current one. This case was being covered up by a side-effect in
ScrollableArea.
* platform/ScrollController.h:
* platform/ScrollSnapAnimatorState.cpp:
(WebCore::ScrollSnapAnimatorState::setupAnimationForState):
(WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset const): Return a std::pair
instead of splitting the output values into the argument list.
* platform/ScrollSnapAnimatorState.h:
(WebCore::ScrollSnapAnimatorState::activeSnapIndexForAxis const):
(WebCore::ScrollSnapAnimatorState::setActiveSnapIndexForAxis):
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::currentHorizontalSnapPointIndex const):
(WebCore::ScrollableArea::currentVerticalSnapPointIndex const):
(WebCore::ScrollableArea::setCurrentHorizontalSnapPointIndex):
(WebCore::ScrollableArea::setCurrentVerticalSnapPointIndex):
(WebCore::ScrollableArea::resnapAfterLayout):
* platform/ScrollableArea.h:
2021-06-15 Peng Liu <peng.liu6@apple.com>
some http/tests/ are crashing with ASSERTION FAILED: isInRoutingArbitrationForToken(token) || m_setupArbitrationOngoing
https://bugs.webkit.org/show_bug.cgi?id=226896
Reviewed by Eric Carlson.
When the `RoutingArbiter` fails to `-[beginArbitrationWithCategory:completionHandler:]`,
a token won't be added to `m_tokens`. Therefore, we should remove the assertion
in `SharedRoutingArbitrator::endRoutingArbitrationForToken()`.
* platform/audio/mac/SharedRoutingArbitrator.mm:
(WebCore::SharedRoutingArbitrator::endRoutingArbitrationForToken):
2021-06-15 Alan Bujtas <zalan@apple.com>
Cleanup RenderElement::RendererCreationType
https://bugs.webkit.org/show_bug.cgi?id=227033
Reviewed by Simon Fraser.
Let the caller define the preferred type of renderer for certain display type values.
* html/HTMLFieldSetElement.cpp:
(WebCore::HTMLFieldSetElement::createElementRenderer):
* html/HTMLSummaryElement.cpp:
(WebCore::HTMLSummaryElement::createElementRenderer):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::createFor):
* rendering/RenderElement.h:
(WebCore::RenderElement::createFor):
2021-06-15 Said Abou-Hallawa <said@apple.com>
[GPU Process] ConcreteImageBuffer::baseTransform() returns incorrect transform for unaccelerated ImageBuffer
https://bugs.webkit.org/show_bug.cgi?id=227044
<rdar://78642742>
Reviewed by Simon Fraser.
The static constant ImageBufferBackend::isOriginAtUpperLeftCorner is used
to tell where the origin of the physical graphics context. For CG platforms,
it is at the bottom left corner. This requires the coordinates system to
be moved to the top-left corner and flipped.
The fix is:
1) Rename isOriginAtUpperLeftCorner to isOriginAtBottomLeftCorner since
it is a description for the physical graphics context. All the logical
graphics contexts have to have their coordinates system at the top-left
corner.
2) Set isOriginAtBottomLeftCorner to true in ImageBufferCGBackend only
so all the super classes inherit the 'true' value. This includes
ImageBufferShareableBitmapBackend for CG platforms.
Test: fast/canvas/canvas-large-dimensions-drawing.html
* platform/graphics/ConcreteImageBuffer.h:
* platform/graphics/ImageBufferBackend.h:
* platform/graphics/cg/ImageBufferCGBackend.h:
* platform/graphics/cg/ImageBufferCGBitmapBackend.h:
* platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
2021-06-15 Andres Gonzalez <andresg_22@apple.com>
iOS - VoiceOver reads incorrectly in content editable element if role="document".
https://bugs.webkit.org/show_bug.cgi?id=227035
rdar://78776169
Reviewed by Chris Fleizach.
On iOS, VoiceOver was announcing <div contenteditable="true" role="document">
as a landmark and not as editable text. Furthermore, VoiceOver wasn't
echoing keyboard input once the element became interactive.
The solution is to return AccessibilityRole::TextArea for an element
with these attributes instead of Document.
Used shouldIgnoreRoleAttribute to special case this scenario.
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::shouldIgnoreAttributeRole const):
* accessibility/AccessibilityObjectInterface.h:
Removed shouldIgnoreRoleAttribute from the AXObject interface since it
doesn't need to be exposed outside the AXObject class hierarchy.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::shouldIgnoreAttributeRole const):
* accessibility/AccessibilityRenderObject.h:
* accessibility/AccessibilityTreeItem.h:
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _accessibilityTextEntryTraits]): Code cleanup.
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::shouldIgnoreAttributeRole const): Deleted.
* accessibility/isolatedtree/AXIsolatedObject.h:
2021-06-15 Alex Christensen <achristensen@webkit.org>
Allow legacy SecurityOrigin behavior for x-apple-ql-id2 scheme
https://bugs.webkit.org/show_bug.cgi?id=226993
<rdar://76474042>
Reviewed by Tim Horton.
Why have one x-apple-ql-id scheme when you can have 2?
* page/SecurityOrigin.cpp:
(WebCore::shouldTreatAsUniqueOrigin):
Also move the linked-on-or-before check to after the hasSpecialScheme check which will be true for most URLs (http, https, file, etc.)
2021-06-15 Philippe Normand <pnormand@igalia.com>
[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-06-06 Darin Adler <darin@apple.com>
Delete some recently-obsoleted files
https://bugs.webkit.org/show_bug.cgi?id=226705
Reviewed by Chris Dumez.
* Sources.txt: Removed CSSCustomIdentValue.cpp.
* WebCore.xcodeproj/project.pbxproj: Removed CSSCustomIdentValue.cpp/h.
* css/CSSCustomIdentValue.cpp: Removed.
* css/CSSCustomIdentValue.h: Removed.
* css/calc/CSSCalcExpressionNodeParser.cpp: Added TextStream.h include.
* dom/SuccessOr.h: Removed.
2021-06-15 Wenson Hsieh <wenson_hsieh@apple.com>
[GPU Process] Add a bounds check before reading data length for out-of-line display list items
https://bugs.webkit.org/show_bug.cgi?id=227029
rdar://79343645
Reviewed by Chris Dumez.
Add some additional hardening when decoding out-of-line display list items.
* platform/graphics/displaylists/DisplayListIterator.cpp:
(WebCore::DisplayList::DisplayList::Iterator::updateCurrentItem):
Currently, it's possible to perform an out-of-bounds read in the shared display list item buffer, since we only
perform a bounds check after grabbing the data length (8 bytes) from the buffer after reading and validating an
out-of-line display list item type.
Mitigate this by validating that there is enough buffer capacity for both the padded item type value and encoded
data length, before we attempt to read the encoded data length.
2021-06-15 Myles C. Maxfield <mmaxfield@apple.com>
GraphicsContext::apply{Fill,Stroke}Pattern needs to do nothing if there is no fill/stroke pattern set
https://bugs.webkit.org/show_bug.cgi?id=227015
<rdar://problem/79301173>
Reviewed by Simon Fraser.
Now that we have a GPU Process, we can't trust incoming IPC. So, this patch protects
against trying to apply the curretn fill/stroke pattern when there isn't one set.
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::applyStrokePattern):
(WebCore::GraphicsContextCG::applyFillPattern):
* platform/graphics/win/GraphicsContextDirect2D.cpp:
(WebCore::GraphicsContextDirect2D::applyStrokePattern):
(WebCore::GraphicsContextDirect2D::applyFillPattern):
2021-06-15 Myles C. Maxfield <mmaxfield@apple.com>
GraphicsContext restores need to do nothing if the state stack is empty
https://bugs.webkit.org/show_bug.cgi?id=227009
<rdar://problem/79301368>
Reviewed by Simon Fraser.
Now that we have a GPU Process, we can't trust incoming IPC. So, this patch protects
against unbalanced save/restore commands in GraphicsContexts.
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContextCairo::restore):
* platform/graphics/cairo/PlatformContextCairo.cpp:
(WebCore::PlatformContextCairo::restore):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::restore):
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
(Nicosia::CairoOperationRecorder::restore):
* platform/graphics/win/GraphicsContextDirect2D.cpp:
(WebCore::GraphicsContextDirect2D::restore):
2021-06-15 Chris Lord <clord@igalia.com>
Scrollbars are not clipped to layer bounds in RenderLayerBacking
https://bugs.webkit.org/show_bug.cgi?id=226823
Reviewed by Simon Fraser.
Mask contents to bounds of overflow controls containers in RenderLayerBacking.
Test: compositing/scrolling/async-overflow-scrolling/overflow-controls-container-clips-scrollbars.html
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGeometry):
(WebCore::RenderLayerBacking::adjustOverflowControlsPositionRelativeToAncestor):
2021-06-15 Eric Carlson <eric.carlson@apple.com>
[Mac] CoreMedia WrapperClass does not need alignment fixup
https://bugs.webkit.org/show_bug.cgi?id=226978
rdar://78864290
Reviewed by Geoffrey Garen and Dan Bernstein.
* platform/graphics/cocoa/WebCoreDecompressionSession.mm:
(WebCore::WebCoreDecompressionSession::enqueueSample): static_assert CMBufferQueueRef
callback struct alignment and version size.
2021-06-15 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Add support for preferred width computation when mixed width types are present
https://bugs.webkit.org/show_bug.cgi?id=227010
Reviewed by Antti Koivisto.
This is in preparation for supporting available space distribution with mixed width types (e.g. percent and fixed).
While this patch only addresses the preferred width computation for the table, certain values already work with the existing distribution code.
Test: fast/layoutformattingcontext/table-space-distribution-mixed-width-type-simple.html
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns):
2021-06-15 Martin Robinson <mrobinson@igalia.com>
[css-scroll-snap] Scroll snap offsets are interpreted as scroll positions in ScrollableArea
https://bugs.webkit.org/show_bug.cgi?id=226572
Reviewed by Simon Fraser.
Test: css3/scroll-snap/scroll-snap-right-to-left-initial-snapping.html
This is also covered by existing WPT tests, but these tests are composite reference
tests where there are still some failing elements.
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::nearestActiveSnapPoint): Use scroll offsets instead of positions.
(WebCore::ScrollableArea::updateScrollSnapState): Ditto.
2021-05-31 Sergio Villar Senin <svillar@igalia.com>
[css-flexbox] Do not compute the min-max sizes of flex items twice
https://bugs.webkit.org/show_bug.cgi?id=226463
Reviewed by Simon Fraser.
When determining the flex base size, the items min and max main sizes are ignored (no clamping occurs).
Those limits are used to compute the item's hypothetical main size and also later when the flexible
lengths are resolved. The thing is that we were running the code that clamps the flex item size twice instead
of computing those limits once and apply them twice.
From now one, we just compute them once and store the limits in a std::pair in the FlexItem class. This means
that the FlexItem is able to compute the hypothetical main size on its own and does not need it to be passed
as an argument.
No new tests as this is already being tested by dozens of tests.
* rendering/FlexibleBoxAlgorithm.cpp:
(WebCore::FlexItem::FlexItem):
(WebCore::FlexItem::constrainSizeByMinMax const): Clamp the passed in size by the stored min & max sizes.
* rendering/FlexibleBoxAlgorithm.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeFlexItemMinMaxSizes): Renamed from adjustChildSizeForMinAndMax and
without the childSize argument which is no longer needed.
(WebCore::RenderFlexibleBox::constructFlexItem): Use constrainSizeByMinMax.
(WebCore::RenderFlexibleBox::resolveFlexibleLengths): Ditto.
(WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax): Deleted.
* rendering/RenderFlexibleBox.h:
2021-06-11 Sergio Villar Senin <svillar@igalia.com>
logged in GitHub issue pages have bad layout for "Notifications Customize" link
https://bugs.webkit.org/show_bug.cgi?id=226859
Reviewed by Alan Bujtas.
Test: imported/w3c/web-platform-tests/html/rendering/the-details-element/summary-display-list-item-002.html
In r278280 we made display:list-item on <summary> elements to fallback to display:flexbox in order not to
show two markers. However there is no reason why it should be a flexible box instead of a block container,
actually is causing issues in some sites. We better fallback to block instead of flexbox renderer.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::createFor): create a RenderBlockFlow when OnlyCreateBlockAndFlexboxRenderers is
specified (right now only by summary elements).
2021-06-15 Said Abou-Hallawa <said@apple.com>
[CG] Create a sub-image when drawing an image only if the destination image will be enlarged, rotated or sheared
https://bugs.webkit.org/show_bug.cgi?id=226916
<rdar://71712144>
Reviewed by Simon Fraser.
When drawing only part of the image, we may want to create a sub-image
first and draw this sub-image. But creating the sub-image is expensive.
So we use SubimageCacheWithTimer to avoid recreating them very often.
If the same part of the image is drawn multiple times, creating the sub-
image is a win. But if the part of the image is drawn only once, drawing
the whole image to a clipped context will be faster. In some cases, we
must to draw the part of the image through a sub-image. For example, if
the destination rectangle stretches only a part of an image, interpolating
the sub-image will give the correct display.
In this patch GraphicsContextCG::drawNativeImage() is re-factored to do
the following:
1) Normalize the srcRect and destRect
2) Simplify calculation of adjustDestRect and subimageRect using FloatRect
and FloatSize math
3) Move the heuristic which decides whether to use a sub-image or not to
a separate function.
A sub-image will be created if:
1) An interpolation will be performed when drawing the sub-image
2) and one of the following:
a) If the context is rotated or sheared
b) If destRect.size() / srcRect.size() is non-uniformly scaled
c) If destRect.size() / srcRect.size() is uniformly enlarging in
both direction
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::normalizeRect): Deleted.
* platform/graphics/FloatRect.cpp:
(WebCore::normalizeRect):
* platform/graphics/FloatRect.h:
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::shouldUseSubimage):
(WebCore::getSubimage):
(WebCore::imageLogicalSize):
(WebCore::GraphicsContextCG::drawNativeImage):
* platform/graphics/transforms/AffineTransform.h:
(WebCore::AffineTransform::isRotateOrShear const):
2021-06-15 Martin Robinson <mrobinson@webkit.org>
[css-scroll-snap] New snap containers always snap to the first scroll position
https://bugs.webkit.org/show_bug.cgi?id=226630
Reviewed by Simon Fraser.
There are two situations where we should not immediately snap to the first snap position
of a scroller after initial layout:
1. If that scroll is right-to-left. In this case the last snap position is closest to
the origin.
2. If the scroller uses proximity snapping and the first snap position is far enough
away from the origin that it isn't yet active.
Previously, WebKit was always snapping to the first position. The change fixes that by
not snapping to the 0 index snap point immediately after initial layout and only snapping
to an eligible snap positions after running a snap point search.
No new tests. This change fixes two existing WPT tests:
- imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-snap-003.htm
- imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/scroll-snap-initial-layout-000.htm
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::closestSnapOffsetWithInfoAndAxis): Pull in isNearEnoughToOffsetForProximity as
an anonymous function and use it to avoid snapping to the first and last position if
they are too far for proximity snapping.
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::dumpProperties const): Use invalidSnapOffsetIndex as
the default for the snap index property. Interpret 0 as a valid snap position.
* page/scrolling/ScrollingStateScrollingNode.h: Ditto.
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::dumpProperties const): Ditto.
* page/scrolling/ScrollingTreeScrollingNode.h: Ditto.
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::resnapAfterLayout): Added this method that passes through to ScrollController.
(WebCore::ScrollAnimator::updateActiveScrollSnapIndexForOffset): Simplified setActiveScrollSnapIndicesForOffset
into updateActiveScrollSnapIndexForClientOffset.
* platform/ScrollAnimator.h: Added method definition.
* platform/ScrollController.cpp:
(WebCore::ScrollController::setSnapOffsetsInfo): Use updateActiveScrollSnapIndexForClientOffset now.
(WebCore::ScrollController::activeScrollSnapIndexForAxis const): Return invalidSnapOffsetIndex
when snapping is disabled.
(WebCore::ScrollController::setNearestScrollSnapIndexForAxisAndOffset): No longer clamp the scroll
position to the first and last snap points. We might be scrolling to a position before or after
them that isn't subject to proximity snapping.
(WebCore::ScrollController::updateActiveScrollSnapIndexForClientOffset): Renamed from setActiveScrollSnapIndicesForOffset
because it always just took the client's current offset.
(WebCore::ScrollController::resnapAfterLayout): Added this helper which snaps in axes that aren't currently
snapped to a snap position after a layout.
* platform/ScrollController.h: Removed unused method that used 0 incorrectly as an invalid snap position.
Update method definitions.
* platform/ScrollSnapAnimatorState.h: Use invalidSnapOffsetIndex to signify no snapping.
* platform/ScrollSnapAnimatorState.cpp:
(WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset const): No longer clamp offsets to first and
last scroll snap offsets.
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::currentHorizontalSnapPointIndex const): Ditto.
(WebCore::ScrollableArea::currentVerticalSnapPointIndex const): Ditto.
(WebCore::ScrollableArea::resnapAfterLayout): Call into ScrollController::resnapAfterLayout.
2021-06-14 Myles C. Maxfield <mmaxfield@apple.com>
Font::applyTransforms() can redirect GlyphBuffer's internal pointers
https://bugs.webkit.org/show_bug.cgi?id=226997
<rdar://problem/78704666>
Reviewed by Ryosuke Niwa.
After calling Font::applyTransforms(), we need to update any pointers which point into the GlyphBuffer.
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::applyFontTransforms):
2021-06-14 Kate Cheney <katherine_cheney@apple.com>
Remove Storage Access API quirk on live.com
https://bugs.webkit.org/show_bug.cgi?id=226990
<rdar://problem/79218986>
Reviewed by Brent Fulgham.
The quirk on live.com is unnecessary, and we should remove it.
* dom/DocumentStorageAccess.cpp:
(WebCore::DocumentStorageAccess::requestStorageAccessQuirk):
* page/Quirks.cpp:
(WebCore::isStorageAccessQuirkDomainAndElement):
(WebCore::Quirks::requestStorageAccessAndHandleClick const):
(WebCore::Quirks::mapToTopDomain): Deleted.
* page/Quirks.h:
2021-06-14 Truitt Savell <tsavell@apple.com>
Unreviewed, reverting r278842.
introduced a failing test
Reverted changeset:
"Fix RTCDataChannelInit::decode"
https://bugs.webkit.org/show_bug.cgi?id=226968
https://commits.webkit.org/r278842
2021-06-14 Devin Rousso <drousso@apple.com>
[macOS] TouchBar playback speed controls don't work
https://bugs.webkit.org/show_bug.cgi?id=226987
<rdar://problem/79216098>
Reviewed by Eric Carlson.
Override `setRate:` and `setDefaultPlaybackRate:` instead of just having an ivar so that
TouchBar playback speed controls actually affect the corresponding `<video>`.
* platform/mac/WebPlaybackControlsManager.mm:
(-[WebPlaybackControlsManager defaultPlaybackRate]): Added.
(-[WebPlaybackControlsManager setDefaultPlaybackRate:]): Added.
(-[WebPlaybackControlsManager rate]): Added.
(-[WebPlaybackControlsManager setRate:]): Added.
2021-06-14 Alex Christensen <achristensen@webkit.org>
Pass PAL::SessionID by value instead of reference
https://bugs.webkit.org/show_bug.cgi?id=226983
Reviewed by Geoffrey Garen.
It's a wrapper around an integer which will pass in a register.
There's no reason to pass a pointer to it.
* loader/CrossOriginAccessControl.cpp:
(WebCore::validatePreflightResponse):
* loader/CrossOriginAccessControl.h:
* loader/CrossOriginPreflightResultCache.cpp:
(WebCore::CrossOriginPreflightResultCache::appendEntry):
(WebCore::CrossOriginPreflightResultCache::canSkipPreflight):
* loader/CrossOriginPreflightResultCache.h:
* loader/EmptyClients.cpp:
* loader/cache/CachedApplicationManifest.cpp:
(WebCore::CachedApplicationManifest::CachedApplicationManifest):
* loader/cache/CachedApplicationManifest.h:
* loader/cache/CachedCSSStyleSheet.cpp:
(WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
* loader/cache/CachedCSSStyleSheet.h:
* loader/cache/CachedFont.cpp:
(WebCore::CachedFont::CachedFont):
* loader/cache/CachedFont.h:
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::CachedImage):
* loader/cache/CachedImage.h:
* loader/cache/CachedRawResource.cpp:
(WebCore::CachedRawResource::CachedRawResource):
* loader/cache/CachedRawResource.h:
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::CachedResource):
* loader/cache/CachedResource.h:
* loader/cache/CachedResourceLoader.cpp:
(WebCore::createResource):
(WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest):
* loader/cache/CachedResourceLoader.h:
* loader/cache/CachedSVGDocument.cpp:
(WebCore::CachedSVGDocument::CachedSVGDocument):
* loader/cache/CachedSVGDocument.h:
* loader/cache/CachedSVGFont.cpp:
(WebCore::CachedSVGFont::CachedSVGFont):
* loader/cache/CachedSVGFont.h:
* loader/cache/CachedScript.cpp:
(WebCore::CachedScript::CachedScript):
* loader/cache/CachedScript.h:
* loader/cache/CachedTextTrack.cpp:
(WebCore::CachedTextTrack::CachedTextTrack):
* loader/cache/CachedTextTrack.h:
* loader/cache/CachedXSLStyleSheet.cpp:
(WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
* loader/cache/CachedXSLStyleSheet.h:
* page/DatabaseProvider.h:
* platform/WebCoreCrossThreadCopier.cpp:
(WTF::PAL::SessionID>::copy):
* platform/WebCoreCrossThreadCopier.h:
* storage/StorageNamespaceProvider.cpp:
(WebCore::StorageNamespaceProvider::setSessionIDForTesting):
* storage/StorageNamespaceProvider.h:
2021-06-14 Patrick Angle <pangle@apple.com>
Web Inspector: CSS variables not handled as case sensitive
https://bugs.webkit.org/show_bug.cgi?id=226875
Reviewed by Devin Rousso.
Test: inspector/css/overridden-property.html
CSS variables support distinct declarations with only differences in cases. Previously, we naively converted all
property names to lowercase, instead of properly providing variable names in their original case.
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyle::styleWithProperties const):
2021-06-14 Youenn Fablet <youenn@apple.com>
Fix RTCDataChannelInit::decode
https://bugs.webkit.org/show_bug.cgi?id=226968
Reviewed by Eric Carlson.
Test: imported/w3c/web-platform-tests/webrtc-extensions/transfer-datachannel-service-worker.https.html
* platform/mediastream/RTCDataChannelHandler.h:
(WebCore::RTCDataChannelInit::decode):
Make sure to use optionals of optionals.
2021-06-14 Per Arne <pvollan@apple.com>
[AppleWin] Fix build failure
https://bugs.webkit.org/show_bug.cgi?id=226966
<rdar://79228536>
Reviewed by Eric Carlson.
Disable warning causing the build failure.
* platform/cf/MediaAccessibilitySoftLink.h:
2021-06-14 Chris Dumez <cdumez@apple.com>
Avoid converting SecurityOrigins to Strings in SecurityPolicy
https://bugs.webkit.org/show_bug.cgi?id=226976
Reviewed by Geoffrey Garen.
Avoid converting SecurityOrigins to Strings in SecurityPolicy, by using a SecurityOriginData
as key in the originAccessMap instead of a String. Getting a SecurityOriginData from a
SecurityOrigin is very cheap.
* page/SecurityPolicy.cpp:
(WebCore::SecurityPolicy::isAccessAllowed):
(WebCore::SecurityPolicy::addOriginAccessAllowlistEntry):
(WebCore::SecurityPolicy::removeOriginAccessAllowlistEntry):
2021-06-14 Jonathan Bedard <jbedard@apple.com>
[Monterey] Support building WebKit (Part 2)
https://bugs.webkit.org/show_bug.cgi?id=226846
<rdar://problem/79095148>
Reviewed by Chris Dumez.
Covered by exisiting tests.
* html/HTMLElement.cpp:
(WebCore::HTMLElement::updateWithTextRecognitionResult): Explicitly define second arugment
to avoid 'missing field' compilation error.
2021-06-14 Chris Dumez <cdumez@apple.com>
Micro-optimize ResourceResponseBase::sanitizeHTTPHeaderFields()
https://bugs.webkit.org/show_bug.cgi?id=226977
Reviewed by Geoffrey Garen.
Micro-optimize ResourceResponseBase::sanitizeHTTPHeaderFields() as it is not as efficient as it could be and it
shows on profiles. In particular, rely on Vector::removeAllMatching() more instead of reconstructing HTTPHeaderMaps
& Vectors.
* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting):
(WebCore::ResourceResponseBase::sanitizeHTTPHeaderFields):
2021-06-14 Kimmo Kinnunen <kkinnunen@apple.com>
AcceleratedImageBuffer not instantiated but objects are punned to the type
https://bugs.webkit.org/show_bug.cgi?id=226917
Reviewed by Said Abou-Hallawa.
AcceleratedImageBuffer::create would create instance
of ConcreteImageBuffer, not AcceleratedImageBuffer.
Fix by adding a correct create static function.
Tested by new test:
TestWebKitAPI.ImageBufferTests.ImageBufferSubTypeCreateCreatesSubtypes
* platform/graphics/PlatformImageBuffer.h:
(WebCore::IOSurfaceImageBuffer::create):
(WebCore::IOSurfaceImageBuffer::IOSurfaceImageBuffer):
Add the correct factory functions and public constructors.
* platform/graphics/cg/ImageBufferCGBitmapBackend.h:
Add export statements that are needed for the added test.
* platform/graphics/coreimage/FilterEffectRendererCoreImage.mm:
(WebCore::FilterEffectRendererCoreImage::imageForSourceGraphic):
(WebCore::FilterEffectRendererCoreImage::renderToImageBuffer):
Change the image creation site to create the explicit IOSurfaceImageBuffer
since that's what it's trying to create.
Change the type-punning call sites to use explicit
IOSurfaceImageBuffer name, as that's what the call site
is intending to use.
2021-06-14 Zalan Bujtas <zalan@apple.com>
[LFC][TFC] Add support for flexing columns when the content is also flexing
https://bugs.webkit.org/show_bug.cgi?id=226959
Reviewed by Antti Koivisto.
This patch adds support for (the very common) cases when the minimum content width < maximum content width
(e.g. text content wraps across multiple lines) and the parent column does not have fixed width either.
Note that in some cases now table layout agrees with Chrome/Firefox and not with trunk WebKit
(see table-space-distribution-simple-mismatching.htnl).
Tests: fast/layoutformattingcontext/table-space-distribution-simple-mismatching.html
fast/layoutformattingcontext/table-space-distribution-simple2.html
* layout/formattingContexts/table/TableLayout.cpp:
(WebCore::Layout::TableFormattingContext::TableLayout::distributedHorizontalSpace):
2021-06-13 Chris Dumez <cdumez@apple.com>
Relax "parent must be an HTMLElement" restriction in outerHTML setter
https://bugs.webkit.org/show_bug.cgi?id=226808
Reviewed by Ryosuke Niwa.
Made the following change to our outerHTML setter for better compatibility and to better
match the specification [1]:
- Stop throwing an exception when the parent is not an HTML element. This new behavior matches
the specification, Blink and Gecko behavior.
I did not fully align us with the specification because we are mostly aligned with Blink at
the moment. In particular:
- The specification says the outerHTML setter should be a no-op when the parent is null.
Firefox matches the specification but WebKit & Blink throw a NoModificationAllowedError.
- The specification says we should allow setting outerHTML if the parent is a DocumentFragment.
Firefox allows this but WebKit & Blink throw a NoModificationAllowedError.
- WebKit & Blink have some Text node merging logic that is not present in the specification
and which Gecko doesn't implement.
[1] https://w3c.github.io/DOM-Parsing/#dom-element-outerhtml
Test: fast/dom/set-outer-html-special-cases.html
* dom/Element.cpp:
(WebCore::Element::setOuterHTML):
2021-06-13 Sam Weinig <weinig@apple.com>
SimulatedXRDevice::shutDownTrackingAndRendering() should clear it's GraphicsContextGL to ensure the resource is cleaned up quickly
https://bugs.webkit.org/show_bug.cgi?id=226947
Reviewed by Dean Jackson.
SimulatedXRDevice::shutDownTrackingAndRendering() needs to clear its GraphicsContextGL
to ensure the resource is cleaned up quickly, and doesn't wait for GC to be reclaimed.
Without this, we can run out of GraphicsContextGLs and fail tests if GC happens to be
running a bit behind.
* testing/WebFakeXRDevice.cpp:
(WebCore::SimulatedXRDevice::shutDownTrackingAndRendering):
2021-06-13 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Add support for over-constrained cases for available space distribution
https://bugs.webkit.org/show_bug.cgi?id=226957
Reviewed by Antti Koivisto.
This patch cleans up the code for the available space distribution. It also enables
cases when the final column width is less than the preferred width (available space is negative).
See further explanation inline in the source.
Test: fast/layoutformattingcontext/table-space-distribution-simple.html
* layout/formattingContexts/table/TableLayout.cpp:
(WebCore::Layout::GridSpace::isEmpty const):
(WebCore::Layout::max):
(WebCore::Layout::operator-):
(WebCore::Layout::operator+=):
(WebCore::Layout::operator/):
(WebCore::Layout::distributeAvailableSpace):
(WebCore::Layout::TableFormattingContext::TableLayout::distributedHorizontalSpace):
2021-06-11 Chris Dumez <cdumez@apple.com>
Lazily compute SecurityOrigin::m_isPotentiallyTrustworthy for performance
https://bugs.webkit.org/show_bug.cgi?id=226946
Reviewed by Alex Christensen.
We currently initialize m_isPotentiallyTrustworthy in the SecurityOrigin constructor.
However, it is a bit expensive to compute and shows on profiles, and we often don't
actually use this data member. As a result, this patch makes it so that
SecurityOrigin::m_isPotentiallyTrustworthy gets computed lazily.
* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::SecurityOrigin):
(WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
* page/SecurityOrigin.h:
(WebCore::SecurityOrigin::isPotentiallyTrustworthy const): Deleted.
2021-06-10 Yusuke Suzuki <ysuzuki@apple.com>
Use DOMConstructor array instead of HashMap since window constructor property access is critical
https://bugs.webkit.org/show_bug.cgi?id=226909
Reviewed by Filip Pizlo.
window.XXX constructor access is relatively frequently done. But its implementation is using HashMap lookup even though
we are successfully caching the custom property accesses. This patch stop using HashMap and instead using array by
collecting all constructors at build time. # of constructors are 774 in macOS build.
preprocess-idls.pl collects all constructors and assign DOMConstructor::XXX enum to each constructor. And it also counts
the number of constructors & create DOMConstructors class which holds array of constructors.
We also remove locking for JSDOMGlobalObject::m_constructors since it is no longer HashTable, so GC can safely access to
these fields.
* CMakeLists.txt:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::JSDOMGlobalObject):
(WebCore::JSDOMGlobalObject::visitChildrenImpl):
* bindings/js/JSDOMGlobalObject.h:
(WebCore::getDOMConstructor): Deleted.
* bindings/js/JSDOMGlobalObjectInlines.h: Added.
(WebCore::getDOMConstructor):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
(GenerateCallbackImplementationContent):
* bindings/scripts/preprocess-idls.pl:
* bindings/scripts/test/JS/JSDOMWindow.cpp:
(WebCore::JSDOMWindow::getConstructor):
* bindings/scripts/test/JS/JSDedicatedWorkerGlobalScope.cpp:
(WebCore::JSDedicatedWorkerGlobalScope::getConstructor):
* bindings/scripts/test/JS/JSExposedToWorkerAndWindow.cpp:
(WebCore::JSExposedToWorkerAndWindow::getConstructor):
* bindings/scripts/test/JS/JSPaintWorkletGlobalScope.cpp:
(WebCore::JSPaintWorkletGlobalScope::getConstructor):
* bindings/scripts/test/JS/JSServiceWorkerGlobalScope.cpp:
(WebCore::JSServiceWorkerGlobalScope::getConstructor):
* bindings/scripts/test/JS/JSTestCEReactions.cpp:
(WebCore::JSTestCEReactions::getConstructor):
* bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
(WebCore::JSTestCEReactionsStringifier::getConstructor):
* bindings/scripts/test/JS/JSTestCallTracer.cpp:
(WebCore::JSTestCallTracer::getConstructor):
* bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
(WebCore::JSTestCallbackInterface::getConstructor):
* bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
(WebCore::JSTestClassWithJSBuiltinConstructor::getConstructor):
* bindings/scripts/test/JS/JSTestConditionalIncludes.cpp:
(WebCore::JSTestConditionalIncludes::getConstructor):
* bindings/scripts/test/JS/JSTestConditionallyReadWrite.cpp:
(WebCore::JSTestConditionallyReadWrite::getConstructor):
* bindings/scripts/test/JS/JSTestDOMJIT.cpp:
(WebCore::JSTestDOMJIT::getConstructor):
* bindings/scripts/test/JS/JSTestDefaultToJSON.cpp:
(WebCore::JSTestDefaultToJSON::getConstructor):
* bindings/scripts/test/JS/JSTestDefaultToJSONFilteredByExposed.cpp:
(WebCore::JSTestDefaultToJSONFilteredByExposed::getConstructor):
* bindings/scripts/test/JS/JSTestDefaultToJSONIndirectInheritance.cpp:
(WebCore::JSTestDefaultToJSONIndirectInheritance::getConstructor):
* bindings/scripts/test/JS/JSTestDefaultToJSONInherit.cpp:
(WebCore::JSTestDefaultToJSONInherit::getConstructor):
* bindings/scripts/test/JS/JSTestDefaultToJSONInheritFinal.cpp:
(WebCore::JSTestDefaultToJSONInheritFinal::getConstructor):
* bindings/scripts/test/JS/JSTestDelegateToSharedSyntheticAttribute.cpp:
(WebCore::JSTestDelegateToSharedSyntheticAttribute::getConstructor):
* bindings/scripts/test/JS/JSTestDomainSecurity.cpp:
(WebCore::JSTestDomainSecurity::getConstructor):
* bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
(WebCore::JSTestEnabledBySetting::getConstructor):
* bindings/scripts/test/JS/JSTestEnabledForContext.cpp:
(WebCore::JSTestEnabledForContext::getConstructor):
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
(WebCore::JSTestEventConstructor::getConstructor):
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::JSTestEventTarget::getConstructor):
* bindings/scripts/test/JS/JSTestException.cpp:
(WebCore::JSTestException::getConstructor):
* bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
(WebCore::JSTestGenerateIsReachable::getConstructor):
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::JSTestGlobalObject::getConstructor):
* bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
(WebCore::JSTestIndexedSetterNoIdentifier::getConstructor):
* bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
(WebCore::JSTestIndexedSetterThrowingException::getConstructor):
* bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
(WebCore::JSTestIndexedSetterWithIdentifier::getConstructor):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSTestInterface::getConstructor):
* bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
(WebCore::JSTestInterfaceLeadingUnderscore::getConstructor):
* bindings/scripts/test/JS/JSTestIterable.cpp:
(WebCore::JSTestIterable::getConstructor):
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
(WebCore::JSTestJSBuiltinConstructor::getConstructor):
* bindings/scripts/test/JS/JSTestLegacyFactoryFunction.cpp:
(WebCore::JSTestLegacyFactoryFunction::getConstructor):
(WebCore::JSTestLegacyFactoryFunction::getLegacyFactoryFunction):
* bindings/scripts/test/JS/JSTestLegacyOverrideBuiltIns.cpp:
(WebCore::JSTestLegacyOverrideBuiltIns::getConstructor):
* bindings/scripts/test/JS/JSTestMapLike.cpp:
(WebCore::JSTestMapLike::getConstructor):
* bindings/scripts/test/JS/JSTestMapLikeWithOverriddenOperations.cpp:
(WebCore::JSTestMapLikeWithOverriddenOperations::getConstructor):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
(WebCore::JSTestNamedAndIndexedSetterNoIdentifier::getConstructor):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
(WebCore::JSTestNamedAndIndexedSetterThrowingException::getConstructor):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
(WebCore::JSTestNamedAndIndexedSetterWithIdentifier::getConstructor):
* bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
(WebCore::JSTestNamedDeleterNoIdentifier::getConstructor):
* bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
(WebCore::JSTestNamedDeleterThrowingException::getConstructor):
* bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
(WebCore::JSTestNamedDeleterWithIdentifier::getConstructor):
* bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
(WebCore::JSTestNamedDeleterWithIndexedGetter::getConstructor):
* bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
(WebCore::JSTestNamedGetterCallWith::getConstructor):
* bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
(WebCore::JSTestNamedGetterNoIdentifier::getConstructor):
* bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
(WebCore::JSTestNamedGetterWithIdentifier::getConstructor):
* bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
(WebCore::JSTestNamedSetterNoIdentifier::getConstructor):
* bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
(WebCore::JSTestNamedSetterThrowingException::getConstructor):
* bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
(WebCore::JSTestNamedSetterWithIdentifier::getConstructor):
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
(WebCore::JSTestNamedSetterWithIndexedGetter::getConstructor):
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
(WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::getConstructor):
* bindings/scripts/test/JS/JSTestNamedSetterWithLegacyOverrideBuiltIns.cpp:
(WebCore::JSTestNamedSetterWithLegacyOverrideBuiltIns::getConstructor):
* bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeableProperties.cpp:
(WebCore::JSTestNamedSetterWithLegacyUnforgeableProperties::getConstructor):
* bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns.cpp:
(WebCore::JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns::getConstructor):
* bindings/scripts/test/JS/JSTestNamespaceObject.cpp:
(WebCore::JSTestNamespaceObject::getConstructor):
* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::JSTestNode::getConstructor):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObj::getConstructor):
* bindings/scripts/test/JS/JSTestOperationConditional.cpp:
(WebCore::JSTestOperationConditional::getConstructor):
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
(WebCore::JSTestOverloadedConstructors::getConstructor):
* bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
(WebCore::JSTestOverloadedConstructorsWithSequence::getConstructor):
* bindings/scripts/test/JS/JSTestPluginInterface.cpp:
(WebCore::JSTestPluginInterface::getConstructor):
* bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
(WebCore::JSTestPromiseRejectionEvent::getConstructor):
* bindings/scripts/test/JS/JSTestReadOnlyMapLike.cpp:
(WebCore::JSTestReadOnlyMapLike::getConstructor):
* bindings/scripts/test/JS/JSTestReadOnlySetLike.cpp:
(WebCore::JSTestReadOnlySetLike::getConstructor):
* bindings/scripts/test/JS/JSTestReportExtraMemoryCost.cpp:
(WebCore::JSTestReportExtraMemoryCost::getConstructor):
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
(WebCore::JSTestSerializedScriptValueInterface::getConstructor):
* bindings/scripts/test/JS/JSTestSetLike.cpp:
(WebCore::JSTestSetLike::getConstructor):
* bindings/scripts/test/JS/JSTestSetLikeWithOverriddenOperations.cpp:
(WebCore::JSTestSetLikeWithOverriddenOperations::getConstructor):
* bindings/scripts/test/JS/JSTestStringifier.cpp:
(WebCore::JSTestStringifier::getConstructor):
* bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
(WebCore::JSTestStringifierAnonymousOperation::getConstructor):
* bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
(WebCore::JSTestStringifierNamedOperation::getConstructor):
* bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
(WebCore::JSTestStringifierOperationImplementedAs::getConstructor):
* bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
(WebCore::JSTestStringifierOperationNamedToString::getConstructor):
* bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
(WebCore::JSTestStringifierReadOnlyAttribute::getConstructor):
* bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
(WebCore::JSTestStringifierReadWriteAttribute::getConstructor):
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
(WebCore::JSTestTypedefs::getConstructor):
* bindings/scripts/test/JS/JSWorkerGlobalScope.cpp:
(WebCore::JSWorkerGlobalScope::getConstructor):
* bindings/scripts/test/JS/JSWorkletGlobalScope.cpp:
(WebCore::JSWorkletGlobalScope::getConstructor):
2021-06-11 Alex Christensen <achristensen@webkit.org>
Partition CrossOriginPreflightResultCache by SessionID
https://bugs.webkit.org/show_bug.cgi?id=226910
Reviewed by Youenn Fablet.
* loader/CrossOriginAccessControl.cpp:
(WebCore::validatePreflightResponse):
* loader/CrossOriginAccessControl.h:
* loader/CrossOriginPreflightChecker.cpp:
(WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
* loader/CrossOriginPreflightResultCache.cpp:
(WebCore::CrossOriginPreflightResultCache::appendEntry):
(WebCore::CrossOriginPreflightResultCache::canSkipPreflight):
* loader/CrossOriginPreflightResultCache.h:
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
2021-06-11 Chris Dumez <cdumez@apple.com>
Use SharedBuffer!=() in CachedResource::tryReplaceEncodedData()
https://bugs.webkit.org/show_bug.cgi?id=226943
Reviewed by Geoff Garen.
Use SharedBuffer!=() in CachedResource::tryReplaceEncodedData() instead of duplicating its logic.
SharedBuffer!=() is also potentially more efficient since it doesn't requires combining the
SharedBuffers' data segments.
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::tryReplaceEncodedData):
2021-06-11 Imanol Fernandez <ifernandez@igalia.com>
Implement Encode/Decode templates for WebXR InputSources
https://bugs.webkit.org/show_bug.cgi?id=226923
Reviewed by Sam Weinig.
Process WebXR InputSources in PlatformXR FrameData Encode/Decode templates.
Tested by WebXR WPT.
* platform/xr/PlatformXR.h:
(PlatformXR::Device::FrameData::InputSourceButton::encode const):
(PlatformXR::Device::FrameData::InputSourceButton::decode):
(PlatformXR::Device::FrameData::InputSourcePose::encode const):
(PlatformXR::Device::FrameData::InputSourcePose::decode):
(PlatformXR::Device::FrameData::InputSource::encode const):
(PlatformXR::Device::FrameData::InputSource::decode):
(PlatformXR::Device::FrameData::encode const):
(PlatformXR::Device::FrameData::decode):
2021-06-11 Chris Dumez <cdumez@apple.com>
Enable more release logging in WebCore for ephemeral sessions
https://bugs.webkit.org/show_bug.cgi?id=226940
Reviewed by Geoffrey Garen.
Enable more release logging in WebCore for ephemeral sessions, to faciliate
debugging.
* Modules/webaudio/AudioContext.cpp:
* loader/PolicyChecker.cpp:
(WebCore::FrameLoader::PolicyChecker::checkNavigationPolicy):
* page/FrameView.cpp:
(WebCore::FrameView::scheduleResizeEventIfNeeded):
(WebCore::FrameView::paintContents):
(WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
* page/PerformanceMonitor.cpp:
(WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
(WebCore::PerformanceMonitor::measurePostLoadMemoryUsage):
(WebCore::PerformanceMonitor::measurePostBackgroundingMemoryUsage):
(WebCore::PerformanceMonitor::measurePostBackgroundingCPUUsage):
(WebCore::PerformanceMonitor::measureCPUUsageInActivityState):
* workers/service/ServiceWorker.cpp:
(WebCore::ServiceWorker::ServiceWorker):
(WebCore::ServiceWorker::updateState):
(WebCore::ServiceWorker::isAlwaysOnLoggingAllowed const): Deleted.
* workers/service/ServiceWorker.h:
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::addRegistration):
(WebCore::ServiceWorkerContainer::unregisterRegistration):
(WebCore::ServiceWorkerContainer::updateRegistration):
(WebCore::ServiceWorkerContainer::jobFailedWithException):
(WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
(WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
(WebCore::ServiceWorkerContainer::startScriptFetchForJob):
(WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
(WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
(WebCore::ServiceWorkerContainer::isAlwaysOnLoggingAllowed const): Deleted.
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerRegistration.cpp:
(WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
(WebCore::ServiceWorkerRegistration::updateStateFromServer):
(WebCore::ServiceWorkerRegistration::queueTaskToFireUpdateFoundEvent):
2021-06-11 Patrick Angle <pangle@apple.com>
Web Inspector: Add instrumentation to node destruction for InspectorDOMAgent
https://bugs.webkit.org/show_bug.cgi?id=226624
Reviewed by Devin Rousso.
Test: inspector/dom/willDestroyDOMNode.html
Add instrumentation for destruction of nodes in order to cease instrumenting nodes and inform the frontend that
the node no longer exists. This work serves as a prelude to <https://webkit.org/b/189687> (Web Inspector:
preserve DOM.NodeId if a node is removed and re-added) to eventually only forget about nodes upon destruction,
instead of removal from the DOM tree. Additionally, the storage of nodes is simplified down to two inverse maps,
one that maps `Node` to `NodeId`, and another that maps `NodeId` to `Node`. These are kept in sync throughout,
and both attached and detached nodes are now handled as part of these two maps of Nodes.
* dom/Node.cpp:
(WebCore::Node::~Node):
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::willDestroyDOMNodeImpl):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didRemoveDOMNode):
(WebCore::InspectorInstrumentation::willDestroyDOMNode):
* inspector/agents/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::didRemoveDOMNode):
* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::InspectorDOMAgent):
(WebCore::InspectorDOMAgent::reset):
(WebCore::InspectorDOMAgent::bind):
(WebCore::InspectorDOMAgent::unbind):
(WebCore::InspectorDOMAgent::getDocument):
(WebCore::InspectorDOMAgent::pushChildNodesToFrontend):
(WebCore::InspectorDOMAgent::discardBindings):
(WebCore::InspectorDOMAgent::pushNodePathToFrontend):
(WebCore::InspectorDOMAgent::boundNodeId):
- Add a check that the `Node*` is a valid key (not `nullptr`) before getting its id.
(WebCore::InspectorDOMAgent::buildObjectForNode):
(WebCore::InspectorDOMAgent::buildArrayForContainerChildren):
(WebCore::InspectorDOMAgent::buildArrayForPseudoElements):
(WebCore::InspectorDOMAgent::didCommitLoad):
(WebCore::InspectorDOMAgent::didInsertDOMNode):
(WebCore::InspectorDOMAgent::didRemoveDOMNode):
(WebCore::InspectorDOMAgent::willDestroyDOMNode):
(WebCore::InspectorDOMAgent::destroyedNodesTimerFired):
- Added instrumentation point for DOM nodes being destroyed so they can be removed from the agent, and the
frontend can also be informed of their ceasing to exist.
(WebCore::InspectorDOMAgent::characterDataModified):
(WebCore::InspectorDOMAgent::didInvalidateStyleAttr):
(WebCore::InspectorDOMAgent::didPushShadowRoot):
(WebCore::InspectorDOMAgent::willPopShadowRoot):
(WebCore::InspectorDOMAgent::didChangeCustomElementState):
(WebCore::InspectorDOMAgent::pseudoElementCreated):
(WebCore::InspectorDOMAgent::pseudoElementDestroyed):
(WebCore::InspectorDOMAgent::releaseDanglingNodes): Deleted.
- Removed usage of NodeToIdMap and nested maps of nodes throughout in favor of two inverse maps for relating
`Node`s and `NodeId`s. Because there is now a single set of canonical node maps, we no longer to to pass a
NodeToIdMap throughout the agent.
* inspector/agents/InspectorDOMAgent.h:
* inspector/agents/page/PageConsoleAgent.cpp:
(WebCore::PageConsoleAgent::PageConsoleAgent):
(WebCore::PageConsoleAgent::clearMessages):
* inspector/agents/page/PageConsoleAgent.h:
* inspector/agents/page/PageDOMDebuggerAgent.cpp:
(WebCore::PageDOMDebuggerAgent::willDestroyDOMNode):
* inspector/agents/page/PageDOMDebuggerAgent.h:
2021-06-11 Yusuke Suzuki <ysuzuki@apple.com>
Add fast-path for binding security check of DOMWindow
https://bugs.webkit.org/show_bug.cgi?id=226930
Reviewed by Geoffrey Garen.
The security check[1] must pass if the current JSDOMGlobalObject is the same to the accessed JSDOMWindow.
This clarification paves the way to emit JIT code which removes this security check when the lexical and
accessed JSGlobalObjects are the same.
[1]: https://html.spec.whatwg.org/multipage/browsers.html#integration-with-idl
* bindings/js/JSDOMBindingSecurity.cpp:
(WebCore::BindingSecurity::shouldAllowAccessToDOMWindow):
* bindings/js/JSDOMBindingSecurity.h:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateAttributeGetterBodyDefinition):
(GenerateAttributeSetterBodyDefinition):
(GenerateOperationBodyDefinition):
2021-06-11 Jonathan Bedard <jbedard@apple.com>
[Monterey] Support building WebKit
https://bugs.webkit.org/show_bug.cgi?id=226846
<rdar://problem/79095148>
Reviewed by Tim Horton.
Covered by exisiting tests.
* testing/Internals.cpp:
(WebCore::Internals::installImageOverlay): Explicitly define second arugment
to avoid 'missing field' compilation error.
2021-06-11 Chris Dumez <cdumez@apple.com>
Enable release logging in ephemeral sessions for parts of WebCore
https://bugs.webkit.org/show_bug.cgi?id=226929
Reviewed by Eric Carlson.
Enable release logging in ephemeral sessions for parts of WebCore, to facilitate debugging.
* dom/Document.cpp:
(WebCore::Document::canNavigate):
* dom/Document.h:
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::setRequest):
(WebCore::DocumentLoader::setMainDocumentError):
(WebCore::DocumentLoader::mainReceivedError):
(WebCore::DocumentLoader::frameDestroyed):
(WebCore::DocumentLoader::stopLoading):
(WebCore::DocumentLoader::notifyFinished):
(WebCore::DocumentLoader::willSendRequest):
(WebCore::DocumentLoader::tryLoadingSubstituteData):
(WebCore::DocumentLoader::disallowDataRequest const):
(WebCore::DocumentLoader::continueAfterContentPolicy):
(WebCore::DocumentLoader::attachToFrame):
(WebCore::DocumentLoader::detachFromFrame):
(WebCore::DocumentLoader::startLoadingMainResource):
(WebCore::DocumentLoader::loadMainResource):
(WebCore::DocumentLoader::cancelMainResourceLoad):
* loader/DocumentLoader.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::changeLocation):
(WebCore::FrameLoader::loadURLIntoChildFrame):
(WebCore::FrameLoader::loadArchive):
(WebCore::FrameLoader::loadInSameDocument):
(WebCore::FrameLoader::prepareForLoadStart):
(WebCore::FrameLoader::setupForReplace):
(WebCore::FrameLoader::loadFrameRequest):
(WebCore::FrameLoader::loadURL):
(WebCore::FrameLoader::load):
(WebCore::FrameLoader::loadWithNavigationAction):
(WebCore::FrameLoader::loadWithDocumentLoader):
(WebCore::FrameLoader::clearProvisionalLoadForPolicyCheck):
(WebCore::FrameLoader::reloadWithOverrideEncoding):
(WebCore::FrameLoader::reload):
(WebCore::FrameLoader::stopAllLoaders):
(WebCore::FrameLoader::stopForBackForwardCache):
(WebCore::FrameLoader::setDocumentLoader):
(WebCore::FrameLoader::setPolicyDocumentLoader):
(WebCore::FrameLoader::setProvisionalDocumentLoader):
(WebCore::FrameLoader::setState):
(WebCore::FrameLoader::clearProvisionalLoad):
(WebCore::FrameLoader::transitionToCommitted):
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
(WebCore::FrameLoader::loadPostRequest):
(WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy):
(WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
(WebCore::FrameLoader::loadDifferentDocumentItem):
(WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad):
* loader/FrameLoader.h:
* loader/ProgressTracker.cpp:
(WebCore::ProgressTracker::progressStarted):
(WebCore::ProgressTracker::progressCompleted):
(WebCore::ProgressTracker::finalProgressComplete):
* loader/ProgressTracker.h:
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::init):
(WebCore::ResourceLoader::loadDataURL):
(WebCore::ResourceLoader::willSendRequestInternal):
(WebCore::ResourceLoader::didReceiveResponse):
(WebCore::ResourceLoader::didFinishLoading):
(WebCore::ResourceLoader::didFinishLoadingOnePart):
(WebCore::ResourceLoader::didFail):
(WebCore::ResourceLoader::willSendRequestAsync):
(WebCore::ResourceLoader::wasBlocked):
(WebCore::ResourceLoader::cannotShowURL):
* loader/ResourceLoader.h:
(WebCore::ResourceLoader::frame const):
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::init):
(WebCore::SubresourceLoader::willSendRequestInternal):
(WebCore::SubresourceLoader::didReceiveResponse):
(WebCore::SubresourceLoader::didFinishLoading):
(WebCore::SubresourceLoader::didFail):
(WebCore::SubresourceLoader::willCancel):
(WebCore::SubresourceLoader::notifyDone):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::load):
(WebCore::CachedResource::redirectReceived):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::canRequestAfterRedirection const):
(WebCore::CachedResourceLoader::requestResource):
* loader/cache/CachedResourceLoader.h:
* page/Frame.cpp:
(WebCore::Frame::injectUserScriptImmediately):
* page/Frame.h:
* page/FrameView.cpp:
* page/Page.cpp:
* page/Page.h:
* page/PerformanceMonitor.cpp:
2021-06-11 Wenson Hsieh <wenson_hsieh@apple.com>
[Live Text] Text selection inside image elements should not be cleared upon resize
https://bugs.webkit.org/show_bug.cgi?id=226911
Reviewed by Tim Horton.
Refactor `HTMLElement::updateWithTextRecognitionResult`, such that it doesn't tear down and recreate the host
element's shadow DOM structure in the case where the extant DOM elements are compatible with the given text
recognition result. This prevents us from removing or inserting DOM elements in the case where an image element
is resized (and thus adjusts its shadow DOM content using the updated size), which in turn prevents us from
clearing out the text selection.
Test: fast/images/text-recognition/mac/image-overlay-maintain-selection-during-size-change.html
* editing/cocoa/DataDetection.h:
* editing/cocoa/DataDetection.mm:
Make this helper method return an HTMLDivElement instead of just an HTMLElement.
(WebCore::DataDetection::createElementForImageOverlay):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::updateWithTextRecognitionResult):
Split this method into two logical parts: the first builds up a TextRecognitionElements struct that contains
references to all connected elements in the image element's shadow DOM that require style updates due to the
new size; the second uses this TextRecognitionElements information to compute the new CSS transforms to apply to
each of the data detector, line containers, and text containers underneath each line container element.
Importantly, in step (1), we avoid regenerating shadow DOM content in the case where the DOM elements already
exist in their expected places within the shadow DOM.
2021-06-11 Megan Gardner <megan_gardner@apple.com>
Rename AppHighlight group to QuickNote to correctly reflect feature.
https://bugs.webkit.org/show_bug.cgi?id=226888
Reviewed by Tim Horton.
Rename only, no behavior change.
* Modules/highlight/AppHighlight.h:
(WebCore::AppHighlight::encode const):
(WebCore::AppHighlight::decode):
* Modules/highlight/AppHighlightStorage.cpp:
(WebCore::AppHighlightStorage::storeAppHighlight):
* Modules/highlight/AppHighlightStorage.h:
* en.lproj/Localizable.strings:
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
(WebCore::ContextMenuController::populate):
(WebCore::ContextMenuController::checkOrEnableIfNeeded const):
* platform/ContextMenuItem.cpp:
(WebCore::isValidContextMenuAction):
* platform/ContextMenuItem.h:
* platform/LocalizedStrings.h:
* platform/cocoa/LocalizedStringsCocoa.mm:
(WebCore::contextMenuItemTagAddHighlightToQuickNote):
(WebCore::contextMenuItemTagAddHighlightToNewQuickNote):
(WebCore::contextMenuItemTagAddHighlightToCurrentGroup): Deleted.
(WebCore::contextMenuItemTagAddHighlightToNewGroup): Deleted.
* testing/Internals.cpp:
(WebCore::Internals::appHighlightContextMenuItemTitles const):
2021-06-11 Cathie Chen <cathiechen@igalia.com>
Use HTMLDimension to parse different HTML attribute length values
https://bugs.webkit.org/show_bug.cgi?id=226810
Reviewed by Darin Adler.
This patch uses HTMLDimension to parse different kind of html length values which are defined in [1].
Then according the length types to determine if the value is valid.
[1] https://www.w3.org/TR/html4/sgml/dtd.html#Length
* html/HTMLElement.cpp:
(WebCore::HTMLElement::addHTMLLengthToStyle):
(WebCore::HTMLElement::addHTMLLengthToStyle): Add HTMLLength (including percentage values and pixel values) to style.
(WebCore::HTMLElement::addHTMLMultiLengthToStyle): Add MultiLength (including percentage, pixel and relative values) to style.
(WebCore::HTMLElement::addHTMLPixelsToStyle): Add pixel values to style.
(WebCore::HTMLElement::addHTMLNumberToStyle): Add number (including percentage values and numbers) to style.
* html/HTMLElement.h:
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::collectPresentationalHintsForAttribute): <img>'s width and height attributes are multiLength.
* html/HTMLMarqueeElement.cpp:
(WebCore::HTMLMarqueeElement::collectPresentationalHintsForAttribute): scrolldelayAttr and loopAttr are numbers.
* html/HTMLTableColElement.cpp:
(WebCore::HTMLTableColElement::collectPresentationalHintsForAttribute): <col>'s width and height attributes are multiLength.
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::collectPresentationalHintsForAttribute): <table>'s cellspacingAttr only supports pixel values.
* html/parser/HTMLParserIdioms.cpp:
(WebCore::parseHTMLDimensionInternal):
(WebCore::parseHTMLDimension):
(WebCore::parseHTMLMultiLength): MultiLength doesn't support relative_length (number + *), but make sure relative_length not be treated as a pixel value.
* html/parser/HTMLParserIdioms.h:
2021-06-11 Youenn Fablet <youenn@apple.com>
getDisplayMedia API doesn't work
https://bugs.webkit.org/show_bug.cgi?id=226874
<rdar://problem/79134041>
Reviewed by Eric Carlson.
Test: fast/mediastream/getDisplayMedia-frame-rate.html
* platform/mediastream/RealtimeVideoSource.cpp:
(WebCore::RealtimeVideoSource::videoSampleAvailable):
Only apply decimation in case frame rate is set.
2021-06-11 Alex Christensen <achristensen@webkit.org>
EventSource.constructor throws an exception when the url param is an empty string
https://bugs.webkit.org/show_bug.cgi?id=226635
Reviewed by Yusuke Suzuki.
* page/EventSource.cpp:
(WebCore::EventSource::create):
2021-06-11 Adrian Perez de Castro <aperez@igalia.com>
Unreviewed non-unified build fixes.
* loader/ResourceCryptographicDigest.cpp: Add missing SharedBuffer.h header.
* platform/network/soup/ResourceHandleSoup.cpp: Add missing SecurityOrigin.h header.
2021-06-11 Kimmo Kinnunen <kkinnunen@apple.com>
WebGL context image buffer accumulates the NativeImage contents when drawn to RemoteImageBufferProxy
https://bugs.webkit.org/show_bug.cgi?id=226813
<rdar://77421966>
Reviewed by Simon Fraser.
Add a workaround to flush WebGL element image buffer before
every new frame in order to clear the WebContent process side
NativeImage caches.
Test: webgl/draw-webgl-to-context2d-memory-test.html
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::paintRenderingResultsToCanvas):
2021-06-10 Chris Dumez <cdumez@apple.com>
CARingBuffer::frameOffset() makes incorrect assumptions about the frame count
https://bugs.webkit.org/show_bug.cgi?id=226253
<rdar://problem/78463453>
Reviewed by Eric Carlson.
CARingBuffer::frameOffset() was trying to avoid doing a `frameNumber % m_frameCount`
modulo operation by doing a `frameNumber & (m_frameCount - 1)`. However, this bitwise
operation is only equivalent if m_frameCount is a power of 2. It isn't enforced
anywhere that the frameCount is a power of 2. As a matter of fact, we frequently use
2*sampleRate which is often 2*44100=88200, which is NOT a power of 2.
When adding logging, I saw frameOffset(512) returning 0 for a frameCount of 88200, which
made no sense. It was causing offset0 and offset1 in CARingBuffer::fetchInternal() to
be both 0 (even though startRead was 0 and endRead was 512) and it was leading the
function to make bad computations.
To address the issue, I updated CARingBuffer::frameOffset() to use a simple modulo
operation. It is safer as it makes no assumption on the frame count and it is more
readable. If we're worried about the performance, we could alternatively round up the
frameCount to the next power of 2 and keep using the bitwise operation, but I am
personally do not think it is worth it.
* platform/audio/cocoa/CARingBuffer.cpp:
(WebCore::CARingBuffer::initializeAfterAllocation):
* platform/audio/cocoa/CARingBuffer.h:
(WebCore::CARingBuffer::frameOffset):
2021-06-10 Yury Semikhatsky <yurys@chromium.org>
[REGRESSION][Curl] Network::ResourceTiming are broken after r278391
https://bugs.webkit.org/show_bug.cgi?id=226901
Reviewed by Fujii Hironori.
Initialize fetchStart with startTime in Curl.
No new tests.
* platform/network/curl/CurlContext.cpp:
(WebCore::CurlHandle::getNetworkLoadMetrics):
2021-06-10 Sam Weinig <weinig@apple.com>
Nothing is keeping navigator.xr alive during GC
https://bugs.webkit.org/show_bug.cgi?id=226898
Reviewed by Chris Dumez.
Ensure the navigator.xr wrapper is kept alive when it has custom properties
by annotating it with `GenerateIsReachable=ReachableFromNavigator`.
Test: webxr/gc.html
* Modules/webxr/NavigatorWebXR.cpp:
(WebCore::NavigatorWebXR::xr):
* Modules/webxr/WebXRSystem.cpp:
(WebCore::WebXRSystem::create):
(WebCore::WebXRSystem::WebXRSystem):
(WebCore::WebXRSystem::navigator):
* Modules/webxr/WebXRSystem.h:
* Modules/webxr/WebXRSystem.idl:
2021-06-10 Chris Dumez <cdumez@apple.com>
Drop unnecessary call to StringView::toStringWithoutCopying() in shouldTreatAsPotentiallyTrustworthy()
https://bugs.webkit.org/show_bug.cgi?id=226907
Reviewed by Darin Adler.
Drop unnecessary call to StringView::toStringWithoutCopying() in shouldTreatAsPotentiallyTrustworthy() since
the function we're calling takes a StringView.
* page/SecurityOrigin.cpp:
(WebCore::shouldTreatAsPotentiallyTrustworthy):
2021-06-10 Wenson Hsieh <wenson_hsieh@apple.com>
[Live Text] Add a mechanism to regenerate text in an image element when it changes dimensions
https://bugs.webkit.org/show_bug.cgi?id=226858
rdar://77522786
Reviewed by Devin Rousso.
Push `m_elementsWithTextRecognitionResults` from WebPage down to Page, and additionally keep track of a
TextRecognitionResult per element, as well as the size of the element at the time when we last injected text
recognition results. Use this information to tell elements to update their OCR text containers if their
dimenions have changed since the last update, after finishing a rendering update.
Test: fast/images/text-recognition/image-overlay-size-change.html
* html/HTMLElement.cpp:
(WebCore::HTMLElement::updateWithTextRecognitionResult):
Refactor this to take a `const TextRecognitionResult&` instead of a `TextRecognitionResult&&`, since this method
doesn't actually take ownership of the TextRecognitionResult. This allows us to avoid explicitly copying a
TextRecognitionResult when calling this method from `Page::updateElementsWithTextRecognitionResults`. Also, add
a CacheTextRecognitionResults enum flag as an argument, to avoid entering `Page::cacheTextRecognitionResult`
every time we update a resized element in `Page::updateElementsWithTextRecognitionResults`; since we know that
the dimensions are the only thing that changed, we simply update the cached dimensions.
Call into `Page::cacheTextRecognitionResult` to store per-element TextRecognitionResults when we
finish injecting the OCR text and data detectors into the image element.
* html/HTMLElement.h:
* page/Page.cpp:
(WebCore::Page::didCommitLoad):
Clear out both `m_textRecognitionResultsByElement` and `m_elementsWithTextRecognitionResults`.
(WebCore::Page::doAfterUpdateRendering):
At the end of each rendering update, go through `m_elementsWithTextRecognitionResults` and check if any of the
elements' dimensions have changed; if so, tell those elements to re-update their OCR text quads and data
detectors in the UA shadow tree.
(WebCore::Page::resetTextRecognitionResults):
(WebCore::Page::updateElementsWithTextRecognitionResults):
(WebCore::Page::hasCachedTextRecognitionResult const):
(WebCore::Page::cacheTextRecognitionResult):
Add the element to `m_elementsWithTextRecognitionResults` and `m_textRecognitionResultsByElement`, appending a
new entry to `m_textRecognitionResultsByElement` only if necessary.
* page/Page.h:
2021-06-10 Chris Dumez <cdumez@apple.com>
REGRESSION: (r278544) [ Mac-wk1 ] media/media-continues-playing-after-replace-source.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=226899
<rdar://problem/79160701>
Reviewed by Ryosuke Niwa.
Have MediaPlayerPrivateAVFoundationObjC schedule tasks on the HTML event loop instead of simply using
callOnMainThread() to address flakiness issues, since the rest of the media code uses the HTML event
loop.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerQueueTaskOnEventLoop):
* html/HTMLMediaElement.h:
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::queueTaskOnEventLoop):
* platform/graphics/MediaPlayer.h:
(WebCore::MediaPlayerClient::mediaPlayerQueueTaskOnEventLoop):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::queueTaskOnEventLoop):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(-[WebCoreAVFMovieObserver metadataLoaded]):
(-[WebCoreAVFMovieObserver didEnd:]):
(-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
(-[WebCoreAVFMovieObserver legibleOutput:didOutputAttributedStrings:nativeSampleBuffers:forItemTime:]):
(-[WebCoreAVFMovieObserver outputSequenceWasFlushed:]):
(-[WebCoreAVFMovieObserver metadataOutput:didOutputTimedMetadataGroups:fromPlayerItemTrack:]):
(-[WebCoreAVFMovieObserver metadataCollector:didCollectDateRangeMetadataGroups:indexesOfNewGroups:indexesOfModifiedGroups:]):
(-[WebCoreAVFLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]):
(-[WebCoreAVFLoaderDelegate resourceLoader:didCancelLoadingRequest:]):
2021-06-10 Alex Christensen <achristensen@webkit.org>
Move Timing-Allow-Origin checks to the network process
https://bugs.webkit.org/show_bug.cgi?id=226678
<rdar://problem/45227788>
Reviewed by Chris Dumez.
We tried hard to do it in the web process by keeping track of whether the last redirect was cross-origin
and checking the final response and original security origin. We got many tests to pass, but to get the rest
and be correct, we need to check the Timing-Allow-Origin header field of each redirect against the original security origin.
Tests: imported/w3c/web-platform-tests/resource-timing/SO-XO-SO-redirect-chain-tao.https.html
imported/w3c/web-platform-tests/resource-timing/TAO-match.html
imported/w3c/web-platform-tests/resource-timing/TAO-null-opaque-origin.html
imported/w3c/web-platform-tests/resource-timing/TAO-port-mismatch-means-crossorigin.html
imported/w3c/web-platform-tests/resource-timing/connection-reuse.html
imported/w3c/web-platform-tests/resource-timing/connection-reuse.https.html
imported/w3c/web-platform-tests/resource-timing/cross-origin-start-end-time-with-redirects.html
imported/w3c/web-platform-tests/resource-timing/document-domain-no-impact-opener.html
imported/w3c/web-platform-tests/resource-timing/entry-attributes.html
imported/w3c/web-platform-tests/resource-timing/fetch-cross-origin-redirect.https.html
imported/w3c/web-platform-tests/resource-timing/font-timestamps.html
imported/w3c/web-platform-tests/resource-timing/iframe-failed-commit.html
imported/w3c/web-platform-tests/resource-timing/initiator-type-for-script.html
imported/w3c/web-platform-tests/resource-timing/nextHopProtocol-is-tao-protected.https.html
imported/w3c/web-platform-tests/resource-timing/object-not-found-after-TAO-cross-origin-redirect.html
imported/w3c/web-platform-tests/resource-timing/object-not-found-after-cross-origin-redirect.html
imported/w3c/web-platform-tests/resource-timing/redirects.html
imported/w3c/web-platform-tests/resource-timing/resource-ignore-data-url.html
imported/w3c/web-platform-tests/resource-timing/resource_cached.html
imported/w3c/web-platform-tests/resource-timing/resource_timing_content_length.html
imported/w3c/web-platform-tests/resource-timing/same-origin-from-cross-origin-redirect.html
imported/w3c/web-platform-tests/resource-timing/sizes-redirect-img.html
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::start):
Get a SecurityOrigin for our WebKitLegacy ResourceHandle use like we do in WebLoaderStrategy::scheduleLoadFromNetworkProcess
* loader/ResourceTiming.cpp:
(WebCore::ResourceTiming::ResourceTiming):
(WebCore::ResourceTiming::initServerTiming):
(WebCore::ResourceTiming::isolatedCopy const):
(WebCore::passesTimingAllowCheck): Deleted.
* loader/ResourceTiming.h:
(WebCore::ResourceTiming::networkLoadMetrics const):
(WebCore::ResourceTiming::ResourceTiming):
(WebCore::ResourceTiming::allowTimingDetails const): Deleted.
(): Deleted.
* page/PerformanceNavigation.cpp:
(WebCore::PerformanceNavigation::redirectCount const):
* page/PerformanceNavigationTiming.cpp:
(WebCore::PerformanceNavigationTiming::sameOriginCheckFails const):
(WebCore::PerformanceNavigationTiming::redirectCount const):
* page/PerformanceResourceTiming.cpp:
(WebCore::entryStartTime):
(WebCore::entryEndTime):
(WebCore::PerformanceResourceTiming::redirectStart const):
(WebCore::PerformanceResourceTiming::redirectEnd const):
(WebCore::PerformanceResourceTiming::domainLookupStart const):
(WebCore::PerformanceResourceTiming::domainLookupEnd const):
(WebCore::PerformanceResourceTiming::connectStart const):
(WebCore::PerformanceResourceTiming::connectEnd const):
(WebCore::PerformanceResourceTiming::secureConnectionStart const):
(WebCore::PerformanceResourceTiming::requestStart const):
(WebCore::PerformanceResourceTiming::responseStart const):
(WebCore::PerformanceResourceTiming::transferSize const):
(WebCore::PerformanceResourceTiming::encodedBodySize const):
(WebCore::PerformanceResourceTiming::decodedBodySize const):
* page/PerformanceTiming.cpp:
(WebCore::PerformanceTiming::unloadEventStart const):
(WebCore::PerformanceTiming::unloadEventEnd const):
(WebCore::PerformanceTiming::redirectStart const):
(WebCore::PerformanceTiming::redirectEnd const):
* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::BlobResourceHandle):
* platform/network/NetworkLoadMetrics.h:
(WebCore::NetworkLoadMetrics::isolatedCopy const):
(WebCore::NetworkLoadMetrics::operator== const):
(WebCore::NetworkLoadMetrics::encode const):
(WebCore::NetworkLoadMetrics::decode):
* platform/network/ResourceHandle.cpp:
(WebCore::ResourceHandle::ResourceHandle):
(WebCore::ResourceHandle::create):
(WebCore::ResourceHandle::loadResourceSynchronously):
(WebCore::ResourceHandle::isCrossOriginWithoutTAO const):
(WebCore::ResourceHandle::markAsCrossOriginWithoutTAO):
(WebCore::ResourceHandle::sourceOrigin const):
(WebCore::ResourceHandle::hasCrossOriginRedirect const): Deleted.
(WebCore::ResourceHandle::setHasCrossOriginRedirect): Deleted.
* platform/network/ResourceHandle.h:
* platform/network/ResourceHandleInternal.h:
(WebCore::ResourceHandleInternal::ResourceHandleInternal):
* platform/network/TimingAllowOrigin.cpp: Added.
(WebCore::passesTimingAllowOriginCheck):
* platform/network/TimingAllowOrigin.h: Added.
* platform/network/cocoa/NetworkLoadMetrics.mm:
(WebCore::packageTimingData):
(WebCore::copyTimingData):
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::platformLoadResourceSynchronously):
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
2021-06-10 Alex Christensen <achristensen@webkit.org>
Origin is null in http requests when baseURL has custom scheme on iOS 15.0
https://bugs.webkit.org/show_bug.cgi?id=226760
<rdar://79027280>
Reviewed by Chris Dumez.
This fixes a regression from r272469 where I made two mistakes.
1. I made schemes handled by a WKURLSchemeHandler able to create non-null origins to increase compatibility.
I forgot that one can also call loadHTMLString and pass a baseURL that can be a custom scheme.
In this case, the custom scheme is also treated as the "origin" so it should be non-null.
2. When updateRequestForAccessControl is called in the Network Process, it uses SecurityOrigins that have been
serialized and deserialized then passed through the SecurityOrigin constructor, which doesn't know about the
registry of custom schemes that are handled for that WKWebView and may deserialize to a different (null) origin.
We want to deserialize the origin having been made with the rules of SecurityOrigins in the Web Process, so
set its data to be the same as the serialized data.
I added a unit test to prevent future regression.
* page/SecurityOrigin.h:
(WebCore::SecurityOrigin::decode):
2021-06-10 Arcady Goldmints-Orlov <agoldmints@igalia.com>
[Cairo] Fix Path::boundingRectSlowCase when the path is a single MoveTo
https://bugs.webkit.org/show_bug.cgi?id=226613
Cairo says there is no bounding rectangle in this case, whereas the SVG
standard says there it should be a zero-size rectangle at the moved-to
point. This fixes the recently added test
fast/svg/bounding-rect-for-path-with-only-move-command.html
Reviewed by Fujii Hironori.
* platform/graphics/cairo/PathCairo.cpp:
(WebCore::Path::boundingRectSlowCase const):
2021-06-10 Chris Dumez <cdumez@apple.com>
Fix incorrect check in AudioNode.disconnect()
https://bugs.webkit.org/show_bug.cgi?id=226818
<rdar://problem/79076999>
Reviewed by Eric Carlson.
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::disconnect):
2021-06-10 Toshio Ogasawara <toshio.ogasawara@access-company.com>
[MSE] When currentTime is a large value, it takes time to process SourceBufferPrivate::evictCodedFrames().
https://bugs.webkit.org/show_bug.cgi?id=226867
Reviewed by Eric Carlson.
SourceBufferPrivate::evictCodedFrames() now starts with the earliest PTS value
in trackBuffer instead of MediaTime::zeroTime() to avoid unnecessary loops.
Test: media/media-source/media-source-evict-codedframe-large-currenttime.html
* platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::evictCodedFrames):
2021-06-10 Andres Gonzalez <andresg_22@apple.com>
iOS - VoiceOver reads the programmatically associated label instead of the accessible name provided via the aria-label or aria-labelledby attribute
https://bugs.webkit.org/show_bug.cgi?id=226534
rdar://65935211
Reviewed by Chris Fleizach.
The problem is due to VoiceOver retrieving the titleUIElement for the
given object, and using the label of that title element as the label of
the object in question. The solution in this patch is to only return a
title element if the object can have title elements (if exposesTitleUIElement
is true). This check was missing in AccessibilityRenderObject::titleUIElement.
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::exposesTitleUIElement const):
This method is no longer necessary in the AXCoreObject interface,
instead is a virtual in the AXObject class hierarchy.
* accessibility/AccessibilityObjectInterface.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::titleUIElement const):
Checks whether this object can have a title element.
(WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
(WebCore::AccessibilityRenderObject::accessibilityHitTest const):
* accessibility/AccessibilityRenderObject.h:
* accessibility/atk/WebKitAccessibleUtil.cpp:
(accessibilityTitle):
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::initializeAttributeData):
No need to cache this value any more.
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/isolatedtree/AXIsolatedTree.h:
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
* accessibility/win/AccessibilityObjectWrapperWin.cpp:
(WebCore::AccessibilityObjectWrapper::accessibilityAttributeValue):
2021-06-10 Ben Nham <nham@apple.com>
Only cache GET requests in the memory cache
https://bugs.webkit.org/show_bug.cgi?id=226359
Reviewed by Geoff Garen.
Test: http/tests/cache/memory-cache-only-caches-get.html
We only cache GET requests at the disk cache level, but we don't have that same restriction
at the memory cache level. We should make the policies match. In particular, in long-running
webpages, we're accumulating POSTs from XMLHttpRequests in our memory cache and should stop
doing that, since POST response caching is generally not used or expected.
I also changed InspectorInstrumentation::willSendRequest to take an optional CachedResource
parameter because it currently uses InspectorPageAgent::cachedResource to find the resource,
which in turn expects to find the resource in the memory cache. That doesn't work anymore
for these non-GET requests, so we now pass down the CachedResource explicitly in the cases
where that's necessary.
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::willSendRequestImpl):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::willSendRequest):
* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::resourceTypeForCachedResource):
(WebCore::InspectorNetworkAgent::willSendRequest):
* inspector/agents/InspectorNetworkAgent.h:
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::tryLoadingSubstituteData):
(WebCore::DocumentLoader::addSubresourceLoader):
(WebCore::DocumentLoader::loadMainResource):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::requestFromDelegate):
* loader/ResourceLoadNotifier.cpp:
(WebCore::ResourceLoadNotifier::willSendRequest):
(WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
* loader/ResourceLoadNotifier.h:
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::willSendRequestInternal):
* loader/ResourceLoader.h:
(WebCore::ResourceLoader::cachedResource const):
* loader/SubresourceLoader.cpp:
* loader/SubresourceLoader.h:
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::update):
(WebCore::ApplicationCacheGroup::startLoadingEntry):
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::add):
2021-06-10 Chris Dumez <cdumez@apple.com>
Replace ReadableStreamChunk struct with a WTF::Span
https://bugs.webkit.org/show_bug.cgi?id=226879
Reviewed by Alex Christensen.
Replace ReadableStreamChunk struct with a WTF::Span now that we support
Span and they are essentially the same thing.
* Headers.cmake:
* Modules/cache/DOMCache.cpp:
(WebCore::DOMCache::addAll):
(WebCore::DOMCache::put):
* Modules/fetch/FetchBodyConsumer.cpp:
(WebCore::FetchBodyConsumer::resolve):
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::BodyLoader::didReceiveData):
(WebCore::FetchResponse::BodyLoader::consumeDataByChunk):
* Modules/fetch/FetchResponse.h:
* Modules/streams/ReadableStreamChunk.h: Removed.
* Modules/streams/ReadableStreamSink.cpp:
(WebCore::ReadableStreamToSharedBufferSink::enqueue):
* Modules/streams/ReadableStreamSink.h:
* WebCore.xcodeproj/project.pbxproj:
* workers/service/context/ServiceWorkerFetch.cpp:
2021-06-10 Chris Dumez <cdumez@apple.com>
Enable WebPage's release logging in ephemeral sessions
https://bugs.webkit.org/show_bug.cgi?id=226510
Reviewed by Eric Carlson.
Enable WebPage's release logging in ephemeral sessions. Our release logging doesn't contain
anything sensitive and not having this logging makes it hard to debug issues in apps using
ephemeral sessions.
* Modules/applepay/PaymentCoordinator.cpp:
(WebCore::PaymentCoordinator::supportsVersion const):
(WebCore::PaymentCoordinator::canMakePayments):
(WebCore::PaymentCoordinator::canMakePaymentsWithActiveCard):
(WebCore::PaymentCoordinator::openPaymentSetup):
(WebCore::PaymentCoordinator::beginPaymentSession):
(WebCore::PaymentCoordinator::completeMerchantValidation):
(WebCore::PaymentCoordinator::completeShippingMethodSelection):
(WebCore::PaymentCoordinator::completeShippingContactSelection):
(WebCore::PaymentCoordinator::completePaymentMethodSelection):
(WebCore::PaymentCoordinator::completePaymentMethodModeChange):
(WebCore::PaymentCoordinator::completePaymentSession):
(WebCore::PaymentCoordinator::abortPaymentSession):
(WebCore::PaymentCoordinator::cancelPaymentSession):
(WebCore::PaymentCoordinator::validateMerchant):
(WebCore::PaymentCoordinator::didAuthorizePayment):
(WebCore::PaymentCoordinator::didSelectPaymentMethod):
(WebCore::PaymentCoordinator::didSelectShippingMethod):
(WebCore::PaymentCoordinator::didSelectShippingContact):
(WebCore::PaymentCoordinator::didChangePaymentMethodMode):
(WebCore::PaymentCoordinator::didCancelPaymentSession):
(WebCore::PaymentCoordinator::shouldEnableApplePayAPIs const):
(WebCore::PaymentCoordinator::setApplePayIsActiveIfAllowed const):
(WebCore::PaymentCoordinator::shouldAllowUserAgentScripts const):
(WebCore::PaymentCoordinator::getSetupFeatures):
(WebCore::PaymentCoordinator::beginApplePaySetup):
(WebCore::PaymentCoordinator::endApplePaySetup):
* Modules/applepay/PaymentCoordinatorClient.h:
* testing/MockPaymentCoordinator.h:
2021-06-10 Youenn Fablet <youenn@apple.com>
CountQueuingStrategy.constructor misses checking the type of init param
https://bugs.webkit.org/show_bug.cgi?id=226759
Reviewed by Chris Dumez.
Now that streams are WebIDLed, add related parameter type checks.
Covered by rebased tests.
* Modules/streams/CountQueuingStrategy.js:
(initializeCountQueuingStrategy):
2021-06-10 Rob Buis <rbuis@igalia.com>
Treat intrinsic like *-content
https://bugs.webkit.org/show_bug.cgi?id=226790
Reviewed by Sergio Villar Senin.
Treat intrinsic like *-content for intrinsic logical
content calculations.
Tests: fast/flexbox/intrinsic-width-column-flow-crash.html
fast/flexbox/intrinsic-width-crash.html
fast/flexbox/min-intrinsic-width-crash.html
* platform/Length.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeIntrinsicLogicalContentHeightUsing const):
(WebCore::RenderBox::computeContentAndScrollbarLogicalHeightUsing const):
2021-06-10 Chris Dumez <cdumez@apple.com>
Fix some inefficient uses of SharedBuffer
https://bugs.webkit.org/show_bug.cgi?id=226857
Reviewed by Darin Adler.
Fix some inefficient uses of SharedBuffer:
- Avoid calling SharedBuffer::data() whenever possible since this function
may have to combine internal segments of SharedBuffer. Added a convenience
function on SharedBuffer (forEachSegment()) to get the data pointer / size
of each segment.
- Avoid some unnecessary construction of SharedBuffer simply to get a Vector.
We should construct the Vector directly in such cases. I dropped the
Blob factory that took in a SharedBuffer as it was inefficient and frequently
called instead of the more efficient factory that takes in a Vector<uint8_t>.
- Add convenience functions to SharedBuffer that return a Vector, including one
named takeData() that avoids copying the data.
- Add convenience functions to SharedBuffer for doing a prefix check or copying
to a destination pointer.
* Modules/async-clipboard/ClipboardItem.cpp:
(WebCore::ClipboardItem::blobFromString):
* Modules/async-clipboard/ios/ClipboardImageReaderIOS.mm:
(WebCore::ClipboardImageReader::readBuffer):
* Modules/async-clipboard/mac/ClipboardImageReaderMac.mm:
(WebCore::ClipboardImageReader::readBuffer):
* Modules/fetch/FetchBodyConsumer.cpp:
(WebCore::blobFromData):
(WebCore::packageFormData):
(WebCore::resolveWithTypeAndData):
(WebCore::FetchBodyConsumer::takeAsBlob):
* Modules/indexeddb/IDBGetResult.cpp:
* Modules/indexeddb/IDBGetResult.h:
* Modules/mediarecorder/MediaRecorder.cpp:
(WebCore::createDataAvailableEvent):
* Modules/mediastream/RTCDataChannel.cpp:
(WebCore::RTCDataChannel::didReceiveRawData):
* editing/WebCorePasteboardFileReader.cpp:
(WebCore::WebCorePasteboardFileReader::readBuffer):
* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::createFragmentForImageAttachment):
(WebCore::replaceRichContentWithAttachments):
(WebCore::createFragmentAndAddResources):
(WebCore::sanitizeMarkupWithArchive):
(WebCore::WebContentReader::readImage):
(WebCore::attachmentForData):
* editing/gtk/WebContentReaderGtk.cpp:
(WebCore::WebContentReader::readImage):
* fileapi/Blob.cpp:
* fileapi/Blob.h:
* fileapi/NetworkSendQueue.cpp:
(WebCore::NetworkSendQueue::processMessages):
* html/HTMLAttachmentElement.cpp:
(WebCore::HTMLAttachmentElement::updateEnclosingImageWithData):
* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::didReceiveResponse):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::continueAfterContentPolicy):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::didFinishLoading):
(WebCore::DocumentThreadableLoader::loadRequest):
* loader/NetscapePlugInStreamLoader.cpp:
(WebCore::NetscapePlugInStreamLoader::didReceiveDataOrBuffer):
* loader/ResourceCryptographicDigest.cpp:
(WebCore::cryptographicDigestForSharedBuffer):
* loader/ResourceCryptographicDigest.h:
* loader/SubresourceIntegrity.cpp:
(WebCore::matchIntegrityMetadata):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::writeDataToUniqueFileInDirectory):
* loader/cache/CachedRawResource.cpp:
(WebCore::CachedRawResource::didAddClient):
* loader/icon/IconLoader.cpp:
(WebCore::IconLoader::notifyFinished):
* platform/SharedBuffer.cpp:
(WebCore::combineSegmentsData):
(WebCore::SharedBuffer::combineIntoOneSegment const):
(WebCore::SharedBuffer::data const):
(WebCore::SharedBuffer::takeData):
(WebCore::SharedBuffer::toHexString const):
(WebCore::SharedBuffer::forEachSegment const):
(WebCore::SharedBuffer::startsWith const):
(WebCore::SharedBuffer::copyTo const):
* platform/SharedBuffer.h:
* platform/cf/SharedBufferCF.cpp:
(WebCore::SharedBuffer::createCFData const):
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemBuffer::append):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged):
* workers/ScriptBuffer.cpp:
(WebCore::ScriptBuffer::toString const):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::createResponseBlob):
2021-06-10 Youenn Fablet <youenn@apple.com> and Victor M. Jaquez L. <vjaquez@igalia.com>
Update libwebrtc to M92
https://bugs.webkit.org/show_bug.cgi?id=226494
Reviewed by Eric Carlson.
Covered by existing tests.
* Configurations/WebCore.xcconfig:
* Configurations/WebCoreTestSupport.xcconfig:
* Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.cpp:
(WebCore::LibWebRTCRtpReceiverBackend::createSource):
* Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp:
(WebCore::fillInboundRtpStreamStats):
(WebCore::fillOutboundRtpStreamStats):
(WebCore::fillRTCIceCandidateStats):
* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::LibWebRTCProvider::signalingThread):
(WebCore::LibWebRTCProvider::createPeerConnectionFactory):
(WebCore::LibWebRTCProvider::setPeerConnectionFactory):
(WebCore::LibWebRTCProvider::createPeerConnection):
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:
* testing/MockLibWebRTCPeerConnection.cpp:
(WebCore::createConnection):
(WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnectionOrError):
* testing/MockLibWebRTCPeerConnection.h:
2021-06-10 Adrian Perez de Castro <aperez@igalia.com>
Non-unified build fixes, early May 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=226763
Unreviewed non-unified build fixes.
* css/calc/CSSCalcValue.cpp: Add missing CSSCalcSymbolTable.h header.
* layout/formattingContexts/inline/text/TextUtil.h: Add missing forward declaration for
InlineTextBox class.
* loader/MixedContentChecker.h: Add missing <optional> header.
* page/FrameSnapshotting.cpp: Remove unneeded inclusion of DestinationColorSpace.h and
wtf/OptionSet.h headers.
* page/FrameSnapshotting.h: Add mission DestinationColorSpace.h and wtf/OptionSet.h headers,
remove now unneeded wtf/Forward.h heeder and forward declaration for the
DestinationColorSpace class.
* platform/DateComponents.h: Add missing <optional> header, remove unneeded <limits> header.
* platform/Theme.h: Add missin <optional> header.
* platform/graphics/HEVCUtilities.h: Ditto.
* rendering/HighlightData.h: Add missing forward declaration for the RenderText class.
* rendering/MarkedText.cpp: Add missing HighlightData.h header.
* rendering/RenderLineBoxList.cpp: Add missing inclusion of the LegacyInlineElementBox.h
header.
* style/StyleAdjuster.cpp: Add missing ShadowRoot.h header.
* svg/SVGToOTFFontConversion.h: Add missing <optional> header.
* workers/service/ServiceWorkerClientQueryOptions.h: Ditto.
2021-06-09 Rob Buis <rbuis@igalia.com>
Null check page in generateCertificate
https://bugs.webkit.org/show_bug.cgi?id=226798
Reviewed by Youenn Fablet.
Null check page in generateCertificate.
Test: http/wpt/webrtc/RTCPeerConnection-generateCertificate-crash.html
* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::generateCertificate):
2021-06-09 Cameron McCormack <heycam@apple.com>
Add window.internals.log()
https://bugs.webkit.org/show_bug.cgi?id=226403
Reviewed by Tim Horton.
window.internals.log() writes output to stderr using WTFLogAlways.
This may be useful for interleaving some output generated from within a
test with WebCore logging, which also goes to stderr. console.log()
doesn't work for this, since that goes to stdout and is captured as
the test output.
* testing/Internals.cpp:
(WebCore::Internals::log):
* testing/Internals.h:
* testing/Internals.idl:
2021-06-09 Cathie Chen <cathiechen@igalia.com>
Aspect ratio from width and height attribute is not compatible to string with invalid ends
https://bugs.webkit.org/show_bug.cgi?id=226469
Reviewed by Antti Koivisto.
The patch follows the steps defined in [1] to parse the dimension values from the attribute values.
It adds HTMLDimension to present the dimension value which has two types, Percentage and Pixel.
And parseHTMLDimension() follows the specification steps to check validation and parse the dimension
value. Currently, it is only used by parsing aspect-ratio from width and height attributes. It will
apply to other attributes length parse in the future patch.
[1] https://html.spec.whatwg.org/#rules-for-parsing-dimension-values
* html/HTMLElement.cpp:
(WebCore::HTMLElement::applyAspectRatioFromWidthAndHeightAttributesToStyle): Call parseHTMLDimension to get the length values.
* html/parser/HTMLParserIdioms.cpp:
(WebCore::parseHTMLDimensionNumber):
(WebCore::parseHTMLDimension):
* html/parser/HTMLParserIdioms.h:
2021-06-09 Andres Gonzalez <andresg_22@apple.com>
iOS - VoiceOver reads the old heading text when updated with heading.firstChild.data.
https://bugs.webkit.org/show_bug.cgi?id=226754
rdar://44949563
Reviewed by Chris Fleizach.
Tests: accessibility/ios-simulator/heading-text-updates.html
accessibility/mac/heading-text-updates.html
The problem was caused by [WebAccessibilityObjectWrapper _accessibilityTraitsFromAncestors]
setting the value and label of static text inside headings. since this
method is called only on the initialization of the object, the label is
never updated when the text changes.
The solution is to move the logic to return the label and value of
static text inside headings to the accessibilityLabel and accessibilityValue
respectively.
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _accessibilityTraitsFromAncestors]):
(-[WebAccessibilityObjectWrapper accessibilityLabel]):
(-[WebAccessibilityObjectWrapper accessibilityValue]):
2021-06-09 Eric Carlson <eric.carlson@apple.com>
Nullptr crash in MediaSource::updateBufferedIfNeeded
https://bugs.webkit.org/show_bug.cgi?id=226851
rdar://79059134
Reviewed by Devin Rousso.
No new tests, I was unable to come up with a reproducible case.
* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::updateBufferedIfNeeded): NULL-check `m_private`.
2021-06-09 Chris Dumez <cdumez@apple.com>
Avoid some calls to StringView::toString() / StringView::toStringWithoutCopying()
https://bugs.webkit.org/show_bug.cgi?id=226803
Reviewed by Darin Adler.
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFontVariationTag):
* page/FrameView.cpp:
(WebCore::FrameView::scrollToFragmentInternal):
* platform/text/hyphen/HyphenationLibHyphen.cpp:
(WebCore::lastHyphenLocation):
* rendering/RenderTreeAsText.cpp:
(WebCore::writeDebugInfo):
2021-06-09 Tyler Wilcock <twilco.o@protonmail.com>
[css-counter-styles] Mark counter-style descriptors as "descriptor-only"
https://bugs.webkit.org/show_bug.cgi?id=226792
Reviewed by Simon Fraser.
* css/CSSProperties.json:
Mark @counter-style rule descriptors (additive-symbols, fallback, pad,
symbols, negative, prefix, range, suffix, system) as "descriptor-only".
Note that while `speak-as` is also a valid descriptor for
@counter-style rules, it is deliberately excluded from this change as
it is also a property in the CSS Speech specification.
https://www.w3.org/TR/css-speech-1/#speaking-props-speak-as
2021-06-09 Alex Christensen <achristensen@webkit.org>
Performance API: Implement performance.timeOrigin
https://bugs.webkit.org/show_bug.cgi?id=174862
Reviewed by Ryosuke Niwa.
* page/Performance.cpp:
(WebCore::Performance::timeOrigin const):
* page/Performance.h:
* page/Performance.idl:
2021-06-09 Simon Fraser <simon.fraser@apple.com>
Unreviewed Windows build fix.
* rendering/RenderLayerScrollableArea.cpp:
2021-06-09 Simon Fraser <simon.fraser@apple.com>
Clean up scrollbar creation code in RenderLayerScrollableArea
https://bugs.webkit.org/show_bug.cgi?id=226805
Reviewed by Alan Bujtas.
Share code between updateScrollbarsAfterStyleChange() and updateScrollbarsAfterLayout() which
had a lot of common logic. updateScrollbarPresenceAndState() takes two optionals, indicating
whether information about overflow is available (which is only the case after layout).
Also make lots of member function declarations private in RenderLayerScrollableArea.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateScrollingNodeLayers):
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::updateScrollbarPresenceAndState):
(WebCore::RenderLayerScrollableArea::updateScrollbarsAfterStyleChange):
(WebCore::RenderLayerScrollableArea::updateScrollbarsAfterLayout):
* rendering/RenderLayerScrollableArea.h:
2021-06-09 Alan Bujtas <zalan@apple.com>
[Flexbox] FlexItem stays invisible after initial layout
https://bugs.webkit.org/show_bug.cgi?id=226778
Reviewed by Simon Fraser.
RenderFlexibleBox::layoutAndPlaceChildren() initiates repaint() on newly constructed flex items by checking their everHadLayout bit.
This is similar to what we do for regular block layout when block level boxes appear.
However flexitems are laid out multiple times, first right after they are constructed in constructFlexItem. This initial layout
sets everHadLayout bit to true which makes the check in layoutAndPlaceChildren somewhat late.
Test: fast/flexbox/repaint-issue-when-flex-item-appears.html
* rendering/FlexibleBoxAlgorithm.cpp:
(WebCore::FlexItem::FlexItem):
* rendering/FlexibleBoxAlgorithm.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::constructFlexItem):
(WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
2021-06-09 Alexander Mikhaylenko <alexm@gnome.org>
[GTK4] Add support for navigation gestures
https://bugs.webkit.org/show_bug.cgi?id=212327
Reviewed by Michael Catanzaro.
Support GskRenderNode for GRefPtr.
* platform/gtk/GRefPtrGtk.cpp:
(WTF::refGPtr):
(WTF::derefGPtr):
* platform/gtk/GRefPtrGtk.h:
2021-06-09 Alicia Boya García <aboya@igalia.com>
[WTF][GStreamer] Add RAII lockers for 3rd party locks
https://bugs.webkit.org/show_bug.cgi?id=225650
Reviewed by Xabier Rodriguez-Calvar.
This patch introduces RAII locker classes that wrap GST_OBJECT_LOCK
and GST_PAD_STREAM_LOCK to match the style, safety and convenience of
locks from WTF.
This patch also changes all usages of GStreamer locks in the WebKit
codebase to use these new lockers.
This patch introduces no behavior changes.
* platform/graphics/gstreamer/GStreamerCommon.h:
(gstObjectLock):
(gstObjectUnlock):
(gstPadStreamLock):
(gstPadStreamUnlock):
(holdGstObjectLock):
(holdGstPadStreamLock):
* platform/graphics/gstreamer/TextCombinerPadGStreamer.cpp:
(webkitTextCombinerPadGetProperty):
(webkitTextCombinerPadSetProperty):
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
(webKitMediaSrcWaitForPadLinkedOrFlush):
(webKitMediaSrcLoop):
(webKitMediaSrcStreamFlush):
(webKitMediaSrcGetUri):
(webKitMediaSrcSetUri):
2021-06-09 Chris Dumez <cdumez@apple.com>
Rely on SQLiteDatabase::setMaximumSize() for quota management in LocalStorageDatabase
https://bugs.webkit.org/show_bug.cgi?id=226788
Reviewed by Sihui Liu.
Export SQLiteDatabase::setMaximumSize() so it can be used from WebKit2.
* platform/sql/SQLiteDatabase.h:
2021-06-08 Alex Christensen <achristensen@webkit.org>
Move PrivacyStance code from WebKitAdditions
https://bugs.webkit.org/show_bug.cgi?id=226774
Reviewed by Jer Noble.
* platform/network/NetworkLoadMetrics.h:
(WebCore::NetworkLoadMetrics::isolatedCopy const):
(WebCore::NetworkLoadMetrics::operator== const):
(WebCore::NetworkLoadMetrics::encode const):
(WebCore::NetworkLoadMetrics::decode):
* platform/network/cocoa/WebCoreNSURLSession.mm:
(-[WebCoreNSURLSessionTaskTransactionMetrics _privacyStance]):
2021-06-08 Rob Buis <rbuis@igalia.com>
CSSOM test for serializing counter() fails
https://bugs.webkit.org/show_bug.cgi?id=184256
Reviewed by Sam Weinig.
The last CSS component value should be omitted if it is "decimal" [1].
Behavior matches Firefox and Chrome.
[1] https://drafts.csswg.org/cssom/#serialize-a-css-component-value
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):
2021-06-08 Sam Weinig <weinig@apple.com>
Adopt WTF::Span in SQLiteStatement
https://bugs.webkit.org/show_bug.cgi?id=226773
Reviewed by Alex Christensen.
Do some initial adoption of WTF::Span by adopting it in SQLiteStatement.
- Removes class BlobView.
- Renames columnBlobView to columnBlobAsSpan() (mirrors columnBlobAsString() naming)
and have it return a Span<const uint8_t>.
- Replace bindBlob(int index, const void* blob, int size) with bindBlob(int index, Span<const uint8_t>).
Due to implicit construction for types with data() and size() functions (actually anything
that std::data() and std::size() can reason about), Vector and SharedBuffer cleanly work
to convert to Span of the same underlying type. This means that many callers of bindBlob
are now simpler, as instead of doing:
bindBlob(1, foo->data(), foo->size());
we instead do:
bindBlob(1, *foo);
There is much much more to do to take advantage of this new type, but this is
kept intentionally small, as the pulling back the onion can go very deep.
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::migrateIndexInfoTableForIDUpdate):
(WebCore::IDBServer::SQLiteIDBBackingStore::migrateIndexRecordsTableForIDUpdate):
(WebCore::IDBServer::SQLiteIDBBackingStore::addExistingIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo):
(WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore):
(WebCore::IDBServer::SQLiteIDBBackingStore::createIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedHasIndexRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::keyExistsInObjectStore):
(WebCore::IDBServer::SQLiteIDBBackingStore::deleteRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::addRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::getRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords):
(WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey):
(WebCore::IDBServer::SQLiteIDBBackingStore::getCount):
* Modules/indexeddb/server/SQLiteIDBCursor.cpp:
(WebCore::IDBServer::SQLiteIDBCursor::bindArguments):
(WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindPreIndexStatementIfNecessary):
(WebCore::IDBServer::SQLiteIDBCursor::internalFetchNextRecord):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::store):
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::bindBlob):
(WebCore::SQLiteStatement::columnBlob):
(WebCore::SQLiteStatement::columnBlobAsSpan):
(WebCore::SQLiteStatement::columnBlobView): Deleted.
* platform/sql/SQLiteStatement.h:
(WebCore::SQLiteStatement::BlobView::BlobView): Deleted.
(WebCore::SQLiteStatement::BlobView::data): Deleted.
(WebCore::SQLiteStatement::BlobView::size): Deleted.
(): Deleted.
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::doPushChanges):
(WebCore::RegistrationDatabase::importRecords):
2021-06-08 Jean-Yves Avenard <jya@apple.com>
MediaPlayerPrivateRemote::didLoadingProgress should not send synchronous message to GPU process
https://bugs.webkit.org/show_bug.cgi?id=226761
rdar://78834312
Reviewed by Eric Carlson.
Make MediaPlayer::didLoadingProgress method asynchronous. This method is particularly well
suited to be made async as there's only one calling point from the HTMLMediaElement that
occurs when the progressEventTimer gets fired. As such, when the operation is precisely run
isn't particularly relevant as per spec:
"While the load is not suspended (see below), every 350ms (±200ms) or for every byte received,
whichever is least frequent, queue a media element task given the media element to fire an
event named progress at the element.".
This allows to make the query to the GPU process async.
While we can expect the time to query the GPU process to take less than 200ms on average,
there will be no change in the obversable behaviour compare to the previous implementation
where the call to the GPU process was synchronous.
Covered by existing tests.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::progressEventTimerFired): Use new method definition.
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::didLoadingProgress const):
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::didLoadingProgressAsync const): Add default implementation
that calls the old sync didLoadingProgress method.
2021-06-08 Chris Dumez <cdumez@apple.com>
Drop legacy EventLoopEventQueue class
https://bugs.webkit.org/show_bug.cgi?id=226748
Reviewed by Darin Adler.
Drop legacy EventLoopEventQueue class which was used by HTMLMediaElement. I added a
queueCancellableTaskToDispatchEvent() convenience function on ActiveDOMObject to
schedule cancellable events directly on the HTML event loop. The function takes
care of keeping the object and its wrapper alive until the event has fired.
Note that the previous code was using EventLoopEventQueue to dispatch events on
other objects than the HTMLMediaElement. This was wrong as it wouldn't take
care of keeping the real target's JS wrapper alive to actually dispatch the
event. As a result, I had to update a couple of media classes to subclass
ActiveDOMObject and the HTMLMediaElement now calls
queueCancellableTaskToDispatchEvent() directly on the target.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/ActiveDOMObject.cpp:
(WebCore::ActiveDOMObjectEventDispatchTask::ActiveDOMObjectEventDispatchTask):
(WebCore::ActiveDOMObject::queueTaskToDispatchEventInternal):
(WebCore::ActiveDOMObject::queueCancellableTaskToDispatchEventInternal):
* dom/ActiveDOMObject.h:
* dom/EventLoopEventQueue.cpp: Removed.
* dom/EventLoopEventQueue.h: Removed.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
(WebCore::HTMLMediaElement::~HTMLMediaElement):
(WebCore::HTMLMediaElement::scheduleEvent):
(WebCore::HTMLMediaElement::updateActiveTextTrackCues):
(WebCore::HTMLMediaElement::cancelPendingEventsAndCallbacks):
(WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
(WebCore::HTMLMediaElement::mediaPlayerInitializationDataEncountered):
(WebCore::HTMLMediaElement::closeTaskQueues):
(WebCore::HTMLMediaElement::virtualHasPendingActivity const):
(WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent):
(WebCore::HTMLMediaElement::scheduleEventOn):
* html/HTMLMediaElement.h:
* html/track/InbandTextTrack.cpp:
(WebCore::InbandTextTrack::create):
* html/track/LoadableTextTrack.cpp:
(WebCore::LoadableTextTrack::create):
* html/track/TextTrack.cpp:
(WebCore::TextTrack::TextTrack):
(WebCore::TextTrack::create):
(WebCore::TextTrack::activeDOMObjectName const):
* html/track/TextTrack.h:
* html/track/TextTrack.idl:
* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::create):
(WebCore::TextTrackCue::TextTrackCue):
(WebCore::TextTrackCue::activeDOMObjectName const):
* html/track/TextTrackCue.h:
* html/track/TextTrackCue.idl:
2021-06-08 Devin Rousso <drousso@apple.com>
Unreviewed, followup to r278630
* Modules/applepay/ApplePaySession.h:
Remove mentions of file that doesn't exist anymore.
2021-06-08 Michael Catanzaro <mcatanzaro@gnome.org>
Unreviewed, fix new -Wreturn-type warning
https://bugs.webkit.org/show_bug.cgi?id=226718
<rdar://problem/78947485>
* rendering/HighlightData.cpp:
(WebCore::HighlightData::rangeForTextBox):
2021-06-08 Jean-Yves Avenard <jya@apple.com>
[MSE] Assertion if attempting to perform eviction before playback starts.
https://bugs.webkit.org/show_bug.cgi?id=226720
<rdar://problem/78943223>
Reviewed by Eric Carlson.
Handle the case where the buffered range doesn't yet exist as we haven't parsed
an init segment yet.
Test: media/media-source/media-source-append-buffer-full-quota-exceeded-error-onstart.html
* platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::evictCodedFrames): Exit early if the buffered range is empty
and handle the case where a buffered range index wasn't found.
2021-06-08 Devin Rousso <drousso@apple.com>
[Payment Request] upstream new features
https://bugs.webkit.org/show_bug.cgi?id=226740
<rdar://problem/78963132>
Reviewed by Andy Estes.
- recurring line items (`HAVE_PASSKIT_RECURRING_SUMMARY_ITEM` and `ENABLE_APPLE_PAY_RECURRING_LINE_ITEM`)
- deferred line items (`HAVE_PASSKIT_DEFERRED_SUMMARY_ITEM` and `ENABLE_APPLE_PAY_DEFERRED_LINE_ITEM`)
- estimated shipping dates (`HAVE_PASSKIT_SHIPPING_METHOD_DATE_COMPONENTS_RANGE` and `ENABLE_APPLE_PAY_SHIPPING_METHOD_DATE_COMPONENTS_RANGE`)
- coupon code entry (`HAVE_PASSKIT_COUPON_CODE` and `ENABLE_APPLE_PAY_COUPON_CODE`)
- shipped vs in-store pickup (`HAVE_PASSKIT_SHIPPING_CONTACT_EDITING_MODE` and `ENABLE_APPLE_PAY_SHIPPING_CONTACT_EDITING_MODE`)
Tests: http/tests/paymentrequest/ApplePayModifier-additionalLineItems.https.html
http/tests/paymentrequest/ApplePayModifier-additionalShippingMethods.https.html
http/tests/paymentrequest/ApplePayModifier-total.https.html
http/tests/paymentrequest/paymentmethodchange-couponCode.https.html
http/tests/paymentrequest/paymentrequest-couponCode.https.html
http/tests/paymentrequest/paymentrequest-shippingContactEditingMode.https.html
http/tests/paymentrequest/paymentrequest-supportsCouponCode.https.html
* Modules/applepay/ApplePayCouponCodeUpdate.idl: Copied from Source/WebCore/Modules/applepay/ApplePayPaymentMethodModeUpdate.idl.
* Modules/applepay/ApplePayCouponCodeUpdate.h: Renamed from Source/WebCore/Modules/applepay/ApplePayPaymentMethodModeUpdate.h.
(WebCore::ApplePayCouponCodeUpdate::encode const):
(WebCore::ApplePayCouponCodeUpdate::decode):
Object used to update the payment request via `ApplePaySession.prototype.completeCouponCodeChange`
when responding to the user modifying the coupon code.
* Modules/applepay/ApplePayErrorCode.idl:
* Modules/applepay/ApplePayErrorCode.h:
Add `"couponCodeInvalid"` and `"couponCodeExpired"`.
* Modules/applepay/ApplePayLineItem.idl:
* Modules/applepay/ApplePayLineItem.h:
(WebCore::ApplePayLineItem::encode const):
(WebCore::ApplePayLineItem::decode):
* Modules/applepay/ApplePayPaymentTiming.idl: Added.
* Modules/applepay/ApplePayPaymentTiming.h: Added.
* Modules/applepay/ApplePayRecurringPaymentDateUnit.idl: Added.
* Modules/applepay/ApplePayRecurringPaymentDateUnit.h: Added.
Add members that indicate whether this line item is immediate, recurring, or deferred.
Depending on that timing, additional members are added for further configuration (e.g. the
start and/or end date of a recurring payment, it's frequency, etc.).
* Modules/applepay/ApplePayShippingMethod.idl:
* Modules/applepay/ApplePayShippingMethod.h:
(WebCore::ApplePayShippingMethod::encode const):
(WebCore::ApplePayShippingMethod::decode):
* Modules/applepay/ApplePayDateComponentsRange.idl: Added.
* Modules/applepay/ApplePayDateComponentsRange.h: Added.
(WebCore::ApplePayDateComponentsRange::encode const):
(WebCore::ApplePayDateComponentsRange::decode):
* Modules/applepay/ApplePayDateComponents.idl: Added.
* Modules/applepay/ApplePayDateComponents.h: Added.
(WebCore::ApplePayDateComponents::encode const):
(WebCore::ApplePayDateComponents::decode):
Add members that can be used to indicate the estimated shipping dates for this shipping method.
* Modules/applepay/ApplePayRequestBase.idl:
* Modules/applepay/ApplePayRequestBase.h:
* Modules/applepay/ApplePayRequestBase.cpp:
(WebCore::convertAndValidate):
* Modules/applepay/ApplePaySessionPaymentRequest.h:
(WebCore::ApplePaySessionPaymentRequest::supportsCouponCode const): Added.
(WebCore::ApplePaySessionPaymentRequest::setSupportsCouponCode): Added.
(WebCore::ApplePaySessionPaymentRequest::couponCode const): Added.
(WebCore::ApplePaySessionPaymentRequest::setCouponCode): Added.
(WebCore::ApplePaySessionPaymentRequest::shippingContactEditingMode const): Added.
(WebCore::ApplePaySessionPaymentRequest::setShippingContactEditingMode): Added.
* Modules/applepay/ApplePayShippingContactEditingMode.idl: Added.
* Modules/applepay/ApplePayShippingContactEditingMode.h: Added.
Add members that indicate:
- whether this payment request supports a coupon code at all
- the initial coupon code (assuming the above)
- whether this payment request allows editing the shipping contact (i.e. in-store pickup does not)
* dom/EventNames.h:
* dom/EventNames.in:
* Modules/applepay/ApplePayCouponCodeChangedEvent.idl: Added.
* Modules/applepay/ApplePayCouponCodeChangedEvent.h: Added.
* Modules/applepay/ApplePayCouponCodeChangedEvent.cpp: Added.
(WebCore::ApplePayCouponCodeChangedEvent::ApplePayCouponCodeChangedEvent):
(WebCore::ApplePayCouponCodeChangedEvent::eventInterface const):
Add a `"couponcodechange"` event that is dispatched whenever the user modifies the coupon code for an `ApplePaySession`.
* Modules/applepay/ApplePayCouponCodeDetails.idl: Copied from Source/WebCore/Modules/applepay/ApplePayPaymentMethodModeDetails.idl.
* Modules/applepay/ApplePayCouponCodeDetails.h: Copied from Source/WebCore/Modules/applepay/ApplePayPaymentMethodModeUpdate.idl.
Used as the `object methodData` when a `PaymentMethodChangeEvent` is dispatched for a `PaymentRequest`.
* Modules/applepay/ApplePaySession.idl:
* Modules/applepay/ApplePaySession.h:
* Modules/applepay/ApplePaySession.cpp:
(WebCore::convertAndValidate):
(WebCore::ApplePaySession::completeCouponCodeChange): Added.
(WebCore::ApplePaySession::didChangeCouponCode): Renamed from `WebCore::ApplePaySession::didChangePaymentMethodMode`.
(WebCore::ApplePaySession::canSuspendWithoutCanceling const):
(WebCore::ApplePaySession::canBegin const):
(WebCore::ApplePaySession::canAbort const):
(WebCore::ApplePaySession::canCancel const):
(WebCore::ApplePaySession::canCompleteShippingMethodSelection const):
(WebCore::ApplePaySession::canCompleteShippingContactSelection const):
(WebCore::ApplePaySession::canCompletePaymentMethodSelection const):
(WebCore::ApplePaySession::canCompleteCouponCodeChange const): Renamed from `WebCore::ApplePaySession::canCompletePaymentMethodModeChange const`.
(WebCore::ApplePaySession::canCompletePayment const):
(WebCore::ApplePaySession::isFinalState const):
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
(WebCore::ApplePayPaymentHandler::paymentMethodUpdated):
(WebCore::ApplePayPaymentHandler::didChangeCouponCode): Renamed from `WebCore::ApplePayPaymentHandler::didChangePaymentMethodMode`.
Add methods for JS to call and state logic to handle coupon code changes.
* Modules/applepay/PaymentCoordinator.h:
* Modules/applepay/PaymentCoordinator.cpp:
(WebCore::PaymentCoordinator::completeCouponCodeChange): Renamed from `WebCore::PaymentCoordinator::completePaymentMethodModeChange`.
(WebCore::PaymentCoordinator::didChangeCouponCode): Renamed from `WebCore::PaymentCoordinator::didChangePaymentMethodMode`.
* Modules/applepay/PaymentCoordinatorClient.h:
* loader/EmptyClients.cpp:
(WebCore::EmptyPaymentCoordinatorClient::completeCouponCodeChange): Renamed from `WebCore::EmptyPaymentCoordinatorClient::completePaymentMethodModeChange`.
Plumbing up to WebKit.
* Modules/applepay/cocoa/PaymentSummaryItemsCocoa.mm:
(WebCore::toDate): Added.
(WebCore::toCalendarUnit): Added.
(WebCore::toPKPaymentSummaryItem):
Convert WebCore objects to PassKit objects.
* testing/MockPaymentCoordinator.idl:
* testing/MockPaymentCoordinator.h:
* testing/MockPaymentCoordinator.cpp:
(WebCore::MockPaymentCoordinator::showPaymentUI):
(WebCore::MockPaymentCoordinator::completeCouponCodeChange): Renamed from `WebCore::MockPaymentCoordinator::completePaymentMethodModeChange`.
(WebCore::MockPaymentCoordinator::changeCouponCode): Added.
* Modules/applepay/cocoa/PaymentAPIVersionCocoa.mm:
(WebCore::PaymentAPIVersion::current):
* Modules/applepay/PaymentHeaders.h:
* Modules/applepay/PaymentSession.h:
* Modules/applepay/ApplePayLineItemData.idl: Removed.
* Modules/applepay/ApplePayLineItemData.h: Removed.
* Modules/applepay/ApplePayShippingMethodData.idl: Removed.
* Modules/applepay/ApplePayShippingMethodData.h: Removed.
Remove unnecessary base types after r275169.
* PlatformMac.cmake:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
2021-06-08 Michael Catanzaro <mcatanzaro@gnome.org>
Unreviewed, fix build after r278621
https://bugs.webkit.org/show_bug.cgi?id=226731
<rdar://problem/79021715>
* rendering/MarkedText.cpp:
2021-06-08 Chris Dumez <cdumez@apple.com>
Unreviewed Windows build fix after r278619.
* platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
(WebCore::CDMSessionAVFoundationCF::generateKeyRequest):
2021-06-08 Devin Rousso <drousso@apple.com>
[Modern Media Controls] Don't show Playback Speed when up-to-date Live Boadcasts
https://bugs.webkit.org/show_bug.cgi?id=226744
Reviewed by Eric Carlson.
Test: http/tests/media/modern-media-controls/overflow-support/playback-speed-live-broadcast.html
* Modules/modern-media-controls/media/overflow-support.js:
(OverflowSupport.prototype.get mediaEvents):
(OverflowSupport.prototype.syncControl):
(OverflowSupport.prototype.get _includePlaybackRates): Added.
Rework existing logic that determines whether to include "Playback Speed" into a separate
function for clarity.
2021-06-08 Antti Koivisto <antti@apple.com>
Factor MarkedText collection out of LegacyInlineTextBox
https://bugs.webkit.org/show_bug.cgi?id=226731
Reviewed by Sam Weinig.
Move more code out from the legacy inline classes.
* rendering/LegacyInlineTextBox.cpp:
(WebCore::LegacyInlineTextBox::paint):
(WebCore::LegacyInlineTextBox::hasMarkers const):
(WebCore::LegacyInlineTextBox::paintPlatformDocumentMarkers):
(WebCore::LegacyInlineTextBox::calculateUnionOfAllDocumentMarkerBounds const):
(WebCore::LegacyInlineTextBox::paintMarkedTexts):
(WebCore::LegacyInlineTextBox::highlightStartEnd const): Deleted.
(WebCore::LegacyInlineTextBox::collectMarkedTextsForDraggedContent): Deleted.
(WebCore::LegacyInlineTextBox::collectMarkedTextsForDocumentMarkers const): Deleted.
(WebCore::LegacyInlineTextBox::collectMarkedTextsForHighlights const): Deleted.
* rendering/LegacyInlineTextBox.h:
(WebCore::LegacyInlineTextBox::paintMarkedTexts):
* rendering/MarkedText.cpp:
(WebCore::MarkedText::subdivide):
(WebCore::MarkedText::collectForHighlights):
(WebCore::MarkedText::collectForDocumentMarkers):
(WebCore::MarkedText::collectForDraggedContent):
(WebCore::subdivide): Deleted.
* rendering/MarkedText.h:
(WebCore::MarkedText::operator== const):
* rendering/MarkedTextStyle.cpp:
(WebCore::subdivideAndResolveStyle):
2021-06-08 Truitt Savell <tsavell@apple.com>
Unreviewed, reverting r278609.
Broke builds with a linker error.
Reverted changeset:
"Update libwebrtc to M92"
https://bugs.webkit.org/show_bug.cgi?id=226494
https://commits.webkit.org/r278609
2021-06-08 Chris Dumez <cdumez@apple.com>
Reduce use of reinterpret_cast<> in the codebase
https://bugs.webkit.org/show_bug.cgi?id=226743
Reviewed by Darin Adler.
* Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
(WebCore::CDMSessionClearKey::generateKeyRequest):
* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::take):
* Modules/fetch/FetchBodyConsumer.cpp:
(WebCore::FetchBodyConsumer::resolve):
(WebCore::FetchBodyConsumer::takeAsBlob):
(WebCore::FetchBodyConsumer::takeAsText):
* Modules/mediastream/RTCDataChannelRemoteHandler.cpp:
(WebCore::RTCDataChannelRemoteHandler::readyToSend):
(WebCore::RTCDataChannelRemoteHandler::sendStringData):
(WebCore::RTCDataChannelRemoteHandler::sendRawData):
* Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp:
(WebCore::copyBusData):
* Modules/webauthn/AuthenticatorResponseData.h:
(WebCore::encodeArrayBuffer):
(WebCore::decodeArrayBuffer):
* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::startClosingHandshake):
(WebCore::WebSocketChannel::processOutgoingFrameQueue):
* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::WebSocketHandshake::getExpectedWebSocketAccept):
(WebCore::headerHasValidHTTPVersion):
* bindings/js/ScriptBufferSourceProvider.h:
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readString):
* contentextensions/SerializedNFA.cpp:
(WebCore::ContentExtensions::SerializedNFA::pointerAtOffsetInFile const):
* dom/Node.cpp:
(WebCore::hashPointer):
* dom/TextEncoder.cpp:
(WebCore::TextEncoder::encode const):
* dom/TextEncoderStreamEncoder.cpp:
(WebCore::TextEncoderStreamEncoder::flush):
* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::sanitizeMarkupWithArchive):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::texImageArrayBufferViewHelper):
* inspector/DOMPatchSupport.cpp:
(WebCore::addStringToSHA1):
* loader/TextResourceDecoder.cpp:
(WebCore::TextResourceDecoder::textFromUTF8):
* loader/cache/CachedScript.cpp:
(WebCore::CachedScript::script):
* page/cocoa/ResourceUsageOverlayCocoa.mm:
(WebCore::showText):
* platform/SharedBufferChunkReader.cpp:
(WebCore::SharedBufferChunkReader::nextChunk):
* platform/cf/SharedBufferCF.cpp:
(WebCore::SharedBuffer::createCFData const):
* platform/generic/KeyedEncoderGeneric.cpp:
(WebCore::KeyedEncoderGeneric::encodeString):
* platform/graphics/GraphicsContextGL.cpp:
(WebCore::GraphicsContextGL::packImageData):
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::getPixelBuffer const):
(WebCore::ImageBufferBackend::putPixelBuffer):
* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::InbandTextTrackPrivateAVF::processNativeSamples):
* platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
(WebCore::CDMSessionAVFoundationCF::generateKeyRequest):
(WebCore::CDMSessionAVFoundationCF::update):
* platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp:
(WebCore::InbandTextTrackPrivateAVCF::readNativeSampleBuffer):
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemBuffer::createItemBuffer):
* platform/graphics/displaylists/DisplayListIterator.cpp:
(WebCore::DisplayList::DisplayList::Iterator::updateCurrentItem):
* platform/image-decoders/gif/GIFImageReader.h:
(GIFImageReader::data const):
* platform/mac/SSLKeyGeneratorMac.mm:
(WebCore::signedPublicKeyAndChallengeString):
* platform/mediastream/RealtimeMediaSourceCenter.cpp:
(WebCore::addStringToSHA1):
* platform/network/FormDataBuilder.cpp:
(WebCore::FormDataBuilder::encodeStringAsFormData):
* platform/network/SocketStreamHandle.cpp:
(WebCore::SocketStreamHandle::sendHandshake):
* platform/network/cf/ResourceRequestCFNet.cpp:
(WebCore::ResourceRequest::doUpdatePlatformRequest):
* platform/network/cf/ResourceRequestCFNet.h:
(WebCore::httpHeaderValueUsingSuitableEncoding):
* platform/network/cf/SocketStreamHandleImplCFNet.cpp:
(WebCore::SocketStreamHandleImpl::platformSendInternal):
* platform/network/curl/CurlCacheEntry.cpp:
(WebCore::CurlCacheEntry::generateBaseFilename):
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::columnBlobView):
* testing/MockCDMFactory.cpp:
(WebCore::MockCDM::sanitizeResponse const):
2021-06-08 Devin Rousso <drousso@apple.com>
[Modern Media Controls] upstream new features
https://bugs.webkit.org/show_bug.cgi?id=226736
<rdar://problem/78957464>
Reviewed by Eric Carlson.
- bring the "Audio"/"Languages" tracks menu to iOS
- add a new "Playback Speed" menu in the overflow menu on iOS and macOS
- add support for showing the most relevant `<track kind="chapters">` in the overflow menu on iOS and macOS
Tests: media/modern-media-controls/overflow-button/overflow-button.html
media/modern-media-controls/overflow-support/chapters.html
media/modern-media-controls/overflow-support/playback-speed.html
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::showMediaControlsContextMenu):
* Modules/modern-media-controls/media/overflow-support.js:
(OverflowSupport.prototype.get mediaEvents):
(OverflowSupport.prototype.get tracksToMonitor):
(OverflowSupport.prototype.syncControl):
* en.lproj/Localizable.strings:
* rendering/RenderTheme.h:
(WebCore::RenderTheme::mediaControlsScripts):
* rendering/RenderThemeAdwaita.cpp:
(WebCore::RenderThemeAdwaita::mediaControlsScripts):
* rendering/RenderThemeAdwaita.h:
* rendering/RenderThemeCocoa.h:
* rendering/RenderThemeCocoa.mm:
(WebCore::RenderThemeCocoa::purgeCaches):
(WebCore::RenderThemeCocoa::mediaControlsScripts):
* rendering/RenderThemeWin.h:
* rendering/RenderThemeWin.cpp:
(WebCore::RenderThemeWin::mediaControlsScripts):
Drop the "additional script" and lower the inline capacity of the `Vector`.
* testing/Internals.idl:
* testing/Internals.h:
* testing/Internals.cpp:
(WebCore::Internals::setMediaControlsHidePlaybackRates): Added.
* html/HTMLMediaElement.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setMediaControlsHidePlaybackRates): Added.
Since Playback Rates is always shown, provide a way for tests to turn it off.
2021-06-08 Devin Rousso <drousso@apple.com>
Require that callsites of `SnapshotOptions` specify a `PixelFormat` and `DestinationColorSpace`
https://bugs.webkit.org/show_bug.cgi?id=226756
Reviewed by Sam Weinig.
Don't wrap `PixelFormat` or `DestinationColorSpace` with `std::optional` as we want each
callsite to explicity configure them. This makes it easier to find where values for each
are used as there's no implicit behavior.
No behavior change. Followup after r278565.
* page/FrameSnapshotting.h:
* page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRect):
(WebCore::snapshotFrameRectWithClip):
(WebCore::snapshotNode):
(WebCore::snapshotSelection):
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::snapshotNode):
(WebCore::InspectorPageAgent::snapshotRect):
* page/PageConsoleClient.cpp:
(WebCore::PageConsoleClient::screenshot):
* page/TextIndicator.cpp:
(WebCore::snapshotOptionsForTextIndicatorOptions):
(WebCore::takeSnapshots):
* platform/DragImage.cpp:
(WebCore::createDragImageForNode):
(WebCore::createDragImageForSelection):
(WebCore::createDragImageForRange):
(WebCore::createDragImageForImage):
2021-06-08 Sam Weinig <weinig@apple.com>
Move some hand rolled CSSProperty predicates to be generated based on new CSSProperties.json properties
https://bugs.webkit.org/show_bug.cgi?id=226768
Reviewed by Antti Koivisto.
Replace hand rolled isDescriptorOnly, isDirectionAwareProperty and isColorProperty
functions with generated versions using new "color-property", "direction-aware-property"
and "descriptor-only" properties in CSSProperties.json.
* css/CSSProperties.json:
* css/CSSProperty.cpp:
(WebCore::CSSProperty::isDescriptorOnly): Deleted.
(WebCore::CSSProperty::isDirectionAwareProperty): Deleted.
(WebCore::CSSProperty::isColorProperty): Deleted.
* css/makeprop.pl:
(addProperty):
2021-06-08 Antoine Quint <graouts@webkit.org>
REGRESSION (r256095): Adding a border-radius, border, or box-shadow breaks animations from scale(0)
https://bugs.webkit.org/show_bug.cgi?id=218371
<rdar://problem/70906316>
Reviewed by Simon Fraser.
When computing an animation's transform extent, we must account for implicit keyframes.
Test: webanimations/accelerated-transform-animation-to-scale-zero-with-implicit-from-keyframe.html
* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):
2021-06-08 Youenn Fablet <youenn@apple.com> and Victor M. Jaquez L. <vjaquez@igalia.com>
Update libwebrtc to M92
https://bugs.webkit.org/show_bug.cgi?id=226494
Reviewed by Eric Carlson.
Covered by existing tests.
* Configurations/WebCore.xcconfig:
* Configurations/WebCoreTestSupport.xcconfig:
* Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.cpp:
(WebCore::LibWebRTCRtpReceiverBackend::createSource):
* Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp:
(WebCore::fillInboundRtpStreamStats):
(WebCore::fillOutboundRtpStreamStats):
(WebCore::fillRTCIceCandidateStats):
* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::LibWebRTCProvider::signalingThread):
(WebCore::LibWebRTCProvider::createPeerConnectionFactory):
(WebCore::LibWebRTCProvider::setPeerConnectionFactory):
(WebCore::LibWebRTCProvider::createPeerConnection):
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:
* testing/MockLibWebRTCPeerConnection.cpp:
(WebCore::createConnection):
(WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnectionOrError):
* testing/MockLibWebRTCPeerConnection.h:
2021-06-08 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Add initial percent value support for columns
https://bugs.webkit.org/show_bug.cgi?id=226751
Reviewed by Simon Fraser.
This patch adds the initial support for content like this:
<table>
<tr>
<td style="width: 10%"></td><td style="width: 90%"></td>
</tr>
</table>
Percent values work in mysterious ways in cases when the table has no fixed width.
1. The smaller the percent value is, the wider the table may become.
Percent values are resolved against the cell's border box (so essentially they are resolved
against their own content as opposed to the table/containing block) and the formula is slightly different.
<td style="padding: 5px; width: 20%;"></td> : produces a 10px wide border box (horizontal border: 0px, padding: 10px, content: 0px).
The maximum constraint is resolved to 50px (width / percent * 100)
<td style="padding: 5px; width: 100%;"></td> : produces a 10px wide border box and the maximum constraint is resolved to 10px.
This maximum constraint value turns into the available width for the table content and becomes the final table width.
2. With multiple rows, we pick the highest _percent_ value for each column (as opposed to the resolved values).
<tr><td style="width: 20%"></td></tr> (assum same 5px padding on both sides)
<tr><td style="width: 80%"></td></tr>
While the second row's cell has a higher maximum constraint value (50px see #1) since we only look at the raw percent values,
this content only produces a 12.5px wide table.
3. The percent values do not accumulate across columns but instead we pick the largest one to represent the entire table's max constraint width.
<tr><td style="width: 60%"></td><td style="width: 40%"></td></tr>
60% resolves to 16.6px
40% resolves to 25px and we use the 25px value as the width for the entire table (and not 16.6px + 25px).
4. Since we pick the highest percent values across rows for each columns, we may end up with > 100%.
In such cases we start dropping percent values for subsequent columns:
<tr><td style="width: 20%;"></td><td style="width: 80%;"></td></tr>
<tr><td style="width: 60%;"></td><td style="width: 10%;"></td></tr>
First column width is max(20%, 60%) -> 60%
Second column width is max(80%, 10%) -> 80%
As we limit the accumulated percent value to 100%, the final column percent values are 60% and 40% (and not 80%).
Now the 60% is resolved to 16.6px and the 40% is resolved to 25px and since we don't accumulate these values (see #3)
the final table width is 25px (based on a percent value which is not even in the markup).
5. While the smaller percent values produce wider tables (see #1), during the available space distribution
columns with smaller percent values get assigned less space.
<tr><td style="width: 1%"></td><td style="width: 99%"></td></tr>
This content produces a 1000px wide table due to the small (1%) percent value (see #1 #2 and #3).
When we distribute the available space (1000px), the first cell gets only 10px (1%) while the second cell ends up with 990px (99%).
(and this is the cherry on top (not included in this patch):
Imagine the following scenario:
1. the accumulated column percent value > 100% (let's say 80% and 30%)
2. as we reach the 100% while walking the columns one by one (see #4), the remaining percent value becomes 0%.
3. In order to avoid division by 0, we pick a very small epsilon value to run the formula.
4. Now this very small percent value produces a large resolved value (see #2) which means
<tr><td style="width: 100%"></td></tr>
produces a 10px wide table
<tr><td style="width: 100%"></td><td style="width: 1%"></td></tr> <- note the 1%
produces a very very very wide table.
)
Test: fast/layoutformattingcontext/table-with-percent-columns-only-no-content.html
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints):
(WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns):
* layout/formattingContexts/table/TableGrid.h:
(WebCore::Layout::TableGrid::Column::percent const):
(WebCore::Layout::TableGrid::Column::setFixedWidth):
(WebCore::Layout::TableGrid::Column::setPercent):
* layout/formattingContexts/table/TableLayout.cpp:
(WebCore::Layout::TableFormattingContext::TableLayout::distributedHorizontalSpace):
2021-06-08 Jean-Yves Avenard <jya@apple.com>
[MSE] Rework handling of SourceBuffer's buffer full.
https://bugs.webkit.org/show_bug.cgi?id=226711
<rdar://problem/78937909>
Reviewed by Jer Noble.
Bug 225630 modified the handling of the Source Buffer "buffer full" algorithm.
Per spec, we are to reject a buffer only once we know that the source buffer is full.
The first appendBuffer should always complete.
https://w3c.github.io/media-source/#sourcebuffer-buffer-full-flag
"The buffer full flag keeps track of whether appendBuffer() is allowed to accept
more bytes. It is set to false when the SourceBuffer object is created and gets
updated as data is appended and removed."
"buffer full flag" only gets modified to true in the 3.5.1 Segment Parser Loop
algorithm, step 6.3
https://w3c.github.io/media-source/#sourcebuffer-segment-parser-loop
"If this SourceBuffer is full and cannot accept more media data, then set the
buffer full flag to true."
On the 2nd call to the appendBuffer, in the Prepare Append algorithm, step 3.5.4.6:
https://w3c.github.io/media-source/#sourcebuffer-prepare-append
"If the buffer full flag equals true, then throw a QuotaExceededError exception
and abort these steps."
This change moves the check of the source buffer size back into SourceBufferPrivate
so that checking if we have sufficient space or not is hidden from the SourceBuffer.
Rather than deal with a single "buffer full" flag, we use instead a isBufferFullFor()
method which allows to easily swap between the previous per-spec behaviour and the
one introduced by bug 225630 as it does present some advantages.
We can always determine if we have sufficient space by checking the current source
buffer memory size and the requested limit.
The previous algorithm took into consideration the allocated capacity of the
temporary SourceBuffer::m_pendingAppendData ; this approach was flawed in that we
always checked if m_pendingAppendData.capacity + newDataSize would fit in the
source buffer. However newDataSize would always happen to fit within the existing
capacity, so it was accounted for twice.
We remove check on the capacity allocated as it simplifies the code a great deal,
and avoid the piggy-backing of unrelated methods (such as
SourceBufferPrivate::reenqueueMediaIfNeeded that ended up also checking capacity)
This change is already covered with existing tests.
* Modules/mediasource/SourceBuffer.cpp: call new isBufferFullFor to check if
sufficient is available.
(WebCore::SourceBuffer::appendBufferInternal):
(WebCore::SourceBuffer::sourceBufferPrivateAppendComplete):
* platform/graphics/SourceBufferPrivate.h: Add isBufferFullFor method
remove m_bufferFull member.
* platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::reenqueueMediaIfNeeded): remove reference to
buffer capacity
(WebCore::SourceBufferPrivate::evictCodedFrames): remove reference to
buffer capacity
(WebCore::SourceBufferPrivate::isBufferFullFor): To get per-spec behaviour
we only need to stop checking the value of the requiredSize argument.
2021-06-08 Antti Koivisto <antti@apple.com>
`text-decoration: underline` is not applied to web component
https://bugs.webkit.org/show_bug.cgi?id=226724
<rdar://problem/78987286>
Reviewed by Ryosuke Niwa.
'text-decoration' is not an inherited property in itself but its effective value
behaves as it was. We fail to inherit this effective value into author shadow trees.
Test case by Jeroen Zwartepoorte.
Test: fast/shadow-dom/effective-text-decoration-inheritance.html
* style/StyleAdjuster.cpp:
(WebCore::Style::shouldInheritEffectiveTextDecorations):
Test for user agent shadow tree, not a shadow tree in general.
Also inverse the logic and refactor a bit.
(WebCore::Style::Adjuster::adjust const):
(WebCore::Style::isAtShadowBoundary): Deleted.
(WebCore::Style::doesNotInheritTextDecoration): Deleted.
2021-06-08 Frédéric Wang <fwang@igalia.com>
Crash in InsertParagraphSeparatorCommand::doApply
https://bugs.webkit.org/show_bug.cgi?id=226527
Reviewed by Ryosuke Niwa.
After r273375 and r278002, it is possible that InsertParagraphSeparatorCommand::doApply is
confused by a display: table start block, leading to nullptr crash in the rest of the
function. This patch just excludes that case in order to work around that kind of issue.
Test: fast/editing/insert-paragraph-with-img-in-table-crash.html
* editing/InsertParagraphSeparatorCommand.cpp:
(WebCore::InsertParagraphSeparatorCommand::doApply):
2021-06-07 Alex Christensen <achristensen@webkit.org>
Adopt SecTrustGetCertificateAtIndex replacement where available
https://bugs.webkit.org/show_bug.cgi?id=225893
Reviewed by Chris Dumez.
* platform/network/cf/CertificateInfoCFNet.cpp:
(WebCore::certificatesMatch):
(WebCore::CertificateInfo::certificateChainFromSecTrust):
(WebCore::CertificateInfo::containsNonRootSHA1SignedCertificate const):
* platform/network/cocoa/CertificateInfoCocoa.mm:
(WebCore::CertificateInfo::dump const):
2021-06-07 Alexey Shvayka <shvaikalesh@gmail.com>
Unreviewed, reland r276592 with a fix for put() override in prototype chain of a JSProxy
https://bugs.webkit.org/show_bug.cgi?id=226185
Tests: js/dom/script-tests/reflect-set-onto-dom.js
imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/interface-object-set-receiver.html
http/tests/security/cross-frame-access-object-getPrototypeOf-in-put.html
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::put):
(WebCore::JSDOMWindow::doPutPropertySecurityCheck): Deleted.
* bindings/js/JSLocationCustom.cpp:
(WebCore::JSLocation::doPutPropertySecurityCheck): Deleted.
* bindings/js/JSRemoteDOMWindowCustom.cpp:
(WebCore::JSRemoteDOMWindow::put):
* bindings/scripts/CodeGeneratorJS.pm:
(GeneratePut):
(GenerateHeader):
* bindings/scripts/test/JS/*: Updated.
* bridge/objc/objc_runtime.h:
* bridge/runtime_array.h:
* bridge/runtime_object.h:
2021-06-07 Devin Rousso <drousso@apple.com>
Fix localized strings after r278202
https://bugs.webkit.org/show_bug.cgi?id=226742
Reviewed by Eric Carlson.
* Scripts/extract-localizable-strings.pl:
Add support for `WEB_UI_CFSTRING_KEY`.
* en.lproj/Localizable.strings:
2021-06-07 Alexey Shvayka <shvaikalesh@gmail.com>
Window should behave like a legacy platform object without indexed setter
https://bugs.webkit.org/show_bug.cgi?id=225894
Reviewed by Darin Adler.
This change fixes major interop issue by disallowing expando indexed properties on WindowProxy,
raising TypeError only when needed, which aligns WebKit with Blink and Gecko.
While [[DefineOwnProperty]] [1] and [[Delete]] [2] methods of WindowProxy are implemented
precisely per spec, current [[Set]] [3] algorithm seems to allow invoking setters from
the prototype chain. Blink and Gecko implement stricter semantics by failing early rather
than traversing the prototype chain, as does this patch.
To avoid breaking native apps that either add expando indexed properties to WindowProxy, or
more likely read / write indices of sloppy function's |this| value, which accidently happens
to be a WindowProxy, the new behavior is introduced only for web content and newly-built apps.
Since unlike putByIndex(), deletePropertyByIndex() might be invoked with UINT_MAX, which is
not an array index [4], isIndex() check is required. In future, JSC will be fixed to remove
such checks from all indexed overrides.
DeletePropertySlot::disableCaching() is not called because indexed deletes are not currently
repatched, and once they are, cacheability should be inferred from added type info flags.
Also, removes extra jsDOMWindowGetOwnPropertySlotRestrictedAccess() call for indices, which
is missing from the spec [5]; this is unobservable.
[1] https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-defineownproperty (step 2.1)
[2] https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-delete (step 2.1)
[3] https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-set (step 3)
[4] https://tc39.es/ecma262/#array-index
[5] https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-getownproperty (step 2.5.2)
Tests: imported/w3c/web-platform-tests/html/browsers/the-window-object/window-indexed-properties-delete-no-cache.html
imported/w3c/web-platform-tests/html/browsers/the-window-object/window-indexed-properties.html
imported/w3c/web-platform-tests/html/browsers/the-window-object/window-indexed-properties-strict.html
* bindings/js/JSDOMExceptionHandling.cpp:
(WebCore::makeUnsupportedIndexedSetterErrorMessage):
* bindings/js/JSDOMExceptionHandling.h:
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::allowsLegacyExpandoIndexedProperties):
(WebCore::JSDOMWindow::getOwnPropertySlotByIndex): Remove outdated comments.
(WebCore::JSDOMWindow::put):
(WebCore::JSDOMWindow::putByIndex): Release scope when calling Base::putByIndex(), which could throw.
(WebCore::JSDOMWindow::deleteProperty):
(WebCore::JSDOMWindow::deletePropertyByIndex):
(WebCore::JSDOMWindow::defineOwnProperty):
* platform/cocoa/VersionChecks.h:
2021-06-07 Chris Dumez <cdumez@apple.com>
Drop legacy MainThreadTaskQueue & EventLoopTaskQueue classes
https://bugs.webkit.org/show_bug.cgi?id=226734
Reviewed by Ryosuke Niwa.
Drop legacy MainThreadTaskQueue & EventLoopTaskQueue classes. Code that was using MainThreadTaskQueue
is now calling callOnMainThread() directly. Call that was using EventLoopTaskQueue is now using the
HTML event loop directly. If said code needed to cancel tasks or check if a previously scheduled task
is still pending, it now relies on WTF::CancellableTask / WTF::TaskCancellationGroup to do so.
* Headers.cmake:
* Modules/encryptedmedia/MediaKeySystemAccess.cpp:
* WebCore.xcodeproj/project.pbxproj:
* animation/DocumentTimelinesController.cpp:
(WebCore::DocumentTimelinesController::cacheCurrentTime):
(WebCore::DocumentTimelinesController::maybeClearCachedCurrentTime):
* animation/DocumentTimelinesController.h:
* dom/ActiveDOMObject.h:
* dom/Document.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
(WebCore::HTMLMediaElement::~HTMLMediaElement):
(WebCore::HTMLMediaElement::scheduleNextSourceChild):
(WebCore::HTMLMediaElement::scheduleCheckPlaybackTargetCompatability):
(WebCore::HTMLMediaElement::seekWithTolerance):
(WebCore::HTMLMediaElement::setVolume):
(WebCore::HTMLMediaElement::scheduleConfigureTextTracks):
(WebCore::HTMLMediaElement::scheduleMediaEngineWasUpdated):
(WebCore::HTMLMediaElement::scheduleUpdatePlayState):
(WebCore::HTMLMediaElement::cancelPendingTasks):
(WebCore::HTMLMediaElement::clearMediaPlayer):
(WebCore::HTMLMediaElement::closeTaskQueues):
(WebCore::HTMLMediaElement::suspend):
(WebCore::HTMLMediaElement::resume):
(WebCore::HTMLMediaElement::virtualHasPendingActivity const):
(WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured):
(WebCore::HTMLMediaElement::mediaPlayerBufferedTimeRangesChanged):
(WebCore::HTMLMediaElement::scheduleUpdateMediaState):
(WebCore::HTMLMediaElement::playbackControlsManagerBehaviorRestrictionsTimerFired):
* html/HTMLMediaElement.h:
* platform/GenericTaskQueue.h: Removed.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(-[WebCoreAVFMovieObserver metadataLoaded]):
(-[WebCoreAVFMovieObserver didEnd:]):
(-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
(-[WebCoreAVFMovieObserver legibleOutput:didOutputAttributedStrings:nativeSampleBuffers:forItemTime:]):
(-[WebCoreAVFMovieObserver outputSequenceWasFlushed:]):
(-[WebCoreAVFMovieObserver metadataOutput:didOutputTimedMetadataGroups:fromPlayerItemTrack:]):
(-[WebCoreAVFMovieObserver metadataCollector:didCollectDateRangeMetadataGroups:indexesOfNewGroups:indexesOfModifiedGroups:]):
(-[WebCoreAVFLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]):
(-[WebCoreAVFLoaderDelegate resourceLoader:didCancelLoadingRequest:]):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::didParseInitializationData):
(WebCore::SourceBufferPrivateAVFObjC::abort):
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
2021-06-07 Wenson Hsieh <wenson_hsieh@apple.com>
Upstream WebKit support for Live Text
https://bugs.webkit.org/show_bug.cgi?id=226706
<rdar://problem/78933684>
Reviewed by Tim Horton.
Upstream WebKit support for the family of "live text" and visual intelligence features from WebKitAdditions.
This encompasses the following features on macOS 12 and iOS 15:
- Text selection and interaction in images.
- Data detectors in images.
- Visual search (Look Up) via context menu in images.
To do this, we rename the IMAGE_EXTRACTION feature flag (and any other similar symbol names that reference
"image extraction" in some capacity) to their real names in macOS and iOS:
- "Text recognition", in code that supports automatic OCR and data detectors in images.
- "Look Up", in code that references the context menu action to invoke visual search.
- "Visual Search", in code that manages QuickLook integration for invoking visual search.
- "Image analysis", in code that directly integrates with VKImageAnalyzer and VKImageAnalyzerRequest.
Tests: fast/images/text-recognition/basic-image-overlay.html
fast/images/text-recognition/click-link-with-image-overlay.html
fast/images/text-recognition/image-overlay-creation-is-idempotent.html
fast/images/text-recognition/image-overlay-in-image-with-zero-font-size.html
fast/images/text-recognition/image-overlay-with-selection-styles.html
fast/images/text-recognition/ios/coalesce-selection-rects-in-image-overlay.html
fast/images/text-recognition/ios/reselect-word-in-image-overlay.html
fast/images/text-recognition/ios/select-word-in-image-overlay-inside-link.html
fast/images/text-recognition/ios/select-word-in-image-overlay.html
fast/images/text-recognition/ios/selection-rects-in-image-overlay.html
fast/images/text-recognition/mac/copy-image-overlay-text-with-context-menu.html
fast/images/text-recognition/mac/image-overlay-text-disables-app-highlight-menu-items.html
fast/images/text-recognition/mac/select-image-overlay-in-link-with-mouse-drag.html
fast/images/text-recognition/mac/select-image-overlay-with-mouse-drag-2.html
fast/images/text-recognition/mac/select-image-overlay-with-mouse-drag-does-not-fire-click.html
fast/images/text-recognition/mac/select-image-overlay-with-mouse-drag.html
fast/images/text-recognition/mac/select-rotated-transparent-image-overlay.html
fast/images/text-recognition/mac/select-word-in-draggable-image-overlay.html
fast/images/text-recognition/mac/select-word-in-transparent-image-overlay.html
* WebCore.xcodeproj/project.pbxproj:
* editing/cocoa/DataDetection.h:
* editing/cocoa/DataDetection.mm:
(WebCore::DataDetection::createElementForImageOverlay):
* en.lproj/Localizable.strings:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::updateWithTextRecognitionResult):
(WebCore::HTMLElement::updateWithImageExtractionResult): Deleted.
* html/HTMLElement.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::requestTextRecognition):
(WebCore::ChromeClient::requestImageExtraction): Deleted.
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
(WebCore::ContextMenuController::populate):
(WebCore::ContextMenuController::checkOrEnableIfNeeded const):
* page/EventHandler.cpp:
(WebCore::EventHandler::EventHandler):
(WebCore::EventHandler::clear):
(WebCore::EventHandler::mouseMoved):
(WebCore::EventHandler::updateMouseEventTargetNode):
(WebCore::EventHandler::m_textRecognitionHoverTimerFired):
(WebCore::EventHandler::imageExtractionTimerFired): Deleted.
* page/EventHandler.h:
* page/Quirks.cpp:
* page/Quirks.h:
* platform/ContextMenuItem.cpp:
(WebCore::isValidContextMenuAction):
* platform/ContextMenuItem.h:
* platform/LocalizedStrings.h:
* platform/TextRecognitionResult.h: Renamed from Source/WebCore/platform/ImageExtractionResult.h.
Rename the following:
- ImageExtractionResult => TextRecognitionResult
- ImageExtractionTextData => TextRecognitionWordData
- ImageExtractionLineData => TextRecognitionLineData
- ImageExtractionDataDetectorInfo => TextRecognitionDataDetector
(WebCore::TextRecognitionWordData::TextRecognitionWordData):
(WebCore::TextRecognitionWordData::encode const):
(WebCore::TextRecognitionWordData::decode):
(WebCore::TextRecognitionLineData::TextRecognitionLineData):
(WebCore::TextRecognitionDataDetector::TextRecognitionDataDetector):
(WebCore::TextRecognitionLineData::encode const):
(WebCore::TextRecognitionLineData::decode):
(WebCore::TextRecognitionResult::isEmpty const):
(WebCore::TextRecognitionResult::encode const):
(WebCore::TextRecognitionResult::decode):
* platform/cocoa/LocalizedStringsCocoa.mm:
(WebCore::contextMenuItemTagLookUpImage):
(WebCore::contextMenuItemTagRevealImage): Deleted.
* testing/Internals.cpp:
(WebCore::makeDataForLine):
(WebCore::Internals::installImageOverlay):
2021-06-07 Eleni Maria Stea <estea@igalia.com>
Compile error by trying to fit a GCGLint64* to a GLint64*
https://bugs.webkit.org/show_bug.cgi?id=226639
Reviewed by Kenneth Russell.
ANGLE functions GetInteger64vRobustANGLE and
GetInteger64i_vRobustANGLE expect a value of GLint64* aka
long int * but we try to fit a pointer to a long long int.
Fixed compile errors.
* platform/graphics/GraphicsTypesGL.h:
2021-06-07 Antoine Quint <graouts@webkit.org>
REGRESSION (r272201): iPad render flashing on load
https://bugs.webkit.org/show_bug.cgi?id=226216
<rdar://problem/78466306>
Reviewed by Simon Fraser.
When we switched to wrapping all animations in animation groups for bug 219894, we neglected to update GraphicsLayerCA::moveOrCopyAnimations().
We now iterate over m_animationGroups which contain the animation groups that are current and in the order they were added, and also ensure
we preserve the original begin time for each group.
Test: webanimations/accelerated-animation-tiled-while-running.html
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::moveOrCopyLayerAnimation):
(WebCore::GraphicsLayerCA::moveOrCopyAnimations):
* platform/graphics/ca/GraphicsLayerCA.h:
2021-06-07 Devin Rousso <drousso@apple.com>
Convert WebCore::SnapshotOptions into an enum class
https://bugs.webkit.org/show_bug.cgi?id=226730
Reviewed by Wenson Hsieh.
Convert `SnapshotOptions` into an `enum class SnapshotFlags` and create a container `struct
SnapshotOptions` that also allows for changing the `DestinationColorSpace` (defaults to sRGB)
and `PixelFormat` (defaults to BGRA8).
No behavior change.
* page/FrameSnapshotting.h:
* page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRect):
(WebCore::snapshotFrameRectWithClip):
(WebCore::snapshotSelection):
(WebCore::snapshotNode):
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::snapshotRect):
* page/PageColorSampler.cpp:
(WebCore::sampleColor):
* page/PageConsoleClient.cpp:
(WebCore::PageConsoleClient::screenshot):
* page/TextIndicator.cpp:
(WebCore::snapshotOptionsForTextIndicatorOptions):
(WebCore::takeSnapshot):
(WebCore::takeSnapshots):
* platform/DragImage.cpp:
(WebCore::createDragImageForSelection):
(WebCore::createDragImageForRange):
2021-06-07 Imanol Fernandez <ifernandez@igalia.com>
Change WebXRSpace::efectiveOrigin() matrix multiplication order
https://bugs.webkit.org/show_bug.cgi?id=224364
<rdar://problem/76754680>
Reviewed by Sergio Villar Senin.
The current multiplication order is not working correctly when combining local-floor space and getOfffsetReferenceSpace().
The reference space is out of sync with input ray pose after some teleportations:
https://github.com/immersive-web/webxr-samples/blob/main/teleportation.html
Tested using WebXR WPT tests.
* Modules/webxr/WebXRSpace.cpp:
(WebCore::WebXRSpace::effectiveOrigin const):
2021-06-07 Imanol Fernandez <ifernandez@igalia.com>
Use 3D points to map the WebXRBoundedReferenceSpace bounds transform
https://bugs.webkit.org/show_bug.cgi?id=224365
<rdar://problem/76754927>
Reviewed by Sergio Villar Senin.
WebXRBoundedReferenceSpace is currently using Point2D mapping to transfom the bounds geometry.
This is not correct because the originOffset is a 3D transform and it expects the bounds depth
coordinates to be on the z axis instead of the y axis.
Tested by WebXR WPT tests.
* Modules/webxr/WebXRBoundedReferenceSpace.cpp:
(WebCore::WebXRBoundedReferenceSpace::updateIfNeeded):
2021-06-07 Antti Koivisto <antti@apple.com>
Factor selection state computation out of LegacyInlineTextBox
https://bugs.webkit.org/show_bug.cgi?id=226718
Reviewed by Alan Bujtas.
Move the code to SelectionRangeData.
* layout/integration/LayoutIntegrationRunIteratorModernPath.h:
(WebCore::LayoutIntegration::RunIteratorModernPath::selectableRange const):
* rendering/HighlightData.cpp:
(WebCore::HighlightData::highlightStateForRenderer):
(WebCore::HighlightData::highlightStateForTextBox):
(WebCore::HighlightData::rangeForTextBox):
* rendering/HighlightData.h:
(WebCore::HighlightData::HighlightData):
* rendering/LegacyInlineTextBox.cpp:
(WebCore::LegacyInlineTextBox::selectionState):
(WebCore::LegacyInlineTextBox::selectableRange const):
(WebCore::LegacyInlineTextBox::selectionStartEnd const):
(WebCore::LegacyInlineTextBox::highlightStartEnd const):
(WebCore::LegacyInlineTextBox::verifySelectionState const): Deleted.
(WebCore::LegacyInlineTextBox::clampedStartEndForState const): Deleted.
* rendering/LegacyInlineTextBox.h:
* rendering/SelectionRangeData.cpp:
(WebCore::SelectionRangeData::SelectionRangeData):
* rendering/TextBoxSelectableRange.h:
2021-06-07 Wenson Hsieh <wenson_hsieh@apple.com>
[Cocoa] Find-in-page should match text inside image overlays
https://bugs.webkit.org/show_bug.cgi?id=226704
Reviewed by Tim Horton.
Add a new TextIteratorBehavior to allow TextIterator to descend into image overlay content, and use this option
when creating TextIterators for find-in-page. See WebKit/ChangeLog for more details.
Test: WebKit.FindTextInImageOverlay
* editing/TextIterator.cpp:
(WebCore::TextIterator::handleReplacedElement):
(WebCore::findIteratorOptions):
* editing/TextIteratorBehavior.h:
2021-06-07 Alicia Boya García <aboya@igalia.com>
[GStreamer] Add clang TSA annotations: MainThreadNotifier
https://bugs.webkit.org/show_bug.cgi?id=226717
Reviewed by Xabier Rodriguez-Calvar.
Adds clang thread safety annotations to
MainThreadNotifier.h
* platform/graphics/gstreamer/MainThreadNotifier.h:
2021-06-07 Alicia Boya García <aboya@igalia.com>
[GStreamer] Add clang TSA annotations: InbandTextTrackPrivateGStreamer
https://bugs.webkit.org/show_bug.cgi?id=226716
Reviewed by Xabier Rodriguez-Calvar.
Adds clang thread safety annotations to
InbandTextTrackPrivateGStreamer.h.
* platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
2021-06-07 Alicia Boya García <aboya@igalia.com>
[GStreamer] Fix clang TSA warning in AbortableTaskQueue
https://bugs.webkit.org/show_bug.cgi?id=226715
Reviewed by Michael Catanzaro.
Fixes a clang thread safety analysis warning in AbortableTaskQueue.
* platform/AbortableTaskQueue.h:
2021-06-06 Antti Koivisto <antti@apple.com>
Factor selection clamping into a type
https://bugs.webkit.org/show_bug.cgi?id=226697
Reviewed by Sam Weinig.
TextBoxSelectableRange will be helpful for moving selection code out of the legacy inline boxes.
It also allows some code sharing already in this patch.
* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* layout/integration/LayoutIntegrationRunIteratorLegacyPath.h:
(WebCore::LayoutIntegration::RunIteratorLegacyPath::isSelectable const):
* layout/integration/LayoutIntegrationRunIteratorModernPath.h:
(WebCore::LayoutIntegration::RunIteratorModernPath::positionForOffset const):
(WebCore::LayoutIntegration::RunIteratorModernPath::isSelectable const):
(WebCore::LayoutIntegration::RunIteratorModernPath::selectionRect const):
(WebCore::LayoutIntegration::RunIteratorModernPath::selectableRange const):
(WebCore::LayoutIntegration::RunIteratorModernPath::clampedOffset const): Deleted.
* rendering/LegacyInlineTextBox.cpp:
(WebCore::LegacyInlineTextBox::isSelectable const):
(WebCore::LegacyInlineTextBox::localSelectionRect const):
(WebCore::LegacyInlineTextBox::paint):
(WebCore::LegacyInlineTextBox::selectableRange const):
(WebCore::LegacyInlineTextBox::clampedStartEndForState const):
(WebCore::LegacyInlineTextBox::calculateDocumentMarkerBounds const):
(WebCore::LegacyInlineTextBox::collectMarkedTextsForDraggedContent):
(WebCore::LegacyInlineTextBox::collectMarkedTextsForDocumentMarkers const):
(WebCore::LegacyInlineTextBox::paintCompositionBackground):
(WebCore::LegacyInlineTextBox::positionForOffset const):
(WebCore::LegacyInlineTextBox::isSelected const): Deleted.
(WebCore::LegacyInlineTextBox::clampedOffset const): Deleted.
* rendering/LegacyInlineTextBox.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::inlineSelectionGaps):
* rendering/TextBoxSelectableRange.h: Added.
(WebCore::TextBoxSelectableRange::clamp const):
(WebCore::TextBoxSelectableRange::intersects const):
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::localSelectionRect const):
2021-06-06 Chris Dumez <cdumez@apple.com>
Drop MainThreadTaskDispatcher and use callOnMainThread() instead
https://bugs.webkit.org/show_bug.cgi?id=226701
Reviewed by Darin Adler.
Drop MainThreadTaskDispatcher and use callOnMainThread() instead. There is a no need for a
global Timer or a Deque of tasks.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/DeferrableTask.h:
(WebCore::MainThreadDeferrableTask::scheduleTask):
* platform/GenericTaskQueue.cpp: Removed.
* platform/GenericTaskQueue.h:
(WebCore::MainThreadTaskQueue::MainThreadTaskQueue):
(WebCore::MainThreadTaskQueue::enqueueTask):
2021-06-06 Chris Dumez <cdumez@apple.com>
Stop using legacy EventLoopDeferrableTask
https://bugs.webkit.org/show_bug.cgi?id=226700
Reviewed by Darin Adler.
Stop using legacy EventLoopDeferrableTask and drop the class entirely. Call sites are
now using the HTML event loop directly and using WTF::CancellableTask to wrap the task
they schedule. This achieves the same result as EventLoopDeferrableTask but is more
lightweight and flexible.
* animation/DocumentTimelinesController.cpp:
(WebCore::DocumentTimelinesController::DocumentTimelinesController):
(WebCore::DocumentTimelinesController::detachFromDocument):
(WebCore::DocumentTimelinesController::cacheCurrentTime):
* animation/DocumentTimelinesController.h:
* dom/ActiveDOMObject.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
(WebCore::HTMLMediaElement::~HTMLMediaElement):
(WebCore::HTMLMediaElement::scheduleCheckPlaybackTargetCompatability):
(WebCore::HTMLMediaElement::seekWithTolerance):
(WebCore::HTMLMediaElement::setVolume):
(WebCore::HTMLMediaElement::scheduleConfigureTextTracks):
(WebCore::HTMLMediaElement::scheduleMediaEngineWasUpdated):
(WebCore::HTMLMediaElement::scheduleUpdatePlayState):
(WebCore::HTMLMediaElement::cancelPendingTasks):
(WebCore::HTMLMediaElement::closeTaskQueues):
(WebCore::HTMLMediaElement::suspend):
(WebCore::HTMLMediaElement::resume):
(WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured):
(WebCore::HTMLMediaElement::mediaPlayerBufferedTimeRangesChanged):
(WebCore::HTMLMediaElement::scheduleUpdateMediaState):
(WebCore::HTMLMediaElement::playbackControlsManagerBehaviorRestrictionsTimerFired):
* html/HTMLMediaElement.h:
* platform/DeferrableTask.h:
2021-06-06 Wenson Hsieh <wenson_hsieh@apple.com>
Turn TextIteratorBehaviorFlag into an enum class and wrap it in OptionSet
https://bugs.webkit.org/show_bug.cgi?id=226691
Reviewed by Darin Adler.
Modernize some editing code by turning `TextIteratorBehaviorFlag` into an enum class, `TextIteratorBehavior`,
with an explicit width of 16 bits. Additionally, since this is a bitmask, refactor various codepaths to use
`OptionSet<TextIteratorBehavior>` instead of the underlying type.
This gives us improved type safety when using this enum, and also narrows the width of this enum to 16 bits
(from 32). No change in behavior.
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::traverseToOffsetInRange):
(WebCore::AXObjectCache::rangeMatchesTextNearRange):
(WebCore::AXObjectCache::nextBoundary):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::textIteratorBehaviorForTextRange const):
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityObjectInterface.h:
* accessibility/atk/WebKitAccessibleHyperlink.cpp:
(rangeLengthForObject):
* accessibility/atk/WebKitAccessibleInterfaceText.cpp:
(getSelectionOffsetsForObject):
* accessibility/atk/WebKitAccessibleUtil.cpp:
(objectFocusedAndCaretOffsetUnignored):
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::textIteratorBehaviorForTextRange const):
Fix this method to return the empty (default) option set instead of `false` (which was previously implicitly
converted to `TextIteratorDefaultBehavior`).
* accessibility/isolatedtree/AXIsolatedObject.h:
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyBlockStyle):
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::moveParagraphs):
* editing/Editing.cpp:
(WebCore::indexForVisiblePosition):
(WebCore::visiblePositionForIndex):
* editing/Editor.cpp:
(WebCore::Editor::selectedText const):
(WebCore::Editor::selectedTextForDataTransfer const):
* editing/Editor.h:
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplacementFragment::ReplacementFragment):
* editing/TextIterator.cpp:
(WebCore::isClippedByFrameAncestor):
(WebCore::TextIterator::TextIterator):
(WebCore::TextIterator::init):
(WebCore::firstChild):
(WebCore::nextSibling):
(WebCore::nextNode):
(WebCore::isDescendantOf):
(WebCore::parentNodeOrShadowHost):
(WebCore::TextIterator::advance):
(WebCore::TextIterator::handleTextNode):
(WebCore::TextIterator::handleTextRun):
(WebCore::TextIterator::handleTextNodeFirstLetter):
(WebCore::TextIterator::handleReplacedElement):
(WebCore::TextIterator::shouldRepresentNodeOffsetZero):
(WebCore::TextIterator::shouldEmitSpaceBeforeAndAfterNode):
(WebCore::TextIterator::handleNonTextNode):
(WebCore::TextIterator::exitNode):
(WebCore::TextIterator::emitText):
(WebCore::SimplifiedBackwardsTextIterator::handleNonTextNode):
(WebCore::SimplifiedBackwardsTextIterator::exitNode):
(WebCore::CharacterIterator::CharacterIterator):
(WebCore::characterCount):
(WebCore::resolveCharacterRange):
(WebCore::hasAnyPlainText):
(WebCore::plainText):
(WebCore::plainTextReplacingNoBreakSpace):
(WebCore::findIteratorOptions):
* editing/TextIterator.h:
(WebCore::characterCount):
(WebCore::characterRange):
(WebCore::resolveCharacterLocation):
(WebCore::resolveCharacterRange):
(WebCore::plainText):
(WebCore::hasAnyPlainText):
(WebCore::plainTextReplacingNoBreakSpace):
(WebCore::TextIterator::TextIterator):
(WebCore::CharacterIterator::CharacterIterator):
* editing/TextIteratorBehavior.h:
Add an alias for `OptionSet<TextIteratorBehavior>`, `TextIteratorBehaviors`, to help with readability when
specifying or consulting these flags. Additionally remove the `TextIteratorDefaultBehavior` enum value
altogether, since we can now just use the default constructor (`OptionSet<TextIteratorBehavior> { }`) to get a
set of empty options.
* editing/TextManipulationController.cpp:
(WebCore::ParagraphContentIterator::ParagraphContentIterator):
* editing/VisibleSelection.cpp:
(WebCore::VisibleSelection::appendTrailingWhitespace):
* editing/VisibleUnits.cpp:
(WebCore::nextBoundary):
* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::renderedTextRespectingRange):
* page/EventHandler.cpp:
(WebCore::textDistance):
2021-06-06 Chris Dumez <cdumez@apple.com>
Flaky assertion hit in AudioSessionRoutingArbitratorProxy::endRoutingArbitration()
https://bugs.webkit.org/show_bug.cgi?id=226699
Reviewed by Darin Adler.
If m_setupArbitrationOngoing is true, then beginRoutingArbitrationForToken() only adds the token to
m_tokens once the setup is done, asynchronously. As a result, if endRoutingArbitrationForToken() during
setup, the `isInRoutingArbitrationForToken(token)` assertion will hit, because the token wasn't added
to m_tokens yet. Tweak the assertion so that it doesn't hit when m_setupArbitrationOngoing is true.
This is a speculative fix as I wasn't able to reproduce the assertion hit locally.
* platform/audio/mac/SharedRoutingArbitrator.mm:
(WebCore::SharedRoutingArbitrator::endRoutingArbitrationForToken):
2021-06-06 Darin Adler <darin@apple.com>
Handle custom identifiers and strings separately, so we can quote strings correctly consistently
https://bugs.webkit.org/show_bug.cgi?id=226694
Reviewed by Sam Weinig.
Progressions in a number of WPT tests.
* animation/CSSAnimation.cpp:
(WebCore::CSSAnimation::CSSAnimation): Update since Animation::name() now
returns a struct.
* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes): Ditto.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::OrderedNamedLinesCollector::appendLines const): Use
createCustomIdent for line names.
(WebCore::valueForGridPosition): Use createCustomIdent for grid line name.
(WebCore::createTransitionPropertyValue): Use createCustomIdent for
animation property names.
(WebCore::counterToCSSValue): Use createCustomIdent for counter names.
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle): Use
createCustomIdent for list-style-type, locale, animation names if they
were created from a custom-ident, and line-grid.
* css/CSSCustomIdentValue.cpp: Emptied out this file; we can delete it soon.
* css/CSSCustomIdentValue.h: Ditto.
* css/CSSMarkup.cpp:
(WebCore::serializeCharacterAsCodePoint): Optimized to do a single
StringBuilder::append call.
(WebCore::serializeAsStringOrCustomIdent): Deleted.
* css/CSSMarkup.h: Removed serializeAsStringOrCustomIdent.
* css/CSSPrimitiveValue.cpp:
(WebCore::isValidCSSUnitTypeForDoubleConversion): Added a case for
CustomIdent. Changed CSS_IDENT to assert not reached, since it should
never be passed to this function. More cleanup of CSSUnitType is needed,
but for now mostly leaving it alone.
(WebCore::isStringType): Added a case for CustomIdent. Moved CSS_DIMENSION,
which was incorrectly returning true, to return false. Pretty sure there's
no way to create one of these with CSS_DIMENSION, but this is less peculiar.
(WebCore::CSSPrimitiveValue::primitiveType const): Added transformation
from CustomIdent to CSS_IDENT as we do with CSS_PROPERTY_ID and CSS_VALUE_ID.
(WebCore::CSSPrimitiveValue::cleanup): Added a case for CustomIdent.
Moved CSS_DIMENSION to the correct section. Pretty sure there's no way to
create one of these with CSS_DIMENSION, but this is less peculiar.
(WebCore::CSSPrimitiveValue::setFloatValue): Deleted.
(WebCore::CSSPrimitiveValue::setStringValue): Deleted.
(WebCore::CSSPrimitiveValue::getStringValue const): Deleted.
(WebCore::CSSPrimitiveValue::stringValue const): Added a case for CustomIdent.
(WebCore::CSSPrimitiveValue::unitTypeString): Added a case for CustomIdent
and an ASSERT_NOT_REACHED for invalid enumeration values.
(WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):
Removed inaccurate FIXME comment for CSS_DIMENSION and changed it to do
something less wrong, but still incorrect. Pretty sure there's no way to
create one of these with CSS_DIMENSION, but this is less peculiar. Changed
CSS_STRING case to always serializeAsString. Added a CustomIdent case
that always serializes as an identifier.
(WebCore::CSSPrimitiveValue::equals const): Moved the CSS_DIMENSION to
the correct part of this switch statement. Pretty sure there's no way to
create one of these with CSS_DIMENSION, but this is less peculiar.
Added case for CustomIdent.
* css/CSSPrimitiveValue.h: Made isFontRelativeLength, isResolution,
and isViewportPercentageLength private. Made those plus isLength all
constexpr. Removed WEBCORE_EXPORT from primitiveType and getFloatValue:
those needed to be exported when this was the web-exposed class, but
that is now DeprecatedCSSOMPrimitiveValue. Deleted setFloatValue,
setStringValue, and getStringValue for the same reason: those functions
are now in DeprecatedCSSOMPrimitiveValue and don't need to be here.
* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapAnimationName): Updated to pass a boolean
in to the animation name to keep track of whether it was created with
a string or a custom-ident so we it can properly round-trip in computed
style. This is required to pass some of the WPT tests, although I could
not find clear guidance in the specification that this behavior is required.
The same name with a string and custom-ident are equivalent in other ways.
* css/CSSUnits.cpp:
(WebCore::operator<<): Added a case for CustomIdent.
* css/CSSUnits.h: Added CustomIdent. Added some FIXME about how we can
change this in the future. It's a remnant of the past when these were part
of our web-facing API, and this can be greatly cleaned up.
* css/CSSValue.cpp:
(WebCore::CSSValue::cssText const): Removed CSSCustomIdentValue.h,
CustomIdentClass, CSSCustomIdentValue. We are not going to use a separate
class for custom-ident, just a separate type of primitive value.
(WebCore::CSSValue::destroy): Ditto.
* css/CSSValue.h: Deleted isCustomIdentValue and CustomIdentClass.
* css/CSSValueList.cpp:
(WebCore::CSSValueList::customCSSText const): Tweaked algorithm
to be slightly more efficient.
* css/CSSValuePool.h: Added createCustomIdent. Later should remove
the create function that takes a string value and a type and use
separate named functions for the few different cases, but doing the
new one this way for now.
* css/DeprecatedCSSOMPrimitiveValue.cpp:
(WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType const):
Rewrote this to be a switch that preserves the current behavior
but no longer relies on the numeric values of CSSUnitType values.
Added a FIXME about using CSS_UNKNOWN more: some of the numbers
we are exposing to the web are doing no good.
(WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue): Moved this
function to the header.
(WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue const):
Rewrote this to be a switch as above. Preserves current behavior
but stops relying on CSSUnitType numeric values.
(WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue): Moved this
function to the header.
(WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue const):
Ditto. By putting a switch on primitiveType here, we can enforce
the desired exception behavior here, instead of getting it from
CSSPrimitiveValue, and it's better for this class to deal with
the legacy bindings issues.
(WebCore::DeprecatedCSSOMPrimitiveValue::getCounterValue const): Ditto.
(WebCore::DeprecatedCSSOMPrimitiveValue::getRectValue const): Ditto.
(WebCore::DeprecatedCSSOMPrimitiveValue::getRGBColorValue const): Ditto.
* css/DeprecatedCSSOMPrimitiveValue.h: Removed unneeded cssValueType
function. Made both setFloatValue and setStringValue simpler since
they always raise an exception and we do not intend to change that.
Also stop using protected since we have no classes derived from this.
Could do more cleanup, but this is a start.
* css/DeprecatedCSSOMValue.cpp:
(WebCore::DeprecatedCSSOMValue::cssValueType const): Put the constant
values, CSS_PRIMITIVE_VALUE and CSS_VALUE_LIST, here rather than
calling member functions.
* css/DeprecatedCSSOMValueList.cpp:
(WebCore::DeprecatedCSSOMValueList::cssText const): Tweaked to make
the code more efficient.
* css/DeprecatedCSSOMValueList.h: Removed unneeded cssValueType
function and const overload of item function. Also stop using protected
since we have no classes derived from this.
* css/MediaQueryExpression.cpp:
(WebCore::featureWithValidIdent): Fixed indentation to match WebKit style.
(WebCore::featureWithValidDensity): Ditto.
(WebCore::featureWithValidPositiveLength): Ditto.
(WebCore::featureExpectingPositiveInteger): Ditto.
(WebCore::featureWithPositiveNumber): Ditto.
* css/calc/CSSCalcCategoryMapping.cpp:
(WebCore::hasDoubleValue): Added a case for CustomIdent.
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeWillChange): Removed comment saying we should use
CSSCustomIdentValue since using a property ID for the value is great.
(WebCore::consumeAnimationName): Removed comment saying we should use
CSSCustomIdentValue here because that would be incorrect: we need to
preserve and round-trip the fact that this was string, not custom-ident.
(WebCore::consumeTransitionProperty): Remove special case for
CSSValueAll that wasn't doing anything. Removed comment saying we should
use CSSCustomIdentValue since using a value ID for the value is great.
(WebCore::consumeAttr): Updated comment.
(WebCore::isCustomIdentValue): Updated to work with the new primitive value.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
Use the new createCustomIdent and removed an outdated comment. While we
might some day want to implement custom-ident differently, we won't need
to change the code here to make that happen.
* platform/animation/Animation.cpp:
(WebCore::Animation::animationsMatch const): Update since m_name now is a
struct.
(WebCore::Animation::initialName): Update to return Name instead of String.
(WebCore::operator<<): Update since name() now returns a struct.
* platform/animation/Animation.h: Added the Name struct so we can store a
boolean to indicate whether it's a string or custom-ident for round tripping.
Update types and implementations of function and data members accordingly.
* style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::createGridPosition): Update code to expect
custom-ident instead of string; they used to both be the same thing.
* style/Styleable.cpp:
(WebCore::shouldConsiderAnimation): Update since Animation::name() now
returns a struct. Also got rid of unsuccessful attempt to optimize comparison
againt the string "none"; later might be good to clean out that special case.
(WebCore::Styleable::updateCSSAnimations const): Ditto.
2021-06-06 Jean-Yves Avenard <jya@apple.com>
[GPUP][MSE] QuotaExceededError Exception not thrown even if the sum of totalTrackBufferSize and appendBuffer size exceeds maximumBufferSize
https://bugs.webkit.org/show_bug.cgi?id=226034
rdar://78579904
Reviewed by Eric Carlson.
Existing media-source-append-buffer-full-quota-exceeded-error.html test will
be exercising this code once bug 225367 has been fixed.
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::appendBufferInternal): fly-by fix, use size of pending
buffer rather than the capacity of the holding vector.
* platform/graphics/SourceBufferPrivate.h: Make totalTrackBufferSizeInBytes method virtual.
2021-06-06 Chris Dumez <cdumez@apple.com>
Reduce use of legacy EventLoopEventQueue and EventLoopTaskQueue
https://bugs.webkit.org/show_bug.cgi?id=226692
Reviewed by Darin Adler.
Reduce use of legacy EventLoopEventQueue and EventLoopTaskQueue, and use the HTML event
loop directly instead. Those are very simple cases, they really don't need any of the
features the queue was providing (such as cancelling events).
To get rid of the remaining usage of EventLoopEventQueue / EventLoopTaskQueue, I believe
we'll need a way to cancel tasks scheduled in the HTML event loop.
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::MediaSessionCoordinator):
(WebCore::MediaSessionCoordinator::coordinatorStateChanged):
* Modules/mediasession/MediaSessionCoordinator.h:
* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::MediaSource):
(WebCore::MediaSource::virtualHasPendingActivity const):
(WebCore::MediaSource::scheduleEvent):
* Modules/mediasource/MediaSource.h:
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::SourceBuffer):
(WebCore::SourceBuffer::virtualHasPendingActivity const):
(WebCore::SourceBuffer::scheduleEvent):
* Modules/mediasource/SourceBuffer.h:
* Modules/mediasource/SourceBufferList.cpp:
(WebCore::SourceBufferList::SourceBufferList):
(WebCore::SourceBufferList::scheduleEvent):
* Modules/mediasource/SourceBufferList.h:
* Modules/remoteplayback/RemotePlayback.cpp:
(WebCore::RemotePlayback::RemotePlayback):
(WebCore::RemotePlayback::watchAvailability):
(WebCore::RemotePlayback::cancelWatchAvailability):
(WebCore::RemotePlayback::prompt):
(WebCore::RemotePlayback::setState):
(WebCore::RemotePlayback::disconnect):
(WebCore::RemotePlayback::availabilityChanged):
(WebCore::RemotePlayback::stop): Deleted.
* Modules/remoteplayback/RemotePlayback.h:
* animation/DocumentTimelinesController.cpp:
(WebCore::DocumentTimelinesController::DocumentTimelinesController):
(WebCore::DocumentTimelinesController::detachFromDocument):
(WebCore::DocumentTimelinesController::cacheCurrentTime):
(WebCore::DocumentTimelinesController::maybeClearCachedCurrentTime):
* animation/DocumentTimelinesController.h:
* dom/FullscreenManager.cpp:
(WebCore::FullscreenManager::FullscreenManager):
(WebCore::FullscreenManager::requestFullscreenForElement):
(WebCore::FullscreenManager::exitFullscreen):
(): Deleted.
* dom/FullscreenManager.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
(WebCore::HTMLMediaElement::~HTMLMediaElement):
(WebCore::HTMLMediaElement::removedFromAncestor):
(WebCore::HTMLMediaElement::scheduleResolvePendingPlayPromises):
(WebCore::HTMLMediaElement::scheduleRejectPendingPlayPromises):
(WebCore::HTMLMediaElement::scheduleNotifyAboutPlaying):
(WebCore::HTMLMediaElement::setMediaKeys):
(WebCore::HTMLMediaElement::closeTaskQueues):
(WebCore::HTMLMediaElement::virtualHasPendingActivity const):
(WebCore::HTMLMediaElement::setIsPlayingToWirelessTarget):
(WebCore::HTMLMediaElement::enterFullscreen):
(WebCore::HTMLMediaElement::isVisibleInViewportChanged):
* html/HTMLMediaElement.h:
* html/shadow/MediaControlTextTrackContainerElement.cpp:
(WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement):
(WebCore::MediaControlTextTrackContainerElement::updateSizes):
* html/shadow/MediaControlTextTrackContainerElement.h:
* html/track/TrackListBase.cpp:
(WebCore::TrackListBase::TrackListBase):
(WebCore::TrackListBase::scheduleChangeEvent):
(WebCore::TrackListBase::isChangeEventScheduled const):
(WebCore::TrackListBase::virtualHasPendingActivity const): Deleted.
* html/track/TrackListBase.h:
* platform/network/curl/CurlMultipartHandle.cpp:
(WebCore::CurlMultipartHandle::processContent):
(WebCore::CurlMultipartHandle::matchedLength):
* platform/network/curl/CurlMultipartHandle.h:
* testing/MockMediaSessionCoordinator.h:
2021-06-06 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Adopt a less quirky fixed column width space distribution
https://bugs.webkit.org/show_bug.cgi?id=226696
Reviewed by Antti Koivisto.
This patch adopts a less quirky space distribution model where any fixed cell width
makes the column fixed (as opposed to just when <col> has fixed with).
This distribution model matches both Chrome and Firefox.
It also enables us to simplify some of the distribution logic by using the same set of values (min vs max)
as the base for the distribution ratio.
Test: fast/layoutformattingcontext/table-fixed-width-variations-simple.html
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns): Collect the fixed with values from the cells too now.
* layout/formattingContexts/table/TableFormattingGeometry.cpp:
(WebCore::Layout::TableFormattingGeometry::intrinsicWidthConstraintsForCellContent const):
(WebCore::Layout::TableFormattingGeometry::intrinsicWidthConstraintsForCell const): Deleted.
* layout/formattingContexts/table/TableFormattingGeometry.h:
* layout/formattingContexts/table/TableGrid.cpp:
(WebCore::Layout::TableGrid::appendCell):
(WebCore::Layout::TableGrid::Column::isFixedWidth const): Deleted.
(WebCore::Layout::TableGrid::Columns::hasFixedColumnsOnly const): Deleted.
(WebCore::Layout::TableGrid::Cell::isFixedWidth const): Deleted.
* layout/formattingContexts/table/TableGrid.h:
(WebCore::Layout::TableGrid::Column::setFixedWidth):
(WebCore::Layout::TableGrid::Column::fixedWidth const):
(WebCore::Layout::TableGrid::Columns::logicalWidth const):
(WebCore::Layout::TableGrid::Column::setHasFixedWidthCell): Deleted.
(WebCore::Layout::TableGrid::Column::hasFixedWidthCell const): Deleted.
* layout/formattingContexts/table/TableLayout.cpp:
(WebCore::Layout::TableFormattingContext::TableLayout::distributedHorizontalSpace): Adjust the distribution values based on whether
the column has fixed width and use max/max in both fixed and non-fixed cases.
2021-06-06 Antti Koivisto <antti@apple.com>
Rename InlineElementBox to LegacyInlineElementBox
https://bugs.webkit.org/show_bug.cgi?id=226695
Reviewed by Sam Weinig.
Also EllipsisBox -> LegacyEllipsisBox.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AXObjectCache.cpp:
* dom/Position.cpp:
* layout/integration/LayoutIntegrationRunIterator.h:
* rendering/LegacyEllipsisBox.cpp: Renamed from Source/WebCore/rendering/EllipsisBox.cpp.
(WebCore::LegacyEllipsisBox::LegacyEllipsisBox):
(WebCore::LegacyEllipsisBox::paint):
(WebCore::LegacyEllipsisBox::markupBox const):
(WebCore::LegacyEllipsisBox::paintMarkupBox):
(WebCore::LegacyEllipsisBox::selectionRect):
(WebCore::LegacyEllipsisBox::paintSelection):
(WebCore::LegacyEllipsisBox::nodeAtPoint):
* rendering/LegacyEllipsisBox.h: Renamed from Source/WebCore/rendering/EllipsisBox.h.
* rendering/LegacyInlineElementBox.cpp: Renamed from Source/WebCore/rendering/InlineElementBox.cpp.
(WebCore::LegacyInlineElementBox::deleteLine):
(WebCore::LegacyInlineElementBox::extractLine):
(WebCore::LegacyInlineElementBox::attachLine):
(WebCore::LegacyInlineElementBox::paint):
(WebCore::LegacyInlineElementBox::nodeAtPoint):
* rendering/LegacyInlineElementBox.h: Renamed from Source/WebCore/rendering/InlineElementBox.h.
(WebCore::LegacyInlineElementBox::LegacyInlineElementBox):
* rendering/LegacyInlineFlowBox.cpp:
(WebCore::LegacyInlineFlowBox::nodeAtPoint):
* rendering/LegacyInlineTextBox.cpp:
(WebCore::LegacyInlineTextBox::selectionState):
* rendering/LegacyLineLayout.cpp:
(WebCore::LegacyLineLayout::computeBlockDirectionPositionsForLine):
* rendering/LegacyRootInlineBox.cpp:
(WebCore::LegacyRootInlineBox::placeEllipsis):
(WebCore::LegacyRootInlineBox::ellipsisBox const):
* rendering/LegacyRootInlineBox.h:
* rendering/RenderBlock.cpp:
* rendering/RenderBlock.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::createInlineBox):
(WebCore::RenderBox::positionLineBox):
* rendering/RenderBox.h:
(WebCore::RenderBox::inlineBoxWrapper const):
(WebCore::RenderBox::setInlineBoxWrapper):
* rendering/RenderFragmentedFlow.cpp:
(WebCore::RenderFragmentedFlow::computedFragmentRangeForBox const):
* rendering/RenderImage.cpp:
* rendering/RenderInline.cpp:
* rendering/RenderLineBoxList.cpp:
* rendering/RenderLineBreak.cpp:
(WebCore::RenderLineBreak::createInlineBox):
(WebCore::RenderLineBreak::setInlineBoxWrapper):
(WebCore::RenderLineBreak::replaceInlineBoxWrapper):
* rendering/RenderLineBreak.h:
* rendering/RenderListItem.cpp:
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::createInlineBox):
* rendering/RenderListMarker.h:
* rendering/RenderReplaced.cpp:
* rendering/RenderText.cpp:
* rendering/RenderTextLineBoxes.cpp:
2021-06-05 Chris Dumez <cdumez@apple.com>
Fix repeated call to String::utf8() in SQLiteFileSystem::computeHashForFileName()
https://bugs.webkit.org/show_bug.cgi?id=226693
Reviewed by Darin Adler.
* platform/sql/SQLiteFileSystem.cpp:
(WebCore::SQLiteFileSystem::computeHashForFileName):
2021-06-05 Chris Dumez <cdumez@apple.com>
Use `const uint8_t*` type more consistently to store bytes in WebKit
https://bugs.webkit.org/show_bug.cgi?id=226688
Reviewed by Darin Adler.
* Modules/cache/DOMCache.cpp:
(WebCore::DOMCache::addAll):
(WebCore::DOMCache::put):
* Modules/fetch/FetchBodyConsumer.cpp:
(WebCore::FetchBodyConsumer::resolve):
(WebCore::FetchBodyConsumer::append):
* Modules/fetch/FetchBodyConsumer.h:
* Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
(WebCore::LibWebRTCDataChannelHandler::OnMessage):
* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::send):
(WebCore::WebSocketChannel::didReceiveSocketStreamData):
(WebCore::WebSocketChannel::appendToBuffer):
(WebCore::WebSocketChannel::startClosingHandshake):
(WebCore::WebSocketChannel::processFrame):
(WebCore::WebSocketChannel::enqueueRawFrame):
(WebCore::WebSocketChannel::processOutgoingFrameQueue):
(WebCore::WebSocketChannel::sendFrame):
* Modules/websockets/WebSocketChannel.h:
* Modules/websockets/WebSocketDeflater.cpp:
(WebCore::setStreamParameter):
(WebCore::WebSocketDeflater::addBytes):
(WebCore::WebSocketInflater::addBytes):
(WebCore::WebSocketInflater::finish):
* Modules/websockets/WebSocketDeflater.h:
(WebCore::WebSocketDeflater::data):
(WebCore::WebSocketInflater::data):
* Modules/websockets/WebSocketFrame.cpp:
(WebCore::WebSocketFrame::parseFrame):
(WebCore::appendFramePayload):
(WebCore::WebSocketFrame::makeFrameData):
(WebCore::WebSocketFrame::WebSocketFrame):
* Modules/websockets/WebSocketFrame.h:
* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::trimInputSample):
(WebCore::WebSocketHandshake::readServerHandshake):
(WebCore::WebSocketHandshake::readStatusLine):
(WebCore::WebSocketHandshake::readHTTPHeaders):
* Modules/websockets/WebSocketHandshake.h:
* Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
(WebCore::WorkerThreadableWebSocketChannel::Bridge::send):
* contentextensions/SerializedNFA.cpp:
(WebCore::ContentExtensions::writeAllToFile):
* crypto/SubtleCrypto.cpp:
(WebCore::SubtleCrypto::unwrapKey):
* crypto/mac/SerializedCryptoKeyWrapMac.mm:
(WebCore::findMasterKey):
* dom/DecodedDataDocumentParser.cpp:
(WebCore::DecodedDataDocumentParser::appendBytes):
* dom/DecodedDataDocumentParser.h:
* dom/DocumentParser.h:
* dom/RawDataDocumentParser.h:
* html/ImageDocument.cpp:
(WebCore::ImageDocumentParser::appendBytes):
* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::appendBytes):
* html/PluginDocument.cpp:
(WebCore::PluginDocumentParser::appendBytes):
* html/track/InbandTextTrack.h:
* html/track/InbandWebVTTTextTrack.cpp:
(WebCore::InbandWebVTTTextTrack::parseWebVTTCueData):
* html/track/InbandWebVTTTextTrack.h:
* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::parseBytes):
(WebCore::WebVTTParser::fileFinished):
* html/track/WebVTTParser.h:
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::addData):
* loader/DocumentWriter.h:
* loader/SinkDocument.cpp:
* loader/TextTrackLoader.cpp:
(WebCore::TextTrackLoader::processNewCueData):
* platform/graphics/InbandTextTrackPrivateClient.h:
* platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
(WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfSample):
* platform/network/HTTPParsers.cpp:
(WebCore::trimInputSample):
(WebCore::isValidHeaderNameCharacter):
(WebCore::parseHTTPHeader):
(WebCore::parseHTTPRequestBody):
* platform/network/HTTPParsers.h:
* platform/network/SocketStreamHandle.cpp:
(WebCore::SocketStreamHandle::sendData):
* platform/network/SocketStreamHandle.h:
* platform/network/SocketStreamHandleClient.h:
* platform/network/cf/SocketStreamHandleImplCFNet.cpp:
(WebCore::SocketStreamHandleImpl::readStreamCallback):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged):
2021-06-05 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Move DataDetectors softlinking in DataDetectorsSPI.h out into a separate PAL header
https://bugs.webkit.org/show_bug.cgi?id=226669
Reviewed by Sam Weinig.
Clean up some softlinking code for the DataDetectors framework. Currently, the `SOFT_LINK_*` macros are defined
inside the SPI header (`pal/spi/mac/DataDetectorsSPI.h`); this patch moves them out into
`pal/mac/DataDetectorsSoftLink.{h|mm}` instead, and updates a few places that use these soft-linked symbols to
import `DataDetectorsSoftLink.h` instead of `DataDetectorsSPI.h`.
* editing/cocoa/DataDetection.mm:
(WebCore::detectItem):
(WebCore::DataDetection::detectItemAroundHitTestResult):
* page/mac/ImageOverlayControllerMac.mm:
(WebCore::ImageOverlayController::updateDataDetectorHighlights):
(WebCore::ImageOverlayController::platformHandleMouseEvent):
* page/mac/ServicesOverlayController.mm:
(WebCore::ServicesOverlayController::mouseIsOverHighlight const):
(WebCore::ServicesOverlayController::buildPhoneNumberHighlights):
(WebCore::ServicesOverlayController::buildSelectionHighlight):
* platform/mac/DataDetectorHighlight.mm:
(WebCore::DataDetectorHighlight::setHighlight):
(WebCore::DataDetectorHighlight::paintContents):
2021-06-05 Dean Jackson <dino@apple.com>
[WebXR] Supply an IOSurface in SimulatedXRDevice
https://bugs.webkit.org/show_bug.cgi?id=226564
<rdar://problem/78793086>
Reviewed by Sam Weinig.
Rather than handle the case where we get a null IOSurface,
have the SimulatedXRDevice create one on each frame.
* Modules/webxr/WebXROpaqueFramebuffer.cpp:
(WebCore::WebXROpaqueFramebuffer::startFrame):
* testing/WebFakeXRDevice.cpp:
(WebCore::SimulatedXRDevice::frameTimerFired):
2021-06-05 Simon Fraser <simon.fraser@apple.com>
Remove some duplicated code related to scrollbars
https://bugs.webkit.org/show_bug.cgi?id=226685
Reviewed by Alan Bujtas.
RenderLayerScrollableArea and RenderBox had some very similar code related to
computing whether scrollbars are present, so remove the duplication, and prepare
for ScrollbarOrientation to become an enum class.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::hasAutoScrollbar const):
(WebCore::RenderBox::hasAlwaysPresentScrollbar const):
(WebCore::RenderBox::hasVerticalScrollbarWithAutoBehavior const): Deleted.
(WebCore::RenderBox::hasHorizontalScrollbarWithAutoBehavior const): Deleted.
* rendering/RenderBox.h:
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::updateScrollbarsAfterLayout):
(WebCore::RenderLayerScrollableArea::updateScrollbarsAfterStyleChange):
(WebCore::styleRequiresScrollbar): Deleted.
(WebCore::styleDefinesAutomaticScrollbar): Deleted.
2021-06-04 Dean Jackson <dino@apple.com>
[WebXR] WebXR on Cocoa doesn't work with webgl 1 contexts
https://bugs.webkit.org/show_bug.cgi?id=226675
Reviewed by Sam Weinig.
Support WebGL 1 contexts by attaching the correct combined depth+stencil
target.
While here, rename some variables to be a bit more clear about what
they do.
* Modules/webxr/WebXROpaqueFramebuffer.cpp:
(WebCore::WebXROpaqueFramebuffer::~WebXROpaqueFramebuffer): Make sure we delete
the texture if we created one.
(WebCore::WebXROpaqueFramebuffer::startFrame): Use the correct attachment point
if we're a WebGL 1 context.
(WebCore::WebXROpaqueFramebuffer::setupFramebuffer):
2021-06-05 Antti Koivisto <antti@apple.com>
Rename InlineTextBox to LegacyInlineTextBox
https://bugs.webkit.org/show_bug.cgi?id=226633
Rubber-stamped by Sam Weinig.
More legacy line layout naming.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/ContainerNode.cpp:
* dom/DocumentMarkerController.cpp:
(WebCore::DocumentMarkerController::addMarker):
* dom/Position.cpp:
* editing/CompositeEditCommand.cpp:
* editing/Editor.h:
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::debugRenderer const):
* editing/RenderedPosition.cpp:
* editing/TextIterator.cpp:
* editing/VisiblePosition.cpp:
* layout/Verification.cpp:
(WebCore::Layout::checkForMatchingTextRuns):
(WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
* layout/formattingContexts/inline/text/TextUtil.h:
* layout/integration/LayoutIntegrationRunIterator.cpp:
(WebCore::LayoutIntegration::firstTextRunInTextOrderFor):
* layout/integration/LayoutIntegrationRunIterator.h:
(WebCore::LayoutIntegration::PathTextRun::legacyInlineBox const):
* layout/integration/LayoutIntegrationRunIteratorLegacyPath.h:
(WebCore::LayoutIntegration::RunIteratorLegacyPath::traverseNextTextRunInTextOrder):
(WebCore::LayoutIntegration::RunIteratorLegacyPath::inlineTextBox const):
* layout/layouttree/LayoutBox.h:
(WebCore::Layout::Box::isInlineTextBox const):
* layout/layouttree/LayoutInlineTextBox.cpp:
(WebCore::Layout::InlineTextBox::InlineTextBox):
* rendering/CaretRectComputation.cpp:
(WebCore::computeCaretRectForSVGInlineText):
* rendering/EllipsisBox.cpp:
* rendering/LegacyInlineBox.h:
* rendering/LegacyInlineFlowBox.cpp:
(WebCore::LegacyInlineFlowBox::addToLine):
(WebCore::LegacyInlineFlowBox::placeBoxRangeInInlineDirection):
(WebCore::LegacyInlineFlowBox::requiresIdeographicBaseline const):
(WebCore::LegacyInlineFlowBox::placeBoxesInBlockDirection):
(WebCore::LegacyInlineFlowBox::addTextBoxVisualOverflow):
(WebCore::LegacyInlineFlowBox::computeOverflow):
(WebCore::LegacyInlineFlowBox::computeOverAnnotationAdjustment const):
(WebCore::LegacyInlineFlowBox::computeUnderAnnotationAdjustment const):
* rendering/LegacyInlineFlowBox.h:
* rendering/LegacyInlineTextBox.cpp: Renamed from Source/WebCore/rendering/InlineTextBox.cpp.
(WebCore::LegacyInlineTextBox::~LegacyInlineTextBox):
(WebCore::LegacyInlineTextBox::hasTextContent const):
(WebCore::LegacyInlineTextBox::markDirty):
(WebCore::LegacyInlineTextBox::logicalOverflowRect const):
(WebCore::LegacyInlineTextBox::setLogicalOverflowRect):
(WebCore::LegacyInlineTextBox::baselinePosition const):
(WebCore::LegacyInlineTextBox::lineHeight const):
(WebCore::LegacyInlineTextBox::selectionTop const):
(WebCore::LegacyInlineTextBox::selectionBottom const):
(WebCore::LegacyInlineTextBox::selectionHeight const):
(WebCore::LegacyInlineTextBox::isSelected const):
(WebCore::LegacyInlineTextBox::selectionState):
(WebCore::LegacyInlineTextBox::verifySelectionState const):
(WebCore::LegacyInlineTextBox::lineFont const):
(WebCore::snappedSelectionRect):
(WebCore::LegacyInlineTextBox::localSelectionRect const):
(WebCore::LegacyInlineTextBox::deleteLine):
(WebCore::LegacyInlineTextBox::extractLine):
(WebCore::LegacyInlineTextBox::attachLine):
(WebCore::LegacyInlineTextBox::placeEllipsisBox):
(WebCore::LegacyInlineTextBox::isLineBreak const):
(WebCore::LegacyInlineTextBox::nodeAtPoint):
(WebCore::LegacyInlineTextBox::emphasisMarkExistsAndIsAbove const):
(WebCore::createMarkedTextFromSelectionInBox):
(WebCore::LegacyInlineTextBox::paint):
(WebCore::LegacyInlineTextBox::clampedOffset const):
(WebCore::LegacyInlineTextBox::clampedStartEndForState const):
(WebCore::LegacyInlineTextBox::selectionStartEnd const):
(WebCore::LegacyInlineTextBox::highlightStartEnd const):
(WebCore::LegacyInlineTextBox::hasMarkers const):
(WebCore::LegacyInlineTextBox::paintPlatformDocumentMarkers):
(WebCore::LegacyInlineTextBox::calculateUnionOfAllDocumentMarkerBounds const):
(WebCore::LegacyInlineTextBox::calculateDocumentMarkerBounds const):
(WebCore::LegacyInlineTextBox::paintPlatformDocumentMarker):
(WebCore::LegacyInlineTextBox::collectMarkedTextsForDraggedContent):
(WebCore::LegacyInlineTextBox::collectMarkedTextsForDocumentMarkers const):
(WebCore::LegacyInlineTextBox::collectMarkedTextsForHighlights const):
(WebCore::LegacyInlineTextBox::textOriginFromBoxRect const):
(WebCore::LegacyInlineTextBox::paintMarkedTexts):
(WebCore::LegacyInlineTextBox::paintMarkedTextBackground):
(WebCore::LegacyInlineTextBox::paintMarkedTextForeground):
(WebCore::LegacyInlineTextBox::paintMarkedTextDecoration):
(WebCore::LegacyInlineTextBox::paintCompositionBackground):
(WebCore::LegacyInlineTextBox::paintCompositionUnderlines const):
(WebCore::mirrorRTLSegment):
(WebCore::LegacyInlineTextBox::paintCompositionUnderline const):
(WebCore::LegacyInlineTextBox::caretMinOffset const):
(WebCore::LegacyInlineTextBox::caretMaxOffset const):
(WebCore::LegacyInlineTextBox::textPos const):
(WebCore::LegacyInlineTextBox::offsetForPosition const):
(WebCore::LegacyInlineTextBox::positionForOffset const):
(WebCore::LegacyInlineTextBox::createTextRun const):
(WebCore::LegacyInlineTextBox::text const):
(WebCore::LegacyInlineTextBox::combinedText const):
(WebCore::LegacyInlineTextBox::debugTextShadow):
(WebCore::LegacyInlineTextBox::expansionBehavior const):
(WebCore::LegacyInlineTextBox::boxName const):
(WebCore::LegacyInlineTextBox::outputLineBox const):
* rendering/LegacyInlineTextBox.h: Renamed from Source/WebCore/rendering/InlineTextBox.h.
(WebCore::LegacyInlineTextBox::LegacyInlineTextBox):
(WebCore::LegacyInlineTextBox::renderer const):
(WebCore::LegacyInlineTextBox::lineStyle const):
(WebCore::LegacyInlineTextBox::prevTextBox const):
(WebCore::LegacyInlineTextBox::nextTextBox const):
(WebCore::LegacyInlineTextBox::setNextTextBox):
(WebCore::LegacyInlineTextBox::setPreviousTextBox):
(WebCore::LegacyInlineTextBox::start const):
(WebCore::LegacyInlineTextBox::end const):
(WebCore::LegacyInlineTextBox::len const):
(WebCore::LegacyInlineTextBox::setStart):
(WebCore::LegacyInlineTextBox::setLen):
(WebCore::LegacyInlineTextBox::offsetRun):
(WebCore::LegacyInlineTextBox::truncation const):
(WebCore::LegacyInlineTextBox::compareByStart):
(WebCore::LegacyInlineTextBox::logicalTopVisualOverflow const):
(WebCore::LegacyInlineTextBox::logicalBottomVisualOverflow const):
(WebCore::LegacyInlineTextBox::logicalLeftVisualOverflow const):
(WebCore::LegacyInlineTextBox::logicalRightVisualOverflow const):
(WebCore::LegacyInlineTextBox::dirtyOwnLineBoxes):
(WebCore::LegacyInlineTextBox::paintMarkedTexts):
* rendering/LegacyLineLayout.cpp:
(WebCore::LegacyLineLayout::constructLine):
(WebCore::setLogicalWidthForTextRun):
(WebCore::LegacyLineLayout::computeExpansionForJustifiedText):
(WebCore::expansionBehaviorForInlineTextBox):
(WebCore::applyExpansionBehavior):
(WebCore::LegacyLineLayout::computeInlineDirectionPositionsForSegment):
(WebCore::LegacyLineLayout::removeInlineBox const):
(WebCore::LegacyLineLayout::computeBlockDirectionPositionsForLine):
(WebCore::LegacyLineLayout::createLineBoxesFromBidiRuns):
* rendering/LegacyRootInlineBox.cpp:
(WebCore::LegacyRootInlineBox::isHyphenated const):
(WebCore::LegacyRootInlineBox::ascentAndDescentForBox const):
* rendering/RenderBlock.cpp:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::inlineSelectionGaps):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintMaskForTextFillBox):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::generateCulledLineBoxRects const):
(WebCore::RenderInline::culledInlineVisualOverflowBoundingBox const):
(WebCore::RenderInline::dirtyLineBoxes):
* rendering/RenderLineBoxList.cpp:
(WebCore::RenderLineBoxList::dirtyLinesFromChangedChild):
* rendering/RenderText.cpp:
(WebCore::RenderText::absoluteQuadsForRange const):
(WebCore::RenderText::createTextBox):
(WebCore::RenderText::positionLineBox):
* rendering/RenderText.h:
(WebCore::RenderText::extractTextBox):
(WebCore::RenderText::attachTextBox):
(WebCore::RenderText::removeTextBox):
(WebCore::RenderText::createInlineTextBox):
(WebCore::RenderText::firstTextBox const):
(WebCore::RenderText::lastTextBox const):
(WebCore::RenderText::findNextInlineTextBox const):
* rendering/RenderTextLineBoxes.cpp:
(WebCore::RenderTextLineBoxes::createAndAppendLineBox):
(WebCore::RenderTextLineBoxes::extract):
(WebCore::RenderTextLineBoxes::attach):
(WebCore::RenderTextLineBoxes::remove):
(WebCore::RenderTextLineBoxes::deleteAll):
(WebCore::RenderTextLineBoxes::findNext const):
(WebCore::RenderTextLineBoxes::checkConsistency const):
* rendering/RenderTextLineBoxes.h:
(WebCore::RenderTextLineBoxes::first const):
(WebCore::RenderTextLineBoxes::last const):
* rendering/RenderTreeAsText.cpp:
* rendering/TextDecorationPainter.h:
(WebCore::TextDecorationPainter::setInlineTextBox):
* rendering/TextPainter.cpp:
(WebCore::TextPainter::clearGlyphDisplayLists):
* rendering/svg/RenderSVGInlineText.cpp:
(WebCore::RenderSVGInlineText::createTextBox):
* rendering/svg/RenderSVGInlineText.h:
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::SVGInlineTextBox):
(WebCore::SVGInlineTextBox::dirtyOwnLineBoxes):
(WebCore::SVGInlineTextBox::dirtyLineBoxes):
(WebCore::SVGInlineTextBox::offsetForPositionInFragment const):
(WebCore::SVGInlineTextBox::paint):
(WebCore::SVGInlineTextBox::nodeAtPoint):
* rendering/svg/SVGInlineTextBox.h:
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeSVGInlineTextBoxes):
* style/InlineTextBoxStyle.cpp:
(WebCore::computeUnderlineOffset):
(WebCore::visualOverflowForDecorations):
* style/InlineTextBoxStyle.h:
2021-06-05 Cameron McCormack <heycam@apple.com>
Diff aspect-ratio property values correctly
https://bugs.webkit.org/show_bug.cgi?id=226673
Reviewed by Rob Buis.
Test: fast/css/aspect-ratio-no-relayout.html
* rendering/style/RenderStyle.cpp:
(WebCore::rareNonInheritedDataChangeRequiresLayout):
2021-06-04 Chris Dumez <cdumez@apple.com>
Optimize a few call sites creating SharedBuffer objects
https://bugs.webkit.org/show_bug.cgi?id=226674
Reviewed by Darin Adler.
* Modules/mediastream/RTCRtpSFrameTransform.cpp:
(WebCore::transformFrame):
* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::interceptWithResponse):
(WebCore::InspectorNetworkAgent::interceptRequestWithResponse):
* platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
(WebCore::CDMPrivateFairPlayStreaming::extractKeyIDsSinf):
* workers/service/context/ServiceWorkerFetch.cpp:
(WebCore::ServiceWorkerFetch::processResponse):
2021-06-04 Chris Dumez <cdumez@apple.com>
Reduce use of legacy MainThreadTaskQueue in media code
https://bugs.webkit.org/show_bug.cgi?id=226672
Reviewed by Darin Adler.
Reduce use of legacy MainThreadTaskQueue in media code. Simply use callOnMainThread()
for these instead.
* platform/graphics/cocoa/TextTrackRepresentationCocoa.h:
* platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
(WebCore::TextTrackRepresentationCocoa::boundsChanged):
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
* platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
(WebCore::CoreAudioCaptureDeviceManager::scheduleUpdateCaptureDevices):
* platform/mediastream/mac/CoreAudioCaptureDeviceManager.h:
* platform/mock/MediaPlaybackTargetPickerMock.cpp:
(WebCore::MediaPlaybackTargetPickerMock::showPlaybackTargetPicker):
(WebCore::MediaPlaybackTargetPickerMock::startingMonitoringPlaybackTargets):
(WebCore::MediaPlaybackTargetPickerMock::setState):
* platform/mock/MediaPlaybackTargetPickerMock.h:
2021-06-04 Chris Dumez <cdumez@apple.com>
FileSystem::readFromFile() should return data as `void*`
https://bugs.webkit.org/show_bug.cgi?id=226671
Reviewed by Darin Adler.
FileSystem::readFromFile() should return data as `void*` instead of `char*`. This is more flexible and
consistent with FileSystem::writeToFile().
* platform/FileHandle.cpp:
(WebCore::FileHandle::read):
* platform/FileStream.cpp:
(WebCore::FileStream::read):
* platform/FileStream.h:
* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::readSync):
(WebCore::BlobResourceHandle::readDataSync):
(WebCore::BlobResourceHandle::readFileSync):
(WebCore::BlobResourceHandle::notifyReceiveData):
* platform/network/BlobResourceHandle.h:
* platform/network/curl/CurlCacheEntry.cpp:
(WebCore::CurlCacheEntry::readCachedData):
(WebCore::CurlCacheEntry::loadResponseHeaders):
(WebCore::CurlCacheEntry::loadFileToBuffer):
* platform/network/curl/CurlCacheEntry.h:
* rendering/RenderThemeWin.cpp:
(WebCore::fillBufferWithContentsOfFile):
(WebCore::RenderThemeWin::stringWithContentsOfFile):
2021-06-04 Chris Dumez <cdumez@apple.com>
Worker.constructor throws an exception when the url param is an empty string
https://bugs.webkit.org/show_bug.cgi?id=226637
Reviewed by Darin Adler.
Stop throwing an exception if the Worker constructor gets called with an empty string.
Instead treat it as a relative URL, like Chrome and Firefox do.
No new tests, updated existing ones.
* workers/AbstractWorker.cpp:
(WebCore::AbstractWorker::resolveURL):
2021-06-04 Chris Dumez <cdumez@apple.com>
Unreviewed Windows build fix after r278516.
* platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
(WebCore::WebCoreAVCFResourceLoader::dataReceived):
* platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.h:
2021-06-04 Chris Dumez <cdumez@apple.com>
Use Vector<uint8_t> instead of Vector<char> to store bytes in SharedBuffer
https://bugs.webkit.org/show_bug.cgi?id=226623
Reviewed by Darin Adler.
Use Vector<uint8_t> instead of Vector<char> to store bytes in SharedBuffer. Also have SharedBuffer::data()
return a `const uint8_t*` instead of `const char*`. This is our preferred type to store bytes.
* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::consumeFormData):
* Modules/fetch/FetchBodyConsumer.cpp:
(WebCore::packageFormData):
(WebCore::resolveWithTypeAndData):
* Modules/highlight/AppHighlight.h:
(WebCore::AppHighlight::encode const):
* Modules/indexeddb/IDBGetResult.cpp:
(WebCore::IDBGetResult::dataFromBuffer):
* Modules/indexeddb/server/IDBSerialization.cpp:
(WebCore::serializeIDBKeyData):
* Modules/mediastream/RTCDataChannel.cpp:
(WebCore::RTCDataChannel::didReceiveRawData):
* Modules/mediastream/RTCDataChannel.h:
* Modules/mediastream/RTCDataChannelRemoteHandler.cpp:
(WebCore::RTCDataChannelRemoteHandler::didReceiveRawData):
(WebCore::RTCDataChannelRemoteHandler::sendRawData):
* Modules/mediastream/RTCDataChannelRemoteHandler.h:
* Modules/mediastream/RTCDataChannelRemoteSource.h:
(WebCore::RTCDataChannelRemoteSource::sendRawData):
* Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
(WebCore::LibWebRTCDataChannelHandler::sendRawData):
(WebCore::LibWebRTCDataChannelHandler::OnMessage):
* Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::load):
* fileapi/Blob.cpp:
(WebCore::Blob::Blob):
* fileapi/NetworkSendQueue.cpp:
(WebCore::NetworkSendQueue::enqueue):
(WebCore::NetworkSendQueue::processMessages):
* fileapi/NetworkSendQueue.h:
* inspector/NetworkResourcesData.cpp:
(WebCore::NetworkResourcesData::ResourceData::appendData):
(WebCore::NetworkResourcesData::maybeAddResourceData):
* inspector/NetworkResourcesData.h:
* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::didReceiveData):
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::decodeBuffer):
(WebCore::InspectorPageAgent::dataContent):
* inspector/agents/InspectorPageAgent.h:
* loader/ContentFilter.cpp:
(WebCore::ContentFilter::deliverResourceData):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::continueAfterContentPolicy):
(WebCore::DocumentLoader::maybeCreateArchive):
(WebCore::DocumentLoader::maybeFinishLoadingMultipartContent):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::didFinishLoading):
(WebCore::DocumentThreadableLoader::loadRequest):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadResourceSynchronously):
* loader/NetscapePlugInStreamLoader.cpp:
(WebCore::NetscapePlugInStreamLoader::didReceiveDataOrBuffer):
* loader/NetscapePlugInStreamLoader.h:
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::didReceiveDataOrBuffer):
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::didReceiveDataOrBuffer):
* loader/TextResourceDecoder.h:
(WebCore::TextResourceDecoder::decode):
(WebCore::TextResourceDecoder::decodeAndFlush):
* loader/TextTrackLoader.cpp:
(WebCore::TextTrackLoader::processNewCueData):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::writeDataToUniqueFileInDirectory):
* loader/archive/mhtml/MHTMLArchive.cpp:
(WebCore::MHTMLArchive::generateMHTMLData):
* loader/archive/mhtml/MHTMLParser.cpp:
(WebCore::MHTMLParser::parseNextPart):
* loader/cache/CachedRawResource.cpp:
(WebCore::CachedRawResource::updateBuffer):
(WebCore::CachedRawResource::finishLoading):
(WebCore::CachedRawResource::didAddClient):
* loader/cache/CachedSVGFont.cpp:
(WebCore::CachedSVGFont::ensureCustomFontData):
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::SharedBuffer):
(WebCore::SharedBuffer::create):
(WebCore::SharedBuffer::combineIntoOneSegment const):
(WebCore::SharedBuffer::data const):
(WebCore::SharedBuffer::tryCreateArrayBuffer const):
(WebCore::SharedBuffer::append):
(WebCore::SharedBuffer::DataSegment::data const):
(WebCore::SharedBuffer::DataSegment::size const):
(WebCore::SharedBufferDataView::data const):
(WebCore::utf8Buffer):
* platform/SharedBuffer.h:
* platform/encryptedmedia/clearkey/CDMClearKey.cpp:
(WebCore::extractKeyidsLocationFromCencInitData):
(WebCore::extractKeyidsFromCencInitData):
* platform/graphics/Model.h:
(WebCore::Model::encode const):
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemBuffer::append):
* platform/graphics/gstreamer/eme/CDMThunder.cpp:
(WebCore::CDMInstanceThunder::setServerCertificate):
(WebCore::ParsedResponseMessage::ParsedResponseMessage):
(WebCore::CDMInstanceSessionThunder::errorCallback):
(WebCore::CDMInstanceSessionThunder::requestLicense):
(WebCore::CDMInstanceSessionThunder::updateLicense):
(WebCore::CDMInstanceSessionThunder::loadSession):
* platform/graphics/opentype/OpenTypeTypes.h:
(WebCore::OpenType::TableBase::isValidEnd):
* platform/mediastream/RTCDataChannelHandler.h:
* platform/mediastream/RTCDataChannelHandlerClient.h:
* platform/mediastream/RTCDataChannelRemoteSourceConnection.h:
* platform/mock/RTCDataChannelHandlerMock.cpp:
(WebCore::RTCDataChannelHandlerMock::sendRawData):
* platform/mock/RTCDataChannelHandlerMock.h:
* platform/network/FormData.cpp:
(WebCore::FormData::asSharedBuffer const):
* platform/network/ResourceHandleClient.cpp:
(WebCore::ResourceHandleClient::didReceiveBuffer):
* platform/network/cocoa/RangeResponseGenerator.mm:
(WebCore::RangeResponseGenerator::giveResponseToTaskIfBytesInRangeReceived):
* platform/text/TextEncoding.h:
(WebCore::TextEncoding::decode const):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged):
* xml/XSLTProcessorLibxslt.cpp:
(WebCore::docLoaderFunc):
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::OffsetBuffer::OffsetBuffer):
2021-06-04 Brady Eidson <beidson@apple.com>
Enforce a quota in window.sessionStorage
rdar://78507096 and https://bugs.webkit.org/show_bug.cgi?id=226337
Reviewed by Chris Dumez.
Covered by change to existing test.
* page/Page.cpp:
(WebCore::Page::sessionStorage): Make sure the quota for session storage is not "noQuota"
* page/Settings.yaml: Default to 5mb instead of noQuota to match other browsers.
2021-06-03 Darin Adler <darin@apple.com>
Move from WebCore::SuccessOr to WTF::Expected
https://bugs.webkit.org/show_bug.cgi?id=226614
Reviewed by Sam Weinig.
The upcoming std::expected is designed for cases like the ones we
are using SuccessOr for, using void for the expected type in a case like
this where it's success or failure. Our WTF::Expected is for our use
while waiting for compilers with std::expected. It was straightforward
to port our uses of SuccessOr to instead use Expected.
* Headers.cmake: Removed SuccessOr.h.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* dom/SuccessOr.h: Emptied out this file for now; delete later.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const): Use
Expected for the return type and call makeUnexpected as needed. Also
updated the check of the result from playbackStateChangePermitted to
call Expected::error instead of SuccessOr::value.
(WebCore::HTMLMediaElement::setReadyState): Use Expected::error
instead of SuccessOr::value, and updated local variable name for
greater clarity. Also fixed one call site that had the success check
backwards: The symptom is that it would never log "Autoplay blocked"
in that case, but otherwise seems harmless.
(WebCore::HTMLMediaElement::play): Ditto.
* html/HTMLMediaElement.h: Use Expected for the return type of
canTransitionFromAutoplayToPlay.
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::playbackStateChangePermitted const): Use
Expected for the return type and call makeUnexpected as needed.
* html/MediaElementSession.h: Removed include of SuccessOr.h, and
tweaked coding style a bit. Use Expected for the return type of
playbackStateChangePermitted.
2021-06-04 Ryosuke Niwa <rniwa@webkit.org>
Store MediaPlayer using WeakPtr in MediaPlayerPrivateRemote
https://bugs.webkit.org/show_bug.cgi?id=224421
Reviewed by Eric Carlson.
Made it possible to create a WeakPtr of MediaPlayer.
* platform/graphics/MediaPlayer.h:
2021-06-04 Martin Robinson <mrobinson@webkit.org>
[css-scroll-snap] Snap offsets and active index are duplicated in ScrollController and ScrollableArea
https://bugs.webkit.org/show_bug.cgi?id=226538
Reviewed by Simon Fraser.
Remove duplicate css-scroll-snap state from ScrollableArea. This state is already
stored in ScrollController, so we do not need to store it also in ScrollableArea.
This change also renames a couple methods so that they have clearer and more
consistent names.
No new tests. This should not change behavior.
* page/FrameView.cpp:
(WebCore::FrameView::performPostLayoutTasks): updateScrollSnapState() is now called
resnapAfterLayout().
* page/scrolling/AsyncScrollingCoordinator.cpp: snapOffsetInfo() is now called
snapOffsetsInfo().
(WebCore::AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry): Ditto.
(WebCore::AsyncScrollingCoordinator::updateScrollSnapPropertiesWithFrameView): Ditto.
* page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
(WebCore::ScrollingTreeScrollingNodeDelegateMac::updateFromStateNode): Use new method name.
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::updateActiveScrollSnapIndexForOffset): We no longer need to
sync state with Scrollable Area.
(WebCore::ScrollAnimator::setSnapOffsetsInfo): Added this setter which
calls through to ScrollController.
(WebCore::ScrollAnimator::snapOffsetsInfo const): Added this getter which calls through
to ScrollController.
(WebCore::ScrollAnimator::setActiveScrollSnapIndexForAxis): Added this method.
* platform/ScrollAnimator.h: Update method declarations.
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::allowsVerticalStretching const): Use new method names.
(WebCore::ScrollAnimatorMac::allowsHorizontalStretching const): Ditto.
* platform/ScrollController.cpp:
(WebCore::ScrollController::setSnapOffsetsInfo): Combined updateScrollSnapState and
updateScrollSnapPoints into this method.
(WebCore::ScrollController::snapOffsetsInfo const): Added this getter.
* platform/ScrollController.h: Update method declarations.
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::handleWheelEventForScrolling): We no longer need to sync
from the ScrollAnimator.
(WebCore::ScrollableArea::snapOffsetsInfo const): Renamed this getter.
(WebCore::ScrollableArea::setScrollSnapOffsetInfo): This now calls through to
ScrollController.
(WebCore::ScrollableArea::clearSnapOffsets): Ditto.
(WebCore::ScrollableArea::currentHorizontalSnapPointIndex const): Ditto.
(WebCore::ScrollableArea::currentVerticalSnapPointIndex const): Ditto.
(WebCore::ScrollableArea::setCurrentHorizontalSnapPointIndex): Ditto.
(WebCore::ScrollableArea::setCurrentVerticalSnapPointIndex): Ditto.
(WebCore::ScrollableArea::resnapAfterLayout): Renamed this method and moved
setting the ScrollSnapOffsetsInfo to setScrollSnapOffsetInfo.
(WebCore::ScrollableArea::doPostThumbMoveSnapping): Use new methods to access
scroll snap state and return early if we don't have a ScrollAnimator already.
This was done implicitly in the previous implementation.
* platform/ScrollableArea.h:
* rendering/RenderLayerScrollableArea.cpp: Update method definitions and
remove members that are no longer used.
(WebCore::RenderLayerScrollableArea::updateScrollInfoAfterLayout): Use new method name.
* testing/Internals.cpp:
(WebCore::Internals::scrollSnapOffsets): Ditto.
2021-06-04 Chris Dumez <cdumez@apple.com>
Stop using legacy MainThreadTaskQueue in PlatformMediaSessionManager / MediaSessionManagerCocoa
https://bugs.webkit.org/show_bug.cgi?id=226649
Reviewed by Eric Carlson.
Stop using legacy MainThreadTaskQueue in PlatformMediaSessionManager / MediaSessionManagerCocoa.
Media code should be using the HTML event loop whenever possible and can use callOnMainThread()
for global singleton classes that are not associated with a particular document (like
PlatformMediaSessionManager).
Also stop subclassing CanMakeWeakPtr<>. It doesn't make sense since the class is a singleton.
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::scheduleUpdateSessionState):
* platform/audio/PlatformMediaSessionManager.h:
* platform/audio/cocoa/MediaSessionManagerCocoa.h:
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::scheduleSessionStatusUpdate):
(WebCore::MediaSessionManagerCocoa::sessionWillEndPlayback):
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::mediaServerConnectionDied):
2021-06-04 Wenson Hsieh <wenson_hsieh@apple.com>
Remove the unused `sourceElementID` argument in `Document::updateIsPlayingMedia` and related code
https://bugs.webkit.org/show_bug.cgi?id=226650
Reviewed by Chris Dumez.
This `uint64_t` argument is currently not used for anything. It was originally added in r188030 with the purpose
of mapping to HTMLMediaElements via `HTMLMediaElement::elementWithID()`, but that mechanism was entirely removed
in r267885.
It appears that this code has been superceded by (relatively recent) support for the Media Session API.
No change in behavior.
* dom/Document.cpp:
(WebCore::Document::willBeRemovedFromFrame):
(WebCore::Document::updateIsPlayingMedia):
* dom/Document.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::isPlayingMediaDidChange):
* page/Page.cpp:
(WebCore::Page::updateIsPlayingMedia):
* page/Page.h:
2021-06-04 Chris Dumez <cdumez@apple.com>
Port MediaKeySystemAccess & MediaCapabilities to the HTML event loop
https://bugs.webkit.org/show_bug.cgi?id=226646
Reviewed by Eric Carlson.
Port MediaKeySystemAccess & MediaCapabilities to the HTML event loop instead of using
a global Timer. Most of the media code has been ported to the HTML event loop already.
* Modules/encryptedmedia/MediaKeySystemAccess.cpp:
(WebCore::MediaKeySystemAccess::createMediaKeys):
* Modules/encryptedmedia/MediaKeySystemAccess.h:
* Modules/mediacapabilities/MediaCapabilities.cpp:
(WebCore::MediaCapabilities::decodingInfo):
(WebCore::MediaCapabilities::encodingInfo):
* Modules/mediacapabilities/MediaCapabilities.h:
* Modules/mediacapabilities/MediaCapabilities.idl:
2021-06-04 Chris Dumez <cdumez@apple.com>
DOMFileSystem::listDirectory() fails to protect |this| when going to the background thread
https://bugs.webkit.org/show_bug.cgi?id=226652
Reviewed by Darin Adler.
* Modules/entriesapi/DOMFileSystem.cpp:
(WebCore::DOMFileSystem::listDirectory):
2021-06-04 Chris Dumez <cdumez@apple.com>
Stop using legacy MainThreadTaskQueue in Document::didLogMessage()
https://bugs.webkit.org/show_bug.cgi?id=226645
Reviewed by Darin Adler.
Stop using legacy MainThreadTaskQueue in Document::didLogMessage() and use the HTML
event loop instead.
* dom/Document.cpp:
(WebCore::Document::didLogMessage):
* dom/Document.h:
2021-06-04 Antti Koivisto <antti@apple.com>
REGRESSION (maybe r276882): custom properties not available on host on initial paint
https://bugs.webkit.org/show_bug.cgi?id=226574
<rdar://problem/78863643>
Reviewed by Simon Fraser.
We fail to invalidate :host style when switching out of shared resolver after asynchronously
loading a stylesheet into a shadow tree. This happens because the resolver has been cleared and
the invalidation code just bails out if none is present.
Test case by vb@bigdot.de.
Test: fast/shadow-dom/shared-resolver-host-invalidation.html
* style/StyleInvalidator.cpp:
(WebCore::Style::Invalidator::invalidateHostAndSlottedStyleIfNeeded):
Change the assumption so that if we don't have a resolver we always invalidate the host.
The alternative would be to build the resolver and do this accurately but doing that here
seems bit risky. This should be cheap and rare invalidation in any case.
2021-06-04 Alex Christensen <achristensen@webkit.org>
Implement off-by-default experimental feature for PerformanceResourceTiming.transferSize, encodedBodySize, and decodedBodySize
https://bugs.webkit.org/show_bug.cgi?id=226629
Reviewed by Brady Eidson.
The tests for TAO are entangled with the tests for these properties. Having an implementation helps see what is still broken.
Covered by web platform tests.
* page/PerformanceResourceTiming.cpp:
(WebCore::PerformanceResourceTiming::transferSize const):
(WebCore::PerformanceResourceTiming::encodedBodySize const):
(WebCore::PerformanceResourceTiming::decodedBodySize const):
* page/PerformanceResourceTiming.h:
* page/PerformanceResourceTiming.idl:
2021-06-04 Myles C. Maxfield <mmaxfield@apple.com>
Use references in font loading code instead of pointers which can never be null
https://bugs.webkit.org/show_bug.cgi?id=226622
Reviewed by Chris Dumez.
CSSFontFace::create()'s CSSFontSelector can never be null. This is clear from
observation of all 3 call sites.
No new tests because there is no behavior change.
* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::create):
* css/CSSFontFace.h:
* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::addFontFaceRule):
* css/FontFace.cpp:
(WebCore::FontFace::FontFace):
2021-06-04 David Kilzer <ddkilzer@apple.com>
REGRESSION (r278121): Fix build failure due to weak external symbol
Occurs when building coverage+release builds:
ERROR: symbol _DDHighlightCreateWithRectsInVisibleRectWithStyleScaleAndDirection
The soft-linked symbol was originally added in r259276.
* Configurations/WebCore.unexp:
- Add _DDHighlightCreateWithRectsInVisibleRectWithStyleScaleAndDirection
to the list of unexported symbols.
- Also sort symbols in the group alphabetically.
2021-06-04 Michael Catanzaro <mcatanzaro@gnome.org>
Fix more GCC warnings
https://bugs.webkit.org/show_bug.cgi?id=226193
Reviewed by Adrian Perez de Castro.
Fix -Wunused-parameter warnings. Also, fix a -Wredundant-move warning.
* platform/animation/TimingFunction.cpp:
(WebCore::TimingFunction::createFromCSSText):
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContextCairo::getCTM const):
(WebCore::GraphicsContextCairo::roundToDevicePixels):
* platform/graphics/x11/PlatformDisplayX11.cpp:
(WebCore::PlatformDisplayX11::supportsGLX const):
2021-06-04 Chris Dumez <cdumez@apple.com>
Rename MainThreadGenericEventQueue to EventLoopEventQueue
https://bugs.webkit.org/show_bug.cgi?id=226618
Reviewed by Ryosuke Niwa.
Rename MainThreadGenericEventQueue to EventLoopEventQueue, now that it is based on the HTML
event loop (and not a global Timer).
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::MediaSessionCoordinator):
* Modules/mediasession/MediaSessionCoordinator.h:
* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::MediaSource):
* Modules/mediasource/MediaSource.h:
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::SourceBuffer):
* Modules/mediasource/SourceBuffer.h:
* Modules/mediasource/SourceBufferList.cpp:
(WebCore::SourceBufferList::SourceBufferList):
* Modules/mediasource/SourceBufferList.h:
* Modules/remoteplayback/RemotePlayback.cpp:
(WebCore::RemotePlayback::RemotePlayback):
* Modules/remoteplayback/RemotePlayback.h:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/EventLoopEventQueue.cpp: Renamed from Source/WebCore/dom/GenericEventQueue.cpp.
(WebCore::EventLoopEventQueue::EventLoopEventQueue):
(WebCore::EventLoopEventQueue::enqueueEvent):
(WebCore::EventLoopEventQueue::dispatchOneEvent):
(WebCore::EventLoopEventQueue::close):
(WebCore::EventLoopEventQueue::cancelAllEvents):
(WebCore::EventLoopEventQueue::hasPendingActivity const):
(WebCore::EventLoopEventQueue::hasPendingEventsOfType const):
(WebCore::EventLoopEventQueue::stop):
(WebCore::EventLoopEventQueue::activeDOMObjectName const):
(WebCore::EventLoopEventQueue::create):
* dom/EventLoopEventQueue.h: Renamed from Source/WebCore/dom/GenericEventQueue.h.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
* html/HTMLMediaElement.h:
* html/track/TrackListBase.cpp:
(WebCore::TrackListBase::TrackListBase):
* html/track/TrackListBase.h:
2021-06-04 Youenn Fablet <youenn@apple.com>
Reintroduce logging useful for debugging in AudioSampleDataSource
https://bugs.webkit.org/show_bug.cgi?id=226578
Reviewed by Eric Carlson.
Removed logging was actually useful for debugging audio issues.
Reintroduce it by restrict logging to ensure we do not introduce too much audio glitches by doing so:
- If we pull samples and do not have enough data, enter more-data-needed mode, and log once that data is missing.
- If we pull samples and do not have enough data and we are already in more-data-needed mode, do not log anything.
- If we push samples and are in more-data-needed mode, reset mode to none and log this information.
The mode check happens in two different threads so might be a bit racy but at worst, this reduces accuracy of the logging.
No change of behavior.
* platform/audio/cocoa/AudioSampleDataSource.h:
* platform/audio/cocoa/AudioSampleDataSource.mm:
(WebCore::AudioSampleDataSource::pushSamplesInternal):
(WebCore::AudioSampleDataSource::pullSamplesInternal):
2021-05-27 Sergio Villar Senin <svillar@igalia.com>
[css-flexbox] Sanitize the aspect ratio handling code
https://bugs.webkit.org/show_bug.cgi?id=226324
Reviewed by Javier Fernandez.
Sanitized the code that detects whether aspect ratio should be used to compute sizes. The
useChildAspectRatio() method was removed as it was very misleading, the name was a bad choice
and it was very confusing. A new method childHasComputableAspectRatio() was added. It verifies
whether the item has an aspect ratio (of any type) and whether we could compute it.
Also two calls to detect whether the cross size was definite (or considered definite) were
unified in a single method.
No new tests as there is no change in behaviour.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::childHasComputableAspectRatio const): New method which takes the
checks from useChildAspectRatio.
(WebCore::RenderFlexibleBox::childHasComputableAspectRatioAndCrossSizeIsConsideredDefinite):
New method doing 3 different checks.
(WebCore::RenderFlexibleBox::childCrossSizeShouldUseContainerCrossSize const): Removed the aspect
ratio checks which make no sense there.
(WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild): Use the new method.
(WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax): Ditto.
(WebCore::RenderFlexibleBox::useChildAspectRatio): Deleted.
* rendering/RenderFlexibleBox.h:
2021-06-03 Jean-Yves Avenard <jya@apple.com>
fast/dom/Window/property-access-on-cached-window-after-frame-removed.html (layout-test) may crash
https://bugs.webkit.org/show_bug.cgi?id=226612
rdar://78846264
Reviewed by Eric Carlson.
It is possible under some circumstances for a MediaSession to be constructed
when no page or frame exists (such as when we move in/out bfcache).
The MediaSession constructor incorrectly only created the MediaSessionCoordinatorPrivate
if a Page and Frame existed.
To avoid any ambiguities on when MediaSession::m_coordinator could be set, we
make this member a const Ref<>.
Test is covered by fast/dom/Window/property-access-on-cached-window-after-frame-removed.html
* Modules/mediasession/MediaSession.cpp:
(WebCore::MediaSession::MediaSession): Create MediaSessionCoordinatorPrivate in initializer list.
(WebCore::MediaSession::suspend): Remove unnecessary null check
(WebCore::MediaSession::stop): Remove unnecessary null check
* Modules/mediasession/MediaSession.h: Make m_coordinator a const Ref<>
(WebCore::MediaSession::coordinator const):
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::create): Remove MediaSessionCoordinatorPrivate argument to constructor.
(WebCore::MediaSessionCoordinator::MediaSessionCoordinator):
* Modules/mediasession/MediaSessionCoordinator.h:
2021-06-03 Alan Bujtas <zalan@apple.com>
Crack in hero text on https://www.apple.com/mac-mini/
https://bugs.webkit.org/show_bug.cgi?id=226610
<rdar://71246655>
Reviewed by Simon Fraser.
FillBox::Text's mask rect needs pixel snapping so that we can position/size it properly on non-1x screens.
Test: fast/clip/hidpi-background-clip-with-text-fill-color.html
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintMaskForTextFillBox):
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
* rendering/RenderBoxModelObject.h:
2021-06-03 Jean-Yves Avenard <jya@apple.com>
REGRESSION(r278336): fast/dom/Window/property-access-on-cached-window-after-frame-removed.html (layout-test) is a constant crash
https://bugs.webkit.org/show_bug.cgi?id=226570
rdar://78784709
Reviewed by Eric Carlson.
Now that the coordinator attribute is no longer optional following bug 226328, it can
be iterated while in closed state. Check that the MediaSessionCoordinatorPrivate is set.
Fix crash in existing test.
Fly-by fixes: trailing whitespaces and make header declaration conditional.
* Modules/mediasession/MediaSession.h:
* Modules/mediasession/MediaSessionCoordinator.h:
(WebCore::MediaSessionCoordinator::identifier const): Add nullptr check, return empty String if so.
* Modules/mediasession/MediaSessionCoordinator.idl: Remove trailing whitespace
2021-06-03 Devin Rousso <drousso@apple.com>
[Payment Request] allow additional line items and/or an override total to be specified in `ApplePayModifier`
https://bugs.webkit.org/show_bug.cgi?id=226597
<rdar://problem/78835065>
Reviewed by Wenson Hsieh.
Instead of merging properties of the first applicable `PaymentDetailsModifier` (or more
specifically the related `ApplePayModifier` with only the `total` line item, add `total`
and `additionalLineItems` properties to `ApplePayModifier` that are `ApplePayLineItem`.
* Modules/applepay/paymentrequest/ApplePayModifier.idl:
* Modules/applepay/paymentrequest/ApplePayModifier.h:
Drive-by: Rename `additionalShippingOptions` to `additionalShippingMethods` to emphasize
that the values are `ApplePayShippingMethod` instead of `PaymentShippingOption`.
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
(WebCore::ApplePayPaymentHandler::computeShippingMethods const):
(WebCore::ApplePayPaymentHandler::computeTotalAndLineItems const):
2021-06-03 Chris Lord <clord@igalia.com>
[WPE] position:sticky content is not correctly offset on async scrolled overflow layers with an RTL vertical scrollbar
https://bugs.webkit.org/show_bug.cgi?id=226327
Reviewed by Darin Adler.
Make sure to respect the origin of sticky positioning nodes'
constraining rect.
No new tests, covered by existing tests.
* page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
(WebCore::ScrollingTreeStickyNode::computeLayerPosition const):
* page/scrolling/nicosia/ScrollingTreeStickyNode.cpp:
(WebCore::ScrollingTreeStickyNode::computeLayerPosition const):
2021-06-03 Simon Fraser <simon.fraser@apple.com>
REGRESSION (Safari 14): Menu items jump around on codelearn.cat
https://bugs.webkit.org/show_bug.cgi?id=226608
<rdar://78636003>
Reviewed by Alan Bujtas.
This site changes overflow style dynamically on a stacking-context layer which
has an existing child compositing layer, and the layer has an offset from its
renderer due to the box-shadow.
When this happens, we need to ensure the child layers get a geometry update,
because the newly created clipping layer changes the offset for the child layers.
Test: compositing/overflow/overflow-change-reposition-descendants.html
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateAfterLayout):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerStyleChanged):
2021-06-03 Chris Dumez <cdumez@apple.com>
Drop generic GenericTaskQueue<T> and DeferrableTask<T> now that they are unused
https://bugs.webkit.org/show_bug.cgi?id=226601
Reviewed by Ryosuke Niwa.
Drop generic GenericTaskQueue<T> and DeferrableTask<T> now that they are unused. Rename
GenericTaskQueue<Timer> to MainThreadTaskQueue and DeferrableTask<Timer> to
MainThreadDeferrableTask as they still have some usage.
I used the "MainThread" naming for consistency with the legacy MainThreadEventQueue and
because the implementation relies on a static Timer.
* Modules/encryptedmedia/MediaKeySystemAccess.h:
* Modules/mediacapabilities/MediaCapabilities.h:
* dom/Document.h:
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::enqueueTaskForDispatcher): Deleted.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
(WebCore::HTMLMediaElement::setVolume):
(WebCore::HTMLMediaElement::cancelPendingTasks):
(WebCore::HTMLMediaElement::closeTaskQueues):
(WebCore::HTMLMediaElement::enqueueTaskForDispatcher): Deleted.
* html/HTMLMediaElement.h:
* platform/DeferrableTask.h:
(WebCore::MainThreadDeferrableTask::MainThreadDeferrableTask):
(WebCore::DeferrableTask::DeferrableTask): Deleted.
(WebCore::DeferrableTask::scheduleTask): Deleted.
* platform/GenericTaskQueue.cpp:
(WebCore::MainThreadTaskDispatcher::MainThreadTaskDispatcher):
(WebCore::MainThreadTaskDispatcher::postTask):
(WebCore::MainThreadTaskDispatcher::sharedTimer):
(WebCore::MainThreadTaskDispatcher::sharedTimerFired):
(WebCore::MainThreadTaskDispatcher::pendingDispatchers):
(WebCore::MainThreadTaskDispatcher::dispatchOneTask):
(WebCore::TaskDispatcher<Timer>::TaskDispatcher): Deleted.
(WebCore::TaskDispatcher<Timer>::postTask): Deleted.
(WebCore::TaskDispatcher<Timer>::sharedTimer): Deleted.
(WebCore::TaskDispatcher<Timer>::sharedTimerFired): Deleted.
(WebCore::TaskDispatcher<Timer>::pendingDispatchers): Deleted.
(WebCore::TaskDispatcher<Timer>::dispatchOneTask): Deleted.
* platform/GenericTaskQueue.h:
(WebCore::MainThreadTaskQueue::MainThreadTaskQueue):
(WebCore::MainThreadTaskQueue::~MainThreadTaskQueue):
(WebCore::TaskDispatcher::TaskDispatcher): Deleted.
(WebCore::TaskDispatcher::postTask): Deleted.
(WebCore::GenericTaskQueueBase::hasPendingTasks const): Deleted.
(WebCore::GenericTaskQueueBase::isClosed const): Deleted.
(WebCore::GenericTaskQueueBase::close): Deleted.
(WebCore::GenericTaskQueueBase::cancelAllTasks): Deleted.
(WebCore::GenericTaskQueueBase::incrementPendingTasks): Deleted.
(WebCore::GenericTaskQueueBase::decrementPendingTasks): Deleted.
(WebCore::GenericTaskQueue::GenericTaskQueue): Deleted.
(WebCore::GenericTaskQueue::~GenericTaskQueue): Deleted.
(WebCore::GenericTaskQueue::enqueueTask): Deleted.
* platform/RemoteCommandListener.h:
* platform/audio/PlatformMediaSessionManager.h:
* platform/audio/cocoa/MediaSessionManagerCocoa.h:
(WebCore::MediaSessionManagerCocoa::taskQueue):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* platform/graphics/cocoa/TextTrackRepresentationCocoa.h:
* platform/graphics/gpu/GPUBuffer.h:
* platform/graphics/gpu/GPUQueue.h:
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
* platform/mediastream/mac/CoreAudioCaptureDeviceManager.h:
* platform/mock/MediaPlaybackTargetPickerMock.h:
2021-06-03 Jean-Yves Avenard <jya@apple.com>
Add MediaSessionCoordinator test to ensure that disconnection on the private side is properly handled.
https://bugs.webkit.org/show_bug.cgi?id=226568
rdar://problem/78801408
Reviewed by Eric Carlson.
Make MediaSessionCoordinatorClient::coordinatorStateChanged pure virtual.
* Modules/mediasession/MediaSessionCoordinatorPrivate.h: Add coordinatorStateChanged method,
will forward state to RemoteMediaSessionCoordinatorProxy::coordinatorStateChanged.
2021-06-03 Cameron McCormack <heycam@apple.com>
Prevent background-attachment:fixed from causing slow scrolling when in a position:fixed layer
https://bugs.webkit.org/show_bug.cgi?id=226399
Reviewed by Simon Fraser.
Tests: scrollingcoordinator/mac/fixed-backgrounds/fixed-background-slow-scrolling-1.html
scrollingcoordinator/mac/fixed-backgrounds/fixed-background-slow-scrolling-2-async.html
scrollingcoordinator/mac/fixed-backgrounds/fixed-background-slow-scrolling-2-sync.html
scrollingcoordinator/mac/fixed-backgrounds/fixed-background-slow-scrolling-3-async.html
scrollingcoordinator/mac/fixed-backgrounds/fixed-background-slow-scrolling-3-sync.html
scrollingcoordinator/mac/fixed-backgrounds/fixed-background-slow-scrolling-4.html
scrollingcoordinator/mac/fixed-backgrounds/fixed-background-slow-scrolling-5-async.html
scrollingcoordinator/mac/fixed-backgrounds/fixed-background-slow-scrolling-5-sync.html
scrollingcoordinator/mac/fixed-backgrounds/fixed-background-slow-scrolling-6.html
scrollingcoordinator/mac/fixed-backgrounds/fixed-background-slow-scrolling-7.html
scrollingcoordinator/mac/fixed-backgrounds/fixed-background-slow-scrolling-8-async.html
scrollingcoordinator/mac/fixed-backgrounds/fixed-background-slow-scrolling-8-sync.html
scrollingcoordinator/mac/fixed-backgrounds/fixed-background-slow-scrolling-9-async.html
scrollingcoordinator/mac/fixed-backgrounds/fixed-background-slow-scrolling-9-sync.html
We move responsbility for managing the HasSlowRepaintObjects
synchronous scrolling reason on the root scrolling node from
ScrollingCoordinator to RenderLayerCompositor, which is where it's
handled for all other scrolling nodes.
If a slow repaint object (i.e. a background-attachment:fixed element) is
present in a non-root async scrolling layer, then it continues to add
HasSlowRepaintObjects to the scrolling node's synchronous scrolling
reasons. But we now no longer add HasSlowRepaintObjects to the root
scrolling node's synchronous scrolling reasons if its containing async
scrolling layer "behaves as fixed", i.e. won't move while scrolling the
viewport.
* page/FrameView.cpp:
(WebCore::FrameView::addSlowRepaintObject): No longer need to inform
the ScrollingCoordinator since the RenderLayerCompositor now handles
HasSlowRepaintObjects synchronous scroling reason updates for the root.
(WebCore::FrameView::removeSlowRepaintObject): Ditto.
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::synchronousScrollingReasons const):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::updateSynchronousScrollingReasons):
Preserve the current value of HasSlowRepaintObjects when updating
synchronous scrolling reasons.
(WebCore::ScrollingCoordinator::shouldUpdateScrollLayerPositionSynchronously const):
(WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText const):
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::synchronousScrollingReasons const):
(WebCore::ScrollingCoordinator::hasSynchronousScrollingReasons const):
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::propagateSynchronousScrollingReasons):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateSynchronousScrollingNodes):
Take responsibility for managing HasSlowRepaintObjects on the root
scroll tree node. Only add HasSlowRepaintObjects on the root if not
in a fixed position layer.
2021-06-03 Fujii Hironori <Hironori.Fujii@sony.com>
[Win] Remove unused GraphicsContext::shouldIncludeChildWindows()
https://bugs.webkit.org/show_bug.cgi?id=226567
Reviewed by Don Olmstead.
It was added by r40366 (Bug 23623) for Plugins. However, the
plugin support was removed by r278265 (Bug 226410).
* platform/graphics/GraphicsContext.h:
(WebCore::GraphicsContext::shouldIncludeChildWindows const): Deleted.
* platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
* platform/graphics/cg/GraphicsContextPlatformPrivateCG.h:
(WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
* platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
* platform/graphics/win/GraphicsContextWin.cpp:
(WebCore::GraphicsContext::setShouldIncludeChildWindows): Deleted.
(WebCore::GraphicsContext::shouldIncludeChildWindows const): Deleted.
2021-06-03 Youenn Fablet <youenn@apple.com>
Do not recalibrate camera if the settings are the same
https://bugs.webkit.org/show_bug.cgi?id=226585
Reviewed by Eric Carlson.
Make sure to not update the preset if the constraints are equal to the current settings.
Manually tested.
* platform/mediastream/RealtimeVideoCaptureSource.cpp:
(WebCore::RealtimeVideoCaptureSource::clientUpdatedSizeAndFrameRate):
2021-06-03 Alan Bujtas <zalan@apple.com>
Incorrect text selection when crossing flex item boundary
https://bugs.webkit.org/show_bug.cgi?id=226518
<rdar://59487603>
Reviewed by Simon Fraser.
Let's use the more sophisticated "which child is closer to the hit point" logic in RenderBox for the flex (and grid) content.
The rest of the RenderBlock::positionForPoint is meant to deal with BFC content where block level boxes are positioned in block direction, after each other.
Test: editing/selection/selecting-content-by-overshooting-the-container.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::positionForPoint):
2021-06-03 Antti Koivisto <antti@apple.com>
Remove TrailingFloatsRootInlineBox
https://bugs.webkit.org/show_bug.cgi?id=226579
Reviewed by Sam Weinig.
Replace it with a bit in LegacyRootInlineBox.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* editing/VisibleUnits.cpp:
(WebCore::previousLinePosition):
(WebCore::nextLinePosition):
* rendering/LegacyInlineBox.cpp:
(WebCore::LegacyInlineBox::logicalHeight const):
* rendering/LegacyInlineFlowBox.h:
(WebCore::LegacyInlineFlowBox::LegacyInlineFlowBox):
* rendering/LegacyLineLayout.cpp:
(WebCore::LegacyLineLayout::linkToEndLineIfNeeded):
* rendering/LegacyRootInlineBox.h:
(WebCore::LegacyRootInlineBox::isForTrailingFloats const):
(WebCore::LegacyRootInlineBox::setIsForTrailingFloats):
(WebCore::LegacyRootInlineBox::isTrailingFloatsRootInlineBox const): Deleted.
* rendering/RenderLineBoxList.cpp:
(WebCore::RenderLineBoxList::dirtyLinesFromChangedChild):
* rendering/TrailingFloatsRootInlineBox.cpp: Removed.
* rendering/TrailingFloatsRootInlineBox.h: Removed.
2021-06-03 Miguel Gomez <magomez@igalia.com>
[GStreamer] Remove dependency on glvideoflip and videoflip
https://bugs.webkit.org/show_bug.cgi?id=225456
Reviewed by Philippe Normand.
Stop using videoflip and glvideoflip to rotate the video frames inside GStreamer. These perform a copy
of the frame to perform the rotation that we can avoid if we rotate the frames ourselves when painting them.
Covered by existent tests.
* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(webKitGLVideoSinkConstructed):
(webKitGLVideoSinkGetProperty):
(webkit_gl_video_sink_class_init):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
(WebCore::MediaPlayerPrivateGStreamer::updateVideoSizeAndOrientationFromCaps):
(WebCore::MediaPlayerPrivateGStreamer::paint):
(WebCore::MediaPlayerPrivateGStreamer::createVideoSinkGL):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2021-06-03 Antti Koivisto <antti@apple.com>
Rename InlineFlowBox to LegacyInlineFlowBox
https://bugs.webkit.org/show_bug.cgi?id=226569
Reviewed by Alan Bujtas.
More legacy line layout naming.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/Verification.cpp:
(WebCore::Layout::collectFlowBoxSubtree):
(WebCore::Layout::collectInlineBoxes):
* layout/formattingContexts/inline/InlineFormattingQuirks.cpp:
(WebCore::Layout::InlineFormattingQuirks::inlineLevelBoxAffectsLineBox const):
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::InlineContentBuilder::computeLineLevelVisualAdjustmentsForRuns const):
(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
* rendering/EllipsisBox.cpp:
(WebCore::EllipsisBox::EllipsisBox):
* rendering/EllipsisBox.h:
* rendering/InlineElementBox.cpp:
* rendering/InlineElementBox.h:
(WebCore::InlineElementBox::InlineElementBox):
* rendering/LegacyInlineBox.cpp:
(WebCore::LegacyInlineBox::dirtyLineBoxes):
(WebCore::LegacyInlineBox::nextLeafOnLine const):
(WebCore::LegacyInlineBox::previousLeafOnLine const):
* rendering/LegacyInlineBox.h:
(WebCore::LegacyInlineBox::parent const):
(WebCore::LegacyInlineBox::setParent):
(WebCore::LegacyInlineBox::LegacyInlineBox):
* rendering/LegacyInlineFlowBox.cpp: Renamed from Source/WebCore/rendering/InlineFlowBox.cpp.
(WebCore::LegacyInlineFlowBox::~LegacyInlineFlowBox):
(WebCore::LegacyInlineFlowBox::setHasBadChildList):
(WebCore::LegacyInlineFlowBox::getFlowSpacingLogicalWidth):
(WebCore::setHasTextDescendantsOnAncestors):
(WebCore::LegacyInlineFlowBox::addToLine):
(WebCore::LegacyInlineFlowBox::removeChild):
(WebCore::LegacyInlineFlowBox::deleteLine):
(WebCore::LegacyInlineFlowBox::removeLineBoxFromRenderObject):
(WebCore::LegacyInlineFlowBox::extractLine):
(WebCore::LegacyInlineFlowBox::extractLineBoxFromRenderObject):
(WebCore::LegacyInlineFlowBox::attachLine):
(WebCore::LegacyInlineFlowBox::attachLineBoxToRenderObject):
(WebCore::LegacyInlineFlowBox::adjustPosition):
(WebCore::isLastChildForRenderer):
(WebCore::isAncestorAndWithinBlock):
(WebCore::LegacyInlineFlowBox::determineSpacingForFlowBoxes):
(WebCore::LegacyInlineFlowBox::placeBoxesInInlineDirection):
(WebCore::LegacyInlineFlowBox::placeBoxRangeInInlineDirection):
(WebCore::LegacyInlineFlowBox::requiresIdeographicBaseline const):
(WebCore::verticalAlignApplies):
(WebCore::LegacyInlineFlowBox::adjustMaxAscentAndDescent):
(WebCore::LegacyInlineFlowBox::computeLogicalBoxHeights):
(WebCore::LegacyInlineFlowBox::placeBoxesInBlockDirection):
(WebCore::LegacyInlineFlowBox::maxLogicalBottomForTextDecorationLine const):
(WebCore::LegacyInlineFlowBox::minLogicalTopForTextDecorationLine const):
(WebCore::LegacyInlineFlowBox::flipLinesInBlockDirection):
(WebCore::LegacyInlineFlowBox::addBoxShadowVisualOverflow):
(WebCore::LegacyInlineFlowBox::addBorderOutsetVisualOverflow):
(WebCore::LegacyInlineFlowBox::addTextBoxVisualOverflow):
(WebCore::LegacyInlineFlowBox::addOutlineVisualOverflow):
(WebCore::LegacyInlineFlowBox::addReplacedChildOverflow):
(WebCore::LegacyInlineFlowBox::computeOverflow):
(WebCore::LegacyInlineFlowBox::setLayoutOverflow):
(WebCore::LegacyInlineFlowBox::setVisualOverflow):
(WebCore::LegacyInlineFlowBox::setOverflowFromLogicalRects):
(WebCore::LegacyInlineFlowBox::nodeAtPoint):
(WebCore::LegacyInlineFlowBox::paint):
(WebCore::LegacyInlineFlowBox::paintFillLayers):
(WebCore::LegacyInlineFlowBox::boxShadowCanBeAppliedToBackground const):
(WebCore::LegacyInlineFlowBox::paintFillLayer):
(WebCore::LegacyInlineFlowBox::paintBoxShadow):
(WebCore::LegacyInlineFlowBox::constrainToLineTopAndBottomIfNeeded const):
(WebCore::clipRectForNinePieceImageStrip):
(WebCore::LegacyInlineFlowBox::paintBoxDecorations):
(WebCore::LegacyInlineFlowBox::paintMask):
(WebCore::LegacyInlineFlowBox::firstLeafDescendant const):
(WebCore::LegacyInlineFlowBox::lastLeafDescendant const):
(WebCore::LegacyInlineFlowBox::selectionState):
(WebCore::LegacyInlineFlowBox::canAccommodateEllipsis const):
(WebCore::LegacyInlineFlowBox::placeEllipsisBox):
(WebCore::LegacyInlineFlowBox::clearTruncation):
(WebCore::LegacyInlineFlowBox::computeOverAnnotationAdjustment const):
(WebCore::LegacyInlineFlowBox::computeUnderAnnotationAdjustment const):
(WebCore::LegacyInlineFlowBox::collectLeafBoxesInLogicalOrder const):
(WebCore::LegacyInlineFlowBox::computeReplacedAndTextLineTopAndBottom const):
(WebCore::LegacyInlineFlowBox::boxName const):
(WebCore::LegacyInlineFlowBox::outputLineTreeAndMark const):
(WebCore::LegacyInlineFlowBox::checkConsistency const):
* rendering/LegacyInlineFlowBox.h: Renamed from Source/WebCore/rendering/InlineFlowBox.h.
(WebCore::LegacyInlineFlowBox::LegacyInlineFlowBox):
(WebCore::LegacyInlineFlowBox::renderer const):
(WebCore::LegacyInlineFlowBox::lineStyle const):
(WebCore::LegacyInlineFlowBox::prevLineBox const):
(WebCore::LegacyInlineFlowBox::nextLineBox const):
(WebCore::LegacyInlineFlowBox::setNextLineBox):
(WebCore::LegacyInlineFlowBox::setPreviousLineBox):
(WebCore::LegacyInlineFlowBox::firstChild const):
(WebCore::LegacyInlineFlowBox::lastChild const):
(WebCore::LegacyInlineFlowBox::marginBorderPaddingLogicalLeft const):
(WebCore::LegacyInlineFlowBox::marginBorderPaddingLogicalRight const):
(WebCore::LegacyInlineFlowBox::marginLogicalLeft const):
(WebCore::LegacyInlineFlowBox::marginLogicalRight const):
(WebCore::LegacyInlineFlowBox::borderLogicalLeft const):
(WebCore::LegacyInlineFlowBox::borderLogicalRight const):
(WebCore::LegacyInlineFlowBox::paddingLogicalLeft const):
(WebCore::LegacyInlineFlowBox::paddingLogicalRight const):
(WebCore::LegacyInlineFlowBox::includeLogicalLeftEdge const):
(WebCore::LegacyInlineFlowBox::includeLogicalRightEdge const):
(WebCore::LegacyInlineFlowBox::setEdges):
(WebCore::LegacyInlineFlowBox::beginPlacingBoxRangesInInlineDirection):
(WebCore::LegacyInlineFlowBox::endPlacingBoxRangesInInlineDirection):
(WebCore::LegacyInlineFlowBox::hasTextChildren const):
(WebCore::LegacyInlineFlowBox::hasTextDescendants const):
(WebCore::LegacyInlineFlowBox::hasHardLinebreak const):
(WebCore::LegacyInlineFlowBox::setHasTextChildren):
(WebCore::LegacyInlineFlowBox::setHasTextDescendants):
(WebCore::LegacyInlineFlowBox::layoutOverflowRect const):
(WebCore::LegacyInlineFlowBox::logicalTopLayoutOverflow const):
(WebCore::LegacyInlineFlowBox::logicalBottomLayoutOverflow const):
(WebCore::LegacyInlineFlowBox::logicalLayoutOverflowRect const):
(WebCore::LegacyInlineFlowBox::visualOverflowRect const):
(WebCore::LegacyInlineFlowBox::logicalLeftVisualOverflow const):
(WebCore::LegacyInlineFlowBox::logicalRightVisualOverflow const):
(WebCore::LegacyInlineFlowBox::logicalTopVisualOverflow const):
(WebCore::LegacyInlineFlowBox::logicalBottomVisualOverflow const):
(WebCore::LegacyInlineFlowBox::logicalVisualOverflowRect const):
(WebCore::LegacyInlineFlowBox::frameRectIncludingLineHeight const):
(WebCore::LegacyInlineFlowBox::logicalFrameRectIncludingLineHeight const):
(WebCore::LegacyInlineFlowBox::descendantsHaveSameLineHeightAndBaseline const):
(WebCore::LegacyInlineFlowBox::clearDescendantsHaveSameLineHeightAndBaseline):
(WebCore::LegacyInlineFlowBox::checkConsistency const):
(WebCore::LegacyInlineFlowBox::setHasBadChildList):
* rendering/LegacyLineLayout.cpp:
(WebCore::parentIsConstructedOrHaveNext):
(WebCore::LegacyLineLayout::createLineBoxes):
(WebCore::LegacyLineLayout::constructLine):
(WebCore::LegacyLineLayout::computeInlineDirectionPositionsForSegment):
* rendering/LegacyLineLayout.h:
* rendering/LegacyRootInlineBox.cpp:
(WebCore::LegacyRootInlineBox::LegacyRootInlineBox):
(WebCore::LegacyRootInlineBox::clearTruncation):
(WebCore::LegacyRootInlineBox::lineCanAccommodateEllipsis):
(WebCore::LegacyRootInlineBox::placeEllipsisBox):
(WebCore::LegacyRootInlineBox::paint):
(WebCore::LegacyRootInlineBox::nodeAtPoint):
(WebCore::LegacyRootInlineBox::adjustPosition):
(WebCore::LegacyRootInlineBox::includeFontForBox const):
(WebCore::LegacyRootInlineBox::includeGlyphsForBox const):
(WebCore::LegacyRootInlineBox::includeInitialLetterForBox const):
* rendering/LegacyRootInlineBox.h:
(WebCore::LegacyRootInlineBox::logicalTopVisualOverflow const):
(WebCore::LegacyRootInlineBox::logicalBottomVisualOverflow const):
(WebCore::LegacyRootInlineBox::logicalTopLayoutOverflow const):
(WebCore::LegacyRootInlineBox::logicalBottomLayoutOverflow const):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::inlineBlockBaseline const):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::containingBlockLogicalWidthForPositioned const):
(WebCore::RenderBox::containingBlockLogicalHeightForPositioned const):
(WebCore::RenderBox::computePositionedLogicalWidthUsing const):
(WebCore::RenderBox::computePositionedLogicalWidthReplaced const):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::getBackgroundRoundedRect const):
(WebCore::RenderBoxModelObject::backgroundRoundedRectAdjustedForBleedAvoidance const):
(WebCore::RenderBoxModelObject::paintMaskForTextFillBox):
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
(WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground const):
* rendering/RenderBoxModelObject.h:
* rendering/RenderImage.cpp:
(WebCore::RenderImage::boxShadowShouldBeAppliedToBackground const):
* rendering/RenderImage.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::generateLineBoxRects const):
(WebCore::RenderInline::generateCulledLineBoxRects const):
(WebCore::RenderInline::linesBoundingBox const):
(WebCore::RenderInline::linesVisualOverflowBoundingBox const):
(WebCore::RenderInline::linesVisualOverflowBoundingBoxInFragment const):
(WebCore::RenderInline::dirtyLineBoxes):
(WebCore::RenderInline::createInlineFlowBox):
(WebCore::RenderInline::createAndAppendInlineFlowBox):
(WebCore::RenderInline::paintOutline):
* rendering/RenderInline.h:
(WebCore::RenderInline::firstLineBox const):
(WebCore::RenderInline::lastLineBox const):
* rendering/RenderLineBoxList.cpp:
(WebCore::RenderLineBoxList::appendLineBox):
(WebCore::RenderLineBoxList::deleteLineBoxTree):
(WebCore::RenderLineBoxList::extractLineBox):
(WebCore::RenderLineBoxList::attachLineBox):
(WebCore::RenderLineBoxList::removeLineBox):
(WebCore::RenderLineBoxList::deleteLineBoxes):
(WebCore::RenderLineBoxList::dirtyLineBoxes):
(WebCore::RenderLineBoxList::lineIntersectsDirtyRect const):
(WebCore::RenderLineBoxList::paint const):
(WebCore::RenderLineBoxList::hitTest const):
(WebCore::RenderLineBoxList::checkConsistency const):
* rendering/RenderLineBoxList.h:
(WebCore::RenderLineBoxList::firstLineBox const):
(WebCore::RenderLineBoxList::lastLineBox const):
* rendering/RenderOverflow.h:
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::boxShadowShouldBeAppliedToBackground const):
* rendering/RenderTableCell.h:
* rendering/RenderVTTCue.cpp:
(WebCore::RenderVTTCue::initializeLayoutParameters):
(WebCore::RenderVTTCue::shouldSwitchDirection const):
(WebCore::RenderVTTCue::repositionCueSnapToLinesSet):
(WebCore::RenderVTTCue::repositionGenericCue):
* rendering/RenderVTTCue.h:
* rendering/svg/RenderSVGInline.cpp:
(WebCore::RenderSVGInline::createInlineFlowBox):
(WebCore::RenderSVGInline::absoluteQuads const):
* rendering/svg/RenderSVGInline.h:
* rendering/svg/SVGInlineFlowBox.h:
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::findRendererDefininingTextDecoration):
* rendering/svg/SVGRootInlineBox.cpp:
(WebCore::SVGRootInlineBox::layoutCharactersInTextBoxes):
(WebCore::SVGRootInlineBox::layoutChildBoxes):
* rendering/svg/SVGRootInlineBox.h:
* rendering/svg/SVGTextQuery.cpp:
(WebCore::flowBoxForRenderer):
(WebCore::SVGTextQuery::collectTextBoxesInFlowBox):
* rendering/svg/SVGTextQuery.h:
2021-06-03 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Use the fixed table height value to resolve percent column height values
https://bugs.webkit.org/show_bug.cgi?id=226566
Reviewed by Antti Koivisto.
Test: fast/layoutformattingcontext/table-with-percent-columns-simple.html
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::layoutInFlowContent):
(WebCore::Layout::TableFormattingContext::setUsedGeometryForCells):
(WebCore::Layout::TableFormattingContext::computeAndDistributeExtraSpace):
* layout/formattingContexts/table/TableFormattingContext.h:
* layout/formattingContexts/table/TableFormattingGeometry.cpp:
(WebCore::Layout::TableFormattingGeometry::verticalSpaceForCellContent const):
* layout/formattingContexts/table/TableFormattingGeometry.h:
2021-06-03 Julian Gonzalez <julian_a_gonzalez@apple.com>
Crash in HTMLConverter::_addLinkForElement()
https://bugs.webkit.org/show_bug.cgi?id=226398
Reviewed by Ryosuke Niwa.
While traversing a node, exit an element with a startIndex
that is always inside the bounds of the attribute string.
Test: editing/pasteboard/select-all-link-cut.html
* editing/cocoa/HTMLConverter.mm:
(HTMLConverter::_traverseNode):
2021-06-02 Rob Buis <rbuis@igalia.com>
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-06-02 Rob Buis <rbuis@igalia.com>
Split FillInlinePath/StrokeInlinePath
https://bugs.webkit.org/show_bug.cgi?id=225687
Reviewed by Wenson Hsieh.
Use specialized display list item types instead of
a Variant for FillInlinePath/StrokeInlinePath.
* 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::FillLine::apply const):
(WebCore::DisplayList::operator<<):
(WebCore::DisplayList::FillArc::apply const):
(WebCore::DisplayList::FillQuadCurve::apply const):
(WebCore::DisplayList::FillBezierCurve::apply const):
(WebCore::DisplayList::StrokeArc::localBounds const):
(WebCore::DisplayList::StrokeArc::apply const):
(WebCore::DisplayList::StrokeQuadCurve::localBounds const):
(WebCore::DisplayList::StrokeQuadCurve::apply const):
(WebCore::DisplayList::StrokeBezierCurve::localBounds const):
(WebCore::DisplayList::StrokeBezierCurve::apply const):
(WebCore::DisplayList::FillInlinePath::apply const): Deleted.
(WebCore::DisplayList::StrokeInlinePath::localBounds const): Deleted.
(WebCore::DisplayList::StrokeInlinePath::apply const): Deleted.
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::FillLine::FillLine):
(WebCore::DisplayList::FillLine::path const):
(WebCore::DisplayList::FillLine::globalBounds const):
(WebCore::DisplayList::FillLine::localBounds const):
(WebCore::DisplayList::FillArc::FillArc):
(WebCore::DisplayList::FillArc::path const):
(WebCore::DisplayList::FillArc::globalBounds const):
(WebCore::DisplayList::FillArc::localBounds const):
(WebCore::DisplayList::FillQuadCurve::FillQuadCurve):
(WebCore::DisplayList::FillQuadCurve::path const):
(WebCore::DisplayList::FillQuadCurve::globalBounds const):
(WebCore::DisplayList::FillQuadCurve::localBounds const):
(WebCore::DisplayList::FillBezierCurve::FillBezierCurve):
(WebCore::DisplayList::FillBezierCurve::path const):
(WebCore::DisplayList::StrokeLine::StrokeLine):
(WebCore::DisplayList::StrokeArc::StrokeArc):
(WebCore::DisplayList::StrokeArc::path const):
(WebCore::DisplayList::StrokeArc::globalBounds const):
(WebCore::DisplayList::StrokeQuadCurve::StrokeQuadCurve):
(WebCore::DisplayList::StrokeQuadCurve::path const):
(WebCore::DisplayList::StrokeQuadCurve::globalBounds const):
(WebCore::DisplayList::StrokeBezierCurve::StrokeBezierCurve):
(WebCore::DisplayList::StrokeBezierCurve::path const):
(WebCore::DisplayList::InlinePathDataStorage::InlinePathDataStorage): Deleted.
(WebCore::DisplayList::InlinePathDataStorage::isValid const): Deleted.
(WebCore::DisplayList::InlinePathDataStorage::path const): Deleted.
(WebCore::DisplayList::FillInlinePath::FillInlinePath): Deleted.
(WebCore::DisplayList::FillInlinePath::globalBounds const): Deleted.
(WebCore::DisplayList::FillInlinePath::localBounds const): Deleted.
(WebCore::DisplayList::StrokeInlinePath::StrokeInlinePath): Deleted.
(WebCore::DisplayList::StrokeInlinePath::globalBounds const): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::fillPath):
(WebCore::DisplayList::Recorder::strokePath):
2021-06-02 Sihui Liu <sihui_liu@apple.com>
Introduce a shared IDB serialization thread
https://bugs.webkit.org/show_bug.cgi?id=226228
<rdar://problem/78725516>
Reviewed by Chris Dumez.
Currently each WebIDBServer has its own thread, and does serialization/deserialization on that thread. To
prepare for making WebIDBServer use WorkQueue, like the other storage manager classes, let's create a shared
thread for handling all serialization/deserialization operations, which cannot be done on WorkQueue as VM needs
to access thread-specific data. Now IDB tasks will call callOnIDBSerializationThreadAndWait to perform
serialization/deserialization operations synchronously.
* Modules/indexeddb/server/IDBBackingStore.h:
* Modules/indexeddb/server/IDBSerializationContext.cpp: Removed. Moved to IDBBindingUtilities.cpp as
IDBSerializationContext is only used by IDBSerialization thread now.
* Modules/indexeddb/server/IDBSerializationContext.h: Removed.
* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::MemoryIDBBackingStore):
(WebCore::IDBServer::MemoryIDBBackingStore::serializationContext): Deleted.
* Modules/indexeddb/server/MemoryIDBBackingStore.h:
* Modules/indexeddb/server/MemoryObjectStore.cpp:
(WebCore::IDBServer::MemoryObjectStore::MemoryObjectStore):
(WebCore::IDBServer::MemoryObjectStore::addRecord):
(WebCore::IDBServer::MemoryObjectStore::populateIndexWithExistingRecords):
* Modules/indexeddb/server/MemoryObjectStore.h:
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::SQLiteIDBBackingStore):
(WebCore::IDBServer::SQLiteIDBBackingStore::updateOneIndexForAddRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::serializationContext): Deleted.
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::putOrAdd):
* Sources.txt:
* bindings/js/IDBBindingUtilities.cpp:
(WebCore::IDBSerializationContext::IDBSerializationContext):
(WebCore::IDBSerializationContext::~IDBSerializationContext):
(WebCore::IDBSerializationContext::globalObject):
(WebCore::IDBSerializationContext::initializeVM):
(WebCore::callOnIDBSerializationThreadAndWait): Create a IDBSerialization thread if not exists, and dispatch a
synchronous task to it.
* bindings/js/IDBBindingUtilities.h:
2021-06-02 Chris Dumez <cdumez@apple.com>
Port media code to the HTML event loop
https://bugs.webkit.org/show_bug.cgi?id=226543
Reviewed by Ryosuke Niwa.
Port media code to the HTML event loop so that event processing order is consistent
with non-media related events. To avoid having a very large patch, I made the following
changes:
- Update MainThreadGenericEventQueue to be based on the HTML event loop instead of a
global Timer.
- Introduce a EventLoopDeferrableTask which has the same API as DeferrableTask<Timer> but
uses the HTML event loop instead of a global Timer. Port media code to use
EventLoopDeferrableTask instead of DeferrableTask.
- Introduce an EventLoopTaskQueue which has the same API as GenericTaskQueue<Timer>
but uses the HTML event loop instead of a global Timer. Port media code to use
EventLoopTaskQueue instead of GenericTaskQueue<Timer>.
This effectively ports our entire media code to the HTML event loop. It allows new
media code to use the HTML event loop *directly* without fear of ordering issues. It also
allows us to refactor existing media code to use the HTML event loop *directly* when possible,
in an incremental fashion, without causing ordering issues.
* Headers.cmake:
* Modules/remoteplayback/RemotePlayback.cpp:
(WebCore::RemotePlayback::RemotePlayback):
* Modules/remoteplayback/RemotePlayback.h:
* animation/DocumentTimelinesController.cpp:
(WebCore::DocumentTimelinesController::DocumentTimelinesController):
* animation/DocumentTimelinesController.h:
* dom/FullscreenManager.cpp:
* dom/FullscreenManager.h:
* dom/GenericEventQueue.cpp:
(WebCore::MainThreadGenericEventQueue::MainThreadGenericEventQueue):
(WebCore::MainThreadGenericEventQueue::enqueueEvent):
(WebCore::MainThreadGenericEventQueue::close):
(WebCore::MainThreadGenericEventQueue::cancelAllEvents):
(WebCore::MainThreadGenericEventQueue::hasPendingEventsOfType const):
* dom/GenericEventQueue.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
* html/HTMLMediaElement.h:
* html/shadow/MediaControlTextTrackContainerElement.cpp:
(WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement):
* html/shadow/MediaControlTextTrackContainerElement.h:
* platform/DeferrableTask.h:
(WebCore::DeferrableTaskBase::close):
(WebCore::DeferrableTaskBase::cancelTask):
(WebCore::DeferrableTaskBase::hasPendingTask const):
(WebCore::DeferrableTaskBase::isClosed const):
(WebCore::DeferrableTaskBase::setHasPendingTask):
* platform/GenericTaskQueue.h:
(WebCore::GenericTaskQueueBase::hasPendingTasks const):
(WebCore::GenericTaskQueueBase::isClosed const):
(WebCore::GenericTaskQueueBase::close):
(WebCore::GenericTaskQueueBase::cancelAllTasks):
(WebCore::GenericTaskQueueBase::incrementPendingTasks):
(WebCore::GenericTaskQueueBase::decremementPendingTasks):
2021-06-02 Alex Christensen <achristensen@webkit.org>
Fix WPT test resource-timing/cross-origin-redirects.html
https://bugs.webkit.org/show_bug.cgi?id=190523
<rdar://45227788>
Reviewed by Brady Eidson.
Test: imported/w3c/web-platform-tests/resource-timing/cross-origin-redirects.html
This test took more to fix than I thought it would. We used to collect our timing data
from various sources into various structures, mostly based on Google's work from 2010 with
a few things tacked on to it. The timing specifications have changed considerably in the
last 11 years, and so should the shape of the structures we put the data into.
We used to have a LoadTiming structure in various places that claimed to contain the redirect times,
but markRedirectStart and markRedirectEnd were never called. Instead we tried to collect this data
from the SubResourceLoader and DocumentLoader reporting redirects in the web process. This wasn't great.
Redirect timing is best collected in the network process by the framework doing the redirecting,
and now we have the NSURLSessionTaskMetrics API to get the data we need.
I've made NetworkLoadMetrics the structure that contains all the network load metrics from the network process.
DocumentEventTiming is owned in the web process by the Document, and it contains the load event timing data.
ResourceLoadTiming is owned by the ResourceLoader, and it contains the fetch start and end times including the
parts of the fetch algorithm that happen in the web process.
DocumentLoadTiming inherits from it and is owned by the DocumentLoader, which reflects the fact that
PerformanceNavigationTiming inherits from PerformanceResourceTiming in the specs.
With these structures in place, we now have the infrastructure to collect timing data and expose it correctly.
Another thing that has changed is that these structures consistently store the timing data in the MonotonicTime type,
which is the number of seconds since the machine restarted. NetworkLoadMetrics used to confusingly store fetch
start time and then other network times as deltas from it, and we would pretend that fetch start time was the same
as the fetch start time in the web process and calculate everything from the deltas. This is an unfortunate
consequence of my younger self not realizing that the double values from NSURLConnection._timingData are values to
be put into [NSDate initWithTimeIntervalSinceReferenceDate] then pulled out with timeIntervalSince1970 to get
WallTime. I was confused because they weren't WallTime or MonotonicTime, so I only dealt with them as deltas
from each other. Consistently using MonotonicTime makes all this code much more straightforward.
I also use std::numeric_limits<uint64_t>::max() instead of std::numeric_limits<uint32_t>::max() as a sentinel value
for requestHeaderBytesSent and responseHeaderBytesReceived to make everything more sane. I'm not too worried about
the metrics of downloads of exactly 4GB, but they should also be fixed.
A consequence of collecting the redirect times in the network process is that we have to move the
SecurityOrigin::canRequest checks to see if the redirects are same-origin to ResourceHandle and NetworkDataTask.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/Document.cpp:
(WebCore::Document::setReadyState):
(WebCore::Document::finishedParsing):
(WebCore::Document::monotonicTimestamp const):
* dom/Document.h:
(WebCore::Document::eventTiming const):
(WebCore::Document::timing const): Deleted.
* dom/DocumentEventTiming.h: Copied from Source/WebCore/dom/DocumentTiming.h.
* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::buildObjectForTiming):
(WebCore::InspectorNetworkAgent::buildObjectForMetrics):
(WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
(WebCore::InspectorNetworkAgent::didFinishLoading):
* inspector/agents/InspectorNetworkAgent.h:
* loader/DocumentLoadTiming.h: Renamed from Source/WebCore/loader/LoadTiming.h.
(WebCore::DocumentLoadTiming::timeOrigin const):
(WebCore::DocumentLoadTiming::markUnloadEventStart):
(WebCore::DocumentLoadTiming::markUnloadEventEnd):
(WebCore::DocumentLoadTiming::markLoadEventStart):
(WebCore::DocumentLoadTiming::markLoadEventEnd):
(WebCore::DocumentLoadTiming::setHasSameOriginAsPreviousDocument):
(WebCore::DocumentLoadTiming::unloadEventStart const):
(WebCore::DocumentLoadTiming::unloadEventEnd const):
(WebCore::DocumentLoadTiming::loadEventStart const):
(WebCore::DocumentLoadTiming::loadEventEnd const):
(WebCore::DocumentLoadTiming::hasSameOriginAsPreviousDocument const):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::finishedLoading):
(WebCore::DocumentLoader::willSendRequest):
(WebCore::DocumentLoader::dataReceived):
(WebCore::DocumentLoader::startLoadingMainResource):
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::timing const):
(WebCore::DocumentLoader::timing):
(WebCore::DocumentLoader::resetTiming):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::loadRequest):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::dispatchUnloadEvents):
* loader/LoadTiming.cpp: Removed.
* loader/ResourceLoadTiming.h: Renamed from Source/WebCore/dom/DocumentTiming.h.
(WebCore::ResourceLoadTiming::markStartTime):
(WebCore::ResourceLoadTiming::markEndTime):
(WebCore::ResourceLoadTiming::startTime const):
(WebCore::ResourceLoadTiming::endTime const):
(WebCore::ResourceLoadTiming::isolatedCopy const):
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::init):
* loader/ResourceLoader.h:
(WebCore::ResourceLoader::loadTiming):
* loader/ResourceTiming.cpp:
(WebCore::ResourceTiming::fromMemoryCache):
(WebCore::ResourceTiming::fromLoad):
(WebCore::ResourceTiming::fromSynchronousLoad):
(WebCore::ResourceTiming::ResourceTiming):
(WebCore::ResourceTiming::isolatedCopy const):
(WebCore::ResourceTiming::fromCache): Deleted.
* loader/ResourceTiming.h:
(WebCore::ResourceTiming::resourceLoadTiming const):
(WebCore::ResourceTiming::ResourceTiming):
(WebCore::ResourceTiming::loadTiming const): Deleted.
* loader/ResourceTimingInformation.cpp:
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):
(WebCore::SubresourceLoader::didFinishLoading):
* loader/cache/CachedResource.h:
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::performance const):
* page/Performance.cpp:
(WebCore::Performance::addNavigationTiming):
* page/Performance.h:
* page/PerformanceNavigation.cpp:
(WebCore::PerformanceNavigation::redirectCount const):
* page/PerformanceNavigationTiming.cpp:
(WebCore::PerformanceNavigationTiming::PerformanceNavigationTiming):
(WebCore::PerformanceNavigationTiming::millisecondsSinceOrigin const):
(WebCore::PerformanceNavigationTiming::sameOriginCheckFails const):
(WebCore::PerformanceNavigationTiming::unloadEventStart const):
(WebCore::PerformanceNavigationTiming::unloadEventEnd const):
(WebCore::PerformanceNavigationTiming::domInteractive const):
(WebCore::PerformanceNavigationTiming::domContentLoadedEventStart const):
(WebCore::PerformanceNavigationTiming::domContentLoadedEventEnd const):
(WebCore::PerformanceNavigationTiming::domComplete const):
(WebCore::PerformanceNavigationTiming::loadEventStart const):
(WebCore::PerformanceNavigationTiming::loadEventEnd const):
(WebCore::PerformanceNavigationTiming::redirectCount const):
* page/PerformanceNavigationTiming.h:
* page/PerformanceResourceTiming.cpp:
(WebCore::networkLoadTimeToDOMHighResTimeStamp):
(WebCore::fetchStart):
(WebCore::entryStartTime):
(WebCore::entryEndTime):
(WebCore::PerformanceResourceTiming::redirectStart const):
(WebCore::PerformanceResourceTiming::redirectEnd const):
(WebCore::PerformanceResourceTiming::fetchStart const):
(WebCore::PerformanceResourceTiming::domainLookupStart const):
(WebCore::PerformanceResourceTiming::domainLookupEnd const):
(WebCore::PerformanceResourceTiming::connectStart const):
(WebCore::PerformanceResourceTiming::connectEnd const):
(WebCore::PerformanceResourceTiming::secureConnectionStart const):
(WebCore::PerformanceResourceTiming::requestStart const):
(WebCore::PerformanceResourceTiming::responseStart const):
(WebCore::PerformanceResourceTiming::responseEnd const):
(WebCore::monotonicTimeToDOMHighResTimeStamp): Deleted.
(WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp const): Deleted.
* page/PerformanceResourceTiming.h:
* page/PerformanceTiming.cpp:
(WebCore::PerformanceTiming::navigationStart const):
(WebCore::PerformanceTiming::unloadEventStart const):
(WebCore::PerformanceTiming::unloadEventEnd const):
(WebCore::PerformanceTiming::redirectStart const):
(WebCore::PerformanceTiming::redirectEnd const):
(WebCore::PerformanceTiming::fetchStart const):
(WebCore::PerformanceTiming::domainLookupStart const):
(WebCore::PerformanceTiming::domainLookupEnd const):
(WebCore::PerformanceTiming::connectStart const):
(WebCore::PerformanceTiming::connectEnd const):
(WebCore::PerformanceTiming::secureConnectionStart const):
(WebCore::PerformanceTiming::requestStart const):
(WebCore::PerformanceTiming::responseStart const):
(WebCore::PerformanceTiming::responseEnd const):
(WebCore::PerformanceTiming::domLoading const):
(WebCore::PerformanceTiming::domInteractive const):
(WebCore::PerformanceTiming::domContentLoadedEventStart const):
(WebCore::PerformanceTiming::domContentLoadedEventEnd const):
(WebCore::PerformanceTiming::domComplete const):
(WebCore::PerformanceTiming::loadEventStart const):
(WebCore::PerformanceTiming::loadEventEnd const):
(WebCore::PerformanceTiming::documentLoader const):
(WebCore::PerformanceTiming::documentEventTiming const):
(WebCore::PerformanceTiming::documentLoadTiming const):
(WebCore::PerformanceTiming::networkLoadMetrics const):
(WebCore::PerformanceTiming::monotonicTimeToIntegerMilliseconds const):
(WebCore::PerformanceTiming::documentTiming const): Deleted.
(WebCore::PerformanceTiming::loadTiming const): Deleted.
(WebCore::PerformanceTiming::resourceLoadTimeRelativeToFetchStart const): Deleted.
* page/PerformanceTiming.h:
* platform/network/NetworkLoadMetrics.h:
(WebCore::NetworkLoadMetrics::isolatedCopy const):
(WebCore::NetworkLoadMetrics::operator== const):
(WebCore::NetworkLoadMetrics::encode const):
(WebCore::NetworkLoadMetrics::decode):
* platform/network/ResourceHandle.cpp:
(WebCore::ResourceHandle::hasCrossOriginRedirect const):
(WebCore::ResourceHandle::setHasCrossOriginRedirect):
(WebCore::ResourceHandle::incrementRedirectCount):
(WebCore::ResourceHandle::redirectCount const):
(WebCore::ResourceHandle::startTimeBeforeRedirects const):
(WebCore::ResourceHandle::networkLoadMetrics):
(WebCore::ResourceHandle::setNetworkLoadMetrics):
* platform/network/ResourceHandle.h:
* platform/network/ResourceHandleInternal.h:
* platform/network/cocoa/NetworkLoadMetrics.mm:
(WebCore::dateToMonotonicTime):
(WebCore::packageTimingData):
(WebCore::copyTimingData):
* platform/network/cocoa/WebCoreNSURLSession.mm:
(networkLoadMetricsDate):
(-[WebCoreNSURLSessionTaskTransactionMetrics fetchStartDate]):
(-[WebCoreNSURLSessionTaskTransactionMetrics domainLookupStartDate]):
(-[WebCoreNSURLSessionTaskTransactionMetrics domainLookupEndDate]):
(-[WebCoreNSURLSessionTaskTransactionMetrics connectStartDate]):
(-[WebCoreNSURLSessionTaskTransactionMetrics secureConnectionStartDate]):
(-[WebCoreNSURLSessionTaskTransactionMetrics connectEndDate]):
(-[WebCoreNSURLSessionTaskTransactionMetrics requestStartDate]):
(-[WebCoreNSURLSessionTaskTransactionMetrics responseStartDate]):
(-[WebCoreNSURLSessionTaskTransactionMetrics responseEndDate]):
* platform/network/curl/CurlContext.cpp:
(WebCore::CurlHandle::getNetworkLoadMetrics):
* platform/network/curl/CurlContext.h:
* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::didCompleteTransfer):
(WebCore::CurlRequest::networkLoadMetrics):
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::start):
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
2021-06-02 Alan Bujtas <zalan@apple.com>
Remove redundant isChildHitTestCandidate in RenderBlock::positionForPoint
https://bugs.webkit.org/show_bug.cgi?id=226554
<rdar://problem/78782485>
Reviewed by Simon Fraser.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::positionForPoint):
2021-06-02 Alan Bujtas <zalan@apple.com>
Incorrect selection when tall float is present
https://bugs.webkit.org/show_bug.cgi?id=226552
<rdar://problem/78781056>
Reviewed by Simon Fraser.
While floats may end up at the bottom of their containers, they do not necessarily stretch the container by their full height.
e.g. <div><div style="float: left; height: 10px; width: 10px;"></div>some<br>text<br>here</div>
The [some text here] content wraps around the float and stretches the containing block <div>.
Test: editing/selection/select-out-of-floated-non-editable-13.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::positionForPoint):
2021-06-02 Antoine Quint <graouts@webkit.org>
Hit-testing does not account for clip-path set on parent of <iframe>
https://bugs.webkit.org/show_bug.cgi?id=226499
<rdar://problem/77317612>
Reviewed by Simon Fraser.
Before considering hit-testing children layers, we should ensure that the current RenderLayer doesn't have styles
set on its renderer that would clip the layer in such a way that the hit test location wouldn't yield a positive
result.
Tests: css3/masking/clip-path-hit-test-on-absolute-position-iframe-parent.html
css3/masking/clip-path-hit-test-on-iframe-parent.html
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hitTestLayer):
2021-06-02 Antoine Quint <graouts@webkit.org>
REGRESSION (r275227): Check boxes on V-Safe site flicker when selected
https://bugs.webkit.org/show_bug.cgi?id=226549
<rdar://problem/77722651>
Reviewed by Simon Fraser.
When checking equality for StyleCachedImage, check whether the backing CSSImageValue is equal even if the pointer is different.
Test: webanimations/background-image-css-variable-no-transition.html
* rendering/style/StyleCachedImage.cpp:
(WebCore::StyleCachedImage::operator== const):
2021-06-02 Jer Noble <jer.noble@apple.com>
REGRESSION(r276993): 5 TestWebKitAPI.AudioRoutingArbitration (api-tests) are constant failures
https://bugs.webkit.org/show_bug.cgi?id=226104
<rdar://77998049>
Reviewed by Eric Carlson.
Add a mechanism for a client to wait until an AudioSession is created or changed before taking
an action.
* platform/audio/AudioSession.cpp:
(WebCore::audioSessionChangedObservers):
(WebCore::AudioSession::sharedSession):
(WebCore::AudioSession::setSharedSession):
(WebCore::AudioSession::addAudioSessionChangedObserver):
* platform/audio/AudioSession.h:
2021-06-02 Chris Dumez <cdumez@apple.com>
Drop legacy ActiveDOMObject::setPendingActivity() / unsetPendingActivity()
https://bugs.webkit.org/show_bug.cgi?id=226544
Reviewed by Darin Adler.
Drop legacy ActiveDOMObject::setPendingActivity() / unsetPendingActivity(). They are too leak-prone. The modern
way to do this is to either override ActiveDOMObject::virtualHasPendingActivity() or use
ActiveDOMObject::makePendingActivity().
* Modules/applepay/ApplePaySession.cpp:
(WebCore::ApplePaySession::begin):
(WebCore::ApplePaySession::abort):
(WebCore::ApplePaySession::completePayment):
(WebCore::ApplePaySession::didCancelPaymentSession):
(WebCore::ApplePaySession::stop):
(WebCore::ApplePaySession::suspend):
(WebCore::ApplePaySession::virtualHasPendingActivity const):
(WebCore::ApplePaySession::didReachFinalState): Deleted.
* Modules/applepay/ApplePaySession.h:
* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::addedToRegistry):
(WebCore::MediaSource::removedFromRegistry):
(WebCore::MediaSource::virtualHasPendingActivity const):
* Modules/mediasource/MediaSource.h:
* Modules/mediastream/RTCDataChannel.cpp:
(WebCore::RTCDataChannel::create):
(WebCore::RTCDataChannel::close):
(WebCore::RTCDataChannel::virtualHasPendingActivity const):
* Modules/mediastream/RTCDataChannel.h:
* dom/ActiveDOMObject.h:
* page/EventSource.cpp:
(WebCore::EventSource::create):
(WebCore::EventSource::networkRequestEnded):
(WebCore::EventSource::close):
(WebCore::EventSource::abortConnectionAttempt):
(WebCore::EventSource::virtualHasPendingActivity const):
* page/EventSource.h:
* workers/Worker.cpp:
(WebCore::Worker::create):
(WebCore::Worker::virtualHasPendingActivity const):
(WebCore::Worker::notifyFinished):
2021-06-02 Sam Weinig <weinig@apple.com>
Add support for "relative color syntax" for color()
https://bugs.webkit.org/show_bug.cgi?id=226513
Reviewed by Darin Adler.
CSS Color 5 has recently been update to support relative color syntax for
the color() function in addition to the existing rgb(), hsl(), hwb(), lab()
and lch().
Took the opertunity to refactor other relative color syntax parsing to share
more code between relative and non-relative parsers using a shared function
with lambdas to differentiate the component consumers. This was done for all
the color types except rgb() and hsl(), which have notable differences in
parsing between the relative and non-relative version.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::parseNonRelativeRGBParameters):
(WebCore::CSSPropertyParserHelpers::parseRGBParameters):
(WebCore::CSSPropertyParserHelpers::colorByNormalizingHSLComponents):
(WebCore::CSSPropertyParserHelpers::parseRelativeHSLParameters):
(WebCore::CSSPropertyParserHelpers::parseNonRelativeHSLParameters):
(WebCore::CSSPropertyParserHelpers::parseHSLParameters):
(WebCore::CSSPropertyParserHelpers::parseHWBParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeHWBParameters):
(WebCore::CSSPropertyParserHelpers::parseNonRelativeHWBParameters):
(WebCore::CSSPropertyParserHelpers::parseLabParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeLabParameters):
(WebCore::CSSPropertyParserHelpers::parseNonRelativeLabParameters):
(WebCore::CSSPropertyParserHelpers::parseLCHParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeLCHParameters):
(WebCore::CSSPropertyParserHelpers::parseNonRelativeLCHParameters):
(WebCore::CSSPropertyParserHelpers::parseColorFunctionForRGBTypes):
(WebCore::CSSPropertyParserHelpers::parseRelativeColorFunctionForRGBTypes):
(WebCore::CSSPropertyParserHelpers::parseColorFunctionForXYZParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeColorFunctionForXYZParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeColorFunctionParameters):
(WebCore::CSSPropertyParserHelpers::parseNonRelativeColorFunctionParameters):
(WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
2021-06-02 Youenn Fablet <youenn@apple.com>
HTMLMediaElement::virtualHasPendingActivity may keep objects alive unnecessarily
https://bugs.webkit.org/show_bug.cgi?id=226529
<rdar://78726921>
Reviewed by Eric Carlson.
In case a media element srcObject is set, its media player is no longer null, even if its srcObject is set back to null later on.
Its ended state is set to false so the media element is kept alive if an event listener is set on the element.
To prevent this, add a check to:
- keep the media element alive if its resource selection queue is not empty
- allow GC of a media element if its media player has no engine
A follow-up patch should allow GC a media element with an ended MediaStream.
Test: fast/mediastream/mediaElement-gc.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::virtualHasPendingActivity const):
* html/HTMLMediaElement.h:
* testing/Internals.cpp:
(WebCore::Internals::mediaElementCount const):
* testing/Internals.h:
* testing/Internals.idl:
2021-06-02 Garrett Davidson <garrett_davidson@apple.com>
[Cocoa] _WKAuthenticatorAssertionResponse should specify the attachment type used
https://bugs.webkit.org/show_bug.cgi?id=225519
<rdar://problem/76554090>
Reviewed by Brent Fulgham.
Allow WebAuthn authenticators to pass back their attachment type and continue
plumbing through up to the authenticator coordinator.
Covered by manual tests.
* Modules/webauthn/AuthenticatorAssertionResponse.cpp:
(WebCore::AuthenticatorAssertionResponse::create):
(WebCore::AuthenticatorAssertionResponse::AuthenticatorAssertionResponse):
* Modules/webauthn/AuthenticatorAssertionResponse.h:
* Modules/webauthn/AuthenticatorAttestationResponse.cpp:
(WebCore::AuthenticatorAttestationResponse::create):
(WebCore::AuthenticatorAttestationResponse::AuthenticatorAttestationResponse):
* Modules/webauthn/AuthenticatorAttestationResponse.h:
* Modules/webauthn/AuthenticatorCoordinator.cpp:
(WebCore::AuthenticatorCoordinator::create const):
(WebCore::AuthenticatorCoordinator::discoverFromExternalSource const):
* Modules/webauthn/AuthenticatorCoordinatorClient.h:
* Modules/webauthn/AuthenticatorResponse.cpp:
(WebCore::AuthenticatorResponse::tryCreate):
(WebCore::AuthenticatorResponse::attachment const):
(WebCore::AuthenticatorResponse::AuthenticatorResponse):
* Modules/webauthn/AuthenticatorResponse.h:
* Modules/webauthn/fido/DeviceResponseConverter.cpp:
(fido::readCTAPMakeCredentialResponse):
(fido::readCTAPGetAssertionResponse):
* Modules/webauthn/fido/DeviceResponseConverter.h:
* Modules/webauthn/fido/U2fResponseConverter.cpp:
(fido::readU2fRegisterResponse):
(fido::readU2fSignResponse):
* Modules/webauthn/fido/U2fResponseConverter.h:
2021-06-02 Youenn Fablet <youenn@apple.com>
Reduce logging in MediaElementSession::playbackStateChangePermitted
https://bugs.webkit.org/show_bug.cgi?id=226531
Reviewed by Eric Carlson.
Downgrade logging to INFO level for the regular code path.
Keep logging more rare case as before.
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::playbackStateChangePermitted const):
2021-06-02 Antti Koivisto <antti@apple.com>
Style::Scope should use CheckedPtr
https://bugs.webkit.org/show_bug.cgi?id=226530
Reviewed by Sam Weinig.
Instead of WeakPtr.
* style/StyleScope.cpp:
(WebCore::Style::Scope::collectResolverScopes):
* style/StyleScope.h:
2021-06-02 Antti Koivisto <antti@apple.com>
Rename RootInlineBox to LegacyRootInlineBox
https://bugs.webkit.org/show_bug.cgi?id=226533
Reviewed by Sam Weinig.
More legacy line layout path renaming.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/ContainerNode.cpp:
* html/HTMLTextFormControlElement.cpp:
(WebCore::getNextSoftBreak):
(WebCore::HTMLTextFormControlElement::valueWithHardLineBreaks const):
* layout/integration/LayoutIntegrationLineIterator.h:
(WebCore::LayoutIntegration::LineIterator::LineIterator):
(WebCore::LayoutIntegration::PathLine::legacyRootInlineBox const):
* layout/integration/LayoutIntegrationLineIteratorLegacyPath.h:
(WebCore::LayoutIntegration::LineIteratorLegacyPath::LineIteratorLegacyPath):
(WebCore::LayoutIntegration::LineIteratorLegacyPath::selectionTopForHitTesting const):
(WebCore::LayoutIntegration::LineIteratorLegacyPath::legacyRootInlineBox const):
* layout/integration/LayoutIntegrationLineIteratorModernPath.h:
(WebCore::LayoutIntegration::LineIteratorModernPath::legacyRootInlineBox const):
* layout/integration/LayoutIntegrationRunIteratorLegacyPath.h:
(WebCore::LayoutIntegration::RunIteratorLegacyPath::RunIteratorLegacyPath):
(WebCore::LayoutIntegration::RunIteratorLegacyPath::rootInlineBox const):
* rendering/EllipsisBox.cpp:
(WebCore::EllipsisBox::markupBox const):
(WebCore::EllipsisBox::selectionRect):
(WebCore::EllipsisBox::paintSelection):
* rendering/FloatingObjects.cpp:
* rendering/FloatingObjects.h:
(WebCore::FloatingObject::originatingLine const):
(WebCore::FloatingObject::setOriginatingLine):
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::innerTextIfTruncated const):
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::computeLogicalBoxHeights):
(WebCore::InlineFlowBox::nodeAtPoint):
(WebCore::InlineFlowBox::constrainToLineTopAndBottomIfNeeded const):
* rendering/InlineFlowBox.h:
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintMarkedTextBackground):
* rendering/LegacyInlineBox.cpp:
(WebCore::LegacyInlineBox::root const):
(WebCore::LegacyInlineBox::root):
* rendering/LegacyInlineBox.h:
* rendering/LegacyLineLayout.cpp:
(WebCore::LegacyLineLayout::createRootInlineBox):
(WebCore::LegacyLineLayout::createAndAppendRootInlineBox):
(WebCore::LegacyLineLayout::constructLine):
(WebCore::setLogicalWidthForTextRun):
(WebCore::LegacyLineLayout::updateRubyForJustifiedText):
(WebCore::LegacyLineLayout::updateLogicalWidthForAlignment):
(WebCore::LegacyLineLayout::computeInlineDirectionPositionsForLine):
(WebCore::LegacyLineLayout::computeInlineDirectionPositionsForSegment):
(WebCore::LegacyLineLayout::removeInlineBox const):
(WebCore::LegacyLineLayout::computeBlockDirectionPositionsForLine):
(WebCore::LegacyLineLayout::createLineBoxesFromBidiRuns):
(WebCore::deleteLineRange):
(WebCore::LegacyLineLayout::layoutRunsAndFloats):
(WebCore::LegacyLineLayout::layoutRunsAndFloatsInRange):
(WebCore::LegacyLineLayout::reattachCleanLineFloats):
(WebCore::LegacyLineLayout::checkFloatInCleanLine):
(WebCore::LegacyLineLayout::determineStartPosition):
(WebCore::LegacyLineLayout::determineEndPosition):
(WebCore::LegacyLineLayout::checkPaginationAndFloatsAtEndLine):
(WebCore::LegacyLineLayout::lineWidthForPaginatedLineChanged const):
(WebCore::LegacyLineLayout::matchedEndLine):
(WebCore::LegacyLineLayout::addOverflowFromInlineChildren):
(WebCore::LegacyLineLayout::lineCountUntil const):
(WebCore::LegacyLineLayout::deleteEllipsisLineBoxes):
(WebCore::LegacyLineLayout::checkLinesForTextOverflow):
(WebCore::LegacyLineLayout::updateFragmentForLine const):
* rendering/LegacyLineLayout.h:
(WebCore::LegacyLineLayout::firstRootBox const):
(WebCore::LegacyLineLayout::lastRootBox const):
* rendering/LegacyRootInlineBox.cpp: Renamed from Source/WebCore/rendering/RootInlineBox.cpp.
(WebCore::containingFragmentMap):
(WebCore::LegacyRootInlineBox::LegacyRootInlineBox):
(WebCore::LegacyRootInlineBox::~LegacyRootInlineBox):
(WebCore::LegacyRootInlineBox::detachEllipsisBox):
(WebCore::LegacyRootInlineBox::clearTruncation):
(WebCore::LegacyRootInlineBox::isHyphenated const):
(WebCore::LegacyRootInlineBox::baselinePosition const):
(WebCore::LegacyRootInlineBox::lineHeight const):
(WebCore::LegacyRootInlineBox::lineCanAccommodateEllipsis):
(WebCore::LegacyRootInlineBox::placeEllipsis):
(WebCore::LegacyRootInlineBox::placeEllipsisBox):
(WebCore::LegacyRootInlineBox::paintEllipsisBox const):
(WebCore::LegacyRootInlineBox::paint):
(WebCore::LegacyRootInlineBox::nodeAtPoint):
(WebCore::LegacyRootInlineBox::adjustPosition):
(WebCore::LegacyRootInlineBox::childRemoved):
(WebCore::LegacyRootInlineBox::containingFragment const):
(WebCore::LegacyRootInlineBox::clearContainingFragment):
(WebCore::LegacyRootInlineBox::setContainingFragment):
(WebCore::LegacyRootInlineBox::alignBoxesInBlockDirection):
(WebCore::LegacyRootInlineBox::beforeAnnotationsAdjustment const):
(WebCore::LegacyRootInlineBox::lineSnapAdjustment const):
(WebCore::LegacyRootInlineBox::lineSelectionGap):
(WebCore::LegacyRootInlineBox::selectionState):
(WebCore::LegacyRootInlineBox::firstSelectedBox):
(WebCore::LegacyRootInlineBox::lastSelectedBox):
(WebCore::LegacyRootInlineBox::selectionTop const):
(WebCore::blockBeforeWithinSelectionRoot):
(WebCore::LegacyRootInlineBox::selectionTopAdjustedForPrecedingBlock const):
(WebCore::LegacyRootInlineBox::selectionBottom const):
(WebCore::LegacyRootInlineBox::blockFlow const):
(WebCore::LegacyRootInlineBox::lineBreakBidiStatus const):
(WebCore::LegacyRootInlineBox::setLineBreakInfo):
(WebCore::LegacyRootInlineBox::ellipsisBox const):
(WebCore::LegacyRootInlineBox::removeLineBoxFromRenderObject):
(WebCore::LegacyRootInlineBox::extractLineBoxFromRenderObject):
(WebCore::LegacyRootInlineBox::attachLineBoxToRenderObject):
(WebCore::LegacyRootInlineBox::paddedLayoutOverflowRect const):
(WebCore::setAscentAndDescent):
(WebCore::LegacyRootInlineBox::ascentAndDescentForBox const):
(WebCore::LegacyRootInlineBox::verticalPositionForBox):
(WebCore::LegacyRootInlineBox::includeLeadingForBox const):
(WebCore::LegacyRootInlineBox::includeFontForBox const):
(WebCore::LegacyRootInlineBox::includeGlyphsForBox const):
(WebCore::LegacyRootInlineBox::includeInitialLetterForBox const):
(WebCore::LegacyRootInlineBox::includeMarginForBox const):
(WebCore::LegacyRootInlineBox::fitsToGlyphs const):
(WebCore::LegacyRootInlineBox::includesRootLineBoxFontOrLeading const):
(WebCore::LegacyRootInlineBox::outputLineBox const):
(WebCore::LegacyRootInlineBox::boxName const):
* rendering/LegacyRootInlineBox.h: Renamed from Source/WebCore/rendering/RootInlineBox.h.
(WebCore::LegacyRootInlineBox::lineTop const):
(WebCore::LegacyRootInlineBox::lineBottom const):
(WebCore::LegacyRootInlineBox::lineBoxTop const):
(WebCore::LegacyRootInlineBox::lineBoxBottom const):
(WebCore::LegacyRootInlineBox::lineBoxHeight const):
(WebCore::LegacyRootInlineBox::paginationStrut const):
(WebCore::LegacyRootInlineBox::setPaginationStrut):
(WebCore::LegacyRootInlineBox::isFirstAfterPageBreak const):
(WebCore::LegacyRootInlineBox::setIsFirstAfterPageBreak):
(WebCore::LegacyRootInlineBox::paginatedLineWidth const):
(WebCore::LegacyRootInlineBox::setPaginatedLineWidth):
(WebCore::LegacyRootInlineBox::selectionHeight const):
(WebCore::LegacyRootInlineBox::selectionHeightAdjustedForPrecedingBlock const):
(WebCore::LegacyRootInlineBox::setLineTopBottomPositions):
(WebCore::LegacyRootInlineBox::lineBreakObj const):
(WebCore::LegacyRootInlineBox::lineBreakPos const):
(WebCore::LegacyRootInlineBox::setLineBreakPos):
(WebCore::LegacyRootInlineBox::appendFloat):
(WebCore::LegacyRootInlineBox::removeFloat):
(WebCore::LegacyRootInlineBox::floatsPtr):
(WebCore::LegacyRootInlineBox::baselineType const):
(WebCore::LegacyRootInlineBox::hasAnnotationsBefore const):
(WebCore::LegacyRootInlineBox::hasAnnotationsAfter const):
(WebCore::LegacyRootInlineBox::logicalTopVisualOverflow const):
(WebCore::LegacyRootInlineBox::logicalBottomVisualOverflow const):
(WebCore::LegacyRootInlineBox::logicalTopLayoutOverflow const):
(WebCore::LegacyRootInlineBox::logicalBottomLayoutOverflow const):
(WebCore::LegacyRootInlineBox::isTrailingFloatsRootInlineBox const):
(WebCore::LegacyRootInlineBox::nextRootBox const):
(WebCore::LegacyRootInlineBox::prevRootBox const):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::simplifiedNormalFlowLayout):
* rendering/RenderBlockFlow.cpp:
(WebCore::calculateMinimumPageHeight):
(WebCore::needsAppleMailPaginationQuirk):
(WebCore::RenderBlockFlow::adjustLinePositionForPagination):
(WebCore::RenderBlockFlow::layoutLineGridBox):
(WebCore::RenderBlockFlow::markLinesDirtyInBlockRange):
(WebCore::RenderBlockFlow::inlineSelectionGaps):
(WebCore::shouldIncludeLinesForParentLineCount):
(WebCore::RenderBlockFlow::lineCount const):
(WebCore::RenderBlockFlow::clearTruncation):
(WebCore::RenderBlockFlow::addFocusRingRectsForInlineChildren):
(WebCore::RenderBlockFlow::outputLineTreeAndMark const):
(WebCore::shouldCheckLines): Deleted.
* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::lineGridBox const):
(WebCore::RenderBlockFlow::setLineGridBox):
(WebCore::RenderBlockFlow::firstRootBox const):
(WebCore::RenderBlockFlow::lastRootBox const):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::positionLineBox):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintMaskForTextFillBox):
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::lineAtIndex):
(WebCore::getHeightForLineCount):
(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
(WebCore::shouldCheckLines): Deleted.
* rendering/RenderFragmentedFlow.cpp:
(WebCore::RenderFragmentedFlow::checkLinesConsistency const):
* rendering/RenderFragmentedFlow.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::generateCulledLineBoxRects const):
(WebCore::RenderInline::linesVisualOverflowBoundingBox const):
(WebCore::RenderInline::linesVisualOverflowBoundingBoxInFragment const):
(WebCore::RenderInline::paintOutline):
* rendering/RenderLineBoxList.cpp:
(WebCore::RenderLineBoxList::anyLineIntersectsRect const):
(WebCore::RenderLineBoxList::lineIntersectsDirtyRect const):
(WebCore::RenderLineBoxList::paint const):
(WebCore::RenderLineBoxList::hitTest const):
(WebCore::RenderLineBoxList::dirtyLinesFromChangedChild):
* rendering/RenderLineBreak.cpp:
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::localSelectionRect):
(WebCore::RenderListMarker::addOverflowFromListMarker):
(WebCore::RenderListMarker::selectionRectForRepaint):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::shouldPaint):
(WebCore::RenderReplaced::localSelectionRect const):
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::layoutBlock):
(WebCore::RenderRubyRun::getOverhang const):
* rendering/RenderTextLineBoxes.cpp:
(WebCore::RenderTextLineBoxes::dirtyRange):
* rendering/TrailingFloatsRootInlineBox.h:
* rendering/line/LineLayoutState.h:
(WebCore::LineLayoutState::endLine const):
(WebCore::LineLayoutState::setEndLine):
(WebCore::LineLayoutState::updateRepaintRangeFromBox):
* rendering/mathml/RenderMathMLBlock.cpp:
(WebCore::RenderMathMLBlock::baselinePosition const):
* rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::positionForPoint):
* rendering/svg/SVGRootInlineBox.cpp:
(WebCore::SVGRootInlineBox::SVGRootInlineBox):
* rendering/svg/SVGRootInlineBox.h:
* style/InlineTextBoxStyle.cpp:
(WebCore::computeUnderlineOffset):
2021-06-02 Chris Dumez <cdumez@apple.com>
Use Checked aliases instead of Checked<T, RecordOverflow>
https://bugs.webkit.org/show_bug.cgi?id=226535
Reviewed by Keith Miller.
* html/ImageData.cpp:
(WebCore::computeDataSize):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::validateTexFuncData):
(WebCore::WebGLRenderingContextBase::validateCompressedTexFuncData):
* platform/graphics/GraphicsContextGL.cpp:
(WebCore::GraphicsContextGL::computeImageSizeInBytes):
* platform/graphics/IntRect.cpp:
(WebCore::IntRect::isValid const):
* platform/graphics/PixelBuffer.cpp:
(WebCore::PixelBuffer::computeBufferSize):
* platform/graphics/PixelBuffer.h:
* platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.cpp:
(WebCore::ISOFairPlayStreamingKeyRequestInfoBox::parse):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateBackdropFilters):
* platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
(WebCore::ImageBufferCGBitmapBackend::calculateSafeBackendSize):
* platform/graphics/win/Direct2DUtilities.cpp:
(WebCore::Direct2D::createDirect2DImageSurfaceWithData):
* platform/graphics/win/ImageBufferDirect2DBackend.cpp:
(WebCore::ImageBufferDirect2DBackend::copyNativeImage const):
(WebCore::ImageBufferDirect2DBackend::compatibleBitmap):
2021-06-02 Martin Robinson <mrobinson@igalia.com>
[css-scroll-snap] Scroll snap is broken with non-horizontal writing modes
https://bugs.webkit.org/show_bug.cgi?id=226010
Reviewed by Frédéric Wang.
Fix issues related to vertical writing modes and scroll snap.
This change fixes three existing WPT tests.
imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-snap-type-on-root-element.html
imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/writing-mode-vertical-lr.html
imported/w3c/web-platform-tests/css/css-scroll-snap/snap-inline-block.html
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::valueForScrollSnapAlignment): Update to reflect new member names of ScrollSnapAlign.
* page/FrameView.cpp:
(WebCore::FrameView::updateSnapOffsets): Pass in the text direction and writing mode of the
container, allowing the values specified on the body to override those specified on the root
element.
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::updateSnapOffsetsForScrollableArea): Properly handle the writing mode and the
text direction of the container.
* page/scrolling/ScrollSnapOffsetsInfo.h: Update function signature.
* rendering/RenderLayerModelObject.cpp:
(WebCore::scrollSnapContainerRequiresUpdateForStyleUpdate): Pass in the writing mode and
text direction of the scrolling container.
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::updateSnapOffsets): Update to reflect new member names
of ScrollSnapAlign.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::hasSnapPosition const): Ditto.
* rendering/style/StyleScrollSnapPoints.h: Change the name of the members of ScrollSnapAlign
to match what is described in the specification. The values provided are for block and
inline directions, but depending on the scroll container.
(WebCore::operator==): Ditto.
* style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertScrollSnapAlign): Ditto.
2021-06-02 Antti Koivisto <antti@apple.com>
REGRESSION(r276882): Style not invalidated correctly for media queries in shadow trees that share style
https://bugs.webkit.org/show_bug.cgi?id=226369
<rdar://problem/78684562>
Reviewed by Sam Weinig.
Style resolvers are stateful in respect to media queries. We would only invalidate in the first shadow tree
because that evaluation flipped the state and the second evaluation would see nothing changing in media query
state.
* style/StyleScope.cpp:
(WebCore::Style::Scope::collectResolverScopes):
Add a helper to collect all scopes associated with a resolver.
(WebCore::Style::Scope::evaluateMediaQueries):
Only evaluate each resolver once, then invalidate all associated scopes if needed.
* style/StyleScope.h:
2021-05-28 Antoine Quint <graouts@webkit.org>
Hit-testing does not account for clip-path on <iframe>
https://bugs.webkit.org/show_bug.cgi?id=226380
<rdar://problem/78621486>
Reviewed by Antti Koivisto.
The logic to account for the clip-path property during hit-testing was only found in RenderBlock::nodeAtPoint()
although other types of RenderBox objects may need this, such as RenderIFrame. So we move some of the logic
from RenderBlock::nodeAtPoint() to dedicated methods on RenderBox such that RenderBox::nodeAtPoint() may call them
but also allow for RenderBlock::nodeAtPoint() to call them.
Test: css3/masking/clip-path-hit-test-iframe.html
css3/masking/clip-path-hit-test-img.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::nodeAtPoint):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::hitTestVisualOverflow const):
(WebCore::RenderBox::hitTestClipPath const):
(WebCore::RenderBox::hitTestBorderRadius const):
(WebCore::RenderBox::nodeAtPoint):
* rendering/RenderBox.h:
2021-06-02 Youenn Fablet <youenn@apple.com>
Improve AudioMediaStreamTrackRendererUnit logging to know which source is being played
https://bugs.webkit.org/show_bug.cgi?id=226466
Reviewed by Eric Carlson.
Log AudioSampleDataSource identifier when using it with the render unit.
Set AudioSampleDataSource identifier to its MediaStreamTrack/RealtimeMediaSource identifier.
This allows identifying which tracks are being played.
No change of behavior.
* platform/mediastream/AudioTrackPrivateMediaStream.cpp:
(WebCore::AudioTrackPrivateMediaStream::createRenderer):
(WebCore::AudioTrackPrivateMediaStream::setLogger): Deleted.
* platform/mediastream/AudioTrackPrivateMediaStream.h:
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererCocoa.cpp:
(WebCore::AudioMediaStreamTrackRendererCocoa::pushSamples):
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.cpp:
(WebCore::AudioMediaStreamTrackRendererUnit::addSource):
(WebCore::AudioMediaStreamTrackRendererUnit::removeSource):
2021-06-01 Darin Adler <darin@apple.com>
Remove <wtf/Optional.h>
https://bugs.webkit.org/show_bug.cgi?id=226437
Reviewed by Chris Dumez.
* <many files>: Removed include of <wtf/Optional.h>.
* platform/graphics/Font.h: Tweaked style a bit.
* Modules/geolocation/GeolocationClient.h: Added include of <optional>.
* Modules/mediastream/DoubleRange.h: Ditto.
* Modules/mediastream/LongRange.h: Ditto.
* Modules/webauthn/AuthenticationExtensionsClientOutputs.h: Ditto.
* css/CSSToLengthConversionData.h: Ditto.
* css/DOMMatrix2DInit.h: Ditto.
* dom/AddEventListenerOptions.h: Ditto.
* dom/DeviceMotionData.h: Ditto.
* dom/DeviceOrientationData.h: Ditto.
* dom/SuccessOr.h: Ditto.
* html/DateTimeFieldsState.h: Ditto.
* html/ImageBitmapOptions.h: Ditto.
* html/canvas/PredefinedColorSpace.h: Ditto.
* layout/LayoutPhase.h: Ditto.
* layout/MarginTypes.h: Ditto.
* loader/ResourceLoadNotifier.h: Ditto.
* page/RuntimeEnabledFeatures.h: Ditto.
* page/ScrollOptions.h: Ditto.
* platform/MediaCapabilitiesInfo.h: Ditto.
* platform/cocoa/SystemBattery.h: Ditto.
* platform/graphics/DecodingOptions.h: Ditto.
* platform/graphics/DestinationColorSpace.h: Ditto.
* platform/graphics/DisplayRefreshMonitorClient.h: Ditto.
* platform/graphics/FloatLine.h: Ditto.
* platform/graphics/gpu/GPURequestAdapterOptions.h: Ditto.
* platform/graphics/x11/PlatformDisplayX11.h: Ditto.
* platform/ios/SelectionGeometry.h: Ditto.
* platform/mac/NSScrollerImpDetails.h: Ditto.
* platform/network/DNS.h: Ditto.
* platform/text/EncodingTables.h: Ditto.
* platform/text/TextCodecCJK.h: Ditto.
* platform/text/TextCodecUTF16.h: Ditto.
* platform/text/TextFlags.h: Ditto.
2021-06-01 Chris Dumez <cdumez@apple.com>
Rename Checked::unsafeGet() to Checked::value()
https://bugs.webkit.org/show_bug.cgi?id=226514
Reviewed by Darin Adler.
Rename Checked::unsafeGet() to Checked::value(). The "unsafeGet" naming is confusing as this
function isn't really unsafe since it will crash if the value has overflowed. Also add an
`operator T()` to implicitly convert a Checked to its underlying type without needing to
call value().
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readTerminal):
* dom/TextEncoderStreamEncoder.cpp:
(WebCore::TextEncoderStreamEncoder::encode):
* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::takeResults):
* html/FileInputType.cpp:
(WebCore::FileInputType::saveFormControlState const):
* html/ImageData.cpp:
(WebCore::ImageData::create):
(WebCore::ImageData::createUninitialized):
* html/MediaElementSession.cpp:
(WebCore::isElementRectMostlyInMainFrame):
* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::sliceArrayBufferView):
(WebCore::WebGL2RenderingContext::copyBufferSubData):
(WebCore::WebGL2RenderingContext::getBufferSubData):
(WebCore::WebGL2RenderingContext::validateClearBuffer):
* html/canvas/WebGLBuffer.cpp:
(WebCore::WebGLBuffer::associateBufferSubDataImpl):
(WebCore::WebGLBuffer::associateCopyBufferSubData):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::clip2D):
(WebCore::WebGLRenderingContextBase::validateDrawArrays):
(WebCore::WebGLRenderingContextBase::validateDrawElements):
(WebCore::WebGLRenderingContextBase::validateTexFuncData):
(WebCore::WebGLRenderingContextBase::validateCompressedTexFuncData):
(WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0):
* html/canvas/WebGLRenderingContextBase.h:
(WebCore::WebGLRenderingContextBase::validateTexImageSubRectangle):
(WebCore::WebGLRenderingContextBase::checkedAddAndMultiply):
* page/FrameView.h:
(WebCore::FrameView::incrementVisuallyNonEmptyPixelCount):
* page/History.cpp:
(WebCore::History::stateObjectAdded):
* platform/audio/AudioArray.h:
(WebCore::AudioArray::resize):
* platform/audio/cocoa/AudioFileReaderCocoa.cpp:
(WebCore::tryCreateAudioBufferList):
* platform/audio/cocoa/CARingBuffer.cpp:
(WebCore::CARingBuffer::adoptStorage):
(WebCore::CARingBuffer::initializeAfterAllocation):
(WebCore::CARingBuffer::allocate):
* platform/audio/cocoa/WebAudioBufferList.cpp:
(WebCore::WebAudioBufferList::WebAudioBufferList):
* platform/graphics/FormatConverter.h:
(WebCore::FormatConverter::FormatConverter):
* platform/graphics/GraphicsContextGL.cpp:
(WebCore::GraphicsContextGL::computeImageSizeInBytes):
* platform/graphics/ImageBackingStore.h:
(WebCore::ImageBackingStore::setSize):
(WebCore::ImageBackingStore::clear):
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::calculateMemoryCost):
* platform/graphics/ImageFrame.h:
(WebCore::ImageFrame::frameBytes const):
* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::maximumSubsamplingLevel):
* platform/graphics/PixelBuffer.cpp:
(WebCore::PixelBuffer::tryCreateForDecoding):
(WebCore::PixelBuffer::tryCreate):
* platform/graphics/PixelBuffer.h:
(WebCore::PixelBuffer::encode const):
(WebCore::PixelBuffer::decode):
* platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
(WebCore::ImageDecoderAVFObjC::frameBytesAtIndex const):
* platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
(WebCore::MediaSampleAVFObjC::setByteRangeOffset):
(WebCore::MediaSampleAVFObjC::byteRangeForAttachment const):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateBackdropFilters):
* platform/graphics/ca/LayerPool.cpp:
(WebCore::LayerPool::backingStoreBytesForSize):
* platform/graphics/cg/GraphicsContextGLCG.cpp:
(WebCore::GraphicsContextGLImageExtractor::extractImage):
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::ImageBufferCGBackend::calculateBytesPerRow):
* platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::ImageDecoderCG::frameBytesAtIndex const):
* platform/graphics/cocoa/SourceBufferParser.cpp:
(WebCore::SourceBufferParser::Segment::read const):
* platform/graphics/filters/FEColorMatrix.cpp:
(WebCore::effectApplyAccelerated):
* platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::FEGaussianBlur::platformApplySoftware):
* platform/graphics/filters/FETurbulence.cpp:
(WebCore::FETurbulence::platformApplySoftware):
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::unmultipliedResult):
(WebCore::FilterEffect::premultipliedResult):
(WebCore::copyPremultiplyingAlpha):
(WebCore::copyUnpremultiplyingAlpha):
* platform/graphics/gpu/cocoa/GPUBindGroupAllocatorMetal.mm:
(WebCore::GPUBindGroupAllocator::allocateAndSetEncoders):
(WebCore::GPUBindGroupAllocator::reallocate):
* platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm:
(WebCore::GPUCommandBuffer::copyBufferToBuffer):
* platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
(WebCore::GPURenderPassEncoder::drawIndexed):
* platform/graphics/gstreamer/ImageDecoderGStreamer.cpp:
(WebCore::ImageDecoderGStreamer::frameBytesAtIndex const):
* platform/graphics/nicosia/NicosiaBuffer.cpp:
(Nicosia::Buffer::Buffer):
* platform/graphics/win/Direct2DUtilities.cpp:
(WebCore::Direct2D::createDirect2DImageSurfaceWithData):
* platform/graphics/win/ImageBufferDirect2DBackend.cpp:
(WebCore::ImageBufferDirect2DBackend::compatibleBitmap):
* platform/graphics/win/ImageDecoderDirect2D.cpp:
(WebCore::ImageDecoderDirect2D::frameBytesAtIndex const):
* platform/image-decoders/ScalableImageDecoder.cpp:
(WebCore::ScalableImageDecoder::frameBytesAtIndex const):
* platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp:
(WebCore::sycc444ToRGB):
(WebCore::sycc422ToRGB):
(WebCore::sycc420ToRGB):
* platform/ios/LegacyTileLayerPool.mm:
(WebCore::LegacyTileLayerPool::bytesBackingLayerWithPixelSize):
* platform/text/TextCodecUTF16.cpp:
(WebCore::TextCodecUTF16::encode const):
* platform/text/TextCodecUTF8.cpp:
(WebCore::TextCodecUTF8::encodeUTF8):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForCanvas const):
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createRasterShape):
* storage/StorageMap.cpp:
(WebCore::StorageMap::setItem):
* xml/XSLStyleSheetLibxslt.cpp:
(WebCore::XSLStyleSheet::parseString):
* xml/XSLTProcessorLibxslt.cpp:
(WebCore::xsltParamArrayFromParameterMap):
* xml/parser/CharacterReferenceParserInlines.h:
(WebCore::consumeCharacterReference):
2021-06-01 Jean-Yves Avenard <jya@apple.com>
MediaSession.coordinator should not be optional, relying on coordinator state change instead
https://bugs.webkit.org/show_bug.cgi?id=226328
rdar://77461335
Reviewed by Eric Carlson.
The coordinator was a read-only optional attribute of the MediaSession element.
Testing if the attribute was to be used to determine if a MediaSessionCoordinator
was now available and for the MediaSession to join it. This made the use of an external
polyfill difficult and enforcing the validity of an user created custom
MediaSessionCoordinator due to IDL semantics limitations hard.
We instead always create a MediaSessionCoordinator which in its default state is Closed.
Once this state is changed to Waiting and an event is fire the MediaSession can now
join it.
* Modules/mediasession/MediaSession.cpp:
(WebCore::MediaSession::MediaSession): MediaSession no longer needs to fire event.
Remove no longer necessary inheritance and async event queue.
(WebCore::MediaSession::create): Drive-by fix, don't call suspendIfNeeded() in the constructor.
(WebCore::MediaSession::createCoordinator): Make method private.
* Modules/mediasession/MediaSession.h:
(WebCore::MediaSession::coordinator const): MediaSessionCoordinator always exists. Return reference instead.
* Modules/mediasession/MediaSession.idl: Amend definition, remove EventHandler
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::create):
(WebCore::MediaSessionCoordinator::MediaSessionCoordinator):
(WebCore::MediaSessionCoordinator::setMediaSessionCoordinatorPrivate):
(WebCore::MediaSessionCoordinator::virtualHasPendingActivity const):
(WebCore::MediaSessionCoordinator::join):
(WebCore::MediaSessionCoordinator::close):
(WebCore::MediaSessionCoordinator::coordinatorStateChanged):
* Modules/mediasession/MediaSessionCoordinator.h:
* Modules/mediasession/MediaSessionCoordinator.idl: Added new EventHandler attribute.
* Modules/mediasession/MediaSessionCoordinatorMixin.idl: Update for new API definition.
* dom/EventNames.h:
* dom/EventTargetFactory.in:
* page/Page.cpp:
(WebCore::Page::setMediaSessionCoordinator):
(WebCore::Page::invalidateMediaSessionCoordinator):
* testing/Internals.cpp:
(WebCore::Internals::registerMockMediaSessionCoordinator):
2021-06-01 Chris Dumez <cdumez@apple.com>
Drop unused AudioChannel::resizeSmaller()
https://bugs.webkit.org/show_bug.cgi?id=226516
Reviewed by Sam Weinig.
* platform/audio/AudioBus.cpp:
* platform/audio/AudioBus.h:
* platform/audio/AudioChannel.cpp:
* platform/audio/AudioChannel.h:
2021-06-01 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Data detector highlights should appear when hovering inside image overlays
https://bugs.webkit.org/show_bug.cgi?id=226507
Reviewed by Tim Horton.
Refactor some logic in ImageOverlayController, such that the overlay is installed if _either_ selection painting
is required, or data detector highlights for the image overlay host element exist; additionally, add plumbing to
allow the ImageOverlayController to install a page overlay when the element under the mouse is inside an image
overlay.
* dom/Document.cpp:
(WebCore::Document::willBeRemovedFromFrame):
Drive-by fix: use `imageOverlayControllerIfExists` instead of `imageOverlayController` to avoid unnecessarily
creating a new ImageOverlayController when detaching a Document.
* page/EventHandler.cpp:
(WebCore::EventHandler::clear):
Refactor logic for clearing out `m_elementUnderMouse` into a separate helper, and call it from these two places.
This new helper clears out `m_elementUnderMouse` and additionally notifies the page's image overlay controller
(only if it has already been constructed).
(WebCore::EventHandler::updateMouseEventTargetNode):
Call out to the page's image overlay controller when changing `m_elementUnderMouse`.
(WebCore::EventHandler::clearElementUnderMouse):
* page/EventHandler.h:
* page/ImageOverlayController.cpp:
(WebCore::ImageOverlayController::selectionQuadsDidChange):
Refactor ImageOverlayController so that it only installs its page overlay if either:
1. Selection painting is needed for selected text inside an image overlay, or...
2. The cursor is over an image overlay host element with data detection results.
To achieve this, we maintain a weak pointer to the image overlay host that contains the selection separately
from the weak pointer to the image overlay host that contains data detectors, and is the element currently under
the mouse cursor.
Drive-by fix: also ignore selection updates due to temporary selections triggered as a result of gathering
dictionary popup info.
(WebCore::ImageOverlayController::documentDetached):
(WebCore::ImageOverlayController::uninstallPageOverlay):
(WebCore::ImageOverlayController::uninstallPageOverlayIfNeeded):
Split this into two functions: `uninstallPageOverlayIfNeeded`, which removes and destroys the PageOverlay if
it is no longer needed (i.e. the overlay is required for neither selection painting nor data detectors).
(WebCore::ImageOverlayController::willMoveToPage):
(WebCore::ImageOverlayController::drawRect):
(WebCore::ImageOverlayController::elementUnderMouseDidChange):
* page/ImageOverlayController.h:
Rename `m_imageOverlayBounds` to `m_selectionClipRect` to make it clear that this is only used during selection
painting, and rename `m_overlaySelectionQuads` to just `m_selectionQuads` for conciseness.
* page/Page.h:
(WebCore::Page::imageOverlayControllerIfExists):
Add a version of this getter that does not initialize the ImageOverlayController if it didn't already exist. See
call sites in EventHandler and Document.
* page/mac/ImageOverlayControllerMac.mm:
(WebCore::ImageOverlayController::clearDataDetectorHighlights):
Additionally clear out `m_hostElementForDataDetectors`.
(WebCore::ImageOverlayController::elementUnderMouseDidChange):
Update data detector highlights whenever the element under the mouse is over content inside an image overlay.
Note that we effectively ignore this method call in the case where we're clearing out `m_elementUnderMouse` for
a different Document than the one containing `m_hostElementForDataDetectors`, which prevents us from erroneously
hiding data detectors when `m_elementUnderMouse` is removed or otherwise cleared out in a different Document.
2021-06-01 Chris Dumez <cdumez@apple.com>
Fix unsafe access to m_upload in XMLHttpRequest::virtualHasPendingActivity()
https://bugs.webkit.org/show_bug.cgi?id=226508
Reviewed by Geoffrey Garen.
Fix unsafe access to m_upload in XMLHttpRequest::virtualHasPendingActivity() as virtualHasPendingActivity()
may get called off the main thread and m_upload gets initialized lazily on the main thread.
Tests: fast/xmlhttprequest/xmlhttprequest-upload-sameobject.html
http/tests/xmlhttprequest/upload-progress-events-gc.html
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::updateHasRelevantEventListener):
(WebCore::XMLHttpRequest::eventListenersDidChange):
(WebCore::XMLHttpRequest::virtualHasPendingActivity const):
* xml/XMLHttpRequest.h:
* xml/XMLHttpRequest.idl:
* xml/XMLHttpRequestUpload.cpp:
(WebCore::XMLHttpRequestUpload::eventListenersDidChange):
(WebCore::XMLHttpRequestUpload::hasRelevantEventListener const):
* xml/XMLHttpRequestUpload.h:
2021-06-01 Fujii Hironori <Hironori.Fujii@sony.com>
[Win] Remove unused GraphicsContext::hdc()
https://bugs.webkit.org/show_bug.cgi?id=226309
Reviewed by Anders Carlsson.
* platform/graphics/GraphicsContext.h:
* platform/graphics/win/GraphicsContextWin.cpp:
(WebCore::GraphicsContext::hdc const): Deleted.
2021-06-01 Cameron McCormack <heycam@apple.com>
Remove duplicate "behavior for fixed" entry from scrolling state tree logging
https://bugs.webkit.org/show_bug.cgi?id=226479
Reviewed by Frédéric Wang.
* page/scrolling/ScrollingStateFrameScrollingNode.cpp:
(WebCore::ScrollingStateFrameScrollingNode::dumpProperties const):
2021-06-01 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo] GraphicsContextCairo::GraphicsContextCairo(HDC, bool) leaks cairo_t
https://bugs.webkit.org/show_bug.cgi?id=226317
Reviewed by Don Olmstead.
* platform/graphics/win/GraphicsContextCairoWin.cpp:
(WebCore::createCairoContextWithHDC): Changed the return type from cairo_t* to RefPtr<cairo_t>.
(WebCore::GraphicsContextCairo::GraphicsContextCairo):
2021-06-01 Philippe Normand <pnormand@igalia.com>
[EME][Thunder] Build broken since r278244
https://bugs.webkit.org/show_bug.cgi?id=226498
Reviewed by Alex Christensen.
* platform/graphics/gstreamer/eme/CDMThunder.cpp:
(WebCore::CDMInstanceSessionThunder::cdmInstanceThunder const): Cast raw pointer instead of
its smart pointer container.
2021-06-01 Antti Koivisto <antti@apple.com>
Rename InlineBox to LegacyInlineBox
https://bugs.webkit.org/show_bug.cgi?id=226501
Reviewed by Alan Bujtas.
More legacy line layout path renaming.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/Position.h:
* layout/Verification.cpp:
(WebCore::Layout::checkForMatchingNonTextRuns):
(WebCore::Layout::collectFlowBoxSubtree):
(WebCore::Layout::collectInlineBoxes):
(WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
* layout/integration/LayoutIntegrationRunIterator.cpp:
(WebCore::LayoutIntegration::firstTextRunInTextOrderFor):
* layout/integration/LayoutIntegrationRunIterator.h:
(WebCore::LayoutIntegration::PathRun::legacyInlineBox const):
* layout/integration/LayoutIntegrationRunIteratorLegacyPath.h:
(WebCore::LayoutIntegration::RunIteratorLegacyPath::RunIteratorLegacyPath):
(WebCore::LayoutIntegration::RunIteratorLegacyPath::legacyInlineBox const):
* layout/integration/LayoutIntegrationRunIteratorModernPath.h:
(WebCore::LayoutIntegration::RunIteratorModernPath::legacyInlineBox const):
* rendering/BidiRun.cpp:
* rendering/BidiRun.h:
(WebCore::BidiRun::box):
(WebCore::BidiRun::setBox):
* rendering/CaretRectComputation.cpp:
(WebCore::computeCaretRectForInline):
* rendering/EllipsisBox.cpp:
(WebCore::EllipsisBox::EllipsisBox):
(WebCore::EllipsisBox::markupBox const):
(WebCore::EllipsisBox::paintMarkupBox):
(WebCore::EllipsisBox::nodeAtPoint):
* rendering/EllipsisBox.h:
* rendering/InlineElementBox.h:
(WebCore::InlineElementBox::InlineElementBox):
(WebCore::InlineElementBox::renderer const):
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::setHasBadChildList):
(WebCore::InlineFlowBox::getFlowSpacingLogicalWidth):
(WebCore::InlineFlowBox::addToLine):
(WebCore::InlineFlowBox::removeChild):
(WebCore::InlineFlowBox::deleteLine):
(WebCore::InlineFlowBox::extractLine):
(WebCore::InlineFlowBox::attachLine):
(WebCore::InlineFlowBox::adjustPosition):
(WebCore::InlineFlowBox::determineSpacingForFlowBoxes):
(WebCore::InlineFlowBox::placeBoxRangeInInlineDirection):
(WebCore::InlineFlowBox::requiresIdeographicBaseline const):
(WebCore::InlineFlowBox::adjustMaxAscentAndDescent):
(WebCore::InlineFlowBox::computeLogicalBoxHeights):
(WebCore::InlineFlowBox::placeBoxesInBlockDirection):
(WebCore::InlineFlowBox::maxLogicalBottomForTextDecorationLine const):
(WebCore::InlineFlowBox::minLogicalTopForTextDecorationLine const):
(WebCore::InlineFlowBox::flipLinesInBlockDirection):
(WebCore::InlineFlowBox::addReplacedChildOverflow):
(WebCore::InlineFlowBox::computeOverflow):
(WebCore::InlineFlowBox::nodeAtPoint):
(WebCore::InlineFlowBox::paint):
(WebCore::InlineFlowBox::firstLeafDescendant const):
(WebCore::InlineFlowBox::lastLeafDescendant const):
(WebCore::InlineFlowBox::canAccommodateEllipsis const):
(WebCore::InlineFlowBox::placeEllipsisBox):
(WebCore::InlineFlowBox::clearTruncation):
(WebCore::InlineFlowBox::computeOverAnnotationAdjustment const):
(WebCore::InlineFlowBox::computeUnderAnnotationAdjustment const):
(WebCore::InlineFlowBox::collectLeafBoxesInLogicalOrder const):
(WebCore::InlineFlowBox::outputLineTreeAndMark const):
(WebCore::InlineFlowBox::checkConsistency const):
* rendering/InlineFlowBox.h:
(WebCore::InlineFlowBox::InlineFlowBox):
(WebCore::InlineFlowBox::renderer const):
(WebCore::InlineFlowBox::firstChild const):
(WebCore::InlineFlowBox::lastChild const):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::markDirty):
* rendering/InlineTextBox.h:
(WebCore::InlineTextBox::InlineTextBox):
(WebCore::InlineTextBox::renderer const):
* rendering/LegacyInlineBox.cpp: Renamed from Source/WebCore/rendering/InlineBox.cpp.
(WebCore::LegacyInlineBox::assertNotDeleted const):
(WebCore::LegacyInlineBox::~LegacyInlineBox):
(WebCore::LegacyInlineBox::setHasBadParent):
(WebCore::LegacyInlineBox::invalidateParentChildList):
(WebCore::LegacyInlineBox::removeFromParent):
(WebCore::LegacyInlineBox::boxName const):
(WebCore::LegacyInlineBox::showNodeTreeForThis const):
(WebCore::LegacyInlineBox::showLineTreeForThis const):
(WebCore::LegacyInlineBox::outputLineTreeAndMark const):
(WebCore::LegacyInlineBox::outputLineBox const):
(WebCore::LegacyInlineBox::logicalHeight const):
(WebCore::LegacyInlineBox::baselinePosition const):
(WebCore::LegacyInlineBox::lineHeight const):
(WebCore::LegacyInlineBox::caretMinOffset const):
(WebCore::LegacyInlineBox::caretMaxOffset const):
(WebCore::LegacyInlineBox::dirtyLineBoxes):
(WebCore::LegacyInlineBox::adjustPosition):
(WebCore::LegacyInlineBox::root const):
(WebCore::LegacyInlineBox::root):
(WebCore::LegacyInlineBox::nextOnLineExists const):
(WebCore::LegacyInlineBox::previousOnLineExists const):
(WebCore::LegacyInlineBox::nextLeafOnLine const):
(WebCore::LegacyInlineBox::previousLeafOnLine const):
(WebCore::LegacyInlineBox::selectionState):
(WebCore::LegacyInlineBox::canAccommodateEllipsis const):
(WebCore::LegacyInlineBox::placeEllipsisBox):
(WebCore::LegacyInlineBox::clearKnownToHaveNoOverflow):
(WebCore::LegacyInlineBox::locationIncludingFlipping const):
(WebCore::LegacyInlineBox::flipForWritingMode const):
(showNodeTree):
(showLineTree):
* rendering/LegacyInlineBox.h: Renamed from Source/WebCore/rendering/InlineBox.h.
(WebCore::LegacyInlineBox::nextOnLine const):
(WebCore::LegacyInlineBox::previousOnLine const):
(WebCore::LegacyInlineBox::setNextOnLine):
(WebCore::LegacyInlineBox::setPreviousOnLine):
(WebCore::LegacyInlineBox::LegacyInlineBox):
(WebCore::LegacyInlineBox::~LegacyInlineBox):
(WebCore::LegacyInlineBox::assertNotDeleted const):
* rendering/LegacyLineLayout.cpp:
(WebCore::LegacyLineLayout::createInlineBoxForRenderer):
(WebCore::LegacyLineLayout::createLineBoxes):
(WebCore::LegacyLineLayout::constructLine):
(WebCore::inlineAncestorHasStartBorderPaddingOrMargin):
(WebCore::inlineAncestorHasEndBorderPaddingOrMargin):
(WebCore::LegacyLineLayout::computeInlineDirectionPositionsForSegment):
(WebCore::LegacyLineLayout::layoutRunsAndFloats):
* rendering/LegacyLineLayout.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::outputLineTreeAndMark const):
* rendering/RenderBlockFlow.h:
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::offsetLeft const):
(WebCore::RenderInline::offsetTop const):
(WebCore::RenderInline::culledInlineFirstLineBox const):
(WebCore::RenderInline::culledInlineLastLineBox const):
* rendering/RenderInline.h:
(WebCore::RenderInline::firstLineBoxIncludingCulling const):
(WebCore::RenderInline::lastLineBoxIncludingCulling const):
* rendering/RenderLineBoxList.cpp:
(WebCore::RenderLineBoxList::dirtyLinesFromChangedChild):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::localSelectionRect):
* rendering/RenderObject.h:
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::isHyphenated const):
(WebCore::RootInlineBox::placeEllipsis):
(WebCore::RootInlineBox::childRemoved):
(WebCore::RootInlineBox::lineSelectionGap):
(WebCore::RootInlineBox::selectionState):
(WebCore::RootInlineBox::firstSelectedBox):
(WebCore::RootInlineBox::lastSelectedBox):
(WebCore::RootInlineBox::ascentAndDescentForBox const):
(WebCore::RootInlineBox::verticalPositionForBox):
(WebCore::RootInlineBox::includeLeadingForBox const):
(WebCore::RootInlineBox::includeFontForBox const):
(WebCore::RootInlineBox::includeGlyphsForBox const):
(WebCore::RootInlineBox::includeInitialLetterForBox const):
(WebCore::RootInlineBox::includeMarginForBox const):
(WebCore::RootInlineBox::outputLineBox const):
* rendering/RootInlineBox.h:
* rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::positionForPoint):
* rendering/svg/SVGInlineFlowBox.cpp:
(WebCore::SVGInlineFlowBox::paintSelectionBackground):
(WebCore::SVGInlineFlowBox::paint):
* rendering/svg/SVGRootInlineBox.cpp:
(WebCore::SVGRootInlineBox::paint):
(WebCore::SVGRootInlineBox::layoutCharactersInTextBoxes):
(WebCore::SVGRootInlineBox::layoutChildBoxes):
(WebCore::SVGRootInlineBox::layoutRootBox):
(WebCore::SVGRootInlineBox::closestLeafChildForPosition):
(WebCore::SVGRootInlineBox::nodeAtPoint):
(WebCore::reverseInlineBoxRangeAndValueListsIfNeeded):
(WebCore::SVGRootInlineBox::reorderValueLists):
* rendering/svg/SVGRootInlineBox.h:
* rendering/svg/SVGTextQuery.cpp:
(WebCore::SVGTextQuery::collectTextBoxesInFlowBox):
2021-06-01 Dean Jackson <dino@apple.com>
[WebXR] Attach IOSurface to WebXROpaqueFramebuffer
https://bugs.webkit.org/show_bug.cgi?id=225896
<rdar://problem/78128289>
Add a null check to fix a test crash.
* Modules/webxr/WebXROpaqueFramebuffer.cpp:
(WebCore::WebXROpaqueFramebuffer::startFrame):
2021-06-01 Sam Weinig <weinig@apple.com>
Factor out token-type dependent CSS property parsing functions to allow more code sharing
https://bugs.webkit.org/show_bug.cgi?id=226473
Reviewed by Darin Adler.
As a step toward reducing duplicate code and making CSSPropertyParserHelpers a bit
easier to follow, this change extracts the token type specific parts of the primitive
consume functions (e.g. the part of consumeNumberRaw where the token is known to be
a FunctionToken) into their own functions. This allows sharing between functions that
both need that logic (e.g. consumeNumberRaw and consumeNumberRawOrPercentRaw can share)
without extra branches, rechecking the token type, or duplication. It also has the
benefit of creating a strict pattern for primitive consumers going forward.
The new names are rather long to make it very clear what they do, but they are unlikely
to stay for very long. Future changes will try to generalize through templates to allow
programatic combinations of the consumers without always haveing to write the boilerplate.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::shouldAcceptUnitlessValue):
(WebCore::CSSPropertyParserHelpers::consumeIntegerTypeRawWithKnownTokenTypeFunction):
(WebCore::CSSPropertyParserHelpers::consumeIntegerTypeRawWithKnownTokenTypeNumber):
(WebCore::CSSPropertyParserHelpers::consumeIntegerTypeCSSPrimitiveValueWithCalcWithKnownTokenTypeFunction):
(WebCore::CSSPropertyParserHelpers::consumeIntegerTypeCSSPrimitiveValueWithCalcWithKnownTokenTypeNumber):
(WebCore::CSSPropertyParserHelpers::validatedNumberRaw):
(WebCore::CSSPropertyParserHelpers::consumeNumberRawWithKnownTokenTypeFunction):
(WebCore::CSSPropertyParserHelpers::consumeNumberRawWithKnownTokenTypeNumber):
(WebCore::CSSPropertyParserHelpers::consumeNumberRawWithKnownTokenTypeIdent):
(WebCore::CSSPropertyParserHelpers::consumeNumberCSSPrimitiveValueWithCalcWithKnownTokenTypeFunction):
(WebCore::CSSPropertyParserHelpers::consumeNumberCSSPrimitiveValueWithCalcWithKnownTokenTypeNumber):
(WebCore::CSSPropertyParserHelpers::validatedPercentRaw):
(WebCore::CSSPropertyParserHelpers::consumePercentRawWithKnownTokenTypeFunction):
(WebCore::CSSPropertyParserHelpers::consumePercentRawWithKnownTokenTypePercentage):
(WebCore::CSSPropertyParserHelpers::consumePercentRawWithKnownTokenTypeIdent):
(WebCore::CSSPropertyParserHelpers::consumePercentCSSPrimitiveValueWithCalcWithKnownTokenTypeFunction):
(WebCore::CSSPropertyParserHelpers::consumePercentCSSPrimitiveValueWithCalcWithKnownTokenTypePercentage):
(WebCore::CSSPropertyParserHelpers::validatedLengthRaw):
(WebCore::CSSPropertyParserHelpers::consumeLengthRawWithKnownTokenTypeFunction):
(WebCore::CSSPropertyParserHelpers::consumeLengthRawWithKnownTokenTypeDimension):
(WebCore::CSSPropertyParserHelpers::consumeLengthRawWithKnownTokenTypeNumber):
(WebCore::CSSPropertyParserHelpers::consumeLengthCSSPrimitiveValueWithCalcWithKnownTokenTypeFunction):
(WebCore::CSSPropertyParserHelpers::consumeLengthCSSPrimitiveValueWithCalcWithKnownTokenTypeDimension):
(WebCore::CSSPropertyParserHelpers::consumeLengthCSSPrimitiveValueWithCalcWithKnownTokenTypeNumber):
(WebCore::CSSPropertyParserHelpers::consumeAngleRawWithKnownTokenTypeFunction):
(WebCore::CSSPropertyParserHelpers::consumeAngleRawWithKnownTokenTypeDimension):
(WebCore::CSSPropertyParserHelpers::consumeAngleRawWithKnownTokenTypeNumber):
(WebCore::CSSPropertyParserHelpers::consumeAngleCSSPrimitiveValueWithCalcWithKnownTokenTypeFunction):
(WebCore::CSSPropertyParserHelpers::consumeAngleCSSPrimitiveValueWithCalcWithKnownTokenTypeDimension):
(WebCore::CSSPropertyParserHelpers::consumeAngleCSSPrimitiveValueWithCalcWithKnownTokenTypeNumber):
(WebCore::CSSPropertyParserHelpers::consumeTimeCSSPrimitiveValueWithCalcWithKnownTokenTypeFunction):
(WebCore::CSSPropertyParserHelpers::consumeTimeCSSPrimitiveValueWithCalcWithKnownTokenTypeDimension):
(WebCore::CSSPropertyParserHelpers::consumeTimeCSSPrimitiveValueWithCalcWithKnownTokenTypeNumber):
(WebCore::CSSPropertyParserHelpers::consumeResolutionCSSPrimitiveValueWithKnownTokenTypeDimension):
(WebCore::CSSPropertyParserHelpers::consumeIntegerTypeRaw):
(WebCore::CSSPropertyParserHelpers::consumeIntegerType):
(WebCore::CSSPropertyParserHelpers::consumeIntegerRaw):
(WebCore::CSSPropertyParserHelpers::consumeInteger):
(WebCore::CSSPropertyParserHelpers::consumePositiveIntegerRaw):
(WebCore::CSSPropertyParserHelpers::consumePositiveInteger):
(WebCore::CSSPropertyParserHelpers::consumeNumberRaw):
(WebCore::CSSPropertyParserHelpers::consumeNumber):
(WebCore::CSSPropertyParserHelpers::consumeLengthRaw):
(WebCore::CSSPropertyParserHelpers::consumeLength):
(WebCore::CSSPropertyParserHelpers::consumePercentRaw):
(WebCore::CSSPropertyParserHelpers::consumePercent):
(WebCore::CSSPropertyParserHelpers::consumePercentWorkerSafe):
(WebCore::CSSPropertyParserHelpers::canConsumeCalcValue):
(WebCore::CSSPropertyParserHelpers::consumeAngleRaw):
(WebCore::CSSPropertyParserHelpers::consumeAngle):
(WebCore::CSSPropertyParserHelpers::consumeAngleWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumeTime):
(WebCore::CSSPropertyParserHelpers::consumeResolution):
(WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
(WebCore::CSSPropertyParserHelpers::consumeLengthOrPercentRaw):
(WebCore::CSSPropertyParserHelpers::consumeLengthOrPercent):
(WebCore::CSSPropertyParserHelpers::consumeNumberAllowingSymbolTableIdent):
(WebCore::CSSPropertyParserHelpers::consumePercentAllowingSymbolTableIdent):
(WebCore::CSSPropertyParserHelpers::consumeAngleRawOrNumberRaw):
(WebCore::CSSPropertyParserHelpers::consumeAngleRawOrNumberRawAllowingSymbolTableIdent):
(WebCore::CSSPropertyParserHelpers::consumeNumberRawOrPercentRaw):
(WebCore::CSSPropertyParserHelpers::consumeNumberRawOrPercentDividedBy100Raw):
(WebCore::CSSPropertyParserHelpers::consumeNumberRawOrPercentRawAllowingSymbolTableIdent):
(WebCore::CSSPropertyParserHelpers::consumeNumberRawOrPercentDividedBy100RawAllowingSymbolTableIdent):
(WebCore::CSSPropertyParserHelpers::divisibleBy100):
(WebCore::CSSPropertyParserHelpers::consumeFontWeightNumberRaw):
(WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
(WebCore::CSSPropertyParserHelpers::consumeFontWeightNumberWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumeIdentRaw):
(WebCore::CSSPropertyParserHelpers::consumeIdent):
(WebCore::CSSPropertyParserHelpers::consumeIdentWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumeUrlAsStringView):
(WebCore::CSSPropertyParserHelpers::consumeOptionalAlpha):
(WebCore::CSSPropertyParserHelpers::consumeOptionalAlphaAllowingSymbolTableIdent):
(WebCore::CSSPropertyParserHelpers::normalizeRGBComponentNumber):
(WebCore::CSSPropertyParserHelpers::normalizeRGBComponentPercentage):
(WebCore::CSSPropertyParserHelpers::consumeRelativeRGBComponent):
(WebCore::CSSPropertyParserHelpers::clampRGBComponent):
(WebCore::CSSPropertyParserHelpers::consumeRGBOrHSLOptionalAlpha):
(WebCore::CSSPropertyParserHelpers::parseRelativeRGBParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeHSLParameters):
(WebCore::CSSPropertyParserHelpers::parseHSLParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeHWBParameters):
(WebCore::CSSPropertyParserHelpers::parseHWBParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeLabParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeLCHParameters):
(WebCore::CSSPropertyParserHelpers::parseLCHParameters):
(WebCore::CSSPropertyParserHelpers::parseColorFunctionForRGBTypes):
(WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop):
(WebCore::CSSPropertyParserHelpers::consumeCrossFade):
(WebCore::CSSPropertyParserHelpers::consumeNumberOrPercentDividedBy100Raw): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeOptionalAlphaOrIdent): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeHue): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeHueOrIdent): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeNumberOrIdent): Deleted.
(WebCore::CSSPropertyParserHelpers::consumePercentOrIdent): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeNumberOrPercentOrIdentNormalizedForRelativeRGB): Deleted.
2021-06-01 Chris Dumez <cdumez@apple.com>
Fix thread safety issues in MediaStreamAudioSourceNode
https://bugs.webkit.org/show_bug.cgi?id=226476
Reviewed by Youenn Fablet.
Adopt thread safety analysis annotations in MediaStreamAudioSourceNode and fix
bugs found by clang. In particular, the following issues were fixed:
- setFormat() could modify m_sourceNumberOfChannels before locking on the main
thread.
- process() was accessing m_sourceNumberOfChannels / m_sourceSampleRate
on the rendering thread *before* locking.
* Modules/webaudio/MediaStreamAudioSourceNode.cpp:
(WebCore::MediaStreamAudioSourceNode::setFormat):
(WebCore::MediaStreamAudioSourceNode::process):
* Modules/webaudio/MediaStreamAudioSourceNode.h:
2021-06-01 Chris Dumez <cdumez@apple.com>
Fix thread safety issues in WaveShaperProcessor
https://bugs.webkit.org/show_bug.cgi?id=226478
Reviewed by Youenn Fablet.
Adopt thread safety analysis annotations in WaveShaperProcessor and fix bugs
found by clang. In particular, the following issues were fixed:
- WaveShaperDSPKernel::latencyTime() was failing to grab the lock before accessing
the WaveShaperProcessor's oversample on the rendering thread, even though
oversample gets modified on the main thread.
- WaveShaperNode::propagatesSilence() was failing to grab the lock before accessing
the WaveShaperProcessor's curve on the rendering thread, even though the curve
gets modified on the main thread.
* Modules/webaudio/AudioBasicProcessorNode.h:
(WebCore::AudioBasicProcessorNode::processor const):
* Modules/webaudio/WaveShaperDSPKernel.cpp:
(WebCore::WaveShaperDSPKernel::process):
(WebCore::WaveShaperDSPKernel::processCurve):
(WebCore::WaveShaperDSPKernel::latencyTime const):
* Modules/webaudio/WaveShaperDSPKernel.h:
* Modules/webaudio/WaveShaperNode.cpp:
(WebCore::WaveShaperNode::create):
(WebCore::WaveShaperNode::setCurveForBindings):
(WebCore::WaveShaperNode::curveForBindings):
(WebCore::WaveShaperNode::setOversampleForBindings):
(WebCore::WaveShaperNode::oversampleForBindings const):
(WebCore::WaveShaperNode::propagatesSilence const):
* Modules/webaudio/WaveShaperNode.h:
* Modules/webaudio/WaveShaperNode.idl:
* Modules/webaudio/WaveShaperProcessor.cpp:
(WebCore::WaveShaperProcessor::setCurveForBindings):
(WebCore::WaveShaperProcessor::setOversampleForBindings):
(WebCore::WaveShaperProcessor::process):
* Modules/webaudio/WaveShaperProcessor.h:
2021-06-01 Chris Dumez <cdumez@apple.com>
Fix thread safety issues in MediaElementAudioSourceNode
https://bugs.webkit.org/show_bug.cgi?id=226475
Reviewed by Youenn Fablet.
Adopt thread safety analysis annotations in MediaElementAudioSourceNode and fix
bugs found by clang. In particular, the following issues were fixed:
- setFormat() was modifying m_muted / m_sourceNumberOfChannels / m_sourceSampleRate
on the main thread without locking, even though those data members are accessed
from the rendering thread.
- process() was accessing m_muted / m_sourceNumberOfChannels / m_sourceSampleRate
on the rendering thread *before* locking.
* Modules/webaudio/MediaElementAudioSourceNode.cpp:
(WebCore::MediaElementAudioSourceNode::setFormat):
(WebCore::MediaElementAudioSourceNode::process):
* Modules/webaudio/MediaElementAudioSourceNode.h:
2021-06-01 Antti Koivisto <antti@apple.com>
Rename ComplexLineLayout to LegacyLineLayout
https://bugs.webkit.org/show_bug.cgi?id=226482
Reviewed by Alan Bujtas.
Since we now handle most inline content with LFC, rename the legacy path as "legacy".
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::lineOverflowWidth):
* rendering/InlineIterator.h:
(WebCore::IsolateTracker::addFakeRunIfNecessary):
(WebCore::InlineBidiResolver::appendRunInternal):
* rendering/LegacyLineLayout.cpp: Renamed from Source/WebCore/rendering/ComplexLineLayout.cpp.
(WebCore::LegacyLineLayout::LegacyLineLayout):
(WebCore::LegacyLineLayout::~LegacyLineLayout):
(WebCore::determineDirectionality):
(WebCore::createRun):
(WebCore::LegacyLineLayout::appendRunsForObject):
(WebCore::LegacyLineLayout::createRootInlineBox):
(WebCore::LegacyLineLayout::createAndAppendRootInlineBox):
(WebCore::LegacyLineLayout::createInlineBoxForRenderer):
(WebCore::dirtyLineBoxesForRenderer):
(WebCore::parentIsConstructedOrHaveNext):
(WebCore::LegacyLineLayout::createLineBoxes):
(WebCore::endsWithHTMLSpaces):
(WebCore::reachedEndOfTextRenderer):
(WebCore::LegacyLineLayout::constructLine):
(WebCore::LegacyLineLayout::textAlignmentForLine const):
(WebCore::updateLogicalWidthForLeftAlignedBlock):
(WebCore::updateLogicalWidthForRightAlignedBlock):
(WebCore::updateLogicalWidthForCenterAlignedBlock):
(WebCore::LegacyLineLayout::setMarginsForRubyRun):
(WebCore::setLogicalWidthForTextRun):
(WebCore::LegacyLineLayout::updateRubyForJustifiedText):
(WebCore::LegacyLineLayout::computeExpansionForJustifiedText):
(WebCore::LegacyLineLayout::updateLogicalWidthForAlignment):
(WebCore::updateLogicalInlinePositions):
(WebCore::LegacyLineLayout::computeInlineDirectionPositionsForLine):
(WebCore::expansionBehaviorForInlineTextBox):
(WebCore::applyExpansionBehavior):
(WebCore::inlineAncestorHasStartBorderPaddingOrMargin):
(WebCore::inlineAncestorHasEndBorderPaddingOrMargin):
(WebCore::isLastInFlowRun):
(WebCore::LegacyLineLayout::computeInlineDirectionPositionsForSegment):
(WebCore::LegacyLineLayout::removeInlineBox const):
(WebCore::LegacyLineLayout::computeBlockDirectionPositionsForLine):
(WebCore::isCollapsibleSpace):
(WebCore::findFirstTrailingSpace):
(WebCore::LegacyLineLayout::handleTrailingSpaces):
(WebCore::LegacyLineLayout::appendFloatingObjectToLastLine):
(WebCore::notifyResolverToResumeInIsolate):
(WebCore::setUpResolverToResumeInIsolate):
(WebCore::constructBidiRunsForSegment):
(WebCore::LegacyLineLayout::createLineBoxesFromBidiRuns):
(WebCore::deleteLineRange):
(WebCore::repaintDirtyFloats):
(WebCore::LegacyLineLayout::layoutRunsAndFloats):
(WebCore::LegacyLineLayout::restartLayoutRunsAndFloatsInRange):
(WebCore::LegacyLineLayout::layoutRunsAndFloatsInRange):
(WebCore::LegacyLineLayout::reattachCleanLineFloats):
(WebCore::LegacyLineLayout::linkToEndLineIfNeeded):
(WebCore::LegacyLineLayout::layoutLineBoxes):
(WebCore::LegacyLineLayout::checkFloatInCleanLine):
(WebCore::LegacyLineLayout::determineStartPosition):
(WebCore::LegacyLineLayout::determineEndPosition):
(WebCore::LegacyLineLayout::checkPaginationAndFloatsAtEndLine):
(WebCore::LegacyLineLayout::lineWidthForPaginatedLineChanged const):
(WebCore::LegacyLineLayout::matchedEndLine):
(WebCore::LegacyLineLayout::addOverflowFromInlineChildren):
(WebCore::LegacyLineLayout::lineCount const):
(WebCore::LegacyLineLayout::lineCountUntil const):
(WebCore::LegacyLineLayout::deleteEllipsisLineBoxes):
(WebCore::LegacyLineLayout::checkLinesForTextOverflow):
(WebCore::LegacyLineLayout::positionNewFloatOnLine):
(WebCore::LegacyLineLayout::updateFragmentForLine const):
(WebCore::LegacyLineLayout::style const):
(WebCore::LegacyLineLayout::layoutContext const):
* rendering/LegacyLineLayout.h: Renamed from Source/WebCore/rendering/ComplexLineLayout.h.
(WebCore::LegacyLineLayout::lineBoxes):
(WebCore::LegacyLineLayout::lineBoxes const):
(WebCore::LegacyLineLayout::firstRootBox const):
(WebCore::LegacyLineLayout::lastRootBox const):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::willBeDestroyed):
(WebCore::RenderBlockFlow::layoutInlineChildren):
(WebCore::RenderBlockFlow::startAlignedOffsetForLine):
(WebCore::RenderBlockFlow::adjustLinePositionForPagination):
(WebCore::RenderBlockFlow::styleDidChange):
(WebCore::RenderBlockFlow::hitTestInlineChildren):
(WebCore::RenderBlockFlow::addOverflowFromInlineChildren):
(WebCore::RenderBlockFlow::inlineBlockBaseline const):
(WebCore::RenderBlockFlow::lineCount const):
(WebCore::RenderBlockFlow::paintInlineChildren):
(WebCore::RenderBlockFlow::hasLines const):
(WebCore::RenderBlockFlow::ensureLineBoxes):
* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::firstRootBox const):
(WebCore::RenderBlockFlow::lastRootBox const):
(WebCore::RenderBlockFlow::hasLegacyLineLayout const):
(WebCore::RenderBlockFlow::legacyLineLayout const):
(WebCore::RenderBlockFlow::legacyLineLayout):
(WebCore::RenderBlockFlow::hasComplexLineLayout const): Deleted.
(WebCore::RenderBlockFlow::complexLineLayout const): Deleted.
(WebCore::RenderBlockFlow::complexLineLayout): Deleted.
* rendering/RenderText.cpp:
(WebCore::RenderText::usesLegacyLineLayoutPath const):
(WebCore::RenderText::usesComplexLineLayoutPath const): Deleted.
* rendering/RenderText.h:
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::removeLineBoxFromRenderObject):
(WebCore::RootInlineBox::extractLineBoxFromRenderObject):
(WebCore::RootInlineBox::attachLineBoxToRenderObject):
* rendering/line/LineBreaker.cpp:
(WebCore::LineBreaker::skipLeadingWhitespace):
* rendering/line/LineBreaker.h:
(WebCore::LineBreaker::positionNewFloatOnLine):
2021-06-01 Sam Weinig <weinig@apple.com>
Support calc() on components inside relative color syntax colors
https://bugs.webkit.org/show_bug.cgi?id=226272
Reviewed by Darin Adler.
Added new and updated test cases to fast/css/parsing-relative-color-syntax.html.
Updates support for the CSS Color 5 "Relative Color Syntax" to support
both calc() on components and component permutations within the syntax.
This allows for things like:
background: lch(from var(--primary-color) 60% calc(c * 0.8) h);
or
background: lch(from rebeccapurple g b r);
To make this work, the calc() infrastructure now supports passing a CSSCalcSymbolTable
which allows the logic in the parser to lookup unknown identifiers when parsing a value.
The relative color syntax parsers can then build an appropriate CSSCalcSymbolTable filled
with the components of the origin color.
Since these calc() values are not serialized, this can all happen in the parser, but if
we to be able serialize them in the future, CSSCalcPrimitiveValueNode could be updated
to store the symbol name in addition to storing the value and type (or we could we could
add a new node for it).
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/calc/CSSCalcSymbolTable.cpp: Added.
* css/calc/CSSCalcSymbolTable.h: Added.
Add CSSCalcSymbolTable which contains a mapping from CSSValueID to CSSUnitType/double pairs.
* css/calc/CSSCalcExpressionNodeParser.cpp:
(WebCore::CSSCalcExpressionNodeParser::parseValue):
When trying to construct a value node, if the token is a identifier, use the new
symbol table to look up a type/value to use instead. Use a switch to make things
a bit more clear that differentiation is being done based on token type.
* css/calc/CSSCalcExpressionNodeParser.h:
Add reference to a CSSCalcSymbolTable to the parser. The parser should only ever be used
on the stack, so this works well and allows us to avoid copying the table.
* css/calc/CSSCalcValue.cpp:
(WebCore::CSSCalcValue::create):
* css/calc/CSSCalcValue.h:
Pass the CSSCalcSymbolTable to the parser if one is provided. An overload was used
to avoid #including CSSCalcSymbolTable.h in the header just to add a default value.
* css/makevalues.pl:
Give a concrete base of uint16_t to allow it to be forward declared and add DefaultHash
and HashTraits to allow it to be used with HashTable. These match the definition of
CSSPropertyID.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::CalcParser::CalcParser):
(WebCore::CSSPropertyParserHelpers::consumeNumberRaw):
(WebCore::CSSPropertyParserHelpers::consumePercentWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumeAngleRaw):
(WebCore::CSSPropertyParserHelpers::consumeAngleWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
(WebCore::CSSPropertyParserHelpers::consumeOptionalAlphaOrIdent):
(WebCore::CSSPropertyParserHelpers::consumeHueOrIdent):
(WebCore::CSSPropertyParserHelpers::consumeNumberOrIdent):
(WebCore::CSSPropertyParserHelpers::consumePercentOrIdent):
(WebCore::CSSPropertyParserHelpers::consumeNumberOrPercentOrIdentNormalizedForRelativeRGB):
(WebCore::CSSPropertyParserHelpers::parseRelativeRGBParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeHSLParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeHWBParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeLabParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeLCHParameters):
(WebCore::CSSPropertyParserHelpers::extractChannelValue): Deleted.
(WebCore::CSSPropertyParserHelpers::resolveRelativeColorChannel): Deleted.
Rework relative color syntax parsing to allow permutation of channel symbols
and use of the calc() symbol table support to allow passing in the channels.
This makes the relatative color syntax variants much closer to the normal
variants (with the exception of passing the symbol table) and a subsequent
change will attempt to merge them further.
2021-06-01 Alan Bujtas <zalan@apple.com>
[LFC][TFC][Quirks] heightValueOfNearestContainingBlockWithFixedHeight should not need to cross formatting context boundary
https://bugs.webkit.org/show_bug.cgi?id=226470
Reviewed by Antti Koivisto.
Now that the incoming vertical constraint is applied properly for the cell layout, we don't need to cross
the formatting context boundary in heightValueOfNearestContainingBlockWithFixedHeight to check if the table
box has fixed height value.
* layout/formattingContexts/table/TableFormattingQuirks.cpp:
(WebCore::Layout::TableFormattingQuirks::heightValueOfNearestContainingBlockWithFixedHeight const):
2021-05-27 Sergio Villar Senin <svillar@igalia.com>
Improve if condition in RenderReplaced::computeReplacedLogicalWidth
https://bugs.webkit.org/show_bug.cgi?id=226325
Reviewed by Darin Adler.
Removed the check for intrinsicRatio as we're already inside a block in which intrinsicRatio
is true. Also switched the position of the two conditions in the OR clause as it allows us
to remove the check for computedHeightIsAuto. Last but not least, used a ternary operator
to initialize the value of boxSizing instead of the if clause.
No new tests as there is no change in functionality.
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeReplacedLogicalWidth const):
2021-05-31 Dean Jackson <dino@apple.com>
[WebXR] Attach IOSurface to WebXROpaqueFramebuffer
https://bugs.webkit.org/show_bug.cgi?id=225896
<rdar://problem/78128289>
Reviewed by Sam Weinig.
Implement binding of incoming IOSurfaces (via FrameData)
into the WebGL framebuffer that the page will use as
a rendering target.
Currently only single-sample (non-antialiased) buffers
are supported and the canvas context must be WebGL 2.
* Modules/webxr/WebXROpaqueFramebuffer.cpp:
(WebCore::WebXROpaqueFramebuffer::startFrame): Create a texture if necessary, then
bind its backing store to the incoming IOSurface, then hook it up to the framebuffer.
(WebCore::WebXROpaqueFramebuffer::endFrame): Release the Pbuffer we used in startFrame.
(WebCore::WebXROpaqueFramebuffer::setupFramebuffer): Add Cocoa+ANGLE specific implementation.
* Modules/webxr/WebXROpaqueFramebuffer.h: Keep a member variable for the Pbuffer.
2021-05-31 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Decouple stretching and final cell layouts
https://bugs.webkit.org/show_bug.cgi?id=226452
Reviewed by Antti Koivisto.
Stretching layout is slightly different from the final cell layout.
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::setUsedGeometryForCells):
(WebCore::Layout::TableFormattingContext::computeAndDistributeExtraSpace):
(WebCore::Layout::TableFormattingContext::layoutCell): Deleted.
* layout/formattingContexts/table/TableFormattingContext.h:
* layout/formattingContexts/table/TableFormattingGeometry.cpp:
(WebCore::Layout::TableFormattingGeometry::horizontalSpaceForCellContent const):
(WebCore::Layout::TableFormattingGeometry::verticalSpaceForCellContent const):
* layout/formattingContexts/table/TableFormattingGeometry.h:
2021-05-31 Alan Bujtas <zalan@apple.com>
[LFC] Tighten the constraint classes (ConstraintsForInFlowContent/ConstraintsForOutOfFlowContent)
https://bugs.webkit.org/show_bug.cgi?id=226435
Reviewed by Antti Koivisto.
While logical height should always be available for out of flow content by design,
the base inflow layout can't necessarily provide it. This height constraint is not even required/used in most of the layout systems,
so let's move it to the derived class(es).
* layout/LayoutContext.cpp:
(WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
* layout/LayoutUnits.h:
* layout/formattingContexts/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry):
* layout/formattingContexts/FormattingGeometry.cpp:
(WebCore::Layout::FormattingGeometry::outOfFlowNonReplacedVerticalGeometry const):
(WebCore::Layout::FormattingGeometry::outOfFlowReplacedVerticalGeometry const):
(WebCore::Layout::FormattingGeometry::inlineReplacedContentHeightAndMargin const):
(WebCore::Layout::FormattingGeometry::inlineReplacedContentWidthAndMargin const):
(WebCore::Layout::FormattingGeometry::constraintsForInFlowContent const):
* layout/formattingContexts/block/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
(WebCore::Layout::BlockFormattingContext::computeStaticVerticalPosition):
(WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForBoxAndAncestors):
(WebCore::Layout::BlockFormattingContext::verticalPositionWithMargin const):
* layout/formattingContexts/block/BlockFormattingContext.h:
* layout/formattingContexts/block/BlockFormattingGeometry.cpp:
(WebCore::Layout::BlockFormattingGeometry::staticVerticalPosition const):
(WebCore::Layout::BlockFormattingGeometry::staticPosition const): Deleted.
* layout/formattingContexts/block/BlockFormattingGeometry.h:
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp:
(WebCore::Layout::TableWrapperBlockFormattingContext::layoutTableBox):
(WebCore::Layout::TableWrapperBlockFormattingContext::computeHeightAndMarginForTableBox):
* layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::sizeAndPlaceFlexItems):
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::lineLayout):
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::layoutInFlowContent):
(WebCore::Layout::TableFormattingContext::setUsedGeometryForCells):
(WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
(WebCore::Layout::TableFormattingContext::layoutCell):
* layout/formattingContexts/table/TableFormattingContext.h:
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::layout):
2021-05-31 Aakash Jain <aakash_jain@apple.com>
REGRESSION(r278261): Broke windows build - follow-up fix
https://bugs.webkit.org/show_bug.cgi?id=226477
Unreviewed build fix.
* css/calc/CSSCalcValue.cpp:
2021-05-31 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r278261.
https://bugs.webkit.org/show_bug.cgi?id=226477
Broke windows build
Reverted changeset:
"Support calc() on components inside relative color syntax
colors"
https://bugs.webkit.org/show_bug.cgi?id=226272
https://trac.webkit.org/changeset/278261
2021-05-31 Chris Dumez <cdumez@apple.com>
Fix thread safety issues in ConvolverNode
https://bugs.webkit.org/show_bug.cgi?id=226449
Reviewed by Darin Adler.
Adopt thread safety annotations in ConvolverNode and fix bugs found by clang.
In particular, the following issues were found and fixed:
- tailTime() / latencyTime() were accessing m_reverb on the audio thread without
locking even though m_reverb gets modified on the main thread.
- checkNumberOfChannelsForInput() was accessing m_buffer on the audio thread
without locking even though m_buffer gets modified on the main thread.
* Modules/webaudio/ConvolverNode.cpp:
(WebCore::ConvolverNode::create):
(WebCore::ConvolverNode::setBufferForBindings):
(WebCore::ConvolverNode::setNormalizeForBindings):
(WebCore::ConvolverNode::tailTime const):
(WebCore::ConvolverNode::latencyTime const):
(WebCore::ConvolverNode::checkNumberOfChannelsForInput):
* Modules/webaudio/ConvolverNode.h:
* Modules/webaudio/ConvolverNode.idl:
2021-05-31 Chris Dumez <cdumez@apple.com>
Drop PendingActivity data member from BaseAudioContext
https://bugs.webkit.org/show_bug.cgi?id=226445
Reviewed by Darin Adler.
Drop PendingActivity data member from BaseAudioContext and instead have AudioContext / OfflineAudioContext
override virtualHasPendingActivity() to keep their JS wrapper alive. I find that PendingActivity data members
are too error prone and a frequent cause of leaks.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::AudioContext):
(WebCore::AudioContext::startRendering):
(WebCore::AudioContext::mayResumePlayback):
(WebCore::AudioContext::suspendPlayback):
(WebCore::AudioContext::virtualHasPendingActivity const):
* Modules/webaudio/AudioContext.h:
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::clear):
(WebCore::BaseAudioContext::clearPendingActivity): Deleted.
(WebCore::BaseAudioContext::setPendingActivity): Deleted.
* Modules/webaudio/BaseAudioContext.h:
* Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::startRendering):
(WebCore::OfflineAudioContext::resumeRendering):
(WebCore::OfflineAudioContext::didSuspendRendering):
(WebCore::OfflineAudioContext::finishedRendering):
(WebCore::OfflineAudioContext::virtualHasPendingActivity const):
(WebCore::OfflineAudioContext::dispatchEvent): Deleted.
* Modules/webaudio/OfflineAudioContext.h:
2021-05-31 Chris Dumez <cdumez@apple.com>
Fix thread safety issues in AudioBufferSourceNode
https://bugs.webkit.org/show_bug.cgi?id=226448
Reviewed by Darin Adler.
Adopt thread safety analysis annotations in AudioBufferSourceNode and fix the bugs
that were found by clang:
- We were failing to grab the processLock when setting the loop / loopStart / loopEnd attributes
on the main thread (Those are set by JS at any time).
- propagatesSilence() was failing to grab the lock when checking m_buffer on the audio thread.
* Modules/webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::process):
(WebCore::AudioBufferSourceNode::renderSilenceAndFinishIfNotLooping):
(WebCore::AudioBufferSourceNode::renderFromBuffer):
(WebCore::AudioBufferSourceNode::setBuffer):
(WebCore::AudioBufferSourceNode::setLoop):
(WebCore::AudioBufferSourceNode::setLoopStart):
(WebCore::AudioBufferSourceNode::setLoopEnd):
(WebCore::AudioBufferSourceNode::adjustGrainParameters):
(WebCore::AudioBufferSourceNode::totalPitchRate):
(WebCore::AudioBufferSourceNode::propagatesSilence const):
* Modules/webaudio/AudioBufferSourceNode.h:
2021-05-31 Chris Dumez <cdumez@apple.com>
Stop using WTF_IGNORES_THREAD_SAFETY_ANALYSIS in MediaRecorderPrivateWriter code
https://bugs.webkit.org/show_bug.cgi?id=226446
Reviewed by Darin Adler.
Fold MediaRecorderPrivateWriter::clear() into the destructor since this is the
only place it is called. This allows us to stop using WTF_IGNORES_THREAD_SAFETY_ANALYSIS
since thread safety checks do not apply to destructors.
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
(WebCore::MediaRecorderPrivateWriter::~MediaRecorderPrivateWriter):
(): Deleted.
2021-05-31 Chris Dumez <cdumez@apple.com>
Fix thread safety issues in OscillatorNode
https://bugs.webkit.org/show_bug.cgi?id=226450
Reviewed by Darin Adler.
Adopt thread safety annotations in OscillatorNode and fix bugs found by clang.
In particular, propagatesSilence() was failing to grab the lock before accessing
m_periodicWave, which gets modified on the main thread.
* Modules/webaudio/OscillatorNode.cpp:
(WebCore::OscillatorNode::create):
(WebCore::OscillatorNode::setTypeForBindings):
(WebCore::OscillatorNode::propagatesSilence const):
* Modules/webaudio/OscillatorNode.h:
* Modules/webaudio/OscillatorNode.idl:
2021-05-31 Chris Dumez <cdumez@apple.com>
Fix thread safety issues in PannerNode
https://bugs.webkit.org/show_bug.cgi?id=226455
Reviewed by Darin Adler.
Adopt thread safety annotations in PannerNode and fix bugs found by clang.
In particular, the following issues were fixed:
- tailTime() / latencyTime() were accessing m_panner on the audio thread without locking
even though m_panner gets modified on the main thread.
- process() was accessing panningModel and m_panner before locking, on the audio thread,
even though those get modified on the main thread.
- processOnlyAudioParams() was failing to grab the process lock.
- requiresTailProcessing() may get called on the audio thread and was failing to grab
the processLock before accessing m_panner, which gets modified on the main thread.
* Modules/webaudio/PannerNode.cpp:
(WebCore::PannerNode::create):
(WebCore::PannerNode::PannerNode):
(WebCore::PannerNode::process):
(WebCore::PannerNode::processOnlyAudioParams):
(WebCore::PannerNode::setPanningModelForBindings):
(WebCore::PannerNode::setDistanceModelForBindings):
(WebCore::PannerNode::setRefDistanceForBindings):
(WebCore::PannerNode::setMaxDistanceForBindings):
(WebCore::PannerNode::setRolloffFactorForBindings):
(WebCore::PannerNode::setConeOuterGainForBindings):
(WebCore::PannerNode::setConeOuterAngleForBindings):
(WebCore::PannerNode::setConeInnerAngleForBindings):
(WebCore::PannerNode::requiresTailProcessing const):
(WebCore::PannerNode::tailTime const):
(WebCore::PannerNode::latencyTime const):
* Modules/webaudio/PannerNode.h:
* Modules/webaudio/PannerNode.idl:
* platform/audio/Distance.h:
2021-05-31 Adrian Perez de Castro <aperez@igalia.com>
Non-unified build fixes, very early June 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=226471
Unreviewed non-unified build fixes.
No new tests needed.
* css/calc/CSSCalcOperationNode.cpp: Add missing CSSCalcValua.h, CSSPrimitiveValue.h,
CSSUnits.h, and wtf/text/TextStream.h headers.
* css/calc/CSSCalcOperationNode.h: Add missing CalcOperator.h header.
* css/calc/CSSCalcValue.cpp: Add missing CSSCalcSymbolTable.h, CalcExpressionInversion.h,
CalcExpressionNumber.h, and CalcExpressionOperation.h headers.
* platform/calc/CalcExpressionInversion.h: Add missing wtf/TypeCasts.h header, remove
unneeded <memory> header.
* platform/calc/CalcExpressionNegation.h: Ditto.
* platform/calc/CalcExpressionNumber.h: Add missing wtf/TypeCasts.h header.
2021-04-29 Sergio Villar Senin <svillar@igalia.com>
Enable <summary> to be a flex container
https://bugs.webkit.org/show_bug.cgi?id=190065
Reviewed by Antti Koivisto.
Create grid or flex renderers for <summary> elements whenever display: {inline}-{grid|flex}
is specified. All vendors but WebKit allowed it so it should be good for interoperability.
* html/HTMLSummaryElement.cpp:
(WebCore::HTMLSummaryElement::createElementRenderer): create the renderer specifying
RenderElement::OnlyCreateBlockAndFlexboxRenderers.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::createFor): do not create a RenderListItem for <summary> if display:list-item
is used because they're already list items. Let it fallthrough to RenderBlockFlow creation.
2021-05-31 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Move ensureTableGrid to TableFormattingState
https://bugs.webkit.org/show_bug.cgi?id=226424
Reviewed by Antti Koivisto.
We can certainly have this much logic in a formatting state class.
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::ensureTableGrid): Deleted.
* layout/formattingContexts/table/TableFormattingContext.h:
* layout/formattingContexts/table/TableFormattingState.cpp:
(WebCore::Layout::ensureTableGrid):
(WebCore::Layout::TableFormattingState::TableFormattingState):
2021-05-31 Antti Koivisto <antti@apple.com>
Rename presentationAttributeStyle to presentationalHintStyle to match spec language
https://bugs.webkit.org/show_bug.cgi?id=226467
Reviewed by Sam Weinig.
The HTML specification calls these "presentational hints", https://html.spec.whatwg.org/#presentational-hints.
* dom/Attr.cpp:
(WebCore::Attr::style):
* dom/Element.cpp:
(WebCore::Element::cloneAttributesFromElement):
* dom/ElementData.cpp:
(WebCore::ShareableElementData::ShareableElementData):
(WebCore::UniqueElementData::UniqueElementData):
* dom/ElementData.h:
(WebCore::ElementData::presentationalHintStyleIsDirty const):
(WebCore::ElementData::setPresentationalHintStyleIsDirty const):
(WebCore::ElementData::presentationalHintStyle const):
(WebCore::ElementData::presentationAttributeStyleIsDirty const): Deleted.
(WebCore::ElementData::setPresentationAttributeStyleIsDirty const): Deleted.
(WebCore::ElementData::presentationAttributeStyle const): Deleted.
* dom/StyledElement.cpp:
(WebCore::StyledElement::attributeChanged):
(WebCore::StyledElement::rebuildPresentationalHintStyle):
(WebCore::StyledElement::addPropertyToPresentationalHintStyle):
(WebCore::StyledElement::rebuildPresentationAttributeStyle): Deleted.
(WebCore::StyledElement::addPropertyToPresentationAttributeStyle): Deleted.
* dom/StyledElement.h:
(WebCore::StyledElement::collectPresentationalHintsForAttribute):
(WebCore::StyledElement::additionalPresentationalHintStyle const):
(WebCore::StyledElement::hasPresentationalHintsForAttribute const):
(WebCore::StyledElement::presentationalHintStyle const):
(WebCore::StyledElement::additionalPresentationAttributeStyle const): Deleted.
(WebCore::StyledElement::collectStyleForPresentationAttribute): Deleted.
(WebCore::StyledElement::isPresentationAttribute const): Deleted.
(WebCore::StyledElement::presentationAttributeStyle const): Deleted.
* html/HTMLBRElement.cpp:
(WebCore::HTMLBRElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLBRElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLBRElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLBRElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLBRElement.h:
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLBodyElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLBodyElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLBodyElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLBodyElement.h:
* html/HTMLButtonElement.cpp:
(WebCore::HTMLButtonElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLButtonElement::isPresentationAttribute const): Deleted.
* html/HTMLButtonElement.h:
* html/HTMLDivElement.cpp:
(WebCore::HTMLDivElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLDivElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLDivElement.h:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::applyBorderAttributeToStyle):
(WebCore::HTMLElement::mapLanguageAttributeToLocale):
(WebCore::HTMLElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLElement::applyAlignmentAttributeToStyle):
(WebCore::HTMLElement::addHTMLLengthToStyle):
(WebCore::HTMLElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLElement.h:
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLEmbedElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLEmbedElement.h:
* html/HTMLFontElement.cpp:
(WebCore::HTMLFontElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLFontElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLFontElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLFontElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLFontElement.h:
* html/HTMLFrameSetElement.cpp:
(WebCore::HTMLFrameSetElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLFrameSetElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLFrameSetElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLFrameSetElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLFrameSetElement.h:
* html/HTMLHRElement.cpp:
(WebCore::HTMLHRElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLHRElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLHRElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLHRElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLHRElement.h:
* html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLIFrameElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLIFrameElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLIFrameElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLIFrameElement.h:
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLImageElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLImageElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLImageElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLImageElement.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLInputElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLInputElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLInputElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLInputElement.h:
* html/HTMLLIElement.cpp:
(WebCore::HTMLLIElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLLIElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLLIElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLLIElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLLIElement.h:
* html/HTMLMarqueeElement.cpp:
(WebCore::HTMLMarqueeElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLMarqueeElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLMarqueeElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLMarqueeElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLMarqueeElement.h:
* html/HTMLOListElement.cpp:
(WebCore::HTMLOListElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLOListElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLOListElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLOListElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLOListElement.h:
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLObjectElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLObjectElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLObjectElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLObjectElement.h:
* html/HTMLParagraphElement.cpp:
(WebCore::HTMLParagraphElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLParagraphElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLParagraphElement.h:
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLPlugInElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLPlugInElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLPlugInElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLPlugInElement.h:
* html/HTMLPreElement.cpp:
(WebCore::HTMLPreElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLPreElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLPreElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLPreElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLPreElement.h:
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLSelectElement::isPresentationAttribute const): Deleted.
* html/HTMLSelectElement.h:
* html/HTMLTableCaptionElement.cpp:
(WebCore::HTMLTableCaptionElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLTableCaptionElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLTableCaptionElement.h:
* html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLTableCellElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLTableCellElement::additionalPresentationalHintStyle const):
(WebCore::HTMLTableCellElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLTableCellElement::collectStyleForPresentationAttribute): Deleted.
(WebCore::HTMLTableCellElement::additionalPresentationAttributeStyle const): Deleted.
* html/HTMLTableCellElement.h:
* html/HTMLTableColElement.cpp:
(WebCore::HTMLTableColElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLTableColElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLTableColElement::additionalPresentationalHintStyle const):
(WebCore::HTMLTableColElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLTableColElement::collectStyleForPresentationAttribute): Deleted.
(WebCore::HTMLTableColElement::additionalPresentationAttributeStyle const): Deleted.
* html/HTMLTableColElement.h:
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLTableElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLTableElement::additionalPresentationalHintStyle const):
(WebCore::HTMLTableElement::collectStyleForPresentationAttribute): Deleted.
(WebCore::HTMLTableElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLTableElement::additionalPresentationAttributeStyle const): Deleted.
* html/HTMLTableElement.h:
* html/HTMLTablePartElement.cpp:
(WebCore::HTMLTablePartElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLTablePartElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLTablePartElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLTablePartElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLTablePartElement.h:
* html/HTMLTableSectionElement.cpp:
(WebCore::HTMLTableSectionElement::additionalPresentationalHintStyle const):
(WebCore::HTMLTableSectionElement::additionalPresentationAttributeStyle const): Deleted.
* html/HTMLTableSectionElement.h:
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLTextAreaElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLTextAreaElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLTextAreaElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLTextAreaElement.h:
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const):
* html/HTMLUListElement.cpp:
(WebCore::HTMLUListElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLUListElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLUListElement::isPresentationAttribute const): Deleted.
(WebCore::HTMLUListElement::collectStyleForPresentationAttribute): Deleted.
* html/HTMLUListElement.h:
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::collectPresentationalHintsForAttribute):
(WebCore::HTMLVideoElement::hasPresentationalHintsForAttribute const):
(WebCore::HTMLVideoElement::collectStyleForPresentationAttribute): Deleted.
(WebCore::HTMLVideoElement::isPresentationAttribute const): Deleted.
* html/HTMLVideoElement.h:
* inspector/agents/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::buildObjectForAttributesStyle):
* mathml/MathMLElement.cpp:
(WebCore::MathMLElement::hasPresentationalHintsForAttribute const):
(WebCore::MathMLElement::collectPresentationalHintsForAttribute):
(WebCore::MathMLElement::isPresentationAttribute const): Deleted.
(WebCore::MathMLElement::collectStyleForPresentationAttribute): Deleted.
* mathml/MathMLElement.h:
* style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::matchAllRules):
* style/MatchedDeclarationsCache.cpp:
(WebCore::Style::MatchedDeclarationsCache::sweep):
* style/StyleSharingResolver.cpp:
(WebCore::Style::SharingResolver::canShareStyleWithElement const):
(WebCore::Style::SharingResolver::sharingCandidateHasIdenticalStyleAffectingAttributes const):
* svg/SVGCircleElement.cpp:
(WebCore::SVGCircleElement::svgAttributeChanged):
* svg/SVGElement.cpp:
(WebCore::SVGElement::hasPresentationalHintsForAttribute const):
(WebCore::SVGElement::collectPresentationalHintsForAttribute):
(WebCore::SVGElement::isPresentationAttribute const): Deleted.
(WebCore::SVGElement::collectStyleForPresentationAttribute): Deleted.
* svg/SVGElement.h:
(WebCore::SVGElement::invalidateSVGPresentationalHintStyle):
(WebCore::SVGElement::invalidateSVGPresentationAttributeStyle): Deleted.
* svg/SVGEllipseElement.cpp:
(WebCore::SVGEllipseElement::svgAttributeChanged):
* svg/SVGFilterElement.cpp:
(WebCore::SVGFilterElement::svgAttributeChanged):
* svg/SVGForeignObjectElement.cpp:
(WebCore::SVGForeignObjectElement::svgAttributeChanged):
* svg/SVGImageElement.cpp:
(WebCore::SVGImageElement::svgAttributeChanged):
* svg/SVGMaskElement.cpp:
(WebCore::SVGMaskElement::svgAttributeChanged):
* svg/SVGPatternElement.cpp:
(WebCore::SVGPatternElement::svgAttributeChanged):
* svg/SVGRectElement.cpp:
(WebCore::SVGRectElement::svgAttributeChanged):
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::svgAttributeChanged):
* svg/SVGTextContentElement.cpp:
(WebCore::SVGTextContentElement::hasPresentationalHintsForAttribute const):
(WebCore::SVGTextContentElement::collectPresentationalHintsForAttribute):
(WebCore::SVGTextContentElement::isPresentationAttribute const): Deleted.
(WebCore::SVGTextContentElement::collectStyleForPresentationAttribute): Deleted.
* svg/SVGTextContentElement.h:
* svg/SVGTextPositioningElement.cpp:
(WebCore::SVGTextPositioningElement::collectPresentationalHintsForAttribute):
(WebCore::SVGTextPositioningElement::hasPresentationalHintsForAttribute const):
(WebCore::SVGTextPositioningElement::collectStyleForPresentationAttribute): Deleted.
(WebCore::SVGTextPositioningElement::isPresentationAttribute const): Deleted.
* svg/SVGTextPositioningElement.h:
* svg/properties/SVGAttributeAnimator.cpp:
(WebCore::SVGAttributeAnimator::invalidateStyle):
2021-05-31 Miguel Gomez <magomez@igalia.com>
[GStreamer] Incorrect rendering of VP9 with transparency
https://bugs.webkit.org/show_bug.cgi?id=225961
Reviewed by Žan Doberšek.
Fix the rendering of videos with transparency. This is done both AC and non AC modes and
with and without GSTREAMER_GL enabled.
On AC mode and using GSTREAMER_GL, a new option is added to TextureMapperGL and TextureMapperShaderProgram
to support premultiplying the components of a pixel. This is required because GStreamer uses straight alpha,
and we need it premultiplied in order to perform the correct blending blending of the video frames. Then we
use that new option to render video frames. This new option is also used when copying the video frame into
an external texture if premultiplyAlpha is requested.
On non AC mode, or when GStreamer-gl is disabled, add support to ImageGStreamerCairo to premultiply the alpha
of the video frame before creating the cairo surface to paint, and pass the appropriate composite operator when
drawing with alpha.
Test: media/video-with-alpha.html
* platform/graphics/gstreamer/GStreamerVideoFrameHolder.cpp:
(WebCore::GstVideoFrameHolder::GstVideoFrameHolder):
* platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
(WebCore::ImageGStreamer::ImageGStreamer):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::pushTextureToCompositor):
(WebCore::MediaPlayerPrivateGStreamer::paint): update the caps of the conversion to make them match the format
expected by cairo, so we can avoid a component swap.
(WebCore::MediaPlayerPrivateGStreamer::copyVideoTextureToPlatformTexture):
* platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
(WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
* platform/graphics/gstreamer/VideoTextureCopierGStreamer.h:
* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGL::drawTexture):
* platform/graphics/texmap/TextureMapperGL.h:
* platform/graphics/texmap/TextureMapperShaderProgram.cpp:
(WebCore::TextureMapperShaderProgram::create):
* platform/graphics/texmap/TextureMapperShaderProgram.h:
2021-05-31 Rob Buis <rbuis@igalia.com>
Treat width: intrinsic as non definite
https://bugs.webkit.org/show_bug.cgi?id=226367
Reviewed by Darin Adler.
Treat width: intrinsic as non definite in
childMainSizeIsDefinite.
Test: fast/css/flex-box-intrinsic-width-crash.html
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::childMainSizeIsDefinite):
2021-05-31 Youenn Fablet <youenn@apple.com>
Go to network in case fetch event is not yet responded when being destroyed instead of failing the load
https://bugs.webkit.org/show_bug.cgi?id=226374
<rdar://78298472>
Reviewed by Alex Christensen.
In case worker is terminated, instead of failing fetch events that are pending a response, we should go to the network.
This mirrors what is already done in ServiceWorkerFetchTask.
This can for instance happen in case a lot of fetches are done in parallel on the same service worker.
The service worker will do the fetch itself but given there are lots of fetches, some fetch might not start until other loads are complete.
This may trigger the fetch timeout which might then trigger terminating the worker.
We should probably revisit our fetch timeout policy now that we have added worker spin detection.
Test: http/wpt/service-workers/fetch-worker-terminate.https.html
* testing/ServiceWorkerInternals.cpp:
(WebCore::ServiceWorkerInternals::terminate):
(WebCore::ServiceWorkerInternals::waitForFetchEventToFinish):
* testing/ServiceWorkerInternals.h:
* testing/ServiceWorkerInternals.idl:
* workers/service/FetchEvent.cpp:
(WebCore::FetchEvent::~FetchEvent):
Update logging to only log the case where respondWith is called but fetch event is destroyed before processing the response.
Otherwise, we would log the case of respondWith being never called, which is happening often and leads to go to the network.
(WebCore::FetchEvent::processResponse):
* workers/service/FetchEvent.h:
* workers/service/context/ServiceWorkerFetch.cpp:
(WebCore::ServiceWorkerFetch::processResponse):
2021-05-30 Wenson Hsieh <wenson_hsieh@apple.com>
REGRESSION (r258118): SVG paths that contain a single move command incorrect client bounding rects
https://bugs.webkit.org/show_bug.cgi?id=226447
rdar://72112744
Reviewed by Alan Bujtas.
r258118 introduced a fast path for computing the bounding rect of a `WebCore::Path` without having to
materialize a platform path object (e.g. `CGPathRef` on platforms that use CoreGraphics). To do this, we
introduce `InlinePathData` -- a variant capable of representing several types of simple `Path` objects without
allocating a platform path.
However, in the case where a `Path` only consists of a single `moveTo` command, this fast path for computing the
bounding rect currently returns the zero rect (an empty rect at the origin), rather than an empty rect at the
location we've moved to. This causes the offset of the bounding rect of an SVG path element that contains only a
single `M` drawing command to be incorrect.
Simply fix this by returning an empty rect that is offset by the `moveTo` location, rather than the origin.
Test: fast/svg/bounding-rect-for-path-with-only-move-command.html
* platform/graphics/Path.cpp:
(WebCore::Path::boundingRectFromInlineData const):
2021-05-30 Youenn Fablet <youenn@apple.com>
Add logging to allow relating a HTMLMediaElement to a MediaStream
https://bugs.webkit.org/show_bug.cgi?id=226373
Reviewed by Eric Carlson.
Update logging to print the ID of the MediaStream being played by the HTMLMediaElement.
* Modules/mediastream/MediaStream.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::loadResource):
2021-05-30 Sam Weinig <weinig@apple.com>
Use SortedArrayMap in parseColorContrastFunctionParameters
https://bugs.webkit.org/show_bug.cgi?id=226444
Reviewed by Darin Adler.
Use SortedArrayMap to remove some boilerplate and allow for a future where
this list gets big and the map can switch to a binary search automatically.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::parseColorContrastFunctionParameters):
2021-05-30 Sam Weinig <weinig@apple.com>
Remove support for no longer specific color(lab ...) syntax
https://bugs.webkit.org/show_bug.cgi?id=226439
Reviewed by Darin Adler.
Remove support for parsing the color(lab ...) syntax.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
(WebCore::CSSPropertyParserHelpers::parseColorFunctionForLabParameters): Deleted.
2021-05-30 Cameron McCormack <heycam@apple.com>
Fix some comment typos
https://bugs.webkit.org/show_bug.cgi?id=226443
Reviewed by Sam Weinig.
Trivial fixes for comment typos I noticed over the past couple of
months.
* page/scrolling/ScrollingStateTree.h:
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawPlatformImage):
(WebCore::GraphicsContext::drawPlatformPattern):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hitTestList):
* rendering/RenderLayer.h:
2021-05-30 Chris Dumez <cdumez@apple.com>
Drop PendingActivity from ScriptProcessorNode
https://bugs.webkit.org/show_bug.cgi?id=226442
Reviewed by Darin Adler.
ScriptProcessorNode already has a virtualHasPendingActivity() implementation that keeps
the JS wrapper alive as long has the audio context is running and there is an "audioprocess"
event listener registered on the node. Therefore, there is no need for an additional
PendingActivity data member.
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::markNodeForDeletionIfNecessary):
* Modules/webaudio/AudioNode.h:
(WebCore::AudioNode::didBecomeMarkedForDeletion): Deleted.
* Modules/webaudio/ScriptProcessorNode.cpp:
(WebCore::ScriptProcessorNode::ScriptProcessorNode):
(WebCore::ScriptProcessorNode::didBecomeMarkedForDeletion): Deleted.
* Modules/webaudio/ScriptProcessorNode.h:
2021-05-30 Chris Dumez <cdumez@apple.com>
Remove some dead code from BaseAudioContext / AudioContext
https://bugs.webkit.org/show_bug.cgi?id=226441
Reviewed by Sam Weinig.
* Modules/webaudio/AudioContext.h:
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::connect):
* Modules/webaudio/AudioScheduledSourceNode.cpp:
(WebCore::AudioScheduledSourceNode::updateSchedulingInfo):
(WebCore::AudioScheduledSourceNode::finish):
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::sourceNodeWillBeginPlayback):
(WebCore::BaseAudioContext::refSourceNode): Deleted.
(WebCore::BaseAudioContext::derefSourceNode): Deleted.
(WebCore::BaseAudioContext::incrementActiveSourceCount): Deleted.
(WebCore::BaseAudioContext::decrementActiveSourceCount): Deleted.
* Modules/webaudio/BaseAudioContext.h:
(WebCore::BaseAudioContext::sampleRate const):
(WebCore::BaseAudioContext::activeSourceCount const): Deleted.
(WebCore::BaseAudioContext::incrementConnectionCount): Deleted.
(WebCore::BaseAudioContext::connectionCount const): Deleted.
2021-05-30 Chris Dumez <cdumez@apple.com>
Unreviewed, tweak slightly incorrect assertion added in r278233.
The assertion was hitting flakily on the bots.
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::addTailProcessingNode):
2021-05-30 Sam Weinig <weinig@apple.com>
Add additional target luminance keywords for color-contrast() added for https://github.com/w3c/csswg-drafts/issues/6311
https://bugs.webkit.org/show_bug.cgi?id=226438
Reviewed by Chris Dumez.
Add newly spec'd target luminance keywords.
* css/CSSValueKeywords.in:
Add AAA and AAA-large keywords.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::parseColorContrastFunctionParameters):
Add target luminance mappings for "AAA" -> 7 and "AAA-large" -> 4.5
2021-05-30 Sam Weinig <weinig@apple.com>
Support calc() on components inside relative color syntax colors
https://bugs.webkit.org/show_bug.cgi?id=226272
Reviewed by Darin Adler.
Added new and updated test cases to fast/css/parsing-relative-color-syntax.html.
Updates support for the CSS Color 5 "Relative Color Syntax" to support
both calc() on components and component permutations within the syntax.
This allows for things like:
background: lch(from var(--primary-color) 60% calc(c * 0.8) h);
or
background: lch(from rebeccapurple g b r);
To make this work, the calc() infrastructure now supports passing a CSSCalcSymbolTable
which allows the logic in the parser to lookup unknown identifiers when parsing a value.
The relative color syntax parsers can then build an appropriate CSSCalcSymbolTable filled
with the components of the origin color.
Since these calc() values are not serialized, this can all happen in the parser, but if
we to be able serialize them in the future, CSSCalcPrimitiveValueNode could be updated
to store the symbol name in addition to storing the value and type (or we could we could
add a new node for it).
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/calc/CSSCalcSymbolTable.cpp: Added.
* css/calc/CSSCalcSymbolTable.h: Added.
Add CSSCalcSymbolTable which contains a mapping from CSSValueID to CSSUnitType/double pairs.
* css/calc/CSSCalcExpressionNodeParser.cpp:
(WebCore::CSSCalcExpressionNodeParser::parseValue):
When trying to construct a value node, if the token is a identifier, use the new
symbol table to look up a type/value to use instead. Use a switch to make things
a bit more clear that differentiation is being done based on token type.
* css/calc/CSSCalcExpressionNodeParser.h:
Add reference to a CSSCalcSymbolTable to the parser. The parser should only ever be used
on the stack, so this works well and allows us to avoid copying the table.
* css/calc/CSSCalcValue.cpp:
(WebCore::CSSCalcValue::create):
* css/calc/CSSCalcValue.h:
Pass the CSSCalcSymbolTable to the parser if one is provided. An overload was used
to avoid #including CSSCalcSymbolTable.h in the header just to add a default value.
* css/makevalues.pl:
Give a concrete base of uint16_t to allow it to be forward declared and add DefaultHash
and HashTraits to allow it to be used with HashTable. These match the definition of
CSSPropertyID.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::CalcParser::CalcParser):
(WebCore::CSSPropertyParserHelpers::consumeNumberRaw):
(WebCore::CSSPropertyParserHelpers::consumePercentWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumeAngleRaw):
(WebCore::CSSPropertyParserHelpers::consumeAngleWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
(WebCore::CSSPropertyParserHelpers::consumeOptionalAlphaOrIdent):
(WebCore::CSSPropertyParserHelpers::consumeHueOrIdent):
(WebCore::CSSPropertyParserHelpers::consumeNumberOrIdent):
(WebCore::CSSPropertyParserHelpers::consumePercentOrIdent):
(WebCore::CSSPropertyParserHelpers::consumeNumberOrPercentOrIdentNormalizedForRelativeRGB):
(WebCore::CSSPropertyParserHelpers::parseRelativeRGBParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeHSLParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeHWBParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeLabParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeLCHParameters):
(WebCore::CSSPropertyParserHelpers::extractChannelValue): Deleted.
(WebCore::CSSPropertyParserHelpers::resolveRelativeColorChannel): Deleted.
Rework relative color syntax parsing to allow permutation of channel symbols
and use of the calc() symbol table support to allow passing in the channels.
This makes the relatative color syntax variants much closer to the normal
variants (with the exception of passing the symbol table) and a subsequent
change will attempt to merge them further.
2021-05-30 Dean Jackson <dino@apple.com>
[WebXR] Provide a way to bind and unbind IOSurfaces to ANGLE Pbuffers
https://bugs.webkit.org/show_bug.cgi?id=226423
<rdar://problem/78652783>
Reviewed by Sam Weinig.
WebXR on Cocoa platforms gets framebuffer texture targets via
IOSurfaces. Those must be attached to ANGLE Pbuffers, which are
then bound to GL textures. There is already some code in
GraphicsContextGL (and in the CoreVideo classes) to do this, but
this is an attempt to make a generic function that will handle all
cases.
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::createPbufferAndAttachIOSurface):
(WebCore::GraphicsContextGLOpenGL::destroyPbufferAndDetachIOSurface):
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
2021-05-30 Dean Jackson <dino@apple.com>
[WebXR] No need for opaqueTexture when USE(IOSURFACE_FOR_XR_LAYER_DATA)
https://bugs.webkit.org/show_bug.cgi?id=226405
<rdar://problem/78636950>
Reviewed by Tim Horton.
When USE(IOSURFACE_FOR_XR_LAYER_DATA) is true, we'll get our
textures via a different method - we'll create them based on an
IOSurface we receive. This means that when we're in a
USE(IOSURFACE_FOR_XR_LAYER_DATA) configuration, we don't need the
opaqueTexture property on FrameData.
* platform/xr/PlatformXR.h: Put opaqueTexture in the #else clause.
(PlatformXR::Device::FrameData::LayerData::encode const):
(PlatformXR::Device::FrameData::LayerData::decode):
* testing/WebFakeXRDevice.cpp:
(WebCore::SimulatedXRDevice::frameTimerFired):
* Modules/webxr/WebXROpaqueFramebuffer.cpp: Guard use of opaqueTexture.
2021-05-30 Dean Jackson <dino@apple.com>
[WebXR] invalidateFramebuffer is not the same as clearing contents
https://bugs.webkit.org/show_bug.cgi?id=226422
<rdar://problem/78652351>
Reviewed by Sam Weinig.
The WebXR specification says that buffer contents must be cleared
before each frame. The code currently does glInvalidateFramebuffer
to wipe the attachments, which isn't the same thing (and produces
an error since it tries to invalidate attachments that don't exist).
Remove the call to invalidateFramebuffer for the moment since it
causes a glError. Add a FIXME to replace it with explicit calls
to glClear. I expect most content does this already, so it is unlikely
anything will break.
* Modules/webxr/WebXROpaqueFramebuffer.cpp:
(WebCore::WebXROpaqueFramebuffer::startFrame): Remove the call to
invalidateFramebuffer.
2021-05-30 Dean Jackson <dino@apple.com>
[WebXR] Recommended framebuffer width incorrectly scaled
https://bugs.webkit.org/show_bug.cgi?id=226408
<rdar://problem/78638309>
Reviewed by Tim Horton.
When WebXRWebGLLayer creates the WebXROpaqueFramebuffer, it asks
the session for the recommended framebuffer size. It then
multiplies the width by 2 - I assume because there are two eyes.
However, the specification [1] says that it is a "best estimate of
the WebGL framebuffer resolution large enough to contain all of the
sessions XRViews". So it should be the session that makes account
for the multiple views, not the framebuffer.
Since this would almost certainly break existing content using the OpenXR
backend, I edited the implementation to include the 2x width scale.
* Modules/webxr/WebXRWebGLLayer.cpp:
(WebCore::createOpaqueFramebuffer): Remove the "* 2".
* platform/xr/openxr/PlatformXROpenXR.cpp: Add a "* 2" to not break content.
2021-05-30 Darin Adler <darin@apple.com>
Remove WTF::Optional synonym for std::optional, using that class template directly instead
https://bugs.webkit.org/show_bug.cgi?id=226433
Reviewed by Chris Dumez.
* <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.
2021-05-29 Chris Dumez <cdumez@apple.com>
Adopt clang thread safety annotations in WTF::DataMutex
https://bugs.webkit.org/show_bug.cgi?id=226431
Reviewed by Darin Adler.
Update code base due to DataMutex API changes.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::performTaskAtMediaTime):
(WebCore::MediaPlayerPrivateGStreamer::triggerRepaint):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webKitWebSrcConstructed):
(webKitWebSrcGetProperty):
(webKitWebSrcSetContext):
(webKitWebSrcCreate):
(webKitWebSrcMakeRequest):
(webKitWebSrcStop):
(webKitWebSrcGetSize):
(webKitWebSrcIsSeekable):
(webKitWebSrcDoSeek):
(webKitWebSrcQuery):
(webKitWebSrcUnLock):
(webKitWebSrcUnLockStop):
(webKitWebSrcSetMediaPlayer):
(webKitSrcPassedCORSAccessCheck):
(CachedResourceStreamingClient::responseReceived):
(CachedResourceStreamingClient::dataReceived):
(CachedResourceStreamingClient::accessControlCheckFailed):
(CachedResourceStreamingClient::loadFailed):
(CachedResourceStreamingClient::loadFinished):
(webKitSrcWouldTaintOrigin):
* platform/graphics/gstreamer/mse/MediaSourceTrackGStreamer.cpp:
(WebCore::MediaSourceTrackGStreamer::isReadyForMoreSamples):
(WebCore::MediaSourceTrackGStreamer::notifyWhenReadyForMoreSamples):
(WebCore::MediaSourceTrackGStreamer::enqueueObject):
(WebCore::MediaSourceTrackGStreamer::clearQueue):
* platform/graphics/gstreamer/mse/MediaSourceTrackGStreamer.h:
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
(webKitMediaSrcActivateMode):
(webKitMediaSrcPadLinked):
(webKitMediaSrcLoop):
(webKitMediaSrcStreamFlush):
2021-05-29 Sam Weinig <weinig@apple.com>
Split calc() related files into 1-class per file structure
https://bugs.webkit.org/show_bug.cgi?id=226421
Reviewed by Chris Dumez.
It's bothered me for a while that the calc related classes (both in css/
and in platform/) were bundled all in two big files. This change splits
them all out into their own header and implementation files that match
their name, and puts them in new calc/ subdirectories (css/calc/... and
platform/calc/...). This should hopefully make the modifications I need
to make to calc() to support relative color syntax a little easier.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSCalculationValue.cpp: Removed.
* css/CSSCalculationValue.h: Removed.
* css/CSSGradientValue.cpp:
* css/CSSPrimitiveValue.cpp:
* css/CSSPrimitiveValueMappings.h:
* css/CSSValue.cpp:
* css/calc: Added.
* css/calc/CSSCalcCategoryMapping.cpp: Added.
(WebCore::calcUnitCategory):
(WebCore::calculationCategoryForCombination):
(WebCore::canonicalUnitTypeForCalculationCategory):
(WebCore::hasDoubleValue):
* css/calc/CSSCalcCategoryMapping.h: Added.
* css/calc/CSSCalcExpressionNode.cpp: Added.
(WebCore::operator<<):
(WebCore::prettyPrintNode):
(WebCore::prettyPrintNodes):
* css/calc/CSSCalcExpressionNode.h: Added.
(WebCore::CSSCalcExpressionNode::equals const):
(WebCore::CSSCalcExpressionNode::category const):
(WebCore::CSSCalcExpressionNode::CSSCalcExpressionNode):
* css/calc/CSSCalcExpressionNodeParser.cpp: Added.
(WebCore::CSSCalcExpressionNodeParser::parseCalc):
(WebCore::CSSCalcExpressionNodeParser::operatorValue):
(WebCore::checkDepthAndIndex):
(WebCore::CSSCalcExpressionNodeParser::parseCalcFunction):
(WebCore::CSSCalcExpressionNodeParser::parseValue):
(WebCore::CSSCalcExpressionNodeParser::parseCalcValue):
(WebCore::CSSCalcExpressionNodeParser::parseCalcProduct):
(WebCore::CSSCalcExpressionNodeParser::parseCalcSum):
* css/calc/CSSCalcExpressionNodeParser.h: Added.
(WebCore::CSSCalcExpressionNodeParser::CSSCalcExpressionNodeParser):
* css/calc/CSSCalcInvertNode.cpp: Added.
(WebCore::CSSCalcInvertNode::createCalcExpression const):
(WebCore::CSSCalcInvertNode::doubleValue const):
(WebCore::CSSCalcInvertNode::computeLengthPx const):
(WebCore::CSSCalcInvertNode::dump const):
* css/calc/CSSCalcInvertNode.h: Added.
* css/calc/CSSCalcNegateNode.cpp: Added.
(WebCore::CSSCalcNegateNode::createCalcExpression const):
(WebCore::CSSCalcNegateNode::dump const):
* css/calc/CSSCalcNegateNode.h: Added.
* css/calc/CSSCalcOperationNode.cpp: Added.
(WebCore::determineCategory):
(WebCore::categoryForInvert):
(WebCore::resolvedTypeForMinOrMaxOrClamp):
(WebCore::isSamePair):
(WebCore::sortingCategoryForType):
(WebCore::sortingCategory):
(WebCore::primitiveTypeForCombination):
(WebCore::conversionToAddValuesWithTypes):
(WebCore::functionFromOperator):
(WebCore::CSSCalcOperationNode::create):
(WebCore::CSSCalcOperationNode::createSum):
(WebCore::CSSCalcOperationNode::createProduct):
(WebCore::CSSCalcOperationNode::createMinOrMaxOrClamp):
(WebCore::CSSCalcOperationNode::hoistChildrenWithOperator):
(WebCore::CSSCalcOperationNode::canCombineAllChildren const):
(WebCore::CSSCalcOperationNode::combineChildren):
(WebCore::CSSCalcOperationNode::simplify):
(WebCore::CSSCalcOperationNode::simplifyRecursive):
(WebCore::CSSCalcOperationNode::simplifyNode):
(WebCore::CSSCalcOperationNode::primitiveType const):
(WebCore::CSSCalcOperationNode::createCalcExpression const):
(WebCore::CSSCalcOperationNode::doubleValue const):
(WebCore::CSSCalcOperationNode::computeLengthPx const):
(WebCore::CSSCalcOperationNode::collectDirectComputationalDependencies const):
(WebCore::CSSCalcOperationNode::collectDirectRootComputationalDependencies const):
(WebCore::CSSCalcOperationNode::buildCSSText):
(WebCore::functionPrefixForOperator):
(WebCore::CSSCalcOperationNode::buildCSSTextRecursive):
(WebCore::CSSCalcOperationNode::dump const):
(WebCore::CSSCalcOperationNode::equals const):
(WebCore::CSSCalcOperationNode::evaluateOperator):
* css/calc/CSSCalcOperationNode.h: Added.
* css/calc/CSSCalcPrimitiveValueNode.cpp: Added.
(WebCore::CSSCalcPrimitiveValueNode::create):
(WebCore::CSSCalcPrimitiveValueNode::customCSSText const):
(WebCore::CSSCalcPrimitiveValueNode::primitiveType const):
(WebCore::CSSCalcPrimitiveValueNode::CSSCalcPrimitiveValueNode):
(WebCore::CSSCalcPrimitiveValueNode::isNumericValue const):
(WebCore::CSSCalcPrimitiveValueNode::isNegative const):
(WebCore::CSSCalcPrimitiveValueNode::negate):
(WebCore::CSSCalcPrimitiveValueNode::invert):
(WebCore::CSSCalcPrimitiveValueNode::add):
(WebCore::CSSCalcPrimitiveValueNode::multiply):
(WebCore::CSSCalcPrimitiveValueNode::convertToUnitType):
(WebCore::CSSCalcPrimitiveValueNode::canonicalizeUnit):
(WebCore::CSSCalcPrimitiveValueNode::createCalcExpression const):
(WebCore::CSSCalcPrimitiveValueNode::doubleValue const):
(WebCore::CSSCalcPrimitiveValueNode::computeLengthPx const):
(WebCore::CSSCalcPrimitiveValueNode::collectDirectComputationalDependencies const):
(WebCore::CSSCalcPrimitiveValueNode::collectDirectRootComputationalDependencies const):
(WebCore::CSSCalcPrimitiveValueNode::isZero const):
(WebCore::CSSCalcPrimitiveValueNode::equals const):
(WebCore::CSSCalcPrimitiveValueNode::dump const):
* css/calc/CSSCalcPrimitiveValueNode.h: Added.
* css/calc/CSSCalcValue.cpp: Added.
(WebCore::createBlendHalf):
(WebCore::createCSS):
(WebCore::CSSCalcValue::CSSCalcValue):
(WebCore::CSSCalcValue::category const):
(WebCore::CSSCalcValue::primitiveType const):
(WebCore::CSSCalcValue::createCalculationValue const):
(WebCore::CSSCalcValue::setPermittedValueRange):
(WebCore::CSSCalcValue::collectDirectComputationalDependencies const):
(WebCore::CSSCalcValue::collectDirectRootComputationalDependencies const):
(WebCore::CSSCalcValue::customCSSText const):
(WebCore::CSSCalcValue::equals const):
(WebCore::CSSCalcValue::clampToPermittedRange const):
(WebCore::CSSCalcValue::doubleValue const):
(WebCore::CSSCalcValue::computeLengthPx const):
(WebCore::CSSCalcValue::isCalcFunction):
(WebCore::CSSCalcValue::dump const):
(WebCore::CSSCalcValue::create):
(WebCore::operator<<):
* css/calc/CSSCalcValue.h: Added.
* css/parser/CSSPropertyParserHelpers.cpp:
* platform/CalculationValue.cpp: Removed.
* platform/CalculationValue.h: Removed.
* platform/Length.cpp:
* platform/calc: Added.
* platform/calc/CalcExpressionBlendLength.cpp: Added.
(WebCore::CalcExpressionBlendLength::CalcExpressionBlendLength):
(WebCore::CalcExpressionBlendLength::evaluate const):
(WebCore::CalcExpressionBlendLength::operator== const):
(WebCore::CalcExpressionBlendLength::dump const):
* platform/calc/CalcExpressionBlendLength.h: Added.
(WebCore::operator==):
* platform/calc/CalcExpressionInversion.cpp: Added.
(WebCore::CalcExpressionInversion::evaluate const):
(WebCore::CalcExpressionInversion::dump const):
(WebCore::CalcExpressionInversion::operator== const):
(WebCore::operator==):
* platform/calc/CalcExpressionInversion.h: Added.
* platform/calc/CalcExpressionLength.cpp: Added.
(WebCore::CalcExpressionLength::evaluate const):
(WebCore::CalcExpressionLength::operator== const):
(WebCore::CalcExpressionLength::dump const):
* platform/calc/CalcExpressionLength.h: Added.
(WebCore::CalcExpressionLength::CalcExpressionLength):
(WebCore::operator==):
* platform/calc/CalcExpressionNegation.cpp: Added.
(WebCore::CalcExpressionNegation::evaluate const):
(WebCore::CalcExpressionNegation::operator== const):
(WebCore::CalcExpressionNegation::dump const):
(WebCore::operator==):
* platform/calc/CalcExpressionNegation.h: Added.
* platform/calc/CalcExpressionNode.cpp: Added.
(WebCore::operator<<):
* platform/calc/CalcExpressionNode.h: Added.
(WebCore::CalcExpressionNode::type const):
(WebCore::CalcExpressionNode::CalcExpressionNode):
* platform/calc/CalcExpressionNumber.cpp: Added.
(WebCore::CalcExpressionNumber::evaluate const):
(WebCore::CalcExpressionNumber::dump const):
(WebCore::CalcExpressionNumber::operator== const):
* platform/calc/CalcExpressionNumber.h: Added.
(WebCore::CalcExpressionNumber::CalcExpressionNumber):
(WebCore::operator==):
* platform/calc/CalcExpressionOperation.cpp: Added.
(WebCore::CalcExpressionOperation::evaluate const):
(WebCore::CalcExpressionOperation::operator== const):
(WebCore::operator==):
(WebCore::CalcExpressionOperation::dump const):
* platform/calc/CalcExpressionOperation.h: Added.
(WebCore::CalcExpressionOperation::CalcExpressionOperation):
* platform/calc/CalcOperator.cpp: Added.
(WebCore::operator<<):
* platform/calc/CalcOperator.h: Added.
* platform/calc/CalculationCategory.cpp: Added.
(WebCore::operator<<):
* platform/calc/CalculationCategory.h: Added.
* platform/calc/CalculationValue.cpp: Added.
(WebCore::CalculationValue::create):
(WebCore::CalculationValue::CalculationValue):
(WebCore::CalculationValue::evaluate const):
(WebCore::operator==):
(WebCore::operator<<):
* platform/calc/CalculationValue.h: Added.
(WebCore::CalculationValue::shouldClampToNonNegative const):
(WebCore::CalculationValue::expression const):
* style/StyleBuilderConverter.h:
2021-05-29 Cameron McCormack <heycam@apple.com>
Rename Internals.mainThreadScrollingReasons to synchronousScrollingReasons
https://bugs.webkit.org/show_bug.cgi?id=226415
Reviewed by Simon Fraser.
Brings the name into accordance with the term the C++ code uses.
* testing/Internals.cpp:
(WebCore::Internals::synchronousScrollingReasons const):
* testing/Internals.h:
* testing/Internals.idl:
2021-05-28 Darin Adler <darin@apple.com>
Clients of optional should use has_value instead of relying on hasValue macro
https://bugs.webkit.org/show_bug.cgi?id=226395
Reviewed by Chris Dumez.
In some files we are touching, moved from Optional to std::optional, but doing
that consistently in files we are not otherwise modifying is out of scope here.
In some places, use has_value instead of hasValue. In others, improved further
by not using has_value explicitly when it's clearer to do so. Wasn't 100%
consistent about that, but did aim to cover 100% of the hasValue call sites.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::create): Don't use hasValue.
* Modules/webxr/WebXRFrame.cpp:
(WebCore::WebXRFrame::getViewerPose): Ditto.
(WebCore::WebXRFrame::getPose): Ditto.
* Modules/webxr/WebXRGamepad.cpp:
(WebCore::WebXRGamepad::WebXRGamepad): Ditto.
* Modules/webxr/WebXRInputSource.cpp:
(WebCore::WebXRInputSource::requiresInputSourceChange): Use has_value.
* bindings/js/DOMPromiseProxy.h:
(WebCore::DOMPromiseProxy<IDLType>::isFulfilled const): Ditto.
(WebCore::DOMPromiseProxy<IDLUndefined>::isFulfilled const): Ditto.
(WebCore::DOMPromiseProxyWithResolveCallback<IDLType>::isFulfilled const): Ditto.
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readTerminal): Ditto.
* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::addToFacesLookupTable): Removed unneeded double check
of optional value. !x and !x.has_value() check the same thing.
(WebCore::CSSFontFaceSet::remove): Ditto.
(WebCore::CSSFontFaceSet::fontFace): Simplified code with extra local variables
to use an idiom that does not use hasValue. Since using *, ->, or value() on an
optional already asserts, there is no need to explicitly assert in the caller.
* css/CSSGradientValue.cpp:
(WebCore::GradientStop::isSpecified const): Use has_value.
* css/CSSSegmentedFontFace.cpp:
(WebCore::CSSSegmentedFontFace::fontRanges): Removed unneeded calls to hasValue.
* css/FontFace.cpp:
(WebCore::FontFace::family const): Use has_value.
(WebCore::FontFace::style const): Ditto.
(WebCore::FontFace::weight const): Ditto.
(WebCore::FontFace::stretch const): Ditto.
(WebCore::FontFace::unicodeRange const): Ditto.
(WebCore::FontFace::featureSettings const): Ditto.
(WebCore::FontFace::display const): Ditto.
* css/parser/CSSSelectorParser.cpp:
(WebCore::consumeANPlusB): Ditto.
* display/css/DisplayStyle.h: Ditto.
* dom/DataTransferItemList.h: Ditto.
* dom/Document.cpp:
(WebCore::Document::updateHighlightPositions): Ditto.
* dom/EventTarget.cpp:
(WebCore::EventTarget::addEventListener): Ditto.
* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::hasPendingCorrection const): Ditto.
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyInlineStyle): Don't call hasValue.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::captionDisplayMode): Ditto.
* html/ImageBitmap.h: Ditto.
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::setScreenSizeOverride): Use has_value.
* layout/LayoutPhase.cpp:
(WebCore::Layout::PhaseScope::PhaseScope): Ditto.
* layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::tryBreakingTextRun const): Ditto.
* layout/formattingContexts/inline/InlineLine.h: Ditto.
* loader/CrossOriginPreflightResultCache.cpp:
(WebCore::parseAccessControlMaxAge): Ditto.
* page/EventHandler.cpp:
(WebCore::EventHandler::defaultWheelEventHandler): Ditto.
* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope): Ditto.
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::closestSnapOffsetWithInfoAndAxis): Ditto.
* platform/ScrollController.cpp:
(WebCore::ScrollController::adjustScrollDestination): Don't use hasValue.
* platform/cocoa/SystemBattery.mm:
(WebCore::systemHasBattery): Use has_value.
(WebCore::systemHasAC): Use has_value.
* platform/graphics/Gradient.h: Ditto.
* platform/graphics/ImageSource.h: Ditto.
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::wouldTaintOrigin const): Changed idiom to not use hasValue.
* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(setGLContext): Do not use hasValue.
* platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::ElementFactories::hasElementForMediaType const): Ditto.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::playbackPosition const): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::performTaskAtMediaTime): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::triggerRepaint): Ditto.
* platform/graphics/gstreamer/eme/CDMProxyThunder.cpp:
(WebCore::CDMProxyThunder::getDecryptionSession const): Use has_value.
* platform/graphics/gstreamer/eme/CDMThunder.cpp:
(WebCore::ParsedResponseMessage::hasType const): Use has_value.
(WebCore::CDMInstanceSessionThunder::cdmInstanceThunder const): Use
a pointer for the erturn value instead of Optional<&>. This hasn't
compiled since we switched to std::optional so I suspect this code is
not compiled by EWS or the buildbot.
* platform/graphics/gstreamer/eme/CDMThunder.h: Updated to match above.
* platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::AppendPipeline::parseDemuxerSrcPadCaps): Use value_or.
(WebCore::AppendPipeline::appsinkCapsChanged): Do not use has_value.
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected): Ditto.
* platform/graphics/transforms/TransformState.h: Use has_value.
* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(WebCore::supportsPictureInPicture): Ditto.
* platform/mac/NSScrollerImpDetails.mm:
(WebCore::ScrollerStyle::recommendedScrollerStyle): Ditto.
* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::isSystemPreview const): Ditto.
* platform/xr/openxr/OpenXRInputSource.cpp:
(PlatformXR::OpenXRInputSource::getInputSource const): Ditto.
* rendering/EventRegion.h: Ditto.
* rendering/GridTrackSizingAlgorithm.h: Remove unnecessary assertion, since
the * operator already does the assertion.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::canComputePercentageFlexBasis): Use has_value.
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::setExplicitValue): Ditto.
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::systemFocusRingColor): Ditto.
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded): Ditto.
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::createSVGTransformFromMatrix): Changed idiom to not
call hasValue.
* svg/SVGTransform.h: Ditto.
* testing/WebFakeXRDevice.cpp:
(WebCore::WebFakeXRDevice::setViews): Ditto.
2021-05-29 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Do not include vertical spacing when resolving percent height for table content
https://bugs.webkit.org/show_bug.cgi?id=226365
Reviewed by Antti Koivisto.
<table style="height: 100px; border-spacing: 10px;"><tr><td style="height: 100%"></td></tr></table>
The <td>'s 100% height is resolved against 100px - (2 * 10px) -> 80px;
Test: fast/layoutformattingcontext/table-with-percent-columns-and-spacing.html
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::TableFormattingContext):
* layout/formattingContexts/table/TableFormattingContext.h:
* layout/formattingContexts/table/TableFormattingGeometry.cpp:
(WebCore::Layout::TableFormattingGeometry::TableFormattingGeometry):
(WebCore::Layout::TableFormattingGeometry::computedCellBorder const):
* layout/formattingContexts/table/TableFormattingGeometry.h:
(WebCore::Layout::TableFormattingGeometry::formattingContext const):
* layout/formattingContexts/table/TableFormattingQuirks.cpp:
(WebCore::Layout::TableFormattingQuirks::heightValueOfNearestContainingBlockWithFixedHeight const):
* layout/formattingContexts/table/TableFormattingQuirks.h:
(WebCore::Layout::TableFormattingQuirks::formattingContext const):
2021-05-29 Alan Bujtas <zalan@apple.com>
[LFC] Transition containing block for loops to range loops
https://bugs.webkit.org/show_bug.cgi?id=226315
Reviewed by Antti Koivisto.
Add support for stayWithin.
* layout/floats/FloatingContext.cpp:
(WebCore::Layout::FloatingContext::mapTopLeftToFloatingStateRoot const):
* layout/formattingContexts/FormattingGeometry.cpp:
(WebCore::Layout::FormattingGeometry::computedHeightValue const):
* layout/formattingContexts/block/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::usedAvailableWidthForFloatAvoider):
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::isDescendantOf const):
* layout/layouttree/LayoutBox.h:
* layout/layouttree/LayoutContainingBlockChainIterator.h:
(WebCore::Layout::LayoutContainingBlockChainIteratorAdapter::begin):
(WebCore::Layout::LayoutContainingBlockChainIteratorAdapter::end):
(WebCore::Layout::LayoutContainingBlockChainIterator::LayoutContainingBlockChainIterator):
(WebCore::Layout::LayoutContainingBlockChainIteratorAdapter::LayoutContainingBlockChainIteratorAdapter):
(WebCore::Layout::containingBlockChain):
2021-05-28 Wenson Hsieh <wenson_hsieh@apple.com>
Web process terminates when attempting to log in on bankid.no
https://bugs.webkit.org/show_bug.cgi?id=226411
rdar://77419432
Reviewed by Chris Dumez.
On bankid.no, we hit an erroneous MESSAGE_CHECK after decoding and applying an `EndClipToDrawingCommands` while
the display list replayer's `m_maskImageBuffer` is null. This may occur as a result of the following sequence of
events:
1. We call into `clipToDrawingCommands` inside `CanvasRenderingContext2DBase`, while drawing text with either
a gradient or pattern fill style.
2. A `BeginClipToDrawingCommands` item is decoded and handled in the GPU process; we create and store a new
mask image buffer on the display list replayer in the GPU process.
3. When we decode the `DrawGlyphs` item while drawing into the mask buffer, we see that the resource identifier
corresponding to the font is missing from the resource cache in the GPU process, and subsequently go to
sleep while we wait for the resource to arrive.
4. The web font data arrives in the GPU process, and we add it to the cache; this allows us to continue
processing the display list from where we paused replay in step (3).
5. Eventually, we handle the `EndClipToDrawingCommands` item; however, since this is now happening underneath
a different GPU process wakeup message than in (2), our mask image buffer from (1) is missing. This not only
causes all of the prior drawing commands to target the canvas' image buffer rather than the mask image
buffer, but also causes us to hit a `MESSAGE_CHECK` and terminate the web process.
To fix this, we add some DisplayList::Replayer::Delegate method hooks to call out into the replayer client when
a mask image buffer has been created or cleared out; in the GPU process, we then use these client hooks to keep
track of the current mask image buffer that is the target of display list replayer.
If we go to sleep and then resume display list processing later for any reason, we then pass this mask image
buffer back to the display list replayer upon construction, and simply let the display list replayer paint into
the maks image buffer's context.
Test: fast/canvas/fill-gradient-text-with-web-font.html
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::Replayer::Replayer):
(WebCore::DisplayList::Replayer::applyItem):
Call into the client hooks below.
* platform/graphics/displaylists/DisplayListReplayer.h:
(WebCore::DisplayList::Replayer::Replayer):
When initializing a DisplayList::Replayer, make it possible to take in an initial mask image buffer as well.
(WebCore::DisplayList::Replayer::Delegate::didCreateMaskImageBuffer):
(WebCore::DisplayList::Replayer::Delegate::didResetMaskImageBuffer):
Add new replayer delegate hooks to inform the clients layer when the replayer's mask image buffer has been
created or cleared out. See WebKit ChangeLog for more information.
2021-05-28 Chris Dumez <cdumez@apple.com>
Regression: Raw AudioBufferSourceNode playback causes repeated crackling sound
https://bugs.webkit.org/show_bug.cgi?id=222098
<rdar://problem/74546471>
Reviewed by Darin Adler.
The issue was due to certain audio nodes (such as AudioBufferSourceNode) staying in the audio
graph after they were no longer needed. As a result, the audio graph was becoming larger and
larger and the audio performance should degrade due to us traversing this increasingly large
graph.
The audio nodes that had trouble getting removed from the graphs were tail processing nodes.
Those are nodes that may still produce output for a while after they no longer have any
inputs. PannerNode and DelayNode are example of such nodes.
When a Node is no longer useful (the node no longer has any connections, m_connectionRefCount
is 0), we call disableOutputsIfNecessary() on it to disable its outputs and avoid doing any
processing of these outputs since they no longer have an input. disableOutputsIfNecessary()
would normally call disableOutputs() (if not already disabled) but there was an exception
in the case where the node requires tail processing. For such nodes, you wouldn't want to
disable them until they've finished processing their tail.
The issue was that once those nodes had finished processing their tail, we wouldn't come
back to them and disable their outputs later on. As a result, we would process more and
more (silent) nodes and the audio performance would seriously deteriorate.
To address this, we now add the node to the context's list of tail processing nodes in
disableOutputsIfNecessary() if the node requires tail processing. After each rendering
quantum, we go through those tail processing nodes and check if they have finished
processing their tail. If they have, we go ahead and disable their outputs at this point
and remove them from the list.
This is modeled after what Blink is doing for tail processing nodes in:
- https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc
I have verified that on the following demo, the performance no longer deteriorates after
a while:
- https://jsfiddle.net/KrisJohnson/s5vL24o1/123/
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::enableOutputsIfNecessary):
(WebCore::AudioNode::disableOutputsIfNecessary):
* Modules/webaudio/AudioNode.h:
(WebCore::AudioNode::isTailProcessing const):
(WebCore::AudioNode::setIsTailProcessing):
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::uninitialize):
(WebCore::BaseAudioContext::handlePostRenderTasks):
(WebCore::BaseAudioContext::addTailProcessingNode):
(WebCore::BaseAudioContext::removeTailProcessingNode):
(WebCore::BaseAudioContext::updateTailProcessingNodes):
(WebCore::BaseAudioContext::disableOutputsForFinishedTailProcessingNodes):
(WebCore::BaseAudioContext::finishTailProcessing):
* Modules/webaudio/BaseAudioContext.h:
(WebCore::BaseAudioContext::TailProcessingNode::TailProcessingNode):
(WebCore::BaseAudioContext::TailProcessingNode::~TailProcessingNode):
(WebCore::BaseAudioContext::TailProcessingNode::operator-> const):
(WebCore::BaseAudioContext::TailProcessingNode::operator== const):
2021-05-28 Chris Dumez <cdumez@apple.com>
DelayDSPKernel::process() is slow
https://bugs.webkit.org/show_bug.cgi?id=226358
Reviewed by Darin Adler.
When I profiled the demo at https://jsfiddle.net/KrisJohnson/s5vL24o1/123/ (in the context of Bug 222098),
I noticed that 20% of the CPU time was spent under DelayDSPKernel::process().
To improve this, we now vectorize DelayDSPKernel::process() in the common case where there is no automation
and the delay time is constant.
The implementation is very similar to the one in Blink:
- https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/platform/audio/audio_delay_dsp_kernel.cc
Some differences compared to the Blink implementation:
- I did not vectorize the A-rate case for simplicity. It is not as common and it is more complicated.
We may consider doing this in the future if really needed.
- On Cocoa, we leveage Accelerate's vDSP_vintb() to do the interpolation instead of doing 2 separate
operations.
This doesn't fix Bug 222098 but it does improve the situation quite a bit. I also see that the CPU time
spent under DelayDSPKernel::process() went from ~20% to 1.2% on this demo.
No new tests, no Web-facing behavior change, just a performance optimization.
* Modules/webaudio/DelayDSPKernel.cpp:
(WebCore::copyToCircularBuffer):
(WebCore::DelayDSPKernel::DelayDSPKernel):
(WebCore::DelayDSPKernel::bufferLengthForDelay const):
(WebCore::DelayDSPKernel::process):
(WebCore::DelayDSPKernel::processARate):
(WebCore::DelayDSPKernel::processKRate):
* Modules/webaudio/DelayDSPKernel.h:
* platform/audio/VectorMath.cpp:
(WebCore::VectorMath::substract):
(WebCore::VectorMath::interpolate):
* platform/audio/VectorMath.h:
2021-05-28 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Prevent GPU Process from attempt to connect to the AppSSO service (Part 2)
https://bugs.webkit.org/show_bug.cgi?id=226393
<rdar://problem/78614833>
Reviewed by Eric Carlson.
In Bug 224834 I modified WebKit to use avoid invoking AppSSO in CFNetwork calls, since we make those
decisions prior to beginning our network interactions. I missed a media call where this was being done.
This patch corrects that mistake.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::canonicalURL):
2021-05-28 Chris Dumez <cdumez@apple.com>
Stop using UncheckedLock in JSDOMGlobalObject
https://bugs.webkit.org/show_bug.cgi?id=226281
Reviewed by Darin Adler.
Stop using UncheckedLock in JSDOMGlobalObject and use Lock instead of benefit from Clang thread
safety analysis. This is a step towards phasing out UncheckedLock and improving the thread
safety of our code.
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::visitChildrenImpl):
(WebCore::JSDOMGlobalObject::clearDOMGuardedObjects):
* bindings/js/JSDOMGlobalObject.h:
(WebCore::getDOMConstructor):
* bindings/js/JSDOMGuardedObject.cpp:
(WebCore::DOMGuardedObject::DOMGuardedObject):
(WebCore::DOMGuardedObject::clear):
(WebCore::DOMGuardedObject::removeFromGlobalObject):
* bindings/js/JSDOMGuardedObject.h:
* bindings/js/JSDOMWrapperCache.cpp:
(WebCore::cacheDOMStructure):
2021-05-28 Jean-Yves Avenard <jya@apple.com>
Add MediaSession.callActionHandler
https://bugs.webkit.org/show_bug.cgi?id=226077
rdar://77463304
Reviewed by Eric Carlson.
Make it possible for JavaScript to be able to trigger a MediaSession action
handler so a MediaSession.coordinator polyfill such as one provided by an
external JS library will work.
Test: media/media-session/callActionHandler.html
* Modules/mediasession/MediaSession.cpp:
(WebCore::MediaSession::callActionHandler):
* Modules/mediasession/MediaSession.h:
* Modules/mediasession/MediaSession.idl: Add method definition.
2021-05-28 Alan Bujtas <zalan@apple.com>
CrashOnOverflow in WebCore::RenderTable::cellBefore(WebCore::RenderTableCell const*)
https://bugs.webkit.org/show_bug.cgi?id=225949
Reviewed by Antti Koivisto.
The table section maintains a grid of rows and columns. This grid is used to jump to cells directly during layout (as opposed to tree walking).
It needs to be re-populated on tree mutations e.g when a new row is added to the table.
RenderTableSection::willInsertTableRow assumes that rows and cells are inserted subsequently, after each other and
it's ok to ignore the grid invalidation on appends as the subsequent ::addCell() call takes care of the grid.
However in some continuation split cases, we re-parent complete rows under table sections which means no subsequent ::addCell() calls.
This patch addresses this case by using the same pattern we have for block continuation invalidation in RenderTreeBuilder::splitAnonymousBoxesAroundChild().
Test: fast/table/table-split-on-insert-with-section-crash.html
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::markBoxForRelayoutAfterSplit):
(WebCore::markBoxForRelayoutAfterSplit): Deleted.
* rendering/updating/RenderTreeBuilder.h:
* rendering/updating/RenderTreeBuilderInline.cpp:
(WebCore::RenderTreeBuilder::Inline::splitInlines):
2021-05-28 Sam Weinig <weinig@apple.com>
Add stub implementation of CA separated portal bits for GraphicsLayer
https://bugs.webkit.org/show_bug.cgi?id=226343
Reviewed by Simon Fraser.
Plumbs isSeparatedPortal and isDescendentOfSeparatedPortal bits through GraphicsLayer.
Renames setSeparated to setIsSeparated for consistency.
Currently unused, but getting the bits in is big enough that its helpful
to land on its own.
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::GraphicsLayer):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::isIsSeparated const):
(WebCore::GraphicsLayer::setIsSeparated):
(WebCore::GraphicsLayer::isSeparatedPortal const):
(WebCore::GraphicsLayer::setIsSeparatedPortal):
(WebCore::GraphicsLayer::isDescendentOfSeparatedPortal const):
(WebCore::GraphicsLayer::setIsDescendentOfSeparatedPortal):
(WebCore::GraphicsLayer::isSeparated const): Deleted.
(WebCore::GraphicsLayer::setSeparated): Deleted.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setIsSeparated):
(WebCore::GraphicsLayerCA::setIsSeparatedPortal):
(WebCore::GraphicsLayerCA::setIsDescendentOfSeparatedPortal):
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::updateIsSeparated):
(WebCore::GraphicsLayerCA::updateIsSeparatedPortal):
(WebCore::GraphicsLayerCA::updateIsDescendentOfSeparatedPortal):
(WebCore::GraphicsLayerCA::setSeparated): Deleted.
(WebCore::GraphicsLayerCA::updateSeparated): Deleted.
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::PlatformCALayerCocoa::setIsSeparated):
(WebCore::PlatformCALayerCocoa::isSeparatedPortal const):
(WebCore::PlatformCALayerCocoa::setIsSeparatedPortal):
(WebCore::PlatformCALayerCocoa::isDescendentOfSeparatedPortal const):
(WebCore::PlatformCALayerCocoa::setIsDescendentOfSeparatedPortal):
(WebCore::PlatformCALayerCocoa::setSeparated): Deleted.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGeometry):
2021-05-28 Brent Fulgham <bfulgham@apple.com>
Buffer computations should use correct type
https://bugs.webkit.org/show_bug.cgi?id=226352
<rdar://problem/78116213>
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-28 Eric Carlson <eric.carlson@apple.com>
[Cocoa] Return immediately when asked to paint an AVPlayer that hasn't reached HaveCurrentData
https://bugs.webkit.org/show_bug.cgi?id=226350
rdar://77910715
Reviewed by Jer Noble.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastPixelBuffer): Return immediately
if readyState < HaveCurrentData.
(WebCore::MediaPlayerPrivateAVFoundationObjC::videoOutputHasAvailableFrame): Ditto.
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): Ditto.
2021-05-28 Devin Rousso <drousso@apple.com>
[Modern Media Controls] put the localized information for tracks first if the track is not in the user's preferred language
https://bugs.webkit.org/show_bug.cgi?id=226361
<rdar://problem/78497853>
Reviewed by Eric Carlson.
Test: media/modern-media-controls/tracks-support/sorted-by-user-preferred-languages.html
This makes it clearer/easier for the user to understand what's going on when the track label
is not in the user's preferred language. For example, if a `<video>` has an "English" audio
track, it's not very helpful to show "English (英语)" for Chinese users instead of something
like "英语 (English)".
If the track has a `label` and either matches the user's preferred language or its `label`
already contains the localized language name, combine the track's `label` with a localized
description of the track if that description isn't already in the `label`. Otherwise, add
the localized language name first, then the description of the track, and finally the `label`.
Here are some examples if the user's preferred language is English:
- `<track kind="subtitles" srclang="en">` would show "English"
- `<track kind="subtitles" srclang="en" label="Foo">` would show "Foo"
- `<track kind="captions" srclang="en">` would show "English Captions"
- `<track kind="captions" srclang="en" label="Foo">` would show "Foo Captions"
- `<track kind="captions" srclang="en" label="Captions">` would show "Captions"
- `<track kind="subtitles" srclang="fr">` would show "French"
- `<track kind="subtitles" srclang="fr" label="Foo">` would show "French (Foo)"
- `<track kind="captions" srclang="fr">` would show "French Captions"
- `<track kind="captions" srclang="fr" label="Foo">` would show "French Captions (Foo)"
- `<track kind="captions" srclang="fr" label="Captions">` would show "French Captions"
* page/CaptionUserPreferences.cpp:
(WebCore::trackDisplayName):
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::addTextTrackKindDisplayNameIfNeeded): Added.
(WebCore::addAudioTrackKindDisplayNameIfNeeded): Added.
(WebCore::addTrackKindDisplayNameIfNeeded): Added.
(WebCore::trackDisplayName):
(WebCore::CaptionUserPreferencesMediaAF::displayNameForTrack const):
(WebCore::textTrackCompare):
(WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu):
(WebCore::buildDisplayStringForTrackBase): Deleted.
* platform/LocalizedStrings.h:
* platform/LocalizedStrings.cpp:
(WebCore::trackNoLabelText): Added.
(WebCore::textTrackOffMenuItemText): Added.
(WebCore::textTrackAutomaticMenuItemText): Added.
(WebCore::addTrackLabelAsSuffix): Added.
(WebCore::textTrackKindClosedCaptionsDisplayName): Added.
(WebCore::addTextTrackKindClosedCaptionsSuffix): Added.
(WebCore::textTrackKindCaptionsDisplayName): Added.
(WebCore::addTextTrackKindCaptionsSuffix): Added.
(WebCore::textTrackKindDescriptionsDisplayName): Added.
(WebCore::addTextTrackKindDescriptionsSuffix): Added.
(WebCore::textTrackKindChaptersDisplayName): Added.
(WebCore::addTextTrackKindChaptersSuffix): Added.
(WebCore::textTrackKindMetadataDisplayName): Added.
(WebCore::addTextTrackKindMetadataSuffix): Added.
(WebCore::textTrackKindSDHDisplayName): Added.
(WebCore::addTextTrackKindSDHSuffix): Added.
(WebCore::textTrackKindEasyReaderDisplayName): Added.
(WebCore::addTextTrackKindEasyReaderSuffix): Added.
(WebCore::textTrackKindForcedDisplayName): Added.
(WebCore::addTextTrackKindForcedSuffix): Added.
(WebCore::audioTrackKindDescriptionsDisplayName): Added.
(WebCore::addAudioTrackKindDescriptionsSuffix): Added.
(WebCore::audioTrackKindCommentaryDisplayName): Added.
(WebCore::addAudioTrackKindCommentarySuffix): Added.
(WebCore::textTrackNoLabelText): Deleted.
(WebCore::audioTrackNoLabelText): Deleted.
(WebCore::captionsTextTrackKindDisplayName): Deleted.
(WebCore::captionsTextTrackWithoutLabelMenuItemText): Deleted.
(WebCore::descriptionsTextTrackKindDisplayName): Deleted.
(WebCore::descriptionsTextTrackWithoutLabelMenuItemText): Deleted.
(WebCore::chaptersTextTrackKindDisplayName): Deleted.
(WebCore::chaptersTextTrackWithoutLabelMenuItemText): Deleted.
(WebCore::metadataTextTrackKindDisplayName): Deleted.
(WebCore::metadataTextTrackWithoutLabelMenuItemText): Deleted.
(WebCore::textTrackCountryAndLanguageMenuItemText): Deleted.
(WebCore::textTrackLanguageMenuItemText): Deleted.
(WebCore::closedCaptionKindTrackDisplayName): Deleted.
(WebCore::closedCaptionTrackMenuItemText): Deleted.
(WebCore::sdhTrackKindDisplayName): Deleted.
(WebCore::sdhTrackMenuItemText): Deleted.
(WebCore::easyReaderKindDisplayName): Deleted.
(WebCore::easyReaderTrackMenuItemText): Deleted.
(WebCore::forcedTrackKindDisplayName): Deleted.
(WebCore::forcedTrackMenuItemText): Deleted.
(WebCore::audioDescriptionTrackSuffixText): Deleted.
* en.lproj/Localizable.strings:
Clean up localized string functions related to media controls.
2021-05-28 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r278196.
https://bugs.webkit.org/show_bug.cgi?id=226379
Causes asserts in layoutformattingcontext
Reverted changeset:
"[LFC] Transition containing block for loops to range loops"
https://bugs.webkit.org/show_bug.cgi?id=226315
https://trac.webkit.org/changeset/278196
2021-05-28 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r278199.
https://bugs.webkit.org/show_bug.cgi?id=226378
Causes asserts in layoutformattingcontext
Reverted changeset:
"[LFC][TFC] Do not include vertical spacing when resolving
percent height for table content"
https://bugs.webkit.org/show_bug.cgi?id=226365
https://trac.webkit.org/changeset/278199
2021-05-28 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Do not include vertical spacing when resolving percent height for table content
https://bugs.webkit.org/show_bug.cgi?id=226365
Reviewed by Antti Koivisto.
<table style="height: 100px; border-spacing: 10px;"><tr><td style="height: 100%"></td></tr></table>
The <td>'s 100% height is resolved against 100px - (2 * 10px) -> 80px;
Test: fast/layoutformattingcontext/table-with-percent-columns-and-spacing.html
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::TableFormattingContext):
* layout/formattingContexts/table/TableFormattingContext.h:
* layout/formattingContexts/table/TableFormattingGeometry.cpp:
(WebCore::Layout::TableFormattingGeometry::TableFormattingGeometry):
(WebCore::Layout::TableFormattingGeometry::computedCellBorder const):
* layout/formattingContexts/table/TableFormattingGeometry.h:
(WebCore::Layout::TableFormattingGeometry::formattingContext const):
* layout/formattingContexts/table/TableFormattingQuirks.cpp:
(WebCore::Layout::TableFormattingQuirks::heightValueOfNearestContainingBlockWithFixedHeight const):
* layout/formattingContexts/table/TableFormattingQuirks.h:
(WebCore::Layout::TableFormattingQuirks::formattingContext const):
2021-05-28 Alan Bujtas <zalan@apple.com>
[LFC] Transition containing block for loops to range loops
https://bugs.webkit.org/show_bug.cgi?id=226315
Reviewed by Antti Koivisto.
Add support for stayWithin.
* layout/floats/FloatingContext.cpp:
(WebCore::Layout::FloatingContext::mapTopLeftToFloatingStateRoot const):
* layout/formattingContexts/FormattingGeometry.cpp:
(WebCore::Layout::FormattingGeometry::computedHeightValue const):
* layout/formattingContexts/block/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::usedAvailableWidthForFloatAvoider):
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::isDescendantOf const):
* layout/layouttree/LayoutBox.h:
* layout/layouttree/LayoutContainingBlockChainIterator.h:
(WebCore::Layout::LayoutContainingBlockChainIteratorAdapter::begin):
(WebCore::Layout::LayoutContainingBlockChainIteratorAdapter::end):
(WebCore::Layout::LayoutContainingBlockChainIterator::LayoutContainingBlockChainIterator):
(WebCore::Layout::LayoutContainingBlockChainIteratorAdapter::LayoutContainingBlockChainIteratorAdapter):
(WebCore::Layout::containingBlockChain):
2021-05-28 Rob Buis <rbuis@igalia.com>
Webkit doesn't calculate padding-top/-bottom in % correctly when parent has padding
https://bugs.webkit.org/show_bug.cgi?id=221202
Reviewed by Manuel Rego Casasnovas.
Absolute positioned elements should resolve %-ge padding against containing block padding-edge:
https://drafts.csswg.org/css-position-3/#absolute-positioning-containing-block
Test: imported/w3c/web-platform-tests/css/css-position/position-absolute-padding-percentage.html
* rendering/RenderBox.cpp:
(WebCore::RenderBox::containingBlockLogicalWidthForContent const):
2021-05-28 Martin Robinson <mrobinson@webkit.org>
More readily layout when scroll-snap properties change
https://bugs.webkit.org/show_bug.cgi?id=225950
Reviewed by Simon Fraser.
Do a layout when scroll-snap properties change instead of trying
to update scroll positions without a layout.
Test: css3/scroll-snap/scroll-snap-style-change-crash.html
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::styleDidChange): Remove code dealing with scrollports
as this is now handled by the RenderStyle diff. Now trigger a layout for scrollports
when the scrolled children change their snap properties.
* rendering/RenderObject.cpp:
(WebCore::RenderObject::enclosingScrollableContainerForSnapping const): Made this return a non-const.
* rendering/RenderObject.h:
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeRequiresLayout const): Added code to handle scrollport specific
properties.
2021-05-27 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Show context menu when clicking on data detection results in image overlays
https://bugs.webkit.org/show_bug.cgi?id=226274
rdar://75504956
Reviewed by Tim Horton and Aditya Keerthi.
Add a client hook to allow ImageOverlayController to call out into the WebKit client layer when a data detector
button (with a corresponding DDScannerResult) is clicked. See WebKit ChangeLog for more details.
* WebCore.xcodeproj/project.pbxproj:
* page/ChromeClient.h:
(WebCore::ChromeClient::handleClickForDataDetectionResult):
* page/cocoa/DataDetectorElementInfo.h: Added.
Introduce a struct that wraps a data detection result and the accompanying element bounding rect, mainly so that
we have a C++ struct we can plumb through the client layers (rather than directly passing Objective-C objects
around).
* page/mac/ImageOverlayControllerMac.mm:
(WebCore::ImageOverlayController::handleDataDetectorAction):
2021-05-27 Devin Rousso <drousso@apple.com>
Sampled Page Top Color: allow snapshotting of elements with CSS animations/transitions if they're paused
https://bugs.webkit.org/show_bug.cgi?id=226313
<rdar://problem/78534076>
Reviewed by Tim Horton.
The primary concern of sampling elements with CSS animations/transitions is that it
introduces some indeterminism in when the sampling happens vs how far progressed the CSS
animation/transition is. As an example, sampling from a page with an inline `<style>` that
applies a CSS animation to fade in the CSS `background-color` from `white` to `black` is
more likely to get a color closer to `black` than if that same CSS was in an external
uncached resource. This wouldn't make for a great experience, so r277044 made it so that any
CSS animations/transitions caused the sampling logic to bail, regardless of the state of the
CSS animation/transition. This is only really an issue for CSS animations/transitions that
are actively running, however, not ones that have yet to run or have already finished. It's
still possible that two loads of the same page could result in different colors (or bails)
depending on how quickly the CSS animation/transition runs or (if the CSS is in an external
resource) how long the containing resource takes to load, but with this patch it's now a
binary state (sample or bail) instead of an indeterminate range of possible sampled colors.
Tests: SampledPageTopColor.HitTestBeforeCSSTransition
SampledPageTopColor.HitTestDuringCSSTransition
SampledPageTopColor.HitTestAfterCSSTransition
SampledPageTopColor.HitTestBeforeCSSAnimation
SampledPageTopColor.HitTestDuringCSSAnimation
SampledPageTopColor.HitTestAfterCSSAnimation
* page/PageColorSampler.cpp:
(WebCore::isValidSampleLocation):
Use `Styleable` instead of `RenderStyle` to get more information about active CSS animations/transitions.
2021-05-27 Said Abou-Hallawa <said@apple.com>
Values of keySplines control points must all be in the range 0 to 1
https://bugs.webkit.org/show_bug.cgi?id=226336
Reviewed by Sam Weinig.
W3C specs:
https://svgwg.org/specs/animations/#KeySplinesAttribute
MDN documenation:
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/keySplines
Test: imported/w3c/web-platform-tests/svg/animations/keysplines-y-limits.html
* svg/SVGAnimationElement.cpp:
(WebCore::parseKeySplines):
2021-05-27 Darin Adler <darin@apple.com>
Next step toward using std::optional directly instead of through WTF::Optional typedef
https://bugs.webkit.org/show_bug.cgi?id=226280
Reviewed by Chris Dumez.
* <many files>: Accept the renaming done by do-webcore-rename.
* Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained
about the names of some arguments, fixed them, and also hand-updated Optional to
std::optional as long as we were touching it.
* loader/EmptyClients.cpp: Since style checker complained about the mix of
WEBCORE_EXPORT and inlined functions, moved them out of line, and
also hand-updated Optional to std::optional as long as we were touching it.
Also removed is<EmptyFrameLoaderClient>().
* loader/EmptyFrameLoaderClient.h: Ditto.
2021-05-27 Brent Fulgham <bfulgham@apple.com>
[Hardening] Use a RELEASE_ASSERT for SharedBufferDataView constructor
https://bugs.webkit.org/show_bug.cgi?id=226346
<rdar://problem/78115298>
Reviewed by Ryosuke Niwa.
We have a DEBUG assert in the constructor for SharedBufferDataView. Debug test show that we don't hit this during normal
operation, and it's not a hot code path. We should make it a RELEASE_ASSERT.
* platform/SharedBuffer.cpp:
(WebCore::SharedBufferDataView::SharedBufferDataView):
2021-05-27 Sihui Liu <sihui_liu@apple.com>
Abandon pending tasks on background thread when WebIDBServer is closed
https://bugs.webkit.org/show_bug.cgi?id=226295
Reviewed by Chris Dumez.
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: Disable threading check as we may
abort transactions on the main thread.
(WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo):
2021-05-27 Wenson Hsieh <wenson_hsieh@apple.com>
Refactor some data detector code in WebCore::Frame
https://bugs.webkit.org/show_bug.cgi?id=226267
Reviewed by Andy Estes and Devin Rousso.
In preparation for supporting data detection in image overlays, this patch refactors some existing data detector
logic inside (and adjacent to) Frame. See comments below for more details.
* WebCore.xcodeproj/project.pbxproj:
* editing/cocoa/DataDetection.h:
* editing/cocoa/DataDetection.mm:
(WebCore::DataDetection::canPresentDataDetectorsUIForElement):
Use DataDetectionResultsStorage instead of grabbing the array of scanner results directly from Frame.
(WebCore::DataDetection::createElementForImageOverlay):
Add a helper method to create a data detector element for image overlays; this grabs a scanner result from the
given ImageExtractionDataDetectorInfo, adds it to the element's document's frame, and then sets the newly
created element's "x-apple-data-detectors-result" attribute to the new identifier value. The main reason we do
this is to avoid having HTMLElement directly handle DDScannerResult (and instead delegate out to platform-
specific helpers in DataDetection).
* html/HTMLElement.cpp:
(WebCore::HTMLElement::updateWithImageExtractionResult):
Use the new helper function above.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
Use DataDetectionResultsStorage instead of setting the array of scanner results directly on Frame.
* page/Frame.cpp:
(WebCore::Frame::dataDetectionResults):
* page/Frame.h:
We currently store a list of document-wide data detection results (Objective-C DDScannerResult objects)
directly on Frame. For image overlays, I need to store a map of identifiers to scanner results in a similar
fashion. Rather than add more Objective-C code on Frame, it's better to instead move this logic out into a
separate C++ class, DataDetectionResultsStorage, that wraps both the document-level array of DDScannerResults,
as well as the new map of ImageOverlayDataDetectionResultIdentifier => DDScannerResult specifically for data
detector results inside image overlays.
* page/cocoa/DataDetectionResultsStorage.h: Copied from Source/WebCore/editing/cocoa/DataDetection.h.
(WebCore::DataDetectionResultsStorage::setDocumentLevelResults):
(WebCore::DataDetectionResultsStorage::documentLevelResults const):
Move the existing `m_dataDetectionResults` NSArray on Frame out into the storage helper class, as
`m_documentLevelResults`. As its name suggests, this array stores data detection results gathered by running
data detection over the entire document.
(WebCore::DataDetectionResultsStorage::imageOverlayDataDetectionResult):
(WebCore::DataDetectionResultsStorage::addImageOverlayDataDetectionResult):
Add a new map of ImageOverlayDataDetectionResultIdentifier to DDScannerResult for storing scanner results
specific to image overlay content. Using a separate data structure here prevents image overlay data detector
results from getting blown away when document-level data detection finishes and sets document-wide results on
the frame.
* page/cocoa/ImageOverlayDataDetectionResultIdentifier.h: Added.
Add an identifier type that we can use to look up data detection results in image overlay elements in Frame's
data detection result storage.
2021-05-27 Ziran Sun <zsun@igalia.com>
[css-grid] Add discrete animation support for grid-template-columns|rows
https://bugs.webkit.org/show_bug.cgi?id=226174
For CSSGridTemplateTemplate|Row, the animation wrapper setter needs to check a few style
settings such as gridColumns|gridRows, gridAutoRepeatColumns|gridAutoRepeatRows etc. to be
inline with the style specified. So does the getter.
Reviewed by Antoine Quint.
This change has improved the two exising animation related grid-template-* tests.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
2021-05-27 Tim Horton <timothy_horton@apple.com>
Introduce BifurcatedGraphicsContext
https://bugs.webkit.org/show_bug.cgi?id=226318
Reviewed by Sam Weinig.
New test: BifurcatedGraphicsContextTests.BasicBifurcatedContext
Introduce a GraphicsContext subclass that forwards painting
to two arbitrary child GraphicsContexts. This can be used, for example,
to paint into a bitmap and display list simultaneously.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/BifurcatedGraphicsContext.cpp: Added.
(WebCore::BifurcatedGraphicsContext::BifurcatedGraphicsContext):
(WebCore::BifurcatedGraphicsContext::~BifurcatedGraphicsContext):
(WebCore::BifurcatedGraphicsContext::hasPlatformContext const):
(WebCore::BifurcatedGraphicsContext::platformContext const):
(WebCore::BifurcatedGraphicsContext::save):
(WebCore::BifurcatedGraphicsContext::restore):
(WebCore::BifurcatedGraphicsContext::drawRect):
(WebCore::BifurcatedGraphicsContext::drawLine):
(WebCore::BifurcatedGraphicsContext::drawEllipse):
(WebCore::BifurcatedGraphicsContext::applyStrokePattern):
(WebCore::BifurcatedGraphicsContext::applyFillPattern):
(WebCore::BifurcatedGraphicsContext::drawPath):
(WebCore::BifurcatedGraphicsContext::fillPath):
(WebCore::BifurcatedGraphicsContext::strokePath):
(WebCore::BifurcatedGraphicsContext::beginTransparencyLayer):
(WebCore::BifurcatedGraphicsContext::endTransparencyLayer):
(WebCore::BifurcatedGraphicsContext::applyDeviceScaleFactor):
(WebCore::BifurcatedGraphicsContext::fillRect):
(WebCore::BifurcatedGraphicsContext::fillRoundedRectImpl):
(WebCore::BifurcatedGraphicsContext::fillRectWithRoundedHole):
(WebCore::BifurcatedGraphicsContext::clearRect):
(WebCore::BifurcatedGraphicsContext::strokeRect):
(WebCore::BifurcatedGraphicsContext::fillEllipse):
(WebCore::BifurcatedGraphicsContext::strokeEllipse):
(WebCore::BifurcatedGraphicsContext::setIsCALayerContext):
(WebCore::BifurcatedGraphicsContext::isCALayerContext const):
(WebCore::BifurcatedGraphicsContext::setIsAcceleratedContext):
(WebCore::BifurcatedGraphicsContext::renderingMode const):
(WebCore::BifurcatedGraphicsContext::clip):
(WebCore::BifurcatedGraphicsContext::clipOut):
(WebCore::BifurcatedGraphicsContext::clipPath):
(WebCore::BifurcatedGraphicsContext::clipBounds const):
(WebCore::BifurcatedGraphicsContext::setLineCap):
(WebCore::BifurcatedGraphicsContext::setLineDash):
(WebCore::BifurcatedGraphicsContext::setLineJoin):
(WebCore::BifurcatedGraphicsContext::setMiterLimit):
(WebCore::BifurcatedGraphicsContext::drawNativeImage):
(WebCore::BifurcatedGraphicsContext::drawPattern):
(WebCore::BifurcatedGraphicsContext::scale):
(WebCore::BifurcatedGraphicsContext::rotate):
(WebCore::BifurcatedGraphicsContext::translate):
(WebCore::BifurcatedGraphicsContext::concatCTM):
(WebCore::BifurcatedGraphicsContext::setCTM):
(WebCore::BifurcatedGraphicsContext::getCTM const):
(WebCore::BifurcatedGraphicsContext::roundToDevicePixels):
(WebCore::BifurcatedGraphicsContext::drawFocusRing):
(WebCore::BifurcatedGraphicsContext::drawLinesForText):
(WebCore::BifurcatedGraphicsContext::drawDotsForDocumentMarker):
(WebCore::BifurcatedGraphicsContext::setURLForRect):
(WebCore::BifurcatedGraphicsContext::setDestinationForRect):
(WebCore::BifurcatedGraphicsContext::addDestinationAtPoint):
(WebCore::BifurcatedGraphicsContext::supportsInternalLinks const):
(WebCore::BifurcatedGraphicsContext::updateState):
(WebCore::BifurcatedGraphicsContext::deprecatedPrivateContext const):
* platform/graphics/BifurcatedGraphicsContext.h: Added.
2021-05-27 Simon Fraser <simon.fraser@apple.com>
Add animations to GraphicsLayer logging output
https://bugs.webkit.org/show_bug.cgi?id=226303
Reviewed by Tim Horton.
Log animations in GraphicsLayer, so that it shows up in the "Layers" log channel,
and in showGraphicsLayerTree() output.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::operator<<):
(WebCore::GraphicsLayerCA::dumpAnimations):
(WebCore::GraphicsLayerCA::dumpAdditionalProperties const):
* platform/graphics/ca/GraphicsLayerCA.h:
2021-05-27 Brent Fulgham <bfulgham@apple.com>
Pass frame ref during navigationPolicyCompletionHandler
https://bugs.webkit.org/show_bug.cgi?id=226268
<rdar://problem/78512383>
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-05-27 Alan Bujtas <zalan@apple.com>
REGRESSION (r244434) Dispatch intrinsicContentsSizeChanged on the main frame only
https://bugs.webkit.org/show_bug.cgi?id=226311
Reviewed by Tim Horton.
While the Mail version of the content autosizing runs on both the main frame and the subframe(s),
the content size reporting should only happen on the main frame. The client is only interested
in the enclosing size of the content (also the API to retrieve the information is per-WKWebView,
it doesn't expose this information on a frame-by-frame basis).
Test: fast/dynamic/mail-autosize-with-iframe.html
* page/FrameView.cpp:
(WebCore::FrameView::autoSizeIfEnabled):
(WebCore::FrameView::enableFixedWidthAutoSizeMode):
(WebCore::FrameView::enableSizeToContentAutoSizeMode):
(WebCore::FrameView::enableAutoSizeMode):
2021-05-27 Sam Weinig <weinig@apple.com>
Merge WorkerGlobalScope+Caches.idl and DOMWindow+Caches.idl into a single WindowOrWorkerGlobalScope+Caches.idl
https://bugs.webkit.org/show_bug.cgi?id=226271
Reviewed by Darin Adler.
Address FIXMEs in both WorkerGlobalScope+Caches.idl and DOMWindow+Caches.idl by
merging them into a single WindowOrWorkerGlobalScope+Caches.idl, matching the spec
langauge more closely.
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/cache/DOMWindow+Caches.idl: Removed.
* Modules/cache/DOMWindowCaches.cpp: Removed.
* Modules/cache/DOMWindowCaches.h: Removed.
* Modules/cache/WindowOrWorkerGlobalScope+Caches.idl: Added.
* Modules/cache/WindowOrWorkerGlobalScopeCaches.cpp: Added.
(WebCore::DOMWindowCaches::supplementName):
(WebCore::WorkerGlobalScopeCaches::supplementName):
(WebCore::DOMWindowCaches::DOMWindowCaches):
(WebCore::DOMWindowCaches::from):
(WebCore::DOMWindowCaches::caches const):
(WebCore::WorkerGlobalScopeCaches::WorkerGlobalScopeCaches):
(WebCore::WorkerGlobalScopeCaches::from):
(WebCore::WorkerGlobalScopeCaches::caches const):
(WebCore::WindowOrWorkerGlobalScopeCaches::caches):
* Modules/cache/WindowOrWorkerGlobalScopeCaches.h: Added.
* Modules/cache/WorkerGlobalScope+Caches.idl: Removed.
* Modules/cache/WorkerGlobalScopeCaches.cpp: Removed.
* Modules/cache/WorkerGlobalScopeCaches.h: Removed.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
2021-05-27 Adrian Perez de Castro <aperez@igalia.com>
Non-unified build fixes, late May 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=226322
Unreviewed non-unified build fixes.
No new tests needed.
* css/CSSGridIntegerRepeatValue.cpp: Add missing wtf/text/StringConcatenateNumbers.h
header.
* css/CSSTimingFunctionValue.cpp: Ditto.
* layout/formattingContexts/flex/FlexFormattingContext.h: Add missing FormattingQuirks.h
header, remove now unneeded FormattingContext.h header.
* loader/PrivateClickMeasurement.cpp: Add missing wtf/text/StringConcatenateNumbers.h
header.
* platform/graphics/cairo/GraphicsContextCairo.cpp: Add missing Gradient.h header.
* platform/graphics/filters/FEMorphology.cpp: Add missing ColorTypes.h header.
2021-05-27 Youenn Fablet <youenn@apple.com>
Support H264 profiles in MediaRecorder
https://bugs.webkit.org/show_bug.cgi?id=226219
<rdar://78027944>
Reviewed by Eric Carlson.
Use mimeType option given in MediaRecorder options to detect which H264 profile to use.
Implement this by parsing the mime type codec parameter and use the avc1.WXYZ string to compute the profile.
By default, use baseline profile, which is not VideoToolbox profile but has wider decoding support.
If profile specified by the application fails, we downgrade to baseline.
Test: http/wpt/mediarecorder/MediaRecorder-video-h264-profiles.html
* Modules/mediarecorder/MediaRecorderProvider.cpp:
(WebCore::MediaRecorderProvider::isSupported):
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
(WebCore::MediaRecorderPrivateWriter::create):
(WebCore::MediaRecorderPrivateWriter::initialize):
(WebCore::MediaRecorderPrivateWriter::setOptions): Deleted.
* platform/mediarecorder/cocoa/VideoSampleBufferCompressor.h:
* platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm:
(WebCore::VideoSampleBufferCompressor::create):
(WebCore::VideoSampleBufferCompressor::VideoSampleBufferCompressor):
(WebCore::VideoSampleBufferCompressor::vtProfileLevel const):
(WebCore::VideoSampleBufferCompressor::initCompressionSession):
2021-05-27 Carlos Garcia Campos <cgarcia@igalia.com>
[SOUP] Do not disable the idle connection timeout
https://bugs.webkit.org/show_bug.cgi?id=226263
Reviewed by Sergio Villar Senin.
We disable the connection timeout in SoupSession because we implement our own timeout in WebKit, but that's not
the case for the idle connection timeout. There's no reason keep idle connection alive forever.
* platform/network/soup/SoupNetworkSession.cpp:
(WebCore::SoupNetworkSession::SoupNetworkSession):
2021-05-26 Cameron McCormack <heycam@apple.com>
Prevent sbix glyphs from being rendered in the GPU process
https://bugs.webkit.org/show_bug.cgi?id=226159
<rdar://77231959>
Reviewed by Darin Adler.
When GPUP canvas is enabled, the display list recorder handles sbix
glyphs by recording drawImage calls. This means that during display list
replay, we should not have any sbix glyphs in a DrawGlyphs display list
item. This patch checks for such glyphs (like we already do for SVG
glyphs) and returns early if they're found.
Manually tested. No new tests, since we'd need to add some way inject
sbix glyph IDs into display list items.
* platform/graphics/Font.h:
(WebCore::Font::ComplexColorFormatGlyphs::hasRelevantTables const):
(WebCore::Font::ComplexColorFormatGlyphs::bitForInitialized):
(WebCore::Font::ComplexColorFormatGlyphs::bitForValue):
(WebCore::Font::ComplexColorFormatGlyphs::bitsRequiredForGlyphCount):
(WebCore::Font::ComplexColorFormatGlyphs::ComplexColorFormatGlyphs):
* platform/graphics/coretext/FontCascadeCoreText.cpp:
(WebCore::FontCascade::drawGlyphs): Call new function that checks for
SVG and sbix glyph presence. Change release assertion to debug
assertion to avoid unnecessarily crashing the GPUP, and instead return
early in the presence of these glyphs.
* platform/graphics/coretext/FontCoreText.cpp:
(WebCore::Font::otSVGTable const):
(WebCore::Font::ComplexColorFormatGlyphs::createWithNoRelevantTables):
(WebCore::Font::ComplexColorFormatGlyphs::createWithRelevantTablesAndGlyphCount):
(WebCore::Font::ComplexColorFormatGlyphs::hasValueFor const):
(WebCore::Font::ComplexColorFormatGlyphs::get const):
(WebCore::Font::ComplexColorFormatGlyphs::set):
(WebCore::Font::hasComplexColorFormatTables const):
(WebCore::Font::glyphsWithComplexColorFormat const):
(WebCore::Font::glyphHasComplexColorFormat const):
(WebCore::Font::findOTSVGGlyphs const):
(WebCore::Font::hasAnyComplexColorFormatGlyphs const): New function to
check if a list of glyph IDs has any that would be inappropriate
to render in the GPU process. Since calling the CoreText function that
allows us to check if an sbix glyph exists would be too expensive to
call for every drawGlyphs call, we lazily cache (in a BitVector) the
presence of sbix and SVG images for glyph IDs we check.
2021-05-26 Sihui Liu <sihui_liu@apple.com>
Add logging for when SQLiteDatabase fails to close
https://bugs.webkit.org/show_bug.cgi?id=226290
Reviewed by Chris Dumez.
Also fix some logging error in IDB.
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::createOrMigrateRecordsTableIfNecessary):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidBlobTables):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidRecordsTable):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsTable):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsRecordIndex):
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::performCurrentOpenOperation):
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::open):
(WebCore::SQLiteDatabase::close):
* platform/sql/SQLiteDatabase.h:
2021-05-26 Fujii Hironori <Hironori.Fujii@sony.com>
[Win] Remove unused GraphicsContext::WindowsBitmap class
https://bugs.webkit.org/show_bug.cgi?id=226312
Reviewed by Don Olmstead.
* platform/graphics/GraphicsContext.h:
(WebCore::GraphicsContext::WindowsBitmap::hdc const): Deleted.
(WebCore::GraphicsContext::WindowsBitmap::buffer const): Deleted.
(WebCore::GraphicsContext::WindowsBitmap::bufferLength const): Deleted.
(WebCore::GraphicsContext::WindowsBitmap::size const): Deleted.
(WebCore::GraphicsContext::WindowsBitmap::bytesPerRow const): Deleted.
(WebCore::GraphicsContext::WindowsBitmap::bitsPerPixel const): Deleted.
(WebCore::GraphicsContext::WindowsBitmap::windowsDIB const): Deleted.
* platform/graphics/win/GraphicsContextCGWin.cpp:
(WebCore::GraphicsContext::drawWindowsBitmap): Deleted.
* platform/graphics/win/GraphicsContextCairoWin.cpp:
(WebCore::GraphicsContext::drawWindowsBitmap): Deleted.
* platform/graphics/win/GraphicsContextDirect2D.cpp:
(WebCore::GraphicsContextDirect2D::drawWindowsBitmap): Deleted.
* platform/graphics/win/GraphicsContextWin.cpp:
(WebCore::GraphicsContext::shouldIncludeChildWindows const):
(WebCore::GraphicsContext::WindowsBitmap::WindowsBitmap): Deleted.
(WebCore::GraphicsContext::WindowsBitmap::~WindowsBitmap): Deleted.
(WebCore::GraphicsContext::createWindowsBitmap): Deleted.
2021-05-26 Fujii Hironori <Hironori.Fujii@sony.com>
[Cairo] Remove unused members ownedPlatformContext and platformContext of GraphicsContextPlatformPrivate
https://bugs.webkit.org/show_bug.cgi?id=226310
Reviewed by Don Olmstead.
GraphicsContextPlatformPrivate is a class tracking HDC
transforming. It doesn't need to know about PlatformContextCairo.
Remove unused members ownedPlatformContext and platformContext.
GraphicsContextPlatformPrivate::syncContext was a setter of
cairo_t*. Removed it and set cairo_t* as an argument of the
constructor.
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContextCairo::GraphicsContextCairo):
* platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
(WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
(WebCore::GraphicsContextPlatformPrivate::setCTM):
(WebCore::GraphicsContextPlatformPrivate::syncContext): Deleted.
* platform/graphics/win/GraphicsContextCairoWin.cpp:
(WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
(WebCore::GraphicsContextPlatformPrivate::syncContext): Deleted.
2021-05-26 Toshio Ogasawara <toshio.ogasawara@access-company.com>
[MSE] MediaSample that need to be removed with SourceBufferPrivate::evictCodedFrames() may not be removed.
https://bugs.webkit.org/show_bug.cgi?id=225800
<rdar://problem/78296352>
Reviewed by Jer Noble.
Fixed evictCodedFrames to remove MediaSample that can be removed after the minimumRangeStart.
Test: media/media-source/media-source-evict-codedframe-after-seek.html
* platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::evictCodedFrames):
2021-05-26 Chris Dumez <cdumez@apple.com>
Leverage the new Vector(const T*, size_t) constructor
https://bugs.webkit.org/show_bug.cgi?id=226304
Reviewed by Darin Adler.
Leverage the new Vector(const T*, size_t) constructor in existing code.
* Modules/fetch/FetchBodyConsumer.cpp:
(WebCore::blobFromData):
* Modules/indexeddb/IDBGetResult.cpp:
(WebCore::IDBGetResult::dataFromBuffer):
* Modules/webauthn/WebAuthenticationUtils.cpp:
(WebCore::convertBytesToVector):
* Modules/webauthn/fido/DeviceResponseConverter.cpp:
(fido::decodeResponseMap):
* Modules/webauthn/fido/FidoHidPacket.cpp:
(fido::FidoHidInitPacket::createFromSerializedData):
(fido::FidoHidContinuationPacket::createFromSerializedData):
* Modules/webauthn/fido/Pin.cpp:
(fido::pin::encodeCOSEPublicKey):
* Modules/webauthn/fido/U2fResponseConverter.cpp:
(fido::WebCore::extractECPublicKeyFromU2fRegistrationResponse):
(fido::WebCore::extractCredentialIdFromU2fRegistrationResponse):
(fido::WebCore::createFidoAttestationStatementFromU2fRegisterResponse):
(fido::readU2fSignResponse):
* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::enqueueRawFrame):
* crypto/SubtleCrypto.cpp:
(WebCore::toKeyData):
(WebCore::copyToVector):
* crypto/gcrypt/CryptoKeyECGCrypt.cpp:
(WebCore::CryptoKeyEC::platformAddFieldElements const):
* crypto/mac/CryptoKeyECMac.cpp:
(WebCore::CryptoKeyEC::platformImportPkcs8):
* crypto/mac/SerializedCryptoKeyWrapMac.mm:
(WebCore::vectorFromNSData):
* crypto/openssl/CryptoAlgorithmAES_GCMOpenSSL.cpp:
(WebCore::cryptDecrypt):
* fileapi/Blob.cpp:
(WebCore::Blob::Blob):
* platform/graphics/ImageBackingStore.h:
(WebCore::ImageBackingStore::ImageBackingStore):
* platform/graphics/cairo/ImageBufferUtilitiesCairo.cpp:
(WebCore::data):
* platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::GstMappedBuffer::createVector const):
* platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp:
(WebCore::CDMProxyClearKey::cencSetDecryptionKey):
* platform/mediarecorder/MediaRecorderPrivateMock.cpp:
(WebCore::MediaRecorderPrivateMock::fetchData):
* platform/network/FormData.cpp:
(WebCore::FormDataElement::isolatedCopy const):
(WebCore::FormData::appendData):
* platform/network/curl/OpenSSLHelper.cpp:
(OpenSSL::BIO::getDataAsVector const):
* testing/Internals.cpp:
(WebCore::Internals::deserializeBuffer const):
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::openFunc):
2021-05-26 Jean-Yves Avenard <jya@apple.com>
Make MediaSession readystate enums all lowercase
https://bugs.webkit.org/show_bug.cgi?id=226213
<rdar://problem/78437011>
Reviewed by Eric Carlson.
Use the current MediaSession definition pattern which makes all enum names
lower case.
* Modules/mediasession/MediaSession.h:
* Modules/mediasession/MediaSessionReadyState.h:
* Modules/mediasession/MediaSessionReadyState.idl:
2021-05-26 Wenson Hsieh <wenson_hsieh@apple.com>
Add a PAL softlinking header for the Reveal framework
https://bugs.webkit.org/show_bug.cgi?id=226292
Reviewed by Tim Horton.
Pull soft-linking bits out of `DictionaryLookup.mm` and into a separate PAL header, so that we can easily soft-
link both Reveal and RevealCore in WebKit, in future patches. See below for more details.
No change in behavior.
* editing/cocoa/DictionaryLookup.mm:
Also do some minor cleanup around this code:
- Use `auto` in more places.
- Make `WebRevealHighlight` conform to `RVPresenterHighlightDelegate` and `UIRVPresenterHighlightDelegate`, as
was (probably) intended. Currently, the names of these delegate methods are treated as unused type template
arguments on the class. This means we no longer need to `static_cast` to the protocol when passing these
objects around.
- Move several ivars on `WebRevealHighlight` out of the @interface, and into the @implementation.
(-[WebRevealHighlight revealContext:drawRectsForItem:]):
(WebCore::canCreateRevealItems):
(WebCore::DictionaryLookup::rangeForSelection):
(WebCore::DictionaryLookup::rangeAtHitTestResult):
(WebCore::showPopupOrCreateAnimationController):
(SOFT_LINK_CLASS_OPTIONAL): Deleted.
2021-05-26 Don Olmstead <don.olmstead@sony.com>
[CMake] Support USE_ANGLE_EGL on additional platforms
https://bugs.webkit.org/show_bug.cgi?id=224888
<rdar://problem/77280211>
Reviewed by Ken Russell.
Use the ANGLE library targets when applicable.
* CMakeLists.txt:
* Headers.cmake:
2021-05-26 Chris Lord <clord@igalia.com>
Scrollbars/indicators are sometimes incorrectly drawn when async overflow scrolling is enabled
https://bugs.webkit.org/show_bug.cgi?id=226259
Reviewed by Simon Fraser.
Respect scrolled contents visibility when rendering scrollbar layers.
No new tests, covered by existing tests.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::paintContents):
2021-05-26 Truitt Savell <tsavell@apple.com>
Unreviewed, reverting r278028.
Caused fast/selectors/slow-style-sharing-with-long-cousin-
list.html to timeout on iOS and Windows.
Reverted changeset:
"CrashOnOverflow in
WebCore::RenderTable::cellBefore(WebCore::RenderTableCell
const*)"
https://bugs.webkit.org/show_bug.cgi?id=225949
https://commits.webkit.org/r278028
2021-05-26 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Support painting data detector highlights inside image overlays
https://bugs.webkit.org/show_bug.cgi?id=226227
Reviewed by Tim Horton.
Add support for painting data detector highlights inside image overlays by leveraging `DataDetectorHighlight`.
See comments below for more details.
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* editing/Editor.cpp:
(WebCore::scanForTelephoneNumbers):
Avoid painting service-controls-based telephone number highlights for selected text inside image overlays, in
order to avoid painting a redundant data detector highlight for telephone numbers in image overlays.
* html/HTMLElement.cpp:
(WebCore::imageOverlayDataDetectorClassName):
(WebCore::HTMLElement::isImageOverlayDataDetectorResult const):
(WebCore::HTMLElement::updateWithImageExtractionResult):
* html/HTMLElement.h:
* html/shadow/imageOverlay.css:
(div.image-overlay-data-detector-result):
Add support for injecting elements in the DOM that represent data detection results; these are transformed and
overlaid on the image in the same way as existing text containers. Note that we lay out these elements on top
of text, but make them invisible to hit-testing unless the `IgnoreCSSPointerEventsProperty` option is specified.
We'll take advantage of this behavior in a future patch.
* page/ImageOverlayController.cpp:
(WebCore::ImageOverlayController::selectionQuadsDidChange):
(WebCore::ImageOverlayController::uninstallPageOverlayIfNeeded):
(WebCore::ImageOverlayController::drawRect):
(WebCore::ImageOverlayController::platformHandleMouseEvent):
* page/ImageOverlayController.h:
Refactor the image overlay controller, such that we install the page overlay if there is any selection inside
the image overlay (as opposed to only when we need to use this overlay to paint the text selection for
transparent images). If data detectors are present, we'll additionally set up out `DataDetectorHighlight`s (one
for each data detection result container).
* page/mac/ImageOverlayControllerMac.mm: Added.
(WebCore::ImageOverlayController::updateDataDetectorHighlights):
Traverse the image overlay's subtree in search of container elements that correspond to data detection results;
for each of these elements, we create a new `DataDetectorHighlight` using the element's bounds, and save the
pair in `m_dataDetectorContainersAndHighlights`. Note that we hold a weak pointer to the container element, such
that there's no risk of leaking any of these data detection result containers (or their documents).
(WebCore::ImageOverlayController::platformHandleMouseEvent):
(WebCore::ImageOverlayController::handleDataDetectorAction):
Add a FIXME referencing the next patch in the sequence.
(WebCore::ImageOverlayController::clearDataDetectorHighlights):
* platform/mac/DataDetectorHighlight.h:
* platform/mac/DataDetectorHighlight.mm:
(WebCore::DataDetectorHighlight::createForImageOverlay):
Add a helper method to create a `DataDetectorHighlight` for image overlays.
2021-05-26 Antti Koivisto <antti@apple.com>
Don't hang onto expired resources without validation headers in memory cache
https://bugs.webkit.org/show_bug.cgi?id=226083
rdar://78035612
Reviewed by Chris Dumez.
They consume memory while only really being useful for history navigation.
Disk cache can handle the relatively rare cases where that is useful and not
covered by the page cache.
* loader/ResourceTimingInformation.cpp:
(WebCore::ResourceTimingInformation::addResourceTiming):
(WebCore::ResourceTimingInformation::removeResourceTiming):
Add way to remove entries from the map.
* loader/ResourceTimingInformation.h:
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::removeClient):
Removal from cache is now handled in deleteIfPossible() so any path that gets the resource to
canDelete() state will do cache removal check.
Since deleteIfPossible is invoked by removeClient the existing behavior is covered.
(WebCore::CachedResource::deleteIfPossible):
Remove expired resources without validation headers from the cache if the resource is otherwise deletable.
Also eagerly remove no-store http resources (previously only https was removed).
(WebCore::CachedResource::deleteThis):
Factor into a function.
* loader/cache/CachedResource.h:
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
Ensure existing resource is removed from cache adding a new one. This was causing confusion with inCache state.
(WebCore::CachedResourceLoader::garbageCollectDocumentResources):
Don't remove entries with active loader. They are needed for resource timing.
Don't leave removed entries to ResourceTimingInformation. They are not guaranteed to stay alive after
being removed from m_documentResources.
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::remove):
Call CachedResource::deleteThis() directly.
2021-05-26 Chris Dumez <cdumez@apple.com>
Drop SecurityPolicyViolationEvent's blockedURL & documentURL attributes
https://bugs.webkit.org/show_bug.cgi?id=226270
Reviewed by Alex Christensen.
Drop SecurityPolicyViolationEvent's blockedURL & documentURL attributes that I very recently added as part of
r278042. No other browser supports those and it looks like they may get dropped from the spec
(https://github.com/w3c/webappsec-csp/issues/498) since the blockedURI/documentURI cannot be renamed in the
SecurityPolicyViolationEventInit dictionary.
This is basically a partial revert of r278042, while we work on the spec to get updated to match browsers.
* dom/SecurityPolicyViolationEvent.h:
* dom/SecurityPolicyViolationEvent.idl:
2021-05-26 Alan Bujtas <zalan@apple.com>
[LFC] Introduce containingBlockChain iterator
https://bugs.webkit.org/show_bug.cgi?id=226269
Reviewed by Antti Koivisto.
Let's use the range loop syntax to climb the containing block chain.
* WebCore.xcodeproj/project.pbxproj:
* layout/formattingContexts/table/TableFormattingQuirks.cpp:
(WebCore::Layout::TableFormattingQuirks::heightValueOfNearestContainingBlockWithFixedHeight const):
* layout/layouttree/LayoutContainingBlockChainIterator.h: Added.
(WebCore::Layout::LayoutContainingBlockChainIterator::operator* const):
(WebCore::Layout::LayoutContainingBlockChainIterator::operator-> const):
(WebCore::Layout::LayoutContainingBlockChainIterator::operator== const):
(WebCore::Layout::LayoutContainingBlockChainIterator::operator!= const):
(WebCore::Layout::LayoutContainingBlockChainIterator::LayoutContainingBlockChainIterator):
(WebCore::Layout::LayoutContainingBlockChainIterator::operator++):
(WebCore::Layout::LayoutContainingBlockChainIteratorAdapter::LayoutContainingBlockChainIteratorAdapter):
(WebCore::Layout::LayoutContainingBlockChainIteratorAdapter::begin):
(WebCore::Layout::LayoutContainingBlockChainIteratorAdapter::end):
(WebCore::Layout::containingBlockChainOf):
2021-05-26 Alan Bujtas <zalan@apple.com>
REGRESSION: Safari v14.1 computes element height to be 33,554,432 pixels
https://bugs.webkit.org/show_bug.cgi?id=226006
<rdar://problem/78471122>
Reviewed by Antti Koivisto.
We fail to find the intrusive floats when they don't line up with the top of the line.
The fix is twofold here.
- when probing for the intrusive float boxes, we need to look at both the line geometry and the initial line constraints.
When the intrusive floats take up the entire horizontal space and the line ends up with no inline content,
the computed line geometry may come back with a 0px tall line.
Now if we probe the intrusive floats at [top: 0px, bottom: 0px] and they happen to have a vertical offset e.g 1px,
we won't find them (since we only scan at 0px vertically).
- if we still don't find the intrusive float(s), let's just offset the next line by the line height candidate (e.g. 18px)
instead of the "inifitePoint". The layout will likely be incorrect but it won't produce an infinitely tall content.
Test: fast/inline/inline-root-with-negative-margin-and-sibling-float.html
* layout/floats/FloatingContext.h:
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::lineLayout):
2021-05-25 Fujii Hironori <Hironori.Fujii@sony.com>
Rename ImageBuffer::transformColorSpace to transformToColorSpace, and it should take a single argument
https://bugs.webkit.org/show_bug.cgi?id=226108
Reviewed by Said Abou-Hallawa.
The 'srcColorSpace' argument of ImageBuffer::transformColorSpace()
should be removed because it is redundant and it is the same as
ImageBuffer::colorSpace().
RenderSVGResourceMasker::applyResource creates a image buffer for
a mask image. In Cairo, rendering happens in sRGB color space. So,
create a image buffer in sRGB, then renders the content and
transforms to linear sRGB.
* platform/graphics/ConcreteImageBuffer.h:
* platform/graphics/ImageBuffer.h:
* platform/graphics/ImageBufferBackend.h:
(WebCore::ImageBufferBackend::transformToColorSpace): Take a single argument 'newColorSpace'.
(WebCore::ImageBufferBackend::transformColorSpace): Renamed to transformToColorSpace.
* platform/graphics/cairo/ImageBufferCairoBackend.cpp:
(WebCore::ImageBufferCairoBackend::transformToColorSpace):
(WebCore::ImageBufferCairoBackend::transformColorSpace): Renamed to transformToColorSpace.
* platform/graphics/cairo/ImageBufferCairoBackend.h:
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::transformResultColorSpace):
* rendering/svg/RenderSVGResourceMasker.cpp:
(WebCore::RenderSVGResourceMasker::applyResource):
(WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):
2021-05-25 Chris Dumez <cdumez@apple.com>
Stop using UncheckedLock in MediaElementAudioSourceNode
https://bugs.webkit.org/show_bug.cgi?id=226250
Reviewed by Darin Adler.
Stop using UncheckedLock in MediaElementAudioSourceNode as it is being phased out in favor of
Lock, which supports clang thread safety analysis.
* Modules/webaudio/MediaElementAudioSourceNode.h:
* html/HTMLMediaElement.cpp:
2021-05-25 Chris Dumez <cdumez@apple.com>
[GStreamer] Stop using UncheckedLock in WebKitCommonEncryptionDecryptorGStreamer
https://bugs.webkit.org/show_bug.cgi?id=226249
Reviewed by Darin Adler.
Stop using UncheckedLock in WebKitCommonEncryptionDecryptorGStreamer as it is being phased out
in favor of WTF::Lock, which supports Clang thread safety analysis.
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
(transformInPlace):
(isCDMProxyAvailable):
(attachCDMProxy):
(sinkEventHandler):
(webKitMediaCommonEncryptionDecryptIsFlushing):
(setContext):
2021-05-25 Sam Weinig <weinig@apple.com>
Support byte components for all bounded RGB color types, not just SRGBA
https://bugs.webkit.org/show_bug.cgi?id=226222
Reviewed by Darin Adler.
We currently arbitrarily restrict byte components (e.g. SRGBA<uint8_t>)
to just SRGBA by only supporting conversion for that one color type. Support
for any bounded (e.g. [0..1]) RGB type would have the same semantics and
be useful now that we can get pixel buffers that are not SRGBA only out
of ImageBuffer.
To do this, we replace the ColorConversion specializations for this type
of conversion, and inline it directly in the main conversion convert function,
allowing for a more complex conditional without SFINAE complexity.
To make things a bit simpler, this also simplifies the RGB color type descriptors
to no longer be templates, as the description of the types is always float
based, regardless of the component used. This allows for a simpler new helper,
SelfWithReplacementComponent, to convert to and from ColorType<float>/ColorType<uint8_t>.
* platform/graphics/ColorConversion.cpp:
(WebCore::SRGBA<uint8_t>>::convert): Deleted.
* platform/graphics/ColorConversion.h:
(WebCore::ColorConversion::convert):
(WebCore::ColorConversion::handleToFloatConversion):
(WebCore::ColorConversion::handleToByteConversion):
* platform/graphics/ColorTypes.h:
2021-05-25 Chris Dumez <cdumez@apple.com>
CSP does not apply to AudioWorklets
https://bugs.webkit.org/show_bug.cgi?id=225862
<rdar://problem/78098440>
Reviewed by Eric Carlson.
Make sure Worklet::addModule() checks with CSP before attempting to load the script.
Tests: http/tests/security/contentSecurityPolicy/audioworklet-script-src-allowed.html
http/tests/security/contentSecurityPolicy/audioworklet-script-src-blocked.html
* worklets/Worklet.cpp:
(WebCore::Worklet::addModule):
2021-05-25 Devin Rousso <drousso@apple.com>
[Modern Media Controls] REGRESSION(r254389) media controls needs the full list of language preferences for ordering tracks
https://bugs.webkit.org/show_bug.cgi?id=226038
Reviewed by Myles C. Maxfield and Eric Carlson.
Media controls need access to the full list of language preferences in order to properly
sort/order the list of tracks in the controls UI. For example, if a `<video>` has subtitles
for English, Spanish, and French, and the user has English (default) and French (alternate)
configured in the Language & Region view of System Preferences on macOS, WebKit should order
the subtitles list English, French, and then Spanish.
Test: media/modern-media-controls/tracks-support/sorted-by-user-preferred-languages.html
* page/CaptionUserPreferences.cpp:
(WebCore::CaptionUserPreferences::preferredLanguages const):
(WebCore::CaptionUserPreferences::textTrackSelectionScore const):
(WebCore::CaptionUserPreferences::primaryAudioTrackLanguageOverride const):
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::preferredLanguages const):
(WebCore::buildDisplayStringForTrackBase):
(WebCore::trackDisplayName):
(WebCore::textTrackCompare):
* platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm:
(WebCore::MediaSelectionGroupAVFObjC::updateOptions):
* bindings/js/JSDOMWindowBase.cpp:
* bindings/js/JSWorkerGlobalScopeBase.cpp:
* bindings/js/JSWorkletGlobalScopeBase.cpp:
Wrap `defaultLanguage` in a lambda since it now has a parameter.
* platform/LocalizedStrings.h:
* platform/LocalizedStrings.cpp:
(WebCore::captionsTextTrackKindDisplayName): Added.
(WebCore::descriptionsTextTrackKindDisplayName): Added.
(WebCore::chaptersTextTrackKindDisplayName): Added.
(WebCore::metadataTextTrackKindDisplayName): Added.
(WebCore::closedCaptionKindTrackDisplayName): Added.
(WebCore::sdhTrackKindDisplayName): Added.
(WebCore::easyReaderKindDisplayName): Added.
(WebCore::forcedTrackKindDisplayName): Added.
Move the logic added in r277797 from `buildDisplayStringForTrackBase` to `trackDisplayName`
and only perform it if the text track display name doesn't already contain the display name
for the text track kind (e.g. if the `label` is "English Captions" don't add "Captions", but
do if the `label` is only "English").
2021-05-25 Tim Horton <timothy_horton@apple.com>
Virtualize GraphicsContext
https://bugs.webkit.org/show_bug.cgi?id=226170
Reviewed by Simon Fraser.
No new tests, just a refactoring.
In preparation for future patches which introduce new kinds of GraphicsContexts,
virtualize GraphicsContext, moving platform implementations into subclasses
GraphicsContext{CG,Cairo,Direct2D}, NullGraphicsContext, DisplayList::Recorder,
and Nicosia::CairoOperationRecorder.
GraphicsContextImpl dissolves away; platform contexts that were
unnecessarily implemented both as `GraphicsContext` and as a subclass
of GraphicsContextImpl (GraphicsContextImplCairo and GraphicsContextImplDirect2D)
are folded into their GraphicsContext subclass.
`paintingDisabled()` is no longer relevant in GraphicsContext implementations,
so we no longer have to check it everywhere; NullGraphicsContext overrides
everything with an empty implementation. We keep `paintingDisabled()` for
use in code outside of GraphicsContext, where it just distinguishes between
NullGraphicsContext and the others.
Also, a few bits of cleanup to make this easier:
- Legacy shadow radius behavior becomes a parameter to setShadow instead of a separate method.
- canvasClip(), which hasn't done anything different than clip() since Skia, is removed.
- GraphicsContext gains renderingMode() in place of isAcceleratedContext().
- Subclasses override updateState() to respond to GraphicsContext state changes,
as was already done for GraphicsContextImpl, to keep subclassing simple.
- builderState(), which was unused, is removed.
- drawPath() is introduced on all platforms, with a default implementation that just fills and strokes.
* Headers.cmake:
* PlatformFTW.cmake:
* PlatformWin.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* display/css/DisplayBoxDecorationPainter.cpp:
(WebCore::Display::BoxDecorationPainter::paintBoxShadow const):
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::isAccelerated const):
(WebCore::CanvasRenderingContext2DBase::clipInternal):
(WebCore::CanvasRenderingContext2DBase::clearRect):
(WebCore::CanvasRenderingContext2DBase::applyShadow):
(WebCore::CanvasRenderingContext2DBase::createPattern):
(WebCore::CanvasRenderingContext2DBase::drawTextUnchecked):
* page/FrameView.cpp:
(WebCore::FrameView::traverseForPaintInvalidation):
(WebCore::FrameView::adjustPageHeightDeprecated):
* page/FrameView.h:
* page/win/FrameCGWin.cpp:
(WebCore::imageFromRect):
* page/win/FrameGdiWin.cpp:
(WebCore::imageFromRect):
* platform/Cairo.cmake:
* platform/SourcesCairo.txt:
* platform/cocoa/DragImageCocoa.mm:
(WebCore::createDragImageForLink):
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::displayListForTextRun const):
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContextState::GraphicsContextState):
(WebCore::GraphicsContextStateChange::accumulate):
(WebCore::GraphicsContextStateChange::apply const):
(WebCore::GraphicsContextStateChange::dump const):
(WebCore::GraphicsContext::~GraphicsContext):
(WebCore::GraphicsContext::save):
(WebCore::GraphicsContext::restore):
(WebCore::GraphicsContext::drawRaisedEllipse):
(WebCore::GraphicsContext::setStrokeColor):
(WebCore::GraphicsContext::setShadow):
(WebCore::GraphicsContext::clearShadow):
(WebCore::GraphicsContext::setFillColor):
(WebCore::GraphicsContext::setStrokePattern):
(WebCore::GraphicsContext::setFillPattern):
(WebCore::GraphicsContext::setStrokeGradient):
(WebCore::GraphicsContext::setFillGradient):
(WebCore::GraphicsContext::beginTransparencyLayer):
(WebCore::GraphicsContext::endTransparencyLayer):
(WebCore::GraphicsContext::drawText):
(WebCore::GraphicsContext::drawGlyphs):
(WebCore::GraphicsContext::drawEmphasisMarks):
(WebCore::GraphicsContext::drawBidiText):
(WebCore::GraphicsContext::drawImage):
(WebCore::GraphicsContext::drawTiledImage):
(WebCore::GraphicsContext::drawImageBuffer):
(WebCore::GraphicsContext::drawConsumingImageBuffer):
(WebCore::GraphicsContext::clipRoundedRect):
(WebCore::GraphicsContext::clipOutRoundedRect):
(WebCore::GraphicsContext::clipToDrawingCommands):
(WebCore::GraphicsContext::clipToImageBuffer):
(WebCore::GraphicsContext::clipBounds const):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::fillRoundedRect):
(WebCore::GraphicsContext::fillRectWithRoundedHole):
(WebCore::GraphicsContext::setCompositeOperation):
(WebCore::GraphicsContext::drawPath):
(WebCore::GraphicsContext::drawLineForText):
(WebCore::GraphicsContext::paintFrameForMedia):
(WebCore::NullGraphicsContext::drawConsumingImageBuffer):
(WebCore::GraphicsContext::GraphicsContext): Deleted.
(WebCore::GraphicsContext::hasPlatformContext const): Deleted.
(WebCore::GraphicsContext::setStrokeThickness): Deleted.
(WebCore::GraphicsContext::setStrokeStyle): Deleted.
(WebCore::GraphicsContext::setLegacyShadow): Deleted.
(WebCore::GraphicsContext::setShadowsIgnoreTransforms): Deleted.
(WebCore::GraphicsContext::setShouldAntialias): Deleted.
(WebCore::GraphicsContext::setShouldSmoothFonts): Deleted.
(WebCore::GraphicsContext::setShouldSubpixelQuantizeFonts): Deleted.
(WebCore::GraphicsContext::setImageInterpolationQuality): Deleted.
(WebCore::GraphicsContext::setFillRule): Deleted.
(WebCore::GraphicsContext::drawNativeImage): Deleted.
(WebCore::GraphicsContext::drawPattern): Deleted.
(WebCore::GraphicsContext::setTextDrawingMode): Deleted.
(WebCore::GraphicsContext::setAlpha): Deleted.
(WebCore::GraphicsContext::setDrawLuminanceMask): Deleted.
(WebCore::GraphicsContext::setUseDarkAppearance): Deleted.
(WebCore::GraphicsContext::setPlatformTextDrawingMode): Deleted.
(WebCore::GraphicsContext::setPlatformStrokeStyle): Deleted.
(WebCore::GraphicsContext::setPlatformShouldSmoothFonts): Deleted.
(WebCore::GraphicsContext::isAcceleratedContext const): Deleted.
(WebCore::GraphicsContext::platformApplyDeviceScaleFactor): Deleted.
(WebCore::GraphicsContext::applyDeviceScaleFactor): Deleted.
(WebCore::GraphicsContext::fillEllipse): Deleted.
(WebCore::GraphicsContext::strokeEllipse): Deleted.
(WebCore::GraphicsContext::platformFillEllipse): Deleted.
(WebCore::GraphicsContext::platformStrokeEllipse): Deleted.
(WebCore::GraphicsContext::builderState): Deleted.
(WebCore::GraphicsContext::supportsInternalLinks const): Deleted.
(WebCore::GraphicsContext::setDestinationForRect): Deleted.
(WebCore::GraphicsContext::addDestinationAtPoint): Deleted.
* platform/graphics/GraphicsContext.h:
(WebCore::GraphicsContext::hasPlatformContext const):
(WebCore::GraphicsContext::platformContext const):
(WebCore::GraphicsContext::paintingDisabled const):
(WebCore::GraphicsContext::performingPaintInvalidation const):
(WebCore::GraphicsContext::invalidatingControlTints const):
(WebCore::GraphicsContext::invalidatingImagesWithAsyncDecodes const):
(WebCore::GraphicsContext::detectingContentfulPaint const):
(WebCore::GraphicsContext::setStrokeThickness):
(WebCore::GraphicsContext::setStrokeStyle):
(WebCore::GraphicsContext::setStrokeGradient):
(WebCore::GraphicsContext::setFillRule):
(WebCore::GraphicsContext::setShadowsIgnoreTransforms):
(WebCore::GraphicsContext::setShouldAntialias):
(WebCore::GraphicsContext::setShouldSmoothFonts):
(WebCore::GraphicsContext::setShouldSubpixelQuantizeFonts):
(WebCore::GraphicsContext::setImageInterpolationQuality):
(WebCore::GraphicsContext::imageInterpolationQuality const):
(WebCore::GraphicsContext::setAlpha):
(WebCore::GraphicsContext::alpha const):
(WebCore::GraphicsContext::compositeOperation const):
(WebCore::GraphicsContext::blendModeOperation const):
(WebCore::GraphicsContext::setDrawLuminanceMask):
(WebCore::GraphicsContext::drawLuminanceMask const):
(WebCore::GraphicsContext::setTextDrawingMode):
(WebCore::GraphicsContext::textDrawingMode const):
(WebCore::GraphicsContext::hasVisibleShadow const):
(WebCore::GraphicsContext::hasShadow const):
(WebCore::GraphicsContext::hasBlurredShadow const):
(WebCore::GraphicsContext::setUseDarkAppearance):
(WebCore::GraphicsContext::useDarkAppearance const):
(WebCore::GraphicsContext::state const):
(WebCore::GraphicsContext::renderingMode const):
(WebCore::GraphicsContext::fillEllipse):
(WebCore::GraphicsContext::strokeEllipse):
(WebCore::GraphicsContext::drawNativeImage):
(WebCore::GraphicsContext::drawImage):
(WebCore::GraphicsContext::drawTiledImage):
(WebCore::GraphicsContext::drawImageBuffer):
(WebCore::GraphicsContext::drawConsumingImageBuffer):
(WebCore::GraphicsContext::drawPattern):
(WebCore::GraphicsContext::isInTransparencyLayer const):
(WebCore::GraphicsContext::scale):
(WebCore::GraphicsContext::applyDeviceScaleFactor):
(WebCore::GraphicsContext::setURLForRect):
(WebCore::GraphicsContext::setDestinationForRect):
(WebCore::GraphicsContext::addDestinationAtPoint):
(WebCore::GraphicsContext::supportsInternalLinks const):
(WebCore::GraphicsContext::setContentfulPaintDetected):
(WebCore::GraphicsContext::contenfulPaintDetected const):
(WebCore::GraphicsContext::deprecatedPrivateContext const):
(WebCore::GraphicsContext::supportsTransparencyLayers const):
(WebCore::GraphicsContext::impl): Deleted.
* platform/graphics/GraphicsContextImpl.cpp: Removed.
* platform/graphics/GraphicsContextImpl.h: Removed.
* platform/graphics/Image.cpp:
(WebCore::Image::drawTiled):
* platform/graphics/Image.h:
* platform/graphics/ShadowBlur.cpp:
(WebCore::ShadowBlur::ShadowBlur):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::recursiveCommitChanges):
* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(PlatformCALayerWin::drawTextAtPoint const):
* platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
(PlatformCALayerWinInternal::displayCallback):
(PlatformCALayerWinInternal::drawRepaintCounters):
* platform/graphics/ca/win/WebTiledBackingLayerWin.cpp:
(WebTiledBackingLayerWin::displayCallback):
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContextCairo::GraphicsContextCairo):
(WebCore::GraphicsContextCairo::~GraphicsContextCairo):
(WebCore::GraphicsContextCairo::hasPlatformContext const):
(WebCore::GraphicsContextCairo::getCTM const):
(WebCore::GraphicsContextCairo::platformContext const):
(WebCore::GraphicsContextCairo::save):
(WebCore::GraphicsContextCairo::restore):
(WebCore::GraphicsContextCairo::drawRect):
(WebCore::GraphicsContextCairo::drawNativeImage):
(WebCore::GraphicsContextCairo::drawLine):
(WebCore::GraphicsContextCairo::drawEllipse):
(WebCore::GraphicsContextCairo::fillPath):
(WebCore::GraphicsContextCairo::strokePath):
(WebCore::GraphicsContextCairo::fillRect):
(WebCore::GraphicsContextCairo::clip):
(WebCore::GraphicsContextCairo::clipPath):
(WebCore::GraphicsContextCairo::clipBounds const):
(WebCore::GraphicsContextCairo::clipToImageBuffer):
(WebCore::GraphicsContextCairo::drawFocusRing):
(WebCore::GraphicsContextCairo::drawLinesForText):
(WebCore::GraphicsContextCairo::drawDotsForDocumentMarker):
(WebCore::GraphicsContextCairo::roundToDevicePixels):
(WebCore::GraphicsContextCairo::translate):
(WebCore::GraphicsContextCairo::updateState):
(WebCore::GraphicsContextCairo::concatCTM):
(WebCore::GraphicsContextCairo::setCTM):
(WebCore::GraphicsContextCairo::beginTransparencyLayer):
(WebCore::GraphicsContextCairo::endTransparencyLayer):
(WebCore::GraphicsContextCairo::clearRect):
(WebCore::GraphicsContextCairo::strokeRect):
(WebCore::GraphicsContextCairo::setLineCap):
(WebCore::GraphicsContextCairo::setLineDash):
(WebCore::GraphicsContextCairo::setLineJoin):
(WebCore::GraphicsContextCairo::setMiterLimit):
(WebCore::GraphicsContextCairo::clipOut):
(WebCore::GraphicsContextCairo::rotate):
(WebCore::GraphicsContextCairo::scale):
(WebCore::GraphicsContextCairo::fillRoundedRectImpl):
(WebCore::GraphicsContextCairo::fillRectWithRoundedHole):
(WebCore::GraphicsContextCairo::drawPattern):
(WebCore::GraphicsContextCairo::renderingMode const):
(WebCore::GraphicsContextCairo::drawGlyphs):
(WebCore::GraphicsContext::platformInit): Deleted.
(WebCore::GraphicsContext::platformDestroy): Deleted.
(WebCore::GraphicsContext::getCTM const): Deleted.
(WebCore::GraphicsContext::platformContext const): Deleted.
(WebCore::GraphicsContext::savePlatformState): Deleted.
(WebCore::GraphicsContext::restorePlatformState): Deleted.
(WebCore::GraphicsContext::drawRect): Deleted.
(WebCore::GraphicsContext::drawPlatformImage): Deleted.
(WebCore::GraphicsContext::drawLine): Deleted.
(WebCore::GraphicsContext::drawEllipse): Deleted.
(WebCore::GraphicsContext::fillPath): Deleted.
(WebCore::GraphicsContext::strokePath): Deleted.
(WebCore::GraphicsContext::fillRect): Deleted.
(WebCore::GraphicsContext::clip): Deleted.
(WebCore::GraphicsContext::clipPath): Deleted.
(WebCore::GraphicsContext::clipBounds const): Deleted.
(WebCore::GraphicsContext::drawFocusRing): Deleted.
(WebCore::GraphicsContext::drawLineForText): Deleted.
(WebCore::GraphicsContext::drawLinesForText): Deleted.
(WebCore::GraphicsContext::drawDotsForDocumentMarker): Deleted.
(WebCore::GraphicsContext::roundToDevicePixels): Deleted.
(WebCore::GraphicsContext::translate): Deleted.
(WebCore::GraphicsContext::setPlatformFillColor): Deleted.
(WebCore::GraphicsContext::setPlatformStrokeColor): Deleted.
(WebCore::GraphicsContext::setPlatformStrokeThickness): Deleted.
(WebCore::GraphicsContext::setPlatformStrokeStyle): Deleted.
(WebCore::GraphicsContext::setURLForRect): Deleted.
(WebCore::GraphicsContext::concatCTM): Deleted.
(WebCore::GraphicsContext::setCTM): Deleted.
(WebCore::GraphicsContext::setPlatformShadow): Deleted.
(WebCore::GraphicsContext::clearPlatformShadow): Deleted.
(WebCore::GraphicsContext::beginPlatformTransparencyLayer): Deleted.
(WebCore::GraphicsContext::endPlatformTransparencyLayer): Deleted.
(WebCore::GraphicsContext::supportsTransparencyLayers): Deleted.
(WebCore::GraphicsContext::clearRect): Deleted.
(WebCore::GraphicsContext::strokeRect): Deleted.
(WebCore::GraphicsContext::setLineCap): Deleted.
(WebCore::GraphicsContext::setLineDash): Deleted.
(WebCore::GraphicsContext::setLineJoin): Deleted.
(WebCore::GraphicsContext::setMiterLimit): Deleted.
(WebCore::GraphicsContext::setPlatformAlpha): Deleted.
(WebCore::GraphicsContext::setPlatformCompositeOperation): Deleted.
(WebCore::GraphicsContext::canvasClip): Deleted.
(WebCore::GraphicsContext::clipOut): Deleted.
(WebCore::GraphicsContext::rotate): Deleted.
(WebCore::GraphicsContext::scale): Deleted.
(WebCore::GraphicsContext::platformFillRoundedRect): Deleted.
(WebCore::GraphicsContext::fillRectWithRoundedHole): Deleted.
(WebCore::GraphicsContext::drawPlatformPattern): Deleted.
(WebCore::GraphicsContext::setPlatformShouldAntialias): Deleted.
(WebCore::GraphicsContext::setPlatformImageInterpolationQuality): Deleted.
(WebCore::GraphicsContext::isAcceleratedContext const): Deleted.
* platform/graphics/cairo/GraphicsContextImplCairo.cpp: Removed.
* platform/graphics/cairo/GraphicsContextImplCairo.h: Removed.
* platform/graphics/cairo/ImageBufferCairoBackend.cpp:
* platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp:
(WebCore::ImageBufferCairoSurfaceBackend::ImageBufferCairoSurfaceBackend):
* platform/graphics/cairo/PathCairo.cpp:
(WebCore::Path::strokeBoundingRect const):
(WebCore::Path::strokeContains const):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::coreInterpolationQuality):
(WebCore::cgInterpolationQuality):
(WebCore::cgTextDrawingMode):
(WebCore::GraphicsContextCG::GraphicsContextCG):
(WebCore::GraphicsContextCG::~GraphicsContextCG):
(WebCore::GraphicsContextCG::hasPlatformContext const):
(WebCore::GraphicsContextCG::platformContext const):
(WebCore::GraphicsContextCG::save):
(WebCore::GraphicsContextCG::restore):
(WebCore::GraphicsContextCG::drawNativeImage):
(WebCore::drawPatternCallback):
(WebCore::GraphicsContextCG::drawPattern):
(WebCore::GraphicsContextCG::drawRect):
(WebCore::GraphicsContextCG::drawLine):
(WebCore::GraphicsContextCG::drawEllipse):
(WebCore::GraphicsContextCG::applyStrokePattern):
(WebCore::GraphicsContextCG::applyFillPattern):
(WebCore::GraphicsContextCG::drawPath):
(WebCore::GraphicsContextCG::fillPath):
(WebCore::GraphicsContextCG::strokePath):
(WebCore::GraphicsContextCG::fillRect):
(WebCore::GraphicsContextCG::fillRoundedRectImpl):
(WebCore::GraphicsContextCG::fillRectWithRoundedHole):
(WebCore::GraphicsContextCG::clip):
(WebCore::GraphicsContextCG::clipOut):
(WebCore::GraphicsContextCG::clipPath):
(WebCore::GraphicsContextCG::clipBounds const):
(WebCore::GraphicsContextCG::beginTransparencyLayer):
(WebCore::GraphicsContextCG::endTransparencyLayer):
(WebCore::applyShadowOffsetWorkaroundIfNeeded):
(WebCore::setCGShadow):
(WebCore::GraphicsContextCG::updateState):
(WebCore::GraphicsContextCG::setMiterLimit):
(WebCore::GraphicsContextCG::clearRect):
(WebCore::GraphicsContextCG::strokeRect):
(WebCore::GraphicsContextCG::setLineCap):
(WebCore::GraphicsContextCG::setLineDash):
(WebCore::GraphicsContextCG::setLineJoin):
(WebCore::GraphicsContextCG::scale):
(WebCore::GraphicsContextCG::rotate):
(WebCore::GraphicsContextCG::translate):
(WebCore::GraphicsContextCG::concatCTM):
(WebCore::GraphicsContextCG::setCTM):
(WebCore::GraphicsContextCG::getCTM const):
(WebCore::GraphicsContextCG::roundToDevicePixels):
(WebCore::GraphicsContextCG::drawLinesForText):
(WebCore::GraphicsContextCG::setURLForRect):
(WebCore::GraphicsContextCG::setIsCALayerContext):
(WebCore::GraphicsContextCG::isCALayerContext const):
(WebCore::GraphicsContextCG::setIsAcceleratedContext):
(WebCore::GraphicsContextCG::renderingMode const):
(WebCore::GraphicsContextCG::applyDeviceScaleFactor):
(WebCore::GraphicsContextCG::fillEllipse):
(WebCore::GraphicsContextCG::strokeEllipse):
(WebCore::GraphicsContextCG::supportsInternalLinks const):
(WebCore::GraphicsContextCG::setDestinationForRect):
(WebCore::GraphicsContextCG::addDestinationAtPoint):
(WebCore::setCGStrokeColor): Deleted.
(WebCore::convertInterpolationQuality): Deleted.
(WebCore::GraphicsContext::platformInit): Deleted.
(WebCore::GraphicsContext::platformDestroy): Deleted.
(WebCore::GraphicsContext::platformContext const): Deleted.
(WebCore::GraphicsContext::savePlatformState): Deleted.
(WebCore::GraphicsContext::restorePlatformState): Deleted.
(WebCore::GraphicsContext::drawPlatformImage): Deleted.
(WebCore::GraphicsContext::drawPlatformPattern): Deleted.
(WebCore::GraphicsContext::drawRect): Deleted.
(WebCore::GraphicsContext::drawLine): Deleted.
(WebCore::GraphicsContext::drawEllipse): Deleted.
(WebCore::GraphicsContext::applyStrokePattern): Deleted.
(WebCore::GraphicsContext::applyFillPattern): Deleted.
(WebCore::GraphicsContext::drawPath): Deleted.
(WebCore::GraphicsContext::fillPath): Deleted.
(WebCore::GraphicsContext::strokePath): Deleted.
(WebCore::GraphicsContext::fillRect): Deleted.
(WebCore::GraphicsContext::platformFillRoundedRect): Deleted.
(WebCore::GraphicsContext::fillRectWithRoundedHole): Deleted.
(WebCore::GraphicsContext::clip): Deleted.
(WebCore::GraphicsContext::clipOut): Deleted.
(WebCore::GraphicsContext::clipPath): Deleted.
(WebCore::GraphicsContext::clipBounds const): Deleted.
(WebCore::GraphicsContext::beginPlatformTransparencyLayer): Deleted.
(WebCore::GraphicsContext::endPlatformTransparencyLayer): Deleted.
(WebCore::GraphicsContext::supportsTransparencyLayers): Deleted.
(WebCore::GraphicsContext::setPlatformShadow): Deleted.
(WebCore::GraphicsContext::clearPlatformShadow): Deleted.
(WebCore::GraphicsContext::setMiterLimit): Deleted.
(WebCore::GraphicsContext::clearRect): Deleted.
(WebCore::GraphicsContext::strokeRect): Deleted.
(WebCore::GraphicsContext::setLineCap): Deleted.
(WebCore::GraphicsContext::setLineDash): Deleted.
(WebCore::GraphicsContext::setLineJoin): Deleted.
(WebCore::GraphicsContext::canvasClip): Deleted.
(WebCore::GraphicsContext::scale): Deleted.
(WebCore::GraphicsContext::rotate): Deleted.
(WebCore::GraphicsContext::translate): Deleted.
(WebCore::GraphicsContext::concatCTM): Deleted.
(WebCore::GraphicsContext::setCTM): Deleted.
(WebCore::GraphicsContext::getCTM const): Deleted.
(WebCore::GraphicsContext::roundToDevicePixels): Deleted.
(WebCore::GraphicsContext::drawLineForText): Deleted.
(WebCore::GraphicsContext::drawLinesForText): Deleted.
(WebCore::GraphicsContext::setURLForRect): Deleted.
(WebCore::GraphicsContext::setPlatformImageInterpolationQuality): Deleted.
(WebCore::GraphicsContext::setIsCALayerContext): Deleted.
(WebCore::GraphicsContext::isCALayerContext const): Deleted.
(WebCore::GraphicsContext::setIsAcceleratedContext): Deleted.
(WebCore::GraphicsContext::isAcceleratedContext const): Deleted.
(WebCore::GraphicsContext::setPlatformTextDrawingMode): Deleted.
(WebCore::GraphicsContext::setPlatformStrokeColor): Deleted.
(WebCore::GraphicsContext::setPlatformStrokeThickness): Deleted.
(WebCore::GraphicsContext::setPlatformFillColor): Deleted.
(WebCore::GraphicsContext::setPlatformShouldAntialias): Deleted.
(WebCore::GraphicsContext::setPlatformShouldSmoothFonts): Deleted.
(WebCore::GraphicsContext::setPlatformAlpha): Deleted.
(WebCore::GraphicsContext::setPlatformCompositeOperation): Deleted.
(WebCore::GraphicsContext::platformApplyDeviceScaleFactor): Deleted.
(WebCore::GraphicsContext::platformFillEllipse): Deleted.
(WebCore::GraphicsContext::platformStrokeEllipse): Deleted.
(WebCore::GraphicsContext::supportsInternalLinks const): Deleted.
(WebCore::GraphicsContext::setDestinationForRect): Deleted.
(WebCore::GraphicsContext::addDestinationAtPoint): Deleted.
* platform/graphics/cg/GraphicsContextCG.h:
* platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
(WebCore::ImageBufferCGBitmapBackend::create):
* platform/graphics/cg/PathCG.cpp:
(WebCore::Path::strokeContains const):
(WebCore::Path::strokeBoundingRect const):
* platform/graphics/cg/PatternCG.cpp:
(WebCore::patternCallback):
* platform/graphics/cocoa/FontCascadeCocoa.mm:
* platform/graphics/cocoa/GraphicsContextCocoa.mm:
(WebCore::GraphicsContextCG::drawFocusRing):
(WebCore::drawFocusRingToContextAtTime):
(WebCore::GraphicsContextCG::drawDotsForDocumentMarker):
(WebCore::GraphicsContext::drawFocusRing): Deleted.
(WebCore::GraphicsContext::drawDotsForDocumentMarker): Deleted.
* platform/graphics/cocoa/IOSurface.mm:
(WebCore::IOSurface::ensureGraphicsContext):
* platform/graphics/displaylists/DisplayListDrawGlyphsRecorder.h:
* platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp:
(WebCore::DisplayList::DrawGlyphsRecorder::createInternalContext):
(WebCore::DisplayList::DrawGlyphsRecorder::populateInternalContext):
(WebCore::DisplayList::DrawGlyphsRecorder::recordDrawGlyphs):
* platform/graphics/displaylists/DisplayListDrawingContext.cpp:
(WebCore::DisplayList::DrawingContext::DrawingContext):
(WebCore::DisplayList::DrawingContext::recorder): Deleted.
* platform/graphics/displaylists/DisplayListDrawingContext.h:
(WebCore::DisplayList::DrawingContext::recorder):
* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::DrawPath::apply const):
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::SetState::encode const):
(WebCore::DisplayList::SetState::decode):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::Recorder):
(WebCore::DisplayList::Recorder::drawImageBuffer):
(WebCore::DisplayList::Recorder::getCTM const):
(WebCore::DisplayList::Recorder::drawLinesForText):
(WebCore::DisplayList::Recorder::drawFocusRing):
(WebCore::DisplayList::Recorder::clipBounds const):
(WebCore::DisplayList::Recorder::clipToDrawingCommands):
(WebCore::DisplayList::Recorder::paintFrameForMedia):
(WebCore::DisplayList::Recorder::extentFromLocalBounds const):
(WebCore::DisplayList::Recorder::clearShadow): Deleted.
(WebCore::DisplayList::Recorder::getCTM): Deleted.
(WebCore::DisplayList::Recorder::clipBounds): Deleted.
(WebCore::DisplayList::Recorder::canPaintFrameForMedia const): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.h:
(WebCore::DisplayList::Recorder::append):
* platform/graphics/mac/ColorMac.mm:
(WebCore::makeSimpleColorFromNSColor):
* platform/graphics/mac/WebLayer.mm:
(-[WebLayer drawInContext:]):
(-[WebSimpleLayer drawInContext:]):
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
(Nicosia::CairoOperationRecorder::CairoOperationRecorder):
(Nicosia::CairoOperationRecorder::fillRect):
(Nicosia::CairoOperationRecorder::fillRoundedRect):
(Nicosia::CairoOperationRecorder::fillRectWithRoundedHole):
(Nicosia::CairoOperationRecorder::fillPath):
(Nicosia::CairoOperationRecorder::fillEllipse):
(Nicosia::CairoOperationRecorder::strokeRect):
(Nicosia::CairoOperationRecorder::strokePath):
(Nicosia::CairoOperationRecorder::strokeEllipse):
(Nicosia::CairoOperationRecorder::drawGlyphs):
(Nicosia::CairoOperationRecorder::drawNativeImage):
(Nicosia::CairoOperationRecorder::drawRect):
(Nicosia::CairoOperationRecorder::drawLine):
(Nicosia::CairoOperationRecorder::drawLinesForText):
(Nicosia::CairoOperationRecorder::drawEllipse):
(Nicosia::CairoOperationRecorder::getCTM const):
(Nicosia::CairoOperationRecorder::clipBounds const):
(Nicosia::CairoOperationRecorder::clipToDrawingCommands):
(Nicosia::CairoOperationRecorder::paintFrameForMedia):
(Nicosia::CairoOperationRecorder::clearShadow): Deleted.
(Nicosia::CairoOperationRecorder::drawPath): Deleted.
(Nicosia::CairoOperationRecorder::getCTM): Deleted.
(Nicosia::CairoOperationRecorder::clipBounds): Deleted.
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:
* platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp:
(Nicosia::PaintingContextCairo::ForPainting::ForPainting):
(Nicosia::PaintingContextCairo::ForRecording::ForRecording):
* platform/graphics/win/GraphicsContextCGWin.cpp:
(WebCore::GraphicsContextCG::GraphicsContextCG):
(WebCore::GraphicsContext::releaseWindowsContext):
(WebCore::GraphicsContext::drawWindowsBitmap):
(WebCore::GraphicsContextCG::drawFocusRing):
(WebCore::GraphicsContextCG::drawDotsForDocumentMarker):
(WebCore::GraphicsContextCG::deprecatedPrivateContext const):
(WebCore::GraphicsContext::GraphicsContext): Deleted.
(WebCore::GraphicsContext::platformInit): Deleted.
(WebCore::GraphicsContext::drawFocusRing): Deleted.
(WebCore::GraphicsContext::drawDotsForDocumentMarker): Deleted.
* platform/graphics/win/GraphicsContextCairoWin.cpp:
(WebCore::GraphicsContextCairo::GraphicsContextCairo):
(WebCore::GraphicsContext::releaseWindowsContext):
(WebCore::GraphicsContextCairo::deprecatedPrivateContext const):
(WebCore::GraphicsContext::GraphicsContext): Deleted.
(WebCore::GraphicsContext::platformInit): Deleted.
* platform/graphics/win/GraphicsContextDirect2D.cpp:
(WebCore::GraphicsContextDirect2D::GraphicsContextDirect2D):
(WebCore::GraphicsContextDirect2D::systemFactory):
(WebCore::GraphicsContextDirect2D::defaultRenderTarget):
(WebCore::GraphicsContextDirect2D::platformInit):
(WebCore::GraphicsContextDirect2D::~GraphicsContextDirect2D):
(WebCore::GraphicsContextDirect2D::platformContext const):
(WebCore::GraphicsContextDirect2D::save):
(WebCore::GraphicsContextDirect2D::restore):
(WebCore::GraphicsContextDirect2D::drawNativeImage):
(WebCore::GraphicsContextDirect2D::releaseWindowsContext):
(WebCore::GraphicsContextDirect2D::drawWindowsBitmap):
(WebCore::GraphicsContextDirect2D::drawFocusRing):
(WebCore::GraphicsContextDirect2D::drawDotsForDocumentMarker):
(WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
(WebCore::GraphicsContextDirect2D::brushWithColor):
(WebCore::GraphicsContextDirect2D::colorWithGlobalAlpha const):
(WebCore::GraphicsContextDirect2D::solidStrokeBrush const):
(WebCore::GraphicsContextDirect2D::solidFillBrush const):
(WebCore::GraphicsContextDirect2D::patternStrokeBrush const):
(WebCore::GraphicsContextDirect2D::patternFillBrush const):
(WebCore::GraphicsContextDirect2D::beginDraw):
(WebCore::GraphicsContextDirect2D::endDraw):
(WebCore::GraphicsContextDirect2D::flush):
(WebCore::GraphicsContextDirect2D::drawPattern):
(WebCore::GraphicsContextDirect2D::drawRect):
(WebCore::GraphicsContextDirect2D::strokeStyle const):
(WebCore::GraphicsContextDirect2D::drawLine):
(WebCore::GraphicsContextDirect2D::drawEllipse):
(WebCore::GraphicsContextDirect2D::applyStrokePattern):
(WebCore::GraphicsContextDirect2D::applyFillPattern):
(WebCore::GraphicsContextDirect2D::drawPath):
(WebCore::GraphicsContextDirect2D::fillPath):
(WebCore::GraphicsContextDirect2D::strokePath):
(WebCore::GraphicsContextDirect2D::fillRect):
(WebCore::GraphicsContextDirect2D::fillRoundedRectImpl):
(WebCore::GraphicsContextDirect2D::fillRectWithRoundedHole):
(WebCore::GraphicsContextDirect2D::clip):
(WebCore::GraphicsContextDirect2D::clipOut):
(WebCore::GraphicsContextDirect2D::clipPath):
(WebCore::GraphicsContextDirect2D::clipBounds const):
(WebCore::GraphicsContextDirect2D::beginTransparencyLayer):
(WebCore::GraphicsContextDirect2D::endTransparencyLayer):
(WebCore::GraphicsContextDirect2D::supportsTransparencyLayers):
(WebCore::GraphicsContextDirect2D::updateState):
(WebCore::GraphicsContextDirect2D::setMiterLimit):
(WebCore::GraphicsContextDirect2D::clearRect):
(WebCore::GraphicsContextDirect2D::strokeRect):
(WebCore::GraphicsContextDirect2D::setLineCap):
(WebCore::GraphicsContextDirect2D::setLineDash):
(WebCore::GraphicsContextDirect2D::setLineJoin):
(WebCore::GraphicsContextDirect2D::scale):
(WebCore::GraphicsContextDirect2D::rotate):
(WebCore::GraphicsContextDirect2D::translate):
(WebCore::GraphicsContextDirect2D::concatCTM):
(WebCore::GraphicsContextDirect2D::setCTM):
(WebCore::GraphicsContextDirect2D::getCTM const):
(WebCore::GraphicsContextDirect2D::roundToDevicePixels):
(WebCore::GraphicsContextDirect2D::drawLinesForText):
(WebCore::GraphicsContextDirect2D::setURLForRect):
(WebCore::GraphicsContextDirect2D::setIsCALayerContext):
(WebCore::GraphicsContextDirect2D::isCALayerContext const):
(WebCore::GraphicsContextDirect2D::setIsAcceleratedContext):
(WebCore::GraphicsContextDirect2D::isAcceleratedContext const):
(WebCore::GraphicsContextDirect2D::applyDeviceScaleFactor):
(WebCore::GraphicsContextDirect2D::fillEllipse):
(WebCore::GraphicsContextDirect2D::strokeEllipse):
(WebCore::GraphicsContextDirect2D::drawGlyphs):
(WebCore::GraphicsContextDirect2D::clipToDrawingCommands):
(WebCore::GraphicsContextDirect2D::clipToImageBuffer):
(WebCore::GraphicsContextDirect2D::paintFrameForMedia):
(WebCore::GraphicsContext::GraphicsContext): Deleted.
(WebCore::GraphicsContext::systemFactory): Deleted.
(WebCore::GraphicsContext::defaultRenderTarget): Deleted.
(WebCore::GraphicsContext::platformInit): Deleted.
(WebCore::GraphicsContext::platformDestroy): Deleted.
(WebCore::GraphicsContext::platformContext const): Deleted.
(WebCore::GraphicsContext::savePlatformState): Deleted.
(WebCore::GraphicsContext::restorePlatformState): Deleted.
(WebCore::GraphicsContext::drawPlatformImage): Deleted.
(WebCore::GraphicsContext::releaseWindowsContext): Deleted.
(WebCore::GraphicsContext::drawWindowsBitmap): Deleted.
(WebCore::GraphicsContext::drawFocusRing): Deleted.
(WebCore::GraphicsContext::drawDotsForDocumentMarker): Deleted.
(WebCore::GraphicsContext::brushWithColor): Deleted.
(WebCore::GraphicsContext::colorWithGlobalAlpha const): Deleted.
(WebCore::GraphicsContext::solidStrokeBrush const): Deleted.
(WebCore::GraphicsContext::solidFillBrush const): Deleted.
(WebCore::GraphicsContext::patternStrokeBrush const): Deleted.
(WebCore::GraphicsContext::patternFillBrush const): Deleted.
(WebCore::GraphicsContext::beginDraw): Deleted.
(WebCore::GraphicsContext::endDraw): Deleted.
(WebCore::GraphicsContext::flush): Deleted.
(WebCore::GraphicsContext::drawPlatformPattern): Deleted.
(WebCore::GraphicsContext::drawRect): Deleted.
(WebCore::GraphicsContext::platformStrokeStyle const): Deleted.
(WebCore::GraphicsContext::drawLine): Deleted.
(WebCore::GraphicsContext::drawEllipse): Deleted.
(WebCore::GraphicsContext::applyStrokePattern): Deleted.
(WebCore::GraphicsContext::applyFillPattern): Deleted.
(WebCore::GraphicsContext::drawPath): Deleted.
(WebCore::GraphicsContext::fillPath): Deleted.
(WebCore::GraphicsContext::strokePath): Deleted.
(WebCore::GraphicsContext::fillRect): Deleted.
(WebCore::GraphicsContext::platformFillRoundedRect): Deleted.
(WebCore::GraphicsContext::fillRectWithRoundedHole): Deleted.
(WebCore::GraphicsContext::clip): Deleted.
(WebCore::GraphicsContext::clipOut): Deleted.
(WebCore::GraphicsContext::clipPath): Deleted.
(WebCore::GraphicsContext::clipBounds const): Deleted.
(WebCore::GraphicsContext::beginPlatformTransparencyLayer): Deleted.
(WebCore::GraphicsContext::endPlatformTransparencyLayer): Deleted.
(WebCore::GraphicsContext::supportsTransparencyLayers): Deleted.
(WebCore::GraphicsContext::setPlatformShadow): Deleted.
(WebCore::GraphicsContext::clearPlatformShadow): Deleted.
(WebCore::GraphicsContext::setPlatformStrokeStyle): Deleted.
(WebCore::GraphicsContext::setMiterLimit): Deleted.
(WebCore::GraphicsContext::clearRect): Deleted.
(WebCore::GraphicsContext::strokeRect): Deleted.
(WebCore::GraphicsContext::setLineCap): Deleted.
(WebCore::GraphicsContext::setLineDash): Deleted.
(WebCore::GraphicsContext::setLineJoin): Deleted.
(WebCore::GraphicsContext::canvasClip): Deleted.
(WebCore::GraphicsContext::scale): Deleted.
(WebCore::GraphicsContext::rotate): Deleted.
(WebCore::GraphicsContext::translate): Deleted.
(WebCore::GraphicsContext::concatCTM): Deleted.
(WebCore::GraphicsContext::setCTM): Deleted.
(WebCore::GraphicsContext::getCTM const): Deleted.
(WebCore::GraphicsContext::roundToDevicePixels): Deleted.
(WebCore::GraphicsContext::drawLineForText): Deleted.
(WebCore::GraphicsContext::drawLinesForText): Deleted.
(WebCore::GraphicsContext::setURLForRect): Deleted.
(WebCore::GraphicsContext::setPlatformImageInterpolationQuality): Deleted.
(WebCore::GraphicsContext::setIsCALayerContext): Deleted.
(WebCore::GraphicsContext::isCALayerContext const): Deleted.
(WebCore::GraphicsContext::setIsAcceleratedContext): Deleted.
(WebCore::GraphicsContext::isAcceleratedContext const): Deleted.
(WebCore::GraphicsContext::setPlatformTextDrawingMode): Deleted.
(WebCore::GraphicsContext::setPlatformStrokeColor): Deleted.
(WebCore::GraphicsContext::setPlatformStrokeThickness): Deleted.
(WebCore::GraphicsContext::setPlatformFillColor): Deleted.
(WebCore::GraphicsContext::setPlatformShouldAntialias): Deleted.
(WebCore::GraphicsContext::setPlatformShouldSmoothFonts): Deleted.
(WebCore::GraphicsContext::setPlatformAlpha): Deleted.
(WebCore::GraphicsContext::setPlatformCompositeOperation): Deleted.
(WebCore::GraphicsContext::platformApplyDeviceScaleFactor): Deleted.
(WebCore::GraphicsContext::platformFillEllipse): Deleted.
(WebCore::GraphicsContext::platformStrokeEllipse): Deleted.
* platform/graphics/win/GraphicsContextImplDirect2D.cpp: Removed.
* platform/graphics/win/GraphicsContextImplDirect2D.h: Removed.
* platform/graphics/win/GraphicsContextWin.cpp:
(WebCore::GraphicsContext::setShouldIncludeChildWindows):
(WebCore::GraphicsContext::shouldIncludeChildWindows const):
(WebCore::GraphicsContext::createWindowsBitmap):
(WebCore::GraphicsContext::getWindowsContext):
(WebCore::GraphicsContext::hdc const):
* platform/graphics/win/ImageBufferDirect2DBackend.cpp:
(WebCore::ImageBufferDirect2DBackend::create):
* platform/graphics/win/ImageCGWin.cpp:
(WebCore::BitmapImage::getHBITMAPOfSize):
* platform/graphics/win/ImageCairoWin.cpp:
(WebCore::BitmapImage::getHBITMAPOfSize):
* platform/graphics/win/PathDirect2D.cpp:
(WebCore::Path::strokeContains const):
(WebCore::Path::strokeBoundingRect const):
* platform/ios/DragImageIOS.mm:
(WebCore::createDragImageFromImage):
(WebCore::createDragImageForLink):
(WebCore::createDragImageForSelection):
(WebCore::createDragImageForRange):
(WebCore::createDragImageForColor):
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererCocoa.cpp:
* platform/win/DragImageWin.cpp:
(WebCore::createDragImageForLink):
* platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenuWin::paint):
* rendering/ContentfulPaintChecker.cpp:
(WebCore::ContentfulPaintChecker::qualifiesForContentfulPaint):
* rendering/RenderBoxModelObject.cpp:
(WebCore::applyBoxShadowForBackground):
(WebCore::RenderBoxModelObject::paintBoxShadow):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateEventRegion):
2021-05-25 Chris Dumez <cdumez@apple.com>
Stop using UncheckedLock in Node's s_eventTargetDataMapLock
https://bugs.webkit.org/show_bug.cgi?id=226191
Reviewed by Geoffrey Garen.
Stop using UncheckedLock in Node's s_eventTargetDataMapLock. This is a step towards phasing
out UncheckedLock in favor of Lock which supports Clang Thread Safety Analysis.
Note that I had to factor the code a little differently because Clang Thread Safety Analysis
doesn't support conditional locking.
* dom/Node.cpp:
(WebCore::Node::eventTargetDataConcurrently):
2021-05-25 Chris Dumez <cdumez@apple.com>
Stop using UncheckedLock in html/canvas
https://bugs.webkit.org/show_bug.cgi?id=226186
Reviewed by Darin Adler.
Stop using UncheckedLock in html/canvas. This is a step towards phasing out
UncheckedLock, in favor of the checked Lock. Technically, the code still
doesn't do much thread-safety analysis after this change. It is very difficult
to adopt thread-safety analysis here because the call sites don't always lock
(there are cases where no locking is needed). It is also hard to get a reference
to the various locks to make WTF_REQUIRES_LOCK() work.
* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::deleteVertexArray):
* html/canvas/WebGLContextGroup.cpp:
(WebCore::WebGLContextGroup::objectGraphLockForAContext):
* html/canvas/WebGLContextGroup.h:
* html/canvas/WebGLContextObject.cpp:
(WebCore::WebGLContextObject::objectGraphLockForContext):
* html/canvas/WebGLContextObject.h:
* html/canvas/WebGLObject.h:
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::objectGraphLock):
* html/canvas/WebGLRenderingContextBase.h:
* html/canvas/WebGLSharedObject.cpp:
(WebCore::WebGLSharedObject::objectGraphLockForContext):
* html/canvas/WebGLSharedObject.h:
2021-05-25 Chris Dumez <cdumez@apple.com>
[iOS] ASSERTION FAILED: !isMainThread() in WebCore::SpeechRecognitionCaptureSourceImpl::audioSamplesAvailable
https://bugs.webkit.org/show_bug.cgi?id=226247
<rdar://problem/78481513>
Unreviewed, drop threading assertions I added in r277921 as my understanding was wrong
about which thread the functions run on and they are hitting on the bots.
* Modules/speech/SpeechRecognitionCaptureSourceImpl.cpp:
(WebCore::SpeechRecognitionCaptureSourceImpl::updateDataSource):
* Modules/speech/SpeechRecognitionCaptureSourceImpl.h:
2021-05-25 Sihui Liu <sihui_liu@apple.com>
Make error returned by SQLiteIDBBackingStore::getOrEstablishDatabaseInfo more detailed
https://bugs.webkit.org/show_bug.cgi?id=226124
Reviewed by Chris Dumez.
Convert some error loggings to error info to help debug rdar://77532291.
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::createOrMigrateRecordsTableIfNecessary):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidBlobTables):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidRecordsTable):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsTable):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsRecordIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidObjectStoreInfoTable):
(WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo):
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:
* platform/sql/SQLiteDatabase.cpp: add two helper funtions that are used in many places.
(WebCore::SQLiteDatabase::tableExists):
(WebCore::SQLiteDatabase::tableSQL):
(WebCore::SQLiteDatabase::indexSQL):
* platform/sql/SQLiteDatabase.h:
2021-05-25 Don Olmstead <don.olmstead@sony.com>
[PlayStation] Build failure in UserAgentPlayStation
https://bugs.webkit.org/show_bug.cgi?id=226232
Unreviewed build fix after r277967.
* platform/playstation/UserAgentPlayStation.cpp:
(WebCore::standardUserAgentStatic):
2021-05-25 Chris Dumez <cdumez@apple.com>
SecurityPolicyViolationEvent.constructor do not throw any exception as expected when eventInitDict param do not include all the members required
https://bugs.webkit.org/show_bug.cgi?id=226215
Reviewed by Darin Adler.
Update our SecurityPolicyViolationEvent & SecurityPolicyViolationEventInit IDL to match
Blink more closely, which gets us much closer to the specification:
- https://w3c.github.io/webappsec-csp/#securitypolicyviolationevent
I added comments in the IDL for cases where we intentionally don't match the specification
because it would not be compatible with Blink.
The following changes were made:
- Mark documentURI, violatedDirective, effectiveDirective, originalPolicy, disposition and
statusCode dictionary members as required.
- Use 'unsigned long' type for lineNumber & columNumber dictionary members instead of 'long'.
- Add disposition and sample dictionary members.
- Use USVString type for referrer dictionary member instead of DOMString
- Allow workers to construct a SecurityPolicyViolationEvent.
- Add documentURL, blockedURL, sample, disposition, lineno, colno attributes to
SecurityPolicyViolationEvent.
* dom/SecurityPolicyViolationEvent.h:
(WebCore::SecurityPolicyViolationEvent::Init::encode const):
(WebCore::SecurityPolicyViolationEvent::Init::decode):
* dom/SecurityPolicyViolationEvent.idl:
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::reportViolation const):
2021-05-24 Darin Adler <darin@apple.com>
Switch from WTF::Optional to std::optional
https://bugs.webkit.org/show_bug.cgi?id=211674
Reviewed by Chris Dumez.
* platform/graphics/VP9Utilities.h: Tweaked coding style a bit.
Added missing operator!= because std::optional's operator!= relies
on that, while WTF::Optional's operator!= relied on operator==.
* platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:
(Encoders::definition): Use a pointer instead of Optional<&>.
* testing/Internals.cpp:
(WebCore::Internals::setVP9ScreenSizeAndScaleForTesting): Use a
form of construction for ScreenDataOverrides that works with both
WTF::Optional and std::optional. Something about way the old code
used WTF::makeOptional was not compatible with std::make_optional,
but it was easy to make it more straightforward and not even have
to use a "make" function.
2021-05-25 Simon Fraser <simon.fraser@apple.com>
Divide by zero in DisplayUpdate::relevantForUpdateFrequency()
https://bugs.webkit.org/show_bug.cgi?id=226224
<rdar://76894675>
Reviewed by Wenson Hsieh.
Check for non-zero preferredFramesPerSecond before using it as a denominator
to avoid divide by zero.
* platform/graphics/DisplayUpdate.cpp:
(WebCore::DisplayUpdate::relevantForUpdateFrequency const):
2021-05-25 Alan Bujtas <zalan@apple.com>
CrashOnOverflow in WebCore::RenderTable::cellBefore(WebCore::RenderTableCell const*)
https://bugs.webkit.org/show_bug.cgi?id=225949
Reviewed by Sergio Villar Senin.
The table section maintains a grid of rows and columns. This grid is used to jump to cells directly during layout (as opposed to tree walking).
It needs to be re-populated on tree mutations e.g when a new row is added to the table.
RenderTableSection::willInsertTableRow assumes that rows and cells are inserted subsequently, after each other and
it's ok to ignore the grid invalidation on the first row insertion (beforeChild is nullptr).
However in case of continuation split (e.g <table> is inside of an inline element and this inline element
needs to be split due to a block level box insertion), the row and all of its cells are cloned and inserted under the table section at once.
Test: fast/table/table-split-on-insert-with-section-crash.html
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::willInsertTableRow): fun fact: this code dates back to r3351 "The new table code from Lars.".
2021-05-25 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Percent height resolving quirk should stop at the table formatting context root
https://bugs.webkit.org/show_bug.cgi?id=226156
Reviewed by Darin Adler.
Test: fast/layoutformattingcontext/table-with-percent-height-descendant.html
* layout/formattingContexts/FormattingQuirks.h:
* layout/formattingContexts/table/TableFormattingQuirks.cpp:
(WebCore::Layout::TableFormattingQuirks::heightValueOfNearestContainingBlockWithFixedHeight const):
* layout/formattingContexts/table/TableFormattingQuirks.h:
2021-05-25 Chris Dumez <cdumez@apple.com>
Stop using UncheckedLock in DatabaseTracker
https://bugs.webkit.org/show_bug.cgi?id=226208
Reviewed by Sam Weinig.
Stop using UncheckedLock in DatabaseTracker. This is a step towards phasing out the
UncheckedLock in favor of the regular Lock which support Clang thread safety analysis.
In this particular instance, I have opted to annotate the functions that gave out
warning with WTF_IGNORES_THREAD_SAFETY_ANALYSIS. I initially tried to use proper
annotations (WTF_ACQUIRES_LOCK() / WTF_RELEASES_LOCK()). However, the call sites are
Objective C functions and I am unable to annotate those.
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::openDatabaseMutex):
* Modules/webdatabase/DatabaseTracker.h:
2021-05-25 Simon Fraser <simon.fraser@apple.com>
Initialize WebCore and WebKit logging channels in the GPU Process
https://bugs.webkit.org/show_bug.cgi?id=226210
Reviewed by Andy Estes.
Send the strings representing the enabled WebCore and WebKit logging channels to the
GPU Process, and use them to initialize log channels there, as we do for the WebContent
process.
* platform/LogInitialization.h: Export logLevelString().
* platform/Logging.h: Remove functions that are declared in LogInitialization.h.
* platform/mac/LoggingMac.mm:
2021-05-25 Enrique Ocaña González <eocanha@igalia.com>
[GTK] Layout test media/track/track-cue-missing.html is failing
https://bugs.webkit.org/show_bug.cgi?id=191004
Reviewed by Alicia Boya Garcia.
Implemented the missing performTaskAtMediaTime() method, needed by HTMLMediaElement::updateActiveTextTrackCues()
to trigger custom updates at times that don't fit in the regular updates statically scheduled every 250 ms.
The implementation uses triggerRepaint() for synchronization instead of timers, computing the current stream time
of the last video frame to be painted as an heuristic, instead of asking the position to the pipeline (more
expensive and risky from a non-main thread). If the stream time is beyond the task target time, the task is run
on the main thread.
Still, that is not enough. The task scheduled by HTMLMediaElement requires currentTime() to return an accurate
value, not one cached every 200ms. m_cachedTime needs to be updated more frequently (at least once every main
loop iteration), but still remain consistent along the whole iteration. This is achieved by enqueing an
invalidation task (to be run at the end of the current iteration) each time the cached value is set with a value
coming from a position query.
The changes in the m_cachedTime management add an overhead between 173% (track-cue-missing test) and 426%
(regular video playback without subtitles) in the run time spent querying the position to the pipeline. As an
optimization, the position is now directly queried to the audio and video sink and the highest value (according
to the current playback direction) is returned. This reduces the overhead to just 63% in the regular playback
without subtitles case.
The inner TaskAtMediaTimeScheduler class is used for task target time evaluation. As it can be used from the
main thread and from a secondary one in triggerRepaint(), it's wrapped in a DataMutex to manage concurrent
access. The original task is returned to the caller of checkTaskForScheduling() when the currentTime is beyond
the target time. The caller is then responsible of running the task externally in the main thread, out of the
influence of the DataMutex lock (the task can be expensive and the lock is only needed to evaluate the triggering
conditions).
Covered by existing tests.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(WebCore::MediaPlayerPrivateGStreamer::TaskAtMediaTimeScheduler::setTask): Configure the object with the right task, targetTime, and current playback direction.
(WebCore::MediaPlayerPrivateGStreamer::TaskAtMediaTimeScheduler::checkTaskForScheduling): Check if the task must run. In that case, return the task as result so the caller can run it externally on the main thread after the DataMutex lock has been released.
(WebCore::MediaPlayerPrivateGStreamer::invalidateCachedPosition): Implementation moved to the cpp file.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): Don't initialize m_cachedPosition, as it's now an Optional that will be initialized as no-value.
(WebCore::MediaPlayerPrivateGStreamer::playbackPosition const): Change the time based caching mechanism to a mainloop iteration based one. Directly query the sinks instead of the pipeline for position.
(WebCore::MediaPlayerPrivateGStreamer::asyncStateChangeDone): Invalidate the Optional, instead of setting an invalid MediaTime.
(WebCore::MediaPlayerPrivateGStreamer::updateStates): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::didEnd): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::performTaskAtMediaTime): Set the task on the TaskAtMediaTimeScheduler when the media is currently playing. That task will run at the target time. The HTMLMediaElement periodic update will already take care if the media isn't currently playing.
(WebCore::MediaPlayerPrivateGStreamer::invalidateCachedPosition const): Reset Optional<MediaTime> m_cachedTime.
(WebCore::MediaPlayerPrivateGStreamer::invalidateCachedPositionOnNextIteration const): Enqueue an invalidation on the next mainloop iteration.
(WebCore::MediaPlayerPrivateGStreamer::triggerRepaint): Check if the PendingTask needs to be run, using the streaming time of the last rendered sample as an approximate way to get the position, and run it if that's the case.
2021-05-25 Tim Nguyen <ntim@apple.com>
Add basic <dialog> element UA styles
https://bugs.webkit.org/show_bug.cgi?id=226169
Reviewed by Antti Koivisto.
Basic styles from https://html.spec.whatwg.org/#flow-content-3
* css/dialog.css:
(dialog):
2021-05-25 Frederic Wang <fwang@igalia.com>
Crash in CompositeEditCommand::splitTreeToNode via InsertParagraphSeparatorCommand::doApply
https://bugs.webkit.org/show_bug.cgi?id=225267
Reviewed by Ryosuke Niwa.
WebCore::Position::upstream behaves specially for table renderer, which may confuse the
execution of WebCore::InsertParagraphSeparatorCommand::doApply() when the visible position
is within a table, leading to a debug assertion failure and a nullptr dereference in release
build. In r273375, this was fixed for DOM elements with the table tag, but this does not work
for display: table. This patch instead directly calls isRenderedTable, for consistency with
WebCore::Position::upstream.
Test: fast/editing/paste-and-match-style-with-table-2-crash.html
* editing/markup.cpp:
(WebCore::createFragmentFromText): Use isRenderedTable instead of checking the tag name.
2021-05-25 Ian Gilbert <iang@apple.com>
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-24 Zan Dobersek <zdobersek@igalia.com>
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-24 Cathie Chen <cathiechen@igalia.com>
Use the parsed width and height attributes as a presentational hint for aspect-ratio CSS property
https://bugs.webkit.org/show_bug.cgi?id=217529
Reviewed by Antti Koivisto.
The feature "mapping attributes width and height to aspect ratio" currently is handled by RenderReplaced::computeIntrinsicRatioInformation.
However, per [1], the non-negative width and height attributes are expected to be used as a presentational hint for the aspect-ratio property.
This patch addes HTMLElement::applyAspectRatioFromWidthAndHeightAttributesToStyle to apply the attributes to m_presentationAttributeStyle.
Also this patch supports the feature for <video> and <input> with type="image".
[1] https://html.spec.whatwg.org/#map-to-the-aspect-ratio-property-(using-dimension-rules)
* html/HTMLElement.cpp:
(WebCore::HTMLElement::applyAspectRatioFromWidthAndHeightAttributesToStyle): Apply attributes width / height to aspectRatio of style if they aren't negative.
* html/HTMLElement.h:
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::collectStyleForPresentationAttribute): Use attributes width and height as a presentational hint for aspect-ratio.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::collectStyleForPresentationAttribute): If isImageButton(), collect attributes width and height as aspect-ratio of m_presentationAttributeStyle.
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::collectStyleForPresentationAttribute): Ditto.
* rendering/RenderImage.cpp:
(WebCore::RenderImage::computeIntrinsicRatioInformation const): The intrinsicRatio is logicalAspectRatio()
if error image is not showing alt text.
(WebCore::RenderImage::canMapWidthHeightToAspectRatio const): Deleted. Remove the legacy code.
* rendering/RenderImage.h:
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeIntrinsicRatioInformation const): Ditto.
(WebCore::RenderReplaced::intrinsicAspectRatioFromWidthHeight const): Deleted. Ditto.
* rendering/RenderReplaced.h:
(WebCore::RenderReplaced::canMapWidthHeightToAspectRatio const): Deleted. Ditto.
2021-05-24 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r277867.
https://bugs.webkit.org/show_bug.cgi?id=226211
Causes problems playing YouTube videos
Reverted changeset:
"[Cocoa] Last few seconds of 'audio/webm; codecs=vorbis'
appended to a SampleBuffer are not played"
https://bugs.webkit.org/show_bug.cgi?id=226069
https://trac.webkit.org/changeset/277867
2021-05-24 Sam Weinig <weinig@apple.com>
DestinationColorSpace's well known color space accessors cause unnecessary retain count churn
https://bugs.webkit.org/show_bug.cgi?id=226160
Reviewed by Darin Adler.
While unlikely to be hot, we can avoid unnecessary retain count churn of
the well known color spaces on DestinationColorSpace by switching their
signature to return a const-reference and storing/returning a static instance.
* platform/graphics/DestinationColorSpace.cpp:
(WebCore::knownColorSpace):
(WebCore::DestinationColorSpace::SRGB):
(WebCore::DestinationColorSpace::LinearSRGB):
(WebCore::DestinationColorSpace::DisplayP3):
* platform/graphics/DestinationColorSpace.h:
2021-05-24 Chris Dumez <cdumez@apple.com>
[GStreamer] Stop using UncheckedLock in VideoRenderRequestScheduler
https://bugs.webkit.org/show_bug.cgi?id=226192
Reviewed by Sam Weinig.
Stop using UncheckedLock in VideoRenderRequestScheduler to benefit from Clang thread safety
analysis.
* platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
(VideoRenderRequestScheduler::start):
(VideoRenderRequestScheduler::stop):
(VideoRenderRequestScheduler::drain):
(VideoRenderRequestScheduler::requestRender):
2021-05-24 Sam Weinig <weinig@apple.com>
Convert DestinationColorSpace from an enum to class wrapping a platform color space (CGColorSpaceRef for CG ports, etc.)
https://bugs.webkit.org/show_bug.cgi?id=226143
Reviewed by Darin Adler.
Replace enumeration based DestinationColorSpace with a struct wrapping
a platform color space (CGColorSpaceRef for CG ports, etc.). For ports
that don't have a platform level color space type, a builtin PlatformColorSpace
type is provided that is just the old enum renamed to PlatformColorSpace::Name.
The goal of this change is to unify the currently bifurcated concept of an
ImageBuffer's color space, which previosly could either be based on the
DestinationColorSpace (and reflected in the colorSpace() member function),
or (for CG ports) based on a CGColorSpaceRef, with the colorSpace() function
returning sRGB even if the ImageBuffer was not.
* Headers.cmake:
* Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp:
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::sanitizeDataIfNeeded):
* Modules/mediasession/MediaMetadata.cpp:
(WebCore::ArtworkImageLoader::notifyFinished):
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::dumpImageBitmap):
(WebCore::CloneDeserializer::readImageBitmap):
* css/CSSFilterImageValue.cpp:
(WebCore::CSSFilterImageValue::image):
* html/CustomPaintCanvas.cpp:
(WebCore::CustomPaintCanvas::copiedImage const):
* html/CustomPaintImage.cpp:
(WebCore::CustomPaintImage::drawPattern):
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::toMediaSample):
(WebCore::HTMLCanvasElement::createImageBuffer const):
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::createBufferForPainting const):
* html/HTMLVideoElement.h:
* html/ImageBitmap.cpp:
(WebCore::ImageBitmap::createImageBuffer):
(WebCore::ImageBitmap::createPromise):
* html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::commitToPlaceholderCanvas):
* html/canvas/CanvasRenderingContext.cpp:
(WebCore::CanvasRenderingContext::colorSpace const):
* html/canvas/CanvasRenderingContext.h:
* html/canvas/CanvasRenderingContext2D.cpp:
* html/canvas/ImageBitmapRenderingContext.cpp:
(WebCore::ImageBitmapRenderingContext::setOutputBitmap):
* html/canvas/PredefinedColorSpace.cpp:
(WebCore::toDestinationColorSpace):
(WebCore::toPredefinedColorSpace):
* html/canvas/PredefinedColorSpace.h:
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer):
* html/shadow/MediaControlTextTrackContainerElement.cpp:
(WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::indexForData):
(WebCore::InspectorCanvas::buildArrayForCanvasPattern):
* page/Chrome.cpp:
(WebCore::Chrome::createImageBuffer const):
* page/Chrome.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::createImageBuffer const):
* page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRectWithClip):
* page/PageColorSampler.cpp:
(WebCore::sampleColor):
* page/PageConsoleClient.cpp:
(WebCore::PageConsoleClient::screenshot):
* platform/HostWindow.h:
* platform/PlatformColorSpace.h: Added.
(WebCore::PlatformColorSpace::get const):
* platform/PlatformScreen.h:
* platform/ScreenProperties.h:
(WebCore::ScreenProperties::encode const):
(WebCore::ScreenData::encode const):
(WebCore::ScreenData::decode):
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::preTransformedNativeImageForCurrentFrame):
(WebCore::BitmapImage::drawPattern):
* platform/graphics/Color.cpp:
(WebCore::Color::toColorComponentsInColorSpace const):
* platform/graphics/Color.h:
* platform/graphics/ColorConversion.cpp:
(WebCore::converColorComponents):
* platform/graphics/ColorConversion.h:
* platform/graphics/ColorSpace.cpp:
* platform/graphics/ColorSpace.h:
* platform/graphics/ConcreteImageBuffer.h:
(WebCore::ConcreteImageBuffer::create):
* platform/graphics/CrossfadeGeneratedImage.cpp:
(WebCore::CrossfadeGeneratedImage::drawPattern):
* platform/graphics/DestinationColorSpace.cpp: Added.
(WebCore::DestinationColorSpace::SRGB):
(WebCore::DestinationColorSpace::LinearSRGB):
(WebCore::DestinationColorSpace::DisplayP3):
(WebCore::DestinationColorSpace::DestinationColorSpace):
(WebCore::operator==):
(WebCore::operator!=):
(WebCore::operator<<):
* platform/graphics/DestinationColorSpace.h: Added.
(WebCore::DestinationColorSpace::platformColorSpace const):
(WebCore::DestinationColorSpace::encode const):
(WebCore::DestinationColorSpace::decode):
* platform/graphics/GradientImage.cpp:
(WebCore::GradientImage::drawPattern):
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::clipToDrawingCommands):
* platform/graphics/GraphicsContext.h:
* platform/graphics/GraphicsContextImpl.h:
* platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::create):
(WebCore::ImageBuffer::createCompatibleBuffer):
(WebCore::ImageBuffer::copyRectToBuffer):
* platform/graphics/ImageBuffer.h:
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::getPixelBuffer const):
(WebCore::ImageBufferBackend::putPixelBuffer):
* platform/graphics/ImageBufferBackend.h:
(WebCore::ImageBufferBackend::transformColorSpace):
(WebCore::ImageBufferBackend::colorSpace const):
* platform/graphics/PixelBuffer.h:
(WebCore::PixelBuffer::decode):
* platform/graphics/PixelBufferConversion.cpp:
(WebCore::makeVImageCGImageFormat):
* platform/graphics/PixelBufferFormat.h:
(WebCore::PixelBufferFormat::decode):
* platform/graphics/RemoteVideoSample.cpp:
(WebCore::transferBGRAPixelBufferToIOSurface):
(WebCore::RemoteVideoSample::create):
(WebCore::RemoteVideoSample::RemoteVideoSample):
(WebCore::RemoteVideoSample::surface const):
* platform/graphics/RemoteVideoSample.h:
* platform/graphics/ShadowBlur.cpp:
(WebCore::ScratchBuffer::getScratchBuffer):
(WebCore::ShadowBlur::drawRectShadowWithoutTiling):
(WebCore::ShadowBlur::drawInsetShadowWithoutTiling):
(WebCore::ShadowBlur::drawRectShadowWithTiling):
(WebCore::ShadowBlur::drawInsetShadowWithTiling):
(WebCore::ShadowBlur::blurShadowBuffer):
(WebCore::ShadowBlur::drawShadowLayer):
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::readPixelsForPaintResults):
* platform/graphics/cairo/ImageBufferCairoBackend.cpp:
(WebCore::ImageBufferCairoBackend::transformColorSpace):
* platform/graphics/cairo/ImageBufferCairoBackend.h:
* platform/graphics/cg/ColorCG.cpp:
(WebCore::convertToCGCompatibleComponents):
(WebCore::createCGColor):
(WebCore::platformConvertColorComponents):
* platform/graphics/cg/ColorSpaceCG.h:
(WebCore::cachedCGColorSpace): Deleted.
* platform/graphics/cg/GraphicsContextGLCG.cpp:
(WebCore::GraphicsContextGLOpenGL::paintToCanvas):
* platform/graphics/cg/IOSurfacePool.cpp:
(WebCore::surfaceMatchesParameters):
(WebCore::IOSurfacePool::takeSurface):
* platform/graphics/cg/IOSurfacePool.h:
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::createBitmapImageAfterScalingIfNeeded):
(WebCore::ImageBufferCGBackend::copyCGImageForEncoding const):
* platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
(WebCore::ImageBufferCGBitmapBackend::create):
(WebCore::ImageBufferCGBitmapBackend::copyNativeImage const):
* platform/graphics/cg/ImageBufferCGBitmapBackend.h:
* platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
(WebCore::ImageBufferIOSurfaceBackend::create):
* platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
* platform/graphics/cg/ImageBufferUtilitiesCG.cpp:
(WebCore::encode):
* platform/graphics/cg/NativeImageCG.cpp:
(WebCore::NativeImage::singlePixelSolidColor const):
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::allocateAndBindDisplayBufferBacking):
* platform/graphics/cocoa/IOSurface.h:
* platform/graphics/cocoa/IOSurface.mm:
(WebCore::IOSurface::surfaceFromPool):
(WebCore::IOSurface::create):
(WebCore::IOSurface::createFromSendRight):
(WebCore::IOSurface::createFromSurface):
(WebCore::IOSurface::createFromImage):
(WebCore::IOSurface::createFromPixelBuffer):
(WebCore::IOSurface::IOSurface):
(WebCore::IOSurface::ensurePlatformContext):
(WebCore::IOSurface::migrateColorSpaceToProperties):
* platform/graphics/coreimage/FilterEffectRendererCoreImage.mm:
(WebCore::FilterEffectRendererCoreImage::renderToImageBuffer):
* platform/graphics/cv/ImageTransferSessionVT.mm:
(WebCore::ImageTransferSessionVT::createPixelBuffer):
* platform/graphics/cv/PixelBufferConformerCV.cpp:
(WebCore::PixelBufferConformerCV::createImageFromPixelBuffer):
* platform/graphics/displaylists/DisplayListImageBuffer.h:
(WebCore::DisplayList::ImageBuffer::create):
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemHandle::destroy):
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::BeginClipToDrawingCommands::BeginClipToDrawingCommands):
(WebCore::DisplayList::BeginClipToDrawingCommands::colorSpace const):
(WebCore::DisplayList::BeginClipToDrawingCommands::encode const):
(WebCore::DisplayList::BeginClipToDrawingCommands::decode):
(WebCore::DisplayList::GetPixelBuffer::GetPixelBuffer):
(WebCore::DisplayList::GetPixelBuffer::outputFormat const):
(WebCore::DisplayList::GetPixelBuffer::encode const):
(WebCore::DisplayList::GetPixelBuffer::decode):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::clipToDrawingCommands):
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/filters/FEDisplacementMap.cpp:
(WebCore::FEDisplacementMap::setResultColorSpace):
* platform/graphics/filters/FEDisplacementMap.h:
* platform/graphics/filters/FEFlood.h:
* platform/graphics/filters/FETile.cpp:
(WebCore::FETile::platformApplySoftware):
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::convertPixelBufferToColorSpace):
(WebCore::FilterEffect::convertImageBufferToColorSpace):
(WebCore::FilterEffect::copyConvertedImageBufferToDestination):
(WebCore::FilterEffect::copyConvertedPixelBufferToDestination):
(WebCore::FilterEffect::requiresPixelBufferColorSpaceConversion):
(WebCore::FilterEffect::transformResultColorSpace):
* platform/graphics/filters/FilterEffect.h:
(WebCore::FilterEffect::operatingColorSpace const):
(WebCore::FilterEffect::setOperatingColorSpace):
(WebCore::FilterEffect::resultColorSpace const):
(WebCore::FilterEffect::setResultColorSpace):
* platform/graphics/filters/SourceGraphic.h:
(WebCore::SourceGraphic::SourceGraphic):
* platform/gtk/PlatformScreenGtk.cpp:
(WebCore::screenColorSpace):
* platform/ios/PlatformScreenIOS.mm:
(WebCore::screenColorSpace):
(WebCore::collectScreenProperties):
* platform/mac/PlatformScreenMac.mm:
(WebCore::collectScreenProperties):
(WebCore::screenColorSpace):
* platform/mac/ThemeMac.mm:
(WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
* platform/mediastream/mac/ScreenDisplayCapturerMac.mm:
(WebCore::ScreenDisplayCapturerMac::createDisplayStream):
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::imageBuffer const):
* platform/playstation/PlatformScreenPlayStation.cpp:
(WebCore::screenColorSpace):
* platform/win/PlatformScreenWin.cpp:
(WebCore::screenColorSpace):
* platform/wpe/PlatformScreenWPE.cpp:
(WebCore::screenColorSpace):
* platform/xr/PlatformXR.h:
(PlatformXR::Device::FrameData::LayerData::decode):
* rendering/CSSFilter.cpp:
(WebCore::CSSFilter::buildReferenceFilter):
(WebCore::CSSFilter::build):
(WebCore::CSSFilter::allocateBackingStoreIfNeeded):
(WebCore::CSSFilter::apply):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
* rendering/RenderLayerBacking.cpp:
(WebCore::patternForDescription):
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::paintSystemPreviewBadge):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintProgressBar):
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createRasterShape):
* rendering/svg/RenderSVGResourceClipper.cpp:
(WebCore::RenderSVGResourceClipper::applyClippingToContext):
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::buildPrimitives const):
(WebCore::RenderSVGResourceFilter::applyResource):
(WebCore::RenderSVGResourceFilter::postApplyResource):
* rendering/svg/RenderSVGResourceGradient.cpp:
(WebCore::createMaskAndSwapContextForTextGradient):
* rendering/svg/RenderSVGResourceMasker.cpp:
(WebCore::RenderSVGResourceMasker::applyResource):
(WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):
* rendering/svg/RenderSVGResourceMasker.h:
* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::createTileImage const):
* rendering/svg/SVGRenderingContext.cpp:
(WebCore::SVGRenderingContext::createImageBuffer):
(WebCore::SVGRenderingContext::bufferForeground):
* rendering/svg/SVGRenderingContext.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::nativeImage):
(WebCore::SVGImage::drawPatternForContainer):
* svg/graphics/filters/SVGFEImage.cpp:
(WebCore::FEImage::platformApplySoftware):
2021-05-24 Alan Bujtas <zalan@apple.com>
[LFC] Add support for geometry/quirks virtual functions
https://bugs.webkit.org/show_bug.cgi?id=226150
Reviewed by Antti Koivisto.
This enables us to override quirks/geometry functionality at the subclasses.
* layout/formattingContexts/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
(WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry):
(WebCore::Layout::FormattingContext::computeBorderAndPadding):
(WebCore::Layout::FormattingContext::layoutOutOfFlowContent):
(WebCore::Layout::FormattingContext::geometry const): Deleted.
(WebCore::Layout::FormattingContext::quirks const): Deleted.
* layout/formattingContexts/FormattingContext.h:
* layout/formattingContexts/FormattingGeometry.cpp:
(WebCore::Layout::FormattingGeometry::computedHeightValue const):
* layout/formattingContexts/FormattingGeometry.h:
(WebCore::Layout::FormattingGeometry::isBlockFormattingGeometry const):
(WebCore::Layout::FormattingGeometry::isInlineFormattingGeometry const):
(WebCore::Layout::FormattingGeometry::isFlexFormattingGeometry const):
(WebCore::Layout::FormattingGeometry::isTableFormattingGeometry const):
* layout/formattingContexts/FormattingQuirks.cpp:
(WebCore::Layout::FormattingQuirks::heightValueOfNearestContainingBlockWithFixedHeight const):
* layout/formattingContexts/FormattingQuirks.h:
(WebCore::Layout::FormattingQuirks::isBlockFormattingQuirks const):
(WebCore::Layout::FormattingQuirks::isInlineFormattingQuirks const):
(WebCore::Layout::FormattingQuirks::isTableFormattingQuirks const):
* layout/formattingContexts/block/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
(WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
(WebCore::Layout::BlockFormattingContext::placeInFlowPositionedChildren):
(WebCore::Layout::BlockFormattingContext::computeStaticVerticalPosition):
(WebCore::Layout::BlockFormattingContext::computeStaticHorizontalPosition):
(WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForBoxAndAncestors):
(WebCore::Layout::BlockFormattingContext::computeWidthAndMargin):
(WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
(WebCore::Layout::BlockFormattingContext::computedIntrinsicWidthConstraints):
(WebCore::Layout::BlockFormattingContext::geometry const): Deleted.
* layout/formattingContexts/block/BlockFormattingContext.h:
(WebCore::Layout::BlockFormattingContext::formattingState):
(WebCore::Layout::BlockFormattingContext::blockFormattingGeometry const):
(WebCore::Layout::BlockFormattingContext::blockFormattingQuirks const):
* layout/formattingContexts/block/BlockFormattingGeometry.cpp:
(WebCore::Layout::BlockFormattingGeometry::inFlowContentHeightAndMargin const):
* layout/formattingContexts/block/BlockFormattingGeometry.h:
* layout/formattingContexts/block/BlockFormattingQuirks.cpp:
(WebCore::Layout::BlockFormattingQuirks::stretchedInFlowHeightIfApplicable const):
* layout/formattingContexts/block/BlockFormattingQuirks.h:
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp:
(WebCore::Layout::TableWrapperBlockFormattingContext::TableWrapperBlockFormattingContext):
(WebCore::Layout::TableWrapperBlockFormattingContext::layoutTableBox):
(WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox):
(WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox):
(WebCore::Layout::TableWrapperBlockFormattingContext::computeHeightAndMarginForTableBox):
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.h:
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingQuirks.cpp:
(WebCore::Layout::TableWrapperQuirks::overriddenTableHeight const):
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingQuirks.h:
* layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::FlexFormattingContext):
(WebCore::Layout::FlexFormattingContext::sizeAndPlaceFlexItems):
(WebCore::Layout::FlexFormattingContext::computeIntrinsicWidthConstraintsForFlexItems):
(WebCore::Layout::FlexFormattingContext::geometry const): Deleted.
* layout/formattingContexts/flex/FlexFormattingContext.h:
* layout/formattingContexts/flex/FlexFormattingGeometry.h:
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
(WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
(WebCore::Layout::InlineFormattingContext::lineLayout):
(WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
(WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingRoot):
(WebCore::Layout::InlineFormattingContext::computeHorizontalMargin):
(WebCore::Layout::InlineFormattingContext::computeWidthAndMargin):
(WebCore::Layout::InlineFormattingContext::computeHeightAndMargin):
(WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
(WebCore::Layout::InlineFormattingContext::geometry const): Deleted.
* layout/formattingContexts/inline/InlineFormattingContext.h:
* layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::LineBoxBuilder::computeLineBoxHeightAndAlignInlineLevelBoxesVertically):
(WebCore::Layout::InlineFormattingGeometry::lineBoxForLineContent const):
(WebCore::Layout::InlineFormattingGeometry::inlineLevelBoxAffectsLineBox const):
(WebCore::Layout::InlineFormattingGeometry::lineBoxForLineContent): Deleted.
* layout/formattingContexts/inline/InlineFormattingGeometry.h:
* layout/formattingContexts/inline/InlineFormattingQuirks.h:
* layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::isAtSoftWrapOpportunity):
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::TableFormattingContext):
(WebCore::Layout::TableFormattingContext::setUsedGeometryForRows):
(WebCore::Layout::TableFormattingContext::layoutCell):
(WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns):
(WebCore::Layout::TableFormattingContext::computeAndDistributeExtraSpace):
(WebCore::Layout::TableFormattingContext::geometry const): Deleted.
* layout/formattingContexts/table/TableFormattingContext.h:
* layout/formattingContexts/table/TableFormattingGeometry.h:
* layout/formattingContexts/table/TableFormattingQuirks.h:
* layout/formattingContexts/table/TableLayout.cpp:
(WebCore::Layout::TableFormattingContext::TableLayout::distributedVerticalSpace):
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayNonRootInlineBoxes const):
2021-05-24 Darin Adler <darin@apple.com>
Remove StringBuilder::appendLiteral
https://bugs.webkit.org/show_bug.cgi?id=226137
Reviewed by Chris Dumez.
* Modules/fetch/FetchBodyConsumer.cpp:
(WebCore::packageFormData): Use auto for the result of makeString.
* Modules/indexeddb/IDBKeyData.cpp:
(WebCore::IDBKeyData::loggingString const): Use append instead
of appendLiteral.
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): Use auto
for the result of makeString.
* Modules/indexeddb/server/SQLiteIDBCursor.cpp:
(WebCore::IDBServer::buildPreIndexStatement): Use makeString
instead of StringBuilder.
(WebCore::IDBServer::buildIndexStatement): Ditto.
(WebCore::IDBServer::buildObjectStoreStatement): Ditto.
* Modules/websockets/WebSocket.cpp:
(WebCore::encodeProtocolString): Use append instead of appendLiteral.
* Modules/websockets/WebSocketExtensionDispatcher.cpp:
(WebCore::WebSocketExtensionDispatcher::appendAcceptedExtension): Ditto.
* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::WebSocketHandshake::clientHandshakeMessage const): Use
makeString instead of StringBuilder.
(WebCore::WebSocketHandshake::clientHandshakeRequest const): Tweak
to match the function above more closely, and use ASCIILiteral.
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(formatForDebugger): Use makeString instead of StringBuilder.
* contentextensions/CombinedURLFilters.cpp:
(WebCore::ContentExtensions::prefixTreeVertexToString): Use
append instead of appendLiteral.
* css/CSSBasicShapes.cpp:
(WebCore::buildCircleString): Ditto.
(WebCore::buildEllipseString): Ditto.
(WebCore::buildPathString): Ditto.
(WebCore::buildPolygonString): Ditto.
(WebCore::buildInsetString): Ditto.
* css/CSSGradientValue.cpp:
(WebCore::CSSLinearGradientValue::customCSSText const): Ditto.
(WebCore::CSSRadialGradientValue::customCSSText const): Ditto.
(WebCore::CSSConicGradientValue::customCSSText const): Ditto.
* css/CSSGridIntegerRepeatValue.cpp:
(WebCore::CSSGridIntegerRepeatValue::customCSSText const):
Use makeString instead of StringBuilder.
* css/CSSImageSetValue.cpp:
(WebCore::CSSImageSetValue::customCSSText const): Use append
instead of appendLiteral.
* css/CSSImportRule.cpp:
(WebCore::CSSImportRule::cssText const): Use makeString instead
of StringBuilder.
* css/CSSKeyframeRule.cpp:
(WebCore::StyleRuleKeyframe::cssText const): Ditto.
* css/CSSKeyframesRule.cpp:
(WebCore::CSSKeyframesRule::cssText const): Use variadic append.
* css/CSSLineBoxContainValue.cpp:
(WebCore::CSSLineBoxContainValue::customCSSText const): Use
append instead of appendLiteral.
* css/CSSNamespaceRule.cpp:
(WebCore::CSSNamespaceRule::cssText const): Ditto.
* css/CSSPageRule.cpp:
(WebCore::CSSPageRule::cssText const): Use makeString instead of
StringBuilder.
* css/CSSPaintImageValue.cpp:
(WebCore::CSSPaintImageValue::customCSSText const): Ditto.
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):
Use append instead of appendLiteral.
* css/CSSSelector.cpp:
(WebCore::appendLangArgumentList): Use variadic append.
(WebCore::CSSSelector::selectorText const): Ditto. Also use
append instead of appendLiteral and make some improvements to
cut down on allocations a little.
* css/CSSSelectorList.cpp:
(WebCore::CSSSelectorList::buildSelectorsText const): Use
append instead of appendLiteral.
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::CSSStyleSheet): Moved more of the
data member initialization to the class definition.
(WebCore::CSSStyleSheet::addRule): Use makeString instead of
StringBuilder.
* css/CSSStyleSheet.h: Moved initialization here.
* css/CSSTimingFunctionValue.cpp:
(WebCore::CSSStepsTimingFunctionValue::customCSSText const):
Use makeString instead of StringBuilder.
(WebCore::CSSSpringTimingFunctionValue::customCSSText const):
Ditto.
* css/MediaList.cpp:
(WebCore::MediaQuerySet::mediaText const): Use append instead
of appendLiteral.
* css/MediaQuery.cpp:
(WebCore::MediaQuery::serialize const): Ditto.
* css/MediaQueryExpression.cpp:
(WebCore::MediaQueryExpression::serialize const): Use makeString
instead of StringBuilder.
* css/StyleProperties.cpp:
(WebCore::StyleProperties::getLayeredShorthandValue const):
Use append instead of appendLiteral.
* css/parser/CSSParserToken.cpp:
(WebCore::CSSParserToken::serialize const): Removed a lot of
unnecessary braces. Use variadic append and append instead of appendLiteral.
* dom/Document.cpp:
(WebCore::Document::initSecurityContext): Use auto for the result
of makeString.
* dom/Element.cpp:
(WebCore::appendAttributes): Use variadic append and append
instead of appendLiteral.
* dom/SecurityContext.cpp:
(WebCore::SecurityContext::parseSandboxPolicy): Ditto.
* editing/HTMLInterchange.cpp:
(WebCore::convertHTMLTextToInterchangeFormat): Ditto.
* editing/TextIterator.cpp:
(WebCore::createSearcher): Use auto for the result of makeString.
* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::appendStyleNodeOpenTag):
Use append instead of appendLiteral.
(WebCore::StyledMarkupAccumulator::appendStartTag): Ditto.
(WebCore::urlToMarkup): Ditto.
* html/FormController.cpp:
(WebCore::recordFormStructure): Ditto.
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::reportValidity): Use auto for
the result of makeString.
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::validateInteractively): Ditto.
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::completeURLsInAttributeValue const):
Use append insteaed of appendLiteral.
* html/MediaElementSession.cpp:
(WebCore::restrictionNames): Use auto for the result of makeString.
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::getUniformLocation): Ditto.
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeRemaining): Ditto.
* html/parser/XSSAuditorDelegate.cpp:
(WebCore::buildConsoleError): Use makeString instead of StringBuilder.
* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::rebuildDisplayTree): Ditto.
* inspector/InspectorFrontendAPIDispatcher.cpp:
(WebCore::expressionForEvaluatingCommand): Use append instead of appendLiteral.
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::drawElementTitle): Use auto for the result of makeString.
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::addRule): Use append instead of appendLiteral.
* inspector/agents/InspectorApplicationCacheAgent.cpp:
(WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCacheResource):
Use makeString instead of StringBuilder.
* inspector/agents/WebConsoleAgent.cpp:
(WebCore::WebConsoleAgent::didReceiveResponse): Use auto for the result of makeString.
(WebCore::WebConsoleAgent::didFailLoading): Ditto.
* loader/MixedContentChecker.cpp:
(WebCore::logWarning): Ditto
(WebCore::MixedContentChecker::checkFormForMixedContent): Ditto
* loader/PrivateClickMeasurement.cpp:
(WebCore::makeValidURL): Added. Used for various cases below that all construct
URLs in the same way with the same kinds of checks. Use makeString here instead
of StringBuilder.
(WebCore::attributionReportURL): Call makeValidURL.
(WebCore::PrivateClickMeasurement::tokenSignatureURL const): Ditto.
(WebCore::PrivateClickMeasurement::tokenPublicKeyURL const): Ditto.
* loader/ResourceLoadStatistics.cpp:
(WebCore::appendBoolean): Use append instead of appendLiteral.
(WebCore::appendHashSet): Ditto.
(WebCore::appendNavigatorAPIOptionSet): Ditto.
(WebCore::appendScreenAPIOptionSet): Ditto.
(WebCore::ResourceLoadStatistics::toString const): Ditto.
* loader/WorkerThreadableLoader.cpp:
(WebCore::WorkerThreadableLoader::loadResourceSynchronously): Use auto for
the result of makeString.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::postMessage): Ditto.
* page/Frame.cpp:
(WebCore::createRegExpForLabels): Use append instead of appendLiteral.
Also tweak coding style a bit.
* page/FrameView.cpp:
(WebCore::FrameView::logMockScrollAnimatorMessage const): Use makeString
instead of StringBuilder.
* page/PageSerializer.cpp:
(WebCore::PageSerializer::SerializerMarkupAccumulator::appendStartTag):
Use append instead of appendLiteral.
(WebCore::PageSerializer::serializeCSSStyleSheet): Ditto.
(WebCore::PageSerializer::urlForBlankFrame): Use auto for the result of
makeString.
* page/PerformanceLoggingClient.cpp:
(WebCore::PerformanceLoggingClient::synchronousScrollingReasonsAsString):
Use makeString instead of StringBuilder.
* page/cocoa/ResourceUsageOverlayCocoa.mm:
(WebCore::ResourceUsageOverlay::platformDraw): Use auto for the result of
makeString.
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::consoleMessageForViolation): Use makeString instsead of StringBuilder.
(WebCore::ContentSecurityPolicy::allowRunningOrDisplayingInsecureContent): Ditto.
(WebCore::ContentSecurityPolicy::reportInvalidDirectiveValueCharacter const):
Get rid of local variable for result of makeString.
(WebCore::ContentSecurityPolicy::reportInvalidPathCharacter const): Ditto.
(WebCore::ContentSecurityPolicy::reportInvalidSourceExpression const): Ditto.
* page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::ContentSecurityPolicyDirectiveList::create): Get rid of local
variable for result of makeString.
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText):
Use makeString instead of StringBulder.
* platform/Decimal.cpp:
(WebCore::Decimal::toString const): Use append instead of appendLiteral.
* platform/animation/TimingFunction.cpp:
(WebCore::TimingFunction::createFromCSSText): Use makeString instead
of StringBuilder.
* platform/audio/HRTFElevation.cpp:
(WebCore::HRTFElevation::calculateKernelsForAzimuthElevation): Use auto
for the result of makeString.
* platform/glib/UserAgentGLib.cpp:
(WebCore::buildUserAgentString): Use append instead of appendLiteral.
* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::InbandTextTrackPrivateAVF::processCueAttributes): Use
append instead of appendLiteral.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::recursiveCommitChanges): Got rid of local
variable for result of makeString.
(WebCore::GraphicsLayerCA::appendToUncommittedAnimations): Use auto
for result of makeString.
* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::tileRevalidationTimerFired): Update to
use OptionSet.
* platform/graphics/ca/TileGrid.cpp:
(WebCore::validationPolicyAsString): Use OptionSet.
(WebCore::TileGrid::setNeedsDisplayInRect): Use auto for iterator
and range-based for loop.
(WebCore::TileGrid::updateTileLayerProperties): Ditto.
(WebCore::TileGrid::blankPixelCount const): Ditto.
(WebCore::TileGrid::removeTiles): Use HashCountedSet.
(WebCore::TileGrid::revalidateTiles): Use OptionSet.
(WebCore::TileGrid::retainedTileBackingStoreMemory const): Use
ranged-based for loop.
(WebCore::TileGrid::drawTileMapContents const): Use range-based
for loop and use writeIntegerToBuffer instead of String::number.
(WebCore::TileGrid::platformCALayerRepaintCount const): Use
HashCountedSet.
(WebCore::TileGrid::platformCALayerIncrementRepaintCount): Ditto.
This cuts us down from 3 hash table lookups to 1.
(WebCore::TileGrid::removeUnparentedTilesNow): Removed local
variable to make code a little tighter.
* platform/graphics/ca/TileGrid.h: Use OptionSet and HashCountedSet.
Removed some type names.
* platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
(WebCore::PlatformCAFilters::setFiltersOnLayer): Use auto for
reuslt of makeString.
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::drawText): Ditto.
* platform/mock/ScrollAnimatorMock.cpp:
(WebCore::ScrollAnimatorMock::scrollbarPrefix const): Added
helper function for use below.
(WebCore::ScrollAnimatorMock::mouseEnteredScrollbar const): Use
makeString instead of StringBuilder.
(WebCore::ScrollAnimatorMock::mouseExitedScrollbar const): Ditto.
(WebCore::ScrollAnimatorMock::mouseIsDownInScrollbar const): Ditto.
* platform/mock/ScrollAnimatorMock.h: Ditto.
* platform/network/ProxyServer.cpp:
(WebCore::appendProxyServerString): Use append instead of appendLiteral.
(WebCore::toString): Ditto.
* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::sanitizeSuggestedFilename): Get rid
of local variable with result of maekString in it.
* platform/playstation/UserAgentPlayStation.cpp:
(WebCore::platformForUAString): Deleted. No need for a global variable
to hold the result of something called only once.
(WebCore::platformVersionForUAString): Ditto.
(WebCore::buildUserAgentString): Deleted.
(WebCore::standardUserAgentStatic): Moved the logic from buildUserAgentString
here, using makeString instead of StringBuilder.
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::open): Use auto for result of makeString.
* platform/sql/SQLiteFileSystem.cpp:
(WebCore::SQLiteFileSystem::deleteDatabaseFile): Ditto.
* platform/text/DateTimeFormat.cpp:
(WebCore::DateTimeFormat::quoteAndAppendLiteral): Use append instead
of appendLiteral and StringView::substring instead of String::substring.
* platform/win/ClipboardUtilitiesWin.cpp:
(WebCore::replaceNewlinesWithWindowsStyleNewlines): Use append
instead of appendLiteral.
* platform/win/UserAgentWin.cpp:
(WebCore::standardUserAgent): Use makeString instead of StringBuildeer.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::name const): Ditto.
(WebCore::RenderLayer::debugDescription const): Ditto.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::logLayerInfo): Use append instead of
appendLiteral.
* rendering/RenderTreeAsText.cpp:
(WebCore::quoteAndEscapeNonPrintables): Ditto.
(WebCore::nodePosition): Ditto.
* svg/SVGPathStringBuilder.cpp:
(WebCore::SVGPathStringBuilder::moveTo): Ditto.
(WebCore::SVGPathStringBuilder::lineTo): Ditto.
(WebCore::SVGPathStringBuilder::lineToHorizontal): Ditto.
(WebCore::SVGPathStringBuilder::lineToVertical): Ditto.
(WebCore::SVGPathStringBuilder::curveToCubic): Ditto.
(WebCore::SVGPathStringBuilder::curveToCubicSmooth): Ditto.
(WebCore::SVGPathStringBuilder::curveToQuadratic): Ditto.
(WebCore::SVGPathStringBuilder::curveToQuadraticSmooth): Ditto.
(WebCore::SVGPathStringBuilder::arcTo): Ditto.
(WebCore::SVGPathStringBuilder::closePath): Ditto.
* testing/Internals.cpp:
(WebCore::Internals::dumpMarkerRects): Ditto.
(WebCore::appendOffsets):
(WebCore::Internals::scrollSnapOffsets): Ditto.
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::validateWorkerResponse): Use auto
for reuslt of makeString.
2021-05-24 Chris Dumez <cdumez@apple.com>
Stop using UncheckedLock in ShadowBlur's ScratchBuffer
https://bugs.webkit.org/show_bug.cgi?id=226183
Reviewed by Simon Fraser.
Stop using UncheckedLock in ShadowBlur's ScratchBuffer to benefit from Clang
Thread Safety Analysis. Note that I had to factor the code a bit differently
because analysis doesn't support conditionally held locks. I could have also
used WTF_IGNORES_THREAD_SAFETY_ANALYSIS but I think it is better to factor
the code so that we do get the validation.
* platform/graphics/ShadowBlur.cpp:
(WebCore::ScratchBuffer::WTF_REQUIRES_LOCK):
(WebCore::ScratchBuffer::WTF_RETURNS_LOCK):
(WebCore::ShadowBlur::drawRectShadowWithTiling):
(WebCore::ShadowBlur::drawRectShadowWithTilingWithLayerImageBuffer):
(WebCore::ShadowBlur::drawInsetShadowWithTiling):
(WebCore::ShadowBlur::drawInsetShadowWithTilingWithLayerImageBuffer):
* platform/graphics/ShadowBlur.h:
2021-05-24 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r277940.
https://bugs.webkit.org/show_bug.cgi?id=226182
Caused Safari crash under IPC::typeFromCFTypeRef
Reverted changeset:
"Convert DestinationColorSpace from an enum to class wrapping
a platform color space (CGColorSpaceRef for CG ports, etc.)"
https://bugs.webkit.org/show_bug.cgi?id=226143
https://trac.webkit.org/changeset/277940
2021-05-24 Chris Dumez <cdumez@apple.com>
Drop CheckedLock / CheckedCondition aliases
https://bugs.webkit.org/show_bug.cgi?id=226176
Reviewed by Kate Cheney.
Drop CheckedLock / CheckedCondition aliases now that they are the default.
* Modules/indexeddb/IDBObjectStore.h:
* Modules/indexeddb/IDBTransaction.h:
* Modules/indexeddb/client/IDBConnectionProxy.h:
* Modules/indexeddb/server/IDBSerializationContext.cpp:
* Modules/indexeddb/server/IDBServer.cpp:
* Modules/mediastream/RTCDataChannel.cpp:
* Modules/mediastream/RTCRtpSFrameTransformer.h:
* Modules/mediastream/RTCRtpScriptTransform.h:
* Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.h:
* Modules/speech/SpeechRecognitionCaptureSourceImpl.h:
* Modules/webaudio/AudioParamTimeline.h:
* Modules/webaudio/MediaElementAudioSourceNode.h:
* Modules/webdatabase/Database.cpp:
* Modules/webdatabase/Database.h:
* Modules/webdatabase/DatabaseManager.h:
* Modules/webdatabase/DatabaseTask.h:
* Modules/webdatabase/DatabaseThread.h:
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::openDatabaseMutex):
* Modules/webdatabase/DatabaseTracker.h:
* Modules/webdatabase/OriginLock.cpp:
* Modules/webdatabase/SQLCallbackWrapper.h:
* Modules/webdatabase/SQLTransaction.h:
* Modules/webgpu/WebGPUDevice.cpp:
(WebCore::WebGPUDevice::instancesLock):
* Modules/webgpu/WebGPUDevice.h:
* Modules/webgpu/WebGPUPipeline.cpp:
(WebCore::WebGPUPipeline::instancesLock):
* Modules/webgpu/WebGPUPipeline.h:
* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::allActiveWebSocketsLock):
* Modules/websockets/WebSocket.h:
* accessibility/isolatedtree/AXIsolatedTree.cpp:
* accessibility/isolatedtree/AXIsolatedTree.h:
* bindings/js/JSDOMGlobalObject.h:
* bridge/objc/WebScriptObject.mm:
* crypto/CryptoAlgorithmRegistry.h:
* dom/MessagePort.cpp:
* dom/Node.cpp:
* dom/ScriptExecutionContext.cpp:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::createMediaPlayer):
* html/canvas/CanvasRenderingContext.cpp:
(WebCore::CanvasRenderingContext::instancesLock):
* html/canvas/CanvasRenderingContext.h:
* html/canvas/WebGLContextGroup.cpp:
(WebCore::WebGLContextGroup::objectGraphLockForAContext):
* html/canvas/WebGLContextGroup.h:
* html/canvas/WebGLContextObject.cpp:
(WebCore::WebGLContextObject::objectGraphLockForContext):
* html/canvas/WebGLContextObject.h:
* html/canvas/WebGLObject.h:
* html/canvas/WebGLProgram.cpp:
(WebCore::WebGLProgram::instancesLock):
* html/canvas/WebGLProgram.h:
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::objectGraphLock):
* html/canvas/WebGLRenderingContextBase.h:
* html/canvas/WebGLSharedObject.cpp:
(WebCore::WebGLSharedObject::objectGraphLockForContext):
* html/canvas/WebGLSharedObject.h:
* inspector/agents/WebHeapAgent.cpp:
* page/ResourceUsageThread.h:
* page/SecurityPolicy.cpp:
* page/WheelEventTestMonitor.h:
* page/scrolling/ScrollingTree.h:
(WebCore::ScrollingTree::WTF_RETURNS_LOCK):
* page/scrolling/ScrollingTreeLatchingController.h:
* page/scrolling/ThreadedScrollingTree.h:
(WebCore::ThreadedScrollingTree::WTF_RETURNS_LOCK):
* page/scrolling/mac/ScrollingTreeMac.h:
* platform/AbortableTaskQueue.h:
* platform/GenericTaskQueue.cpp:
* platform/GenericTaskQueue.h:
* platform/LegacySchemeRegistry.cpp:
* platform/audio/AudioDestination.h:
* platform/audio/HRTFDatabaseLoader.h:
* platform/audio/ReverbConvolver.cpp:
(WebCore::ReverbConvolver::backgroundThreadEntry):
* platform/audio/cocoa/AudioDestinationCocoa.h:
* platform/audio/gstreamer/AudioSourceProviderGStreamer.h:
* platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
* platform/audio/mac/FFTFrameMac.cpp:
* platform/encryptedmedia/CDMProxy.h:
* platform/graphics/MediaPlayer.cpp:
* platform/graphics/ShadowBlur.cpp:
(WebCore::ScratchBuffer::lock):
(WebCore::ShadowBlur::drawRectShadowWithTiling):
(WebCore::ShadowBlur::drawInsetShadowWithTiling):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
* platform/graphics/cg/IOSurfacePool.h:
* platform/graphics/cg/SubimageCacheWithTimer.h:
* platform/graphics/cocoa/FontCacheCoreText.cpp:
* platform/graphics/gstreamer/ImageDecoderGStreamer.h:
* platform/graphics/gstreamer/MainThreadNotifier.h:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
* platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
(WebCore::TextureMapperPlatformLayerProxy::WTF_RETURNS_LOCK):
* platform/image-decoders/ScalableImageDecoder.h:
* platform/ios/QuickLook.mm:
* platform/ios/WebSQLiteDatabaseTrackerClient.mm:
* platform/ios/wak/WebCoreThreadRun.cpp:
* platform/mediarecorder/MediaRecorderPrivateMock.h:
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
* platform/mediastream/RealtimeMediaSource.h:
* platform/mediastream/RealtimeOutgoingAudioSource.h:
* platform/mediastream/RealtimeOutgoingVideoSource.h:
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.h:
* platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h:
* platform/network/cf/LoaderRunLoopCF.cpp:
(WebCore::loaderRunLoop):
* platform/network/cocoa/WebCoreNSURLSession.mm:
* platform/network/mac/UTIUtilities.mm:
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
* platform/sql/SQLiteDatabase.cpp:
* platform/sql/SQLiteDatabase.h:
* platform/sql/SQLiteDatabaseTracker.cpp:
* platform/text/TextEncodingRegistry.cpp:
* storage/StorageQuotaManager.h:
* workers/WorkerGlobalScope.cpp:
* workers/WorkerOrWorkletScriptController.h:
* workers/WorkerOrWorkletThread.cpp:
(WebCore::WorkerOrWorkletThread::workerOrWorkletThreadsLock):
* workers/WorkerOrWorkletThread.h:
* worklets/PaintWorkletGlobalScope.h:
2021-05-24 Alan Bujtas <zalan@apple.com>
[LFC] Rename the geometry() helpers to formattingGeometry()
https://bugs.webkit.org/show_bug.cgi?id=226153
Reviewed by Antti Koivisto.
* layout/formattingContexts/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
(WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry):
(WebCore::Layout::FormattingContext::computeBorderAndPadding):
(WebCore::Layout::FormattingContext::layoutOutOfFlowContent):
(WebCore::Layout::FormattingContext::formattingGeometry const):
(WebCore::Layout::FormattingContext::geometry const): Deleted.
* layout/formattingContexts/FormattingContext.h:
* layout/formattingContexts/FormattingQuirks.cpp:
(WebCore::Layout::FormattingQuirks::heightValueOfNearestContainingBlockWithFixedHeight const):
* layout/formattingContexts/block/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
(WebCore::Layout::BlockFormattingContext::placeInFlowPositionedChildren):
(WebCore::Layout::BlockFormattingContext::computeStaticVerticalPosition):
(WebCore::Layout::BlockFormattingContext::computeStaticHorizontalPosition):
(WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForBoxAndAncestors):
(WebCore::Layout::BlockFormattingContext::computeWidthAndMargin):
(WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
(WebCore::Layout::BlockFormattingContext::computedIntrinsicWidthConstraints):
(WebCore::Layout::BlockFormattingContext::formattingGeometry const):
(WebCore::Layout::BlockFormattingContext::geometry const): Deleted.
* layout/formattingContexts/block/BlockFormattingContext.h:
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp:
(WebCore::Layout::TableWrapperBlockFormattingContext::layoutTableBox):
(WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox):
(WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox):
(WebCore::Layout::TableWrapperBlockFormattingContext::computeHeightAndMarginForTableBox):
* layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::sizeAndPlaceFlexItems):
(WebCore::Layout::FlexFormattingContext::computeIntrinsicWidthConstraintsForFlexItems):
(WebCore::Layout::FlexFormattingContext::formattingGeometry const):
(WebCore::Layout::FlexFormattingContext::geometry const): Deleted.
* layout/formattingContexts/flex/FlexFormattingContext.h:
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
(WebCore::Layout::InlineFormattingContext::lineLayout):
(WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
(WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingRoot):
(WebCore::Layout::InlineFormattingContext::computeHorizontalMargin):
(WebCore::Layout::InlineFormattingContext::computeWidthAndMargin):
(WebCore::Layout::InlineFormattingContext::computeHeightAndMargin):
(WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
(WebCore::Layout::InlineFormattingContext::formattingGeometry const):
(WebCore::Layout::InlineFormattingContext::geometry const): Deleted.
* layout/formattingContexts/inline/InlineFormattingContext.h:
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::setUsedGeometryForRows):
(WebCore::Layout::TableFormattingContext::layoutCell):
(WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns):
(WebCore::Layout::TableFormattingContext::computeAndDistributeExtraSpace):
(WebCore::Layout::TableFormattingContext::formattingGeometry const):
(WebCore::Layout::TableFormattingContext::geometry const): Deleted.
* layout/formattingContexts/table/TableFormattingContext.h:
* layout/formattingContexts/table/TableLayout.cpp:
(WebCore::Layout::TableFormattingContext::TableLayout::distributedVerticalSpace):
2021-05-24 Alan Bujtas <zalan@apple.com>
[LFC] FormattingGeometry functions should all be const
https://bugs.webkit.org/show_bug.cgi?id=226147
Reviewed by Simon Fraser.
While the const_cast is unfortunate, those functions do not mutate *this*.
* layout/LayoutState.cpp:
(WebCore::Layout::LayoutState::hasFormattingState const):
* layout/LayoutState.h:
* layout/formattingContexts/FormattingGeometry.cpp:
(WebCore::Layout::FormattingGeometry::computedWidthValue const):
(WebCore::Layout::FormattingGeometry::computedWidth const):
(WebCore::Layout::FormattingGeometry::computedMinWidth const):
(WebCore::Layout::FormattingGeometry::computedMaxWidth const):
(WebCore::Layout::FormattingGeometry::shrinkToFitWidth const):
(WebCore::Layout::FormattingGeometry::outOfFlowNonReplacedHorizontalGeometry const):
(WebCore::Layout::FormattingGeometry::outOfFlowReplacedHorizontalGeometry const):
(WebCore::Layout::FormattingGeometry::floatingNonReplacedContentWidthAndMargin const):
(WebCore::Layout::FormattingGeometry::floatingReplacedContentWidthAndMargin const):
(WebCore::Layout::FormattingGeometry::outOfFlowHorizontalGeometry const):
(WebCore::Layout::FormattingGeometry::floatingContentWidthAndMargin const):
(WebCore::Layout::FormattingGeometry::inlineReplacedContentWidthAndMargin const):
(WebCore::Layout::FormattingGeometry::constraintsForOutOfFlowContent const):
(WebCore::Layout::FormattingGeometry::computedWidthValue): Deleted.
(WebCore::Layout::FormattingGeometry::computedWidth): Deleted.
(WebCore::Layout::FormattingGeometry::computedMinWidth): Deleted.
(WebCore::Layout::FormattingGeometry::computedMaxWidth): Deleted.
(WebCore::Layout::FormattingGeometry::shrinkToFitWidth): Deleted.
(WebCore::Layout::FormattingGeometry::outOfFlowNonReplacedHorizontalGeometry): Deleted.
(WebCore::Layout::FormattingGeometry::outOfFlowReplacedHorizontalGeometry): Deleted.
(WebCore::Layout::FormattingGeometry::floatingNonReplacedContentWidthAndMargin): Deleted.
(WebCore::Layout::FormattingGeometry::floatingReplacedContentWidthAndMargin): Deleted.
(WebCore::Layout::FormattingGeometry::outOfFlowHorizontalGeometry): Deleted.
(WebCore::Layout::FormattingGeometry::floatingContentWidthAndMargin): Deleted.
(WebCore::Layout::FormattingGeometry::inlineReplacedContentWidthAndMargin): Deleted.
(WebCore::Layout::FormattingGeometry::constraintsForOutOfFlowContent): Deleted.
* layout/formattingContexts/FormattingGeometry.h:
(WebCore::Layout::FormattingGeometry::layoutState const):
(WebCore::Layout::FormattingGeometry::layoutState): Deleted.
* layout/formattingContexts/block/BlockFormattingGeometry.cpp:
(WebCore::Layout::BlockFormattingGeometry::inFlowNonReplacedContentHeightAndMargin const):
(WebCore::Layout::BlockFormattingGeometry::inFlowNonReplacedContentWidthAndMargin const):
(WebCore::Layout::BlockFormattingGeometry::inFlowReplacedContentWidthAndMargin const):
(WebCore::Layout::BlockFormattingGeometry::inFlowContentHeightAndMargin const):
(WebCore::Layout::BlockFormattingGeometry::inFlowContentWidthAndMargin const):
(WebCore::Layout::BlockFormattingGeometry::computedContentWidthAndMargin const):
(WebCore::Layout::BlockFormattingGeometry::intrinsicWidthConstraints const):
(WebCore::Layout::BlockFormattingGeometry::inFlowNonReplacedContentHeightAndMargin): Deleted.
(WebCore::Layout::BlockFormattingGeometry::inFlowNonReplacedContentWidthAndMargin): Deleted.
(WebCore::Layout::BlockFormattingGeometry::inFlowReplacedContentWidthAndMargin): Deleted.
(WebCore::Layout::BlockFormattingGeometry::inFlowContentHeightAndMargin): Deleted.
(WebCore::Layout::BlockFormattingGeometry::inFlowContentWidthAndMargin): Deleted.
(WebCore::Layout::BlockFormattingGeometry::computedContentWidthAndMargin): Deleted.
(WebCore::Layout::BlockFormattingGeometry::intrinsicWidthConstraints): Deleted.
* layout/formattingContexts/block/BlockFormattingGeometry.h:
* layout/formattingContexts/flex/FlexFormattingGeometry.cpp:
(WebCore::Layout::FlexFormattingGeometry::intrinsicWidthConstraints const):
(WebCore::Layout::FlexFormattingGeometry::intrinsicWidthConstraints): Deleted.
* layout/formattingContexts/flex/FlexFormattingGeometry.h:
* layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::InlineFormattingGeometry::inlineBlockContentWidthAndMargin const):
(WebCore::Layout::InlineFormattingGeometry::inlineBlockContentWidthAndMargin): Deleted.
* layout/formattingContexts/inline/InlineFormattingGeometry.h:
* layout/formattingContexts/table/TableFormattingGeometry.cpp:
(WebCore::Layout::TableFormattingGeometry::computedColumnWidth const):
(WebCore::Layout::TableFormattingGeometry::intrinsicWidthConstraintsForCell const):
(WebCore::Layout::TableFormattingGeometry::usedBaselineForCell const):
(WebCore::Layout::TableFormattingGeometry::computedColumnWidth): Deleted.
(WebCore::Layout::TableFormattingGeometry::intrinsicWidthConstraintsForCell): Deleted.
(WebCore::Layout::TableFormattingGeometry::usedBaselineForCell): Deleted.
* layout/formattingContexts/table/TableFormattingGeometry.h:
2021-05-24 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Add a helper function to compute the intrinsic vertical paddings for the cell
https://bugs.webkit.org/show_bug.cgi?id=226130
Reviewed by Antti Koivisto.
Add a comment explaining what the intrinsic vertical padding is.
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::setUsedGeometryForCells):
(WebCore::Layout::TableFormattingContext::layoutCell):
* layout/formattingContexts/table/TableFormattingContext.h:
2021-05-24 Imanol Fernandez <ifernandez@igalia.com>
Implement OpenXR input sources
https://bugs.webkit.org/show_bug.cgi?id=224931
Reviewed by Sergio Villar Senin.
* Sources.txt: Add OpenXRInput and OpenXRInputSource files
* platform/xr/openxr/OpenXRInput.cpp: Entry point to query and sync input in OpenXR.
(PlatformXR::OpenXRInput::create):
(PlatformXR::OpenXRInput::OpenXRInput):
(PlatformXR::OpenXRInput::initialize):
(PlatformXR::OpenXRInput::getInputSources const):
(PlatformXR::OpenXRInput::updateInteractionProfile):
* platform/xr/openxr/OpenXRInput.h: Added.
* platform/xr/openxr/OpenXRInputMappings.h: Mapping definition for supported input profiles.
(PlatformXR::buttonTypeToString):
(PlatformXR::axisTypetoString):
* platform/xr/openxr/OpenXRInputSource.cpp: Handles tracking and status of a specific input source.
(PlatformXR::OpenXRInputSource::create):
(PlatformXR::OpenXRInputSource::~OpenXRInputSource):
(PlatformXR::OpenXRInputSource::initialize):
(PlatformXR::OpenXRInputSource::suggestBindings const):
(PlatformXR::OpenXRInputSource::getInputSource const):
(PlatformXR::OpenXRInputSource::updateInteractionProfile):
(PlatformXR::OpenXRInputSource::createSpaceAction const):
(PlatformXR::OpenXRInputSource::createAction const):
(PlatformXR::OpenXRInputSource::createButtonActions const):
(PlatformXR::OpenXRInputSource::createBinding const):
(PlatformXR::OpenXRInputSource::getPose const):
(PlatformXR::OpenXRInputSource::getButton const):
(PlatformXR::OpenXRInputSource::getAxis const):
(PlatformXR::OpenXRInputSource::getActionState const):
* platform/xr/openxr/OpenXRInputSource.h: Added.
(PlatformXR::OpenXRInputSource::OpenXRInputSource):
(PlatformXR::OpenXRInputSource::actionSet const):
* platform/xr/openxr/OpenXRUtils.h:
(PlatformXR::XrPoseIdentity): Creates a identity pose.
(PlatformXR::handenessToString): Convert from handeness enum to string.
* platform/xr/openxr/PlatformXROpenXR.cpp: Handle input sources in the OpenXR render loop.
(PlatformXR::OpenXRDevice::initializeTrackingAndRendering):
(PlatformXR::OpenXRDevice::requestFrame):
(PlatformXR::OpenXRDevice::pollEvents):
(PlatformXR::OpenXRDevice::resetSession):
(PlatformXR::OpenXRDevice::updateInteractionProfile):
* platform/xr/openxr/PlatformXROpenXR.h:
2021-05-24 Sihui Liu <sihui_liu@apple.com>
REGRESSION(r256715): XSLTProcessor does not parse script when transforming to document
https://bugs.webkit.org/show_bug.cgi?id=226087
Reviewed by Darin Adler.
Allow JavaScript if context document is null to match old behavior before r256715.
Test: fast/xsl/xslt-transform-script.html
* dom/Document.cpp:
(WebCore::Document::allowsContentJavaScript const):
2021-05-24 Tim Nguyen <ntim@apple.com>
Clean up handling of `-webkit-inline-flex`/`-webkit-flex` CSS display values
https://bugs.webkit.org/show_bug.cgi?id=224807
Reviewed by Antti Koivisto.
These are now aliased at parse-time, like the two-value CSS display syntax is.
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeDisplay):
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::isInlineLevelBox const):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::createFor):
* rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<):
* rendering/style/RenderStyleConstants.h:
* style/StyleAdjuster.cpp:
(WebCore::Style::equivalentBlockDisplay):
2021-05-24 Lauro Moura <lmoura@igalia.com>
[GStreamer] WebProcess crashes when certain elements are missing
https://bugs.webkit.org/show_bug.cgi?id=226081
<rdar://problem/78394687>
Unreviewed LTS build fix.
* platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
2021-05-24 Philippe Normand <pnormand@igalia.com>
[GStreamer] WebProcess crashes when certain elements are missing
https://bugs.webkit.org/show_bug.cgi?id=226081
Reviewed by Xabier Rodriguez-Calvar.
Introducing makeGStreamerElement() and makeGStreamerBin() that should be used when
requesting non-WebKit and non-core GStreamer elements/bins to be created at runtime. The
goal is to prevent NULL pointers to be used in case the runtime host has an incomplete
GStreamer plugins installation.
* platform/audio/gstreamer/AudioDestinationGStreamer.cpp:
(WebCore::AudioDestinationGStreamer::AudioDestinationGStreamer):
* platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
(WebCore::AudioFileReader::handleNewDeinterleavePad):
(WebCore::AudioFileReader::plugDeinterleave):
(WebCore::AudioFileReader::decodeAudioForBusCreation):
* platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
(WebCore::AudioSourceProviderGStreamer::configureAudioBin):
(WebCore::AudioSourceProviderGStreamer::setClient):
(WebCore::AudioSourceProviderGStreamer::handleNewDeinterleavePad):
* platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
(webKitWebAudioSrcConstructed):
* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(webKitGLVideoSinkConstructed):
* platform/graphics/gstreamer/GStreamerAudioMixer.cpp:
(WebCore::GStreamerAudioMixer::GStreamerAudioMixer):
(WebCore::GStreamerAudioMixer::registerProducer):
* platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::createPlatformAudioSink):
(WebCore::makeGStreamerElement):
(WebCore::makeGStreamerBin):
* platform/graphics/gstreamer/GStreamerCommon.h:
* platform/graphics/gstreamer/ImageDecoderGStreamer.cpp:
(WebCore::ImageDecoderGStreamer::InnerDecoder::connectDecoderPad):
(WebCore::ImageDecoderGStreamer::InnerDecoder::preparePipeline):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
(WebCore::MediaPlayerPrivateGStreamer::createHolePunchVideoSink):
(WebCore::MediaPlayerPrivateGStreamer::createVideoSink):
* platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
(webKitTextCombinerHandleCapsEvent):
* platform/graphics/gstreamer/TextSinkGStreamer.cpp:
(webkitTextSinkConstructed):
* platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp:
(webKitAudioSinkConfigure):
* platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::AppendPipeline::AppendPipeline):
(WebCore::createOptionalParserForFormat):
* platform/mediastream/gstreamer/GStreamerAudioCapturer.cpp:
(WebCore::GStreamerAudioCapturer::createConverter):
* platform/mediastream/gstreamer/GStreamerCapturer.cpp:
(WebCore::GStreamerCapturer::makeElement):
* platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
* platform/mediastream/gstreamer/GStreamerVideoCapturer.cpp:
(WebCore::GStreamerVideoCapturer::createConverter):
* platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
(WebCore::GStreamerVideoDecoder::makeElement):
* platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:
(webrtcVideoEncoderSetEncoder):
(webrtcVideoEncoderSetFormat):
* platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
(WebCore::GStreamerVideoEncoder::makeElement):
2021-05-23 Chris Dumez <cdumez@apple.com>
Make CheckedLock the default Lock
https://bugs.webkit.org/show_bug.cgi?id=226157
Reviewed by Darin Adler.
Make CheckedLock the default Lock so that we get more benefits from Clang
Thread Safety Analysis. Note that CheckedLock 100% relies on the existing
Lock implementation and merely adds the clang anotations for thread
safety.
That this patch does is:
1. Rename the Lock class to UncheckedLock
2. Rename the CheckedLock class to Lock
3. Rename the Condition class to UncheckedCondition
4. Rename the CheckedCondition class to Condition
5. Update the types of certain variables from Lock / Condition to
UncheckedLock / UncheckedCondition if I got a build failure. Build
failures are usually caused by the following facts:
- Locker<CheckedLock> doesn't subclass AbstractLocker which a lot of
JSC code passes as argument
- Locker<CheckedLock> has no move constructor
- Locker<CheckedLock> cannot be constructed from a lock pointer, only
a reference
For now, CheckedLock and CheckedCondition remain as aliases to Lock and
Condition, in their respective CheckedLock.h / CheckedCondition.h headers.
I will drop them in a follow-up to reduce patch size.
I will also follow-up to try and get rid of as much usage of UncheckedLock
and UncheckedCondition as possible. I did not try very hard in this patch
to reduce patch size.
* Modules/indexeddb/server/IDBServer.cpp:
* Modules/webaudio/MediaElementAudioSourceNode.h:
* Modules/webdatabase/OriginLock.cpp:
* bindings/js/JSDOMGlobalObject.h:
* dom/Node.cpp:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::createMediaPlayer):
* html/canvas/WebGLContextGroup.cpp:
(WebCore::WebGLContextGroup::objectGraphLockForAContext):
* html/canvas/WebGLContextGroup.h:
* html/canvas/WebGLContextObject.cpp:
(WebCore::WebGLContextObject::objectGraphLockForContext):
* html/canvas/WebGLContextObject.h:
* html/canvas/WebGLObject.h:
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::objectGraphLock):
* html/canvas/WebGLRenderingContextBase.h:
* html/canvas/WebGLSharedObject.cpp:
(WebCore::WebGLSharedObject::objectGraphLockForContext):
* html/canvas/WebGLSharedObject.h:
* page/scrolling/mac/ScrollingTreeMac.h:
* platform/audio/ReverbConvolver.cpp:
(WebCore::ReverbConvolver::backgroundThreadEntry):
* platform/graphics/ShadowBlur.cpp:
(WebCore::ScratchBuffer::lock):
(WebCore::ShadowBlur::drawRectShadowWithTiling):
(WebCore::ShadowBlur::drawInsetShadowWithTiling):
* platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
2021-05-23 Sam Weinig <weinig@apple.com>
Convert DestinationColorSpace from an enum to class wrapping a platform color space (CGColorSpaceRef for CG ports, etc.)
https://bugs.webkit.org/show_bug.cgi?id=226143
Reviewed by Darin Adler.
Replace enumeration based DestinationColorSpace with a struct wrapping
a platform color space (CGColorSpaceRef for CG ports, etc.). For ports
that don't have a platform level color space type, a builtin PlatformColorSpace
type is provided that is just the old enum renamed to PlatformColorSpace::Name.
The goal of this change is to unify the currently bifurcated concept of an
ImageBuffer's color space, which previosly could either be based on the
DestinationColorSpace (and reflected in the colorSpace() member function),
or (for CG ports) based on a CGColorSpaceRef, with the colorSpace() function
returning sRGB even if the ImageBuffer was not.
* Headers.cmake:
* Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp:
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::sanitizeDataIfNeeded):
* Modules/mediasession/MediaMetadata.cpp:
(WebCore::ArtworkImageLoader::notifyFinished):
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::dumpImageBitmap):
(WebCore::CloneDeserializer::readImageBitmap):
* css/CSSFilterImageValue.cpp:
(WebCore::CSSFilterImageValue::image):
* html/CustomPaintCanvas.cpp:
(WebCore::CustomPaintCanvas::copiedImage const):
* html/CustomPaintImage.cpp:
(WebCore::CustomPaintImage::drawPattern):
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::toMediaSample):
(WebCore::HTMLCanvasElement::createImageBuffer const):
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::createBufferForPainting const):
* html/HTMLVideoElement.h:
* html/ImageBitmap.cpp:
(WebCore::ImageBitmap::createImageBuffer):
(WebCore::ImageBitmap::createPromise):
* html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::commitToPlaceholderCanvas):
* html/canvas/CanvasRenderingContext.cpp:
(WebCore::CanvasRenderingContext::colorSpace const):
* html/canvas/CanvasRenderingContext.h:
* html/canvas/CanvasRenderingContext2D.cpp:
* html/canvas/ImageBitmapRenderingContext.cpp:
(WebCore::ImageBitmapRenderingContext::setOutputBitmap):
* html/canvas/PredefinedColorSpace.cpp:
(WebCore::toDestinationColorSpace):
(WebCore::toPredefinedColorSpace):
* html/canvas/PredefinedColorSpace.h:
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer):
* html/shadow/MediaControlTextTrackContainerElement.cpp:
(WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::indexForData):
(WebCore::InspectorCanvas::buildArrayForCanvasPattern):
* page/Chrome.cpp:
(WebCore::Chrome::createImageBuffer const):
* page/Chrome.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::createImageBuffer const):
* page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRectWithClip):
* page/PageColorSampler.cpp:
(WebCore::sampleColor):
* page/PageConsoleClient.cpp:
(WebCore::PageConsoleClient::screenshot):
* platform/HostWindow.h:
* platform/PlatformColorSpace.h: Added.
(WebCore::PlatformColorSpace::get const):
* platform/PlatformScreen.h:
* platform/ScreenProperties.h:
(WebCore::ScreenProperties::encode const):
(WebCore::ScreenData::encode const):
(WebCore::ScreenData::decode):
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::preTransformedNativeImageForCurrentFrame):
(WebCore::BitmapImage::drawPattern):
* platform/graphics/Color.cpp:
(WebCore::Color::toColorComponentsInColorSpace const):
* platform/graphics/Color.h:
* platform/graphics/ColorConversion.cpp:
(WebCore::converColorComponents):
* platform/graphics/ColorConversion.h:
* platform/graphics/ColorSpace.cpp:
* platform/graphics/ColorSpace.h:
* platform/graphics/ConcreteImageBuffer.h:
(WebCore::ConcreteImageBuffer::create):
* platform/graphics/CrossfadeGeneratedImage.cpp:
(WebCore::CrossfadeGeneratedImage::drawPattern):
* platform/graphics/DestinationColorSpace.cpp: Added.
(WebCore::DestinationColorSpace::SRGB):
(WebCore::DestinationColorSpace::LinearSRGB):
(WebCore::DestinationColorSpace::DisplayP3):
(WebCore::DestinationColorSpace::DestinationColorSpace):
(WebCore::operator==):
(WebCore::operator!=):
(WebCore::operator<<):
* platform/graphics/DestinationColorSpace.h: Added.
(WebCore::DestinationColorSpace::platformColorSpace const):
(WebCore::DestinationColorSpace::encode const):
(WebCore::DestinationColorSpace::decode):
* platform/graphics/GradientImage.cpp:
(WebCore::GradientImage::drawPattern):
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::clipToDrawingCommands):
* platform/graphics/GraphicsContext.h:
* platform/graphics/GraphicsContextImpl.h:
* platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::create):
(WebCore::ImageBuffer::createCompatibleBuffer):
(WebCore::ImageBuffer::copyRectToBuffer):
* platform/graphics/ImageBuffer.h:
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::getPixelBuffer const):
(WebCore::ImageBufferBackend::putPixelBuffer):
* platform/graphics/ImageBufferBackend.h:
(WebCore::ImageBufferBackend::transformColorSpace):
(WebCore::ImageBufferBackend::colorSpace const):
* platform/graphics/PixelBuffer.h:
(WebCore::PixelBuffer::decode):
* platform/graphics/PixelBufferConversion.cpp:
(WebCore::makeVImageCGImageFormat):
* platform/graphics/PixelBufferFormat.h:
(WebCore::PixelBufferFormat::decode):
* platform/graphics/RemoteVideoSample.cpp:
(WebCore::transferBGRAPixelBufferToIOSurface):
(WebCore::RemoteVideoSample::create):
(WebCore::RemoteVideoSample::RemoteVideoSample):
(WebCore::RemoteVideoSample::surface const):
* platform/graphics/RemoteVideoSample.h:
* platform/graphics/ShadowBlur.cpp:
(WebCore::ScratchBuffer::getScratchBuffer):
(WebCore::ShadowBlur::drawRectShadowWithoutTiling):
(WebCore::ShadowBlur::drawInsetShadowWithoutTiling):
(WebCore::ShadowBlur::drawRectShadowWithTiling):
(WebCore::ShadowBlur::drawInsetShadowWithTiling):
(WebCore::ShadowBlur::blurShadowBuffer):
(WebCore::ShadowBlur::drawShadowLayer):
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::readPixelsForPaintResults):
* platform/graphics/cairo/ImageBufferCairoBackend.cpp:
(WebCore::ImageBufferCairoBackend::transformColorSpace):
* platform/graphics/cairo/ImageBufferCairoBackend.h:
* platform/graphics/cg/ColorCG.cpp:
(WebCore::convertToCGCompatibleComponents):
(WebCore::createCGColor):
(WebCore::platformConvertColorComponents):
* platform/graphics/cg/ColorSpaceCG.h:
(WebCore::cachedCGColorSpace): Deleted.
* platform/graphics/cg/GraphicsContextGLCG.cpp:
(WebCore::GraphicsContextGLOpenGL::paintToCanvas):
* platform/graphics/cg/IOSurfacePool.cpp:
(WebCore::surfaceMatchesParameters):
(WebCore::IOSurfacePool::takeSurface):
* platform/graphics/cg/IOSurfacePool.h:
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::createBitmapImageAfterScalingIfNeeded):
(WebCore::ImageBufferCGBackend::copyCGImageForEncoding const):
* platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
(WebCore::ImageBufferCGBitmapBackend::create):
(WebCore::ImageBufferCGBitmapBackend::copyNativeImage const):
* platform/graphics/cg/ImageBufferCGBitmapBackend.h:
* platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
(WebCore::ImageBufferIOSurfaceBackend::create):
* platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
* platform/graphics/cg/ImageBufferUtilitiesCG.cpp:
(WebCore::encode):
* platform/graphics/cg/NativeImageCG.cpp:
(WebCore::NativeImage::singlePixelSolidColor const):
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::allocateAndBindDisplayBufferBacking):
* platform/graphics/cocoa/IOSurface.h:
* platform/graphics/cocoa/IOSurface.mm:
(WebCore::IOSurface::surfaceFromPool):
(WebCore::IOSurface::create):
(WebCore::IOSurface::createFromSendRight):
(WebCore::IOSurface::createFromSurface):
(WebCore::IOSurface::createFromImage):
(WebCore::IOSurface::createFromPixelBuffer):
(WebCore::IOSurface::IOSurface):
(WebCore::IOSurface::ensurePlatformContext):
(WebCore::IOSurface::migrateColorSpaceToProperties):
* platform/graphics/coreimage/FilterEffectRendererCoreImage.mm:
(WebCore::FilterEffectRendererCoreImage::renderToImageBuffer):
* platform/graphics/cv/ImageTransferSessionVT.mm:
(WebCore::ImageTransferSessionVT::createPixelBuffer):
* platform/graphics/cv/PixelBufferConformerCV.cpp:
(WebCore::PixelBufferConformerCV::createImageFromPixelBuffer):
* platform/graphics/displaylists/DisplayListImageBuffer.h:
(WebCore::DisplayList::ImageBuffer::create):
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemHandle::destroy):
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::BeginClipToDrawingCommands::BeginClipToDrawingCommands):
(WebCore::DisplayList::BeginClipToDrawingCommands::colorSpace const):
(WebCore::DisplayList::BeginClipToDrawingCommands::encode const):
(WebCore::DisplayList::BeginClipToDrawingCommands::decode):
(WebCore::DisplayList::GetPixelBuffer::GetPixelBuffer):
(WebCore::DisplayList::GetPixelBuffer::outputFormat const):
(WebCore::DisplayList::GetPixelBuffer::encode const):
(WebCore::DisplayList::GetPixelBuffer::decode):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::clipToDrawingCommands):
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/filters/FEDisplacementMap.cpp:
(WebCore::FEDisplacementMap::setResultColorSpace):
* platform/graphics/filters/FEDisplacementMap.h:
* platform/graphics/filters/FEFlood.h:
* platform/graphics/filters/FETile.cpp:
(WebCore::FETile::platformApplySoftware):
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::convertPixelBufferToColorSpace):
(WebCore::FilterEffect::convertImageBufferToColorSpace):
(WebCore::FilterEffect::copyConvertedImageBufferToDestination):
(WebCore::FilterEffect::copyConvertedPixelBufferToDestination):
(WebCore::FilterEffect::requiresPixelBufferColorSpaceConversion):
(WebCore::FilterEffect::transformResultColorSpace):
* platform/graphics/filters/FilterEffect.h:
(WebCore::FilterEffect::operatingColorSpace const):
(WebCore::FilterEffect::setOperatingColorSpace):
(WebCore::FilterEffect::resultColorSpace const):
(WebCore::FilterEffect::setResultColorSpace):
* platform/graphics/filters/SourceGraphic.h:
(WebCore::SourceGraphic::SourceGraphic):
* platform/gtk/PlatformScreenGtk.cpp:
(WebCore::screenColorSpace):
* platform/ios/PlatformScreenIOS.mm:
(WebCore::screenColorSpace):
(WebCore::collectScreenProperties):
* platform/mac/PlatformScreenMac.mm:
(WebCore::collectScreenProperties):
(WebCore::screenColorSpace):
* platform/mac/ThemeMac.mm:
(WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
* platform/mediastream/mac/ScreenDisplayCapturerMac.mm:
(WebCore::ScreenDisplayCapturerMac::createDisplayStream):
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::imageBuffer const):
* platform/playstation/PlatformScreenPlayStation.cpp:
(WebCore::screenColorSpace):
* platform/win/PlatformScreenWin.cpp:
(WebCore::screenColorSpace):
* platform/wpe/PlatformScreenWPE.cpp:
(WebCore::screenColorSpace):
* platform/xr/PlatformXR.h:
(PlatformXR::Device::FrameData::LayerData::decode):
* rendering/CSSFilter.cpp:
(WebCore::CSSFilter::buildReferenceFilter):
(WebCore::CSSFilter::build):
(WebCore::CSSFilter::allocateBackingStoreIfNeeded):
(WebCore::CSSFilter::apply):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
* rendering/RenderLayerBacking.cpp:
(WebCore::patternForDescription):
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::paintSystemPreviewBadge):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintProgressBar):
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createRasterShape):
* rendering/svg/RenderSVGResourceClipper.cpp:
(WebCore::RenderSVGResourceClipper::applyClippingToContext):
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::buildPrimitives const):
(WebCore::RenderSVGResourceFilter::applyResource):
(WebCore::RenderSVGResourceFilter::postApplyResource):
* rendering/svg/RenderSVGResourceGradient.cpp:
(WebCore::createMaskAndSwapContextForTextGradient):
* rendering/svg/RenderSVGResourceMasker.cpp:
(WebCore::RenderSVGResourceMasker::applyResource):
(WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):
* rendering/svg/RenderSVGResourceMasker.h:
* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::createTileImage const):
* rendering/svg/SVGRenderingContext.cpp:
(WebCore::SVGRenderingContext::createImageBuffer):
(WebCore::SVGRenderingContext::bufferForeground):
* rendering/svg/SVGRenderingContext.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::nativeImage):
(WebCore::SVGImage::drawPatternForContainer):
* svg/graphics/filters/SVGFEImage.cpp:
(WebCore::FEImage::platformApplySoftware):
2021-05-23 Chris Dumez <cdumez@apple.com>
Use CheckedLock in even more places
https://bugs.webkit.org/show_bug.cgi?id=226152
Reviewed by Darin Adler.
Use CheckedLock in even more places to benefit from Clang Thread Safety Analysis.
* platform/image-decoders/ScalableImageDecoder.cpp:
(WebCore::ScalableImageDecoder::frameIsCompleteAtIndex const):
(WebCore::ScalableImageDecoder::frameHasAlphaAtIndex const):
(WebCore::ScalableImageDecoder::frameBytesAtIndex const):
(WebCore::ScalableImageDecoder::frameDurationAtIndex const):
(WebCore::ScalableImageDecoder::createFrameImageAtIndex):
* platform/image-decoders/ScalableImageDecoder.h:
* platform/mediarecorder/MediaRecorderPrivateMock.h:
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
* platform/mediastream/RealtimeMediaSource.h:
* platform/mediastream/RealtimeOutgoingAudioSource.h:
* platform/mediastream/RealtimeOutgoingVideoSource.h:
* platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::audioSamplesAvailable):
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData):
* platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h:
* platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
* platform/mediastream/mac/AVVideoCaptureSource.h:
* platform/sql/SQLiteDatabase.h:
* worklets/PaintWorkletGlobalScope.h:
2021-05-23 Chris Dumez <cdumez@apple.com>
Drop WTF::tryHoldLock() as it is incompatible with Clang Thread Safety Analysis
https://bugs.webkit.org/show_bug.cgi?id=226145
Reviewed by Darin Adler.
Drop WTF::tryHoldLock() as it is incompatible with Clang Thread Safety Analysis.
Instead, use the following pattern which is supported:
```
if (lock.tryLock()) {
Locker locker { AdoptLock, lock };
// ...
}
```
* Modules/webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::process):
* Modules/webaudio/AudioWorkletNode.cpp:
(WebCore::AudioWorkletNode::process):
* Modules/webaudio/ConvolverNode.cpp:
(WebCore::ConvolverNode::process):
* Modules/webaudio/MediaElementAudioSourceNode.cpp:
(WebCore::MediaElementAudioSourceNode::process):
* Modules/webaudio/MediaStreamAudioSourceNode.cpp:
(WebCore::MediaStreamAudioSourceNode::process):
* Modules/webaudio/OscillatorNode.cpp:
(WebCore::OscillatorNode::process):
* Modules/webaudio/PannerNode.cpp:
(WebCore::PannerNode::process):
* Modules/webaudio/ScriptProcessorNode.cpp:
(WebCore::ScriptProcessorNode::process):
* Modules/webaudio/WaveShaperProcessor.cpp:
(WebCore::WaveShaperProcessor::process):
* platform/audio/ReverbConvolver.cpp:
(WebCore::ReverbConvolver::process):
* platform/graphics/ShadowBlur.cpp:
(WebCore::ScratchBuffer::purgeTimerFired):
(WebCore::ShadowBlur::drawRectShadowWithTiling):
(WebCore::ShadowBlur::drawInsetShadowWithTiling):
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::provideInput):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
* platform/mediastream/mac/WebAudioSourceProviderCocoa.mm:
(WebCore::WebAudioSourceProviderCocoa::provideInput):
* workers/WorkerOrWorkletThread.cpp:
(WebCore::WorkerOrWorkletThread::stop):
2021-05-22 Chris Dumez <cdumez@apple.com>
Adopt CheckedLock in more places
https://bugs.webkit.org/show_bug.cgi?id=226138
Reviewed by Darin Adler.
Adopt CheckedLock in more places to benefit from Clang Thread Safety Analysis.
* Modules/webdatabase/Database.cpp:
(WebCore::Database::performClose):
(WebCore::Database::scheduleTransaction):
(WebCore::Database::inProgressTransactionCompleted):
(WebCore::Database::hasPendingTransaction):
(WebCore::Database::runTransaction):
* Modules/webdatabase/Database.h:
(WebCore::Database::WTF_GUARDED_BY_LOCK):
* Modules/webdatabase/DatabaseManager.cpp:
(WebCore::DatabaseManager::addProposedDatabase):
(WebCore::DatabaseManager::removeProposedDatabase):
(WebCore::DatabaseManager::fullPathForDatabase):
(WebCore::DatabaseManager::detailsForNameAndOrigin):
* Modules/webdatabase/DatabaseManager.h:
* Modules/webdatabase/DatabaseThread.cpp:
(WebCore::DatabaseThread::databaseThread):
(WebCore::DatabaseThread::recordDatabaseOpen):
(WebCore::DatabaseThread::recordDatabaseClosed):
(WebCore::DatabaseThread::hasPendingDatabaseActivity const):
* Modules/webdatabase/DatabaseThread.h:
* Modules/webdatabase/SQLCallbackWrapper.h:
(WebCore::SQLCallbackWrapper::clear):
(WebCore::SQLCallbackWrapper::unwrap):
* Modules/webdatabase/SQLTransaction.cpp:
(WebCore::SQLTransaction::enqueueStatement):
(WebCore::SQLTransaction::checkAndHandleClosedDatabase):
(WebCore::SQLTransaction::getNextStatement):
* Modules/webdatabase/SQLTransaction.h:
* Modules/webdatabase/SQLTransactionBackend.cpp:
(WebCore::SQLTransactionBackend::doCleanup):
* accessibility/isolatedtree/AXIsolatedTree.h:
(WebCore::AXIsolatedTree::WTF_GUARDED_BY_LOCK):
* platform/AbortableTaskQueue.h:
* platform/audio/cocoa/AudioDestinationCocoa.cpp:
(WebCore::AudioDestinationCocoa::render):
* platform/audio/cocoa/AudioDestinationCocoa.h:
* platform/audio/gstreamer/AudioDestinationGStreamer.h:
* platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
(WebCore::AudioSourceProviderGStreamer::provideInput):
(WebCore::AudioSourceProviderGStreamer::handleSample):
(WebCore::AudioSourceProviderGStreamer::clearAdapters):
* platform/audio/gstreamer/AudioSourceProviderGStreamer.h:
* platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
(webKitWebAudioSrcRenderIteration):
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::AVFWrapper::addToMap):
(WebCore::AVFWrapper::removeFromMap const):
(WebCore::AVFWrapper::avfWrapperForCallbackContext):
(WebCore::AVFWrapper::periodicTimeObserverCallback):
(WebCore::AVFWrapper::processNotification):
(WebCore::AVFWrapper::loadPlayableCompletionCallback):
(WebCore::AVFWrapper::loadMetadataCompletionCallback):
(WebCore::AVFWrapper::seekCompletedCallback):
(WebCore::AVFWrapper::processCue):
(WebCore::AVFWrapper::legibleOutputCallback):
(WebCore::AVFWrapper::processShouldWaitForLoadingOfResource):
(WebCore::AVFWrapper::resourceLoaderShouldWaitForLoadingOfRequestedResource):
2021-05-22 Chris Dumez <cdumez@apple.com>
Use CheckedLock in SpeechRecognitionCaptureSourceImpl
https://bugs.webkit.org/show_bug.cgi?id=226131
Reviewed by Darin Adler.
Use CheckedLock in SpeechRecognitionCaptureSourceImpl to benefit from Clang Thread
Safety Analysis. Note that audioSamplesAvailable() does not grab the lock before using
m_dataSource, only when setting the data member. It is unclear why it is safe so I
used WTF_IGNORES_THREAD_SAFETY_ANALYSIS and added a FIXME comment.
* Modules/speech/SpeechRecognitionCaptureSourceImpl.cpp:
(WebCore::SpeechRecognitionCaptureSourceImpl::updateDataSource):
(WebCore::SpeechRecognitionCaptureSourceImpl::pullSamplesAndCallDataCallback):
* Modules/speech/SpeechRecognitionCaptureSourceImpl.h:
2021-05-22 Chris Dumez <cdumez@apple.com>
Replace LockHolder with Locker in local variables
https://bugs.webkit.org/show_bug.cgi?id=226133
Reviewed by Darin Adler.
Replace LockHolder with Locker in local variables. It is shorter and it allows switching the lock
type more easily since the compiler with deduce the lock type T for Locker<T>.
* Modules/webaudio/AsyncAudioDecoder.cpp:
(WebCore::AsyncAudioDecoder::AsyncAudioDecoder):
(WebCore::AsyncAudioDecoder::runLoop):
* Modules/webdatabase/Database.cpp:
(WebCore::Database::performClose):
(WebCore::Database::inProgressTransactionCompleted):
(WebCore::Database::hasPendingTransaction):
(WebCore::Database::runTransaction):
* Modules/webdatabase/DatabaseThread.cpp:
(WebCore::DatabaseThread::start):
(WebCore::DatabaseThread::databaseThread):
(WebCore::DatabaseThread::recordDatabaseOpen):
(WebCore::DatabaseThread::recordDatabaseClosed):
(WebCore::DatabaseThread::hasPendingDatabaseActivity const):
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::canEstablishDatabase):
(WebCore::DatabaseTracker::retryCanEstablishDatabase):
(WebCore::DatabaseTracker::maximumSize):
(WebCore::DatabaseTracker::fullPathForDatabase):
(WebCore::DatabaseTracker::origins):
(WebCore::DatabaseTracker::databaseNames):
(WebCore::DatabaseTracker::detailsForNameAndOrigin):
(WebCore::DatabaseTracker::setDatabaseDetails):
(WebCore::DatabaseTracker::doneCreatingDatabase):
(WebCore::DatabaseTracker::openDatabases):
(WebCore::DatabaseTracker::addOpenDatabase):
(WebCore::DatabaseTracker::removeOpenDatabase):
(WebCore::DatabaseTracker::originLockFor):
(WebCore::DatabaseTracker::quota):
(WebCore::DatabaseTracker::setQuota):
(WebCore::DatabaseTracker::deleteOrigin):
(WebCore::DatabaseTracker::deleteDatabase):
(WebCore::DatabaseTracker::deleteDatabaseFile):
(WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
* Modules/webdatabase/SQLCallbackWrapper.h:
(WebCore::SQLCallbackWrapper::clear):
(WebCore::SQLCallbackWrapper::unwrap):
* Modules/webdatabase/SQLTransaction.cpp:
(WebCore::SQLTransaction::enqueueStatement):
(WebCore::SQLTransaction::checkAndHandleClosedDatabase):
(WebCore::SQLTransaction::getNextStatement):
* Modules/webdatabase/SQLTransactionBackend.cpp:
(WebCore::SQLTransactionBackend::doCleanup):
* accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::clear):
(WebCore::AXIsolatedTree::generateSubtree):
(WebCore::AXIsolatedTree::createSubtree):
(WebCore::AXIsolatedTree::updateNode):
(WebCore::AXIsolatedTree::updateNodeProperty):
(WebCore::AXIsolatedTree::updateChildren):
(WebCore::AXIsolatedTree::focusedNode):
(WebCore::AXIsolatedTree::rootNode):
(WebCore::AXIsolatedTree::setFocusedNodeID):
(WebCore::AXIsolatedTree::removeNode):
(WebCore::AXIsolatedTree::removeSubtree):
(WebCore::AXIsolatedTree::applyPendingChanges):
* page/scrolling/mac/ScrollingTreeMac.mm:
(ScrollingTreeMac::scrollingNodeForPoint):
(ScrollingTreeMac::eventListenerRegionTypesForPoint const):
* platform/AbortableTaskQueue.h:
* platform/audio/cocoa/CARingBuffer.cpp:
(WebCore::CARingBufferStorageVector::flush):
(WebCore::CARingBufferStorageVector::setCurrentFrameBounds):
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::AVFWrapper::addToMap):
(WebCore::AVFWrapper::removeFromMap const):
(WebCore::AVFWrapper::periodicTimeObserverCallback):
(WebCore::AVFWrapper::processNotification):
(WebCore::AVFWrapper::loadPlayableCompletionCallback):
(WebCore::AVFWrapper::loadMetadataCompletionCallback):
(WebCore::AVFWrapper::seekCompletedCallback):
(WebCore::AVFWrapper::processCue):
(WebCore::AVFWrapper::legibleOutputCallback):
(WebCore::AVFWrapper::processShouldWaitForLoadingOfResource):
(WebCore::AVFWrapper::resourceLoaderShouldWaitForLoadingOfRequestedResource):
* platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
(-[WebCoreSharedBufferResourceLoaderDelegate setExpectedContentSize:]):
(-[WebCoreSharedBufferResourceLoaderDelegate updateData:complete:]):
(-[WebCoreSharedBufferResourceLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]):
(-[WebCoreSharedBufferResourceLoaderDelegate resourceLoader:didCancelLoadingRequest:]):
(WebCore::ImageDecoderAVFObjC::setTrack):
(WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex):
* platform/graphics/gstreamer/ImageDecoderGStreamer.cpp:
(WebCore::ImageDecoderGStreamer::createFrameImageAtIndex):
* platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
(WebCore::InbandTextTrackPrivateGStreamer::handleSample):
(WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfSample):
* platform/graphics/gstreamer/MainThreadNotifier.h:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::parseInitDataFromProtectionMessage):
(WebCore::MediaPlayerPrivateGStreamer::handleProtectionEvent):
* platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
(WebCore::TrackPrivateBaseGStreamer::tagsChanged):
(WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged):
* platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
(VideoRenderRequestScheduler::start):
(VideoRenderRequestScheduler::stop):
(VideoRenderRequestScheduler::drain):
(VideoRenderRequestScheduler::requestRender):
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
(transformInPlace):
(sinkEventHandler):
(webKitMediaCommonEncryptionDecryptIsFlushing):
(setContext):
* platform/graphics/nicosia/NicosiaBuffer.cpp:
(Nicosia::Buffer::beginPainting):
(Nicosia::Buffer::completePainting):
(Nicosia::Buffer::waitUntilPaintingComplete):
* platform/graphics/nicosia/NicosiaPlatformLayer.h:
(Nicosia::PlatformLayer::setSceneIntegration):
(Nicosia::PlatformLayer::createUpdateScope):
(Nicosia::CompositionLayer::updateState):
(Nicosia::CompositionLayer::flushState):
(Nicosia::CompositionLayer::commitState):
(Nicosia::CompositionLayer::accessPending):
(Nicosia::CompositionLayer::accessCommitted):
* platform/graphics/nicosia/NicosiaScene.h:
(Nicosia::Scene::accessState):
* platform/graphics/nicosia/NicosiaSceneIntegration.cpp:
(Nicosia::SceneIntegration::setClient):
(Nicosia::SceneIntegration::invalidate):
(Nicosia::SceneIntegration::requestUpdate):
* platform/graphics/nicosia/texmap/NicosiaBackingStoreTextureMapperImpl.cpp:
(Nicosia::BackingStoreTextureMapperImpl::flushUpdate):
(Nicosia::BackingStoreTextureMapperImpl::takeUpdate):
* platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.cpp:
(Nicosia::ContentLayerTextureMapperImpl::~ContentLayerTextureMapperImpl):
(Nicosia::ContentLayerTextureMapperImpl::invalidateClient):
(Nicosia::ContentLayerTextureMapperImpl::flushUpdate):
(Nicosia::ContentLayerTextureMapperImpl::swapBuffersIfNeeded):
* platform/graphics/nicosia/texmap/NicosiaImageBackingTextureMapperImpl.cpp:
(Nicosia::ImageBackingTextureMapperImpl::flushUpdate):
(Nicosia::ImageBackingTextureMapperImpl::takeUpdate):
* platform/graphics/texmap/TextureMapperGCGLPlatformLayer.cpp:
(WebCore::TextureMapperGCGLPlatformLayer::swapBuffersIfNeeded):
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::MediaPlayerPrivateMediaFoundation::load):
(WebCore::MediaPlayerPrivateMediaFoundation::naturalSize const):
(WebCore::MediaPlayerPrivateMediaFoundation::addListener):
(WebCore::MediaPlayerPrivateMediaFoundation::removeListener):
(WebCore::MediaPlayerPrivateMediaFoundation::notifyDeleted):
(WebCore::MediaPlayerPrivateMediaFoundation::setNaturalSize):
(WebCore::MediaPlayerPrivateMediaFoundation::AsyncCallback::Invoke):
(WebCore::MediaPlayerPrivateMediaFoundation::AsyncCallback::onMediaPlayerDeleted):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::OnClockStart):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::OnClockStop):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::OnClockPause):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::OnClockRestart):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::OnClockSetRate):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::ProcessMessage):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::GetCurrentMediaType):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::InitServicePointers):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::ReleaseServicePointers):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::SetVideoWindow):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::GetVideoWindow):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::SetVideoPosition):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::GetVideoPosition):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::RepaintVideo):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoSamplePool::getSample):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoSamplePool::returnSample):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoSamplePool::areSamplesPending):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoSamplePool::initialize):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoSamplePool::clear):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoScheduler::stopScheduler):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoScheduler::scheduleSample):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoScheduler::processSamplesInQueue):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoScheduler::processSample):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoScheduler::schedulerThreadProcPrivate):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::setVideoWindow):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::setDestinationRect):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::createVideoSamples):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::checkDeviceState):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::createD3DDevice):
* platform/image-decoders/ScalableImageDecoder.cpp:
(WebCore::ScalableImageDecoder::frameIsCompleteAtIndex const):
(WebCore::ScalableImageDecoder::frameHasAlphaAtIndex const):
(WebCore::ScalableImageDecoder::frameBytesAtIndex const):
(WebCore::ScalableImageDecoder::frameDurationAtIndex const):
(WebCore::ScalableImageDecoder::createFrameImageAtIndex):
* platform/image-decoders/ScalableImageDecoder.h:
* platform/ios/LegacyTileCache.mm:
(WebCore::LegacyTileCache::setTilesOpaque):
(WebCore::LegacyTileCache::doLayoutTiles):
(WebCore::LegacyTileCache::setCurrentScale):
(WebCore::LegacyTileCache::commitScaleChange):
(WebCore::LegacyTileCache::layoutTilesNow):
(WebCore::LegacyTileCache::layoutTilesNowForRect):
(WebCore::LegacyTileCache::removeAllNonVisibleTiles):
(WebCore::LegacyTileCache::removeAllTiles):
(WebCore::LegacyTileCache::removeForegroundTiles):
(WebCore::LegacyTileCache::setContentReplacementImage):
(WebCore::LegacyTileCache::contentReplacementImage const):
(WebCore::LegacyTileCache::tileCreationTimerFired):
(WebCore::LegacyTileCache::setNeedsDisplayInRect):
(WebCore::LegacyTileCache::updateTilingMode):
(WebCore::LegacyTileCache::setTilingMode):
(WebCore::LegacyTileCache::doPendingRepaints):
(WebCore::LegacyTileCache::flushSavedDisplayRects):
(WebCore::LegacyTileCache::prepareToDraw):
* platform/ios/LegacyTileLayerPool.mm:
(WebCore::LegacyTileLayerPool::addLayer):
(WebCore::LegacyTileLayerPool::takeLayerWithSize):
(WebCore::LegacyTileLayerPool::setCapacity):
(WebCore::LegacyTileLayerPool::prune):
(WebCore::LegacyTileLayerPool::drain):
* platform/ios/wak/WAKWindow.mm:
(-[WAKWindow setExposedScrollViewRect:]):
(-[WAKWindow exposedScrollViewRect]):
* platform/ios/wak/WebCoreThread.mm:
(RunWebThread):
(StartWebThread):
* platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::audioSamplesAvailable):
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData):
* platform/network/cf/FormDataStreamCFNet.cpp:
(WebCore::openNextStream):
(WebCore::formFinalize):
(WebCore::formClose):
* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::setRequestPaused):
(WebCore::CurlRequest::setCallbackPaused):
(WebCore::CurlRequest::pausedStatusChanged):
(WebCore::CurlRequest::enableDownloadToFile):
(WebCore::CurlRequest::getDownloadedFilePath):
(WebCore::CurlRequest::writeDataToDownloadFileIfEnabled):
(WebCore::CurlRequest::closeDownloadFile):
(WebCore::CurlRequest::cleanupDownloadFile):
* platform/network/curl/CurlSSLHandle.cpp:
(WebCore::CurlSSLHandle::allowAnyHTTPSCertificatesForHost):
(WebCore::CurlSSLHandle::canIgnoreAnyHTTPSCertificatesForHost const):
(WebCore::CurlSSLHandle::setClientCertificateInfo):
(WebCore::CurlSSLHandle::getSSLClientCertificate const):
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::close):
(WebCore::SQLiteDatabase::maximumSize):
(WebCore::SQLiteDatabase::setMaximumSize):
(WebCore::SQLiteDatabase::pageSize):
(WebCore::SQLiteDatabase::freeSpaceSize):
(WebCore::SQLiteDatabase::totalSize):
(WebCore::SQLiteDatabase::runIncrementalVacuumCommand):
(WebCore::SQLiteDatabase::interrupt):
(WebCore::SQLiteDatabase::setAuthorizer):
(WebCore::constructAndPrepareStatement):
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::step):
2021-05-22 Devin Rousso <drousso@apple.com>
ASSERTION FAILED: Component at index 1 is 1.000000 and is greater than the allowed maximum 1.000000
https://bugs.webkit.org/show_bug.cgi?id=226118
<rdar://problem/78333590>
Reviewed by Sam Weinig.
Covered by SampledPageTopColor tests.
* platform/graphics/cg/ColorCG.cpp:
(WebCore::roundAndClampToSRGBALossy):
Use `makeFromComponentsClamping` to actually clamp the component values instead of assuming
that the `CGColorRef` will be sRGB (though it still assumes an RGB color space/format).
2021-05-22 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r277913.
https://bugs.webkit.org/show_bug.cgi?id=226140
Caused multiple layout-test crash on mac debug queues
Reverted changeset:
"Replace LockHolder with Locker in local variables"
https://bugs.webkit.org/show_bug.cgi?id=226133
https://trac.webkit.org/changeset/277913
2021-05-22 Rob Buis <rbuis@igalia.com>
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 Chris Dumez <cdumez@apple.com>
Remove WTF::holdLock() / WTF::holdLockIf()
https://bugs.webkit.org/show_bug.cgi?id=226135
Reviewed by Darin Adler.
Remove WTF::holdLock() / WTF::holdLockIf() because they are not compatible with
Clang Thread Safety Analysis. All call sites have been converted to use the Locker
constructor directly.
* dom/Node.cpp:
(WebCore::Node::eventTargetDataConcurrently):
2021-05-21 Chris Dumez <cdumez@apple.com>
Replace LockHolder with Locker in local variables
https://bugs.webkit.org/show_bug.cgi?id=226133
Reviewed by Darin Adler.
Replace LockHolder with Locker in local variables. It is shorter and it allows switching the lock
type more easily since the compiler with deduce the lock type T for Locker<T>.
* Modules/webaudio/AsyncAudioDecoder.cpp:
(WebCore::AsyncAudioDecoder::AsyncAudioDecoder):
(WebCore::AsyncAudioDecoder::runLoop):
* Modules/webdatabase/Database.cpp:
(WebCore::Database::performClose):
(WebCore::Database::inProgressTransactionCompleted):
(WebCore::Database::hasPendingTransaction):
(WebCore::Database::runTransaction):
* Modules/webdatabase/DatabaseThread.cpp:
(WebCore::DatabaseThread::start):
(WebCore::DatabaseThread::databaseThread):
(WebCore::DatabaseThread::recordDatabaseOpen):
(WebCore::DatabaseThread::recordDatabaseClosed):
(WebCore::DatabaseThread::hasPendingDatabaseActivity const):
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::canEstablishDatabase):
(WebCore::DatabaseTracker::retryCanEstablishDatabase):
(WebCore::DatabaseTracker::maximumSize):
(WebCore::DatabaseTracker::fullPathForDatabase):
(WebCore::DatabaseTracker::origins):
(WebCore::DatabaseTracker::databaseNames):
(WebCore::DatabaseTracker::detailsForNameAndOrigin):
(WebCore::DatabaseTracker::setDatabaseDetails):
(WebCore::DatabaseTracker::doneCreatingDatabase):
(WebCore::DatabaseTracker::openDatabases):
(WebCore::DatabaseTracker::addOpenDatabase):
(WebCore::DatabaseTracker::removeOpenDatabase):
(WebCore::DatabaseTracker::originLockFor):
(WebCore::DatabaseTracker::quota):
(WebCore::DatabaseTracker::setQuota):
(WebCore::DatabaseTracker::deleteOrigin):
(WebCore::DatabaseTracker::deleteDatabase):
(WebCore::DatabaseTracker::deleteDatabaseFile):
(WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
* Modules/webdatabase/SQLCallbackWrapper.h:
(WebCore::SQLCallbackWrapper::clear):
(WebCore::SQLCallbackWrapper::unwrap):
* Modules/webdatabase/SQLTransaction.cpp:
(WebCore::SQLTransaction::enqueueStatement):
(WebCore::SQLTransaction::checkAndHandleClosedDatabase):
(WebCore::SQLTransaction::getNextStatement):
* Modules/webdatabase/SQLTransactionBackend.cpp:
(WebCore::SQLTransactionBackend::doCleanup):
* accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::clear):
(WebCore::AXIsolatedTree::generateSubtree):
(WebCore::AXIsolatedTree::createSubtree):
(WebCore::AXIsolatedTree::updateNode):
(WebCore::AXIsolatedTree::updateNodeProperty):
(WebCore::AXIsolatedTree::updateChildren):
(WebCore::AXIsolatedTree::focusedNode):
(WebCore::AXIsolatedTree::rootNode):
(WebCore::AXIsolatedTree::setFocusedNodeID):
(WebCore::AXIsolatedTree::removeNode):
(WebCore::AXIsolatedTree::removeSubtree):
(WebCore::AXIsolatedTree::applyPendingChanges):
* page/scrolling/mac/ScrollingTreeMac.mm:
(ScrollingTreeMac::scrollingNodeForPoint):
(ScrollingTreeMac::eventListenerRegionTypesForPoint const):
* platform/AbortableTaskQueue.h:
* platform/audio/cocoa/CARingBuffer.cpp:
(WebCore::CARingBufferStorageVector::flush):
(WebCore::CARingBufferStorageVector::setCurrentFrameBounds):
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::AVFWrapper::addToMap):
(WebCore::AVFWrapper::removeFromMap const):
(WebCore::AVFWrapper::periodicTimeObserverCallback):
(WebCore::AVFWrapper::processNotification):
(WebCore::AVFWrapper::loadPlayableCompletionCallback):
(WebCore::AVFWrapper::loadMetadataCompletionCallback):
(WebCore::AVFWrapper::seekCompletedCallback):
(WebCore::AVFWrapper::processCue):
(WebCore::AVFWrapper::legibleOutputCallback):
(WebCore::AVFWrapper::processShouldWaitForLoadingOfResource):
(WebCore::AVFWrapper::resourceLoaderShouldWaitForLoadingOfRequestedResource):
* platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
(-[WebCoreSharedBufferResourceLoaderDelegate setExpectedContentSize:]):
(-[WebCoreSharedBufferResourceLoaderDelegate updateData:complete:]):
(-[WebCoreSharedBufferResourceLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]):
(-[WebCoreSharedBufferResourceLoaderDelegate resourceLoader:didCancelLoadingRequest:]):
(WebCore::ImageDecoderAVFObjC::setTrack):
(WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex):
* platform/graphics/gstreamer/ImageDecoderGStreamer.cpp:
(WebCore::ImageDecoderGStreamer::createFrameImageAtIndex):
* platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
(WebCore::InbandTextTrackPrivateGStreamer::handleSample):
(WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfSample):
* platform/graphics/gstreamer/MainThreadNotifier.h:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::parseInitDataFromProtectionMessage):
(WebCore::MediaPlayerPrivateGStreamer::handleProtectionEvent):
* platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
(WebCore::TrackPrivateBaseGStreamer::tagsChanged):
(WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged):
* platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
(VideoRenderRequestScheduler::start):
(VideoRenderRequestScheduler::stop):
(VideoRenderRequestScheduler::drain):
(VideoRenderRequestScheduler::requestRender):
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
(transformInPlace):
(sinkEventHandler):
(webKitMediaCommonEncryptionDecryptIsFlushing):
(setContext):
* platform/graphics/nicosia/NicosiaBuffer.cpp:
(Nicosia::Buffer::beginPainting):
(Nicosia::Buffer::completePainting):
(Nicosia::Buffer::waitUntilPaintingComplete):
* platform/graphics/nicosia/NicosiaPlatformLayer.h:
(Nicosia::PlatformLayer::setSceneIntegration):
(Nicosia::PlatformLayer::createUpdateScope):
(Nicosia::CompositionLayer::updateState):
(Nicosia::CompositionLayer::flushState):
(Nicosia::CompositionLayer::commitState):
(Nicosia::CompositionLayer::accessPending):
(Nicosia::CompositionLayer::accessCommitted):
* platform/graphics/nicosia/NicosiaScene.h:
(Nicosia::Scene::accessState):
* platform/graphics/nicosia/NicosiaSceneIntegration.cpp:
(Nicosia::SceneIntegration::setClient):
(Nicosia::SceneIntegration::invalidate):
(Nicosia::SceneIntegration::requestUpdate):
* platform/graphics/nicosia/texmap/NicosiaBackingStoreTextureMapperImpl.cpp:
(Nicosia::BackingStoreTextureMapperImpl::flushUpdate):
(Nicosia::BackingStoreTextureMapperImpl::takeUpdate):
* platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.cpp:
(Nicosia::ContentLayerTextureMapperImpl::~ContentLayerTextureMapperImpl):
(Nicosia::ContentLayerTextureMapperImpl::invalidateClient):
(Nicosia::ContentLayerTextureMapperImpl::flushUpdate):
(Nicosia::ContentLayerTextureMapperImpl::swapBuffersIfNeeded):
* platform/graphics/nicosia/texmap/NicosiaImageBackingTextureMapperImpl.cpp:
(Nicosia::ImageBackingTextureMapperImpl::flushUpdate):
(Nicosia::ImageBackingTextureMapperImpl::takeUpdate):
* platform/graphics/texmap/TextureMapperGCGLPlatformLayer.cpp:
(WebCore::TextureMapperGCGLPlatformLayer::swapBuffersIfNeeded):
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::MediaPlayerPrivateMediaFoundation::load):
(WebCore::MediaPlayerPrivateMediaFoundation::naturalSize const):
(WebCore::MediaPlayerPrivateMediaFoundation::addListener):
(WebCore::MediaPlayerPrivateMediaFoundation::removeListener):
(WebCore::MediaPlayerPrivateMediaFoundation::notifyDeleted):
(WebCore::MediaPlayerPrivateMediaFoundation::setNaturalSize):
(WebCore::MediaPlayerPrivateMediaFoundation::AsyncCallback::Invoke):
(WebCore::MediaPlayerPrivateMediaFoundation::AsyncCallback::onMediaPlayerDeleted):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::OnClockStart):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::OnClockStop):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::OnClockPause):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::OnClockRestart):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::OnClockSetRate):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::ProcessMessage):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::GetCurrentMediaType):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::InitServicePointers):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::ReleaseServicePointers):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::SetVideoWindow):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::GetVideoWindow):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::SetVideoPosition):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::GetVideoPosition):
(WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::RepaintVideo):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoSamplePool::getSample):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoSamplePool::returnSample):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoSamplePool::areSamplesPending):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoSamplePool::initialize):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoSamplePool::clear):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoScheduler::stopScheduler):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoScheduler::scheduleSample):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoScheduler::processSamplesInQueue):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoScheduler::processSample):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoScheduler::schedulerThreadProcPrivate):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::setVideoWindow):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::setDestinationRect):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::createVideoSamples):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::checkDeviceState):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::createD3DDevice):
* platform/image-decoders/ScalableImageDecoder.cpp:
(WebCore::ScalableImageDecoder::frameIsCompleteAtIndex const):
(WebCore::ScalableImageDecoder::frameHasAlphaAtIndex const):
(WebCore::ScalableImageDecoder::frameBytesAtIndex const):
(WebCore::ScalableImageDecoder::frameDurationAtIndex const):
(WebCore::ScalableImageDecoder::createFrameImageAtIndex):
* platform/image-decoders/ScalableImageDecoder.h:
* platform/ios/LegacyTileCache.mm:
(WebCore::LegacyTileCache::setTilesOpaque):
(WebCore::LegacyTileCache::doLayoutTiles):
(WebCore::LegacyTileCache::setCurrentScale):
(WebCore::LegacyTileCache::commitScaleChange):
(WebCore::LegacyTileCache::layoutTilesNow):
(WebCore::LegacyTileCache::layoutTilesNowForRect):
(WebCore::LegacyTileCache::removeAllNonVisibleTiles):
(WebCore::LegacyTileCache::removeAllTiles):
(WebCore::LegacyTileCache::removeForegroundTiles):
(WebCore::LegacyTileCache::setContentReplacementImage):
(WebCore::LegacyTileCache::contentReplacementImage const):
(WebCore::LegacyTileCache::tileCreationTimerFired):
(WebCore::LegacyTileCache::setNeedsDisplayInRect):
(WebCore::LegacyTileCache::updateTilingMode):
(WebCore::LegacyTileCache::setTilingMode):
(WebCore::LegacyTileCache::doPendingRepaints):
(WebCore::LegacyTileCache::flushSavedDisplayRects):
(WebCore::LegacyTileCache::prepareToDraw):
* platform/ios/LegacyTileLayerPool.mm:
(WebCore::LegacyTileLayerPool::addLayer):
(WebCore::LegacyTileLayerPool::takeLayerWithSize):
(WebCore::LegacyTileLayerPool::setCapacity):
(WebCore::LegacyTileLayerPool::prune):
(WebCore::LegacyTileLayerPool::drain):
* platform/ios/wak/WAKWindow.mm:
(-[WAKWindow setExposedScrollViewRect:]):
(-[WAKWindow exposedScrollViewRect]):
* platform/ios/wak/WebCoreThread.mm:
(RunWebThread):
(StartWebThread):
* platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::audioSamplesAvailable):
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData):
* platform/network/cf/FormDataStreamCFNet.cpp:
(WebCore::openNextStream):
(WebCore::formFinalize):
(WebCore::formClose):
* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::setRequestPaused):
(WebCore::CurlRequest::setCallbackPaused):
(WebCore::CurlRequest::pausedStatusChanged):
(WebCore::CurlRequest::enableDownloadToFile):
(WebCore::CurlRequest::getDownloadedFilePath):
(WebCore::CurlRequest::writeDataToDownloadFileIfEnabled):
(WebCore::CurlRequest::closeDownloadFile):
(WebCore::CurlRequest::cleanupDownloadFile):
* platform/network/curl/CurlSSLHandle.cpp:
(WebCore::CurlSSLHandle::allowAnyHTTPSCertificatesForHost):
(WebCore::CurlSSLHandle::canIgnoreAnyHTTPSCertificatesForHost const):
(WebCore::CurlSSLHandle::setClientCertificateInfo):
(WebCore::CurlSSLHandle::getSSLClientCertificate const):
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::close):
(WebCore::SQLiteDatabase::maximumSize):
(WebCore::SQLiteDatabase::setMaximumSize):
(WebCore::SQLiteDatabase::pageSize):
(WebCore::SQLiteDatabase::freeSpaceSize):
(WebCore::SQLiteDatabase::totalSize):
(WebCore::SQLiteDatabase::runIncrementalVacuumCommand):
(WebCore::SQLiteDatabase::interrupt):
(WebCore::SQLiteDatabase::setAuthorizer):
(WebCore::constructAndPrepareStatement):
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::step):
2021-05-21 Chris Dumez <cdumez@apple.com>
Fix locking issue for AudioDestinationCocoa::m_isPlaying
https://bugs.webkit.org/show_bug.cgi?id=226129
Reviewed by Jer Noble.
Fix locking issue for AudioDestinationCocoa::m_isPlaying. The AudioDestinationCocoa::isPlaying()
getter fails to lock. isPlaying() may get called from the main thread and the audio rendering
thread. Since we cannot grab a lock on the rendering thread, use std::atomic<bool> type for
m_isPlaying.
* platform/audio/cocoa/AudioDestinationCocoa.cpp:
(WebCore::AudioDestinationCocoa::setIsPlaying):
(WebCore::AudioDestinationCocoa::renderOnRenderingTheadIfPlaying):
* platform/audio/cocoa/AudioDestinationCocoa.h:
2021-05-21 Chris Dumez <cdumez@apple.com>
Stop using holdLock() in WebCore as it is not compatible with Clang thread safety analysis
https://bugs.webkit.org/show_bug.cgi?id=226119
Reviewed by Sam Weinig.
Stop using holdLock() in WebCore as it is not compatible with Clang thread safety analysis
(WTF::CheckedLock). Use the Locker constructor directly instead.
This is a step towards getting rid of holdLock() entirely.
* Modules/speech/SpeechRecognitionCaptureSourceImpl.cpp:
(WebCore::SpeechRecognitionCaptureSourceImpl::audioSamplesAvailable):
* Modules/webaudio/AudioBuffer.cpp:
(WebCore::AudioBuffer::releaseMemory):
(WebCore::AudioBuffer::memoryCost const):
* Modules/webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::setBuffer):
(WebCore::AudioBufferSourceNode::startPlaying):
* Modules/webaudio/AudioWorkletNode.cpp:
(WebCore::AudioWorkletNode::~AudioWorkletNode):
(WebCore::AudioWorkletNode::initializeAudioParameters):
(WebCore::AudioWorkletNode::setProcessor):
* Modules/webaudio/ConvolverNode.cpp:
(WebCore::ConvolverNode::setBuffer):
* Modules/webaudio/MediaElementAudioSourceNode.cpp:
(WebCore::MediaElementAudioSourceNode::setFormat):
* Modules/webaudio/MediaStreamAudioSourceNode.cpp:
(WebCore::MediaStreamAudioSourceNode::setFormat):
* Modules/webaudio/OscillatorNode.cpp:
(WebCore::OscillatorNode::setPeriodicWave):
* Modules/webaudio/PannerNode.cpp:
(WebCore::PannerNode::setPanningModel):
(WebCore::PannerNode::setPosition):
(WebCore::PannerNode::setOrientation):
(WebCore::PannerNode::setDistanceModel):
(WebCore::PannerNode::setRefDistance):
(WebCore::PannerNode::setMaxDistance):
(WebCore::PannerNode::setRolloffFactor):
(WebCore::PannerNode::setConeOuterGain):
(WebCore::PannerNode::setConeOuterAngle):
(WebCore::PannerNode::setConeInnerAngle):
* Modules/webaudio/ScriptProcessorNode.cpp:
(WebCore::ScriptProcessorNode::uninitialize):
(WebCore::ScriptProcessorNode::process):
* Modules/webaudio/WaveShaperProcessor.cpp:
(WebCore::WaveShaperProcessor::setCurve):
(WebCore::WaveShaperProcessor::setOversample):
* Modules/webdatabase/Database.cpp:
(WebCore::Database::performOpenAndVerify):
* Modules/webdatabase/DatabaseManager.cpp:
(WebCore::DatabaseManager::addProposedDatabase):
(WebCore::DatabaseManager::removeProposedDatabase):
(WebCore::DatabaseManager::fullPathForDatabase):
(WebCore::DatabaseManager::detailsForNameAndOrigin):
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::scheduleNotifyDatabaseChanged):
(WebCore::DatabaseTracker::notifyDatabasesChanged):
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::visitChildrenImpl):
* bindings/js/JSPaintWorkletGlobalScopeCustom.cpp:
(WebCore::JSPaintWorkletGlobalScope::visitAdditionalChildren):
* css/CSSPaintImageValue.cpp:
(WebCore::CSSPaintImageValue::image):
* css/DOMCSSPaintWorklet.cpp:
(WebCore::PaintWorklet::addModule):
* dom/EventListenerMap.cpp:
(WebCore::EventListenerMap::clear):
(WebCore::EventListenerMap::replace):
(WebCore::EventListenerMap::add):
(WebCore::EventListenerMap::remove):
(WebCore::EventListenerMap::removeFirstEventListenerCreatedFromMarkup):
* dom/EventTarget.cpp:
(WebCore::EventTarget::visitJSEventListeners):
* dom/Node.cpp:
(WebCore::Node::ensureEventTargetData):
(WebCore::Node::clearEventTargetData):
* html/CanvasBase.cpp:
(WebCore::CanvasBase::memoryCost const):
(WebCore::CanvasBase::externalMemoryCost const):
(WebCore::CanvasBase::setImageBuffer const):
* html/HTMLCollection.cpp:
(WebCore::HTMLCollection::invalidateNamedElementCache const):
* html/HTMLCollection.h:
(WebCore::HTMLCollection::memoryCost const):
(WebCore::HTMLCollection::setNamedItemCache const):
* html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::pushBufferToPlaceholder):
(WebCore::OffscreenCanvas::commitToPlaceholderCanvas):
* html/canvas/OESVertexArrayObject.cpp:
(WebCore::OESVertexArrayObject::deleteVertexArrayOES):
(WebCore::OESVertexArrayObject::bindVertexArrayOES):
* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::bindFramebuffer):
(WebCore::WebGL2RenderingContext::deleteFramebuffer):
(WebCore::WebGL2RenderingContext::vertexAttribIPointer):
(WebCore::WebGL2RenderingContext::deleteQuery):
(WebCore::WebGL2RenderingContext::beginQuery):
(WebCore::WebGL2RenderingContext::endQuery):
(WebCore::WebGL2RenderingContext::deleteSampler):
(WebCore::WebGL2RenderingContext::bindSampler):
(WebCore::WebGL2RenderingContext::deleteSync):
(WebCore::WebGL2RenderingContext::deleteTransformFeedback):
(WebCore::WebGL2RenderingContext::bindTransformFeedback):
(WebCore::WebGL2RenderingContext::beginTransformFeedback):
(WebCore::WebGL2RenderingContext::setIndexedBufferBinding):
(WebCore::WebGL2RenderingContext::deleteVertexArray):
(WebCore::WebGL2RenderingContext::bindVertexArray):
(WebCore::WebGL2RenderingContext::addMembersToOpaqueRoots):
* html/canvas/WebGLContextGroup.cpp:
(WebCore::WebGLContextGroup::detachAndRemoveAllObjects):
* html/canvas/WebGLFramebuffer.cpp:
(WebCore::WebGLFramebuffer::initializeAttachments):
(WebCore::WebGLFramebuffer::setAttachmentInternal):
* html/canvas/WebGLObject.cpp:
(WebCore::WebGLObject::runDestructor):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::attachShader):
(WebCore::WebGLRenderingContextBase::bindBuffer):
(WebCore::WebGLRenderingContextBase::bindFramebuffer):
(WebCore::WebGLRenderingContextBase::bindRenderbuffer):
(WebCore::WebGLRenderingContextBase::bindTexture):
(WebCore::WebGLRenderingContextBase::deleteBuffer):
(WebCore::WebGLRenderingContextBase::deleteFramebuffer):
(WebCore::WebGLRenderingContextBase::deleteProgram):
(WebCore::WebGLRenderingContextBase::deleteRenderbuffer):
(WebCore::WebGLRenderingContextBase::deleteShader):
(WebCore::WebGLRenderingContextBase::deleteTexture):
(WebCore::WebGLRenderingContextBase::detachShader):
(WebCore::WebGLRenderingContextBase::useProgram):
(WebCore::WebGLRenderingContextBase::vertexAttribPointer):
(WebCore::WebGLRenderingContextBase::detachAndRemoveAllObjects):
(WebCore::WebGLRenderingContextBase::addMembersToOpaqueRoots):
* platform/audio/ReverbConvolver.cpp:
(WebCore::ReverbConvolver::~ReverbConvolver):
* platform/audio/cocoa/AudioDestinationCocoa.cpp:
(WebCore::AudioDestinationCocoa::start):
(WebCore::AudioDestinationCocoa::stop):
(WebCore::AudioDestinationCocoa::setIsPlaying):
* platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
(WebCore::AudioSourceProviderGStreamer::handleSample):
(WebCore::AudioSourceProviderGStreamer::clearAdapters):
* platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
(webkitWebAudioSourceSetDispatchToRenderThreadFunction):
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::requestRefreshCallback):
(WebCore::DisplayRefreshMonitor::displayLinkFired):
(WebCore::DisplayRefreshMonitor::displayDidRefresh):
* platform/graphics/FontCache.cpp:
(WebCore::FontCache::cachedFontPlatformData):
(WebCore::FontCache::fontForPlatformData):
(WebCore::FontCache::purgeInactiveFontData):
(WebCore::FontCache::inactiveFontCount):
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::destroyMixIfNeeded):
(WebCore::AudioSourceProviderAVFObjC::createMixIfNeeded):
(WebCore::AudioSourceProviderAVFObjC::prepareCallback):
(WebCore::AudioSourceProviderAVFObjC::unprepareCallback):
(WebCore::AudioSourceProviderAVFObjC::processCallback):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rootLayerBoundsDidChange):
* platform/graphics/cg/ColorCG.cpp:
(WebCore::cachedCGColor):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::hasFirstVideoSampleReachedSink const):
(WebCore::MediaPlayerPrivateGStreamer::pushTextureToCompositor):
(WebCore::MediaPlayerPrivateGStreamer::triggerRepaint):
(WebCore::MediaPlayerPrivateGStreamer::flushCurrentBuffer):
(WebCore::MediaPlayerPrivateGStreamer::paint):
(WebCore::MediaPlayerPrivateGStreamer::copyVideoTextureToPlatformTexture):
(WebCore::MediaPlayerPrivateGStreamer::waitForCDMAttachment):
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webKitWebSrcConstructed):
(webKitWebSrcGetProperty):
(webKitWebSrcSetContext):
(webKitWebSrcCreate):
(webKitWebSrcMakeRequest):
(webKitWebSrcStop):
(webKitWebSrcGetSize):
(webKitWebSrcIsSeekable):
(webKitWebSrcDoSeek):
(webKitWebSrcQuery):
(webKitWebSrcUnLock):
(webKitWebSrcUnLockStop):
(webKitWebSrcSetMediaPlayer):
(webKitSrcPassedCORSAccessCheck):
(CachedResourceStreamingClient::responseReceived):
(CachedResourceStreamingClient::dataReceived):
(CachedResourceStreamingClient::accessControlCheckFailed):
(CachedResourceStreamingClient::loadFailed):
(CachedResourceStreamingClient::loadFinished):
(webKitSrcWouldTaintOrigin):
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
(isCDMProxyAvailable):
(attachCDMProxy):
* platform/graphics/gstreamer/mse/MediaSourceTrackGStreamer.cpp:
(WebCore::MediaSourceTrackGStreamer::isReadyForMoreSamples):
(WebCore::MediaSourceTrackGStreamer::notifyWhenReadyForMoreSamples):
(WebCore::MediaSourceTrackGStreamer::enqueueObject):
(WebCore::MediaSourceTrackGStreamer::clearQueue):
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
(webKitMediaSrcActivateMode):
(webKitMediaSrcPadLinked):
(webKitMediaSrcLoop):
(webKitMediaSrcStreamFlush):
* platform/graphics/mac/ColorMac.mm:
(WebCore::nsColor):
* platform/graphics/nicosia/NicosiaImageBufferPipe.cpp:
(Nicosia::NicosiaImageBufferPipeSource::handle):
* platform/ios/wak/WebCoreThread.mm:
(HandleDelegateSource):
(WebThreadAdoptAndRelease):
(WebCoreObjCDeallocOnWebThreadImpl):
(WebCoreObjCDeallocWithWebThreadLockImpl):
(HandleWebThreadReleaseSource):
* platform/ios/wak/WebCoreThreadRun.cpp:
* platform/mac/PublicSuffixMac.mm:
(WebCore::topPrivatelyControlledDomain):
* platform/mediarecorder/MediaRecorderPrivateMock.cpp:
(WebCore::MediaRecorderPrivateMock::videoSampleAvailable):
(WebCore::MediaRecorderPrivateMock::audioSamplesAvailable):
(WebCore::MediaRecorderPrivateMock::fetchData):
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
(WebCore::MediaRecorderPrivateWriter::appendData):
(WebCore::MediaRecorderPrivateWriter::takeData):
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::addAudioSampleObserver):
(WebCore::RealtimeMediaSource::removeAudioSampleObserver):
(WebCore::RealtimeMediaSource::addVideoSampleObserver):
(WebCore::RealtimeMediaSource::removeVideoSampleObserver):
(WebCore::RealtimeMediaSource::videoSampleAvailable):
(WebCore::RealtimeMediaSource::audioSamplesAvailable):
* platform/mediastream/RealtimeOutgoingAudioSource.cpp:
(WebCore::RealtimeOutgoingAudioSource::~RealtimeOutgoingAudioSource):
(WebCore::RealtimeOutgoingAudioSource::AddSink):
(WebCore::RealtimeOutgoingAudioSource::RemoveSink):
(WebCore::RealtimeOutgoingAudioSource::sendAudioFrames):
* platform/mediastream/RealtimeOutgoingVideoSource.cpp:
(WebCore::RealtimeOutgoingVideoSource::~RealtimeOutgoingVideoSource):
(WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink):
(WebCore::RealtimeOutgoingVideoSource::RemoveSink):
(WebCore::RealtimeOutgoingVideoSource::sendFrame):
* platform/mediastream/mac/BaseAudioSharedUnit.cpp:
(WebCore::BaseAudioSharedUnit::addClient):
(WebCore::BaseAudioSharedUnit::removeClient):
(WebCore::BaseAudioSharedUnit::forEachClient const):
(WebCore::BaseAudioSharedUnit::clearClients):
(WebCore::BaseAudioSharedUnit::audioSamplesAvailable):
* platform/mediastream/mac/WebAudioSourceProviderCocoa.mm:
(WebCore::WebAudioSourceProviderCocoa::prepare):
* platform/network/cf/LoaderRunLoopCF.cpp:
(WebCore::loaderRunLoop):
* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::cancel):
(WebCore::CurlRequest::isCancelled):
(WebCore::CurlRequest::isCompletedOrCancelled):
(WebCore::CurlRequest::didCompleteTransfer):
* platform/network/curl/CurlRequestScheduler.cpp:
(WebCore::CurlRequestScheduler::callOnWorkerThread):
(WebCore::CurlRequestScheduler::startThreadIfNeeded):
(WebCore::CurlRequestScheduler::stopThreadIfNoMoreJobRunning):
(WebCore::CurlRequestScheduler::stopThread):
(WebCore::CurlRequestScheduler::executeTasks):
(WebCore::CurlRequestScheduler::workerThread):
(WebCore::CurlRequestScheduler::startTransfer):
(WebCore::CurlRequestScheduler::finalizeTransfer):
* platform/network/curl/CurlStreamScheduler.cpp:
(WebCore::CurlStreamScheduler::callOnWorkerThread):
(WebCore::CurlStreamScheduler::startThreadIfNeeded):
(WebCore::CurlStreamScheduler::stopThreadIfNoMoreJobRunning):
(WebCore::CurlStreamScheduler::executeTasks):
* style/StyleBuilder.cpp:
(WebCore::Style::Builder::applyProperty):
* workers/WorkerOrWorkletThread.cpp:
(WebCore::WorkerOrWorkletThread::workerOrWorkletThread):
(WebCore::WorkerOrWorkletThread::start):
* worklets/PaintWorkletGlobalScope.cpp:
(WebCore::PaintWorkletGlobalScope::registerPaint):
* worklets/PaintWorkletGlobalScope.h:
2021-05-21 Sam Weinig <weinig@apple.com>
All Netflix playback fails after r277740
https://bugs.webkit.org/show_bug.cgi?id=226120
<rdar://problem/78333782>
Reviewed by Eric Carlson.
* platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
Add missing !.
2021-05-21 Chris Dumez <cdumez@apple.com>
Use CheckedCondition in more places
https://bugs.webkit.org/show_bug.cgi?id=226113
Reviewed by Darin Adler.
Use CheckedCondition in more places to benefit from Clang Thread Safety
Analysis.
* Modules/webdatabase/DatabaseTask.cpp:
(WebCore::DatabaseTaskSynchronizer::waitForTaskCompletion):
(WebCore::DatabaseTaskSynchronizer::taskCompleted):
* Modules/webdatabase/DatabaseTask.h:
(WebCore::DatabaseTaskSynchronizer::WTF_GUARDED_BY_LOCK):
* platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
(webKitWebAudioSrcRenderAndPushFrames):
(webKitWebAudioSrcRenderIteration):
(webKitWebAudioSrcChangeState):
* platform/graphics/gstreamer/ImageDecoderGStreamer.cpp:
(WebCore::ImageDecoderGStreamer::setHasEOS):
(WebCore::ImageDecoderGStreamer::notifySample):
(WebCore::ImageDecoderGStreamer::InnerDecoder::handleMessage):
(WebCore::ImageDecoderGStreamer::InnerDecoder::preparePipeline):
(WebCore::ImageDecoderGStreamer::pushEncodedData):
* platform/graphics/gstreamer/ImageDecoderGStreamer.h:
* platform/graphics/gstreamer/MainThreadNotifier.h:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::pushTextureToCompositor):
(WebCore::MediaPlayerPrivateGStreamer::repaint):
(WebCore::MediaPlayerPrivateGStreamer::triggerRepaint):
(WebCore::MediaPlayerPrivateGStreamer::cancelRepaint):
(WebCore::MediaPlayerPrivateGStreamer::pushNextHolePunchBuffer):
(WebCore::MediaPlayerPrivateGStreamer::waitForCDMAttachment):
(WebCore::MediaPlayerPrivateGStreamer::cdmInstanceAttached):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(WebCore::MediaPlayerPrivateGStreamer::WTF_GUARDED_BY_LOCK):
* platform/graphics/holepunch/MediaPlayerPrivateHolePunch.cpp:
(WebCore::MediaPlayerPrivateHolePunch::pushNextHolePunchBuffer):
* platform/graphics/nicosia/NicosiaImageBufferPipe.cpp:
(Nicosia::NicosiaImageBufferPipeSource::handle):
* platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp:
(Nicosia::GCGLLayer::swapBuffersIfNeeded):
* platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
(WebCore::TextureMapperPlatformLayerProxy::~TextureMapperPlatformLayerProxy):
(WebCore::TextureMapperPlatformLayerProxy::activateOnCompositingThread):
(WebCore::TextureMapperPlatformLayerProxy::invalidate):
(WebCore::TextureMapperPlatformLayerProxy::releaseUnusedBuffersTimerFired):
(WebCore::TextureMapperPlatformLayerProxy::swapBuffer):
(WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
(WebCore::TextureMapperPlatformLayerProxy::scheduleUpdateOnCompositorThread):
(WebCore::TextureMapperPlatformLayerProxy::compositorThreadUpdateTimerFired):
* platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
(WebCore::TextureMapperPlatformLayerProxy::WTF_RETURNS_LOCK):
(WebCore::TextureMapperPlatformLayerProxy::WTF_GUARDED_BY_LOCK):
2021-05-21 Diego Pino Garcia <dpino@igalia.com>
Set CanvasImageSmoothing.imageSmoothingQuality value to 'low' as default
https://bugs.webkit.org/show_bug.cgi?id=225952
Reviewed by Sam Weinig.
Covered by existing tests:
- inspector/canvas/recording-2d-frameCount.html
- inspector/canvas/recording-2d-full.html
- inspector/canvas/recording-2d-memoryLimit.html
- inspector/canvas/recording-2d-saves.html
- inspector/canvas/recording-html-2d.html
* html/canvas/CanvasRenderingContext2DBase.cpp:
2021-05-21 Chris Dumez <cdumez@apple.com>
Adopt CheckedLock in ScrollingTree and fix threading bug
https://bugs.webkit.org/show_bug.cgi?id=226109
Reviewed by Darin Adler.
Adopt CheckedLock in ScrollingTree and fix threading bug found by Clang Thread Safety
Analysis. In particular, ThreadedScrollingTree::willStartRenderingUpdate() was failing
to grab the lock before updating m_state. m_state definitely get modified from several
threads so synchronization is important.
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::handleWheelEvent):
(WebCore::ScrollingTree::traverseScrollingTree):
(WebCore::ScrollingTree::commitTreeState):
(WebCore::ScrollingTree::applyLayerPositions):
(WebCore::ScrollingTree::applyLayerPositionsInternal):
(WebCore::ScrollingTree::scrollBySimulatingWheelEventForTesting):
* page/scrolling/ScrollingTree.h:
(WebCore::ScrollingTree::WTF_RETURNS_LOCK):
(WebCore::ScrollingTree::WTF_REQUIRES_LOCK):
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::ThreadedScrollingTree):
(WebCore::ThreadedScrollingTree::handleWheelEventAfterMainThread):
(WebCore::ThreadedScrollingTree::wheelEventWasProcessedByMainThread):
(WebCore::ThreadedScrollingTree::willSendEventToMainThread):
(WebCore::ThreadedScrollingTree::waitForEventToBeProcessedByMainThread):
(WebCore::ThreadedScrollingTree::invalidate):
(WebCore::ThreadedScrollingTree::willStartRenderingUpdate):
(WebCore::ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout):
(WebCore::ThreadedScrollingTree::didCompleteRenderingUpdate):
(WebCore::ThreadedScrollingTree::scheduleDelayedRenderingUpdateDetectionTimer):
(WebCore::ThreadedScrollingTree::delayedRenderingUpdateDetectionTimerFired):
(WebCore::ThreadedScrollingTree::displayDidRefreshOnScrollingThread):
* page/scrolling/ThreadedScrollingTree.h:
(WebCore::ThreadedScrollingTree::WTF_RETURNS_LOCK):
(WebCore::ThreadedScrollingTree::WTF_GUARDED_BY_LOCK):
* page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
(WebCore::ScrollingTreeScrollingNodeDelegateMac::createTimer):
2021-05-21 Chris Dumez <cdumez@apple.com>
Adopt CheckedLock in AudioMediaStreamTrackRendererUnit
https://bugs.webkit.org/show_bug.cgi?id=226095
Reviewed by Eric Carlson.
Adopt CheckedLock in AudioMediaStreamTrackRendererUnit to benefit from Clang Thread Safety
Analysis. Also rename variables for clarity and fixes a bug where we failed to grab the
lock before checking m_shouldUpdateRenderSources on the render thread (even though the
variable gets updated on the main thread).
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.cpp:
(WebCore::AudioMediaStreamTrackRendererUnit::addSource):
(WebCore::AudioMediaStreamTrackRendererUnit::removeSource):
(WebCore::AudioMediaStreamTrackRendererUnit::updateRenderSourcesIfNecessary):
(WebCore::AudioMediaStreamTrackRendererUnit::render):
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.h:
(WebCore::AudioMediaStreamTrackRendererUnit::WTF_GUARDED_BY_LOCK):
(): Deleted.
2021-05-21 Chris Dumez <cdumez@apple.com>
Adopt CheckedLock / CheckedCondition in CDMProxy
https://bugs.webkit.org/show_bug.cgi?id=226103
Reviewed by Darin Adler.
Adopt CheckedLock / CheckedCondition in CDMProxy to benefit from Clang Thread Safety
Analysis.
* platform/encryptedmedia/CDMProxy.cpp:
(WebCore::CDMProxy::updateKeyStore):
(WebCore::CDMProxy::keyHandle const):
(WebCore::CDMProxy::tryWaitForKeyHandle const):
(WebCore::CDMProxy::keyAvailable const):
* platform/encryptedmedia/CDMProxy.h:
2021-05-21 Peng Liu <peng.liu6@apple.com>
Video player enters a bad state after trying to enter picture-in-picture on YouTube.com videos
https://bugs.webkit.org/show_bug.cgi?id=226042
Reviewed by Daniel Bates.
The quirk `shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFull` was
always true. This patch fixes that.
* page/Quirks.cpp:
(WebCore::Quirks::shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk const):
2021-05-21 Chris Dumez <cdumez@apple.com>
Replace more static Locks with CheckedLocks in WTF / WebCore
https://bugs.webkit.org/show_bug.cgi?id=226040
Reviewed by Darin Adler.
Replace more static Locks with CheckedLocks so that we can benefit from Clang Thread Safety Analysis.
* Modules/indexeddb/server/IDBSerializationContext.cpp:
(WebCore::IDBServer::IDBSerializationContext::getOrCreateForCurrentThread):
(WebCore::IDBServer::IDBSerializationContext::~IDBSerializationContext):
* Modules/mediastream/RTCDataChannel.cpp:
(WebCore::WTF_REQUIRES_LOCK):
(WebCore::RTCDataChannel::detach):
(WebCore::RTCDataChannel::removeFromDataChannelLocalMapIfNeeded):
(WebCore::RTCDataChannel::handlerFromIdentifier):
* Modules/webdatabase/Database.cpp:
(WebCore::WTF_REQUIRES_LOCK):
(WebCore::Database::Database):
(WebCore::Database::performOpenAndVerify):
(WebCore::Database::closeDatabase):
(WebCore::Database::getCachedVersion const):
(WebCore::Database::setCachedVersion):
* Modules/webgpu/WebGPUDevice.cpp:
(WebCore::WebGPUDevice::instancesLock):
(WebCore::WebGPUDevice::~WebGPUDevice):
* Modules/webgpu/WebGPUDevice.h:
* Modules/webgpu/WebGPUPipeline.cpp:
(WebCore::WebGPUPipeline::instancesLock):
(WebCore::WebGPUPipeline::WebGPUPipeline):
(WebCore::WebGPUPipeline::~WebGPUPipeline):
* Modules/webgpu/WebGPUPipeline.h:
* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::WebSocket):
(WebCore::WebSocket::~WebSocket):
(WebCore::WebSocket::allActiveWebSocketsLock):
* Modules/websockets/WebSocket.h:
* bridge/objc/WebScriptObject.mm:
(WebCore::getJSWrapper):
(WebCore::addJSWrapper):
(WebCore::removeJSWrapper):
(WebCore::removeJSWrapperIfRetainCountOne):
* crypto/CryptoAlgorithmRegistry.cpp:
(WebCore::CryptoAlgorithmRegistry::singleton):
(WebCore::CryptoAlgorithmRegistry::identifier):
(WebCore::CryptoAlgorithmRegistry::name):
(WebCore::CryptoAlgorithmRegistry::create):
(WebCore::CryptoAlgorithmRegistry::registerAlgorithm):
* crypto/CryptoAlgorithmRegistry.h:
* dom/MessagePort.cpp:
(WebCore::MessagePort::deref const):
(WebCore::MessagePort::isExistingMessagePortLocallyReachable):
(WebCore::MessagePort::notifyMessageAvailable):
(WebCore::MessagePort::MessagePort):
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::contextIdentifier const):
(WebCore::ScriptExecutionContext::removeFromContextsMap):
(WebCore::ScriptExecutionContext::~ScriptExecutionContext):
(WebCore::ScriptExecutionContext::postTaskTo):
* html/canvas/CanvasRenderingContext.cpp:
(WebCore::CanvasRenderingContext::instancesLock):
(WebCore::CanvasRenderingContext::CanvasRenderingContext):
(WebCore::CanvasRenderingContext::~CanvasRenderingContext):
* html/canvas/CanvasRenderingContext.h:
* html/canvas/WebGLProgram.cpp:
(WebCore::WebGLProgram::instancesLock):
(WebCore::WebGLProgram::WebGLProgram):
(WebCore::WebGLProgram::~WebGLProgram):
* html/canvas/WebGLProgram.h:
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::~WebGLRenderingContextBase):
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::canvasElement const):
(WebCore:: const):
* inspector/agents/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::enable):
* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::enable):
(WebCore::InspectorNetworkAgent::webSocketForRequestId):
* inspector/agents/InspectorNetworkAgent.h:
* inspector/agents/page/PageNetworkAgent.cpp:
* inspector/agents/page/PageNetworkAgent.h:
* inspector/agents/worker/WorkerNetworkAgent.cpp:
* inspector/agents/worker/WorkerNetworkAgent.h:
* page/SecurityPolicy.cpp:
(WebCore::WTF_REQUIRES_LOCK):
(WebCore::SecurityPolicy::isAccessAllowed):
(WebCore::SecurityPolicy::addOriginAccessAllowlistEntry):
(WebCore::SecurityPolicy::removeOriginAccessAllowlistEntry):
(WebCore::SecurityPolicy::resetOriginAccessAllowlists):
(WebCore::SecurityPolicy::allowAccessTo):
* page/cocoa/ResourceUsageThreadCocoa.mm:
(WebCore::ResourceUsageThread::platformCollectCPUData):
* page/linux/ResourceUsageThreadLinux.cpp:
(WebCore::ResourceUsageThread::platformCollectCPUData):
* platform/GenericTaskQueue.cpp:
(WebCore::TaskDispatcher<Timer>::postTask):
(WebCore::TaskDispatcher<Timer>::sharedTimerFired):
(WebCore::TaskDispatcher<Timer>::pendingDispatchers):
(WebCore::TaskDispatcher<Timer>::dispatchOneTask):
* platform/GenericTaskQueue.h:
* platform/LegacySchemeRegistry.cpp:
(WebCore::allBuiltinSchemes):
(WebCore::WTF_REQUIRES_LOCK):
(WebCore::LegacySchemeRegistry::registerURLSchemeAsLocal):
(WebCore::LegacySchemeRegistry::removeURLSchemeRegisteredAsLocal):
(WebCore::LegacySchemeRegistry::registerURLSchemeAsHandledBySchemeHandler):
(WebCore::LegacySchemeRegistry::schemeIsHandledBySchemeHandler):
(WebCore::LegacySchemeRegistry::shouldTreatURLSchemeAsLocal):
(WebCore::LegacySchemeRegistry::registerURLSchemeAsNoAccess):
(WebCore::LegacySchemeRegistry::shouldTreatURLSchemeAsNoAccess):
(WebCore::LegacySchemeRegistry::registerURLSchemeAsDisplayIsolated):
(WebCore::LegacySchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated):
(WebCore::LegacySchemeRegistry::registerURLSchemeAsSecure):
(WebCore::LegacySchemeRegistry::shouldTreatURLSchemeAsSecure):
(WebCore::LegacySchemeRegistry::canDisplayOnlyIfCanRequest):
(WebCore::LegacySchemeRegistry::registerAsCanDisplayOnlyIfCanRequest):
(WebCore::LegacySchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy):
(WebCore::LegacySchemeRegistry::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy):
(WebCore::LegacySchemeRegistry::schemeShouldBypassContentSecurityPolicy):
(WebCore::LegacySchemeRegistry::registerURLSchemeAsCachePartitioned):
(WebCore::LegacySchemeRegistry::shouldPartitionCacheForURLScheme):
* platform/audio/mac/FFTFrameMac.cpp:
(WebCore::WTF_REQUIRES_LOCK):
(WebCore::FFTFrame::fftSetupForSize):
* platform/graphics/MediaPlayer.cpp:
(WebCore::WTF_REQUIRES_LOCK):
(WebCore::installedMediaEngines):
(WebCore::MediaPlayer::resetMediaEngines):
* platform/ios/QuickLook.mm:
(WebCore::WTF_REQUIRES_LOCK):
(WebCore::removeQLPreviewConverterForURL):
(WebCore::addQLPreviewConverterWithFileForURL):
* platform/ios/WebSQLiteDatabaseTrackerClient.mm:
(WTF_REQUIRES_LOCK):
(+[WebDatabaseTransactionBackgroundTaskController startBackgroundTask]):
(+[WebDatabaseTransactionBackgroundTaskController endBackgroundTask]):
* platform/network/mac/UTIUtilities.mm:
(WebCore::WTF_REQUIRES_LOCK):
(WebCore::UTIFromMIMEType):
* platform/sql/SQLiteDatabase.cpp:
(WebCore::WTF_GUARDED_BY_LOCK):
(WebCore::SQLiteDatabase::setIsDatabaseOpeningForbidden):
(WebCore::SQLiteDatabase::open):
* platform/sql/SQLiteDatabaseTracker.cpp:
(WebCore::SQLiteDatabaseTracker::WTF_GUARDED_BY_LOCK):
(WebCore::SQLiteDatabaseTracker::setClient):
(WebCore::SQLiteDatabaseTracker::incrementTransactionInProgressCount):
(WebCore::SQLiteDatabaseTracker::decrementTransactionInProgressCount):
(WebCore::SQLiteDatabaseTracker::hasTransactionInProgress):
* platform/text/TextEncodingRegistry.cpp:
(WebCore::WTF_REQUIRES_LOCK):
(WebCore::newTextCodec):
(WebCore::atomCanonicalTextEncodingName):
* workers/WorkerGlobalScope.cpp:
(WebCore::WTF_REQUIRES_LOCK):
(WebCore::WorkerGlobalScope::WorkerGlobalScope):
(WebCore::WorkerGlobalScope::~WorkerGlobalScope):
(WebCore::WorkerGlobalScope::releaseMemoryInWorkers):
* workers/WorkerOrWorkletThread.cpp:
(WebCore::WorkerOrWorkletThread::workerOrWorkletThreadsLock):
(WebCore::WorkerOrWorkletThread::WorkerOrWorkletThread):
(WebCore::WorkerOrWorkletThread::~WorkerOrWorkletThread):
(WebCore::WorkerOrWorkletThread::releaseFastMallocFreeMemoryInAllThreads):
* workers/WorkerOrWorkletThread.h:
2021-05-21 Fujii Hironori <Hironori.Fujii@sony.com>
ASSERTION FAILED: m_imageBufferResult->colorSpace() == m_resultColorSpace in FilterEffect::copyPremultipliedResult
https://bugs.webkit.org/show_bug.cgi?id=225907
Reviewed by Said Abou-Hallawa.
FilterEffect::copyPremultipliedResult has the assertion ensuring
m_imageBufferResult->colorSpace() matches m_resultColorSpace.
However, it happened to fail in !USE(CG) ports.
FilterEffect::transformResultColorSpace does nothing if USE(CG),
but it calls ImageBuffer::transformColorSpace otherwise.
ImageBuffer::colorSpace() and ImageBufferBackend::colorSpace()
returned the old color space after ImageBuffer::transformColorSpace.
They should return the new color space.
After fixing the above problem, an assertion in
WebCore::convertImagePixels was going to fail. It asserts no color
space conversion happens.
FEColorMatrix, FEDropShadow and
ImageBufferBackend::convertToLuminanceMask were explicitly
specifying DestinationColorSpace::SRGB to getPixelBuffer. They
shouldn't convert the color space.
* platform/graphics/ConcreteImageBuffer.h:
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::convertToLuminanceMask):
* platform/graphics/cairo/ImageBufferCairoBackend.cpp:
(WebCore::ImageBufferCairoBackend::transformColorSpace):
* platform/graphics/filters/FEColorMatrix.cpp:
(WebCore::FEColorMatrix::platformApplySoftware):
* platform/graphics/filters/FEDropShadow.cpp:
(WebCore::FEDropShadow::platformApplySoftware):
2021-05-21 Eric Carlson <eric.carlson@apple.com>
[Cocoa] Update AudioSession buffer size handling
https://bugs.webkit.org/show_bug.cgi?id=225927
rdar://76920375
Reviewed by Jer Noble.
Previously we only set the audio session buffer size when there was an active
MediaSession. This meant that when no audio was being played or captured, the buffer
size would be left at whatever size was appropriate for the last MediaSession
stopped. This was especially bad when the last MediaSession played WebAudio
or captured audio because those require a smaller buffer size than the default,
and was made even worse when using the GPU process because it may live for much
longer than the last web process that played audio. Fix this by using the low power
buffer size when playing audio or when there is no MediaSession at all.
Add AudioBufferSize API test.
* Modules/webaudio/AudioContext.h:
Make mediaType() return `None` if the context is suspended or stopped so the media
session manager won't set the buffer size for WebAudio.
* platform/audio/cocoa/MediaSessionManagerCocoa.h:
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::updateSessionState): Always use "low power"
buffer size when there is no WebAudio or audio capture.
(WebCore::MediaSessionManagerCocoa::addSession): Cache supported hardware buffer sizes.
(WebCore::MediaSessionManagerCocoa::audioOutputDeviceChanged): Update cached buffer
sizes.
* testing/Internals.cpp:
(WebCore::Internals::currentAudioBufferSize const): Expose current audio session buffer
size for testing.
* testing/Internals.h:
* testing/Internals.idl:
2021-05-21 Chris Dumez <cdumez@apple.com>
Use CheckedLock more in cases where we try-lock
https://bugs.webkit.org/show_bug.cgi?id=226056
Reviewed by Alex Christensen.
Use CheckedLock more in cases where we try-lock to benefit from Clang
Thread Safety Analysis.
* Modules/webaudio/AudioParamTimeline.cpp:
(WebCore::AudioParamTimeline::setValueAtTime):
(WebCore::AudioParamTimeline::linearRampToValueAtTime):
(WebCore::AudioParamTimeline::exponentialRampToValueAtTime):
(WebCore::AudioParamTimeline::setTargetAtTime):
(WebCore::AudioParamTimeline::setValueCurveAtTime):
(WebCore::AudioParamTimeline::cancelScheduledValues):
(WebCore::AudioParamTimeline::cancelAndHoldAtTime):
(WebCore::AudioParamTimeline::valueForContextTime):
(WebCore::AudioParamTimeline::valuesForFrameRange):
(WebCore::AudioParamTimeline::hasValues const):
* Modules/webaudio/AudioParamTimeline.h:
* platform/audio/AudioDestination.h:
(WebCore::AudioDestination::WTF_GUARDED_BY_LOCK):
(WebCore::AudioDestination::AudioDestination):
(WebCore::AudioDestination::clearCallback):
(WebCore::AudioDestination::callRenderCallback):
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.cpp:
(WebCore::AudioMediaStreamTrackRendererUnit::addSource):
(WebCore::AudioMediaStreamTrackRendererUnit::removeSource):
(WebCore::AudioMediaStreamTrackRendererUnit::render):
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.h:
2021-05-21 Per Arne <pvollan@apple.com>
Accessibility caption styles does not always reflect the selection
https://bugs.webkit.org/show_bug.cgi?id=226084
<rdar://75426845>
Reviewed by Chris Fleizach.
Export a soft linked constant.
* WebCore.xcodeproj/project.pbxproj:
* platform/cf/MediaAccessibilitySoftLink.cpp:
2021-05-21 Rob Buis <rbuis@igalia.com>
grid track size should reject unitless length
https://bugs.webkit.org/show_bug.cgi?id=189137
Reviewed by Sergio Villar Senin.
Reject unitless length's for grid track sizes in quirks mode.
Behavior matches Chrome and Firefox.
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeGridBreadth):
2021-05-21 Jer Noble <jer.noble@apple.com>
[Cocoa] Last few seconds of 'audio/webm; codecs=vorbis' appended to a SampleBuffer are not played
https://bugs.webkit.org/show_bug.cgi?id=226069
<rdar://78004793>
Reviewed by Eric Carlson.
Test: platform/mac-bigsur/media/media-source/media-vorbis-partial.html
When parsing samples from a WebM file, the samples emitted by the parser can be very short in
duration, which is ineffecient both in storage costs in our SampleMap, as well as in decoding
CPU costs, as each sample must be fed into the decoder separately. So the parser will group
together these small samples into a larger "meta sample" with a duration no shorter than 2s.
However, at the end of a file, no more sample data will be appended, up to 2s of audio data
will not be emitted from the parser.
At the end of an append, always flush audio track data to ensure that all parsed samples are
emitted, regardless of their collective duration.
* platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::SourceBufferParserWebM::appendData):
2021-05-21 Kate Cheney <katherine_cheney@apple.com>
FrameLoader::loadURL, FrameLoader::loadPostRequest not attributing requests as app bound
https://bugs.webkit.org/show_bug.cgi?id=225923
<rdar://problem/78160933>
Reviewed by Alex Christensen.
Tests: http/tests/in-app-browser-privacy/app-bound-attribution-load-url.html
http/tests/in-app-browser-privacy/app-bound-attribution-ping-load.html
http/tests/in-app-browser-privacy/app-bound-attribution-post-request.html
Update FrameLoader::addExtraFieldsToRequest to add the app-bound
value to a request, like for loadURL, loadPostRequest, or ping loads.
Change the name to reflect this use case, which updates the request
but does not add any extra header fields.
Other cases are already covered in WebLoaderStrategy::loadResource.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadURL):
(WebCore::FrameLoader::load):
The main navigation uses the old document loader, so we don't want to
set the app-bound value based on that. The request should have the
correct value already from the UIProcess.
(WebCore::FrameLoader::updateRequestAndAddExtraFields):
(WebCore::FrameLoader::loadPostRequest):
(WebCore::FrameLoader::loadResourceSynchronously):
We can remove setting the app bound value here now that we set the value in
addExtraFieldsToRequest.
(WebCore::FrameLoader::loadDifferentDocumentItem):
(WebCore::FrameLoader::addExtraFieldsToRequest): Deleted.
* loader/FrameLoader.h:
* loader/PingLoader.cpp:
(WebCore::PingLoader::loadImage):
(WebCore::PingLoader::sendPing):
(WebCore::PingLoader::sendViolationReport):
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::init):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::load):
2021-05-21 Youenn Fablet <youenn@apple.com>
Add some logging for the 'FetchEvent is destroyed' case
https://bugs.webkit.org/show_bug.cgi?id=226071
Reviewed by Kate Cheney.
* workers/service/FetchEvent.cpp:
(WebCore::FetchEvent::~FetchEvent):
2021-05-21 Imanol Fernandez <ifernandez@igalia.com>
Fix use after move bug in WebXRSession
https://bugs.webkit.org/show_bug.cgi?id=226074
Reviewed by Sergio Villar Senin.
This patch fixes FrameData usage after move in WebXRSession, a regression from bug 226074.
It also removes an unneeded FrameData copy into WebXRFrame.
Tested by WebXR WPT.
* Modules/webxr/WebXRFrame.cpp: Use frameData from session instead of holding an extra copy
(WebCore::WebXRFrame::populatePose):
(WebCore::WebXRFrame::getViewerPose):
* Modules/webxr/WebXRFrame.h: Remove setFrameData and m_data.
(WebCore::WebXRFrame::setTime):
* Modules/webxr/WebXRSession.cpp: Fix usage after move.
(WebCore::WebXRSession::onFrame):
* platform/xr/PlatformXR.h:
(PlatformXR::Device::FrameData::copy const): Add missing members in the copy function.
2021-05-21 Eleni Maria Stea <estea@igalia.com>
Function paintRenderingResultsToCanvas expects a reference, not a
pointer. Fixed the compile error.
https://bugs.webkit.org/show_bug.cgi?id=226073
Reviewed by Adrian Perez de Castro.
* platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp:
(Nicosia::GCGLLayer::swapBuffersIfNeeded):
2021-05-21 Eleni Maria Stea <estea@igalia.com>
Fixed unreached end of function compiler warning in DataURLDecoder.
https://bugs.webkit.org/show_bug.cgi?id=226079
Reviewed by Adrian Perez de Castro.
* platform/network/DataURLDecoder.cpp:
(WebCore::DataURLDecoder::decodeBase64):
2021-05-21 Adrian Perez de Castro <aperez@igalia.com>
Non-unified build fixes, late-ish May 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=225990
Unreviewed non-unified build fixes.
No new tests needed.
* Modules/indexeddb/server/MemoryObjectStore.cpp: Add missing pal/SessioID.h header.
* Modules/webaudio/OfflineAudioContext.cpp: Add missing OfflineAudioCompletionEvent.h header.
* Modules/webaudio/OfflineAudioContext.h: Add missing wtf/UniqueRef.h header.
* Modules/websockets/WebSocketDeflateFramer.h: Add missing WebSocketExtensionProcessor.h
header, remove wtf/text/WTFString.h as it is already included by the former.
* bindings/js/JSDOMConvertEnumeration.h: Add missing JSDOMGlobalObject.h header.
* contentextensions/DFANode.cpp: Add missing wtf/HashMap.h header.
* html/HTMLFrameElement.cpp: Add missing HTMLParserIdioms.h header.
* html/HTMLHRElement.cpp: Ditto.
* html/HTMLIFrameElement.cpp: Ditto.
* html/HTMLLIElement.cpp: Ditto.
* html/HTMLMetaElement.cpp: Add missing HTMLParserIdioms.h, Frame.h, and FrameView.h headers.
* html/HTMLOutputElement.cpp:
(WebCore::HTMLOutputElement::parseAttribute): Add missing HTMLNames:: namespace prefix in
usage of HTMLNames::forAttr.
(WebCore::HTMLOutputElement::htmlFor): Ditto.
* html/OffscreenCanvas.cpp: Add missing RuntimeEnabledFeatures.h header.
* layout/formattingContexts/FormattingGeometry.cpp: Add missing FormattingQuirks.h header.
* layout/formattingContexts/FormattingQuirks.cpp: Add missing FormattingGeometry.h header.
* layout/formattingContexts/block/BlockFormattingGeometry.cpp: Add missing
BlockFormattingContext.h, BlockFormattingQuirks.h, and BlockMarginCollapse.h headers;
remove unneeded BlockFormattingState.h and FormattingContext.h headers.
* layout/formattingContexts/block/BlockFormattingGeometry.h: Add missing forward
declaration for BlockFormattingContext.
* layout/formattingContexts/block/BlockFormattingQuirks.cpp: Add missing
BlockFormattingContext.h and BlockMarginCollapse.h headers, remove unneeded
BlockFormattingState.h header.
* layout/formattingContexts/block/PrecomputedBlockMarginCollapse.cpp: Add missing
BlockFormattingContext.h and BlockFormattingQuirks.h headers, remove unneeded
BlockFormattingState.h header.
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp:
Add missing BlockMarginCollapse.h header.
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingQuirks.cpp:
Add missing TableWrapperBlockFormattingContext.h header.
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingQuirks.h:
Add missing forward declaration for TableWrapperBlockFormattingContext.
* layout/formattingContexts/flex/FlexFormattingGeometry.cpp: Add missing
FlexFormattingContext.h header, remove unneeded FlexFormattingState.h and
FormattingContext.h headers.
* layout/formattingContexts/flex/FlexFormattingGeometry.h: Add missing forward declaration
for FlexFormattingContext.
* layout/formattingContexts/inline/InlineFormattingGeometry.cpp: Add missing
InlineFormattingContext.h header, remove unneeded InlineLineBox.h header.
* layout/formattingContexts/inline/InlineFormattingGeometry.h: Add missing InlineLineBox.h
and InlineLineBuilder.h headers, add missing forward declaration for
InlineFormattingContext.
* layout/formattingContexts/inline/InlineFormattingQuirks.cpp: Add missing
InlineFormattingContext.h header.
* layout/formattingContexts/inline/InlineFormattingQuirks.h: Add missing InlineLineBox.h
header, add missing forward declaration for InlineFormattingContext.
* layout/formattingContexts/inline/InlineLineBuilder.cpp: Add missing
InlineFormattingQuirks.h header.
* layout/formattingContexts/table/TableFormattingGeometry.cpp: Add missing
TableFormattingContext.h header, remove unneeded TableFormattingState.h header.
* layout/formattingContexts/table/TableFormattingGeometry.h: Add missing TableGrid.h
header, add missing forward declaration for TableFormattingContext.
* layout/formattingContexts/table/TableFormattingQuirks.cpp: Add missing
TableFormattingContext.h header.
* layout/formattingContexts/table/TableFormattingQuirks.h: Add missing forward declaration
for TableFormattingContext.
* layout/formattingContexts/table/TableLayout.cpp: Add missing TableFormattingGeometry.h
header.
* page/FrameViewLayoutContext.cpp: Add missing StyleScope.h header.
* page/ImageOverlayController.h: Add missing LayoutRect.h header.
* page/PageConfiguration.h: Add missing wtf/HashSet.h header.
* platform/network/soup/SoupNetworkSession.cpp: Add missing wtf/text/StringHash.h header.
* style/StyleScopeRuleSets.cpp: Add missing StyleScope.h header.
* style/Styleable.cpp: Ditto.
* svg/SVGDocumentExtensions.cpp: Add missing SVGUseElement.h header.
* svg/SVGDocumentExtensions.h: Add missing wtf/WeakHashSet.h header, add missing
forward declaration for SVGUseElement.
* workers/WorkerGlobalScope.cpp: Add missing FontCustomPlatformData.h header.
2021-05-21 Lauro Moura <lmoura@igalia.com>
[GLIB] fast/canvas/canvas-conic-gradient-angle.html is failing since added in r277547
https://bugs.webkit.org/show_bug.cgi?id=225916
Reviewed by Adrian Perez de Castro.
Covered by existing tests.
In some cases, like negative or large enough "from" angles, the angleStart
variable would fall outside of the 0-360 range, making the center offset
adjust to always fall in the last quadrant instead of the correct one.
This commit normalizes the starting angle to fall between 0-360 when
calculating the quadrant. While it makes the positive "from" angle test
cases to pass, there are still some issues with negative "from", drawing
slightly offset/slanted section borders, likely due to precision issues.
* platform/graphics/cairo/GradientCairo.cpp:
(WebCore::normalizeAngle): Added helper.
(WebCore::addConicSector): Check quadrant with a normalized (0-360) angle.
2021-05-21 Alan Bujtas <zalan@apple.com>
[LFC][TFC][Quirks] Use box-sizing: border-box when computing cell height
https://bugs.webkit.org/show_bug.cgi?id=226063
Reviewed by Simon Fraser.
Test: fast/layoutformattingcontext/table-simple-quirk-td-height-with-padding.html
* layout/Verification.cpp:
(WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree):
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::layoutCell):
* layout/formattingContexts/table/TableFormattingGeometry.cpp:
(WebCore::Layout::TableFormattingGeometry::cellBoxContentHeight const):
(WebCore::Layout::TableFormattingGeometry::cellHeigh const): Deleted.
* layout/formattingContexts/table/TableFormattingGeometry.h:
2021-05-21 Chris Lord <clord@igalia.com>
[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-21 Rob Buis <rbuis@igalia.com>
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-21 Sam Sneddon <gsnedders@apple.com>
Fix Python 3.6+ DeprecationWarnings about unknown escapes
https://bugs.webkit.org/show_bug.cgi?id=226018
Reviewed by Jonathan Bedard.
Fix Python 3.6+ DeprecationWarnings about unknown escapes
No new tests.
* Modules/webgpu/WHLSL/WHLSLBuildStandardLibraryFunctionMap.py:
2021-05-21 Youenn Fablet <youenn@apple.com>
Implement a remote Internal Unit in GPUProcess for audio MediaStreamTrack rendering
https://bugs.webkit.org/show_bug.cgi?id=225603
<rdar://problem/78114391>
Reviewed by Eric Carlson.
Fixed the case where we were calling start even though a source was already being played.
This is more consistent since we are doing those checks for stop.
Reduce the code where we lock sources to the minimum.
In case we want to lock the sources copy in audio thread and we fail, continue rendering audio instead of dropping everything.
Add some main thread assertions in AudioMediaStreamTrackRendererUnit methods.
Manually tested.
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.cpp:
(WebCore::AudioMediaStreamTrackRendererUnit::addSource):
(WebCore::AudioMediaStreamTrackRendererUnit::removeSource):
(WebCore::AudioMediaStreamTrackRendererUnit::render):
2021-05-20 Chris Dumez <cdumez@apple.com>
Fix locking in PlatformCALayer
https://bugs.webkit.org/show_bug.cgi?id=226062
Reviewed by Tim Horton.
Fix locking issue in PlatformCALayer found by Clang Thread Safety Analysis.
We were locking before querying layerToPlatformLayerMap(), but failing to
do so when adding or removing from layerToPlatformLayerMap().
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::WTF_REQUIRES_LOCK):
(WebCore::PlatformCALayer::platformCALayerForLayer):
(WebCore::PlatformCALayerCocoa::commonInit):
(WebCore::PlatformCALayerCocoa::~PlatformCALayerCocoa):
(WebCore::layerToPlatformLayerMap): Deleted.
2021-05-20 Chris Dumez <cdumez@apple.com>
Add missing lock in AXIsolatedTree::treeForID()
https://bugs.webkit.org/show_bug.cgi?id=226060
<rdar://problem/78287227>
Reviewed by Alex Christensen.
Add missing lock in AXIsolatedTree::treeForID(). This was found via Clang Thread Safety
Analysis. This was the only call site that was failing to grab the s_cacheLock before
calling treeIDCache().
* accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::treeForID):
(WebCore::AXIsolatedTree::create):
(WebCore::AXIsolatedTree::removeTreeForPageID):
(WebCore::AXIsolatedTree::treeForPageID):
* accessibility/isolatedtree/AXIsolatedTree.h:
2021-05-20 Chris Lord <clord@igalia.com>
[WPE] Spatial navigation tests fail with async overflow scrolling enabled
https://bugs.webkit.org/show_bug.cgi?id=225922
Reviewed by Simon Fraser.
Add absoluteClippedOverflowRectForSpatialNavigation for when the
clipped overflow rect not taking into account composited scrolling is
necessary.
No new tests, covered by existing tests.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::isOffScreen const):
* page/SpatialNavigation.cpp:
(WebCore::hasOffscreenRect):
* rendering/RenderObject.h:
(WebCore::RenderObject::absoluteClippedOverflowRectForSpatialNavigation const):
(WebCore::RenderObject::visibleRectContextForSpatialNavigation):
2021-05-20 Kate Cheney <katherine_cheney@apple.com>
Mark ServiceWorkerThreadProxy with a default app-bound value
https://bugs.webkit.org/show_bug.cgi?id=223201
<rdar://problem/77664416>
Reviewed by Youenn Fablet.
Service worker loads have their own document loader, so they don't
always get properly marked as app-bound based on the main frame
navigation. Prior fixes handled some fetch events, synthetic
responses, and soft updates. But we need to set a default value when
we install the service worker.
We had to pick a best-effort heuristic to do this. If any client for
the worker is app-bound, then all loads with that worker will be
marked app-bound.
* testing/ServiceWorkerInternals.cpp:
(WebCore::ServiceWorkerInternals::lastNavigationWasAppBound):
* testing/ServiceWorkerInternals.h:
* testing/ServiceWorkerInternals.idl:
* workers/WorkerRunLoop.h:
To test this, I added a new API to ServiceWorkerInternals to get the
worker's app bound value.
* workers/service/ServiceWorkerClientData.cpp:
(WebCore::ServiceWorkerClientData::isolatedCopy const):
(WebCore::ServiceWorkerClientData::from):
* workers/service/ServiceWorkerClientData.h:
(WebCore::ServiceWorkerClientData::encode const):
(WebCore::ServiceWorkerClientData::decode):
Store the main navigation app-bound value when we register a client.
* workers/service/ServiceWorkerContextData.cpp:
(WebCore::ServiceWorkerContextData::isolatedCopy const):
* workers/service/ServiceWorkerContextData.h:
(WebCore::ServiceWorkerContextData::encode const):
(WebCore::ServiceWorkerContextData::decode):
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
(WebCore::ServiceWorkerThreadProxy::lastNavigationWasAppBound):
* workers/service/context/ServiceWorkerThreadProxy.h:
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::importRecords):
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::updateWorker):
(WebCore::SWServer::clientIsAppBoundForRegistrableDomain):
Best-effort heuristic to mark a load as app bound if any client for
that origin was registered as app-bound.
2021-05-20 Sam Weinig <weinig@apple.com>
Fix inverted ASSERT in sampleColor.
Rubber-stamped by Tim Horton.
* page/PageColorSampler.cpp:
(WebCore::sampleColor):
2021-05-20 Alexey Shvayka <shvaikalesh@gmail.com>
[WebIDL] Remove [ImplicitThis] and [CustomProxyToJSObject] extended attributes
https://bugs.webkit.org/show_bug.cgi?id=223758
Reviewed by Sam Weinig.
This change introduces castThisValue<JSClass>, taking a step towards unification of |this|
value casting between IDLAttribute and IDLOperation. The helper uses compile-time inheritance
check to provide implicit |this| value for DOM global objects [1], replacing [ImplicitThis]
extended attribute, which was removed from the spec [2] a while ago.
IDLAttribute can't perform toThis() with ECMAMode::strict(), like IDLOperation now does,
because CustomValue getters are called with |this| value of JSGlobalObject type, which gets
tainted by JSScope::toThis(). #225397 will remove the need for toThis(), finally making |this|
value casting consistent between attributes and operations.
Also, this patch fixes `Object.create(window).location` to throw as per spec [1] by removing
prototype chain traversal from toJSDOMWindow(), which aligns WebKit with Blink and Gecko.
As DOM global objects are wrapped in proxies and require special casting, toJSDOMWindow() and
friends are merged into toJSDOMGlobalObject<JSClass>, which is aware of inheritance / JSProxy.
It replaces [CustomProxyToJSObject] extended attribute, which could be missed when adding new
DOM global objects, fixing worklets' global functions not to throw when called on `globalThis`.
This change reduces WebCore --release binary size by 0.2% (147 KB).
[1] https://heycam.github.io/webidl/#dfn-attribute-getter (step 1.1.2.3)
[2] https://github.com/heycam/webidl/pull/155
Tests: imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/global-object-implicit-this-value.any.js
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-registerprocessor-called-on-globalthis.https.html
fast/css-custom-paint/registerPaintBindings.html
http/tests/security/listener/*.html
* Headers.cmake:
* Modules/webaudio/AudioWorkletGlobalScope.idl:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMAttribute.h:
(WebCore::IDLAttribute::set):
(WebCore::IDLAttribute::setPassingPropertyName):
(WebCore::IDLAttribute::get):
(WebCore::IDLAttribute::getPassingPropertyName):
* bindings/js/JSDOMCastThisValue.h: Added.
(WebCore::castThisValue):
* bindings/js/JSDOMCastedThisErrorBehavior.h: Removed.
* bindings/js/JSDOMGlobalObject.h:
(WebCore::toJSDOMGlobalObject):
* bindings/js/JSDOMOperation.h:
(WebCore::IDLOperation::cast):
* bindings/js/JSDOMWindowBase.cpp:
* bindings/js/JSDOMWindowBase.h:
(WebCore::toJSDOMWindow):
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSC_DEFINE_CUSTOM_GETTER):
(WebCore::IDLOperation<JSDOMWindow>::cast): Deleted.
* bindings/js/JSDocumentCustom.cpp:
(WebCore::cachedDocumentWrapper):
* bindings/js/JSEventTargetCustom.cpp:
(WebCore::jsEventTargetCast):
* bindings/js/JSEventTargetCustom.h:
(WebCore::IDLOperation<JSEventTarget>::call):
* bindings/js/JSRemoteDOMWindowBase.cpp:
(WebCore::toJSRemoteDOMWindow): Deleted.
* bindings/js/JSRemoteDOMWindowBase.h:
* bindings/js/JSWorkerGlobalScopeBase.cpp:
(WebCore::toJSDedicatedWorkerGlobalScope): Deleted.
(WebCore::toJSWorkerGlobalScope): Deleted.
(WebCore::toJSServiceWorkerGlobalScope): Deleted.
* bindings/js/JSWorkerGlobalScopeBase.h:
* bindings/js/JSWorkletGlobalScopeBase.cpp:
(WebCore::toJSWorkletGlobalScope): Deleted.
* bindings/js/JSWorkletGlobalScopeBase.h:
* bindings/scripts/CodeGeneratorJS.pm:
(ShouldGenerateToJSDeclaration):
(IsAcceleratedDOMAttribute):
(GenerateImplementation):
* bindings/scripts/IDLAttributes.json:
* bindings/scripts/test/JS/*: Updated.
* inspector/InspectorController.cpp:
(WebCore::InspectorController::canAccessInspectedScriptState const):
* page/DOMWindow.idl:
* page/RemoteDOMWindow.idl:
* workers/DedicatedWorkerGlobalScope.idl:
* workers/WorkerGlobalScope.idl:
* workers/service/ServiceWorkerGlobalScope.idl:
* worklets/PaintWorkletGlobalScope.idl:
* worklets/WorkletGlobalScope.idl:
2021-05-20 Alexey Shvayka <shvaikalesh@gmail.com>
Align internal methods of WindowProperties object with the spec
https://bugs.webkit.org/show_bug.cgi?id=222918
Reviewed by Sam Weinig.
This patch:
1. Implements [[PreventExtensions]], [[DefineOwnProperty]], and [[Delete]] methods that always fail [1],
ensuring [[Set]] with altered receiver is passed through, indexed properties are rejected as well,
and an exception is thrown if neccessary.
Adding a put() override would a) slow down global `var` creation and b) require factoring out most of
JSObject::putInlineSlow(). Instead, we prevent extensions on a structure while defining isExtensible()
override to cover that up.
2. Corrects property attributes reported by [[GetOwnProperty]] methods of cross-origin WindowProxy [2]
and WindowProperties, bringing these objects in compliance with invariants of internal methods [3].
3. Removes comments on cross-browser differences and priority order from [[GetOwnProperty]] because
it correctly implements the now detailed spec [4]. Browsing contexts precedence is covered by
wpt/html/browsers/the-window-object/named-access-on-the-window-object/named-objects.html test.
4. Asserts that WindowProperties [[Prototype]] is an object, as guaranteed by its [[SetPrototypeOf]].
This change fully implements the current spec, aligning WebKit with Blink and Gecko.
[1] https://heycam.github.io/webidl/#named-properties-object-defineownproperty
[2] https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-getownproperty (step 6.2)
[3] https://tc39.es/ecma262/#sec-invariants-of-the-essential-internal-methods
[4] https://html.spec.whatwg.org/multipage/window-object.html#dom-window-nameditem (step 2)
Tests: imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/window-named-properties-object.html
imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html
imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/window-named-properties.html
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
* bindings/js/JSDOMWindowProperties.cpp:
(WebCore::jsDOMWindowPropertiesGetOwnPropertySlotNamedItemGetter):
(WebCore::JSDOMWindowProperties::finishCreation):
(WebCore::JSDOMWindowProperties::getOwnPropertySlot):
(WebCore::JSDOMWindowProperties::deleteProperty):
(WebCore::JSDOMWindowProperties::deletePropertyByIndex):
(WebCore::JSDOMWindowProperties::preventExtensions):
(WebCore::JSDOMWindowProperties::isExtensible):
(WebCore::JSDOMWindowProperties::defineOwnProperty):
* bindings/js/JSDOMWindowProperties.h:
2021-05-20 Chris Dumez <cdumez@apple.com>
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-20 Antti Koivisto <antti@apple.com>
HTML parser should yield more aggressively
https://bugs.webkit.org/show_bug.cgi?id=224609
rdar://73458064
Reviewed by Darin Adler.
During page loading we may spend substantial amount of time in individual invocations of
the HTML parser. This can be a problem since it blocks rendering updates and so visual
page load progression.
Most of this time is not actually spend parsing, it rather goes into synchronous script
execution and DOM work triggered by scripts. This patch adds a more effective mechanism
where we may decide to yield the parser before executing a script.
* dom/ScriptElement.h:
* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::pumpTokenizerLoop):
* html/parser/HTMLParserScheduler.cpp:
(WebCore::parserTimeLimit):
(WebCore::PumpSession::PumpSession):
(WebCore::HTMLParserScheduler::HTMLParserScheduler):
(WebCore::HTMLParserScheduler::shouldYieldBeforeExecutingScript):
Consider yielding before script execution after 16ms has elapsed and at least 256 tokens have been parsed.
Only yield for synchronous scripts.
Don't yield on very short inline scripts (this is an imperfect way to try to guess the execution cost).
* html/parser/HTMLParserScheduler.h:
(WebCore::HTMLParserScheduler::shouldYieldBeforeToken):
(WebCore::HTMLParserScheduler::checkForYield):
Don't reset the token count, instead track the last yield check point.
* html/parser/HTMLTreeBuilder.h:
(WebCore::HTMLTreeBuilder::scriptToProcess const):
2021-05-20 Chris Dumez <cdumez@apple.com>
[Hardening] Use CheckedArithmetics in WebAudioBufferList constructor
https://bugs.webkit.org/show_bug.cgi?id=226029
<rdar://78222665>
Reviewed by Eric Carlson.
* platform/audio/cocoa/WebAudioBufferList.cpp:
(WebCore::WebAudioBufferList::WebAudioBufferList):
2021-05-20 Chris Dumez <cdumez@apple.com>
Use CheckedLock more in WebCore
https://bugs.webkit.org/show_bug.cgi?id=226026
Reviewed by Geoffrey Garen.
Use CheckedLock more in WebCore to benefit from Clang Thread Safety Analysis.
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::createIndex):
(WebCore::IDBObjectStore::index):
(WebCore::IDBObjectStore::deleteIndex):
(WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
(WebCore::IDBObjectStore::visitReferencedIndexes const):
(WebCore::IDBObjectStore::renameReferencedIndex):
* Modules/indexeddb/IDBObjectStore.h:
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::objectStore):
(WebCore::IDBTransaction::internalAbort):
(WebCore::IDBTransaction::createObjectStore):
(WebCore::IDBTransaction::renameObjectStore):
(WebCore::IDBTransaction::renameIndex):
(WebCore::IDBTransaction::deleteObjectStore):
(WebCore::IDBTransaction::visitReferencedObjectStores const):
* Modules/indexeddb/IDBTransaction.h:
* Modules/indexeddb/client/IDBConnectionProxy.cpp:
(WebCore::IDBClient::IDBConnectionProxy::openDatabase):
(WebCore::IDBClient::IDBConnectionProxy::deleteDatabase):
(WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest):
(WebCore::IDBClient::IDBConnectionProxy::saveOperation):
(WebCore::IDBClient::IDBConnectionProxy::completeOperation):
(WebCore::IDBClient::IDBConnectionProxy::fireVersionChangeEvent):
(WebCore::IDBClient::IDBConnectionProxy::notifyOpenDBRequestBlocked):
(WebCore::IDBClient::IDBConnectionProxy::establishTransaction):
(WebCore::IDBClient::IDBConnectionProxy::didStartTransaction):
(WebCore::IDBClient::IDBConnectionProxy::commitTransaction):
(WebCore::IDBClient::IDBConnectionProxy::didCommitTransaction):
(WebCore::IDBClient::IDBConnectionProxy::abortTransaction):
(WebCore::IDBClient::IDBConnectionProxy::didAbortTransaction):
(WebCore::IDBClient::IDBConnectionProxy::didCloseFromServer):
(WebCore::IDBClient::IDBConnectionProxy::connectionToServerLost):
(WebCore::IDBClient::IDBConnectionProxy::scheduleMainThreadTasks):
(WebCore::IDBClient::IDBConnectionProxy::handleMainThreadTasks):
(WebCore::IDBClient::IDBConnectionProxy::getAllDatabaseNamesAndVersions):
(WebCore::IDBClient::IDBConnectionProxy::didGetAllDatabaseNamesAndVersions):
(WebCore::IDBClient::IDBConnectionProxy::registerDatabaseConnection):
(WebCore::IDBClient::IDBConnectionProxy::unregisterDatabaseConnection):
(WebCore::IDBClient::IDBConnectionProxy::forgetActiveOperations):
(WebCore::IDBClient::IDBConnectionProxy::forgetTransaction):
(WebCore::IDBClient::IDBConnectionProxy::forgetActivityForCurrentThread):
(WebCore::IDBClient::IDBConnectionProxy::setContextSuspended):
* Modules/indexeddb/client/IDBConnectionProxy.h:
* Modules/mediastream/RTCRtpSFrameTransformer.cpp:
(WebCore::RTCRtpSFrameTransformer::setEncryptionKey):
(WebCore::RTCRtpSFrameTransformer::decryptFrame):
(WebCore::RTCRtpSFrameTransformer::encryptFrame):
* Modules/mediastream/RTCRtpSFrameTransformer.h:
* Modules/mediastream/RTCRtpScriptTransform.cpp:
(WebCore::RTCRtpScriptTransform::setTransformer):
(WebCore::RTCRtpScriptTransform::setupTransformer):
(WebCore::RTCRtpScriptTransform::clear):
* Modules/mediastream/RTCRtpScriptTransform.h:
* Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
(WebCore::LibWebRTCDataChannelHandler::setClient):
(WebCore::LibWebRTCDataChannelHandler::checkState):
(WebCore::LibWebRTCDataChannelHandler::OnMessage):
(WebCore::LibWebRTCDataChannelHandler::OnBufferedAmountChange):
* Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.cpp:
(WebCore::LibWebRTCRtpTransformBackend::setInputCallback):
(WebCore::LibWebRTCRtpTransformBackend::setOutputCallback):
(WebCore::LibWebRTCRtpTransformBackend::processTransformedFrame):
(WebCore::LibWebRTCRtpTransformBackend::Transform):
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.h:
* inspector/agents/WebHeapAgent.cpp:
(WebCore::SendGarbageCollectionEventsTask::addGarbageCollection):
(WebCore::SendGarbageCollectionEventsTask::reset):
(WebCore::SendGarbageCollectionEventsTask::timerFired):
* page/ResourceUsageThread.cpp:
(WebCore::ResourceUsageThread::addObserver):
(WebCore::ResourceUsageThread::removeObserver):
(WebCore::ResourceUsageThread::waitUntilObservers):
(WebCore::ResourceUsageThread::notifyObservers):
* page/ResourceUsageThread.h:
* page/WheelEventTestMonitor.cpp:
(WebCore::WheelEventTestMonitor::clearAllTestDeferrals):
(WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring):
(WebCore::WheelEventTestMonitor::deferForReason):
(WebCore::WheelEventTestMonitor::removeDeferralForReason):
(WebCore::WheelEventTestMonitor::receivedWheelEvent):
(WebCore::WheelEventTestMonitor::checkShouldFireCallbacks):
* page/WheelEventTestMonitor.h:
(WebCore::WheelEventTestMonitor::WTF_GUARDED_BY_LOCK):
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::computeWheelProcessingSteps):
(WebCore::ScrollingTree::determineWheelEventProcessing):
(WebCore::ScrollingTree::handleWheelEvent):
(WebCore::ScrollingTree::commitTreeState):
(WebCore::ScrollingTree::mainFrameScrollPosition const):
(WebCore::ScrollingTree::setMainFrameScrollPosition):
(WebCore::ScrollingTree::setGestureState):
(WebCore::ScrollingTree::gestureState):
(WebCore::ScrollingTree::eventTrackingTypeForPoint):
(WebCore::ScrollingTree::isRubberBandInProgressForNode):
(WebCore::ScrollingTree::setRubberBandingInProgressForNode):
(WebCore::ScrollingTree::isUserScrollInProgressForNode):
(WebCore::ScrollingTree::setUserScrollInProgressForNode):
(WebCore::ScrollingTree::clearNodesWithUserScrollInProgress):
(WebCore::ScrollingTree::isScrollSnapInProgressForNode):
(WebCore::ScrollingTree::setNodeScrollSnapInProgress):
(WebCore::ScrollingTree::setMainFramePinnedState):
(WebCore::ScrollingTree::setMainFrameCanRubberBand):
(WebCore::ScrollingTree::mainFrameCanRubberBandInDirection):
(WebCore::ScrollingTree::addPendingScrollUpdate):
(WebCore::ScrollingTree::takePendingScrollUpdates):
(WebCore::ScrollingTree::setScrollPinningBehavior):
(WebCore::ScrollingTree::scrollPinningBehavior):
(WebCore::ScrollingTree::willWheelEventStartSwipeGesture):
(WebCore::ScrollingTree::windowScreenDidChange):
(WebCore::ScrollingTree::displayID):
(WebCore::ScrollingTree::hasProcessedWheelEventsRecently):
(WebCore::ScrollingTree::willProcessWheelEvent):
(WebCore::ScrollingTree::nominalFramesPerSecond):
(WebCore::ScrollingTree::scrollingTreeAsText):
* page/scrolling/ScrollingTree.h:
* page/scrolling/ScrollingTreeLatchingController.cpp:
(WebCore::ScrollingTreeLatchingController::receivedWheelEvent):
(WebCore::ScrollingTreeLatchingController::latchingDataForEvent const):
(WebCore::ScrollingTreeLatchingController::latchedNodeID const):
(WebCore::ScrollingTreeLatchingController::latchedNodeAndSteps const):
(WebCore::ScrollingTreeLatchingController::nodeDidHandleEvent):
(WebCore::ScrollingTreeLatchingController::nodeWasRemoved):
(WebCore::ScrollingTreeLatchingController::clearLatchedNode):
* page/scrolling/ScrollingTreeLatchingController.h:
* platform/audio/HRTFDatabaseLoader.cpp:
(WebCore::HRTFDatabaseLoader::loadAsynchronously):
(WebCore::HRTFDatabaseLoader::waitForLoaderThreadCompletion):
* platform/audio/HRTFDatabaseLoader.h:
* platform/audio/cocoa/AudioDestinationCocoa.cpp:
(WebCore::AudioDestinationCocoa::hasEnoughFrames const):
(WebCore::AudioDestinationCocoa::render):
(WebCore::AudioDestinationCocoa::renderOnRenderingThead):
* platform/audio/cocoa/AudioDestinationCocoa.h:
* platform/encryptedmedia/CDMProxy.cpp:
(WebCore::CDMProxy::instance const):
(WebCore::CDMProxy::setInstance):
(WebCore::CDMProxy::startedWaitingForKey const):
(WebCore::CDMProxy::stoppedWaitingForKey const):
* platform/encryptedmedia/CDMProxy.h:
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
(WebCore::MediaPlayerPrivateAVFoundation::setDelayCallbacks const):
(WebCore::MediaPlayerPrivateAVFoundation::clearMainThreadPendingFlag):
(WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification):
(WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::processNewVideoSample):
* platform/graphics/cg/IOSurfacePool.cpp:
(WebCore::IOSurfacePool::takeSurface):
(WebCore::IOSurfacePool::addSurface):
(WebCore::IOSurfacePool::setPoolSize):
(WebCore::IOSurfacePool::collectionTimerFired):
(WebCore::IOSurfacePool::discardAllSurfaces):
* platform/graphics/cg/IOSurfacePool.h:
(WebCore::IOSurfacePool::WTF_GUARDED_BY_LOCK):
* platform/graphics/cg/SubimageCacheWithTimer.cpp:
(WebCore::SubimageCacheWithTimer::pruneCacheTimerFired):
(WebCore::SubimageCacheWithTimer::subimage):
(WebCore::SubimageCacheWithTimer::clearImageAndSubimages):
(WebCore::SubimageCacheWithTimer::clearAll):
* platform/graphics/cg/SubimageCacheWithTimer.h:
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontDatabase::collectionForFamily):
(WebCore::FontDatabase::clear):
* platform/network/cocoa/WebCoreNSURLSession.mm:
(WebCore::WebCoreNSURLSessionDataTaskClient::clearTask):
(WebCore::WebCoreNSURLSessionDataTaskClient::dataSent):
(WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived):
(WebCore::WebCoreNSURLSessionDataTaskClient::shouldCacheResponse):
(WebCore::WebCoreNSURLSessionDataTaskClient::dataReceived):
(WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived):
(WebCore::WebCoreNSURLSessionDataTaskClient::accessControlCheckFailed):
(WebCore::WebCoreNSURLSessionDataTaskClient::loadFailed):
(WebCore::WebCoreNSURLSessionDataTaskClient::loadFinished):
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
(-[WebCoreResourceHandleAsOperationQueueDelegate detachHandle]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
* storage/StorageQuotaManager.cpp:
(WebCore::StorageQuotaManager::requestSpaceOnBackgroundThread):
(WebCore::StorageQuotaManager::resetQuotaUpdatedBasedOnUsageForTesting):
(WebCore::StorageQuotaManager::resetQuotaForTesting):
* storage/StorageQuotaManager.h:
(WebCore::StorageQuotaManager::WTF_GUARDED_BY_LOCK):
* workers/WorkerOrWorkletScriptController.cpp:
(WebCore::WorkerOrWorkletScriptController::scheduleExecutionTermination):
(WebCore::WorkerOrWorkletScriptController::isTerminatingExecution const):
* workers/WorkerOrWorkletScriptController.h:
(WebCore::WorkerOrWorkletScriptController::WTF_GUARDED_BY_LOCK):
2021-05-20 Wenson Hsieh <wenson_hsieh@apple.com>
[GPU Process] ItemHandle::safeCopy is not actually safe, does no bounds-checking
https://bugs.webkit.org/show_bug.cgi?id=226022
rdar://78181677
Reviewed by Chris Dumez.
Currently, it's possible for DisplayList iteration to trigger out-of-bounds access when decoding inline display
list items; this patch adds hardening to prevent this. See below for more details.
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
Add an `ItemType` argument to `safeCopy`, and use this `ItemType` instead of assuming that the item type of the
`ItemHandle` we're copying from hasn't changed since we've validated it.
(WebCore::DisplayList::ItemHandle::safeCopy const):
* platform/graphics/displaylists/DisplayListItemBuffer.h:
* platform/graphics/displaylists/DisplayListIterator.cpp:
(WebCore::DisplayList::DisplayList::Iterator::updateCurrentItem):
Verify that the remaining item buffer capacity is at least as large as `paddedSizeOfTypeAndItem`, such that we
won't go out of bounds when attempting to read from the item handle in `safeCopy`.
* platform/graphics/displaylists/InMemoryDisplayList.cpp:
(WebCore::DisplayList::InMemoryDisplayList::ReadingClient::decodeItem):
2021-05-20 Chris Lord <clord@igalia.com>
Allow passing a VisibleRectContext when calculating the clipped overflow rect
https://bugs.webkit.org/show_bug.cgi?id=226007
Reviewed by Simon Fraser.
Refactor rendering classes to allow specifying a VisibleRectContext
when calculating the clipped overflow rect.
No new tests, this is just a small refactor.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::isOffScreen const):
* dom/DocumentMarkerController.cpp:
(WebCore::DocumentMarkerController::renderedRectsForMarkers):
* page/SpatialNavigation.cpp:
(WebCore::hasOffscreenRect):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::clippedOverflowRect const):
* rendering/RenderBox.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::mayCauseRepaintInsideViewport const):
(WebCore::RenderElement::isVisibleInDocumentRect const):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::clippedOverflowRect const):
* rendering/RenderInline.h:
* rendering/RenderLineBreak.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::pixelSnappedAbsoluteClippedOverflowRect const):
(WebCore::RenderObject::clippedOverflowRect const):
(WebCore::RenderObject::computeRect const):
(WebCore::absoluteRectsForRangeInText):
* rendering/RenderObject.h:
(WebCore::RenderObject::absoluteClippedOverflowRectForRepaint const):
(WebCore::RenderObject::clippedOverflowRectForRepaint const):
(WebCore::RenderObject::outlineBoundsForRepaint const):
(WebCore::RenderObject::computeAbsoluteRepaintRect const):
(WebCore::RenderObject::computeRectForRepaint const):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::clippedOverflowRect const):
* rendering/RenderReplaced.h:
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::clippedOverflowRect const):
* rendering/RenderTableCell.h:
* rendering/RenderTableCol.cpp:
(WebCore::RenderTableCol::clippedOverflowRect const):
* rendering/RenderTableCol.h:
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::layout):
(WebCore::RenderTableRow::clippedOverflowRect const):
* rendering/RenderTableRow.h:
* rendering/RenderText.cpp:
(WebCore::RenderText::clippedOverflowRect const):
* rendering/RenderText.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::updateVisibleViewportRect):
* rendering/svg/RenderSVGForeignObject.cpp:
(WebCore::RenderSVGForeignObject::clippedOverflowRect const):
* rendering/svg/RenderSVGForeignObject.h:
* rendering/svg/RenderSVGGradientStop.h:
* rendering/svg/RenderSVGHiddenContainer.h:
* rendering/svg/RenderSVGInline.cpp:
(WebCore::RenderSVGInline::clippedOverflowRect const):
* rendering/svg/RenderSVGInline.h:
* rendering/svg/RenderSVGModelObject.cpp:
(WebCore::RenderSVGModelObject::clippedOverflowRect const):
* rendering/svg/RenderSVGModelObject.h:
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::clippedOverflowRect const):
* rendering/svg/RenderSVGRoot.h:
* rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::clippedOverflowRect const):
* rendering/svg/RenderSVGText.h:
* rendering/svg/SVGRenderTreeAsText.cpp:
2021-05-20 Alex Christensen <achristensen@webkit.org>
Add null checks in FrameSelection::selectFrameElementInParentIfFullySelected
https://bugs.webkit.org/show_bug.cgi?id=225973
<rdar://78200977>
Reviewed by Katherine Cheney.
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::selectFrameElementInParentIfFullySelected):
2021-05-20 Devin Rousso <drousso@apple.com>
[Modern Media Controls] add a suffix based on `TextTrack::Kind` when generating display names for `TrackBase`
https://bugs.webkit.org/show_bug.cgi?id=225995
Reviewed by Eric Carlson.
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::buildDisplayStringForTrackBase):
* platform/LocalizedStrings.h:
* platform/LocalizedStrings.cpp:
(WebCore::captionsTextTrackWithoutLabelMenuItemText): Added.
(WebCore::descriptionsTextTrackWithoutLabelMenuItemText): Added.
(WebCore::chaptersTextTrackWithoutLabelMenuItemText): Added.
(WebCore::metadataTextTrackWithoutLabelMenuItemText): Added.
* en.lproj/Localizable.strings:
2021-05-20 Devin Rousso <drousso@apple.com>
[Modern Media Controls] should not use `codePointCompare` as it doesn't take into account language specific sorting rules
https://bugs.webkit.org/show_bug.cgi?id=225993
Reviewed by Eric Carlson.
* page/CaptionUserPreferences.cpp:
(WebCore::CaptionUserPreferences::sortedTrackListForMenu):
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::textTrackCompare):
(WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu):
2021-05-20 Geoffrey Garen <ggaren@apple.com>
GraphicsLayer::setName() causes heap fragmentation
https://bugs.webkit.org/show_bug.cgi?id=225838
Reviewed by Simon Fraser.
Profiling for heap fragmentation shows that GraphicsLayer::setName() is
a top contributor. Worth about 5MB maximum on GMail.
Use MAKE_STATIC_STRING_IMPL for our constant layer names so we end up
with only one copy and no heap allocation in the many cases that are
compile-time constants.
* display/compositing/DisplayLayerController.cpp:
(WebCore::Display::LayerController::setupRootLayerHierarchy):
* page/PageOverlayController.cpp:
(WebCore::PageOverlayController::createRootLayersIfNeeded):
(WebCore::PageOverlayController::installPageOverlay):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setContentsToSolidColor):
(WebCore::GraphicsLayerCA::setContentsToModel):
(WebCore::GraphicsLayerCA::updateBackdropFilters):
(WebCore::GraphicsLayerCA::updateContentsImage):
(WebCore::GraphicsLayerCA::updateClippingStrategy):
(WebCore::GraphicsLayerCA::updateContentsRects):
* platform/graphics/ca/TileCoverageMap.cpp:
(WebCore::TileCoverageMap::TileCoverageMap):
* platform/graphics/ca/win/CACFLayerTreeHost.cpp:
(WebCore::CACFLayerTreeHost::initialize):
(WebCore::CACFLayerTreeHost::updateDebugInfoLayer):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea):
(WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea):
(WebCore::RenderLayerCompositor::updateLayerForHeader):
(WebCore::RenderLayerCompositor::updateLayerForFooter):
(WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
(WebCore::RenderLayerCompositor::ensureRootLayer):
2021-05-20 Devin Rousso <drousso@apple.com>
[Modern Media Controls] should not include `TextTrack` when sorting `TextTrackList` if it doesn't have a desired `TextTrack::Kind` when `CaptionDisplayMode::Manual`
https://bugs.webkit.org/show_bug.cgi?id=225992
Reviewed by Eric Carlson.
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu):
2021-05-20 Peng Liu <peng.liu6@apple.com>
AirPlay icon of the Vimeo.com video player is missing after reloading the page
https://bugs.webkit.org/show_bug.cgi?id=226005
Reviewed by Eric Carlson.
Some sites, e.g., vimeo.com, depends on the "webkitplaybacktargetavailabilitychanged"
event to setup the player related to AirPlay feature properly. When we reload a
page including media element(s), the element's media session will be constructed
with `m_hasPlaybackTargets` be `true`, so no "webkitplaybacktargetavailabilitychanged"
event will be fired.
This patch ensures that an `HTMLMediaElement` always fires that event when we
reload the page.
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::MediaElementSession):
2021-05-20 Peng Liu <peng.liu6@apple.com>
AirPlay icon of the Vimeo.com video player is missing
https://bugs.webkit.org/show_bug.cgi?id=226004
Reviewed by Eric Carlson.
With the optimizations in r276883, an `HTMLMediaElement` will activate its
`MediaSession` just before creating its `MediaPlayer` inside `prepareForLoad()`
or `loadNextSourceChild()`, and will deactivate its `MediaSession` after tearing
down its `MediaPlayer` inside `mediaLoadingFailed()`.
However, with these changes, when a new `HTMLMediaElement` is created and an
event handler of "webkitplaybacktargetavailabilitychanged" is added to the element,
the element's `MediaSession` might be inactive when function
`MediaSessionManageriOS::configureWireLessTargetMonitoring()` runs, so its
`MediaSession` won't monitor wireless routes, and no "webkitplaybacktargetavailabilitychanged"
will be fired thereafter.
This patch fixes this issue by activating an `HTMLMediaElement`'s `MediaSession`
when adding the first event handler to "webkitplaybacktargetavailabilitychanged" event.
It also keeps the `MediaSession` active if there is event handler to
"webkitplaybacktargetavailabilitychanged" after tearing down the `HTMLMediaElement`'s
`MediaPlayer` (in `HTMLMediaElement::mediaLoadingFailed()`).
We can improve the fix by refactoring the way to activate/deactivate
an `HTMLMediaElement`'s `MediaSession`.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::prepareForLoad):
(WebCore::HTMLMediaElement::loadNextSourceChild):
(WebCore::HTMLMediaElement::mediaLoadingFailed):
(WebCore::HTMLMediaElement::addEventListener):
(WebCore::HTMLMediaElement::createMediaPlayer):
Replace two `mediaSession().setActive(true);` in `prepareForLoad()`
and `loadNextSourceChild()` with one in `createMediaPlayer()`.
2021-05-20 Jer Noble <jer.noble@apple.com>
CRASH: Null-pointer deref in MediaSessionManagerCocoa::setNowPlayingInfo()
https://bugs.webkit.org/show_bug.cgi?id=225999
<rdar://78232970>
Reviewed by Eric Carlson.
Null-check `nowPlayingInfo.artwork->imageData` before dereferencing.
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::setNowPlayingInfo):
2021-05-20 Youenn Fablet <youenn@apple.com>
<video> rendered inside <template> shows black for webcam stream (Safari 14.0.3 only)
https://bugs.webkit.org/show_bug.cgi?id=222115
<rdar://problem/74546659>
Reviewed by Eric Carlson.
Update element visibility if changing of document. Add internals API to test this.
Test: fast/media/template-hidden.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::didMoveToNewDocument):
* testing/Internals.cpp:
(WebCore::Internals::isMediaElementHidden):
* testing/Internals.h:
* testing/Internals.idl:
2021-05-20 Alan Bujtas <zalan@apple.com>
[LFC][TFC] Available space distribution should account for the top and bottom table spacing
https://bugs.webkit.org/show_bug.cgi?id=226003
Reviewed by Antti Koivisto.
The available space for the table content is the table width/height minus the left-right/top-bottom spacing, minus
the additional spacing between the rows/columns.
Tests: fast/inline/vertical-top-on-subpixel-makes-inline-box-overflow.html
fast/layoutformattingcontext/table-simple-row-height.html
* layout/formattingContexts/table/TableLayout.cpp:
(WebCore::Layout::distributeAvailableSpace):
2021-05-20 Aditya Keerthi <akeerthi@apple.com>
Value of a color input does not update visually when using setAttribute
https://bugs.webkit.org/show_bug.cgi?id=166930
<rdar://problem/29983218>
Reviewed by Simon Fraser.
Test: fast/forms/color/color-input-set-attribute-value.html
* html/ColorInputType.cpp:
(WebCore::ColorInputType::attributeChanged):
Update the color swatch when the value attribute is changed.
* html/ColorInputType.h:
2021-05-20 Felipe Erias <felipeerias@igalia.com>
[css-flexbox] Wrong height of an empty table inside an orthogonal flex parent
https://bugs.webkit.org/show_bug.cgi?id=225339
Reviewed by Sergio Villar Senin.
When setting the height of an empty table, give precedence to the overriding value if it has been set.
Do not cache the height of that empty table as the intrinsic content height, because doing so may cause
layout problems (the table is actually empty and may be assigned a different height by its parent).
Test: imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-specified-height.html
imported/w3c/web-platform-tests/css/css-flexbox/table-as-item-specified-width-vertical.html
* rendering/RenderTable.cpp:
(WebCore::RenderTable::layout):
2021-05-19 Jean-Yves Avenard <jya@apple.com>
VP9 powerEfficient detection is broken in STP124
https://bugs.webkit.org/show_bug.cgi?id=225910
rdar://78144486
Reviewed by Darin Adler.
Change r273564 made an assumption that the first point of entry in the
media stack is when a PlatformMediaSessionManager is created and move
the initialization of some video codecs there.
However, this isn't always the case. Media Capabilities JS API can cause
queries to be made to the media engine without creating a media element.
We are unfortunately unable to properly write a test that would prevent
this regression to happen again as this is hardware dependent.
* platform/audio/cocoa/MediaSessionManagerCocoa.h:
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::MediaSessionManagerCocoa):
(WebCore::MediaSessionManagerCocoa::EnsureCodecsRegistered): Add method, use C++17 static
initializer which avoids any ambiguity in regards to thread-safety.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2021-05-19 Tomoki Imai <Tomoki.Imai@sony.com>
Scrolling must be done after the layout when doing full page zoom
https://bugs.webkit.org/show_bug.cgi?id=225730
Reviewed by Simon Fraser.
Previously, the actual scroll was executed before the layout with the zoomed position.
It sometimes makes the scroll position exceed the page height, and cannot retain pageYOffset.
In the user experience perspective, the user may miss what they are looking at after zoom.
This patch makes the scroll happen after the layout, with the zoomed position.
Test: LayoutTests\fast\scrolling\page-y-offset-should-not-be-changed-after-zoom.html
* page/Frame.cpp:
(WebCore::Frame::setPageAndTextZoomFactors): Makes the scroll happen after the layout.
2021-05-19 Devin Rousso <drousso@apple.com>
Add a way to create `"wheel"` events from gesture/touch events
https://bugs.webkit.org/show_bug.cgi?id=225788
<rdar://problem/76714308>
Reviewed by Simon Fraser.
Test: fast/events/gesture/wheel-from-gesture.html
Other browsers have taken the approach of dispatching `"wheel"` events with `ctrlKey` and
`deltaY` when handling multi-touch pinch-to-zoom gestures. Add helper functions to do this.
* platform/PlatformWheelEvent.h:
* platform/PlatformWheelEvent.cpp:
(WebCore::PlatformWheelEvent::createFromGesture): Added.
2021-05-19 Chris Dumez <cdumez@apple.com>
Introduce SQLiteStatement::columnBlobView()
https://bugs.webkit.org/show_bug.cgi?id=225988
Reviewed by Alex Christensen.
Introduce SQLiteStatement::columnBlobView() to get a "view" to the blob instead
of copying the data. This is more efficient for call sites that do not need to
hold on the the Blob data.
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::migrateIndexInfoTableForIDUpdate):
(WebCore::IDBServer::SQLiteIDBBackingStore::migrateIndexRecordsTableForIDUpdate):
(WebCore::IDBServer::SQLiteIDBBackingStore::addExistingIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo):
(WebCore::IDBServer::SQLiteIDBBackingStore::deleteRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::getRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords):
(WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey):
* Modules/indexeddb/server/SQLiteIDBCursor.cpp:
(WebCore::IDBServer::SQLiteIDBCursor::internalFetchNextRecord):
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::columnBlob):
(WebCore::SQLiteStatement::columnBlobView):
* platform/sql/SQLiteStatement.h:
(WebCore::SQLiteStatement::BlobView::BlobView):
(WebCore::SQLiteStatement::BlobView::data):
(WebCore::SQLiteStatement::BlobView::size):
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::importRecords):
2021-05-19 Alex Christensen <achristensen@webkit.org>
Add support for Navigation Timing Level 2
https://bugs.webkit.org/show_bug.cgi?id=184363
Reviewed by Ryosuke Niwa.
This is basically just a new shape for exposing the same data as window.performance.navigation, but with a shape that fits better into the rest of the
performance timeline measurements that have been added to the web platform since performance.navigation.
I noted that exposing transfer size is problematic, and some of the tests for reading transfer size still fail.
There are still a few relatively minor test failures to fix in future patches. Each one is annotated in the LayoutTests ChangeLogs.
Tests: imported/w3c/web-platform-tests/navigation-timing/dom_interactive_image_document.html
imported/w3c/web-platform-tests/navigation-timing/dom_interactive_media_document.html
imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_exist.html
imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_values.html
imported/w3c/web-platform-tests/navigation-timing/nav2_test_instance_accessors.html
imported/w3c/web-platform-tests/navigation-timing/nav2_test_navigate_iframe.html
imported/w3c/web-platform-tests/navigation-timing/nav2_test_navigation_type_navigate.html
imported/w3c/web-platform-tests/navigation-timing/nav2_test_redirect_chain_xserver_final_original_origin.html
imported/w3c/web-platform-tests/navigation-timing/nav2_test_redirect_none.html
imported/w3c/web-platform-tests/navigation-timing/nav2_test_unique_nav_instances.html
imported/w3c/web-platform-tests/navigation-timing/po-navigation.html
imported/w3c/web-platform-tests/navigation-timing/secure-connection-start-reuse.https.html
imported/w3c/web-platform-tests/navigation-timing/test_document_onload.html
imported/w3c/web-platform-tests/performance-timeline/get-invalid-entries.html
imported/w3c/web-platform-tests/performance-timeline/not-clonable.html
imported/w3c/web-platform-tests/performance-timeline/po-observe.html
imported/w3c/web-platform-tests/performance-timeline/po-resource.html
imported/w3c/web-platform-tests/performance-timeline/worker-with-performance-observer.html
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSPerformanceEntryCustom.cpp:
(WebCore::toJSNewlyCreated):
* dom/Document.cpp:
(WebCore::Document::setReadyState):
Sometimes the ready state jumps right to Complete without hitting Interactive along the way.
When this happens, we want to mark both m_documentTiming.domComplete and m_documentTiming.domInteractive.
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::notifyFinished):
Call addNavigationTiming in notifyFinished to create the navigation timing object when we are done navigating
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::didFinishLoading):
* loader/ResourceLoader.h:
* loader/ResourceTiming.cpp:
(WebCore::ResourceTiming::fromLoad):
Add a URL parameter. Sometimes we need to use the request's URL and sometimes the response's. Different specs written at different times.
(WebCore::ResourceTiming::populateServerTiming const):
(WebCore::ResourceTiming::populateServerTiming): Deleted.
* loader/ResourceTiming.h:
(WebCore::ResourceTiming::url const):
(WebCore::ResourceTiming::initiator const):
(WebCore::ResourceTiming::loadTiming const):
(WebCore::ResourceTiming::networkLoadMetrics const):
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::reportResourceTiming):
* page/Performance.cpp:
(WebCore::Performance::getEntries const):
(WebCore::Performance::getEntriesByType const):
(WebCore::Performance::getEntriesByName const):
(WebCore::Performance::appendBufferedEntriesByType const):
(WebCore::Performance::addNavigationTiming):
(WebCore::Performance::registerPerformanceObserver):
(WebCore::Performance::queueEntry):
(WebCore::Performance::scheduleTaskIfNeeded):
* page/Performance.h:
* page/PerformanceEntry.h:
(WebCore::PerformanceEntry::startTime const):
(WebCore::PerformanceEntry::duration const):
(WebCore::PerformanceEntry::isResource const): Deleted.
(WebCore::PerformanceEntry::isMark const): Deleted.
(WebCore::PerformanceEntry::isMeasure const): Deleted.
(WebCore::PerformanceEntry::isPaint const): Deleted.
* page/PerformanceMark.h:
(isType): Deleted.
SPECIALIZE_TYPE_TRAITS_BEGIN/END doesn't work well with PerformanceNavigationTiming which inherits from PerformanceResourceTiming which both have distinct types.
is<PerformanceResourceTiming> doesn't give us the info we need. I replaced that with "switch (entry->performanceEntryType())" in the one place it's used, and it works like a charm.
Also renamed type to performanceEntryType so it doesn't conflict with PerformanceNavigationTiming::type, which is specified in the idl.
* page/PerformanceMeasure.h:
(isType): Deleted.
* page/PerformanceNavigationTiming.cpp: Added.
(WebCore::toPerformanceNavigationTimingNavigationType):
(WebCore::PerformanceNavigationTiming::PerformanceNavigationTiming):
(WebCore::PerformanceNavigationTiming::millisecondsSinceOrigin const):
(WebCore::PerformanceNavigationTiming::sameOriginCheckFails const):
(WebCore::PerformanceNavigationTiming::unloadEventStart const):
(WebCore::PerformanceNavigationTiming::unloadEventEnd const):
(WebCore::PerformanceNavigationTiming::domInteractive const):
(WebCore::PerformanceNavigationTiming::domContentLoadedEventStart const):
(WebCore::PerformanceNavigationTiming::domContentLoadedEventEnd const):
(WebCore::PerformanceNavigationTiming::domComplete const):
(WebCore::PerformanceNavigationTiming::loadEventStart const):
(WebCore::PerformanceNavigationTiming::loadEventEnd const):
(WebCore::PerformanceNavigationTiming::type const):
(WebCore::PerformanceNavigationTiming::redirectCount const):
(WebCore::PerformanceNavigationTiming::startTime const):
(WebCore::PerformanceNavigationTiming::duration const):
* page/PerformanceNavigationTiming.h: Added.
* page/PerformanceNavigationTiming.idl: Copied from Source/WebCore/page/PerformanceObserver.idl.
* page/PerformanceObserver.cpp:
(WebCore::PerformanceObserver::takeRecords):
(WebCore::PerformanceObserver::disconnect):
(WebCore::PerformanceObserver::deliver):
(WebCore::PerformanceObserver::supportedEntryTypes):
* page/PerformanceObserver.h:
* page/PerformanceObserver.idl:
* page/PerformanceObserverEntryList.cpp:
(WebCore::PerformanceObserverEntryList::getEntriesByName const):
* page/PerformancePaintTiming.h:
(isType): Deleted.
* page/PerformanceResourceTiming.cpp:
(WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
(WebCore::PerformanceResourceTiming::nextHopProtocol const):
(WebCore::PerformanceResourceTiming::redirectStart const):
(WebCore::PerformanceResourceTiming::redirectEnd const):
(WebCore::PerformanceResourceTiming::fetchStart const):
(WebCore::PerformanceResourceTiming::domainLookupStart const):
(WebCore::PerformanceResourceTiming::domainLookupEnd const):
(WebCore::PerformanceResourceTiming::connectStart const):
(WebCore::PerformanceResourceTiming::connectEnd const):
(WebCore::PerformanceResourceTiming::secureConnectionStart const):
(WebCore::PerformanceResourceTiming::requestStart const):
(WebCore::PerformanceResourceTiming::responseStart const):
(WebCore::PerformanceResourceTiming::responseEnd const):
(WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp const):
* page/PerformanceResourceTiming.h:
(WebCore::PerformanceResourceTiming::initiatorType const):
(isType): Deleted.
* page/PerformanceResourceTiming.idl:
* platform/network/BlobResourceHandle.cpp:
(WebCore::doNotifyFinish):
* platform/network/NetworkLoadMetrics.h:
* platform/network/ResourceHandleClient.h:
(WebCore::ResourceHandleClient::didFinishLoading):
* platform/network/SynchronousLoaderClient.cpp:
(WebCore::SynchronousLoaderClient::didFinishLoading):
* platform/network/SynchronousLoaderClient.h:
* platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
Pass metrics including the response end time from NSURLConnection so we don't assert in WebKitLegacy.
* platform/network/cocoa/NetworkLoadMetrics.mm:
(WebCore::copyTimingData):
Use currentRequest instead of passing in the response so we can call it from didFinishLoading, where we don't have a response stored anywhere.
We're just looking for whether it's http or https, so the currentRequest (which is the request after all the redirects) fits our purpose.
* platform/network/curl/ResourceHandleCurl.cpp:
(WebCore::ResourceHandle::handleDataURL):
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
2021-05-19 Peng Liu <peng.liu6@apple.com>
[iOS] Video playback pauses when switching apps (video enters picture-in-picture from fullscreen)
https://bugs.webkit.org/show_bug.cgi?id=225981
Reviewed by Jer Noble.
Similar to Mac, on iOS devices, we should not pause a video playback
when the video enters picture-in-picture from fullscreen.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
2021-05-19 Sam Weinig <weinig@apple.com>
Remove ImageBuffer::toBGRA() and replace its uses with the more general ImageBuffer::getPixelBuffer()
https://bugs.webkit.org/show_bug.cgi?id=225976
Reviewed by Said Abou-Hallawa.
Removes ImageBuffer::toBGRA() and replaces it with the more verbose (but also more clear)
ImageBuffer::getPixelBuffer(). There were only two users of toBGRA(), MediaSample creation
from a <canvas> and PageColorSampler. For MediaSample, we likely should not be doing
readback this way, and should instead try to keep the data in the GPU process / on the GPU
when possible / necessary.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::toMediaSample):
Update calls to pass imageBuffer and share call to makeRenderingResultsAvailable().
* page/PageColorSampler.cpp:
(WebCore::sampleColor):
Update ot use getPixelBuffer().
* platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
(WebCore::MediaSampleAVFObjC::createImageSample):
Update MediaSampleAVFObjC to use getPixelBuffer directly().
* platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
(WebCore::MediaSampleGStreamer::createImageSample):
* platform/graphics/gstreamer/MediaSampleGStreamer.h:
(WebCore::MediaSampleGStreamer::createImageSample):
* platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.cpp:
(WebCore::MockRealtimeVideoSourceGStreamer::updateSampleBuffer):
Update MediaSampleGStreamer to use getPixelBuffer directly().
* platform/MediaSample.h:
Use #pragma once.
* platform/graphics/ConcreteImageBuffer.h:
* platform/graphics/ImageBuffer.h:
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::toBGRAData const): Deleted.
* platform/graphics/ImageBufferBackend.h:
* platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp:
(WebCore::ImageBufferCairoSurfaceBackend::toBGRAData const): Deleted.
* platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h:
* platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
(WebCore::ImageBufferCGBitmapBackend::toBGRAData const): Deleted.
* platform/graphics/cg/ImageBufferCGBitmapBackend.h:
* platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
(WebCore::ImageBufferIOSurfaceBackend::toBGRAData const): Deleted.
* platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
* platform/graphics/win/ImageBufferDirect2DBackend.cpp:
(WebCore::ImageBufferDirect2DBackend::toBGRAData const): Deleted.
* platform/graphics/win/ImageBufferDirect2DBackend.h:
Remove toBGRA().
2021-05-19 Cameron McCormack <heycam@apple.com>
Remove unused GraphicsContextImpl constructor arguments
https://bugs.webkit.org/show_bug.cgi?id=225583
Reviewed by Simon Fraser.
* platform/graphics/GraphicsContextImpl.cpp:
(WebCore::GraphicsContextImpl::GraphicsContextImpl):
* platform/graphics/GraphicsContextImpl.h:
* platform/graphics/cairo/GraphicsContextImplCairo.cpp:
(WebCore::GraphicsContextImplCairo::GraphicsContextImplCairo):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::Recorder):
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
(Nicosia::CairoOperationRecorder::CairoOperationRecorder):
* platform/graphics/win/GraphicsContextImplDirect2D.cpp:
(WebCore::GraphicsContextImplDirect2D::GraphicsContextImplDirect2D):
2021-05-19 Sam Weinig <weinig@apple.com>
HTMLCanvasElement toDataURL and toBlob do unnecessary data copies through a CFDataRef
https://bugs.webkit.org/show_bug.cgi?id=225853
Reviewed by Darin Adler.
When trying to encode either a PixelBuffer or a ImageBuffer to an image for
blob or dataURL creation, we were using a method that required always first
creating a CFDataRef and then copying that CFDataRef's data into what we needed.
Instead, we can use a callback based CGDataConsumer and some passed around
functors to get the data directly as it is being encoded and process it as
needed. ScopedLambda is used to avoid unnecessary inlining or allocation that
a template based functor or WTF::Function would require respectively.
* platform/graphics/cg/ImageBufferCGBackend.h:
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::ImageBufferCGBackend::toCFData const): Deleted.
(WebCore::ImageBufferCGBackend::copyPlatformImageForEncoding const):
Factor out PlatformImagePtr creation into its own function. This replaces the
toCFData virtual function, and is used in conjunction with the data/dataURL
functions in ImageBufferCGBackend to produce the encoded data.
(WebCore::ImageBufferCGBackend::toData const):
(WebCore::ImageBufferCGBackend::toDataURL const):
Rework to use copyPlatformImageForEncoding and data/dataURL in ImageBufferCGBackend
to produce the encoded data.
* platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
* platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
(WebCore::ImageBufferIOSurfaceBackend::copyPlatformImageForEncoding const):
(WebCore::ImageBufferIOSurfaceBackend::toCFData const): Deleted.
Like toCFData before it, copyPlatformImageForEncoding is virtual allowing for this
override in ImageBufferIOSurfaceBackend.
* platform/graphics/cg/ImageBufferUtilitiesCG.h:
* platform/graphics/cg/ImageBufferUtilitiesCG.cpp:
(WebCore::encode):
(WebCore::encodeToVector):
(WebCore::encodeToDataURL):
(WebCore::data):
(WebCore::dataURL):
(WebCore::encodeImage): Deleted.
(WebCore::cfData): Deleted.
(WebCore::dataVector): Deleted.
Replace encodeImage(), which filled in a CFMutableDataRef, with overloads of data() and
dataURL() that now use a callback based CGDataConsumer and some callback functors to
allow the encoded data to be consumed as it is being created. Also makes use of new
base64Encoded() adapter to base64 encode directly in makeString().
2021-05-19 Chris Dumez <cdumez@apple.com>
Drop "get" prefix from SQLiteStatement member functions as well as out-parameters
https://bugs.webkit.org/show_bug.cgi?id=225971
Reviewed by Darin Adler.
Drop "get" prefix from SQLiteStatement member functions as well as out-parameters to
modernize the code a bit and follow WebKit style.
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::createOrMigrateRecordsTableIfNecessary):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidBlobTables):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsTable):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsRecordIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidObjectStoreInfoTable):
(WebCore::IDBServer::SQLiteIDBBackingStore::migrateIndexInfoTableForIDUpdate):
(WebCore::IDBServer::SQLiteIDBBackingStore::migrateIndexRecordsTableForIDUpdate):
(WebCore::IDBServer::SQLiteIDBBackingStore::addExistingIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo):
(WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameAndVersionFromFile):
(WebCore::IDBServer::SQLiteIDBBackingStore::deleteUnusedBlobFileRecords):
(WebCore::IDBServer::SQLiteIDBBackingStore::deleteRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::getBlobRecordsForObjectStoreRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::getRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords):
(WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey):
(WebCore::IDBServer::SQLiteIDBBackingStore::getCount):
(WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetKeyGeneratorValue):
(WebCore::IDBServer::SQLiteIDBBackingStore::deleteBackingStore):
* Modules/indexeddb/server/SQLiteIDBCursor.cpp:
(WebCore::IDBServer::SQLiteIDBCursor::internalFetchNextRecord):
* Modules/webdatabase/Database.cpp:
(WebCore::retrieveTextResultFromDatabase):
(WebCore::Database::performGetTableNames):
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::fullPathForDatabaseNoLock):
(WebCore::DatabaseTracker::origins):
(WebCore::DatabaseTracker::databaseNamesNoLock):
(WebCore::DatabaseTracker::detailsForNameAndOrigin):
(WebCore::DatabaseTracker::setDatabaseDetails):
(WebCore::DatabaseTracker::quotaNoLock):
(WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
* Modules/webdatabase/SQLStatement.cpp:
(WebCore::SQLStatement::execute):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::loadCacheGroup):
(WebCore::ApplicationCacheStorage::loadManifestHostHashes):
(WebCore::ApplicationCacheStorage::cacheGroupForURL):
(WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL):
(WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
(WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
(WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
(WebCore::ApplicationCacheStorage::verifySchemaVersion):
(WebCore::ApplicationCacheStorage::loadCache):
(WebCore::ApplicationCacheStorage::manifestURLs):
(WebCore::ApplicationCacheStorage::deleteCacheGroupRecord):
(WebCore::ApplicationCacheStorage::checkForDeletedResources):
(WebCore::ApplicationCacheStorage::flatFileAreaSize):
* platform/network/curl/CookieJarDB.cpp:
(WebCore::CookieJarDB::verifySchemaVersion):
(WebCore::CookieJarDB::checkDatabaseValidity):
(WebCore::CookieJarDB::searchCookies):
(WebCore::CookieJarDB::getAllCookies):
(WebCore::CookieJarDB::allDomains):
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::useWALJournalMode):
(WebCore::SQLiteDatabase::maximumSize):
(WebCore::SQLiteDatabase::pageSize):
(WebCore::SQLiteDatabase::freeSpaceSize):
(WebCore::SQLiteDatabase::totalSize):
(WebCore::SQLiteDatabase::clearAllTables):
(WebCore::SQLiteDatabase::turnOnIncrementalAutoVacuum):
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::columnName):
(WebCore::SQLiteStatement::columnValue):
(WebCore::SQLiteStatement::columnText):
(WebCore::SQLiteStatement::columnDouble):
(WebCore::SQLiteStatement::columnInt):
(WebCore::SQLiteStatement::columnInt64):
(WebCore::SQLiteStatement::columnBlobAsString):
(WebCore::SQLiteStatement::columnBlob):
* platform/sql/SQLiteStatement.h:
* platform/win/SearchPopupMenuDB.cpp:
(WebCore::SearchPopupMenuDB::loadRecentSearches):
(WebCore::SearchPopupMenuDB::checkDatabaseValidity):
(WebCore::SearchPopupMenuDB::verifySchemaVersion):
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::ensureValidRecordsTable):
(WebCore::RegistrationDatabase::importRecords):
2021-05-19 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Pull ServicesOverlayController::Highlight out into a separate helper class
https://bugs.webkit.org/show_bug.cgi?id=225968
Reviewed by Tim Horton.
Refactor some code for painting data detector highlights (`DDHighlightRef`), by pulling what is currently
`ServicesOverlayController::Highlight` out into a separate helper class. In a future patch, I plan on using this
functionality for the image overlay controller to support rendering data detector highlights there.
This patch also makes some minor adjustments:
- Make `DataDetectorHighlight` capable of being stored in a `WeakPtr`, and have `ServicesOverlayController`
hold on to a `WeakHashSet<DataDetectorHighlight>` instead of a hash set of raw pointers. This additionally
makes it unnecessary to add methods for `DataDetectorHighlight` to notify `ServicesOverlayController` upon
creation or destruction, since we can simply add the newly created highlight to the weak set after creating
it, and since it's a `WeakPtr`, it will get cleaned up upon destruction.
- Make DataDetectorHighlight::Type an enum class, and make `m_dirtyHighlightTypes` an `OptionSet` instead of
a raw bitmask.
- Use `auto` in a few places where the type is apparent (e.g. in some places where we use `adoptCF`).
- Make `highlightFadeAnimationDuration` a `WTF::Seconds` instead of a raw floating point value.
- Add a FIXME in `DataDetectorHighlight::paintContents` about the need to refactor this painting logic so that
it does *not* use the platform `CGContextRef` directly.
No change in behavior.
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* page/mac/ServicesOverlayController.h:
(WebCore::ServicesOverlayController::activeHighlight const):
(WebCore::ServicesOverlayController::Highlight::ddHighlight const): Deleted.
(WebCore::ServicesOverlayController::Highlight::range const): Deleted.
(WebCore::ServicesOverlayController::Highlight::layer const): Deleted.
(WebCore::ServicesOverlayController::Highlight::type const): Deleted.
* page/mac/ServicesOverlayController.mm:
(WebCore::ServicesOverlayController::~ServicesOverlayController):
(WebCore::ServicesOverlayController::selectionRectsDidChange):
(WebCore::ServicesOverlayController::selectedTelephoneNumberRangesChanged):
(WebCore::ServicesOverlayController::invalidateHighlightsOfType):
(WebCore::ServicesOverlayController::buildPotentialHighlightsIfNeeded):
(WebCore::ServicesOverlayController::mouseIsOverHighlight const):
(WebCore::ServicesOverlayController::remainingTimeUntilHighlightShouldBeShown const):
(WebCore::ServicesOverlayController::removeAllPotentialHighlightsOfType):
(WebCore::ServicesOverlayController::buildPhoneNumberHighlights):
(WebCore::ServicesOverlayController::buildSelectionHighlight):
(WebCore::ServicesOverlayController::replaceHighlightsOfTypePreservingEquivalentHighlights):
(WebCore::ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight):
(WebCore::ServicesOverlayController::determineActiveHighlight):
(WebCore::ServicesOverlayController::mouseEvent):
(WebCore::ServicesOverlayController::didScrollFrame):
(WebCore::ServicesOverlayController::handleClick):
(WebCore::ServicesOverlayController::shouldRemoveHighlightLayerAfterFadingOut const):
(WebCore::ServicesOverlayController::Highlight::createForSelection): Deleted.
(WebCore::ServicesOverlayController::Highlight::createForTelephoneNumber): Deleted.
(WebCore::ServicesOverlayController::Highlight::Highlight): Deleted.
(WebCore::ServicesOverlayController::Highlight::~Highlight): Deleted.
(WebCore::ServicesOverlayController::Highlight::setDDHighlight): Deleted.
(WebCore::ServicesOverlayController::Highlight::invalidate): Deleted.
(WebCore::ServicesOverlayController::Highlight::notifyFlushRequired): Deleted.
(WebCore::ServicesOverlayController::Highlight::paintContents): Deleted.
(WebCore::ServicesOverlayController::Highlight::deviceScaleFactor const): Deleted.
(WebCore::ServicesOverlayController::Highlight::fadeIn): Deleted.
(WebCore::ServicesOverlayController::Highlight::fadeOut): Deleted.
(WebCore::ServicesOverlayController::Highlight::didFinishFadeOutAnimation): Deleted.
(WebCore::ServicesOverlayController::highlightsAreEquivalent): Deleted.
(WebCore::ServicesOverlayController::didCreateHighlight): Deleted.
(WebCore::ServicesOverlayController::willDestroyHighlight): Deleted.
* platform/mac/DataDetectorHighlight.h: Added.
(WebCore::DataDetectorHighlightClient::shouldRemoveHighlightLayerAfterFadingOut const):
(WebCore::DataDetectorHighlight::highlight const):
(WebCore::DataDetectorHighlight::range const):
(WebCore::DataDetectorHighlight::layer const):
(WebCore::DataDetectorHighlight::type const):
* platform/mac/DataDetectorHighlight.mm: Added.
(WebCore::DataDetectorHighlight::createForSelection):
(WebCore::DataDetectorHighlight::createForTelephoneNumber):
(WebCore::DataDetectorHighlight::DataDetectorHighlight):
(WebCore::DataDetectorHighlight::setHighlight):
(WebCore::DataDetectorHighlight::invalidate):
(WebCore::DataDetectorHighlight::notifyFlushRequired):
(WebCore::DataDetectorHighlight::paintContents):
(WebCore::DataDetectorHighlight::deviceScaleFactor const):
(WebCore::DataDetectorHighlight::fadeIn):
(WebCore::DataDetectorHighlight::fadeOut):
(WebCore::DataDetectorHighlight::didFinishFadeOutAnimation):
(WebCore::areEquivalent):
2021-05-18 Darin Adler <darin@apple.com>
Move CFStringRef and NSString support from StringBuilder into StringConcatenateCF
https://bugs.webkit.org/show_bug.cgi?id=225839
Reviewed by Sam Weinig.
* Modules/airplay/WebMediaSessionManager.cpp:
(WebCore::mediaProducerStateString): Use StringBuilder exclusively instead of
mixing it with makeString. Also updated for StringBuilder::shrink name.
* html/HTMLTextFormControlElement.cpp:
(WebCore::stripTrailingNewline): Updated for StringBuilder::shrink name.
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::captionsTextColor const): Tweaked
coding style a bit.
(WebCore::appendCSS): Use variadic StringBuilder::append instead of many
separate calls.
(WebCore::CaptionUserPreferencesMediaAF::captionsDefaultFontCSS const):
Tweaked coding style a bit, and use variadic StrinBuilder::append calls
to reduce the number of calls and streamline the code.
(WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride const):
Ditto. Also removed unnecessary checks that strings are empty before appending.
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText):
Updated for StringBuilder::shrink name.
* platform/LayoutUnit.h: Updated for saturatedSum/Difference names.
* platform/network/cocoa/NetworkStorageSessionCocoa.mm:
(WebCore::NetworkStorageSession::cookiesForSession const): Tweaked codin
style a bit, and use variadic StrinBuilder::append calls to reduce the
number of calls and streamline the code.
* rendering/RenderCounter.cpp:
(WebCore::planCounter): Updated for saturatedSum name.
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueCounter): Ditto.
* svg/SVGPathStringBuilder.cpp:
(WebCore::SVGPathStringBuilder::result): Updated for StringBuilder::shrink name.
* testing/Internals.cpp:
(WebCore::Internals::pageMediaState): Ditto.
* xml/XSLTProcessorLibxslt.cpp:
(WebCore::saveResultToString): Ditto.
2021-05-19 Sam Weinig <weinig@apple.com>
Update Base64 encoding/decoding to match more modern WebKit conventions
https://bugs.webkit.org/show_bug.cgi?id=225920
Reviewed by Chris Dumez.
- Updates to use new signatures for base64 encoding/decoding including
utilizing the string type adaptor and makeString.
- Replace out parameter based getDefaultWebCryptoMasterKey() with
Optional<Vector<uint8_t>> defaultWebCryptoMasterKey().
- Update synchronous loading code path to use uint8_t* consistently for
data buffer representation.
- Replace out parameters in quotedPrintableEncode/quotedPrintableDecode
with Optional.
* Modules/encryptedmedia/InitDataRegistry.cpp:
(WebCore::extractKeyIDsKeyids):
Update to use new base64URLDecode.
(WebCore::sanitizeKeyids):
Update to use new base64URLEncodeToString()
* Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
(WebCore::CDMSessionClearKey::update):
Update to use new base64Decode().
* Modules/plugins/QuickTimePluginReplacement.mm:
(WebCore::jsValueWithDataInContext):
(WebCore::jsValueWithAVMetadataItemInContext):
Update to use new base64EncodeToString(). Replace string concatentation
using operator+ with makeString().
* Modules/webauthn/AuthenticatorCoordinator.cpp:
(WebCore::AuthenticatorCoordinatorInternal::produceClientDataJson):
Update to use new base64URLEncodeToString().
* Modules/webauthn/PublicKeyCredential.cpp:
(WebCore::PublicKeyCredential::PublicKeyCredential):
Update to use new base64URLEncodeToString().
* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::generateSecWebSocketKey):
(WebCore::WebSocketHandshake::getExpectedWebSocketAccept):
Update to use new base64URLEncodeToString().
* crypto/SerializedCryptoKeyWrap.h:
Change from outparameter based getDefaultWebCryptoMasterKey() to new
Optional<Vector<uint8_t>> defaultWebCryptoMasterKey().
* crypto/gcrypt/CryptoKeyECGCrypt.cpp:
(WebCore::CryptoKeyEC::platformAddFieldElements const):
Update to use new base64URLEncodeToString().
* crypto/gcrypt/SerializedCryptoKeyWrapGCrypt.cpp:
(WebCore::defaultWebCryptoMasterKey):
(WebCore::getDefaultWebCryptoMasterKey): Deleted.
Update for new defaultWebCryptoMasterKey() signature.
* crypto/keys/CryptoKeyAES.cpp:
(WebCore::CryptoKeyAES::importJwk):
(WebCore::CryptoKeyAES::exportJwk const):
Update to use new base64URLDecode / base64URLEncodeToString().
* crypto/keys/CryptoKeyEC.cpp:
(WebCore::CryptoKeyEC::importJwk):
Update to use new base64URLDecode.
* crypto/keys/CryptoKeyHMAC.cpp:
(WebCore::CryptoKeyHMAC::importJwk):
(WebCore::CryptoKeyHMAC::exportJwk const):
Update to use new base64URLDecode / base64URLEncodeToString().
* crypto/keys/CryptoKeyRSA.cpp:
(WebCore::CryptoKeyRSA::importJwk):
(WebCore::CryptoKeyRSA::exportJwk const):
Update to use new base64URLDecode / base64URLEncodeToString().
* crypto/mac/CryptoKeyECMac.cpp:
(WebCore::CryptoKeyEC::platformAddFieldElements const):
Update to use new base64URLEncodeToString().
* crypto/mac/SerializedCryptoKeyWrapMac.mm:
(WebCore::createAndStoreMasterKey):
(WebCore::findMasterKey):
(WebCore::defaultWebCryptoMasterKey):
(WebCore::getDefaultWebCryptoMasterKey): Deleted.
Update for new defaultWebCryptoMasterKey() signature.
* crypto/openssl/SerializedCryptoKeyWrapOpenSSL.cpp:
(WebCore::defaultWebCryptoMasterKey):
(WebCore::getDefaultWebCryptoMasterKey): Deleted.
Update for new defaultWebCryptoMasterKey() signature.
* fileapi/FileReaderLoader.cpp:
(WebCore::FileReaderLoader::convertToDataURL):
Update to use new base64EncodeToString().
* inspector/DOMPatchSupport.cpp:
(WebCore::DOMPatchSupport::createDigest):
Update to use new base64EncodeToString().
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::showCertificate):
Update to use new base64URLDecode / base64URLEncodeToString().
* inspector/NetworkResourcesData.cpp:
(WebCore::NetworkResourcesData::ResourceData::decodeDataToContent):
Update to use new base64EncodeToString().
* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::computeContentSecurityPolicySHA256Hash):
Update to use new base64Decode / base64EncodeToString().
* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::Inspector::buildWebSocketMessage):
(WebCore::InspectorNetworkAgent::didReceiveData):
(WebCore::InspectorNetworkAgent::getSerializedCertificate):
(WebCore::InspectorNetworkAgent::interceptWithRequest):
(WebCore::InspectorNetworkAgent::interceptWithResponse):
(WebCore::InspectorNetworkAgent::interceptRequestWithResponse):
(WebCore::InspectorNetworkAgent::cachedResourceContent):
Update to use new base64Decode / base64EncodeToString().
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::dataContent):
(WebCore::InspectorPageAgent::archive):
Update to use new base64EncodeToString().
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadResourceSynchronously):
Switch to using Vector<uint8_t> buffer to match new loadResourceSynchronously
signature.
* loader/LoaderStrategy.h:
Switch to using Vector<uint8_t> for the data buffer.
* loader/PrivateClickMeasurement.cpp:
(WebCore::PrivateClickMeasurement::EphemeralSourceNonce::isValid const):
Update to use new base64URLDecode.
* loader/ResourceCryptographicDigest.cpp:
(WebCore::parseCryptographicDigestImpl):
(WebCore::decodeEncodedResourceCryptographicDigest):
Update to use new base64Decode.
* loader/archive/mhtml/MHTMLArchive.cpp:
(WebCore::MHTMLArchive::generateMHTMLData):
Switch to using new base64Encode and new quotedPrintableEncode.
* loader/archive/mhtml/MHTMLParser.cpp:
(WebCore::MHTMLParser::parseNextPart):
Switch to using new base64Decode and new quotedPrintableDecode.
* loader/cocoa/PrivateClickMeasurementCocoa.mm:
(WebCore::PrivateClickMeasurement::calculateAndUpdateSourceUnlinkableToken):
(WebCore::PrivateClickMeasurement::calculateAndUpdateSourceSecretToken):
Update to use new base64URLDecode / base64URLEncodeToString().
* page/Base64Utilities.cpp:
(WebCore::Base64Utilities::btoa):
(WebCore::Base64Utilities::atob):
Update to use new base64Decode / base64EncodeToString().
* page/Page.cpp:
(WebCore::Page::userStyleSheetLocationChanged):
Update to use new base64Decode.
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::append):
* platform/SharedBuffer.h:
Add overload for append which allows passing in a uint8_t*.
* platform/encryptedmedia/clearkey/CDMClearKey.cpp:
(WebCore::parseLicenseFormat):
(WebCore::extractKeyidsFromCencInitData):
(WebCore::extractKeyIdFromWebMInitData):
(WebCore::CDMInstanceSessionClearKey::removeSessionData):
Update to use new base64URLDecode / base64URLEncodeToString().
* platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
(WebCore::extractSinfData):
Update to use new base64Decode.
* platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestLicense):
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequests):
Update to use new base64Decode / base64EncodeToString().
* platform/graphics/cairo/ImageBufferCairoBackend.cpp:
(WebCore::ImageBufferCairoBackend::toDataURL const):
Update to use new base64EncodeToString().
* platform/graphics/cg/ImageBufferUtilitiesCG.cpp:
(WebCore::dataURL):
Update to use new base64EncodeToString().
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::createUniqueFontName):
Update to use new base64EncodeToString().
* platform/graphics/win/FontCustomPlatformDataCairo.cpp:
(WebCore::createUniqueFontName):
Update to use new base64EncodeToString().
* platform/mac/SSLKeyGeneratorMac.mm:
(WebCore::signedPublicKeyAndChallengeString):
Update to use new base64EncodeToString().
* platform/network/BlobRegistryImpl.cpp:
(WebCore::loadBlobResourceSynchronously):
Switch to using Vector<uint8_t> buffer to match new loadResourceSynchronously
signature.
* platform/network/BlobResourceHandle.cpp:
* platform/network/BlobResourceHandle.h:
(WebCore::BlobResourceHandle::loadResourceSynchronously):
Switch to using Vector<uint8_t> buffer to match new loadResourceSynchronously
signature.
* platform/network/CredentialBase.cpp:
* platform/network/CredentialBase.h:
(WebCore::CredentialBase::serializationForBasicAuthorizationHeader const):
Add helper to construct Basic auth header to replace duplicated logic in
call sites.
* platform/network/DataURLDecoder.cpp:
(WebCore::DataURLDecoder::decodeBase64):
(WebCore::DataURLDecoder::decodeEscaped):
(WebCore::DataURLDecoder::decodeSynchronously):
* platform/network/DataURLDecoder.h:
Update to use new base64Decode.
* platform/network/ResourceHandle.cpp:
* platform/network/ResourceHandle.h:
Switch to using Vector<uint8_t> for the data buffer in the synchronous load.
* platform/network/SynchronousLoaderClient.cpp:
(WebCore::SynchronousLoaderClient::didReceiveData):
* platform/network/SynchronousLoaderClient.h:
Switch to using Vector<uint8_t> buffer to match new loadResourceSynchronously
signature.
* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::applyBasicAuthorizationHeader):
Use new serializationForBasicAuthorizationHeader() helper.
(WebCore::ResourceHandle::platformLoadResourceSynchronously):
Switch to using Vector<uint8_t> for the data buffer in the synchronous load.
* platform/network/curl/ResourceHandleCurl.cpp:
(WebCore::ResourceHandle::platformLoadResourceSynchronously):
(WebCore::ResourceHandle::handleDataURL):
Switch to using Vector<uint8_t> for the data buffer in the synchronous load.
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::applyBasicAuthorizationHeader):
Use new serializationForBasicAuthorizationHeader() helper.
(WebCore::ResourceHandle::platformLoadResourceSynchronously):
Switch to using Vector<uint8_t> for the data buffer in the synchronous load.
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::ResourceHandle::platformLoadResourceSynchronously):
Switch to using Vector<uint8_t> for the data buffer in the synchronous load.
* platform/network/soup/SoupNetworkSession.cpp:
(WebCore::HostTLSCertificateSet::computeCertificateHash):
Update to use new base64EncodeToString().
* platform/text/DecodeEscapeSequences.h:
(WebCore::decodeURLEscapeSequencesAsData):
Switch to returning Vector<uint8_t>.
* platform/text/QuotedPrintable.cpp:
* platform/text/QuotedPrintable.h:
(WebCore::lengthOfLineEndingAtIndex):
(WebCore::quotedPrintableEncode):
(WebCore::quotedPrintableDecode):
Replace uses of Vector<char> with Vector<uint8_t> and the out parameters
with Optional return values.
* platform/win/SSLKeyGeneratorWin.cpp:
(WebCore::signedPublicKeyAndChallengeString):
Update to use new base64EncodeToString().
* workers/service/server/SWScriptStorage.cpp:
(WebCore::SWScriptStorage::sha2Hash const):
Update to use new base64URLEncodeToString().
2021-05-19 Devin Rousso <drousso@apple.com>
[Apple Pay] use a `dictionary ApplePayPaymentMethodModeDetails` instead of a raw `JSObject`
https://bugs.webkit.org/show_bug.cgi?id=225903
<rdar://problem/78134060>
Reviewed by Andy Estes.
No change in functionality.
* Modules/applepay/ApplePayPaymentMethodModeDetails.idl: Added.
* Modules/applepay/ApplePayPaymentMethodModeDetails.h: Added.
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
(WebCore::ApplePayPaymentHandler::didChangePaymentMethodMode):
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* PlatformMac.cmake:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
2021-05-19 Alan Bujtas <zalan@apple.com>
Calculated width percent loses the floating point and cause line wrap
https://bugs.webkit.org/show_bug.cgi?id=225962
Reviewed by Antti Koivisto.
Length::nonNanCalculatedValue unexpectedly floors non-integral values.
Test: fast/inline/unexpected-line-wrap-with-calc.html
* platform/Length.cpp:
(WebCore::Length::nonNanCalculatedValue const):
* platform/Length.h:
2021-05-19 Chris Dumez <cdumez@apple.com>
[Hardening] CARingBuffer should validate the storage size before adopting it
https://bugs.webkit.org/show_bug.cgi?id=225928
<rdar://73575595>
Reviewed by Jer Noble.
We use a lot of SharedMemory-backed CARingBuffers. The pattern is that a process creates the
SharedMemory then sends a SharedMemory::Handle to another process, who adopts it as storage
for its CARingBuffer. Because the process that sends us the SharedMemory::Handle may not be
trusted, we need to validate that the size of the storage is sufficient based on the
CARingBuffer's format & frameCount.
* platform/audio/cocoa/CARingBuffer.cpp:
(WebCore::computeCapacityBytes):
(WebCore::computeSizeForBuffers):
(WebCore::CARingBuffer::adoptStorage):
(WebCore::CARingBuffer::initializeAfterAllocation):
(WebCore::CARingBuffer::allocate):
(WebCore::CARingBufferStorageVector::allocate):
* platform/audio/cocoa/CARingBuffer.h:
2021-05-19 Jer Noble <jer.noble@apple.com>
[Mac] MSE-based video pauses when put in background; PiP context menu disabled
https://bugs.webkit.org/show_bug.cgi?id=225958
<rdar://78130303>
Reviewed by Eric Carlson.
Test: media/media-source/media-source-has-audio-video.html
In r277116, in order to reduce the CPU usage incurred when pushing state changes from
the GPU process to the WebContent process, state changes to `hasAudio` and `hasVideo`
were now only updated when the MediaPlayer indicated that its `characteristicsChanged()`.
However, in SourceBufferPrivateAVFObjC, this call was performed too early, before the
SourceBuffer in the WebContent process had informed SourceBufferPrivate of newly added
audio and video tracks. Thus the cached values of `hasAudio` and `hasVideo` inside the
WebContent process were never updated.
Call `characteristicsChanged()` from the callback handler of `didReceiveInitializationSegment()`,
which will be called only after the WebContent process completes its handling of the
new initialization segment, which includes telling the SourceBufferPrivate in the GPU
process about newly added audio and video tracks.
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::didParseInitializationData):
2021-05-19 Antti Koivisto <antti@apple.com>
Factor pseudo class invalidation code in Document::updateHoverActiveState into a lambda
https://bugs.webkit.org/show_bug.cgi?id=225966
Reviewed by Sam Weinig.
Cleanup.
* dom/Document.cpp:
(WebCore::Document::updateHoverActiveState):
2021-05-19 Chris Dumez <cdumez@apple.com>
Fix flaky assertion hit under AudioSummingJunction::removeOutput()
https://bugs.webkit.org/show_bug.cgi?id=225951
Reviewed by Eric Carlson.
Temporarily disable assertion preventing heap allocations on the audio thread
in AudioSummingJunction::removeOutput() as it is flakily hitting on the bots.
* Modules/webaudio/AudioSummingJunction.cpp:
(WebCore::AudioSummingJunction::removeOutput):
2021-05-19 Wenson Hsieh <wenson_hsieh@apple.com>
[GPU Process] Add more bounds checking and input validation in DisplayListIterator
https://bugs.webkit.org/show_bug.cgi?id=225937
rdar://71848559
Reviewed by Ryosuke Niwa.
Harden logic for iterating display list items.
1. Check that the item type enum is valid after reading it from the cursor.
2. In the case of out-of-line items, verify that the data length of the encoded object is limited to a
reasonable size (4 GB) and does not exceed the capacity of the current item buffer before attempting to read
and decode the item.
Note that in all cases, validation failure results in web process termination via a MESSAGE_CHECK initiated by
the GPU Process.
* platform/graphics/displaylists/DisplayListIterator.cpp:
(WebCore::DisplayList::DisplayList::Iterator::updateCurrentItem):
Note that this additionally caps the size of any given out-of-line display list item to the (comfortably large)
numerical limit of `uint32_t`.
2021-05-19 Youenn Fablet <youenn@apple.com>
ASSERTION FAILED: unwrapParamsOrException.exception().code() != ExistingExceptionError on http/wpt/preload/change-link-rel-attribute.html
https://bugs.webkit.org/show_bug.cgi?id=224845
<rdar://problem/76928843>
Reviewed by Mark Lam.
Covered by existing tests.
* crypto/SubtleCrypto.cpp:
(WebCore::SubtleCrypto::unwrapKey):
Remove debug assertion since there are valid cases where it can happen.
2021-05-19 Rob Buis <rbuis@igalia.com>
https://bugs.webkit.org/show_bug.cgi?id=225964
Fix flex-aspect-ratio-002+004.html
Reviewed by Sergio Villar Senin.
Flex should not do transferred size suggestion for non-replaced aspect-ratio items:
https://drafts.csswg.org/css-flexbox-1/#min-size-auto
Tests: imported/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-002.html
imported/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-004.html
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax):
2021-05-18 Cameron McCormack <heycam@apple.com>
Record gradient and pattern filled canvas text in the correct coordinate system.
https://bugs.webkit.org/show_bug.cgi?id=222881
<rdar://75155310>
Reviewed by Myles C. Maxfield.
When we draw canvas text with a gradient or pattern, we use
GraphicsContext::clipToDrawingCommands to set up a mask, which
we then draw a filled rectangle with. When GPUP canvas rendering is
enabled, Recorder::clipToDrawingCommands needs to ensure that the
commands that draw the text are recorded in a coordinate system that
matches the one that will be used to draw into the mask ImageBuffer
during replaying. (And for complete correctness, an otherwise fresh
GraphicsContext must be used for recording the text drawing commands,
since it's possible other GraphicsContext state could be
introspected.)
So we handle this by setting up a nested display list recorder,
targeting the same DisplayList but with a fresh GraphicsContext with
the right initial CTM, to record the nested drawing commands into.
The refactoring in https://trac.webkit.org/changeset/273291/webkit
dropped some code that set up the CTM for the nested drawing commands,
which is restored here.
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::drawTextUnchecked):
* platform/graphics/displaylists/DisplayListDrawGlyphsRecorder.h:
(WebCore::DisplayList::DrawGlyphsRecorder::drawGlyphsDeconstruction const):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::Recorder):
(WebCore::DisplayList::Recorder::~Recorder):
(WebCore::DisplayList::Recorder::clipToDrawingCommands):
* platform/graphics/displaylists/DisplayListRecorder.h:
2021-05-18 Chris Dumez <cdumez@apple.com>
Use WTF::Locker for locking BaseAudioContext's graph lock
https://bugs.webkit.org/show_bug.cgi?id=225935
Reviewed by Sam Weinig.
Use WTF::Locker for locking BaseAudioContext's graph lock instead of our own AutoLocker.
Also use WTF::RecursiveLock instead of duplicating the recursive locking logic inside
BaseAudioContext. This means we no longer need lock() / tryLock() / unlock() functions
on BaseAudioContext. We now expose the BaseAudioContext's RecursiveLock via a graphLock()
getter and the caller sites can just use a Locker.
* Modules/webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::setBuffer):
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::connect):
(WebCore::AudioNode::disconnect):
(WebCore::AudioNode::setChannelCount):
(WebCore::AudioNode::setChannelCountMode):
(WebCore::AudioNode::setChannelInterpretation):
(WebCore::AudioNode::enableOutputsIfNecessary):
(WebCore::AudioNode::decrementConnectionCount):
(WebCore::AudioNode::deref):
* Modules/webaudio/AudioWorkletNode.cpp:
(WebCore::AudioWorkletNode::create):
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::uninitialize):
(WebCore::BaseAudioContext::refSourceNode):
(WebCore::BaseAudioContext::addDeferredDecrementConnectionCount):
(WebCore::BaseAudioContext::handlePreRenderTasks):
(WebCore::BaseAudioContext::outputPosition):
(WebCore::BaseAudioContext::handlePostRenderTasks):
(WebCore::BaseAudioContext::deleteMarkedNodes):
(WebCore::BaseAudioContext::removeMarkedSummingJunction):
(WebCore::BaseAudioContext::handleDirtyAudioSummingJunctions):
(WebCore::BaseAudioContext::handleDirtyAudioNodeOutputs):
* Modules/webaudio/BaseAudioContext.h:
(WebCore::BaseAudioContext::graphLock):
(WebCore::BaseAudioContext::isGraphOwner const):
* Modules/webaudio/ChannelMergerNode.cpp:
(WebCore::ChannelMergerNode::ChannelMergerNode):
* Modules/webaudio/ConvolverNode.cpp:
(WebCore::ConvolverNode::setBuffer):
* Modules/webaudio/MediaElementAudioSourceNode.cpp:
(WebCore::MediaElementAudioSourceNode::setFormat):
* Modules/webaudio/MediaStreamAudioSourceNode.cpp:
(WebCore::MediaStreamAudioSourceNode::setFormat):
* Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::suspendRendering):
(WebCore::OfflineAudioContext::shouldSuspend):
(WebCore::OfflineAudioContext::didSuspendRendering):
* Modules/webaudio/OfflineAudioContext.h:
* Modules/webaudio/WaveShaperNode.cpp:
(WebCore::WaveShaperNode::setOversample):
2021-05-18 Alan Bujtas <zalan@apple.com>
The containing block for a fixed renderer has to be a type of RenderBlock
https://bugs.webkit.org/show_bug.cgi?id=225924
<rdar://77968716>
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-18 Simon Fraser <simon.fraser@apple.com>
Layer names should not contain object addresses in release builds
https://bugs.webkit.org/show_bug.cgi?id=225926
Reviewed by Geoffrey Garen.
Avoid putting object addresses in layer name strings (which end up on CALayers)
to reduce string bloat.
RenderLayer::name() now calls a description() function on RenderObject, which
in turn calls the same on its Node. These description() functions don't put
object addresses in the string.
Alternatives considered: #ifdeffing in the debugDescription() implementations:
I decided not to because calling a function called debugFoo in release seems
wrong. It might also be useful to dump the string with addresses when debugging
in a release build.
Renaming debugDescription() to description() and passing a behavior enum:
Seems about as complicated as this change.
* dom/Element.cpp:
(WebCore::appendAttributes):
(WebCore::Element::description const):
(WebCore::Element::debugDescription const):
* dom/Element.h:
* dom/Node.cpp:
(WebCore::Node::description const):
* dom/Node.h:
* dom/Text.cpp:
(WebCore::appendTextRepresentation):
(WebCore::Text::description const):
(WebCore::Text::debugDescription const):
* dom/Text.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::name const):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::description const):
* rendering/RenderObject.h:
2021-05-18 Jer Noble <jer.noble@apple.com>
[GPUP] RemoteAudioSession calls into AVAudioSession when GPUP is enabled, causing hangs
https://bugs.webkit.org/show_bug.cgi?id=223564
<rdar://74750291>
Reviewed by Eric Carlson.
Now that AudioSession can have two different implementations at runtime, it should be an
actual virtual class, whose concrete, per-platform implementations are derivations of the
base class. Make AudioSessionIOS and AudioSessionMac true subclasses of AudioSession, and
allow RemoteAudioSession to derive from that same base class (rather than AudioSessionIOS
or AudioSessionMac).
Also ensure AudioSessionIOS or AudioSessionMac is not accidentally created when calling
AudioSession::setSharedSession() by making the NeverDestroyed object holding the session
an Optional, and only lazily creating the session from AudioSession::sharedSession() if
one has not been explicitly set already.
* platform/audio/AudioSession.cpp:
(WebCore::sharedAudioSession):
(WebCore::AudioSession::create):
(WebCore::AudioSession::sharedSession):
(WebCore::AudioSession::addInterruptionObserver):
(WebCore::AudioSession::removeInterruptionObserver):
(WebCore::AudioSession::beginInterruption):
(WebCore::AudioSession::endInterruption):
(WebCore::AudioSession::setIsPlayingToBluetoothOverride):
(WebCore::AudioSession::AudioSession): Deleted.
* platform/audio/AudioSession.h:
* platform/audio/ios/AudioSessionIOS.h: Added.
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSessionIOS::AudioSessionIOS):
(WebCore::AudioSessionIOS::~AudioSessionIOS):
(WebCore::AudioSessionIOS::setCategory):
(WebCore::AudioSessionIOS::category const):
(WebCore::AudioSessionIOS::routeSharingPolicy const):
(WebCore::AudioSessionIOS::routingContextUID const):
(WebCore::AudioSessionIOS::setCategoryOverride):
(WebCore::AudioSessionIOS::categoryOverride const):
(WebCore::AudioSessionIOS::sampleRate const):
(WebCore::AudioSessionIOS::bufferSize const):
(WebCore::AudioSessionIOS::numberOfOutputChannels const):
(WebCore::AudioSessionIOS::maximumNumberOfOutputChannels const):
(WebCore::AudioSessionIOS::tryToSetActiveInternal):
(WebCore::AudioSessionIOS::preferredBufferSize const):
(WebCore::AudioSessionIOS::setPreferredBufferSize):
(WebCore::AudioSessionIOS::isMuted const):
(WebCore::AudioSessionIOS::handleMutedStateChange):
(WebCore::AudioSessionIOS::addInterruptionObserver):
(WebCore::AudioSessionIOS::removeInterruptionObserver):
(WebCore::AudioSessionIOS::beginInterruption):
(WebCore::AudioSessionIOS::endInterruption):
(WebCore::AudioSessionPrivate::AudioSessionPrivate): Deleted.
(WebCore::AudioSessionPrivate::~AudioSessionPrivate): Deleted.
(WebCore::AudioSession::AudioSession): Deleted.
(WebCore::AudioSession::~AudioSession): Deleted.
(WebCore::AudioSession::setCategory): Deleted.
(WebCore::AudioSession::category const): Deleted.
(WebCore::AudioSession::routeSharingPolicy const): Deleted.
(WebCore::AudioSession::routingContextUID const): Deleted.
(WebCore::AudioSession::setCategoryOverride): Deleted.
(WebCore::AudioSession::categoryOverride const): Deleted.
(WebCore::AudioSession::sampleRate const): Deleted.
(WebCore::AudioSession::bufferSize const): Deleted.
(WebCore::AudioSession::numberOfOutputChannels const): Deleted.
(WebCore::AudioSession::maximumNumberOfOutputChannels const): Deleted.
(WebCore::AudioSession::tryToSetActiveInternal): Deleted.
(WebCore::AudioSession::preferredBufferSize const): Deleted.
(WebCore::AudioSession::setPreferredBufferSize): Deleted.
(WebCore::AudioSession::isMuted const): Deleted.
(WebCore::AudioSession::handleMutedStateChange): Deleted.
(WebCore::AudioSession::addInterruptionObserver): Deleted.
(WebCore::AudioSession::removeInterruptionObserver): Deleted.
(WebCore::AudioSession::beginInterruption): Deleted.
(WebCore::AudioSession::endInterruption): Deleted.
* platform/audio/mac/AudioSessionMac.h: Added.
* platform/audio/mac/AudioSessionMac.mm:
(WebCore::AudioSessionMac::addSampleRateObserverIfNeeded const):
(WebCore::AudioSessionMac::handleSampleRateChange):
(WebCore::AudioSessionMac::addBufferSizeObserverIfNeeded const):
(WebCore::AudioSessionMac::handleBufferSizeChange):
(WebCore::AudioSessionMac::audioOutputDeviceChanged):
(WebCore::AudioSessionMac::setIsPlayingToBluetoothOverride):
(WebCore::AudioSessionMac::setCategory):
(WebCore::AudioSessionMac::setCategoryOverride):
(WebCore::AudioSessionMac::sampleRate const):
(WebCore::AudioSessionMac::bufferSize const):
(WebCore::AudioSessionMac::numberOfOutputChannels const):
(WebCore::AudioSessionMac::maximumNumberOfOutputChannels const):
(WebCore::AudioSessionMac::tryToSetActiveInternal):
(WebCore::AudioSessionMac::routeSharingPolicy const):
(WebCore::AudioSessionMac::routingContextUID const):
(WebCore::AudioSessionMac::preferredBufferSize const):
(WebCore::AudioSessionMac::setPreferredBufferSize):
(WebCore::AudioSessionMac::isMuted const):
(WebCore::AudioSessionMac::handleMutedStateChange):
(WebCore::AudioSessionMac::addMutedStateObserver):
(WebCore::AudioSessionMac::removeMutedStateObserver):
(): Deleted.
(WebCore::AudioSessionPrivate::addSampleRateObserverIfNeeded): Deleted.
(WebCore::AudioSessionPrivate::handleSampleRateChange): Deleted.
(WebCore::AudioSessionPrivate::addBufferSizeObserverIfNeeded): Deleted.
(WebCore::AudioSessionPrivate::handleBufferSizeChange): Deleted.
(WebCore::AudioSession::AudioSession): Deleted.
(WebCore::AudioSession::category const): Deleted.
(WebCore::AudioSession::audioOutputDeviceChanged): Deleted.
(WebCore::AudioSession::setIsPlayingToBluetoothOverride): Deleted.
(WebCore::AudioSession::setCategory): Deleted.
(WebCore::AudioSession::categoryOverride const): Deleted.
(WebCore::AudioSession::setCategoryOverride): Deleted.
(WebCore::AudioSession::sampleRate const): Deleted.
(WebCore::AudioSession::bufferSize const): Deleted.
(WebCore::AudioSession::numberOfOutputChannels const): Deleted.
(WebCore::AudioSession::maximumNumberOfOutputChannels const): Deleted.
(WebCore::AudioSession::tryToSetActiveInternal): Deleted.
(WebCore::AudioSession::routeSharingPolicy const): Deleted.
(WebCore::AudioSession::routingContextUID const): Deleted.
(WebCore::AudioSession::preferredBufferSize const): Deleted.
(WebCore::AudioSession::setPreferredBufferSize): Deleted.
(WebCore::AudioSession::isMuted const): Deleted.
(WebCore::AudioSession::handleMutedStateChange): Deleted.
(WebCore::AudioSession::addMutedStateObserver): Deleted.
(WebCore::AudioSession::removeMutedStateObserver): Deleted.
2021-05-18 Chris Dumez <cdumez@apple.com>
Use UTF-8 internally from Strings inside SQLiteStatement
https://bugs.webkit.org/show_bug.cgi?id=225890
Reviewed by Darin Adler.
Use UTF-8 internally from Strings inside SQLiteStatement. Our SQLite databases use UTF-8
internally for text encoding (since we open the database with sqlite3_open_v2() and not
sqlite3_open16()).
Previously, we were providing UTF-16 strings to SQLite, which meant it had to convert it
internally to UTF-8. Also, whenever we were requesting a string from SQLite, it had to
convert it from UTF-8 to UTF-16 before returning it to us. Our String constructed from
returned from SQLiteStatement would also be 16-bit encoded, even if all ASCII so we were
potentially wasting memory too.
We now provide UTF-8 to SQLite by using StringView::utf8(). We also request UTF-8 strings
from SQLite and rely on String::fromUTF8() to convert it to a WTF::String. For all ASCII
characters, this means we'll end up with a 8-bit String and save memory.
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::bindText):
(WebCore::SQLiteStatement::getColumnName):
(WebCore::SQLiteStatement::getColumnText):
* platform/sql/SQLiteStatement.h:
2021-05-18 Said Abou-Hallawa <said@apple.com>
Allow logging minimal info about uploading media files
https://bugs.webkit.org/show_bug.cgi?id=225636
<rdar://problem/76639138>
Reviewed by Alex Christensen.
Files can be uploaded to a server by many different ways: through a form
submit, an xhr, a file fetch or through a worker. r275103 handled the
form submit only. Instead of handling this case by case, we can add the
logging code in a shared place where all the file uploading goes through.
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::submit):
Delete the code which was part of r275103.
* page/Page.cpp:
(WebCore::Page::logMediaDiagnosticMessage const):
* page/Page.h:
Make the Page be responsible for logging the media files info.
* platform/network/FormData.cpp:
(WebCore::FormData::imageOrMediaFilesCount const):
* platform/network/FormData.h:
Make the FormData count how many images or media files it has.
2021-05-18 Keith Miller <keith_miller@apple.com>
Temporarily revert r276592 as it breaks some native apps
https://bugs.webkit.org/show_bug.cgi?id=225917
Unreviewed, revert.
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::doPutPropertySecurityCheck):
(WebCore::JSDOMWindow::put):
* bindings/js/JSLocationCustom.cpp:
(WebCore::JSLocation::doPutPropertySecurityCheck):
* bindings/js/JSRemoteDOMWindowCustom.cpp:
(WebCore::JSRemoteDOMWindow::put):
* bindings/scripts/CodeGeneratorJS.pm:
(GeneratePut):
(GenerateHeader):
* bindings/scripts/test/JS/JSTestDomainSecurity.h:
* bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
(WebCore::JSTestIndexedSetterNoIdentifier::put):
* bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.h:
* bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
(WebCore::JSTestIndexedSetterThrowingException::put):
* bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.h:
* bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
(WebCore::JSTestIndexedSetterWithIdentifier::put):
* bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.h:
* bindings/scripts/test/JS/JSTestInterface.h:
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
(WebCore::JSTestNamedAndIndexedSetterNoIdentifier::put):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.h:
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
(WebCore::JSTestNamedAndIndexedSetterThrowingException::put):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.h:
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
(WebCore::JSTestNamedAndIndexedSetterWithIdentifier::put):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.h:
* bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
(WebCore::JSTestNamedSetterNoIdentifier::put):
* bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.h:
* bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
(WebCore::JSTestNamedSetterThrowingException::put):
* bindings/scripts/test/JS/JSTestNamedSetterThrowingException.h:
* bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
(WebCore::JSTestNamedSetterWithIdentifier::put):
* bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.h:
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
(WebCore::JSTestNamedSetterWithIndexedGetter::put):
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.h:
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
(WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::put):
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.h:
* bindings/scripts/test/JS/JSTestNamedSetterWithLegacyOverrideBuiltIns.cpp:
(WebCore::JSTestNamedSetterWithLegacyOverrideBuiltIns::put):
* bindings/scripts/test/JS/JSTestNamedSetterWithLegacyOverrideBuiltIns.h:
* bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeableProperties.cpp:
(WebCore::JSTestNamedSetterWithLegacyUnforgeableProperties::put):
* bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeableProperties.h:
* bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns.cpp:
(WebCore::JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns::put):
* bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns.h:
* bindings/scripts/test/JS/JSTestPluginInterface.cpp:
(WebCore::JSTestPluginInterface::put):
* bindings/scripts/test/JS/JSTestPluginInterface.h:
* bridge/objc/objc_runtime.h:
* bridge/runtime_array.h:
* bridge/runtime_object.h:
2021-05-18 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com>
[PlayStation] Fix PlayStation port
https://bugs.webkit.org/show_bug.cgi?id=225913
Reviewed by Don Olmstead.
Fix PlayStation port
* PlatformPlayStation.cmake: Rename
PLAYSTATION_COPY_SHARED_LIBRARIES to PLAYSTATION_COPY_REQUIREMENTS.
* accessibility/AccessibilityMenuList.cpp:
(WebCore::AccessibilityMenuList::didUpdateActiveOption):
* platform/graphics/PixelBufferFormat.h: Include wtf/Optional.h.
2021-05-18 Kenneth Russell <kbr@chromium.org>
Clean up code distinguishing between webgl/webgl2 contexts
https://bugs.webkit.org/show_bug.cgi?id=225887
Reviewed by Darin Adler.
Address code review feedback on earlier bug.
Covered by existing WebGL conformance tests.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getContext):
(WebCore::HTMLCanvasElement::getContextWebGL):
2021-05-18 Chris Dumez <cdumez@apple.com>
Make sure SQLiteStatement objects get destroyed before the database is closed
https://bugs.webkit.org/show_bug.cgi?id=225881
Reviewed by Darin Adler.
Make sure SQLiteStatement objects get destroyed before the database is closed. There are 2 issues
with destroying a SQLiteStatement after a database is closed:
1. The underlying call to close the sqlite database will fail if the database still has statements
and we will leak the database.
2. SQLiteStatement has a reference to the database so it cannot outlive the SQLiteDatabase.
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::deleteOrigin):
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::close):
(WebCore::SQLiteDatabase::incrementStatementCount):
(WebCore::SQLiteDatabase::decrementStatementCount):
* platform/sql/SQLiteDatabase.h:
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::SQLiteStatement):
(WebCore::SQLiteStatement::~SQLiteStatement):
2021-05-18 Philippe Normand <pnormand@igalia.com>
[MediaStream][GStreamer] Flaky fast/mediastream/MediaStream-video-element-video-tracks-disabled.html
https://bugs.webkit.org/show_bug.cgi?id=225651
Reviewed by Alicia Boya Garcia.
Push the black frame as soon as the corresponding track has been disabled. The black frame
is also now created once only and reused, instead of re-creating it 30 times per second (or
whatever the frame rate is). The cached frame is updated when the track dimensions change as
well.
* platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
2021-05-18 Alan Bujtas <zalan@apple.com>
Difficult to scroll calcalist.co.il webpage, scrolling gets 'stuck'
https://bugs.webkit.org/show_bug.cgi?id=225905
<rdar://77692680>
Reviewed by Simon Fraser.
The (implicit) integral flooring on the line height may produce short containing block for the inline content.
Test: fast/inline/vertical-top-on-subpixel-makes-inline-box-overflow.html
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::adjustMaxAscentAndDescent):
2021-05-18 Frederic Wang <fwang@igalia.com>
Use RefPtr for local ref counted objects of FrameSelection::setSelectionWithoutUpdatingAppearance
https://bugs.webkit.org/show_bug.cgi?id=225908
Reviewed by Ryosuke Niwa.
A previous patch modified setSelectionWithoutUpdatingAppearance to take into account one
possible DOM mutation after focus change. This is a follow-up patch applying recommendation
from https://lists.webkit.org/pipermail/webkit-dev/2020-September/031386.html event if it is
not obvious whether any of the current uses is dangerous.
No new tests.
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::selectFrameElementInParentIfFullySelected): Use RefPtr for the
following variables:
- parent: used in the non-trivial setFocusedFrame function (where it is however immediately
stored in a RefPtr).
- ownerElement: used in the non-trivial function computeNodeIndex (which however only
performs simple tree navigation).
- ownerElementParent: used as a this of the non-trivial function hasEditableStyle (which
however does not update style when computing editability).
2021-05-18 Ryosuke Niwa <rniwa@webkit.org>
ASSERTION FAILED: isReactionAllowed() in enqueueDisconnectedCallbackIfNeeded during document teardown
https://bugs.webkit.org/show_bug.cgi?id=224033
Reviewed by Maciej Stachowiak.
Moved the bug assertion to after an early exit for when we're in the middle of destorying the document.
enqueueDisconnectedCallbackIfNeeded will be called on custom elements in these circumstances
but there is no correctness issue here since we exit early.
* dom/CustomElementReactionQueue.cpp:
(WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded):
2021-05-18 Frederic Wang <fwang@igalia.com>
SHOULD NEVER BE REACHED in FrameSelection::setSelectionWithoutUpdatingAppearance
https://bugs.webkit.org/show_bug.cgi?id=225219
Reviewed by Ryosuke Niwa.
When FrameSelection::selectFrameElementInParentIfFullySelected sets focus on the parent
frame, that can trigger DOM events, possibly making orphan the newSelection prepared before.
This patch fixes that issue by clearing the selection on that parent frame in such a
situation.
Test: editing/selection/selection-in-iframe-removed-assert.html
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::selectFrameElementInParentIfFullySelected): Check if the
newSelection became orphan and if so, clear it.
2021-05-17 Chris Dumez <cdumez@apple.com>
Drop unused SQLiteStatement::returnsAtLeastOneResult()
https://bugs.webkit.org/show_bug.cgi?id=225901
Reviewed by Darin Adler.
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::returnsAtLeastOneResult): Deleted.
* platform/sql/SQLiteStatement.h:
2021-05-17 Chris Dumez <cdumez@apple.com>
Drop SQLiteStatement::return*Results() functions
https://bugs.webkit.org/show_bug.cgi?id=225899
Reviewed by Alex Christensen.
Drop SQLiteStatement::return*Results() functions. All of them are unused
except for returnTextResults(), which is used only once in SQLiteDatabase.
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::clearAllTables):
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::returnTextResults): Deleted.
(WebCore::SQLiteStatement::returnIntResults): Deleted.
(WebCore::SQLiteStatement::returnInt64Results): Deleted.
(WebCore::SQLiteStatement::returnDoubleResults): Deleted.
* platform/sql/SQLiteStatement.h:
2021-05-17 Sihui Liu <sihui_liu@apple.com>
Remove SQLiteStatement::isColumnNull and its use
https://bugs.webkit.org/show_bug.cgi?id=225892
Reviewed by Chris Dumez.
SQLiteStatement::isColumnNull is only used in SQLiteIDBBackingStore and it is actually not needed, because
SQLiteIDBBackingStore can use getColumnText to evaluate the statement and get the result. So the check is
redundant.
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo):
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::isColumnNull): Deleted.
* platform/sql/SQLiteStatement.h:
2021-05-17 Wenson Hsieh <wenson_hsieh@apple.com>
[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 Fujii Hironori <Hironori.Fujii@sony.com>
[Win] Unreviewed debug build fix for r277601.
https://bugs.webkit.org/show_bug.cgi?id=225855
<rdar://problem/78116715>
* platform/network/curl/CookieJarDB.cpp:
(WebCore::CookieJarDB::executeSQLStatement):
* platform/win/SearchPopupMenuDB.cpp:
(WebCore::SearchPopupMenuDB::executeSQLStatement):
Removed the undefined variables from debug messages.
2021-05-17 Chris Dumez <cdumez@apple.com>
Drop unnecessary SQLiteDatabase::updateLastChangesCount()
https://bugs.webkit.org/show_bug.cgi?id=225885
Reviewed by Alex Christensen.
Drop unnecessary SQLiteDatabase::updateLastChangesCount() and have SQLiteDatabase::lastChanges()
rely on sqlite3_changes() instead of sqlite3_total_changes(). We started using updateLastChangesCount()
+ sqlite3_total_changes() in https://commits.webkit.org/r130891 to address an issue in WebSQL
SQLResultSet.rowsAffected would not be 0 for SELECT statement. This patch reverts r130891 and instead
sets SQLResultSet.rowsAffected when the statement is not a read-only statement.
This is covered by storage/websql/execute-sql-rowsAffected.html which is still passing after
this change.
* Modules/webdatabase/SQLStatement.cpp:
(WebCore::SQLStatement::execute):
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::lastChanges):
(WebCore::SQLiteDatabase::updateLastChangesCount): Deleted.
* platform/sql/SQLiteDatabase.h:
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::step):
(WebCore::SQLiteStatement::isReadOnly):
* platform/sql/SQLiteStatement.h:
2021-05-17 Alex Christensen <achristensen@webkit.org>
Fix Windows debug build.
https://bugs.webkit.org/show_bug.cgi?id=225855
* platform/network/curl/CookieJarDB.cpp:
(WebCore::CookieJarDB::executeSQLStatement):
2021-05-17 Devin Rousso <drousso@apple.com>
[Modern Media Controls] promote submenus items if there is only one
https://bugs.webkit.org/show_bug.cgi?id=225883
Reviewed by Eric Carlson.
As an example, if a `<video>` only has subtitles and not any other languages, the "Subtitles"
submenu should really be top-level (i.e. have "Subtitles" be the title of the entire
contextmenu instead of being a submenu of a title-less contextmenu) in the contextmenu shown
when tapping the tracks button.
Tests: media/modern-media-controls/tracks-support/auto-text-track.html
media/modern-media-controls/tracks-support/click-track-in-contextmenu.html
media/modern-media-controls/tracks-support/hidden-tracks.html
media/modern-media-controls/tracks-support/off-text-track.html
media/modern-media-controls/tracks-support/text-track-selected-via-media-api.html
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::showMediaControlsContextMenu):
2021-05-17 Alberto Garcia <berto@igalia.com>
[GTK] [2.33.1] Fails to build when HAVE_OPENGL_ES_3 is on
https://bugs.webkit.org/show_bug.cgi?id=225867
Reviewed by Adrian Perez de Castro.
Include GLES3/gl3.h if HAVE_OPENGL_ES_3 is set.
* platform/graphics/opengl/ExtensionsGLOpenGLES.h:
2021-05-17 Alex Christensen <achristensen@webkit.org>
Use kAudioObjectPropertyElementMain where available
https://bugs.webkit.org/show_bug.cgi?id=224635
Reviewed by Eric Carlson.
* platform/audio/mac/AudioHardwareListenerMac.cpp:
(WebCore::isAudioHardwareProcessRunning):
(WebCore::currentDeviceSupportedBufferSizes):
(WebCore::processIsRunningPropertyDescriptor):
(WebCore::outputDevicePropertyDescriptor):
* platform/audio/mac/AudioSessionMac.mm:
(WebCore::defaultDevice):
(WebCore::defaultDeviceTransportIsBluetooth):
(WebCore::AudioSessionPrivate::addSampleRateObserverIfNeeded):
(WebCore::AudioSessionPrivate::addBufferSizeObserverIfNeeded):
(WebCore::AudioSession::sampleRate const):
(WebCore::AudioSession::bufferSize const):
(WebCore::AudioSession::maximumNumberOfOutputChannels const):
(WebCore::AudioSession::setPreferredBufferSize):
(WebCore::AudioSession::isMuted const):
(WebCore::AudioSession::addMutedStateObserver):
(WebCore::AudioSession::removeMutedStateObserver):
* platform/mediastream/mac/CoreAudioCaptureDevice.cpp:
(WebCore::getDeviceInfo):
(WebCore::CoreAudioCaptureDevice::CoreAudioCaptureDevice):
(WebCore::CoreAudioCaptureDevice::relatedAudioDeviceIDs):
* platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
(WebCore::deviceHasInputStreams):
(WebCore::deviceHasOutputStreams):
(WebCore::isValidCaptureDevice):
(WebCore::CoreAudioCaptureDeviceManager::coreAudioCaptureDevices):
(WebCore::computeAudioDeviceList):
* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioSharedUnit::defaultOutputDevice):
2021-05-17 Alex Christensen <achristensen@webkit.org>
Null check m_resource in SubresourceLoader::didReceiveResponse
https://bugs.webkit.org/show_bug.cgi?id=225879
Reviewed by Chris Dumez.
Add ASSERT_NOT_REACHED and RELEASE_LOG_FAULT if m_resource is null.
This will help us notice this invalid state in debug builds and diagnose strange loading failures in simulated crash logs.
On further investigation, the crash fixed in r277594 was likely already fixed by something else, but that made it more robust.
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::didReceiveResponse):
2021-05-17 Wenson Hsieh <wenson_hsieh@apple.com>
[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 Chris Dumez <cdumez@apple.com>
Avoid more String creations when preparing SQLite statements
https://bugs.webkit.org/show_bug.cgi?id=225855
Reviewed by Alex Christensen.
Avoid more String creations when preparing SQLite statements by using ASCIILiteral. Also rename the
SQLiteDatabase::prepareStatement() / SQLiteDatabase::executeCommand() overloads that take in a
String to make sure they are not called by mistake.
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::v3RecordsTableSchema):
(WebCore::IDBServer::v3RecordsTableSchemaAlternate):
(WebCore::IDBServer::v3IndexRecordsTableSchema):
(WebCore::IDBServer::v3IndexRecordsTableSchemaAlternate):
(WebCore::IDBServer::blobRecordsTableSchema):
(WebCore::IDBServer::blobRecordsTableSchemaAlternate):
(WebCore::IDBServer::blobFilesTableSchema):
(WebCore::IDBServer::blobFilesTableSchemaAlternate):
(WebCore::IDBServer::createOrMigrateRecordsTableIfNecessary):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidRecordsTable):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsTable):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::createAndPopulateInitialDatabaseInfo):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidObjectStoreInfoTable):
(WebCore::IDBServer::SQLiteIDBBackingStore::migrateIndexInfoTableForIDUpdate):
(WebCore::IDBServer::SQLiteIDBBackingStore::migrateIndexRecordsTableForIDUpdate):
* Modules/indexeddb/server/SQLiteIDBCursor.cpp:
(WebCore::IDBServer::SQLiteIDBCursor::createSQLiteStatement):
(WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindPreIndexStatementIfNecessary):
* Modules/webdatabase/Database.cpp:
(WebCore::setTextValueInDatabase):
(WebCore::retrieveTextResultFromDatabase):
(WebCore::Database::performOpenAndVerify):
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::openTrackerDatabase):
(WebCore::DatabaseTracker::deleteDatabaseFileIfEmpty):
* Modules/webdatabase/SQLStatement.cpp:
(WebCore::SQLStatement::execute):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::executeSQLCommand):
(WebCore::ApplicationCacheStorage::verifySchemaVersion):
(WebCore::ApplicationCacheStorage::openDatabase):
(WebCore::ApplicationCacheStorage::empty):
(WebCore::ApplicationCacheStorage::checkForDeletedResources):
* loader/appcache/ApplicationCacheStorage.h:
* platform/network/curl/CookieJarDB.cpp:
(WebCore::CookieJarDB::verifySchemaVersion):
(WebCore::CookieJarDB::createPrepareStatement):
(WebCore::executeSQLStatement):
(WebCore::CookieJarDB::executeSqlSlow):
(WebCore::CookieJarDB::executeSql):
* platform/network/curl/CookieJarDB.h:
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::setMaximumSize):
(WebCore::SQLiteDatabase::setSynchronous):
(WebCore::SQLiteDatabase::executeCommandSlow):
(WebCore::SQLiteDatabase::tableExists):
(WebCore::SQLiteDatabase::clearAllTables):
(WebCore::SQLiteDatabase::prepareStatementSlow):
(WebCore::SQLiteDatabase::prepareHeapStatementSlow):
* platform/sql/SQLiteDatabase.h:
* platform/sql/SQLiteTransaction.cpp:
(WebCore::SQLiteTransaction::begin):
(WebCore::SQLiteTransaction::commit):
(WebCore::SQLiteTransaction::rollback):
* platform/win/SearchPopupMenuDB.cpp:
(WebCore::SearchPopupMenuDB::verifySchemaVersion):
(WebCore::executeSQLStatement):
(WebCore::SearchPopupMenuDB::executeSimpleSql):
* platform/win/SearchPopupMenuDB.h:
2021-05-17 Frederic Wang <fwang@igalia.com>
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-17 Alex Christensen <achristensen@webkit.org>
Null check m_resource in SubresourceLoader::didReceiveResponse
https://bugs.webkit.org/show_bug.cgi?id=225879
<rdar://78084804>
Reviewed by Chris Dumez.
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::didReceiveResponse):
2021-05-17 Youenn Fablet <youenn@apple.com>
[ BigSur Debug wk2 ARM64 ] imported/w3c/web-platform-tests/webrtc-encoded-transform/sframe-transform-readable.html is flaky crashing
https://bugs.webkit.org/show_bug.cgi?id=225534
<rdar://problem/77679466>
Reviewed by Eric Carlson.
In case the transform is stopped, the pipeTo operation will propagate the error/closure to the ReadableStream.
In that case, we need to stop enqueuing or we end up hitting the assert.
Handle this by adding a boolean which is set to true when SimpleReadableStreamSource::doCancel is called.
Make close and enqueue as no-op if that boolean is true.
Covered by test no longer crashing.
In addition, make sure to skip frames for which the array buffer is null as it might trigger debug asserts in libwebrtc.
Add a test to cover that case.
Test: http/wpt/webrtc/video-script-transform-keyframe-only.html
* Modules/mediastream/RTCRtpScriptTransformer.cpp:
(WebCore::RTCRtpScriptTransformer::writable):
* Modules/streams/ReadableStreamSource.cpp:
(WebCore::SimpleReadableStreamSource::doCancel):
(WebCore::SimpleReadableStreamSource::close):
(WebCore::SimpleReadableStreamSource::enqueue):
* Modules/streams/ReadableStreamSource.h:
2021-05-17 Jer Noble <jer.noble@apple.com>
MediaSession action handlers aren't treated as having a user gesture
https://bugs.webkit.org/show_bug.cgi?id=225875
Reviewed by Eric Carlson.
Test: media/media-session/user-gesture-action-handlers.html
We treat remote control commands as having a user gesture, but not when firing
a MediaSession action handler; we should treat them the same.
* Modules/mediasession/MediaSession.cpp:
(WebCore::MediaSession::callActionHandler):
2021-05-17 Chris Dumez <cdumez@apple.com>
Move more logic from AudioDestinationNode to its subclasses
https://bugs.webkit.org/show_bug.cgi?id=225849
Reviewed by Sam Weinig.
Move more logic from AudioDestinationNode to its subclasses. In particular, AudioDestinationNode
contains a lot of things that are specific to real-time audio rendering and those should go to
DefaultAudioDestinationNode.
This allows us to move isPlayingAudioDidChange() from BaseAudioContext to AudioContext also.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::isPlayingAudioDidChange):
* Modules/webaudio/AudioContext.h:
* Modules/webaudio/AudioDestinationNode.cpp:
(WebCore::AudioDestinationNode::renderQuantum):
* Modules/webaudio/AudioDestinationNode.h:
* Modules/webaudio/BaseAudioContext.cpp:
* Modules/webaudio/BaseAudioContext.h:
* Modules/webaudio/DefaultAudioDestinationNode.cpp:
(WebCore::DefaultAudioDestinationNode::createDestination):
(WebCore::DefaultAudioDestinationNode::framesPerBuffer const):
(WebCore::DefaultAudioDestinationNode::render):
(WebCore::DefaultAudioDestinationNode::setIsSilent):
(WebCore::DefaultAudioDestinationNode::isPlayingDidChange):
(WebCore::DefaultAudioDestinationNode::updateIsEffectivelyPlayingAudio):
* Modules/webaudio/DefaultAudioDestinationNode.h:
* Modules/webaudio/OfflineAudioDestinationNode.cpp:
(WebCore::OfflineAudioDestinationNode::OfflineAudioDestinationNode):
(WebCore::OfflineAudioDestinationNode::startRendering):
(WebCore::OfflineAudioDestinationNode::renderOnAudioThread):
* Modules/webaudio/OfflineAudioDestinationNode.h:
2021-05-17 Peng Liu <peng.liu6@apple.com>
[GPUP] WebContent process should not pull audio session category from the GPU Process
https://bugs.webkit.org/show_bug.cgi?id=225826
Reviewed by Darin Adler.
Change AudioSession::Category to be an enum class.
* platform/audio/AudioSession.cpp:
(WebCore::AudioSession::categoryOverride const):
(WebCore::AudioSession::category const):
* platform/audio/AudioSession.h:
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::updateSessionState):
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSessionPrivate::AudioSessionPrivate):
(WebCore::AudioSession::setCategory):
(WebCore::AudioSession::category const):
* platform/audio/mac/AudioSessionMac.mm:
(WebCore::AudioSession::setCategory):
* platform/audio/mac/SharedRoutingArbitrator.h:
* platform/audio/mac/SharedRoutingArbitrator.mm:
(WebCore::SharedRoutingArbitrator::beginRoutingArbitrationForToken):
* platform/mediastream/mac/BaseAudioSharedUnit.cpp:
(WebCore::BaseAudioSharedUnit::startUnit):
* platform/mock/MockRealtimeAudioSource.cpp:
(WebCore::MockRealtimeAudioSource::startProducingData):
* testing/Internals.cpp:
(WebCore::Internals::audioSessionCategory const):
2021-05-17 Rob Buis <rbuis@igalia.com>
will-change: contain should create a containing block
https://bugs.webkit.org/show_bug.cgi?id=225442
Reviewed by Antti Koivisto.
Make will-change: contain cause the element to be a containing block for both
position: fixed and position: absolute cases as well as create a CSS stacking
context for the element.
Tests: imported/w3c/web-platform-tests/css/css-contain/contain-paint-stacking-context-001b.html
imported/w3c/web-platform-tests/css/css-will-change/will-change-fixpos-cb-contain-1.html
* rendering/style/WillChangeData.cpp:
(WebCore::WillChangeData::createsContainingBlockForOutOfFlowPositioned const):
(WebCore::WillChangeData::propertyCreatesStackingContext):
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueWillChange):
2021-05-17 Tim Nguyen <ntim@apple.com>
will-change: position should not create a containing block for position: fixed elements
https://bugs.webkit.org/show_bug.cgi?id=225443
Reviewed by Antti Koivisto.
This partially undoes r276627 which made will-change: position create a CB for all out-of-flow elements:
- Removed CSSPropertyPosition from createsContainingBlockForOutOfFlowPositioned() to not create a containing block
for position: fixed; children.
- Added createsContainingBlockForAbsolutelyPositioned() with CSSPropertyPosition to still create a containing block
for position: absolute; children.
Enabled WPT (which covers both cases): css/css-will-change/will-change-fixpos-cb-position-1.html
* rendering/RenderElement.h:
(WebCore::RenderElement::canContainAbsolutelyPositionedObjects const):
* rendering/style/WillChangeData.cpp:
(WebCore::WillChangeData::createsContainingBlockForAbsolutelyPositioned const):
(WebCore::WillChangeData::createsContainingBlockForOutOfFlowPositioned const):
* rendering/style/WillChangeData.h:
2021-05-17 Zan Dobersek <zdobersek@igalia.com>
REGRESSION(r277560): conditional attribute typos in IDLs for OffscreenCanvas, OffscreenCanvasRenderingContext2D
https://bugs.webkit.org/show_bug.cgi?id=225858
Unreviewed. Tweaking the for-worker conditional attribute values for the
OffscreenCanvas and OffscreenCanvasRenderingContext2D interfaces after
the r277560 refactoring. The mismatch in the conditional values left the
two interfaces outside any worker global space.
* html/OffscreenCanvas.idl:
* html/canvas/OffscreenCanvasRenderingContext2D.idl:
2021-05-16 Sam Weinig <weinig@apple.com>
Support serializing ImageData object colorSpace property in SerializedScriptValue
https://bugs.webkit.org/show_bug.cgi?id=225854
Reviewed by Chris Dumez.
Test: storage/indexeddb/structured-clone-image-data-display-p3.html
Update SerializedScriptValue schema to version 8 and add serialization
of the colorSpace property.
* bindings/js/SerializedScriptValue.cpp:
(WebCore::PredefinedColorSpaceTag):
Add copy of the PredefinedColorSpace values that are guaranteed to
stay consistent forever.
(WebCore::CloneSerializer::dumpIfTerminal):
Add encoding of the colorSpace when serializing ImageData.
(WebCore::CloneSerializer::write):
(WebCore::CloneDeserializer::read):
Add coders for PredefinedColorSpaceTag.
(WebCore::CloneDeserializer::getJSValue):
Replace multiple overloads with one perfect forwarding overload which does
what we want and works with r-values.
(WebCore::CloneDeserializer::readImageBitmap):
Use auto in two places.
(WebCore::CloneDeserializer::readTerminal):
Add decoding of the colorSpace when deserializing ImageData. For prior versions,
the colorSpace defaults to sRGB, which was the only color space supported.
2021-05-14 Jer Noble <jer.noble@apple.com>
MediaSessionCoordinator survives page reload/navigation
https://bugs.webkit.org/show_bug.cgi?id=225822
Reviewed by Eric Carlson.
Because the MediaSessionCoordinator is created and owned by Page, it will survive
a reload (as Page is not re-created), and the same MediaSessionCoordinator object
will be added to MediaSession when the new Navigator is created.
Rather than have Page own the coordinator itself, it can instead own the
MediaSessionCoordinatorPrivate used to create the coordinator. When the MediaSession
is created, it will query the Page to ask for a MediaSessionCoordinatorPrivate to
use to create the coordinator, guaranteeing a new object is created.
The session itself should be left when the document is put into Back/Forward
Cache, or closed when the document is stopped entirely.
A few drive-by fixes:
The direction of coordinatorStateChanged() is now reversed; it flows down from the
UIProcess to update the state of the MediaSessionCoordinator. This allows the coordinator
to react when it's private implementation changes state.
Add a new upward notification when the trackIdentifier in MediaMetadata changes.
* Modules/mediasession/MediaSession.cpp:
(WebCore::MediaSession::MediaSession):
(WebCore::MediaSession::suspend):
(WebCore::MediaSession::stop):
(WebCore::MediaSession::createCoordinator):
(WebCore::MediaSession::setCoordinator): Deleted.
* Modules/mediasession/MediaSession.h:
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::join):
(WebCore::MediaSessionCoordinator::leave):
(WebCore::MediaSessionCoordinator::close):
(WebCore::MediaSessionCoordinator::metadataChanged):
(WebCore::MediaSessionCoordinator::positionStateChanged):
(WebCore::MediaSessionCoordinator::playbackStateChanged):
(WebCore::MediaSessionCoordinator::readyStateChanged):
(WebCore::MediaSessionCoordinator::seekSessionToTime):
(WebCore::MediaSessionCoordinator::pauseSession):
(WebCore::MediaSessionCoordinator::coordinatorStateChanged):
* Modules/mediasession/MediaSessionCoordinator.h:
* Modules/mediasession/MediaSessionCoordinatorPrivate.h:
(WebCore::MediaSessionCoordinatorClient::coordinatorStateChanged):
* page/Page.cpp:
(WebCore::Page::setMediaSessionCoordinator):
(WebCore::Page::invalidateMediaSessionCoordinator):
* page/Page.h:
(WebCore::Page::mediaSessionCoordinator):
* testing/Internals.cpp:
(WebCore::Internals::registerMockMediaSessionCoordinator):
* testing/Internals.h:
* testing/MockMediaSessionCoordinator.cpp:
(WebCore::MockMediaSessionCoordinator::trackIdentifierChanged):
(WebCore::MockMediaSessionCoordinator::coordinatorStateChanged): Deleted.
* testing/MockMediaSessionCoordinator.h:
2021-05-16 Chris Dumez <cdumez@apple.com>
Modernize / Optimize SQLiteStatement creation and preparation
https://bugs.webkit.org/show_bug.cgi?id=225791
Reviewed by Sam Weinig.
Modernize / Optimize SQLiteStatement creation and preparation:
- The SQLiteStatement constructor is now private so that we never have a
SQLiteStatement that has not been "prepared". Only the SQLiteDatabase
can now construct SQLiteStatement objects. We already needed to pass
a SQLiteDatabase reference when constructing the SQLiteStatement anyway.
- The construct AND prepare a SQLiteStatement, we now call
SQLiteDatabase::prepareStatement() to get a stack object or
SQLiteDatabase::prepareHeapStatement() to get a heap one. These functions
return an Expected<> type so they will either return a "prepared"
SQLiteStatement or an unexpected SQLite error code.
- The prepare*Statement() functions now avoid String allocations in most
cases thanks to overloads taking in the query as an ASCIILiteral.
- Drop finalize() function on SQLiteStatement so SQLiteStatement objects
are always valid. It simplifies the implementation of SQLiteStatement
member functions. The SQLiteStatement destructor "finalizes" the statement
so users can simply destroy the SQLiteStatement if they need the object
to be finalize at a certain point (e.g. before closing a database).
- Drop the prepare() & prepareAndStep() SQLiteStatement member functions now
that SQLiteStatement are always prepared.
- Stop storing the SQL query as a String data member in SQLiteStatement class.
This is no longer needed now that they is no separe prepare step after the
construction. This makes the SQLiteStatement a bit smaller.
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::createOrMigrateRecordsTableIfNecessary):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidBlobTables):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsTable):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsRecordIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::createAndPopulateInitialDatabaseInfo):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidObjectStoreInfoTable):
(WebCore::IDBServer::SQLiteIDBBackingStore::migrateIndexInfoTableForIDUpdate):
(WebCore::IDBServer::SQLiteIDBBackingStore::migrateIndexRecordsTableForIDUpdate):
(WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo):
(WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameAndVersionFromFile):
(WebCore::IDBServer::SQLiteIDBBackingStore::beginTransaction):
(WebCore::IDBServer::SQLiteIDBBackingStore::deleteBackingStore):
(WebCore::IDBServer::SQLiteIDBBackingStore::cachedStatement):
* Modules/indexeddb/server/SQLiteIDBCursor.cpp:
(WebCore::IDBServer::SQLiteIDBCursor::createSQLiteStatement):
(WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindPreIndexStatementIfNecessary):
(WebCore::IDBServer::SQLiteIDBCursor::internalFetchNextRecord):
* Modules/webdatabase/Database.cpp:
(WebCore::setTextValueInDatabase):
(WebCore::retrieveTextResultFromDatabase):
(WebCore::Database::performGetTableNames):
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::hasEntryForOriginNoLock):
(WebCore::DatabaseTracker::hasEntryForDatabase):
(WebCore::DatabaseTracker::fullPathForDatabaseNoLock):
(WebCore::DatabaseTracker::origins):
(WebCore::DatabaseTracker::databaseNamesNoLock):
(WebCore::DatabaseTracker::detailsForNameAndOrigin):
(WebCore::DatabaseTracker::setDatabaseDetails):
(WebCore::DatabaseTracker::quotaNoLock):
(WebCore::DatabaseTracker::setQuota):
(WebCore::DatabaseTracker::addDatabase):
(WebCore::DatabaseTracker::deleteOrigin):
(WebCore::DatabaseTracker::deleteDatabase):
(WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
(WebCore::DatabaseTracker::deleteDatabaseFileIfEmpty):
* Modules/webdatabase/SQLStatement.cpp:
(WebCore::SQLStatement::execute):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::loadCacheGroup):
(WebCore::ApplicationCacheStorage::loadManifestHostHashes):
(WebCore::ApplicationCacheStorage::cacheGroupForURL):
(WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL):
(WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
(WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
(WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
(WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
(WebCore::ApplicationCacheStorage::verifySchemaVersion):
(WebCore::ApplicationCacheStorage::executeStatement):
(WebCore::ApplicationCacheStorage::store):
(WebCore::ApplicationCacheStorage::storeUpdatedType):
(WebCore::ApplicationCacheStorage::ensureOriginRecord):
(WebCore::ApplicationCacheStorage::storeNewestCache):
(WebCore::ApplicationCacheStorage::loadCache):
(WebCore::ApplicationCacheStorage::remove):
(WebCore::ApplicationCacheStorage::manifestURLs):
(WebCore::ApplicationCacheStorage::deleteCacheGroupRecord):
(WebCore::ApplicationCacheStorage::checkForDeletedResources):
(WebCore::ApplicationCacheStorage::flatFileAreaSize):
* platform/network/curl/CookieJarDB.cpp:
(WebCore::CookieJarDB::verifySchemaVersion):
(WebCore::CookieJarDB::checkDatabaseValidity):
(WebCore::CookieJarDB::searchCookies):
(WebCore::CookieJarDB::getAllCookies):
(WebCore::CookieJarDB::allDomains):
(WebCore::CookieJarDB::createPrepareStatement):
(WebCore::CookieJarDB::executeSql):
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::open):
(WebCore::SQLiteDatabase::useWALJournalMode):
(WebCore::SQLiteDatabase::maximumSize):
(WebCore::SQLiteDatabase::setMaximumSize):
(WebCore::SQLiteDatabase::pageSize):
(WebCore::SQLiteDatabase::freeSpaceSize):
(WebCore::SQLiteDatabase::totalSize):
(WebCore::SQLiteDatabase::executeCommand):
(WebCore::SQLiteDatabase::returnsAtLeastOneResult):
(WebCore::SQLiteDatabase::tableExists):
(WebCore::SQLiteDatabase::clearAllTables):
(WebCore::SQLiteDatabase::turnOnIncrementalAutoVacuum):
(WebCore::constructAndPrepareStatement):
(WebCore::SQLiteDatabase::prepareStatement):
(WebCore::SQLiteDatabase::prepareHeapStatement):
* platform/sql/SQLiteDatabase.h:
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::SQLiteStatement):
(WebCore::SQLiteStatement::~SQLiteStatement):
(WebCore::SQLiteStatement::step):
(WebCore::SQLiteStatement::reset):
(WebCore::SQLiteStatement::executeCommand):
(WebCore::SQLiteStatement::returnsAtLeastOneResult):
(WebCore::SQLiteStatement::bindBlob):
(WebCore::SQLiteStatement::bindText):
(WebCore::SQLiteStatement::bindInt):
(WebCore::SQLiteStatement::bindInt64):
(WebCore::SQLiteStatement::bindDouble):
(WebCore::SQLiteStatement::bindNull):
(WebCore::SQLiteStatement::bindParameterCount const):
(WebCore::SQLiteStatement::columnCount):
(WebCore::SQLiteStatement::isColumnNull):
(WebCore::SQLiteStatement::isColumnDeclaredAsBlob):
(WebCore::SQLiteStatement::getColumnName):
(WebCore::SQLiteStatement::getColumnValue):
(WebCore::SQLiteStatement::getColumnText):
(WebCore::SQLiteStatement::getColumnDouble):
(WebCore::SQLiteStatement::getColumnInt):
(WebCore::SQLiteStatement::getColumnInt64):
(WebCore::SQLiteStatement::getColumnBlobAsString):
(WebCore::SQLiteStatement::getColumnBlobAsVector):
(WebCore::SQLiteStatement::returnTextResults):
(WebCore::SQLiteStatement::returnIntResults):
(WebCore::SQLiteStatement::returnInt64Results):
(WebCore::SQLiteStatement::returnDoubleResults):
* platform/sql/SQLiteStatement.h:
* platform/win/SearchPopupMenuDB.cpp:
(WebCore::SearchPopupMenuDB::checkDatabaseValidity):
(WebCore::SearchPopupMenuDB::verifySchemaVersion):
(WebCore::SearchPopupMenuDB::executeSimpleSql):
(WebCore::SearchPopupMenuDB::createPreparedStatement):
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::ensureValidRecordsTable):
(WebCore::RegistrationDatabase::doPushChanges):
(WebCore::RegistrationDatabase::importRecords):
2021-05-16 Alan Bujtas <zalan@apple.com>
[LFC] Cleanup FormattingContext class
https://bugs.webkit.org/show_bug.cgi?id=225744
Reviewed by Antti Koivisto.
This final patch makes the FormattingContext interface uncluttered.
* WebCore.xcodeproj/project.pbxproj:
* layout/FormattingState.h:
(WebCore::Layout::FormattingState::setIntrinsicWidthConstraints):
(WebCore::Layout::FormattingState::intrinsicWidthConstraints const):
(WebCore::Layout::FormattingState::setIntrinsicWidthConstraintsForBox):
(WebCore::Layout::FormattingState::intrinsicWidthConstraintsForBox const):
* layout/LayoutContext.cpp:
(WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
* layout/LayoutUnits.h:
(WebCore::Layout::IntrinsicWidthConstraints::expand):
(WebCore::Layout::IntrinsicWidthConstraints::operator+=):
(WebCore::Layout::IntrinsicWidthConstraints::operator-=):
* layout/formattingContexts/FormattingContext.cpp:
* layout/formattingContexts/FormattingContext.h:
(WebCore::Layout::FormattingContext::root const):
(WebCore::Layout::FormattingContext::formattingState const):
(WebCore::Layout::FormattingContext::isBlockFormattingContext const):
(WebCore::Layout::FormattingContext::isInlineFormattingContext const):
(WebCore::Layout::FormattingContext::isTableFormattingContext const):
(WebCore::Layout::FormattingContext::isTableWrapperBlockFormattingContext const):
(WebCore::Layout::FormattingContext::isFlexFormattingContext const):
(WebCore::Layout::FormattingContext::IntrinsicWidthConstraints::expand): Deleted.
(WebCore::Layout::FormattingContext::IntrinsicWidthConstraints::operator+=): Deleted.
(WebCore::Layout::FormattingContext::IntrinsicWidthConstraints::operator-=): Deleted.
* layout/formattingContexts/FormattingGeometry.cpp:
(WebCore::Layout::FormattingGeometry::computedWidthValue):
(WebCore::Layout::FormattingGeometry::shrinkToFitWidth):
(WebCore::Layout::FormattingGeometry::constrainByMinMaxWidth const):
(WebCore::Layout::FormattingGeometry::constraintsForOutOfFlowContent):
(WebCore::Layout::FormattingGeometry::constraintsForInFlowContent const):
* layout/formattingContexts/FormattingGeometry.h:
* layout/formattingContexts/block/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::computedIntrinsicWidthConstraints):
* layout/formattingContexts/block/BlockFormattingGeometry.cpp:
(WebCore::Layout::BlockFormattingGeometry::intrinsicWidthConstraints):
* layout/formattingContexts/block/BlockFormattingGeometry.h:
* layout/formattingContexts/block/BlockMarginCollapse.cpp:
* layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::computedIntrinsicWidthConstraints):
* layout/formattingContexts/flex/FlexFormattingGeometry.cpp:
(WebCore::Layout::FlexFormattingGeometry::intrinsicWidthConstraints):
* layout/formattingContexts/flex/FlexFormattingGeometry.h:
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints):
(WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns):
* layout/formattingContexts/table/TableFormattingGeometry.cpp:
(WebCore::Layout::TableFormattingGeometry::intrinsicWidthConstraintsForCell):
* layout/formattingContexts/table/TableFormattingGeometry.h:
* layout/formattingContexts/table/TableGrid.h:
(WebCore::Layout::TableGrid::setWidthConstraints):
(WebCore::Layout::TableGrid::widthConstraints const):
(WebCore::Layout::TableGrid::Slot::widthConstraints const):
(WebCore::Layout::TableGrid::Slot::setWidthConstraints):
2021-05-16 Sam Weinig <weinig@apple.com>
Add support for creating/accessing/setting non-sRGB ImageData via canvas
https://bugs.webkit.org/show_bug.cgi?id=225841
Reviewed by Darin Adler.
Test: fast/canvas/canvas-color-space-display-p3-ImageData.html
Add support for accessing non-sRGB (only DisplayP3 for now due
to the specification, but the support is general) pixel data in
HTML canvas.
Updates ImageData constructors and CanvasImageData operations to
take optional ImageDataSettings dictionaries, which contain an
optional color space (otherwise defaulting back to sRGB).
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* html/ImageDataSettings.h: Added.
* html/ImageDataSettings.idl: Added.
Add new ImageDataSettings.idl and related files.
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readImageBitmap):
Fixes FIXME and uses PixelBuffer directly rather than allocating
an unnecessary ImageData. This was done now since the relevent
ImageData constructor has gone away.
* html/ImageData.cpp:
(WebCore::computeDataSize):
(WebCore::ImageData::computeColorSpace):
(WebCore::ImageData::create):
(WebCore::ImageData::createUninitialized):
(WebCore::ImageData::ImageData):
(WebCore::ImageData::pixelBuffer const):
(WebCore::ImageData::dataSize): Deleted.
(WebCore::ImageData::deepClone const): Deleted.
* html/ImageData.h:
(WebCore::ImageData::size const):
(WebCore::ImageData::width const):
(WebCore::ImageData::height const):
(WebCore::ImageData::data const):
(WebCore::ImageData::colorSpace const):
(WebCore::ImageData::pixelBuffer const): Deleted.
- Reworked ImageData to no longer store a PixelBuffer, which has
extraneous information in it, but rather to store just what it
needs IntSize, Ref<JSC::Uint8ClampedArray>, and now PredefinedColorSpace.
- Updates create functions for new optional ImageDataSettings.
- Adds createUninitialized which follows spec language for ImageData creation
and is used by CanvasRenderingContext2D to create ImageData objects of with
the right color spaces, allowing for fallback to the canvas' own color space
when no ImageDataSettings color space is provided. It is uninitialized and
therefore requires the client to initialize the data to allow for support for
no alpha support in the future, which requires a non-zero initialization pattern.
* html/ImageData.idl:
Add optional ImageDataSettings parameters and the new colorSpace attribute.
* html/canvas/CanvasImageData.idl:
Add optional ImageDataSettings parameters.
* html/canvas/CanvasRenderingContext2DBase.h:
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::initializeEmptyImageData):
Add helper to initialize the ImageData buffer. Right now it always calls
zeroFill(), but in the future it will need to do more.
(WebCore::CanvasRenderingContext2DBase::createImageData const):
Update to account for this function being able to throw an exception (when
out of memory) and use the new createUninitialized/initializeEmptyImageData
to create a correctly color spaced ImageData.
(WebCore::CanvasRenderingContext2DBase::createImageData const):
Update for new optional ImageDataSettings and use the new createUninitialized
initializeEmptyImageData to create a correctly color spaced ImageData.
(WebCore::CanvasRenderingContext2DBase::getImageData const):
Moves parameter checks to the begining to match the spec, and uses new
createUninitialized/initializeEmptyImageData to create a correctly color
spaced ImageData. Also, use the ImageData's color space when getting
the pixel buffer to actually return the right data!
* html/canvas/PredefinedColorSpace.cpp:
(WebCore::toPredefinedColorSpace):
* html/canvas/PredefinedColorSpace.h:
Add conversion function from DestinationColorSpace to PredefinedColorSpace.
Since DestinationColorSpace is a superset of PredefinedColorSpace, this can
fail, so this conversion returns an Optional.
* inspector/InspectorCanvas.cpp:
* inspector/InspectorCanvasCallTracer.cpp:
* inspector/InspectorCanvasCallTracer.h:
Stub out inspector support for ImageDataSettings.
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::getPixelBuffer const):
Use the ImageBuffer's actual color space as the source color space
rather than hard coding sRGB. This allows the color space conversion
to take place. Also remove some unnecessary temporary variables.
(WebCore::ImageBufferBackend::putPixelBuffer):
Use the ImageBuffer's actual color space as the destination color space
rather than hard coding sRGB. This allows the color space conversion
to take place. Also remove some unnecessary temporary variables.
* platform/graphics/PixelBuffer.cpp:
(WebCore::PixelBuffer::tryCreate):
(WebCore::PixelBuffer::PixelBuffer):
* platform/graphics/PixelBuffer.h:
(WebCore::PixelBuffer::takeData):
Add a few helpers to allow creationg to/from PixelBuffer
a bit easier.
* platform/graphics/PixelBufferConversion.cpp:
(WebCore::convertImagePixelsAccelerated):
Fix incorrect assertion. We want to assert that there is no error, not that
there is one.
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::convertImageBufferToColorSpace):
(WebCore::FilterEffect::copyUnmultipliedResult):
(WebCore::FilterEffect::copyPremultipliedResult):
(WebCore::FilterEffect::createUnmultipliedImageResult):
(WebCore::FilterEffect::createPremultipliedImageResult):
Stop hard coding SRGB for PixelBuffer color spaces and use the appropriate
color space for the task. We still do color space conversion through ImageBuffer
so we should come back and simplify code here to not always require that.
* testing/Internals.cpp:
(WebCore::Internals::videoSampleAvailable):
(WebCore::Internals::loadArtworkImage):
Update to specify a color space to maintain existing behavior.
2021-05-16 Alan Bujtas <zalan@apple.com>
[LFC] Cleanup margin collapsing class
https://bugs.webkit.org/show_bug.cgi?id=225745
Reviewed by Antti Koivisto.
BlockMarginCollapse needs LayoutState and BlockFormattingState only.
* layout/MarginTypes.h:
* layout/formattingContexts/FormattingGeometry.cpp:
(WebCore::Layout::FormattingGeometry::constraintsForInFlowContent const):
(WebCore::Layout::FormattingGeometry::constraintsForInFlowContent): Deleted.
* layout/formattingContexts/FormattingGeometry.h:
* layout/formattingContexts/block/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForBoxAndAncestors):
(WebCore::Layout::BlockFormattingContext::geometry const):
(WebCore::Layout::BlockFormattingContext::marginCollapse const):
* layout/formattingContexts/block/BlockFormattingGeometry.cpp:
(WebCore::Layout::BlockFormattingGeometry::inFlowNonReplacedContentHeightAndMargin):
* layout/formattingContexts/block/BlockFormattingQuirks.cpp:
(WebCore::Layout::BlockFormattingQuirks::stretchedInFlowHeightIfApplicable const):
* layout/formattingContexts/block/BlockFormattingQuirks.h:
* layout/formattingContexts/block/BlockMarginCollapse.cpp:
(WebCore::Layout::BlockMarginCollapse::BlockMarginCollapse):
(WebCore::Layout::BlockMarginCollapse::hasClearance const):
(WebCore::Layout::BlockMarginCollapse::marginBeforeCollapsesWithParentMarginBefore const):
(WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithParentMarginAfter const):
(WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter const):
(WebCore::Layout::BlockMarginCollapse::positiveNegativeValues const):
(WebCore::Layout::BlockMarginCollapse::positiveNegativeMarginBefore const):
* layout/formattingContexts/block/BlockMarginCollapse.h:
(WebCore::Layout::BlockMarginCollapse::inQuirksMode const):
(WebCore::Layout::BlockMarginCollapse::layoutState const):
(WebCore::Layout::BlockMarginCollapse::formattingState const):
(WebCore::Layout::BlockMarginCollapse::layoutState): Deleted.
(WebCore::Layout::BlockMarginCollapse::formattingContext const): Deleted.
* layout/formattingContexts/block/PrecomputedBlockMarginCollapse.cpp:
(WebCore::Layout::BlockMarginCollapse::precomputedPositiveNegativeValues const):
(WebCore::Layout::BlockMarginCollapse::precomputedPositiveNegativeMarginBefore const):
(WebCore::Layout::BlockMarginCollapse::precomputedMarginBefore):
2021-05-16 Alan Bujtas <zalan@apple.com>
[LFC] Cleanup FormattingQuirk classes
https://bugs.webkit.org/show_bug.cgi?id=225746
Reviewed by Antti Koivisto.
Quirk functions should only be called when not in standards mode.
* layout/formattingContexts/FormattingQuirks.cpp:
(WebCore::Layout::FormattingQuirks::heightValueOfNearestContainingBlockWithFixedHeight const):
(WebCore::Layout::FormattingQuirks::heightValueOfNearestContainingBlockWithFixedHeight): Deleted.
* layout/formattingContexts/FormattingQuirks.h:
(WebCore::Layout::FormattingQuirks::layoutState const):
(WebCore::Layout::FormattingQuirks::layoutState): Deleted.
* layout/formattingContexts/block/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::quirks const): Deleted.
* layout/formattingContexts/block/BlockFormattingContext.h:
* layout/formattingContexts/block/BlockFormattingGeometry.cpp:
(WebCore::Layout::BlockFormattingGeometry::inFlowContentHeightAndMargin):
* layout/formattingContexts/block/BlockFormattingQuirks.cpp:
(WebCore::Layout::BlockFormattingQuirks::BlockFormattingQuirks):
(WebCore::Layout::needsStretching):
(WebCore::Layout::BlockFormattingQuirks::stretchedInFlowHeightIfApplicable const):
(WebCore::Layout::BlockFormattingQuirks::shouldIgnoreCollapsedQuirkMargin):
(WebCore::Layout::BlockFormattingQuirks::shouldCollapseMarginBeforeWithParentMarginBefore):
(WebCore::Layout::BlockFormattingQuirks::shouldCollapseMarginAfterWithParentMarginAfter):
(WebCore::Layout::BlockFormattingQuirks::needsStretching const): Deleted.
(WebCore::Layout::BlockFormattingQuirks::stretchedInFlowHeight): Deleted.
(WebCore::Layout::BlockFormattingQuirks::shouldIgnoreCollapsedQuirkMargin const): Deleted.
(WebCore::Layout::BlockFormattingQuirks::shouldCollapseMarginBeforeWithParentMarginBefore const): Deleted.
(WebCore::Layout::BlockFormattingQuirks::shouldCollapseMarginAfterWithParentMarginAfter const): Deleted.
* layout/formattingContexts/block/BlockFormattingQuirks.h:
(WebCore::Layout::BlockFormattingQuirks::formattingContext const): Deleted.
* layout/formattingContexts/block/BlockMarginCollapse.cpp:
(WebCore::Layout::BlockMarginCollapse::marginBeforeCollapsesWithParentMarginBefore const):
(WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithParentMarginAfter const):
(WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter const):
(WebCore::Layout::BlockMarginCollapse::positiveNegativeMarginBefore const):
(WebCore::Layout::BlockMarginCollapse::quirks const): Deleted.
* layout/formattingContexts/block/BlockMarginCollapse.h:
* layout/formattingContexts/block/PrecomputedBlockMarginCollapse.cpp:
(WebCore::Layout::BlockMarginCollapse::precomputedPositiveNegativeMarginBefore const):
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp:
(WebCore::Layout::TableWrapperBlockFormattingContext::computeHeightAndMarginForTableBox):
(WebCore::Layout::TableWrapperBlockFormattingContext::quirks const): Deleted.
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.h:
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingQuirks.cpp:
(WebCore::Layout::TableWrapperQuirks::TableWrapperQuirks):
(WebCore::Layout::TableWrapperQuirks::overriddenTableHeight const):
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingQuirks.h:
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::lineLayout):
(WebCore::Layout::InlineFormattingContext::quirks const): Deleted.
* layout/formattingContexts/inline/InlineFormattingContext.h:
* layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::InlineFormattingGeometry::inlineLevelBoxAffectsLineBox const):
* layout/formattingContexts/inline/InlineFormattingGeometry.h:
* layout/formattingContexts/inline/InlineFormattingQuirks.cpp:
(WebCore::Layout::InlineFormattingQuirks::initialLineHeight const):
(WebCore::Layout::InlineFormattingQuirks::inlineLevelBoxAffectsLineBox const):
* layout/formattingContexts/inline/InlineFormattingQuirks.h:
(WebCore::Layout::InlineFormattingQuirks::formattingContext const): Deleted.
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::quirks const): Deleted.
* layout/formattingContexts/table/TableFormattingContext.h:
* layout/formattingContexts/table/TableFormattingGeometry.cpp:
(WebCore::Layout::TableFormattingGeometry::cellHeigh const):
* layout/formattingContexts/table/TableFormattingQuirks.cpp:
(WebCore::Layout::TableFormattingQuirks::TableFormattingQuirks):
(WebCore::Layout::TableFormattingQuirks::shouldIgnoreChildContentVerticalMargin):
(WebCore::Layout::TableFormattingQuirks::shouldIgnoreChildContentVerticalMargin const): Deleted.
* layout/formattingContexts/table/TableFormattingQuirks.h:
(WebCore::Layout::TableFormattingQuirks::formattingContext const): Deleted.
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayNonRootInlineBoxes const):
2021-05-16 Tim Nguyen <ntim@apple.com>
Make will-change: transform-style create a containing block
https://bugs.webkit.org/show_bug.cgi?id=225441
Reviewed by Simon Fraser.
Marked relevant WPT as pass.
* rendering/style/WillChangeData.cpp:
(WebCore::WillChangeData::createsContainingBlockForOutOfFlowPositioned const):
2021-05-15 Ryosuke Niwa <rniwa@webkit.org>
Delete WebSQL code from WebKit2
https://bugs.webkit.org/show_bug.cgi?id=225739
Reviewed by Sihui Liu.
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setWebSQLEnabled): Replaced setWebSQLDisabled.
2021-05-15 Alan Bujtas <zalan@apple.com>
[LFC] Make redundant public helpers private in FormattingContext
https://bugs.webkit.org/show_bug.cgi?id=225747
Reviewed by Antti Koivisto.
* layout/formattingContexts/FormattingContext.h:
* layout/formattingContexts/FormattingGeometry.cpp:
(WebCore::Layout::FormattingGeometry::computedHeightValue const):
* layout/formattingContexts/FormattingQuirks.cpp:
(WebCore::Layout::FormattingQuirks::heightValueOfNearestContainingBlockWithFixedHeight):
2021-05-15 Alan Bujtas <zalan@apple.com>
[LFC] Make redundant public helpers private in TableFormattingContext
https://bugs.webkit.org/show_bug.cgi?id=225748
Reviewed by Antti Koivisto.
* layout/formattingContexts/table/TableFormattingContext.h:
* layout/formattingContexts/table/TableFormattingGeometry.cpp:
(WebCore::Layout::TableFormattingGeometry::cellHeigh const):
* layout/formattingContexts/table/TableFormattingQuirks.h:
(WebCore::Layout::TableFormattingQuirks::formattingContext const):
(WebCore::Layout::TableFormattingQuirks::geometry const): Deleted.
2021-05-15 Sam Weinig <weinig@apple.com>
Allow conditionally enabling OffscreenCanvas only for non-worker contexts
https://bugs.webkit.org/show_bug.cgi?id=225845
Reviewed by Darin Adler.
Enable both compile time and runtime conditional enablement of just the
non-worker OffscreenCanvas code path.
To make this work a new IDL extended attribute was needed, ConditionalForWorker=FOO,
which allows specifying an additional macro to check for whether the constructor
should be exposed on workers. Ideally this would be generic for any context type,
but at the moment, the limited syntax of extended attributes makes that hard. If
generalization is needed (or a similar syntax is needed for something else) this can
be revisited.
To support runtime conditional exposure, the existing EnabledForContext, which calls
a static function on the implementation class passing the ScriptExecutationContext
is used. If conditional per context type ever becomes a common thing, we should add
another extended attribute (and add syntax to support like above) that allows specifying
both the context type and the setting name.
Other than that, uses of ENABLE_OFFSCREEN_CANVAS that guarded worker specific functionality
were replaced by ENABLE_OFFSCREEN_CANVAS_IN_WORKERS.
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::serialize):
(WebCore::CloneSerializer::CloneSerializer):
(WebCore::CloneSerializer::dumpIfTerminal):
(WebCore::CloneDeserializer::deserialize):
(WebCore::CloneDeserializer::CloneDeserializer):
(WebCore::CloneDeserializer::readTerminal):
(WebCore::SerializedScriptValue::SerializedScriptValue):
(WebCore::SerializedScriptValue::computeMemoryCost const):
(WebCore::SerializedScriptValue::create):
(WebCore::SerializedScriptValue::deserialize):
* bindings/js/SerializedScriptValue.h:
(WebCore::SerializedScriptValue::SerializedScriptValue):
* bindings/scripts/IDLAttributes.json:
* bindings/scripts/preprocess-idls.pl:
(GenerateConstructorAttributes):
* html/HTMLCanvasElement.idl:
* html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::enabledForContext):
* html/OffscreenCanvas.h:
* html/OffscreenCanvas.idl:
* html/canvas/OffscreenCanvasRenderingContext2D.cpp:
(WebCore::OffscreenCanvasRenderingContext2D::enabledForContext):
* html/canvas/OffscreenCanvasRenderingContext2D.h:
* html/canvas/OffscreenCanvasRenderingContext2D.idl:
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setOffscreenCanvasInWorkersEnabled):
(WebCore::RuntimeEnabledFeatures::offscreenCanvasInWorkersEnabled const):
* workers/DedicatedWorkerGlobalScope.h:
* workers/DedicatedWorkerGlobalScope.idl:
* workers/WorkerAnimationController.cpp:
* workers/WorkerAnimationController.h:
2021-05-15 Alan Bujtas <zalan@apple.com>
[LFC] Make redundant public helpers private in InlineFormattingContext
https://bugs.webkit.org/show_bug.cgi?id=225749
Reviewed by Antti Koivisto.
* layout/formattingContexts/inline/InlineFormattingContext.h:
* layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::LineBoxBuilder::computeLineBoxHeightAndAlignInlineLevelBoxesVertically):
* layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::isAtSoftWrapOpportunity):
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayNonRootInlineBoxes const):
2021-05-15 Alan Bujtas <zalan@apple.com>
[LFC] Make redundant public helpers private in BlockFormattingContext
https://bugs.webkit.org/show_bug.cgi?id=225750
Reviewed by Antti Koivisto.
* layout/formattingContexts/block/BlockFormattingContext.h:
* layout/formattingContexts/block/BlockFormattingGeometry.cpp:
(WebCore::Layout::BlockFormattingGeometry::inFlowNonReplacedContentHeightAndMargin):
(WebCore::Layout::BlockFormattingGeometry::inFlowContentHeightAndMargin):
* layout/formattingContexts/block/BlockFormattingQuirks.cpp:
(WebCore::Layout::BlockFormattingQuirks::stretchedInFlowHeight):
* layout/formattingContexts/block/BlockMarginCollapse.cpp:
(WebCore::Layout::BlockMarginCollapse::quirks const):
(WebCore::Layout::BlockMarginCollapse::marginBeforeCollapsesWithParentMarginBefore const):
(WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithParentMarginAfter const):
(WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter const):
(WebCore::Layout::BlockMarginCollapse::positiveNegativeMarginBefore const):
* layout/formattingContexts/block/BlockMarginCollapse.h:
* layout/formattingContexts/block/PrecomputedBlockMarginCollapse.cpp:
(WebCore::Layout::BlockMarginCollapse::precomputedPositiveNegativeValues const):
(WebCore::Layout::BlockMarginCollapse::precomputedPositiveNegativeMarginBefore const):
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingQuirks.cpp:
(WebCore::Layout::TableWrapperQuirks::overriddenTableHeight const):
2021-05-15 Alan Bujtas <zalan@apple.com>
[LFC] Make FormattingGeometry c'tors public
https://bugs.webkit.org/show_bug.cgi?id=225751
Reviewed by Antti Koivisto.
Remove unnecessary class friending.
* layout/formattingContexts/FormattingGeometry.h:
* layout/formattingContexts/block/BlockFormattingGeometry.h:
* layout/formattingContexts/inline/InlineFormattingGeometry.h:
* layout/formattingContexts/inline/InlineFormattingQuirks.h:
* layout/formattingContexts/table/TableFormattingGeometry.h:
2021-05-15 Alan Bujtas <zalan@apple.com>
[LFC] Move base formatting geometry to its own class
https://bugs.webkit.org/show_bug.cgi?id=225752
Reviewed by Antti Koivisto.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/formattingContexts/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::geometry const):
* layout/formattingContexts/FormattingContext.h:
(WebCore::Layout::FormattingContext::Geometry::layoutState const): Deleted.
(WebCore::Layout::FormattingContext::Geometry::layoutState): Deleted.
(WebCore::Layout::FormattingContext::Geometry::formattingContext const): Deleted.
(WebCore::Layout::FormattingContext::geometry const): Deleted.
(WebCore::Layout::FormattingContext::Geometry::Geometry): Deleted.
* layout/formattingContexts/FormattingContextGeometry.cpp: Removed.
* layout/formattingContexts/block/BlockFormattingGeometry.cpp:
(WebCore::Layout::BlockFormattingGeometry::BlockFormattingGeometry):
(WebCore::Layout::BlockFormattingGeometry::inFlowNonReplacedContentHeightAndMargin):
(WebCore::Layout::BlockFormattingGeometry::inFlowNonReplacedContentWidthAndMargin):
* layout/formattingContexts/block/BlockFormattingGeometry.h:
(WebCore::Layout::BlockFormattingGeometry::formattingContext const):
* layout/formattingContexts/flex/FlexFormattingGeometry.cpp:
(WebCore::Layout::FlexFormattingGeometry::FlexFormattingGeometry):
* layout/formattingContexts/flex/FlexFormattingGeometry.h:
(WebCore::Layout::FlexFormattingGeometry::formattingContext const):
* layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::InlineFormattingGeometry::InlineFormattingGeometry):
(WebCore::Layout::InlineFormattingGeometry::inlineBlockContentWidthAndMargin):
* layout/formattingContexts/inline/InlineFormattingGeometry.h:
(WebCore::Layout::InlineFormattingGeometry::formattingContext const):
* layout/formattingContexts/table/TableFormattingGeometry.cpp:
(WebCore::Layout::TableFormattingGeometry::TableFormattingGeometry):
* layout/formattingContexts/table/TableFormattingGeometry.h:
(WebCore::Layout::TableFormattingGeometry::formattingContext const):
* layout/formattingContexts/table/TableFormattingQuirks.h:
(WebCore::Layout::TableFormattingQuirks::geometry const):
2021-05-15 Alan Bujtas <zalan@apple.com>
[LFC] Move table formatting geometry to its own class
https://bugs.webkit.org/show_bug.cgi?id=225753
Reviewed by Antti Koivisto.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::geometry const):
* layout/formattingContexts/table/TableFormattingContext.h:
(WebCore::Layout::TableFormattingContext::Geometry::Geometry): Deleted.
* layout/formattingContexts/table/TableFormattingContextGeometry.cpp: Removed.
2021-05-15 Chris Dumez <cdumez@apple.com>
Clean up BaseAudioContext now that legacy/prefixed WebAudio is gone
https://bugs.webkit.org/show_bug.cgi?id=225843
Reviewed by Darin Adler.
The BaseAudioContext class hierarchy used to be a bit complicated when
we supposed legacy WebAudio because OfflineAudioContext would subclass
BaseAudioContext directly, while WebKitOfflineAudioContext would
subclass BaseAudioContext via AudioContext. The class hierarchy is now
a lot simpler, BaseAudioContext is the base class and it has exactly
2 subclasses: OfflineAudioContext and AudioContext (for real-time
rendering). Now that the legacy WebAudio code is gone, this patch
cleans up BaseAudioContext and moves as much code as possible to its
subclasses (OfflineAudioContext & AudioContext).
* Modules/webaudio/AudioBuffer.cpp:
(WebCore::AudioBuffer::create):
* Modules/webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::setBuffer):
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::create):
(WebCore::AudioContext::AudioContext):
(WebCore::AudioContext::uninitialize):
(WebCore::AudioContext::lazyInitialize):
(WebCore::AudioContext::activeDOMObjectName const):
* Modules/webaudio/AudioContext.h:
(isType):
* Modules/webaudio/AudioContextState.h:
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::setChannelCount):
* Modules/webaudio/AudioNodeOutput.cpp:
(WebCore::AudioNodeOutput::AudioNodeOutput):
(WebCore::AudioNodeOutput::setNumberOfChannels):
* Modules/webaudio/AudioWorkletNode.cpp:
(WebCore::AudioWorkletNode::create):
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::generateContextID):
(WebCore::BaseAudioContext::BaseAudioContext):
(WebCore::BaseAudioContext::lazyInitialize):
(WebCore::BaseAudioContext::uninitialize):
(WebCore::BaseAudioContext::stop):
(WebCore::BaseAudioContext::createScriptProcessor):
(WebCore::BaseAudioContext::derefFinishedSourceNodes):
(WebCore::BaseAudioContext::lockInternal):
(WebCore::BaseAudioContext::tryLock):
(WebCore::BaseAudioContext::unlock):
(WebCore::BaseAudioContext::handlePostRenderTasks):
(WebCore::BaseAudioContext::deleteMarkedNodes):
(WebCore::BaseAudioContext::updateAutomaticPullNodes):
(WebCore::BaseAudioContext::postTask):
(WebCore::BaseAudioContext::workletIsReady):
* Modules/webaudio/BaseAudioContext.h:
(WebCore::BaseAudioContext::isInitialized const):
(WebCore::BaseAudioContext::currentSampleFrame const):
(WebCore::BaseAudioContext::currentTime const):
(WebCore::BaseAudioContext::sampleRate const):
(WebCore::BaseAudioContext::listener):
(WebCore::BaseAudioContext::incrementConnectionCount):
(WebCore::BaseAudioContext::isAudioThread const):
(WebCore::BaseAudioContext::isAudioThreadFinished const):
(WebCore::BaseAudioContext::isGraphOwner const):
* Modules/webaudio/ChannelMergerNode.cpp:
(WebCore::ChannelMergerNode::create):
* Modules/webaudio/ChannelSplitterNode.cpp:
(WebCore::ChannelSplitterNode::create):
* Modules/webaudio/DefaultAudioDestinationNode.cpp:
(WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode):
(WebCore::DefaultAudioDestinationNode::context):
(WebCore::DefaultAudioDestinationNode::context const):
* Modules/webaudio/DefaultAudioDestinationNode.h:
* Modules/webaudio/MediaElementAudioSourceNode.cpp:
(WebCore::MediaElementAudioSourceNode::setFormat):
* Modules/webaudio/MediaStreamAudioSourceNode.cpp:
(WebCore::MediaStreamAudioSourceNode::setFormat):
* Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::OfflineAudioContext):
(WebCore::OfflineAudioContext::create):
(WebCore::OfflineAudioContext::uninitialize):
(WebCore::OfflineAudioContext::activeDOMObjectName const):
(WebCore::OfflineAudioContext::startRendering):
(WebCore::OfflineAudioContext::suspendRendering):
(WebCore::OfflineAudioContext::resumeRendering):
(WebCore::OfflineAudioContext::didSuspendRendering):
(WebCore::OfflineAudioContext::finishedRendering):
(WebCore::OfflineAudioContext::settleRenderingPromise):
(WebCore::OfflineAudioContext::dispatchEvent):
* Modules/webaudio/OfflineAudioContext.h:
(isType):
* Modules/webaudio/OfflineAudioContext.idl:
* Modules/webaudio/OfflineAudioDestinationNode.cpp:
(WebCore::OfflineAudioDestinationNode::OfflineAudioDestinationNode):
(WebCore::OfflineAudioDestinationNode::context):
(WebCore::OfflineAudioDestinationNode::context const):
* Modules/webaudio/OfflineAudioDestinationNode.h:
* Modules/webaudio/ScriptProcessorNode.cpp:
(WebCore::ScriptProcessorNode::ScriptProcessorNode):
2021-05-15 Alan Bujtas <zalan@apple.com>
[LFC] Move inline formatting geometry to its own class
https://bugs.webkit.org/show_bug.cgi?id=225754
Reviewed by Antti Koivisto.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::geometry const):
* layout/formattingContexts/inline/InlineFormattingContext.h:
(WebCore::Layout::InlineFormattingContext::Geometry::Geometry): Deleted.
* layout/formattingContexts/inline/InlineFormattingContextGeometry.cpp: Removed.
2021-05-15 Alan Bujtas <zalan@apple.com>
[LFC] Move flex formatting geometry to its own class
https://bugs.webkit.org/show_bug.cgi?id=225755
Reviewed by Antti Koivisto.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::geometry const):
* layout/formattingContexts/flex/FlexFormattingContext.h:
(WebCore::Layout::FlexFormattingContext::Geometry::Geometry): Deleted.
* layout/formattingContexts/flex/FlexFormattingContextGeometry.cpp: Removed.
2021-05-15 Alan Bujtas <zalan@apple.com>
[LFC] Move block formatting geometry to its own class
https://bugs.webkit.org/show_bug.cgi?id=225756
Reviewed by Antti Koivisto.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/formattingContexts/block/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::geometry const):
* layout/formattingContexts/block/BlockFormattingContext.h:
(WebCore::Layout::BlockFormattingContext::Geometry::formattingContext const): Deleted.
(WebCore::Layout::BlockFormattingContext::geometry const): Deleted.
(WebCore::Layout::BlockFormattingContext::Geometry::Geometry): Deleted.
* layout/formattingContexts/block/BlockFormattingContextGeometry.cpp: Removed.
* layout/formattingContexts/block/BlockFormattingQuirks.cpp:
(WebCore::Layout::BlockFormattingQuirks::stretchedInFlowHeight):
* layout/formattingContexts/block/BlockFormattingQuirks.h:
(WebCore::Layout::BlockFormattingQuirks::formattingContext const):
(WebCore::Layout::BlockFormattingQuirks::geometry const): Deleted.
* layout/formattingContexts/block/PrecomputedBlockMarginCollapse.cpp:
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp:
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingQuirks.cpp:
(WebCore::Layout::TableWrapperQuirks::overriddenTableHeight const):
2021-05-15 Alan Bujtas <zalan@apple.com>
[LFC] Move base formatting quirks to its own class
https://bugs.webkit.org/show_bug.cgi?id=225757
Reviewed by Antti Koivisto.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/formattingContexts/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::quirks const):
* layout/formattingContexts/FormattingContext.h:
(WebCore::Layout::FormattingContext::formattingState):
(WebCore::Layout::FormattingContext::Quirks::layoutState const): Deleted.
(WebCore::Layout::FormattingContext::Quirks::layoutState): Deleted.
(WebCore::Layout::FormattingContext::Quirks::formattingContext const): Deleted.
(WebCore::Layout::FormattingContext::quirks const): Deleted.
(WebCore::Layout::FormattingContext::Quirks::Quirks): Deleted.
* layout/formattingContexts/FormattingContextQuirks.cpp: Removed.
* layout/formattingContexts/block/BlockFormattingQuirks.cpp:
(WebCore::Layout::BlockFormattingQuirks::BlockFormattingQuirks):
* layout/formattingContexts/block/BlockFormattingQuirks.h:
(WebCore::Layout::BlockFormattingQuirks::formattingContext const):
* layout/formattingContexts/inline/InlineFormattingQuirks.cpp:
(WebCore::Layout::InlineFormattingQuirks::InlineFormattingQuirks):
* layout/formattingContexts/inline/InlineFormattingQuirks.h:
(WebCore::Layout::InlineFormattingQuirks::formattingContext const):
* layout/formattingContexts/table/TableFormattingQuirks.cpp:
(WebCore::Layout::TableFormattingQuirks::TableFormattingQuirks):
* layout/formattingContexts/table/TableFormattingQuirks.h:
(WebCore::Layout::TableFormattingQuirks::formattingContext const):
2021-05-15 Said Abou-Hallawa <said@apple.com>
Implement CanvasRenderingContext2D.createConicGradient
https://bugs.webkit.org/show_bug.cgi?id=225539
Reviewed by Sam Weinig.
Proposal document:
https://github.com/fserb/canvas2D/blob/master/spec/conic-gradient.md
MDN documentation:
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createConicGradient
Tests: fast/canvas/canvas-conic-gradient-angle.html
fast/canvas/canvas-conic-gradient-center.html
fast/canvas/conicGradient-infinite-values.html
* html/canvas/CanvasFillStrokeStyles.idl:
* html/canvas/CanvasGradient.cpp:
(WebCore::CanvasGradient::CanvasGradient):
(WebCore::m_canvas):
(WebCore::CanvasGradient::create):
* html/canvas/CanvasGradient.h:
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::createConicGradient):
* html/canvas/CanvasRenderingContext2DBase.h:
2021-05-15 Alan Bujtas <zalan@apple.com>
[LFC] Move table formatting quirks to its own class
https://bugs.webkit.org/show_bug.cgi?id=225758
Reviewed by Antti Koivisto.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::quirks const):
* layout/formattingContexts/table/TableFormattingContext.h:
(WebCore::Layout::TableFormattingContext::Quirks::Quirks): Deleted.
* layout/formattingContexts/table/TableFormattingContextQuirks.cpp: Removed.
2021-05-15 Alan Bujtas <zalan@apple.com>
[LFC] Move inline formatting quirks to its own class
https://bugs.webkit.org/show_bug.cgi?id=225759
Reviewed by Antti Koivisto.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::quirks const):
* layout/formattingContexts/inline/InlineFormattingContext.h:
(WebCore::Layout::InlineFormattingContext::Quirks::Quirks): Deleted.
* layout/formattingContexts/inline/InlineFormattingContextQuirks.cpp: Removed.
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
2021-05-15 Alan Bujtas <zalan@apple.com>
[LFC] Move table wrapper quirks to its own class
https://bugs.webkit.org/show_bug.cgi?id=225760
Reviewed by Antti Koivisto.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp:
(WebCore::Layout::TableWrapperBlockFormattingContext::quirks const):
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.h:
(WebCore::Layout::TableWrapperBlockFormattingContext::Quirks::Quirks): Deleted.
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContextQuirks.cpp: Removed.
2021-05-15 Sam Weinig <weinig@apple.com>
Move CanvasRenderingContext2DSettings down to CanvasRenderingContext2DBase so it can be used there (and to support OffscreenCanvas)
https://bugs.webkit.org/show_bug.cgi?id=225836
Reviewed by Simon Fraser.
In subsequent changes, it will be useful to have CanvasRenderingContext2DSettings accessible
in CanvasRenderingContext2DBase for implementing color space support in ImageData.
While doing this, I noticed it was trivial to add support for passing the settings
to OffscreenCanvasRenderingContext2D, so I add that as well.
* html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::getContext):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
(WebCore::CanvasRenderingContext2D::pixelFormat const): Deleted.
(WebCore::CanvasRenderingContext2D::colorSpace const): Deleted.
* html/canvas/CanvasRenderingContext2D.h:
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::CanvasRenderingContext2DBase):
(WebCore::CanvasRenderingContext2DBase::pixelFormat const):
(WebCore::CanvasRenderingContext2DBase::colorSpace const):
* html/canvas/CanvasRenderingContext2DBase.h:
(WebCore::CanvasRenderingContext2DBase::getContextAttributes const):
* html/canvas/OffscreenCanvasRenderingContext2D.cpp:
(WebCore::OffscreenCanvasRenderingContext2D::OffscreenCanvasRenderingContext2D):
* html/canvas/OffscreenCanvasRenderingContext2D.h:
* html/canvas/PaintRenderingContext2D.cpp:
(WebCore::PaintRenderingContext2D::PaintRenderingContext2D):
2021-05-15 Alan Bujtas <zalan@apple.com>
[LFC] Move block formatting quirks to its own class
https://bugs.webkit.org/show_bug.cgi?id=225761
Reviewed by Antti Koivisto.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/formattingContexts/FormattingContext.h:
(WebCore::Layout::FormattingContext::Quirks::layoutState const):
(WebCore::Layout::FormattingContext::Quirks::layoutState):
(WebCore::Layout::FormattingContext::Quirks::formattingContext const):
(WebCore::Layout::FormattingContext::quirks const):
* layout/formattingContexts/block/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::quirks const):
* layout/formattingContexts/block/BlockFormattingContext.h:
(WebCore::Layout::BlockFormattingContext::Quirks::formattingContext const): Deleted.
(WebCore::Layout::BlockFormattingContext::Quirks::geometry const): Deleted.
(WebCore::Layout::BlockFormattingContext::quirks const): Deleted.
(WebCore::Layout::BlockFormattingContext::Quirks::Quirks): Deleted.
* layout/formattingContexts/block/BlockFormattingContextQuirks.cpp: Removed.
* layout/formattingContexts/block/BlockMarginCollapse.cpp:
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.h:
(WebCore::Layout::TableWrapperBlockFormattingContext::Quirks::Quirks):
2021-05-15 Alan Bujtas <zalan@apple.com>
[LFC] Move BlockMarginCollapse to its own class
https://bugs.webkit.org/show_bug.cgi?id=225762
Reviewed by Antti Koivisto.
* WebCore.xcodeproj/project.pbxproj:
* layout/formattingContexts/FormattingContext.h:
(WebCore::Layout::FormattingContext::formattingState const):
* layout/formattingContexts/block/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
(WebCore::Layout::BlockFormattingContext::updateMarginAfterForPreviousSibling):
(WebCore::Layout::BlockFormattingContext::marginCollapse const):
* layout/formattingContexts/block/BlockFormattingContext.h:
(WebCore::Layout::BlockFormattingContext::formattingState const):
(WebCore::Layout::BlockFormattingContext::Quirks::formattingContext const):
(WebCore::Layout::BlockFormattingContext::Quirks::geometry const):
(WebCore::Layout::BlockFormattingContext::quirks const):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::layoutState): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::layoutState const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::formattingContext const): Deleted.
(WebCore::Layout::BlockFormattingContext::marginCollapse const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::MarginCollapse): Deleted.
* layout/formattingContexts/block/BlockMarginCollapse.cpp:
(WebCore::Layout::BlockMarginCollapse::BlockMarginCollapse):
(WebCore::Layout::BlockMarginCollapse::hasClearance const):
(WebCore::Layout::BlockMarginCollapse::marginBeforeCollapsesWithParentMarginAfter const):
(WebCore::Layout::BlockMarginCollapse::marginBeforeCollapsesWithParentMarginBefore const):
(WebCore::Layout::BlockMarginCollapse::marginBeforeCollapsesWithPreviousSiblingMarginAfter const):
(WebCore::Layout::BlockMarginCollapse::marginBeforeCollapsesWithFirstInFlowChildMarginBefore const):
(WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance const):
(WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithParentMarginBefore const):
(WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithParentMarginAfter const):
(WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter const):
(WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithNextSiblingMarginBefore const):
(WebCore::Layout::BlockMarginCollapse::marginsCollapseThrough const):
(WebCore::Layout::BlockMarginCollapse::computedPositiveAndNegativeMargin const):
(WebCore::Layout::BlockMarginCollapse::marginValue const):
(WebCore::Layout::BlockMarginCollapse::positiveNegativeValues const):
(WebCore::Layout::BlockMarginCollapse::positiveNegativeMarginBefore const):
(WebCore::Layout::BlockMarginCollapse::positiveNegativeMarginAfter const):
(WebCore::Layout::BlockMarginCollapse::marginBeforeIgnoringCollapsingThrough):
(WebCore::Layout::BlockMarginCollapse::collapsedVerticalValues):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::hasClearance const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSiblingMarginAfter const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithFirstInFlowChildMarginBefore const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginBefore const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginAfter const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithNextSiblingMarginBefore const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::computedPositiveAndNegativeMargin const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginValue const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::updateMarginAfterForPreviousSibling): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginBefore const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginAfter const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeIgnoringCollapsingThrough): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedVerticalValues): Deleted.
* layout/formattingContexts/block/PrecomputedBlockMarginCollapse.cpp:
(WebCore::Layout::BlockMarginCollapse::precomputedPositiveNegativeValues const):
(WebCore::Layout::BlockMarginCollapse::precomputedPositiveNegativeMarginBefore const):
(WebCore::Layout::BlockMarginCollapse::precomputedMarginBefore):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::precomputedPositiveNegativeValues const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::precomputedPositiveNegativeMarginBefore const): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::precomputedMarginBefore): Deleted.
* layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp:
(WebCore::Layout::TableWrapperBlockFormattingContext::computeHeightAndMarginForTableBox):
2021-05-15 Alexander Mikhaylenko <alexm@gnome.org>
[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-05-15 Antti Koivisto <antti@apple.com>
Don't allow :visited link style in subtrees that use mix-blend-mode
https://bugs.webkit.org/show_bug.cgi?id=225446
rdar://65686091
Reviewed by Darin Adler.
Test: fast/css/visited-link-mix-blend-mode.html
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::visitedDependentColor const):
Return unvisited style in substrees that use mix-blend-mode.
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setBlendMode):
(WebCore::RenderStyle::isInSubtreeWithBlendMode const):
Add an inherited fake property for tracking this.
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):
* rendering/style/StyleRareInheritedData.h:
2021-05-14 Chris Dumez <cdumez@apple.com>
Drop FileSystem::fileMetadata() / fileMetadataFollowingSymlinks()
https://bugs.webkit.org/show_bug.cgi?id=225820
Reviewed by Darin Adler.
Update our code base because of the FileSystem API changes.
* Modules/entriesapi/DOMFileSystem.cpp:
(WebCore::listDirectoryWithMetadata):
(WebCore::toFileSystemEntries):
(WebCore::fileTypeIgnoringHiddenFiles):
(WebCore::validatePathIsExpectedType):
(WebCore::DOMFileSystem::getParent):
(WebCore::DOMFileSystem::getEntry):
(WebCore::DOMFileSystem::getFile):
* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::attachmentForFilePath):
* fileapi/File.cpp:
(WebCore::File::isDirectory const):
* html/DirectoryFileListCreator.cpp:
(WebCore::appendDirectoryFiles):
(WebCore::gatherFileInformation):
* platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::setStorageDirectory):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::ensureAssetCacheExistsForPath):
* platform/network/BlobDataFileReference.cpp:
(WebCore::BlobDataFileReference::startTrackingModifications):
* platform/network/BlobRegistryImpl.cpp:
* platform/network/FormData.cpp:
(WebCore::FormData::prepareForUpload):
* platform/network/mac/BlobDataFileReferenceMac.mm:
(WebCore::BlobDataFileReference::generateReplacementFile):
2021-05-14 John Wilander <wilander@apple.com>
Javascript can't access a SameSite=Strict cookie after page is loaded after a redirect from a third party site
https://bugs.webkit.org/show_bug.cgi?id=208049
<rdar://problem/59701889>
Reviewed by Chris Dumez.
The HTTP WG has decided that SameSite=strict cookies should be returned in document.cookie
even in cases where they are not sent in the HTTP request for the page. Chromium and Gecko
now work according to those rules and the spec is being updated.
See:
- https://github.com/httpwg/http-extensions/issues/769
- https://github.com/httpwg/http-extensions/pull/1428/files.
Here's an excerpt from the spec change:
'If a user agent does return cookies for a given call to a "non-HTTP" API with
an associated Document, then the user agent MUST compute the cookie-string
following the algorithm defined in {{retrieval-algorithm}}, indicating that the
retrieval is from a "non-HTTP" API. The retrieval-uri is the associated
Document's cookie URL {{COOKIE-URL}}, and the retrieval is same-site if the
Document's "site for cookies" is same-site with the top-level origin as defined
in {{document-requests}}.'
Existing layout tests changed and rebased.
* loader/CookieJar.cpp:
(WebCore::CookieJar::sameSiteInfo):
Now takes a IsCookieAccessForDOM parameter and forwards it to SameSiteInfo::create().
(WebCore::CookieJar::cookies const):
Now sends IsCookieAccessForDOM::Yes to CookieJar::sameSiteInfo().
(WebCore::CookieJar::setCookies):
Now sends IsCookieAccessForDOM::Yes to CookieJar::sameSiteInfo().
* loader/CookieJar.h:
* platform/network/SameSiteInfo.cpp:
(WebCore::SameSiteInfo::create):
Now takes a IsForDOMCookieAccess parameter and if it's IsForDOMCookieAccess::Yes and
the site is top site, sets isSameSite.
* platform/network/SameSiteInfo.h:
Now has an enum IsForDOMCookieAccess.
2021-05-14 Rob Buis <rbuis@igalia.com>
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-14 Chris Dumez <cdumez@apple.com>
Drop legacy / prefixed WebAudio implementation
https://bugs.webkit.org/show_bug.cgi?id=225832
Reviewed by Darin Adler.
Drop legacy / prefixed WebAudio implementation now that it is no longer
present in shipping and we have received any reports of issues.
This drops all the legacy code but she should be able to clean up the
code further in follow-ups. In particular, I believe some code can
now be moved from BaseAudioContext to OfflineAudioContext.
* CMakeLists.txt:
* DerivedSources.make:
* Modules/webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::~AudioBufferSourceNode):
(WebCore::AudioBufferSourceNode::totalPitchRate):
* Modules/webaudio/AudioBufferSourceNode.h:
* Modules/webaudio/AudioBufferSourceNode.idl:
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::create):
(WebCore::AudioContext::AudioContext):
* Modules/webaudio/AudioContext.h:
* Modules/webaudio/AudioListener.h:
* Modules/webaudio/AudioListener.idl:
* Modules/webaudio/AudioNode.cpp:
* Modules/webaudio/AudioNode.h:
* Modules/webaudio/AudioNode.idl:
* Modules/webaudio/AudioParam.h:
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::BaseAudioContext):
* Modules/webaudio/BaseAudioContext.h:
(WebCore::BaseAudioContext::isOfflineContext const):
(WebCore::BaseAudioContext::BaseAudioContext):
* Modules/webaudio/DynamicsCompressorNode.cpp:
* Modules/webaudio/DynamicsCompressorNode.h:
* Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::OfflineAudioContext):
* Modules/webaudio/OscillatorNode.h:
* Modules/webaudio/OscillatorNode.idl:
* Modules/webaudio/WebKitAudioBufferSourceNode.h: Removed.
* Modules/webaudio/WebKitAudioBufferSourceNode.idl: Removed.
* Modules/webaudio/WebKitAudioContext.cpp: Removed.
* Modules/webaudio/WebKitAudioContext.h: Removed.
* Modules/webaudio/WebKitAudioContext.idl: Removed.
* Modules/webaudio/WebKitAudioListener.h: Removed.
* Modules/webaudio/WebKitAudioListener.idl: Removed.
* Modules/webaudio/WebKitAudioPannerNode.cpp: Removed.
* Modules/webaudio/WebKitAudioPannerNode.h: Removed.
* Modules/webaudio/WebKitAudioPannerNode.idl: Removed.
* Modules/webaudio/WebKitDynamicsCompressorNode.h: Removed.
* Modules/webaudio/WebKitDynamicsCompressorNode.idl: Removed.
* Modules/webaudio/WebKitOfflineAudioContext.cpp: Removed.
* Modules/webaudio/WebKitOfflineAudioContext.h: Removed.
* Modules/webaudio/WebKitOfflineAudioContext.idl: Removed.
* Modules/webaudio/WebKitOscillatorNode.h: Removed.
* Modules/webaudio/WebKitOscillatorNode.idl: Removed.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* testing/Internals.cpp:
(WebCore::Internals::setAudioContextRestrictions):
* testing/Internals.h:
* testing/Internals.idl:
2021-05-14 Sam Weinig <weinig@apple.com>
CustomPaintImage being in platform/graphics is a layering violation
https://bugs.webkit.org/show_bug.cgi?id=225356
Reviewed by Darin Adler.
It is layering violation for a file in platform/ to reference classes
like RenderElement or PaintWorkletGlobalScope. This fixes this by moving
CustomPaintImage out of platform/graphics to html/, next to the existing
CustomPaintCanvas class.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* html/CustomPaintImage.cpp: Copied from Source/WebCore/platform/graphics/CustomPaintImage.cpp.
* html/CustomPaintImage.h: Copied from Source/WebCore/platform/graphics/CustomPaintImage.h.
* platform/graphics/CustomPaintImage.cpp: Removed.
* platform/graphics/CustomPaintImage.h: Removed.
2021-05-14 Darin Adler <darin@apple.com>
output element doesn't react properly to node tree mutations
https://bugs.webkit.org/show_bug.cgi?id=196532
Reviewed by Ryosuke Niwa.
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::replaceAll): Refactored most of the functions
replaceAllChildren and replaceAllChildrenWithNewText into this new one,
and named it based on the name of the operation in the HTML specification.
The function is incomplete, but preserves existing behavior.
(WebCore::ContainerNode::stringReplaceAll): Refactored the rest of the
replaceAllChildrenWithNewText function and renamed to the name from the
HTML specification.
* dom/ContainerNode.h: Updated for the above changes.
* dom/Node.cpp:
(WebCore::Node::setTextContent): Updated for name change above.
* dom/Range.cpp:
(WebCore::Range::surroundContents): Ditto.
* editing/ios/EditorIOS.mm:
(WebCore::Editor::setTextAsChildOfElement): Ditto.
* html/HTMLElement.cpp:
(WebCore::HTMLElement::setInnerText): Ditto.
* html/HTMLOutputElement.cpp:
(WebCore::HTMLOutputElement::HTMLOutputElement): Moved data member
initialization into the class definition.
(WebCore::HTMLOutputElement::create): Added an overload that takes just
a document, for use when invoked from as a constructor.
(WebCore::HTMLOutputElement::parseAttribute): Tightened the logic for the
for attribute. I decided it's better to call through to the base class, even
though we often don't do that for attributes that don't expect the base
class to pay attention to.
(WebCore::HTMLOutputElement::childrenChanged): Deleted. No need for this in
the improved HTML specification version of this element's algorithms.
(WebCore::HTMLOutputElement::reset): Updated based on the HTML specification,
using the default value algorithm rather than the default value mode flag we
were using before.
(WebCore::HTMLOutputElement::setValue): Updated based on the HTML specification,
always setting the default value override based on the current default value,
and using stringReplaceAll. There's no need for the old setTextContentInternal,
since that was all due to the need to avoid infinite recursion in childrenChanged.
(WebCore::HTMLOutputElement::defaultValue const): Updated based on the HTML
specification, deriving the default value from the default value override and
the descendant text content.
(WebCore::HTMLOutputElement::setDefaultValue): Updated based on the HTML
specification, doing a string replace all with the value if the default
value override is null, and updating the default value override otherwise.
(WebCore::HTMLOutputElement::htmlFor): Updated to rename m_tokens to m_forTokens.
(WebCore::HTMLOutputElement::setTextContentInternal): Deleted.
* html/HTMLOutputElement.h: Moved DOMTokenList to be a forward declaration
instead of an include. Adde a constructor that takes only a document to be used
from JavaScript. Made the canContainRangeEndPoint override be private like the
other overrides. Removed the childrenChange override and the
setTextContentInternal function. Removed m_isDefaultValueMode,
m_isSetTextContentInProgress, and m_defaultValue. Added m_defaultValueOverride.
Renamed m_tokens to m_forTokens.
* html/HTMLOutputElement.idl: Updated to match the HTML specification. This
involved adding a constructor, adding SameObject for the htmlFor attribute,
making the form attribute nullable, and removing [LegacyNullToEmptyString]
from the defaultValue and value attributes.
2021-05-14 Sam Weinig <weinig@apple.com>
Use PixelBufferFormat to specify ImageBuffer::getPixelData destination format allowing for more control over data conversion
https://bugs.webkit.org/show_bug.cgi?id=225813
Reviewed by Darin Adler.
The reprevious signature of ImageBuffer::getPixelBuffer:
ImageBuffer::getPixelBuffer(AlphaPremultiplication, const IntRect&);
only allowed specifying the type of alpha premultiplication wanted, and hard coded
a pixel format of RGBA8 and color space of SRGB. To support accurate and efficient
access to pixel buffers with different pixel formats and color spaces we need to be
able to tell getPixelBuffer what we want up front, so that if the ImageBuffer already
has a DisplayP3 buffer, and we want DisplayP3 pixels, we don't first convert to SRGB
and then convert back to DisplayP3 (which would be slow and lose any out of gamut
data). The new signature allows us to specify the entire format triple:
ImageBuffer::getPixelBuffer(const PixelBufferFormat&, const IntRect&);
Additionally, ImageBuffer::putPixelBuffer() no longer needs to provide the source
AlphaPremultiplication either, as the PixelBuffer itself also contains that information.
Now that we are passing color space information, we need to support color space conversion,
so PixelBufferConversion was updated to support color space conversion on CG platforms
using vImageConvert_AnyToAny. This is not currently excersised, but will be in a subsequent
change where canvas ImageData gains a color space setting, at which point it can be tested.
We also don't currently support color space conversion on non-CG platforms. This won't
be a problem in the short term, as only CG platforms support DisplayP3, the only other
color space that can be specified currently, but as cleanup, we should add support for
color space conversion using the ColorConversion and ColorTransferFunction infrastructure
for other ports, moving the existing support for SRGB to/from LinearSRGB conversions from
ImageBufferCairoBackend and ImageBufferCairoImageSurfaceBackend.
* html/ImageBitmap.cpp:
(WebCore::ImageBitmap::createPromise):
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::getImageData const):
(WebCore::CanvasRenderingContext2DBase::putImageData):
* page/PageConsoleClient.cpp:
(WebCore::PageConsoleClient::screenshot):
* platform/graphics/ConcreteImageBuffer.h:
(WebCore::ConcreteImageBuffer::putPixelBuffer):
* platform/graphics/ImageBuffer.h:
(WebCore::ImageBuffer::putPixelBuffer):
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::convertToLuminanceMask):
(WebCore::ImageBufferBackend::getPixelBuffer const):
(WebCore::ImageBufferBackend::putPixelBuffer):
* platform/graphics/ImageBufferBackend.h:
* platform/graphics/PixelBufferConversion.cpp:
(WebCore::makeVImageCGImageFormat):
(WebCore::makeVImageBuffer):
(WebCore::convertImagePixelsAccelerated):
(WebCore::convertImagePixels):
* platform/graphics/ShadowBlur.cpp:
(WebCore::ShadowBlur::blurShadowBuffer):
* platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp:
(WebCore::ImageBufferCairoSurfaceBackend::getPixelBuffer const):
(WebCore::ImageBufferCairoSurfaceBackend::putPixelBuffer):
* platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h:
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::ImageBufferCGBackend::toCFData const):
* platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
(WebCore::ImageBufferCGBitmapBackend::getPixelBuffer const):
(WebCore::ImageBufferCGBitmapBackend::putPixelBuffer):
* platform/graphics/cg/ImageBufferCGBitmapBackend.h:
* platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
(WebCore::ImageBufferIOSurfaceBackend::getPixelBuffer const):
(WebCore::ImageBufferIOSurfaceBackend::putPixelBuffer):
* platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::PutPixelBuffer::PutPixelBuffer):
(WebCore::DisplayList::PutPixelBuffer::swap):
(WebCore::DisplayList::operator<<):
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::GetPixelBuffer::GetPixelBuffer):
(WebCore::DisplayList::GetPixelBuffer::outputFormat const):
(WebCore::DisplayList::PutPixelBuffer::encode const):
(WebCore::DisplayList::PutPixelBuffer::decode):
(WebCore::DisplayList::PutPixelBuffer::inputFormat const): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::getPixelBuffer):
(WebCore::DisplayList::Recorder::putPixelBuffer):
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/filters/FEColorMatrix.cpp:
(WebCore::FEColorMatrix::platformApplySoftware):
* platform/graphics/filters/FEDropShadow.cpp:
(WebCore::FEDropShadow::platformApplySoftware):
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::imageBufferResult):
(WebCore::FilterEffect::convertPixelBufferToColorSpace):
(WebCore::FilterEffect::convertImageBufferToColorSpace):
(WebCore::FilterEffect::copyConvertedPixelBufferToDestination):
(WebCore::FilterEffect::copyUnmultipliedResult):
(WebCore::FilterEffect::copyPremultipliedResult):
* platform/graphics/filters/FilterEffect.h:
* platform/graphics/win/ImageBufferDirect2DBackend.cpp:
(WebCore::ImageBufferDirect2DBackend::getPixelBuffer const):
(WebCore::ImageBufferDirect2DBackend::putPixelBuffer):
* platform/graphics/win/ImageBufferDirect2DBackend.h:
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createRasterShape):
2021-05-14 Devin Rousso <drousso@apple.com>
Sampled Page Top Color: move logic out of `Document`
https://bugs.webkit.org/show_bug.cgi?id=225480
<rdar://problem/77984539>
Reviewed by Tim Horton.
Having `determineSampledPageTopColor` be called in `enqueuePaintTimingEntryIfNeeded` as what
is basically a side effect is not great. The only reason it was there in the first place was
to take advantage of the logic that decided "is this the first contentful paint", but that
logic can be replicated elsewhere. Since the sampled page top color deals more with the page
as a whole instead of an individual `Document` (which includes subframes), it makes more
sense to have this logic be on a utility `PageColorSampler` that's used in `Page` instead.
Test: SampledPageTopColor.MainDocumentChange
* page/PageColorSampler.h: Added.
* page/PageColorSampler.cpp: Added.
(WebCore::isValidSampleLocation):
(WebCore::sampleColor):
(WebCore::colorDifference):
(WebCore::averageColor):
(WebCore::PageColorSampler::sampleTop):
* page/Page.h:
* page/Page.cpp:
(WebCore::Page::doAfterUpdateRendering):
(WebCore::Page::sampledPageTopColor const):
(WebCore::Page::didChangeMainDocument):
* dom/Document.h:
(WebCore::Document::sampledPageTopColor const): Deleted.
* dom/Document.cpp:
(WebCore::Document::enqueuePaintTimingEntryIfNeeded):
(WebCore::isValidPageSampleLocation): Deleted.
(WebCore::samplePageColor): Deleted.
(WebCore::colorDifference): Deleted.
(WebCore::averageColor): Deleted.
(WebCore::Document::determineSampledPageTopColor): Deleted.
* page/FrameView.h:
* page/FrameView.cpp:
(WebCore::FrameView::hasContentfulDescendants const): Added.
(WebCore::FrameView::hasContenfulDescendants const): Deleted.
Drive-by: Fix incorrect spelling.
* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
2021-05-14 Eric Carlson <eric.carlson@apple.com>
[GPUP] a media element with a data url and "crossorigin='anonymous'" doesn't load
https://bugs.webkit.org/show_bug.cgi?id=225786
<rdar://77625185>
Reviewed by Jer Noble.
Test: media/data-url-cross-origin.html
* loader/MediaResourceLoader.cpp:
(WebCore::MediaResourceLoader::requestResource): Set loader options `sameOriginDataURLFlag`
to `SameOriginDataURLFlag::Set` so data: urls are treated as same origin.
2021-05-14 Peng Liu <peng.liu6@apple.com>
REGRESSION: [ Mac WK2 ] fast/mediastream/audio-track-enabled.html is flaky failing
https://bugs.webkit.org/show_bug.cgi?id=221985
Reviewed by Eric Carlson.
When `MediaSessionManagerCocoa::updateSessionState()` goes through all sessions, it
counts all WebAudio sessions regardless their states, and it may set the shared audio
session's category to be `AudioSession::AmbientSound` if the count of WebAudio sessions
is not zero.
However, when we close a page with WebAudio, we should not count the WebAudio session
here because the corresponding AudioContext is suspended and will be destroyed soon.
Without this patch, the shared audio session's category might be `AudioSession::AmbientSound`
after we close the WebAudio page.
* Modules/webaudio/AudioContext.h:
2021-05-14 Alan Bujtas <zalan@apple.com>
[showRenderTree] Do not integral floor the overflow values
https://bugs.webkit.org/show_bug.cgi?id=225825
Reviewed by Simon Fraser.
Integral flooring may hide fractional values caused by rounding bugs.
* rendering/RenderObject.cpp:
(WebCore::RenderObject::outputRenderObject const):
2021-05-14 Chris Dumez <cdumez@apple.com>
Drop "get" prefix from WTF::FileSystem's getFileModificationTime() / getFileCreationTime()
https://bugs.webkit.org/show_bug.cgi?id=225812
Reviewed by Darin Adler.
Update code base due to WTF API change.
* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::removeAllDatabasesForFullOriginPath):
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::deleteDatabasesModifiedSince):
* fileapi/File.cpp:
(WebCore::File::lastModified const):
* page/Page.cpp:
(WebCore::Page::userStyleSheet const):
* platform/FileStream.cpp:
(WebCore::FileStream::getSize):
* platform/network/FormData.cpp:
(WebCore::FormDataElement::EncodedFileData::fileModificationTimeMatchesExpectation const):
* platform/network/curl/CurlCacheEntry.cpp:
(WebCore::CurlCacheEntry::parseResponseHeaders):
* platform/sql/SQLiteFileSystem.cpp:
(WebCore::SQLiteFileSystem::databaseCreationTime):
(WebCore::SQLiteFileSystem::databaseModificationTime):
2021-05-14 Alan Bujtas <zalan@apple.com>
[LFC] Add enclosing line top/bottom to showInlineTreeAndRuns
https://bugs.webkit.org/show_bug.cgi?id=225821
Reviewed by Simon Fraser.
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::showInlineTreeAndRuns):
* page/FrameViewLayoutContext.cpp:
(WebCore::FrameViewLayoutContext::layout):
2021-05-14 Ryosuke Niwa <rniwa@webkit.org>
Add ScriptDisallowedScope to MediaPlayerPrivateAVFoundation
https://bugs.webkit.org/show_bug.cgi?id=225797
Reviewed by Eric Carlson.
Deployed ScriptDisallowedScope to a bunch of functions in MediaPlayerPrivateAVFoundation.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::updateStates):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
(-[WebCoreAVFMovieObserver legibleOutput:didOutputAttributedStrings:nativeSampleBuffers:forItemTime:]):
(-[WebCoreAVFMovieObserver metadataOutput:didOutputTimedMetadataGroups:fromPlayerItemTrack:]):
(-[WebCoreAVFLoaderDelegate resourceLoader:didCancelLoadingRequest:]):
2021-05-14 Jean-Yves Avenard <jya@apple.com>
Bad media session artwork URL results in blue "broken image" icon being shown in Now Playing
https://bugs.webkit.org/show_bug.cgi?id=225799
rdar://77990886
Reviewed by Eric Carlson.
By default, when the image's URL doesn't point to an image the CachedImage
will return a default image consistent of a blue interrogation mark.
We need to explicitely check that an error occurred. The naming used in the
method didn't make this need obvious.
* Modules/mediasession/MediaMetadata.cpp:
(WebCore::ArtworkImageLoader::notifyFinished): Check for a status error.
* testing/Internals.cpp:
(WebCore::Internals::loadArtworkImage): Fix spelling
2021-05-14 Devin Rousso <drousso@apple.com>
Promote `-[WKWebView _pageExtendedBackgroundColor]` SPI to `-[WKWebView underPageBackgroundColor]` API
https://bugs.webkit.org/show_bug.cgi?id=225615
<rdar://problem/76568094>
Reviewed by Wenson Hsieh.
`underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
- the most recent non-null value provided
- the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
- the underlying platform view's background color
Modifications to this property will not have any effect until control is returned to the runloop.
Tests: WKWebViewUnderPageBackgroundColor.OnLoad
WKWebViewUnderPageBackgroundColor.SingleSolidColor
WKWebViewUnderPageBackgroundColor.SingleBlendedColor
WKWebViewUnderPageBackgroundColor.MultipleSolidColors
WKWebViewUnderPageBackgroundColor.MultipleBlendedColors
WKWebViewUnderPageBackgroundColor.KVO
WKWebViewUnderPageBackgroundColor.MatchesScrollView
* page/Page.h:
(WebCore::Page::underPageBackgroundColorOverride const): Added.
* page/Page.cpp:
(WebCore::Page::setUnderPageBackgroundColorOverride): Added.
Hold the client-overriden value for `underPageBackgroundColor` so that it can be used when
drawing the overscroll layer.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateLayerForOverhangAreasBackgroundColor):
Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
`UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
* dom/Document.cpp:
(WebCore::Document::themeColorChanged):
It's no longer necessary to force the overscroll area to redraw since that'll be handled by
a client calling `-[WKWebView setUnderPageBackgroundColor:]` (possibly in response to a
`-[WKWebView themeColor]` KVO notification).
2021-05-14 Alex Christensen <achristensen@webkit.org>
Fix a build after r277493
* editing/cocoa/AttributedString.h:
I removed an unneeded NSDictionary declaration that was being used here.
2021-05-14 Ziran Sun <zsun@igalia.com>
Wrong static position for out-of-flow positioned element with different writing-mode than its containing block
https://bugs.webkit.org/show_bug.cgi?id=189513
Reviewed by Sergio Villar Senin.
The static distance computations (computeBlockStaticDistance & computeInlineStaticDistance) in RenderBox have
not been patched for mixed writing modes. This CL adds support for the case that child is orthogonal to its
container block when container block's text direction is LTR. It aims at fixing failures in
orthogonal-positioned-grid-descendants*.html tests. It is noted that this CL only covers specific case when child's
writing mode is vlr and parent is horizontal tb rather than all cases of mixed writing modes in the static distance
computations.
* rendering/RenderBox.cpp:
(WebCore::computeInlineStaticDistance):
(WebCore::computeBlockStaticDistance):
2021-05-14 Alex Christensen <achristensen@webkit.org>
Resource Timing: secureConnectionStart == 0 when a connection is re-used
https://bugs.webkit.org/show_bug.cgi?id=225733
Reviewed by Chris Dumez.
Covered by a newly-passing web platform test, which was already passed by Chrome and Firefox.
* page/PerformanceResourceTiming.cpp:
(WebCore::PerformanceResourceTiming::secureConnectionStart const):
* platform/network/NetworkLoadMetrics.h:
I use a sentinel value to distinguish no secure connection from a reused secure connection.
* platform/network/ResourceHandle.h:
* platform/network/cocoa/NetworkLoadMetrics.mm:
(WebCore::packageTimingData):
(WebCore::copyTimingData):
Introduce a way to get timing data from CFNetwork using a more modern API.
(WebCore::timingValue): Deleted.
* platform/network/cocoa/WebCoreNSURLSession.mm:
(-[WebCoreNSURLSessionDataTask _timingData]):
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::getConnectionTimingData): Deleted.
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
2021-05-14 Chris Dumez <cdumez@apple.com>
Rename FileSystem::getFileSize() to FileSystem::fileSize()
https://bugs.webkit.org/show_bug.cgi?id=225798
Reviewed by Alex Christensen.
Update code path to due to the API change.
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::databasesSizeForDirectory):
* Modules/webdatabase/DatabaseDetails.h:
(WebCore::DatabaseDetails::DatabaseDetails):
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::hasAdequateQuotaForOrigin):
(WebCore::DatabaseTracker::canEstablishDatabase):
(WebCore::DatabaseTracker::retryCanEstablishDatabase):
(WebCore::DatabaseTracker::maximumSize):
(WebCore::DatabaseTracker::detailsForNameAndOrigin):
(WebCore::DatabaseTracker::setDatabaseDetails):
(WebCore::DatabaseTracker::usage):
(WebCore::DatabaseTracker::quotaNoLock):
(WebCore::DatabaseTracker::quota):
(WebCore::DatabaseTracker::setQuota):
(WebCore::isZeroByteFile):
* Modules/webdatabase/DatabaseTracker.h:
* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::attachmentForFilePath):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::spaceNeeded):
(WebCore::ApplicationCacheStorage::loadCache):
(WebCore::ApplicationCacheStorage::flatFileAreaSize):
* platform/FileStream.cpp:
(WebCore::FileStream::getSize):
* platform/network/FormData.cpp:
(WebCore::FormDataElement::lengthInBytes const):
* platform/network/curl/CurlCacheEntry.cpp:
(WebCore::CurlCacheEntry::loadFileToBuffer):
* platform/network/curl/CurlCacheManager.cpp:
(WebCore::CurlCacheManager::loadIndex):
* platform/sql/SQLiteFileSystem.cpp:
(WebCore::SQLiteFileSystem::databaseFileSize):
* platform/sql/SQLiteFileSystem.h:
* rendering/RenderThemeWin.cpp:
(WebCore::RenderThemeWin::stringWithContentsOfFile):
* workers/service/server/SWScriptStorage.cpp:
(WebCore::shouldUseFileMapping):
(WebCore::SWScriptStorage::retrieve):
2021-05-14 Chris Dumez <cdumez@apple.com>
Rename FileSystem::pathGetFileName() to FileSystem::pathFileName()
https://bugs.webkit.org/show_bug.cgi?id=225806
Reviewed by Alex Christensen.
Rename FileSystem::pathGetFileName() to FileSystem::pathFileName(), as we avoid "get" prefixes in WebKit.
* Modules/entriesapi/FileSystemEntry.cpp:
(WebCore::FileSystemEntry::FileSystemEntry):
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::attachmentForFilePath):
* fileapi/File.cpp:
(WebCore::File::computeNameAndContentType):
* fileapi/FileCocoa.mm:
(WebCore::File::computeNameAndContentTypeForReplacedFile):
* html/DirectoryFileListCreator.cpp:
(WebCore::gatherFileInformation):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::store):
* platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::setStorageDirectory):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::purgeOldDownloadFiles):
2021-05-13 Rob Buis <rbuis@igalia.com>
Check for null element in paintSearchFieldResultsButton
https://bugs.webkit.org/show_bug.cgi?id=225232
Reviewed by Ryosuke Niwa.
Check for null element in paintSearchFieldResultsButton.
Test: fast/css/searchfield-results-button-crash.html
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintSearchFieldResultsButton):
2021-05-13 Michael Catanzaro <mcatanzaro@gnome.org>
Misc GCC warning cleanup
https://bugs.webkit.org/show_bug.cgi?id=225777
Reviewed by Carlos Garcia Campos.
* bindings/js/JSAudioNodeCustom.cpp:
(WebCore::toJSNewlyCreated): Add missing RELEASE_ASSERT_NOT_REACHED().
* svg/SVGToOTFFontConversion.cpp:
(WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Remove redundant condition.
2021-05-13 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Wrong smooth animation sometimes with non-async scrolling
https://bugs.webkit.org/show_bug.cgi?id=225764
Reviewed by Adrian Perez de Castro.
This is happening because sometimes when the scrollbars are added to the scroll view, the contents size hasn't
been updated yet, so that values saved by ScrollAnimationSmooth::updateVisibleLengths() are 0x0. After that the
updateVisibleLengths() is not called again when the contents size is updated, so scroll happens with the wrong
visible lengths. This doesn't happen with async scrolling because updateVisibleLengths() is called every time
layers are repositioned. For non-async scrolling it should be enough to update visible lengths when he contents
size changes.
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::contentsResized const):
* platform/ScrollAnimator.h:
(WebCore::ScrollAnimator::ScrollAnimator::contentsResized const):
2021-05-13 Devin Rousso <drousso@apple.com>
[Modern Media Controls] REGRESSION(r268308) AirPlay briefly disappears and then reappears when hovering over controls
https://bugs.webkit.org/show_bug.cgi?id=225780
<rdar://problem/77984683>
Reviewed by Eric Carlson.
r268308 adjusted `AVRoutePickerViewTargetPicker::isAvailable`, which is used to control
whether `AVRoutePickerViewTargetPicker` (which uses the `AVRouteDetectorMultipleRoutesDetectedDidChange`
notification and actually stops listening for it in `stopMonitoringPlaybackTargets`) or
`AVOutputDeviceMenuControllerTargetPicker` (which uses ObjC KVO and doesn't actually do
anything in `stopMonitoringPlaybackTargets` when the last JS `"webkitplaybacktargetavailabilitychanged"`
event listener is removed, meaning that WebKit never senda a new value to the WebProcess) is
used. When using `AVRoutePickerViewTargetPicker`, WebKit calls `-[AVRouteDetector setRouteDetectionEnabled:]`
whenever the first JS `"webkitplaybacktargetavailabilitychanged"` event listener is added
(with the argument `YES`) and the last JS `"webkitplaybacktargetavailabilitychanged"` event
listener is removed (with the argument `NO`). In the latter scenario (which is the case with
builtin media controls), `-[AVRouteDetector setRouteDetectionEnabled:]` will dispatch a
`AVRouteDetectorMultipleRoutesDetectedDidChange` notification and mark itself as not having
multiple routes (`-[AVRouteDetector multipleRoutesDetected]`). This work is done in the
UIProcess and the result is sent to the WebProcess, meaning that even though there are no
more JS event listeners WebKit still updates the cached state of whether multiple routes
exist. This means that the next time a JS event listener is added, WebKit will ask the
UIProcess to update (which will re-enable route detection, which will dispatch a `AVRouteDetectorMultipleRoutesDetectedDidChange`
notification) but then immediately dispatch a JS `"webkitplaybacktargetavailabilitychanged"`
event using the cached state. Once the request from the UIProcess comes back, WebKit will
then dispatch *another* JS "webkitplaybacktargetavailabilitychanged" event with the new
non-cached value.
* platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.h:
* platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.mm:
(WebCore::AVRoutePickerViewTargetPicker::startingMonitoringPlaybackTargets):
(WebCore::AVRoutePickerViewTargetPicker::stopMonitoringPlaybackTargets):
(WebCore::AVRoutePickerViewTargetPicker::availableDevicesDidChange):
Add a flag that ignores the next `AVRouteDetectorMultipleRoutesDetectedDidChange`
notification since it's guaranteed to be `false` after `setRouteDetectionEnabled:NO`.
2021-05-13 Wenson Hsieh <wenson_hsieh@apple.com>
[Cocoa] Plumb data detector results through some platform objects
https://bugs.webkit.org/show_bug.cgi?id=225775
Work towards rdar://75504956
Reviewed by Tim Horton and Devin Rousso.
Introduce a new struct to hold data detection results, and add it to the existing results object when
`ENABLE(DATA_DETECTION)` is defined.
No change in behavior.
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* editing/cocoa/DataDetection.mm:
(WebCore::DataDetection::canBePresentedByDataDetectors):
(WebCore::DataDetection::canPresentDataDetectorsUIForElement):
(WebCore::resultIsURL):
(WebCore::constructURLStringForResult):
(WebCore::buildQuery):
(WebCore::DataDetection::detectContentInRange):
Add a `PAL` namespace to each of these DataDetectorsCore softlinking call sites, since the soft link header now
exists in PAL.
* platform/ImageExtractionResult.h:
(WebCore::ImageExtractionDataDetectorInfo::ImageExtractionDataDetectorInfo):
(WebCore::ImageExtractionResult::isEmpty const):
(WebCore::ImageExtractionResult::encode const):
(WebCore::ImageExtractionResult::decode):
* platform/cocoa/DataDetectorsCoreSoftLink.h: Removed.
* platform/cocoa/DataDetectorsCoreSoftLink.mm: Removed.
Additionally, move `DataDetectorsCoreSoftLink.{h|mm}` out of `WebCore/platform` and into PAL as softlinking
headers, so that they can be imported in WebKit as well as WebCore.
2021-05-13 Devin Rousso <drousso@apple.com>
[iOS] REGRESSION(r271216) pointerevents/ios/pointer-events-no-mousedown-when-prevent-default-called-on-pointerdown.html is consistently failing
https://bugs.webkit.org/show_bug.cgi?id=225734
<rdar://problem/77070765>
Reviewed by Tim Horton.
r271216 made it so that `touchWithIdentifierWasRemoved` is eagerly called when dispatching
`"pointerup"` for a touch event. This is problematic because (compatibility) mouse events
are dispatched after both pointer and touch events, meaning that if the `CapturingData` for
the touch event is removed, there's no way of knowing if the pointer event `preventDefault`.
Instead of fully removing the `CapturingData` entirely, change its state such that it's
marked as `CapturingData::State::Finished` and check for that instead.
* page/PointerCaptureController.h:
* page/PointerCaptureController.cpp:
(WebCore::PointerCaptureController::hasCancelledPointerEventForIdentifier const):
(WebCore::PointerCaptureController::dispatchEventForTouchAtIndex):
(WebCore::PointerCaptureController::pointerEventForMouseEvent):
(WebCore::PointerCaptureController::cancelPointer):
2021-05-13 Cameron McCormack <heycam@apple.com>
Ensure scrollable transformed elements that are themselves within scrollable elements don't ignore border-radius
https://bugs.webkit.org/show_bug.cgi?id=216978
<rdar://69660229>
Reviewed by Darin Adler.
We use ShouldRespectOverflowClip to prevent clips from ancestors
from being used when we paint a scrollable layer (when
PaintLayerFlag::PaintingOverflowContents is set). We only look
at the ShouldRespectOverflowClip value when we're painting a layer
we're considering to be a clip rect root layer, and we unconditionally
apply ancestor clips for layers that aren't clip rect roots.
A non-root layer with a transform is handled by applying the transform
and painting the layer as a root layer (since we don't want to handle
computing the effect of ancestor clip rects past the transform). When
the transformed layer also has a border-radius, we incorrectly skip
marking its clip rect as being affected by radius, since we currently
do this at the same time as applying ancestor clip rects.
This patch splits out the setAffectedByRadius call so that it happens
even for transformed non-root layers.
Test: fast/layers/overflow-scroll-transform-border-radius.html
* rendering/RenderLayer.cpp:
(WebCore::ClipRects::setOverflowClipRectAffectedByRadius):
(WebCore::RenderLayer::calculateClipRects const):
2021-05-13 Devin Rousso <drousso@apple.com>
[macOS] experimental "Use theme color for scroll area background" isn't working
https://bugs.webkit.org/show_bug.cgi?id=225726
<rdar://problem/77933000>
Reviewed by Tim Horton.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateLayerForOverhangAreasBackgroundColor):
(WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
Fix last remaining `m_layerForOverhangAreas->setBackgroundColor` to use the helper function
`RenderLayerCompositor::updateLayerForOverhangAreasBackgroundColor` instead so that all
paths that update the overscroll area color check the experimental settings too.
2021-05-13 Megan Gardner <megan_gardner@apple.com>
Add textIndicator bounce for AppHighlights on scroll.
https://bugs.webkit.org/show_bug.cgi?id=225727
Reviewed by Tim Horton.
* Modules/highlight/AppHighlightStorage.cpp:
(WebCore::AppHighlightStorage::attemptToRestoreHighlightAndScroll):
* loader/EmptyClients.cpp:
(WebCore::EmptyChromeClient::setTextIndicator const):
* loader/EmptyClients.h:
* page/ChromeClient.h:
* page/TextIndicator.h:
* page/cocoa/WebTextIndicatorLayer.h:
* page/cocoa/WebTextIndicatorLayer.mm:
(-[WebTextIndicatorLayer initWithFrame:textIndicator:margin:offset:]):
(createBounceAnimation):
(-[WebTextIndicatorLayer _animationDuration]):
* page/mac/TextIndicatorWindow.h:
* page/mac/TextIndicatorWindow.mm:
(WebCore::TextIndicatorWindow::~TextIndicatorWindow):
(WebCore::TextIndicatorWindow::clearTextIndicator):
(WebCore::TextIndicatorWindow::setTextIndicator):
2021-05-13 Aditya Keerthi <akeerthi@apple.com>
REGRESSION (r276945): [iOS] Focus rings are too large
https://bugs.webkit.org/show_bug.cgi?id=225778
<rdar://problem/77858341>
Reviewed by Tim Horton.
r276945 updated scaling logic to ensure that the scale of the base CTM
matches the device scale factor. The change itself makes our base CTM
more correct, but exposed a longstanding bug with our focus ring
implementation.
Focus rings are drawn using CoreGraphics, using CGFocusRingStyle. On
macOS, the style is initialized using NSInitializeCGFocusRingStyleForTime.
However, on iOS, we initialize the style ourselves, using UIKit constants.
Currently, the focus ring's style's radius is set to
+[UIFocusRingStyle cornerRadius], a constant of 8. This is the longstanding
issue. CGFocusRingStyle's radius is not a corner radius, but is the
width of the focus ring. In UIKit, this width is represented by
+[UIFocusRingStyle borderThickness], a constant of 3. WebKit has always
intended to match this width, as evidenced by the default outline-width
of 3px in the UA style sheet.
Considering the large disparity between the existing and expected radius
value, it may be surprising that this mistake has gone unnoticed since
2019, when focus rings were first introduced on iOS. This is where r276945
comes into play. Prior to r276945, the scale of the base CTM did not match
the device scale factor. This meant that CG scaled down the constant of 8
to 4 CSS pixels (1 (base CTM) / 2 (device scale factor)). After r276945,
the two scales are equal and the focus ring is drawn as 8 CSS pixels, much
larger than the expected 3px.
Test: fast/forms/ios/focus-ring-size.html
* platform/graphics/cocoa/GraphicsContextCocoa.mm:
(WebCore::drawFocusRingAtTime):
To fix, use the correct SPI to get the focus ring width,
+[UIFocusRingStyle borderThickness]. This ensures that focus rings have
the right width, following r276945.
The change also fixes focus ring repaint issues that arose from the
fact that the outline-width was 3px, but the painted width was 4px.
2021-05-13 Sam Weinig <weinig@apple.com>
Split pixel buffer format data out into a new PixelBufferFormat struct
https://bugs.webkit.org/show_bug.cgi?id=225707
Reviewed by Darin Adler.
Splits out PixelBufferFormat into a new struct and adopts it by PixelBufferConversionView,
ConstPixelBufferConversionView and PixelBuffer. This also means that PixelBuffer now
tracks the alpha format of the underlying buffer which will come in handy.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
Add new files.
* platform/graphics/AlphaPremultiplication.cpp: Added.
(WebCore::operator<<):
Add AlphaPremultiplication.cpp and move TextStream support
here from GraphicsTypes.cpp.
* platform/graphics/GraphicsTypes.cpp:
Move AlphaPremultiplication TextStream to the more appropriate
AlphaPremultiplication.cpp.
* html/ImageData.cpp:
(WebCore::ImageData::create):
* html/ImageData.h:
(WebCore::ImageData::colorSpace const): Deleted.
(WebCore::ImageData::format const): Deleted.
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::toBGRAData const):
(WebCore::ImageBufferBackend::getPixelBuffer const):
(WebCore::ImageBufferBackend::putPixelBuffer):
* platform/graphics/ImageBufferBackend.h:
* platform/graphics/PixelBuffer.cpp:
(WebCore::PixelBuffer::computeBufferSize):
(WebCore::PixelBuffer::tryCreateForDecoding):
(WebCore::PixelBuffer::tryCreate):
(WebCore::PixelBuffer::PixelBuffer):
(WebCore::PixelBuffer::deepClone const):
(WebCore::operator<<):
* platform/graphics/PixelBuffer.h:
(WebCore::PixelBuffer::format const):
(WebCore::PixelBuffer::encode const):
(WebCore::PixelBuffer::decode):
(WebCore::PixelBuffer::colorSpace const): Deleted.
* platform/graphics/PixelBufferConversion.cpp:
(WebCore::convertImagePixelsAccelerated):
(WebCore::convertImagePixels):
* platform/graphics/PixelBufferConversion.h:
* platform/graphics/PixelBufferFormat.cpp: Added.
(WebCore::operator<<):
* platform/graphics/PixelBufferFormat.h: Added.
(WebCore::PixelBufferFormat::encode const):
(WebCore::PixelBufferFormat::decode):
* platform/graphics/PixelFormat.cpp: Added.
(WebCore::operator<<):
* platform/graphics/PixelFormat.h:
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::readPixelsForPaintResults):
* platform/graphics/cg/GraphicsContextGLCG.cpp:
(WebCore::GraphicsContextGLOpenGL::paintToCanvas):
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::ImageBufferCGBackend::toCFData const):
* platform/graphics/cg/ImageBufferUtilitiesCG.cpp:
(WebCore::cfData):
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::copyUnmultipliedResult):
(WebCore::FilterEffect::copyPremultipliedResult):
(WebCore::FilterEffect::createUnmultipliedImageResult):
(WebCore::FilterEffect::createPremultipliedImageResult):
Adopt PixelBufferFormat.
2021-05-13 Chris Dumez <cdumez@apple.com>
Rename FileSystem::directoryName() to FileSystem::parentPath()
https://bugs.webkit.org/show_bug.cgi?id=225768
Reviewed by Darin Adler.
Rename FileSystem::directoryName() to FileSystem::parentPath() for clarity and
consistency with std::filesystem::parent_path() which is used internally.
* Modules/entriesapi/DOMFileSystem.cpp:
(WebCore::DOMFileSystem::DOMFileSystem):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::writeDataToUniqueFileInDirectory):
(WebCore::ApplicationCacheStorage::checkForDeletedResources):
* platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
(WebCore::CDMSessionAVContentKeySession::contentKeySession):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::purgeOldDownloadFiles):
* platform/network/curl/CookieJarDB.cpp:
(WebCore::CookieJarDB::openDatabase):
* platform/sql/SQLiteFileSystem.cpp:
(WebCore::SQLiteFileSystem::ensureDatabaseFileExists):
* platform/win/SearchPopupMenuDB.cpp:
(WebCore::SearchPopupMenuDB::openDatabase):
* workers/service/server/SWScriptStorage.cpp:
(WebCore::SWScriptStorage::store):
2021-05-13 Chris Dumez <cdumez@apple.com>
Rename FileSystem::fileIsDirectory(path, followSymlinks) to isDirectory(path) / isDirectoryFollowingSymlinks(path)
https://bugs.webkit.org/show_bug.cgi?id=225772
Reviewed by Darin Adler.
Update code base due to API naming change.
* Modules/entriesapi/DOMFileSystem.cpp:
(WebCore::listDirectoryWithMetadata):
* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::attachmentForFilePath):
* fileapi/File.cpp:
(WebCore::File::isDirectory const):
* html/DirectoryFileListCreator.cpp:
(WebCore::gatherFileInformation):
* platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::setStorageDirectory):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::ensureAssetCacheExistsForPath):
* platform/network/FormData.cpp:
(WebCore::FormData::prepareForUpload):
2021-05-13 Jer Noble <jer.noble@apple.com>
[ macOS Wk2 ] media/media-fragments/TC0051.html is flakey crashing
https://bugs.webkit.org/show_bug.cgi?id=222277
<rdar://problem/74600790>
Reviewed by Eric Carlson.
In r274734, a workaround was added to detect a bug in the Photos.framework that would cause
an exception to be thrown if the URL provided to AVURLAsset had a malformed fragment identifier.
However, in an effort to reduce the runtime cost of this check, it was only done once, the first
time an AVURLAsset is created. This failed to account for the Photos.framework being dynamically
loaded and changing the behavior of AVURLAsset after the check had been performed.
Instead, fall back to a much simpler check: wrap the creation of the AVURLAsset in a @try/@catch
block, and if an exception was thrown, re-attempt to create the AVURLAsset with a manually
conformed URL.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::conformFragmentIdentifierForURL):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
(WebCore::hasBrokenFragmentSupport): Deleted.
2021-05-13 Alicia Boya García <aboya@igalia.com>
[WTF] Add holdLock() overload for WTF::DataMutex
https://bugs.webkit.org/show_bug.cgi?id=225652
Reviewed by Xabier Rodriguez-Calvar.
All instantiations of DataMutex::LockedWrapper have been replaced by
holdLock(), for equivalent but more concise code.
This patch introduces no behavior changes.
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webKitWebSrcConstructed):
(webKitWebSrcGetProperty):
(webKitWebSrcSetContext):
(webKitWebSrcCreate):
(webKitWebSrcMakeRequest):
(webKitWebSrcStop):
(webKitWebSrcGetSize):
(webKitWebSrcIsSeekable):
(webKitWebSrcDoSeek):
(webKitWebSrcQuery):
(webKitWebSrcUnLock):
(webKitWebSrcUnLockStop):
(webKitWebSrcSetMediaPlayer):
(webKitSrcPassedCORSAccessCheck):
(CachedResourceStreamingClient::responseReceived):
(CachedResourceStreamingClient::dataReceived):
(CachedResourceStreamingClient::accessControlCheckFailed):
(CachedResourceStreamingClient::loadFailed):
(CachedResourceStreamingClient::loadFinished):
(webKitSrcWouldTaintOrigin):
* platform/graphics/gstreamer/mse/MediaSourceTrackGStreamer.cpp:
(WebCore::MediaSourceTrackGStreamer::isReadyForMoreSamples):
(WebCore::MediaSourceTrackGStreamer::notifyWhenReadyForMoreSamples):
(WebCore::MediaSourceTrackGStreamer::enqueueObject):
(WebCore::MediaSourceTrackGStreamer::clearQueue):
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
(webKitMediaSrcActivateMode):
(webKitMediaSrcPadLinked):
(webKitMediaSrcLoop):
(webKitMediaSrcStreamFlush):
2021-05-13 Darin Adler <darin@apple.com>
Remove StringBuilder::appendNumber
https://bugs.webkit.org/show_bug.cgi?id=225732
Reviewed by Sam Weinig.
* Modules/indexeddb/server/IndexValueStore.cpp:
(WebCore::IDBServer::IndexValueStore::loggingString const):
Use append instead of appendNumber.
* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::hostName): Use makeString instead of StringBuilder.
* contentextensions/CombinedURLFilters.cpp:
(WebCore::ContentExtensions::prefixTreeVertexToString):
Use append instead of appendNumber.
* contentextensions/Term.h:
(WebCore::ContentExtensions::Term::toString const): Ditto.
* css/CSSFontFeatureValue.cpp:
(WebCore::CSSFontFeatureValue::customCSSText const): Ditto.
* css/CSSTimingFunctionValue.cpp:
(WebCore::CSSStepsTimingFunctionValue::customCSSText const): Ditto.
* dom/Document.cpp:
(WebCore::Document::downgradeReferrerToRegistrableDomain): Use
makeString instead of StringBuilder.
* editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::generateUniquePrefix): Ditto.
* editing/cocoa/DataDetection.mm:
(WebCore::dataDetectorStringForPath): Use append instead of appendNumber.
* html/HTMLAnchorElement.cpp:
(WebCore::appendServerMapMousePosition): Ditto.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::createContext2d): Use makeString
instead of StringBuilder.
(WebCore::HTMLCanvasElement::createImageBuffer const): Ditto.
* loader/ResourceLoadStatistics.cpp:
(WebCore::ResourceLoadStatistics::toString const): Use append instead
of appendNumber.
* loader/SubresourceIntegrity.cpp:
(WebCore::integrityMismatchDescription): Use makeString instead of
StringBuilder.
* page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::rootMargin const): Use append instead
of appendNumber.
* page/SecurityOriginData.cpp:
(WebCore::SecurityOriginData::databaseIdentifier const): Use makeString
instead of StringBuilder.
* platform/Decimal.cpp:
(WebCore::Decimal::toString const): Use append instead of appendNumber.
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::animationNameForTransition): Use makeString
instead of StringBuilder.
* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::createTileLayer): Ditto.
* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(printTransform): Use single append instead of a run of them.
(printLayer): Ditto, and use append instead of apppendNumber.
(PlatformCALayerWin::layerTreeAsString const): Ditto.
* platform/mediarecorder/MediaRecorderPrivateMock.cpp:
(WebCore::MediaRecorderPrivateMock::generateMockCounterString):
Use append instead of appendNumber.
* platform/network/ProxyServer.cpp:
(WebCore::appendProxyServerString): Ditto.
* rendering/RenderTreeAsText.cpp:
(WebCore::nodePosition): Ditto.
* svg/SVGPathUtilities.cpp:
(WebCore::buildStringFromPath): Ditto.
* testing/Internals.cpp:
(WebCore::Internals::parserMetaData): Use makeString instead of
StringBuilder.
(WebCore::appendOffsets): Use append instead of appendNumber.
* testing/MockPageOverlayClient.cpp:
(WebCore::MockPageOverlayClient::drawRect): Use makeString instead
of StringBuilder.
(WebCore::MockPageOverlayClient::mouseEvent): Ditto.
* xml/XMLErrors.cpp:
(WebCore::XMLErrors::appendErrorMessage): Use append instead of
appendNumber.
2021-05-13 Zalan Bujtas <zalan@apple.com>
[css-flexbox] Flex item construction may affect sibling flex item height computation
https://bugs.webkit.org/show_bug.cgi?id=225489
Reviewed by Sergio Villar Senin.
Flex item construction triggers layout both on the flex item and on its descendants (see constructFlexItem).
During this layout a percent height descendant may indirectly set an incorrect value on the flex container's
m_hasDefiniteHeight (this is due to the odd way we choose to resolve percent height values on the ancestor chain,
see setOverridingContainingBlockContentLogicalHeight(WTF::nullopt)).
Now this incorrect m_hasDefiniteHeight value (Indefinite) causes the next sibling's (also) percent height
resolve fail as it tells the flex item that the flex container can't help with resolving the percent height value.
As the result we end up with an incorrect, 0px height value for this sibling.
e.g.
<div style="height: 100px; display: flex; flex-direction: column;">
<div id=flexItemA style="height: 50px;"><div style="height: 100%;"></div></div>
<div id=flexItemB style="height: 50%;"></div>
</div>
By the time we get to the construction of flexItemB, the RenderFlexibleBox's (flex container) m_hasDefiniteHeight
is already (and incorrectly) set to Indefinite as the result of us trying to resolve flexItemA's descendant height percentage.
This Indefinite value makes the flexItemB's height resolution fail as we believe that the flex container has indefinite height
e.g "height: auto", while it is clearly resolvable (50% of 100px).
Now if we flip the order and flexItemB comes first, the test case passes fine.
It is very unfortunate that some descendant height resolving process can trigger a state change on the ancestor RenderFlexibleBox, but
fixing it would certainly require some substantial architectural change.
In this patch, we just reset the m_hasDefiniteHeight flag inside the loop to ensure that each flex item
starts with a fresh height percent resolve state.
Test: fast/flexbox/flex-column-with-percent-height-descendants.html
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutFlexItems):
2021-05-13 Chris Fleizach <cfleizach@apple.com>
AX: Crash at WebCore::Document::updateLayout
https://bugs.webkit.org/show_bug.cgi?id=225677
Reviewed by Alan Bujtas.
Handling notifications while during layout is risky because we can call back into an update method.
We have handled many other cases like this by deferring the notification, as we do here.
Special note: this test can't be made to crash because actual crash requires the accessibility
runtime to be initialized and posting real notifications to the system. But, we can verify that the
notification is still sent correctly under conditions that could lead to a crash.
Test: accessibility/mac/menu-selection-notification-crash.html
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::deferMenuListValueChange):
(WebCore::AXObjectCache::performDeferredCacheUpdate):
* accessibility/AXObjectCache.h:
* accessibility/AccessibilityMenuList.cpp:
(WebCore::AccessibilityMenuList::didUpdateActiveOption):
2021-05-13 Enrique Ocaña González <eocanha@igalia.com>
[GStreamer] media/track/in-band/track-in-band-srt-mkv-kind.html is a flaky crash
https://bugs.webkit.org/show_bug.cgi?id=225697
This is a tentative fix for the flaky crash (I can't reproduce it locally after 10000
repetitions). It makes sure that mediaPlayerPrivate and any parameter passed to
handleTextSample() can either survive or detected to be invalid when the lambda is ran in
the main thread.
Reviewed by Alicia Boya Garcia.
Covered by existing tests.
* platform/graphics/gstreamer/TextSinkGStreamer.cpp:
(webkitTextSinkHandleSample): Protect mediaPlayerPrivate and streadId and check if the mediaPlayerPrivate WeakRef is still alive.
2021-05-12 Frederic Wang <fwang@igalia.com>
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-05-12 Peng Liu <peng.liu6@apple.com>
[iPad] SourceBufferPrivateAVFObjC should not report an error to the web page when the video playback is interrupted
https://bugs.webkit.org/show_bug.cgi?id=225620
Reviewed by Jer Noble.
If `SourceBufferPrivateAVFObjC` reports an error to a web page when
`AVSampleBufferDisplayLayer` reports `AVErrorOperationInterrupted` (the playback
was interrupted), the web page will likely destroy the video player (and teardown
the video element). That behavior will lead to an empty picture-in-picture window
if the video was playing in picture-in-picture.
With this patch, `SourceBufferPrivateAVFObjC` will not report an error to the
web page in case of playback interruption. Instead, it takes a note that
the playback was interrupted, so that when we try to resume the playback later,
it will flush the `AVSampleBufferDisplayLayer` to recover the playback state.
In addition, we need to enqueue an IDR frame first before we enqueue more
samples after flushing the `AVSampleBufferDisplayLayer`. That is guaranteed
by `SourceBufferPrivate::reenqueSamples()`.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal):
* platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
(WebCore::MediaSourcePrivateAVFObjC::flushActiveSourceBuffersIfNeeded):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::flushIfNeeded):
(WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError):
(WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples):
2021-05-12 Chris Dumez <cdumez@apple.com>
Notification.requestPermission() should return a Promise
https://bugs.webkit.org/show_bug.cgi?id=225712
Reviewed by Darin Adler.
Notification.requestPermission() should return a Promise as per the specification:
- https://notifications.spec.whatwg.org/#notification
Both Firefox and Chrome already support this.
Test: http/tests/notifications/request-with-promise.html
* Modules/notifications/Notification.cpp:
(WebCore::Notification::requestPermission):
* Modules/notifications/Notification.h:
* Modules/notifications/Notification.idl:
* Modules/notifications/NotificationClient.h:
2021-05-12 Fujii Hironori <Hironori.Fujii@sony.com>
Some webgl/2.0.0/conformance/textures/image_bitmap_from_image_data tests are failing after r277369 if !USE(ACCELERATE)
https://bugs.webkit.org/show_bug.cgi?id=225725
Reviewed by Sam Weinig.
* platform/graphics/PixelBufferConversion.cpp:
(WebCore::convertImagePixels): Fixed the wrong condition of destination.alphaFormat.
2021-05-12 Chris Dumez <cdumez@apple.com>
ASSERTION FAILED: actualVTablePointer == expectedVTablePointer in toJSNewlyCreated(JSC::JSGlobalObject *, WebCore::JSDOMGlobalObject *, Ref<WebCore::AudioNode> &&)
https://bugs.webkit.org/show_bug.cgi?id=225719
<rdar://77828031>
Reviewed by Geoffrey Garen.
AudioNode has (a lot of) subclasses that are exposed to JS (for which we call toJS() for).
As a result, AudioNode needs a custom toJS() implementation which returns the correct subclass
wrapper, instead of a generic JSAudioNode.
Test: webaudio/event-relatedTarget-audionode.html
* Modules/webaudio/AudioNode.idl:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSAudioNodeCustom.cpp: Added.
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
2021-05-12 Ziran Sun <zsun@igalia.com>
Wrong position for orthogonal positioned element with writing-mode: vertical-rl
https://bugs.webkit.org/show_bug.cgi?id=180633
Reviewed by Javier Fernandez.
When calculating offset position for orthogonal positioned element with writing mode vertical-rl,
we also need to take into account of borders and paddings. This change corrects computations
for both topOffset and leftOffset.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePositionedLogicalWidthUsing const):
(WebCore::RenderBox::computePositionedLogicalHeightUsing const):
2021-05-12 Jer Noble <jer.noble@apple.com>
TapStorage::lock freed while locked in AudioSourceProviderAVFObjC::destroyMixIfNeeded()
https://bugs.webkit.org/show_bug.cgi?id=225706
<rdar://77719381>
Reviewed by Ryosuke Niwa.
In r275933, an update was made to protect access to TapStorage during destruction by
locking its lock inside destroyMixIfNeeded(), but if TapStorage has a refCount==1
during that teardown, the lock itself is destroyed while it is still held. Add an
explicit scoping to the lock holder, and only deref the TapStorage outside that
locking scope.
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::destroyMixIfNeeded):
2021-05-12 Said Abou-Hallawa <said@apple.com>
Removing the transform CSS property from the SVG element does not cause invalidation
https://bugs.webkit.org/show_bug.cgi?id=225366
Reviewed by Simon Fraser.
If the new or the old RenderStyle includes a transform, the renderer of
the SVG element needs to be repainted.
Test: svg/css/svg-css-transform-dynamic-remove.html
* rendering/svg/RenderSVGModelObject.cpp:
(WebCore::RenderSVGModelObject::styleDidChange):
2021-05-12 Sam Weinig <weinig@apple.com>
Remove inline annoatations for static functions in PixelBufferConversion
https://bugs.webkit.org/show_bug.cgi?id=225708
Reviewed by Darin Adler.
Remove inline annoatations for static functions in PixelBufferConversion
as suggested by Darin. The theory here is that outside of a header, the
use of 'inline' serves no purpose as the compiler is perfectly allowed
and capable of inlining these functions.
* platform/graphics/PixelBufferConversion.cpp:
(WebCore::makeVImageBuffer):
(WebCore::convertImagePixelsAccelerated):
(WebCore::convertSinglePixelPremultipliedToPremultiplied):
(WebCore::convertSinglePixelPremultipliedToUnpremultiplied):
(WebCore::convertSinglePixelUnpremultipliedToPremultiplied):
(WebCore::convertSinglePixelUnpremultipliedToUnpremultiplied):
(WebCore::convertFunctor):
2021-05-12 Alex Christensen <achristensen@webkit.org>
Use HashSet<RefPtr<Node>> instead of HashSet<Node*>
https://bugs.webkit.org/show_bug.cgi?id=220464
Reviewed by Chris Dumez and Ryosuke Niwa.
This makes us more resistent to lifetime bugs.
liveNodeSet() and ignoreSet() need to be WeakHashSet, and they are only used in debug builds so that's fine.
MutationObserver::observedNodes() is not called on the main thread, but it's called during garbage collection.
I replaced it with MutationObserver::isReachableFromOpaqueRoots which eliminates the HashSet allocation and hashing,
and it can return true early if it finds a contained opaque root, resulting in less work in several ways.
This should only increase our performance slightly while getting the same behavior.
* accessibility/AXObjectCache.cpp:
(WebCore::conditionallyAddNodeToFilterList):
(WebCore::filterVectorPairForRemoval):
(WebCore::filterMapForRemoval):
(WebCore::filterListForRemoval):
(WebCore::AXObjectCache::prepareForDocumentDestruction):
* bindings/js/JSMutationObserverCustom.cpp:
(WebCore::JSMutationObserverOwner::isReachableFromOpaqueRoots):
* dom/MutationObserver.cpp:
(WebCore::MutationObserver::isReachableFromOpaqueRoots const):
(WebCore:: const): Deleted.
* dom/MutationObserver.h:
* dom/MutationObserverRegistration.cpp:
(WebCore::MutationObserverRegistration::isReachableFromOpaqueRoots const):
(WebCore::MutationObserverRegistration::addRegistrationNodesToSet const): Deleted.
* dom/MutationObserverRegistration.h:
* dom/Node.cpp:
(WebCore::liveNodeSet):
(WebCore::stringForRareDataUseType):
(WebCore::Node::dumpStatistics):
(WebCore::ignoreSet):
(WebCore::Node::trackForDebugging):
(WebCore::Node::~Node):
* editing/AppendNodeCommand.cpp:
(WebCore::AppendNodeCommand::getNodesInCommand):
* editing/AppendNodeCommand.h:
* editing/CompositeEditCommand.cpp:
(WebCore::EditCommandComposition::getNodesInCommand):
* editing/CompositeEditCommand.h:
* editing/DeleteFromTextNodeCommand.cpp:
(WebCore::DeleteFromTextNodeCommand::getNodesInCommand):
* editing/DeleteFromTextNodeCommand.h:
* editing/EditCommand.cpp:
(WebCore::SimpleEditCommand::addNodeAndDescendants):
* editing/EditCommand.h:
* editing/InsertIntoTextNodeCommand.cpp:
(WebCore::InsertIntoTextNodeCommand::getNodesInCommand):
* editing/InsertIntoTextNodeCommand.h:
* editing/InsertNodeBeforeCommand.cpp:
(WebCore::InsertNodeBeforeCommand::getNodesInCommand):
* editing/InsertNodeBeforeCommand.h:
* editing/MergeIdenticalElementsCommand.cpp:
(WebCore::MergeIdenticalElementsCommand::getNodesInCommand):
* editing/MergeIdenticalElementsCommand.h:
* editing/RemoveNodeCommand.cpp:
(WebCore::RemoveNodeCommand::getNodesInCommand):
* editing/RemoveNodeCommand.h:
* editing/ReplaceNodeWithSpanCommand.cpp:
(WebCore::ReplaceNodeWithSpanCommand::getNodesInCommand):
* editing/ReplaceNodeWithSpanCommand.h:
* editing/SetNodeAttributeCommand.cpp:
(WebCore::SetNodeAttributeCommand::getNodesInCommand):
* editing/SetNodeAttributeCommand.h:
* editing/SetSelectionCommand.h:
* editing/SpellingCorrectionCommand.cpp:
* editing/SplitElementCommand.cpp:
(WebCore::SplitElementCommand::getNodesInCommand):
* editing/SplitElementCommand.h:
* editing/SplitTextNodeCommand.cpp:
(WebCore::SplitTextNodeCommand::getNodesInCommand):
* editing/SplitTextNodeCommand.h:
* editing/WrapContentsInDummySpanCommand.cpp:
(WebCore::WrapContentsInDummySpanCommand::getNodesInCommand):
* editing/WrapContentsInDummySpanCommand.h:
* editing/cocoa/HTMLConverter.mm:
(HTMLConverterCaches::cacheAncestorsOfStartToBeConverted):
* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::highlightSelector):
* xml/XPathFunctions.cpp:
(WebCore::XPath::FunId::evaluate const):
* xml/XPathNodeSet.cpp:
(WebCore::XPath::sortBlock):
(WebCore::XPath::NodeSet::traversalSort const):
* xml/XPathPath.cpp:
(WebCore::XPath::LocationPath::evaluate const):
* xml/XPathPredicate.cpp:
(WebCore::XPath::Union::evaluate const):
2021-05-12 Jer Noble <jer.noble@apple.com>
HTMLMediaElement::mediaLoadingFailedFatally() does direct dispatch of events; should enqueue
https://bugs.webkit.org/show_bug.cgi?id=225700
<rdar://75576322>
Reviewed by Eric Carlson.
In r274559, an update was made to mediaLoadingFailedFatally to adopt recent spec changes, and as
part of that change, an "error" event was changed from being enqueued to being directly dispatched.
However, directly dispatching events exposes the element to JS and has the potential to cause the
element to be garbage collected, deleting the object and potentially other objects in the backtrace.
Events should always be enqueued, rather than directy dispatched, for this reason.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaLoadingFailedFatally):
2021-05-12 Sergio Villar Senin <svillar@igalia.com>
ASSERTION FAILED: m_clients.contains(&client) in CSSFontFace::removeClient via CSSSegmentedFontFace::~CSSSegmentedFontFace()
https://bugs.webkit.org/show_bug.cgi?id=223790
Reviewed by Ryosuke Niwa.
CSSFontFace does not support adding the same client twice as it uses a HashSet to track them. This means that
it's a mistake to call removeClient() more than once. This could happen when specifying the same font
family more than once in a <font-face> element inside a svg container.
Test: fast/css/svg-font-face-duplicate-crash.html
* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::fontFace): Skip duplicate CSSFontFace's when before calling appendFontFace().
2021-05-12 Chris Dumez <cdumez@apple.com>
Queue notification permission requests for the same origin on WebKit side
https://bugs.webkit.org/show_bug.cgi?id=225701
<rdar://76804977>
Reviewed by Geoffrey Garen.
Remove some dead code.
* Modules/notifications/NotificationClient.h:
2021-05-12 Ryosuke Niwa <rniwa@webkit.org>
REGRESSION: Release assert in SlotAssignment::assignedNodesForSlot via ComposedTreeIterator::traverseNextInShadowTree
in Element::insertedIntoAncestor
https://bugs.webkit.org/show_bug.cgi?id=225684
Reviewed by Darin Adler.
The release assertion failure was caused by RenderTreeUpdater::tearDownRenderers end up traversing the parts of the DOM
for which Element::insertedIntoAncestor had not been called yet. Since HTMLSlotElement::insertedIntoAncestor is where
SlotAssignment::Slot is updated for a newly inserted slot, SlotAssignment::Slot may not contain this slot element.
Fixed the bug by returning early in SlotAssignment::assignedNodesForSlot when this condition holds, which is when
the shadow root is connected to a document but HTMLSlotElement isn't since its connected flag has not been updated yet.
Test: fast/shadow-dom/insert-host-child-with-slot-renderer-teardown-crash.html
* dom/SlotAssignment.cpp:
(WebCore::SlotAssignment::assignedNodesForSlot):
2021-05-12 Peng Liu <peng.liu6@apple.com>
Implement TextTrackPrivateRemote::inBandMetadataTrackDispatchType()
https://bugs.webkit.org/show_bug.cgi?id=225674
Reviewed by Eric Carlson.
Remove an unused function in `InbandTextTrackPrivate`.
* platform/graphics/InbandTextTrackPrivate.h:
(WebCore::InbandTextTrackPrivate::textTrackIndex const): Deleted.
2021-05-12 Sergio Villar Senin <svillar@igalia.com>
[css-flexbox] Do not use margins when computing aspect ratio cross sizes
https://bugs.webkit.org/show_bug.cgi?id=221210
Reviewed by Javier Fernandez.
In r270578 we implemented section 9.8.1 of the flexbox specs which allowed us to compute child's
indefinite cross sizes as definite when the flexbox container had a definite cross size and a couple
of other conditions. However we did not take into account that the child might have some margins in
in the cross direction. Aspect ratio computations must use the content box and thus, we need to
substract the margin extent before trying to compute a cross size based on an aspect ratio.
Note that when computeMainSizeFromAspectRatioUsing() is called the child might not have been ever
laid out. This means that the margins wouldn't have been computed and thus marginXXX() would always
return 0. That's why crossAxisMarginExtentForChild() was also modified so that it actually computes
the margins in case the child needs to be laid out.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::crossAxisMarginExtentForChild const):
(WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing const):
2021-05-12 Sam Weinig <weinig@apple.com>
Factor copyImagePixels pixel conversion code into its own file
https://bugs.webkit.org/show_bug.cgi?id=225673
Reviewed by Darin Adler.
Removes virtual ImageBufferBackend::copyImagePixels() function and
moves functionality to new PixelBufferConversion.h/cpp.
Merge USE(ACCELERATE) code from ImageBufferCGBackend into the same
file and do some light cleanup.
- Function renamed to covert convertImagePixels to convey that it is
doing more than copying.
- Add PixelBufferConversionView/ConstPixelBufferConversionView structs
to hold parameters for the conversions, including a ColorSpace member
that is not yet used but will be shortly.
- Uses constexpr conditionals in unaccelerated cases to hoist branch
checking for pixel format conversion requirements outside the main
loop.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
Add new files.
* platform/graphics/PixelBufferConversion.cpp: Added.
(WebCore::makeVImageBuffer):
(WebCore::convertImagePixelsAccelerated):
(WebCore::convertSinglePixelPremultipliedToPremultiplied):
(WebCore::convertSinglePixelPremultipliedToUnpremultiplied):
(WebCore::convertSinglePixelUnpremultipliedToPremultiplied):
(WebCore::convertSinglePixelUnpremultipliedToUnpremultiplied):
(WebCore::convertFunctor):
(WebCore::convertImagePixels):
* platform/graphics/PixelBufferConversion.h: Added.
Move existing copyImagePixels implementations here.
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::toBGRAData const):
(WebCore::ImageBufferBackend::getPixelBuffer const):
(WebCore::ImageBufferBackend::putPixelBuffer):
(WebCore::copyPremultipliedToPremultiplied): Deleted.
(WebCore::copyPremultipliedToUnpremultiplied): Deleted.
(WebCore::copyUnpremultipliedToPremultiplied): Deleted.
(WebCore::copyUnpremultipliedToUnpremultiplied): Deleted.
(WebCore::copyFunctor): Deleted.
(WebCore::ImageBufferBackend::copyImagePixels const): Deleted.
* platform/graphics/ImageBufferBackend.h:
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::makeVImageBuffer): Deleted.
(WebCore::copyImagePixelsAccelerated): Deleted.
(WebCore::ImageBufferCGBackend::copyImagePixels const): Deleted.
* platform/graphics/cg/ImageBufferCGBackend.h:
Remove existing copyImagePixels() implementation and call new
convertImagePixels() instead.
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::copyUnmultipliedResult):
(WebCore::FilterEffect::copyPremultipliedResult):
(WebCore::FilterEffect::createUnmultipliedImageResult):
(WebCore::FilterEffect::createPremultipliedImageResult):
Fix pixel format for the PixelBuffers to match existing behaviors.
These are not being used at the moment but will in the future
and new assert in putPixelBuffer caught these being incorrect.
2021-05-12 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r277320 and r277329.
https://bugs.webkit.org/show_bug.cgi?id=225698
Added broken test fast/css/visited-link-mix-blend-mode.html
Reverted changesets:
"Don't allow :visited link style in subtrees that use mix-
blend-mode"
https://bugs.webkit.org/show_bug.cgi?id=225446
https://trac.webkit.org/changeset/277320
"Don't allow :visited link style in subtrees that use mix-
blend-mode"
https://bugs.webkit.org/show_bug.cgi?id=225446
https://trac.webkit.org/changeset/277329
2021-05-12 Jean-Yves Avenard <jya@apple.com>
Adopt CoreMedia SPI to identify audio-only playback for MSE clients
https://bugs.webkit.org/show_bug.cgi?id=225647
rdar://76138365
Reviewed by Youenn Fablet.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
tells whether the AVSBAR is attached to an <audio> or <video> element.
2021-05-12 Youenn Fablet <youenn@apple.com>
Introduce an internal unit to render audio MediaStreamTrack(s)
https://bugs.webkit.org/show_bug.cgi?id=225601
Reviewed by Eric Carlson.
Move files from platform/mediastream/mac to platform/mediastream/cocoa since they are used in both iOS and macOS.
Move Audio Unit functionality out of AudioMediaStreamTrackRendererUnit.
AudioMediaStreamTrackRendererUnit is responsible to manage sources and do the mixing.
To actually render audio, it will use an InternalUnit, which is currently done in process.
A future work will add support for a remote InternalUnit, that would run on GPUProcess.
To prepare for that, a callback allows customizing the Internal Unit creation.
We also change renderer start to be asynchronous, since it requires fetching the audio description from GPUProcess.
No change of behavior, covered by existing tests.
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/audio/cocoa/AudioSampleBufferList.h:
* platform/mediastream/AudioMediaStreamTrackRenderer.h:
* platform/mediastream/AudioTrackPrivateMediaStream.cpp:
(WebCore::AudioTrackPrivateMediaStream::startRenderer):
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererCocoa.cpp: Renamed from Source/WebCore/platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.cpp.
(WebCore::AudioMediaStreamTrackRendererCocoa::start):
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererCocoa.h: Copied from Source/WebCore/platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.h.
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererInternalUnit.cpp: Renamed from Source/WebCore/platform/mediastream/mac/AudioMediaStreamTrackRendererUnit.cpp.
(WebCore::AudioMediaStreamTrackRendererInternalUnit::createLocalInternalUnit):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::LocalAudioMediaStreamTrackRendererInternalUnit):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::retrieveFormatDescription):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::setAudioOutputDevice):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::start):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::stop):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::createAudioUnitIfNeeded):
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::renderingCallback):
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererInternalUnit.h: Renamed from Source/WebCore/platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.h.
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.cpp: Added.
(WebCore::getCreateInternalUnitFunction):
(WebCore::AudioMediaStreamTrackRendererUnit::setCreateInternalUnitFunction):
(WebCore::createInternalUnit):
(WebCore::AudioMediaStreamTrackRendererUnit::singleton):
(WebCore::AudioMediaStreamTrackRendererUnit::AudioMediaStreamTrackRendererUnit):
(WebCore::AudioMediaStreamTrackRendererUnit::~AudioMediaStreamTrackRendererUnit):
(WebCore::AudioMediaStreamTrackRendererUnit::setAudioOutputDevice):
(WebCore::AudioMediaStreamTrackRendererUnit::addSource):
(WebCore::AudioMediaStreamTrackRendererUnit::removeSource):
(WebCore::AudioMediaStreamTrackRendererUnit::start):
(WebCore::AudioMediaStreamTrackRendererUnit::stop):
(WebCore::AudioMediaStreamTrackRendererUnit::retrieveFormatDescription):
(WebCore::AudioMediaStreamTrackRendererUnit::render):
* platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.h: Renamed from Source/WebCore/platform/mediastream/mac/AudioMediaStreamTrackRendererUnit.h.
2021-05-12 Youenn Fablet <youenn@apple.com>
Enumerate AVCaptureDevice list in a background thread
https://bugs.webkit.org/show_bug.cgi?id=225643
<rdar://problem/77820002>
Reviewed by Eric Carlson.
Enumerate AVCaptureDevice in a background queue asynchronously.
Delay getUserMedia and enumerateDevices until this is completed.
Update RealtimeMediaSourceCenter accordingly and introduce RealtimeMediaSourceCenter::enumerateDevices for that purpose.
Replace getCaptureDevices by computeCaptureDevices to do the async computation.
Continue using captureDevices() getters.
Manually tested.
* platform/mediastream/CaptureDevice.h:
(WebCore::CaptureDevice::CaptureDevice):
(WebCore::CaptureDevice::isolatedCopy):
* platform/mediastream/CaptureDeviceManager.h:
* platform/mediastream/RealtimeMediaSourceCenter.cpp:
(WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices):
(WebCore::RealtimeMediaSourceCenter::enumerateDevices):
(WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
(WebCore::RealtimeMediaSourceCenter::validateRequestConstraintsAfterEnumeration):
* platform/mediastream/RealtimeMediaSourceCenter.h:
* platform/mediastream/RealtimeMediaSourceFactory.h:
(WebCore::AudioCaptureFactory::computeSpeakerDevices const):
* platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
(WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice):
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
(WebCore::AVAudioSessionCaptureDeviceManager::scheduleUpdateCaptureDevices):
(WebCore::AVAudioSessionCaptureDeviceManager::computeCaptureDevices):
* platform/mediastream/mac/AVCaptureDeviceManager.h:
* platform/mediastream/mac/AVCaptureDeviceManager.mm:
(WebCore::AVCaptureDeviceManager::computeCaptureDevices):
(WebCore::AVCaptureDeviceManager::captureDevices):
(WebCore::AVCaptureDeviceManager::updateCachedAVCaptureDevices):
(WebCore::AVCaptureDeviceManager::retrieveCaptureDevices):
(WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
(WebCore::AVCaptureDeviceManager::AVCaptureDeviceManager):
2021-05-11 Cameron McCormack <heycam@apple.com>
Include reasons for compositing in showLayerTree output
https://bugs.webkit.org/show_bug.cgi?id=225640
Reviewed by Simon Fraser.
Since it seems useful to know why a layer is composited.
The logging code was only including one reason, rather than the
whole set of reasons, and that's unchanged (except for the function
name to make that clearer), although we could also just make that
include all of the reasons too.
There were two reason strings missing, which are also added --
OverflowScrollPositioning and WillChange -- which the use of a
switch should help catch in the future.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::logLayerInfo):
(WebCore::compositingReasonToString):
(WebCore::RenderLayerCompositor::logReasonsForCompositing):
(WebCore::operator<<):
* rendering/RenderLayerCompositor.h:
* rendering/RenderTreeAsText.cpp:
2021-05-11 Chris Dumez <cdumez@apple.com>
Port WTF::FileSystem::listDirectory to std::filesystem
https://bugs.webkit.org/show_bug.cgi?id=225633
Reviewed by Darin Adler.
Update FileSystem::listDirectory() call sites to deal with the fact that:
- The function now returns file names instead of full file paths
- The callers now have to do filtering by themselves if they need it
* Modules/entriesapi/DOMFileSystem.cpp:
(WebCore::listDirectoryWithMetadata):
* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::getAllDatabaseNamesAndVersions):
(WebCore::IDBServer::collectOriginsForVersion):
(WebCore::IDBServer::removeAllDatabasesForFullOriginPath):
(WebCore::IDBServer::removeAllDatabasesForOriginPath):
(WebCore::IDBServer::IDBServer::removeDatabasesModifiedSinceForVersion):
(WebCore::IDBServer::IDBServer::removeDatabasesWithOriginsForVersion):
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::fullDatabaseDirectoryWithUpgrade):
(WebCore::IDBServer::SQLiteIDBBackingStore::databasesSizeForDirectory):
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::usage):
(WebCore::DatabaseTracker::deleteOrigin):
* html/DirectoryFileListCreator.cpp:
(WebCore::appendDirectoryFiles):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback):
(WebCore::MediaPlayerPrivateGStreamer::purgeOldDownloadFiles):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* platform/text/hyphen/HyphenationLibHyphen.cpp:
(WebCore::extractLocaleFromDictionaryFileName):
(WebCore::scanDirectoryForDictionaries):
2021-05-11 Chris Dumez <cdumez@apple.com>
Add SPI to suspend / resume a WKWebView
https://bugs.webkit.org/show_bug.cgi?id=225333
<rdar://77462543>
Reviewed by Geoff Garen.
Add new function to BackForwardCache to suspend a page and return a CachedPage
instead of requiring a HistoryItem and storing the CachedPage on that history
item. This is useful when we want to suspend the page in-place and do not want
to require a history item (or a navigation).
* Headers.cmake:
* history/BackForwardCache.cpp:
(WebCore::BackForwardCache::trySuspendPage):
(WebCore::BackForwardCache::addIfCacheable):
(WebCore::BackForwardCache::suspendPage):
* history/BackForwardCache.h:
* history/CachedPage.h:
2021-05-11 Darin Adler <darin@apple.com>
Remove the String::toInt family of functions
https://bugs.webkit.org/show_bug.cgi?id=225599
Reviewed by Anders Carlsson.
* platform/graphics/GLContext.cpp:
(WebCore::GLContext::version): Use
parseIntegerAllowingTrailingJunk<unsigned> instead of String::toUInt.
* platform/graphics/GlyphBuffer.h:
(WebCore::GlyphBuffer::checkedStringOffsetAt const): Fix code that was
assuming GlyphBufferStringOffset was signed to compile without a warning
regardless of whether it's signed or unsigned. This was making GTK
builds have tons and tons of warnings, which was distracting while
working on the other fixes here.
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(CachedResourceStreamingClient::responseReceived): Use
parseIntegerAllowingTrailingJunk<uint64_t> instead of String::toUInt64.
2021-05-11 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r277341.
https://bugs.webkit.org/show_bug.cgi?id=225685
Caused WK2 layout tests to exit with an exception
Reverted changeset:
"Add SPI to suspend / resume a WKWebView"
https://bugs.webkit.org/show_bug.cgi?id=225333
https://trac.webkit.org/changeset/277341
2021-05-11 Simon Fraser <simon.fraser@apple.com>
Display-frequency animations in ScrollController should be externally driven
https://bugs.webkit.org/show_bug.cgi?id=225663
Reviewed by Tim Horton.
Display-frequency animations (i.e. those driven by 1/60_s timers) should ultimately
be driven by Page::updateRendering(), since their output should be synchronized with
rendering updates.
As the first step, remove m_snapRubberbandTimer and m_scrollSnapTimer from
ScrollController and have it expose functions that tell its client to start and stop
the animation, and a per-frame callback. Give ScrollAnimator a 1/60_s timer
to drive this, temporarily.
* page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
* page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
(WebCore::ScrollingTreeScrollingNodeDelegateMac::startAnimationCallback):
(WebCore::ScrollingTreeScrollingNodeDelegateMac::stopAnimationCallback):
(WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollControllerAnimationTimerFired):
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::ScrollAnimator):
(WebCore::ScrollAnimator::startAnimationCallback):
(WebCore::ScrollAnimator::stopAnimationCallback):
(WebCore::ScrollAnimator::scrollControllerAnimationTimerFired):
* platform/ScrollAnimator.h:
* platform/ScrollController.cpp:
(WebCore::ScrollController::animationCallback):
(WebCore::ScrollController::startOrStopAnimationCallbacks):
(WebCore::ScrollController::setIsAnimatingRubberBand):
(WebCore::ScrollController::setIsAnimatingScrollSnap):
(WebCore::ScrollController::updateScrollSnapAnimatingState):
(WebCore::ScrollController::updateRubberBandAnimatingState):
* platform/ScrollController.h:
* platform/ScrollSnapAnimatorState.cpp:
(WebCore::ScrollSnapAnimatorState::currentAnimatedScrollOffset const):
* platform/ScrollSnapAnimatorState.h:
* platform/mac/ScrollController.mm:
(WebCore::ScrollController::stopAllTimers):
(WebCore::ScrollController::handleWheelEvent):
(WebCore::ScrollController::updateRubberBandAnimatingState):
(WebCore::ScrollController::isScrollSnapInProgress const):
(WebCore::ScrollController::stopRubberbanding):
(WebCore::ScrollController::startRubberbandAnimation):
(WebCore::ScrollController::stopSnapRubberbandAnimation):
(WebCore::ScrollController::snapRubberBand):
(WebCore::ScrollController::isRubberBandInProgressInternal const):
(WebCore::ScrollController::scheduleStatelessScrollSnap):
(WebCore::ScrollController::statelessSnapTransitionTimerFired):
(WebCore::ScrollController::processWheelEventForScrollSnap):
(WebCore::ScrollController::startScrollSnapAnimation):
(WebCore::ScrollController::stopScrollSnapAnimation):
(WebCore::ScrollController::updateScrollSnapAnimatingState):
(WebCore::ScrollController::snapRubberBandTimerFired): Deleted.
(WebCore::ScrollController::startSnapRubberbandTimer): Deleted.
(WebCore::ScrollController::stopSnapRubberbandTimer): Deleted.
(WebCore::ScrollController::startScrollSnapTimer): Deleted.
(WebCore::ScrollController::stopScrollSnapTimer): Deleted.
(WebCore::ScrollController::scrollSnapTimerFired): Deleted.
2021-05-11 Geoffrey Garen <ggaren@apple.com>
Function.prototype.toString triggers page demand on Speedometer
https://bugs.webkit.org/show_bug.cgi?id=225678
Reviewed by Mark Lam.
Some JS libraries -- e.g. jQuery, Ember-Debug, Angular -- like to
toString() JS functions in order to enforce return type, argument type,
or deprecation invariants. This triggers pathological page demand if
we keep throwing away the underlying script string.
* loader/cache/CachedResource.cpp:
(WebCore::deadDecodedDataDeletionIntervalForResourceType): Let's try 5s.
2021-05-11 Toshio Ogasawara <toshio.ogasawara@access-company.com>
[MSE] QuotaExceededError Exception not thrown even if the sum of totalTrackBufferSize and appendBuffer size exceeds maximumBufferSize.
https://bugs.webkit.org/show_bug.cgi?id=225630
Reviewed by Eric Carlson.
Test: media/media-source/media-source-append-buffer-full-quota-exceeded-error.html
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::appendBufferInternal):
* platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::evictCodedFrames):
* platform/graphics/SourceBufferPrivate.h:
2021-05-11 Sihui Liu <sihui_liu@apple.com>
Use one VM per thread for IDB serialization work
https://bugs.webkit.org/show_bug.cgi?id=225658
Reviewed by Chris Dumez.
The vm map in IDBSerializationContext uses sessionID as key instead of thread identifier. Normally IDB has one
thread per session (see WebIDBServer and CrossThreadTaskHandler), so we are using one vm per thread. With
r275799, we remove WebIDBServer more aggressively (when no web process is not using IDB) to make sure its thread
does not stay around, and WebIDBServer will be destroyed after it finishes scheduled tasks on the background
thread. Then, it's possible that while a WebIDBServer for some session is removed and finishing last tasks,
a new IDB request for the same session comes in and we create a new WebIDBServer for the session. In this case,
two threads ends up using the same VM.
VM is generally not designed to be used on multiple threads, otherwise we need to acquire lock for each
WTF::String operation to get correct AtomStringTable. So let's just make sure we are using one VM per thread by
making the map in IDBSerializationContext keyed by thread pointer.
New API test: IndexedDB.OneVMPerThread
* Modules/indexeddb/server/IDBSerializationContext.cpp:
(WebCore::IDBServer::IDBSerializationContext::getOrCreateIDBSerializationContext):
(WebCore::IDBServer::IDBSerializationContext::~IDBSerializationContext):
(WebCore::IDBServer::IDBSerializationContext::vm):
(WebCore::IDBServer::IDBSerializationContext::globalObject):
(WebCore::IDBServer::IDBSerializationContext::IDBSerializationContext):
* Modules/indexeddb/server/IDBSerializationContext.h:
* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::MemoryIDBBackingStore):
* Modules/indexeddb/server/MemoryObjectStore.cpp:
(WebCore::IDBServer::MemoryObjectStore::MemoryObjectStore):
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::SQLiteIDBBackingStore):
2021-05-11 Chris Dumez <cdumez@apple.com>
Add SPI to suspend / resume a WKWebView
https://bugs.webkit.org/show_bug.cgi?id=225333
<rdar://77462543>
Reviewed by Geoffrey Garen.
Add new function to BackForwardCache to suspend a page and return a CachedPage
instead of requiring a HistoryItem and storing the CachedPage on that history
item. This is useful when we want to suspend the page in-place and do not want
to require a history item (or a navigation).
* Headers.cmake:
* history/BackForwardCache.cpp:
(WebCore::BackForwardCache::trySuspendPage):
(WebCore::BackForwardCache::addIfCacheable):
(WebCore::BackForwardCache::suspendPage):
* history/BackForwardCache.h:
* history/CachedPage.h:
2021-05-11 Alex Christensen <achristensen@webkit.org>
Add SPI to restrict networking to a set of hosts
https://bugs.webkit.org/show_bug.cgi?id=225426
<rdar://77571521>
Reviewed by Tim Horton.
In r259392 I added SPI to turn network access on and off, but a client needs finer grained control.
This uses the same infrastructure to add a set of hosts to allow. Setting it to nil (the default) allows all hosts,
but setting it to an empty set allows no network access. This accomplishes the same ability as the old SPI, so I'm deprecating it
with this as a replacement. The new ability to specify a finite number of hosts to allow creates a limited WKWebView.
* 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::loadsFromNetwork const): Deleted.
* page/PageConfiguration.h:
2021-05-11 Megan Gardner <megan_gardner@apple.com>
Factor out find bounce layer
https://bugs.webkit.org/show_bug.cgi?id=225557
Reviewed by Tim Horton.
Factor out the text indicator bounce layer in preparation of making this
compatable with iOS.
No behavior change.
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* page/mac/TextIndicatorWindow.h:
* page/mac/TextIndicatorWindow.mm:
(WebCore::TextIndicatorWindow::setAnimationProgress):
(WebCore::TextIndicatorWindow::clearTextIndicator):
(WebCore::TextIndicatorWindow::setTextIndicator):
(WebCore::TextIndicatorWindow::closeWindow):
(WebCore::TextIndicatorWindow::startFadeOut):
(indicatorWantsBounce): Deleted.
(indicatorWantsContentCrossfade): Deleted.
(indicatorWantsFadeIn): Deleted.
(indicatorWantsManualAnimation): Deleted.
(-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]): Deleted.
(createBounceAnimation): Deleted.
(createContentCrossfadeAnimation): Deleted.
(createShadowFadeAnimation): Deleted.
(createFadeInAnimation): Deleted.
(-[WebTextIndicatorView _animationDuration]): Deleted.
(-[WebTextIndicatorView hasCompletedAnimation]): Deleted.
(-[WebTextIndicatorView present]): Deleted.
(-[WebTextIndicatorView hideWithCompletionHandler:]): Deleted.
(-[WebTextIndicatorView setAnimationProgress:]): Deleted.
(-[WebTextIndicatorView isFlipped]): Deleted.
2021-05-11 Antti Koivisto <antti@apple.com>
Don't allow :visited link style in subtrees that use mix-blend-mode
https://bugs.webkit.org/show_bug.cgi?id=225446
rdar://65686091
Unreviewed build fix.
* rendering/style/RenderStyle.h:
2021-05-11 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r277322.
https://bugs.webkit.org/show_bug.cgi?id=225657
Causing build failure
Reverted changeset:
"Adopt CoreMedia SPI to identify audio-only playback for MSE
clients"
https://bugs.webkit.org/show_bug.cgi?id=225647
https://trac.webkit.org/changeset/277322
2021-05-11 Zalan Bujtas <zalan@apple.com>
REGRESSION(r275515): wpt/quirks/blocks-ignore-line-height.html
https://bugs.webkit.org/show_bug.cgi?id=225591
<rdar://problem/77766308>
Reviewed by Antti Koivisto.
Replace the generic line height quirk with a list-item specific one.
The original quirk was added to cover fast/lists/list-item-line-height.html but it looks like
it only needs a list-item specific quirk. This is copied from legacy line layout (see InlineFlowBox c'tor).
Test: fast/inline/line-height-in-non-standards-mode.html
* layout/formattingContexts/inline/InlineFormattingContextQuirks.cpp:
(WebCore::Layout::InlineFormattingContext::Quirks::inlineLevelBoxAffectsLineBox const):
* layout/integration/LayoutIntegrationBoxTree.cpp:
(WebCore::LayoutIntegration::rootBoxStyle):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::isOriginalDisplayListItemType const):
(WebCore::RenderStyle::isDisplayListItemType):
2021-05-11 Zalan Bujtas <zalan@apple.com>
[LFC][Integration] Disable IFC when inline level box has box shadow
https://bugs.webkit.org/show_bug.cgi?id=225634
Reviewed by Darin Adler.
Needs painting support.
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForChild):
2021-05-11 Jean-Yves Avenard <jya@apple.com>
Adopt CoreMedia SPI to identify audio-only playback for MSE clients
https://bugs.webkit.org/show_bug.cgi?id=225647
rdar://76138365
Reviewed by Youenn Fablet.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
tells whether the AVSBAR is attached to an <audio> or <video> element.
2021-05-11 Cathie Chen <cathiechen@igalia.com>
[CSS contain] Support contain:size
https://bugs.webkit.org/show_bug.cgi?id=223570
Reviewed by Alan Bujtas.
This patch brings initial support of CSS contain:size according to [1].
It adds shouldApplySizeContainment() to indicate whether the object is a size containment box.
The intrinsic sizes of size containment box are determined as if it had no content.
So the implementation need to cooperate with the layout steps:
- Computing logical width: Size containment boxes skip handling children while computing minLogicalWidth
and maxLogicalWidth in computeIntrinsicLogicalWidths. So the logical width is not affected by children.
- Layout children: The logical height is changed after layout all children.
- Computing logical height: At the beginning, size containment boxes need to reset logical height to the empty content height
if it is not renderGrid. So the logical height is not affected by children.
We also need to calculate the sizes according to the layout algorithms.
- Grid layout:
To calculate the minLogicalWidth and maxLogicalWidth for indefinite size RenderGrid.
The widths are calculated by GridTrackSizingAlgorithm: m_minContentSize and m_maxContentSize which are the sum of
m_baseSize/m_growthLimit of all GridTracks. The size containment RenderGrid skips handling content in resolveIntrinsicTrackSizes
and the m_maxContentSize will be the sum of m_baseSize. The logical height is same to width, but after calculating
RenderGrid's logical height, it needs to calculate the track sizes again, to make sure that they are distributed properly.
We use computeTrackSizesForDefiniteSize(ForRows, trackBasedLogicalHeight) to recalculate it.
- MultiColumn layout:
According to the specification, size containment boxes should be monolithic, so we need to extend column height
for overflow and positioned size containment boxes. m_spaceShortageForSizeContainment is added to indicate the shortage space
that need to balance the column heights. adjustSizeContainmentChildForPagination() will calculate the shortage.
[1] https://www.w3.org/TR/css-contain-1/#containment-size
* rendering/GridTrackSizingAlgorithm.cpp: Add isComputingSizeContainment to indicate if it is calculating sizes
for indefinite size RenderGrid which is size containment.
(WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild const):
(WebCore::GridTrackSizingAlgorithm::computeGridContainerIntrinsicSizes):
It skips resolveIntrinsicTrackSizes if isComputingSizeContainment, so growthLimit might be undefined,
if so, use track.baseSize() instead.
(WebCore::GridTrackSizingAlgorithm::resolveIntrinsicTrackSizes): Skip resolve the content if isComputingSizeContainment().
(WebCore::GridTrackSizingAlgorithm::advanceNextState): Added RowSizingExtraIterationForSizeContainment.
(WebCore::GridTrackSizingAlgorithm::isValidTransition const):
(WebCore::GridTrackSizingAlgorithm::run): Do not stretch the track sizes if isComputingSizeContainment().
* rendering/GridTrackSizingAlgorithm.h:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layoutPositionedObject): Calculate m_spaceShortageForSizeContainment for positioned size containment.
(WebCore::RenderBlock::computeIntrinsicLogicalWidths const): Skip computeBlockPreferredLogicalWidths if shouldApplySizeContainment.
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths const): Skip handling the children for size containment box.
(WebCore::RenderBlockFlow::adjustBlockChildForPagination): Calculate m_spaceShortageForSizeContainment for child.
(WebCore::RenderBlockFlow::adjustSizeContainmentChildForPagination): m_spaceShortageForSizeContainment = childOverflowHeight - remainingLogicalHeight.
* rendering/RenderBlockFlow.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::updateLogicalHeight): Reset the logical height to empty content height for size containment box.
(WebCore::RenderBox::isUnsplittableForPagination const): Size containment box is unsplittable.
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::computeIntrinsicLogicalWidths const): Ditto.
* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths const): Ditto.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths const): Ditto.
* rendering/RenderFragmentedFlow.h:
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::layoutBlock): If it is size containment with infiniteSize, using trackBasedLogicalHeight
to compute track sizes again to make sure the height is distributed properly.
(WebCore::RenderGrid::computeEmptyTracksForAutoRepeat const): Collapse if shouldApplySizeContainment.
* rendering/RenderImage.cpp:
(WebCore::RenderImage::computeIntrinsicRatioInformation const): This is handled in RenderReplaced::computeIntrinsicRatioInformation instead.
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::computeIntrinsicLogicalWidths const): The widths of size containment boxes are optionsSpacingHorizontal.
* rendering/RenderMenuList.cpp:
(RenderMenuList::computeIntrinsicLogicalWidths const): The widths of size containment box are theme.minimumMenuListSize.
* rendering/RenderMultiColumnFlow.cpp:
(WebCore::RenderMultiColumnFlow::updateSpaceShortageForSizeContainment): Set m_spaceShortageForSizeContainment.
* rendering/RenderMultiColumnFlow.h:
* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::RenderMultiColumnSet):
(WebCore::RenderMultiColumnSet::calculateBalancedHeight const): Add m_spaceShortageForSizeContainment to the column height.
(WebCore::RenderMultiColumnSet::prepareForLayout): Reset m_spaceShortageForSizeContainment.
* rendering/RenderMultiColumnSet.h:
* rendering/RenderObject.cpp:
(WebCore::shouldApplySizeContainment): Check if the object is a size containment box.
* rendering/RenderObject.h:
(WebCore::RenderObject::isAtomicInlineLevelBox const):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeAspectRatioInformationForRenderBox const):
(WebCore::RenderReplaced::computeIntrinsicRatioInformation const): Use the empty intrinsicSize.
* rendering/RenderReplaced.h: The intrinsicSize of size containment is (0, 0).
* rendering/RenderSlider.cpp:
(WebCore::RenderSlider::computeIntrinsicLogicalWidths const): Ditto.
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::computeIntrinsicLogicalWidths const): Ditto.
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::calculateIntrinsicSize): Ditto.
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::containsSize const):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::computeIntrinsicRatioInformation const): Handled in RenderReplaced::computeIntrinsicRatioInformation instead.
2021-05-11 Antti Koivisto <antti@apple.com>
Don't allow :visited link style in subtrees that use mix-blend-mode
https://bugs.webkit.org/show_bug.cgi?id=225446
rdar://65686091
Reviewed by Darin Adler.
Test: fast/css/visited-link-mix-blend-mode.html
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::visitedDependentColor const):
Return unvisited style in substrees that use mix-blend-mode.
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setBlendMode):
(WebCore::RenderStyle::isInSubtreeWithBlendMode const):
Add an inherited fake property for tracking this.
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):
* rendering/style/StyleRareInheritedData.h:
2021-05-10 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Allow immediate action gestures to begin when force clicking text inside image overlays
https://bugs.webkit.org/show_bug.cgi?id=225600
<rdar://problem/77792365>
Reviewed by Tim Horton.
Allow immediate action hit-testing to descend into image overlay content. Currently, this uses the
`DisallowsUserAgentShadowContent` hit-testing option, causing us to ignore image overlays (which exist inside
the UA shadow root). To fix this, we introduce a `DisallowsUserAgentShadowContentExceptForImageOverlays` option
that behaves like the existing `DisallowsUserAgentShadowContent` option, with the exception that we allow hit-
testing to pierce the UA shadow root to find nodes inside image overlays.
Tests: ImmediateActionTests.ImmediateActionOverText
ImmediateActionTests.ImmediateActionOverBody
ImmediateActionTests.ImmediateActionOverImageOverlay
* page/EventHandler.cpp:
(WebCore::EventHandler::hitTestResultAtPoint const):
* rendering/HitTestRequest.h:
Add support for the new hit-test option, which allows hit-testing to descend into image overlays (and is
intended to be mutually exclusive with the existing `DisallowsUserAgentShadowContent` option). Specifying both
options will lead to an assertion on debug builds, and `DisallowsUserAgentShadowContent` takes precedence on
release builds.
(WebCore::HitTestRequest::disallowsUserAgentShadowContentExceptForImageOverlays const):
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::addNodeToListBasedTestResultCommon):
2021-05-10 Sam Weinig <weinig@apple.com>
Use PixelBuffer rather than ImageData in platform/ code to fix layering violation
https://bugs.webkit.org/show_bug.cgi?id=225584
Reviewed by Darin Adler.
Replace use of the DOM layer & ref-counted ImageData class with the new
platform layer PixelBuffer class, which ImageData now uses internally.
Since PixelBuffer is not-reference counted or heap-allocated in most cases,
many uses of RefPtr<ImageData> to indicate a potentially null ImageData have
been replaced with Optional<PixelBuffer>. Generally, this allows us to remove
an unnecessary allocation that was only needed for the DOM object.
Additionally, to many functions with ImageData in their name now have
PixelBuffer in their name instead, e.g. ImageBuffer::getImageData is now
ImageBuffer::getPixelBuffer (though I think changing this in the future to
ImageBuffer::copyPixelBuffer is a good idea).
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::dumpImageBitmap):
(WebCore::CloneDeserializer::readImageBitmap):
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::toDataURL):
(WebCore::HTMLCanvasElement::toBlob):
(WebCore::HTMLCanvasElement::getImageData):
* html/ImageBitmap.cpp:
(WebCore::ImageBitmap::createPromise):
* html/ImageData.cpp:
(WebCore::ImageData::create):
* html/ImageData.h:
(WebCore::ImageData::pixelBuffer const):
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::getImageData const):
(WebCore::CanvasRenderingContext2DBase::putImageData):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::paintRenderingResultsToPixelBuffer):
(WebCore::WebGLRenderingContextBase::texImageSourceHelper):
(WebCore::WebGLRenderingContextBase::paintRenderingResultsToImageData): Deleted.
* html/canvas/WebGLRenderingContextBase.h:
* page/PageConsoleClient.cpp:
(WebCore::PageConsoleClient::screenshot):
* platform/graphics/ConcreteImageBuffer.h:
(WebCore::ConcreteImageBuffer::putPixelBuffer):
(WebCore::ConcreteImageBuffer::putImageData): Deleted.
* platform/graphics/GraphicsContextGL.cpp:
(WebCore::GraphicsContextGL::extractPixelBuffer):
(WebCore::GraphicsContextGL::extractImageData): Deleted.
* platform/graphics/GraphicsContextGL.h:
* platform/graphics/ImageBuffer.cpp:
* platform/graphics/ImageBuffer.h:
(WebCore::ImageBuffer::putPixelBuffer):
(WebCore::ImageBuffer::putImageData): Deleted.
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::drawConsuming):
(WebCore::ImageBufferBackend::convertToLuminanceMask):
(WebCore::ImageBufferBackend::toBGRAData const):
(WebCore::copyPremultipliedToPremultiplied):
(WebCore::copyPremultipliedToUnpremultiplied):
(WebCore::copyUnpremultipliedToPremultiplied):
(WebCore::copyUnpremultipliedToUnpremultiplied):
(WebCore::copyFunctor):
(WebCore::ImageBufferBackend::copyImagePixels const):
(WebCore::ImageBufferBackend::getPixelBuffer const):
(WebCore::ImageBufferBackend::putPixelBuffer):
(WebCore::ImageBufferBackend::getImageData const): Deleted.
(WebCore::ImageBufferBackend::putImageData): Deleted.
* platform/graphics/ImageBufferBackend.h:
* platform/graphics/PixelBuffer.cpp:
(WebCore::computeBufferSize):
(WebCore::PixelBuffer::tryCreateForDecoding):
(WebCore::PixelBuffer::tryCreate):
(WebCore::operator<<):
* platform/graphics/PixelBuffer.h:
(WebCore::PixelBuffer::encode const):
(WebCore::PixelBuffer::decode):
* platform/graphics/ShadowBlur.cpp:
(WebCore::ShadowBlur::blurShadowBuffer):
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::readPixelsForPaintResults):
(WebCore::GraphicsContextGLOpenGL::readRenderingResults):
* platform/graphics/cairo/GraphicsContextGLCairo.cpp:
(WebCore::GraphicsContextGLOpenGL::paintToCanvas):
* platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp:
(WebCore::ImageBufferCairoSurfaceBackend::getPixelBuffer const):
(WebCore::ImageBufferCairoSurfaceBackend::putPixelBuffer):
(WebCore::ImageBufferCairoSurfaceBackend::getImageData const): Deleted.
(WebCore::ImageBufferCairoSurfaceBackend::putImageData): Deleted.
* platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h:
* platform/graphics/cg/GraphicsContextGLCG.cpp:
(WebCore::GraphicsContextGLOpenGL::paintToCanvas):
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::ImageBufferCGBackend::toCFData const):
* platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
(WebCore::ImageBufferCGBitmapBackend::getPixelBuffer const):
(WebCore::ImageBufferCGBitmapBackend::putPixelBuffer):
(WebCore::ImageBufferCGBitmapBackend::getImageData const): Deleted.
(WebCore::ImageBufferCGBitmapBackend::putImageData): Deleted.
* platform/graphics/cg/ImageBufferCGBitmapBackend.h:
* platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
(WebCore::ImageBufferIOSurfaceBackend::toCFData const):
(WebCore::ImageBufferIOSurfaceBackend::getPixelBuffer const):
(WebCore::ImageBufferIOSurfaceBackend::putPixelBuffer):
(WebCore::ImageBufferIOSurfaceBackend::getImageData const): Deleted.
(WebCore::ImageBufferIOSurfaceBackend::putImageData): Deleted.
* platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
* platform/graphics/cg/ImageBufferUtilitiesCG.cpp:
(WebCore::cfData):
(WebCore::dataURL):
(WebCore::data):
* platform/graphics/cg/ImageBufferUtilitiesCG.h:
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::readCompositedResults):
* platform/graphics/cpu/arm/filters/FEBlendNEON.h:
(WebCore::FEBlend::platformApplySoftware):
* 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<<):
(WebCore::DisplayList::PutPixelBuffer::PutPixelBuffer):
(WebCore::DisplayList::PutImageData::PutImageData): Deleted.
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::GetPixelBuffer::GetPixelBuffer):
(WebCore::DisplayList::PutPixelBuffer::pixelBuffer const):
(WebCore::DisplayList::PutPixelBuffer::encode const):
(WebCore::DisplayList::PutPixelBuffer::decode):
(WebCore::DisplayList::GetImageData::GetImageData): Deleted.
(WebCore::DisplayList::GetImageData::outputFormat const): Deleted.
(WebCore::DisplayList::GetImageData::srcRect const): Deleted.
(WebCore::DisplayList::PutImageData::inputFormat const): Deleted.
(WebCore::DisplayList::PutImageData::imageData const): Deleted.
(WebCore::DisplayList::PutImageData::srcRect const): Deleted.
(WebCore::DisplayList::PutImageData::destPoint const): Deleted.
(WebCore::DisplayList::PutImageData::destFormat const): Deleted.
(WebCore::DisplayList::PutImageData::localBounds const): Deleted.
(WebCore::DisplayList::PutImageData::globalBounds const): Deleted.
(WebCore::DisplayList::PutImageData::encode const): Deleted.
(WebCore::DisplayList::PutImageData::decode): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::getPixelBuffer):
(WebCore::DisplayList::Recorder::putPixelBuffer):
(WebCore::DisplayList::Recorder::getImageData): Deleted.
(WebCore::DisplayList::Recorder::putImageData): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/displaylists/DisplayListReplayer.h:
* platform/graphics/filters/FEColorMatrix.cpp:
(WebCore::FEColorMatrix::platformApplySoftware):
* platform/graphics/filters/FEComponentTransfer.cpp:
(WebCore::FEComponentTransfer::platformApplySoftware):
* platform/graphics/filters/FEComposite.cpp:
(WebCore::FEComposite::platformApplySoftware):
* platform/graphics/filters/FEConvolveMatrix.cpp:
(WebCore::FEConvolveMatrix::platformApplySoftware):
* platform/graphics/filters/FEDisplacementMap.cpp:
(WebCore::FEDisplacementMap::platformApplySoftware):
* platform/graphics/filters/FEDropShadow.cpp:
(WebCore::FEDropShadow::platformApplySoftware):
* platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::FEGaussianBlur::platformApplySoftware):
* platform/graphics/filters/FELighting.cpp:
(WebCore::FELighting::platformApplySoftware):
* platform/graphics/filters/FEMorphology.cpp:
(WebCore::FEMorphology::platformApplySoftware):
* platform/graphics/filters/FETurbulence.cpp:
(WebCore::FETurbulence::platformApplySoftware):
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::requestedRegionOfInputPixelBuffer const):
(WebCore::FilterEffect::clearResult):
(WebCore::FilterEffect::imageBufferResult):
(WebCore::FilterEffect::unmultipliedResult):
(WebCore::FilterEffect::premultipliedResult):
(WebCore::FilterEffect::convertPixelBufferToColorSpace):
(WebCore::FilterEffect::convertImageBufferToColorSpace):
(WebCore::FilterEffect::copyConvertedImageBufferToDestination):
(WebCore::FilterEffect::copyConvertedPixelBufferToDestination):
(WebCore::FilterEffect::copyUnmultipliedResult):
(WebCore::FilterEffect::copyPremultipliedResult):
(WebCore::FilterEffect::createUnmultipliedImageResult):
(WebCore::FilterEffect::createPremultipliedImageResult):
(WebCore::FilterEffect::requiresPixelBufferColorSpaceConversion):
(WebCore::FilterEffect::transformResultColorSpace):
(WebCore::FilterEffect::requestedRegionOfInputImageData const): Deleted.
(WebCore::FilterEffect::convertImageDataToColorSpace): Deleted.
(WebCore::FilterEffect::copyConvertedImageDataToDestination): Deleted.
(WebCore::FilterEffect::requiresImageDataColorSpaceConversion): Deleted.
* platform/graphics/filters/FilterEffect.h:
* platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
(WebCore::GraphicsContextGLOpenGL::paintRenderingResultsToCanvas):
(WebCore::GraphicsContextGLOpenGL::paintCompositedResultsToCanvas):
(WebCore::GraphicsContextGLOpenGL::paintRenderingResultsToPixelBuffer):
(WebCore::GraphicsContextGLOpenGL::readRenderingResultsForPainting):
(WebCore::GraphicsContextGLOpenGL::readCompositedResultsForPainting):
(WebCore::GraphicsContextGLOpenGL::readCompositedResults):
(WebCore::GraphicsContextGLOpenGL::paintRenderingResultsToImageData): Deleted.
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp:
(WebCore::GraphicsContextGLOpenGL::readPixelsForPaintResults):
* platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp:
(WebCore::GraphicsContextGLOpenGL::readRenderingResults):
* platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp:
(WebCore::GraphicsContextGLOpenGL::readnPixels):
(WebCore::GraphicsContextGLOpenGL::readPixelsForPaintResults):
* platform/graphics/win/ImageBufferDirect2DBackend.cpp:
(WebCore::ImageBufferDirect2DBackend::getPixelBuffer const):
(WebCore::ImageBufferDirect2DBackend::putPixelBuffer):
(WebCore::ImageBufferDirect2DBackend::getImageData const): Deleted.
(WebCore::ImageBufferDirect2DBackend::putImageData): Deleted.
* platform/graphics/win/ImageBufferDirect2DBackend.h:
* rendering/CSSFilter.cpp:
(WebCore::CSSFilter::outputRect const):
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createRasterShape):
2021-05-10 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r277281.
https://bugs.webkit.org/show_bug.cgi?id=225622
Broke multiple debug tests
Reverted changeset:
"Use HashSet<RefPtr<Node>> instead of HashSet<Node*>"
https://bugs.webkit.org/show_bug.cgi?id=220464
https://trac.webkit.org/changeset/277281
2021-05-10 Mark Lam <mark.lam@apple.com>
Add support to collect stats on cumulative LinkBuffer linked sizes based on profiles.
https://bugs.webkit.org/show_bug.cgi?id=225617
Reviewed by Saam Barati.
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
2021-05-10 Kate Cheney <katherine_cheney@apple.com>
Preflight requests not properly attributed as app-bound
https://bugs.webkit.org/show_bug.cgi?id=225596
<rdar://problem/77664272>
Reviewed by Brent Fulgham.
Tests: http/tests/in-app-browser-privacy/app-bound-attribution-preflight-async.html
http/tests/in-app-browser-privacy/app-bound-attribution-preflight-sync.html
A preflight request initiated by a main navigation that was app-bound
should also be app-bound. Testing sync preflight requests revealed
that we also need to mark this when loading a synchronous resource.
* loader/CrossOriginAccessControl.cpp:
(WebCore::createAccessControlPreflightRequest):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadResourceSynchronously):
2021-05-10 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r277222.
https://bugs.webkit.org/show_bug.cgi?id=225618
WebContent process crashes while visiting
<http://ign.com|ign.com> (RenderFlexibleBox::layoutFlexItems)
Reverted changeset:
"[css-flexbox] Flex item construction may affect sibling flex
item height computation"
https://bugs.webkit.org/show_bug.cgi?id=225489
https://trac.webkit.org/changeset/277222
2021-05-10 Wenson Hsieh <wenson_hsieh@apple.com>
Make WebCore::HitTestRequest::RequestType an enum class
https://bugs.webkit.org/show_bug.cgi?id=225597
Reviewed by Sam Weinig.
Rename `HitTestRequest::RequestType` to `HitTestRequest::Type`, and make it an enum class. I also noticed that
the first request type, `ReadOnly`, starts at a value of 2 (`1 << 1`) instead of 1 (which seems to have been an
unintentional change in <https://trac.webkit.org/r60761>).
No change in behavior.
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::press):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::visiblePositionForPoint const):
(WebCore::AccessibilityRenderObject::accessibilityHitTest const):
* dom/Document.cpp:
(WebCore::isValidPageSampleLocation):
* dom/TreeScope.cpp:
(WebCore::TreeScope::elementsFromPoint):
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::isReplacementObscured):
* html/MediaElementSession.cpp:
(WebCore::isElementMainContentForPurposesOfAutoplay):
* page/AutoscrollController.cpp:
(WebCore::AutoscrollController::updateAutoscrollRenderer):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::handleContextMenuEvent):
(WebCore::ContextMenuController::showContextMenu):
(WebCore::ContextMenuController::maybeCreateContextMenu):
* page/ContextMenuController.h:
* page/DragController.cpp:
(WebCore::DragController::canProcessDrag):
(WebCore::DragController::hitTestResultForDragStart const):
* page/EventHandler.cpp:
(WebCore::EventHandler::eventMayStartDrag const):
(WebCore::EventHandler::updateSelectionForMouseDrag):
(WebCore::EventHandler::hitTestResultAtPoint const):
(WebCore::EventHandler::updateCursor):
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::handleMouseDoubleClickEvent):
(WebCore::EventHandler::handleMouseMoveEvent):
(WebCore::EventHandler::handleMouseReleaseEvent):
(WebCore::EventHandler::handleMouseForceEvent):
(WebCore::EventHandler::updateDragAndDrop):
(WebCore::EventHandler::isInsideScrollbar const):
(WebCore::EventHandler::sendContextMenuEvent):
(WebCore::EventHandler::sendContextMenuEventForKey):
(WebCore::EventHandler::hoverTimerFired):
(WebCore::EventHandler::dragSourceEndedAt):
(WebCore::EventHandler::handleDrag):
(WebCore::hitTestResultInFrame):
(WebCore::EventHandler::handleTouchEvent):
(WebCore::EventHandler::dispatchSyntheticTouchEventIfEnabled):
* page/EventHandler.h:
* page/FocusController.cpp:
(WebCore::updateFocusCandidateIfNeeded):
* page/Frame.cpp:
(WebCore::Frame::visiblePositionForPoint const):
(WebCore::Frame::documentAtPoint):
* page/Page.cpp:
(WebCore::Page::editableElementsInRect const):
* page/PointerCaptureController.cpp:
(WebCore::PointerCaptureController::cancelPointer):
* page/ios/EventHandlerIOS.mm:
(WebCore::EventHandler::tryToBeginDragAtPoint):
* page/ios/FrameIOS.mm:
(WebCore::Frame::renderRectForPoint const):
(WebCore::Frame::betterApproximateNode):
(WebCore::Frame::hitTestResultAtViewportLocation):
(WebCore::Frame::qualifyingNodeAtViewportLocation):
* rendering/HitTestRequest.h:
(WebCore::HitTestRequest::HitTestRequest):
(WebCore::HitTestRequest::readOnly const):
(WebCore::HitTestRequest::active const):
(WebCore::HitTestRequest::move const):
(WebCore::HitTestRequest::release const):
(WebCore::HitTestRequest::ignoreCSSPointerEventsProperty const):
(WebCore::HitTestRequest::ignoreClipping const):
(WebCore::HitTestRequest::svgClipContent const):
(WebCore::HitTestRequest::touchEvent const):
(WebCore::HitTestRequest::disallowsUserAgentShadowContent const):
(WebCore::HitTestRequest::allowsFrameScrollbars const):
(WebCore::HitTestRequest::allowsChildFrameContent const):
(WebCore::HitTestRequest::allowsVisibleChildFrameContent const):
(WebCore::HitTestRequest::isChildFrameHitTest const):
(WebCore::HitTestRequest::resultIsElementList const):
(WebCore::HitTestRequest::includesAllElementsUnderPoint const):
(WebCore::HitTestRequest::type const):
(): Deleted.
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::nodeAtPoint):
* rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::nodeAtFloatPoint):
* rendering/svg/RenderSVGResourceClipper.cpp:
(WebCore::RenderSVGResourceClipper::hitTestClipContent):
* testing/Internals.cpp:
(WebCore::Internals::nodesFromRect const):
* testing/Internals.mm:
(WebCore::Internals::rangeForDictionaryLookupAtLocation):
2021-05-10 Alex Christensen <achristensen@webkit.org>
Add null check in CachedResource::clearLoader
https://bugs.webkit.org/show_bug.cgi?id=225605
<rdar://69912354>
Reviewed by Geoffrey Garen.
As much as we would like it not to be the case, we have records that m_loader can be null.
If it's null, let's not crash.
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::clearLoader):
2021-05-10 Andres Gonzalez <andresg_22@apple.com>
Fix for assert crash in AXObjectCache::visiblePositionForTextMarkerData.
https://bugs.webkit.org/show_bug.cgi?id=225303
<rdar://problem/77453921>
Reviewed by Chris Fleizach.
Test: accessibility/mac/pseudo-element-text-markers.html
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::visiblePositionForTextMarkerData):
Added check for Node::isPseudoElement to avoid hitting the assertion during the creation of a Position.
2021-05-10 Alex Christensen <achristensen@webkit.org>
Use HashSet<RefPtr<Node>> instead of HashSet<Node*>
https://bugs.webkit.org/show_bug.cgi?id=220464
Reviewed by Chris Dumez.
This makes us more resistent to lifetime bugs.
* accessibility/AXObjectCache.cpp:
(WebCore::conditionallyAddNodeToFilterList):
(WebCore::filterVectorPairForRemoval):
(WebCore::filterMapForRemoval):
(WebCore::filterListForRemoval):
(WebCore::AXObjectCache::prepareForDocumentDestruction):
* bindings/js/JSMutationObserverCustom.cpp:
(WebCore::JSMutationObserverOwner::isReachableFromOpaqueRoots):
* dom/MutationObserver.cpp:
(WebCore::MutationObserver::observedNodes const):
(WebCore:: const): Deleted.
* dom/MutationObserver.h:
* dom/MutationObserverRegistration.cpp:
(WebCore::MutationObserverRegistration::addRegistrationNodesToSet const):
* dom/MutationObserverRegistration.h:
* dom/Node.cpp:
(WebCore::liveNodeSet):
(WebCore::ignoreSet):
* editing/AppendNodeCommand.cpp:
(WebCore::AppendNodeCommand::getNodesInCommand):
* editing/AppendNodeCommand.h:
* editing/CompositeEditCommand.cpp:
(WebCore::EditCommandComposition::getNodesInCommand):
* editing/CompositeEditCommand.h:
* editing/DeleteFromTextNodeCommand.cpp:
(WebCore::DeleteFromTextNodeCommand::getNodesInCommand):
* editing/DeleteFromTextNodeCommand.h:
* editing/EditCommand.cpp:
(WebCore::SimpleEditCommand::addNodeAndDescendants):
* editing/EditCommand.h:
* editing/InsertIntoTextNodeCommand.cpp:
(WebCore::InsertIntoTextNodeCommand::getNodesInCommand):
* editing/InsertIntoTextNodeCommand.h:
* editing/InsertNodeBeforeCommand.cpp:
(WebCore::InsertNodeBeforeCommand::getNodesInCommand):
* editing/InsertNodeBeforeCommand.h:
* editing/MergeIdenticalElementsCommand.cpp:
(WebCore::MergeIdenticalElementsCommand::getNodesInCommand):
* editing/MergeIdenticalElementsCommand.h:
* editing/RemoveNodeCommand.cpp:
(WebCore::RemoveNodeCommand::getNodesInCommand):
* editing/RemoveNodeCommand.h:
* editing/ReplaceNodeWithSpanCommand.cpp:
(WebCore::ReplaceNodeWithSpanCommand::getNodesInCommand):
* editing/ReplaceNodeWithSpanCommand.h:
* editing/SetNodeAttributeCommand.cpp:
(WebCore::SetNodeAttributeCommand::getNodesInCommand):
* editing/SetNodeAttributeCommand.h:
* editing/SetSelectionCommand.h:
* editing/SpellingCorrectionCommand.cpp:
* editing/SplitElementCommand.cpp:
(WebCore::SplitElementCommand::getNodesInCommand):
* editing/SplitElementCommand.h:
* editing/SplitTextNodeCommand.cpp:
(WebCore::SplitTextNodeCommand::getNodesInCommand):
* editing/SplitTextNodeCommand.h:
* editing/WrapContentsInDummySpanCommand.cpp:
(WebCore::WrapContentsInDummySpanCommand::getNodesInCommand):
* editing/WrapContentsInDummySpanCommand.h:
* editing/cocoa/HTMLConverter.mm:
(HTMLConverterCaches::cacheAncestorsOfStartToBeConverted):
* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::highlightSelector):
* xml/XPathFunctions.cpp:
(WebCore::XPath::FunId::evaluate const):
* xml/XPathNodeSet.cpp:
(WebCore::XPath::sortBlock):
(WebCore::XPath::NodeSet::traversalSort const):
* xml/XPathPath.cpp:
(WebCore::XPath::LocationPath::evaluate const):
* xml/XPathPredicate.cpp:
(WebCore::XPath::Union::evaluate const):
2021-05-10 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] ImageOverlayController should paint selection quads instead of bounding rects
https://bugs.webkit.org/show_bug.cgi?id=225585
<rdar://problem/77725745>
Reviewed by Tim Horton.
Teach `SelectionRectGatherer` (now renamed to `SelectionGeometryGatherer`) to emit quads, rather than bounding
rects around each quad. We use these quads in `ImageOverlayController` to render selection quads via page
overlay (i.e., in the case where the image containing the overlay is transparent).
Test: fast/images/image-extraction/mac/select-rotated-transparent-image-overlay.html
* Headers.cmake:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* editing/SelectionGeometryGatherer.cpp: Renamed from Source/WebCore/editing/SelectionRectGatherer.cpp.
Rename `SelectionRectGatherer` to `SelectionGeometryGatherer`, to reflect the fact that this helper class now
aggregates both selection quads and gap rects.
(WebCore::SelectionGeometryGatherer::SelectionGeometryGatherer):
(WebCore::SelectionGeometryGatherer::addQuad):
Rename `addRect` to `addQuad`, and make it take a `FloatQuad` instead.
(WebCore::SelectionGeometryGatherer::addGapRects):
(WebCore::SelectionGeometryGatherer::Notifier::Notifier):
(WebCore::SelectionGeometryGatherer::Notifier::~Notifier):
(WebCore::SelectionGeometryGatherer::boundingRects const):
(WebCore::SelectionGeometryGatherer::clearAndCreateNotifier):
* editing/SelectionGeometryGatherer.h: Renamed from Source/WebCore/editing/SelectionRectGatherer.h.
(WebCore::SelectionGeometryGatherer::setTextOnly):
(WebCore::SelectionGeometryGatherer::isTextOnly const):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::updateWithImageExtractionResult):
Minor tweak - don't add any margin around the word when the line only contains a single word.
* page/ImageOverlayController.cpp:
(WebCore::ImageOverlayController::selectionQuadsDidChange):
Rename `selectionRectsDidChange` to `selectionQuadsDidChange`, and take a `FloatQuad` in absolute coordinates
instead of a `LayoutRect`. Store these quads in `m_overlaySelectionQuads` (also renamed from
`m_overlaySelectionRects`).
(WebCore::ImageOverlayController::uninstallPageOverlayIfNeeded):
(WebCore::ImageOverlayController::drawRect):
Make a few changes when painting selections using the `ImageOverlayController`:
1. Instead of painting with `fillRect()`, coalesce all of the collected selection quads into a single `Path`
object, and pass that `Path` into `fillPath()`. This allows us to render each piece of selected content as a
quad instead of a bounding rect, and additionally prevents us from rendering overlapping selections
when using `ImageOverlayController`.
2. Clip selections to the absolute bounds of the image overlay host element's renderer, which prevents the new
selection quads from spilling out of the host element.
(WebCore::ImageOverlayController::selectionRectsDidChange): Deleted.
* page/ImageOverlayController.h:
* rendering/RenderSelectionInfo.cpp:
(WebCore::RenderSelectionInfo::RenderSelectionInfo):
* rendering/RenderSelectionInfo.h:
(WebCore::RenderSelectionInfo::collectedSelectionQuads const):
(WebCore::RenderSelectionInfo::collectedSelectionRects const): Deleted.
More minor refactoring: rename `collectedSelectionRects` to `collectedSelectionQuads`, and make it take the
original `FloatQuad` instead of the quad's bounding box.
* rendering/RenderText.cpp:
(WebCore::RenderText::collectSelectionGeometriesForLineBoxes):
* rendering/RenderText.h:
* rendering/SelectionRangeData.cpp:
(WebCore::SelectionRangeData::SelectionRangeData):
(WebCore::SelectionRangeData::set):
(WebCore::SelectionRangeData::apply):
* rendering/SelectionRangeData.h:
2021-05-10 Eric Carlson <eric.carlson@apple.com>
[GPUP-MSE] Implement time changed callback
https://bugs.webkit.org/show_bug.cgi?id=225485
<rdar://problem/77625992>
Reviewed by Jer Noble.
Implement MediaPlayerPrivateMediaSourceAVFObjC::setCurrentTimeDidChangeCallback so
the GPU process doesn't have to poll currentTime.
No change in functionality.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::~MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCurrentTimeDidChangeCallback):
2021-05-10 Devin Rousso <drousso@apple.com>
Add support for a `media` attribute on `<meta name="theme-color" content="...">`
https://bugs.webkit.org/show_bug.cgi?id=224389
<rdar://problem/74991621>
Reviewed by Ryosuke Niwa.
Tests: WKWebViewThemeColor.MetaElementValidNameAndColorAndMedia
WKWebViewThemeColor.MetaElementInvalidName
WKWebViewThemeColor.MetaElementInvalidColor
WKWebViewThemeColor.MetaElementInvalidMedia
WKWebViewThemeColor.MetaElementMultipleValid
WKWebViewThemeColor.MetaElementValidSubframe
WKWebViewThemeColor.KVO
* html/HTMLMetaElement.idl:
* html/HTMLMetaElement.h:
* html/HTMLMetaElement.cpp:
(WebCore::parseMedia): Added.
(WebCore::mediaMatches): Added.
(WebCore::HTMLMetaElement::mediaAttributeMatches): Added.
(WebCore::HTMLMetaElement::contentColor): Added.
(WebCore::HTMLMetaElement::attributeChanged):
(WebCore::HTMLMetaElement::parseAttribute):
(WebCore::HTMLMetaElement::removedFromAncestor):
(WebCore::HTMLMetaElement::process):
Add support for a reflected `media` attribute. Cache the most recently parsed `media` (which
becomes a `Ref<MediaQuerySet>`) and `content` (which can become a `Color`) to avoid doing
repeated work when determining the active theme color after media state changes. Notify the
`Document` whenever the `name` or `content` or `media` attribute changes if the new or old
value will be or would have been related to calculating the theme color.
* dom/Document.h:
(WebCore::Document::themeColor const): Deleted.
* dom/Document.cpp:
(WebCore::Document::themeColor): Added.
(WebCore::Document::metaElementThemeColorChanged): Added.
(WebCore::Document::determineActiveThemeColorMetaElement): Added.
(WebCore::Document::themeColorChanged):
(WebCore::Document::updateElementsAffectedByMediaQueries):
(WebCore::Document::processMetaElementThemeColor): Deleted.
Make calculating the theme color into a two stage process:
1. find all `<meta name="theme-color">` that have a valid CSS color `content` in tree order
2. return the `HTMLMetaElement::contentColor` of the first item from step 1 that `HTMLMetaElement::mediaAttributeMatches`
This is done so that `Document::updateElementsAffectedByMediaQueries` doesn't have to repeat
step 1 each time it's run (which can be often) and instead only needs to iterate a (likely
very small) list in step 2. The actions/situations listed above would clear the cached data
from both steps, meaning that the next `Document::themeColor` will do a full recalculation.
Notify the UIProcess of a change in theme color if the result of step 2 is different from a
previously cached result (if set).
2021-05-09 Darin Adler <darin@apple.com>
Remove all remaining uses of the String::toInt family of functions
https://bugs.webkit.org/show_bug.cgi?id=225580
Reviewed by Sam Weinig.
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo):
Use parseInteger<uint64_t> instead of String::toUInt64Strict.
(WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameAndVersionFromFile):
Ditto.
* Modules/websockets/WebSocketDeflateFramer.cpp:
(WebCore::WebSocketExtensionDeflateFrame::WebSocketExtensionDeflateFrame):
Use a reference instead of a pointer.
(WebCore::WebSocketExtensionDeflateFrame::processResponse): Use
ASCIILiteral. Use parseIntegerAllowingTrailingJunk<int> instead of
String::toInt. Use auto. Use references instead of pointers.
(WebCore::DeflateResultHolder::DeflateResultHolder): Use a reference.
(WebCore::DeflateResultHolder::~DeflateResultHolder): Ditto.
(WebCore::InflateResultHolder::InflateResultHolder): Ditto.
(WebCore::InflateResultHolder::~InflateResultHolder): Ditto.
(WebCore::WebSocketDeflateFramer::WebSocketDeflateFramer): Deleted.
(WebCore::WebSocketDeflateFramer::createExtensionProcessor): Pass a reference.
(WebCore::WebSocketDeflateFramer::deflate): Ditto.
(WebCore::WebSocketDeflateFramer::inflate): Ditto.
* Modules/websockets/WebSocketDeflateFramer.h: Use forward declarations
instead of includes, references instead of pointers, initialize data members
in the class definition, and remove an unnecessary explicit default constructor.
* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::headerHasValidHTTPVersion): Use parseInteger<int> instead of
StringView::toIntStrict.
(WebCore::WebSocketHandshake::readStatusLine): Ditto.
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::headingLevel const): Use
getIntegralAttribute instead of AtomString::toInt.
(WebCore::AccessibilityNodeObject::hierarchicalLevel const): Ditto.
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::getIntegralAttribute const): Added.
Since AccessibilityObject has its own getAttribute function, we need to
re-implement Element::getIntegralAttribute here.
(WebCore::AccessibilityObject::setSize const): Use getIntegralAttribute
instead of AtomString::toInt.
(WebCore::AccessibilityObject::posInSet const): Ditto.
* accessibility/AccessibilityObject.h: Added getIntegralAttribute.
* accessibility/AccessibilityTable.cpp:
(WebCore::AccessibilityTable::isDataTable const):Use getIntegralAttribute
instead of AtomString::toInt.
(WebCore::AccessibilityTable::axColumnCount const): Ditto.
(WebCore::AccessibilityTable::axRowCount const): Ditto.
* accessibility/AccessibilityTableCell.cpp:
(WebCore::AccessibilityTableCell::axColumnIndex const): Ditto.
(WebCore::AccessibilityTableCell::axRowIndex const): Ditto.
(WebCore::AccessibilityTableCell::axColumnSpan const): Ditto.
(WebCore::AccessibilityTableCell::axRowSpan const): Ditto.
* accessibility/AccessibilityTableRow.cpp:
(WebCore::AccessibilityTableRow::axColumnIndex const): Ditto.
(WebCore::AccessibilityTableRow::axRowIndex const): Ditto.
* css/parser/CSSSelectorParser.cpp:
(WebCore::consumeANPlusB): Use parseInteger<int> instead of String::toIntStrict
* css/parser/CSSTokenizer.cpp:
(WebCore::CSSTokenizer::consumeEscape): Use parseInteger<uint32_t> instead of
String::toUIntStrict.
* editing/cocoa/DataDetection.mm:
(WebCore::DataDetection::canPresentDataDetectorsUIForElement):
Use parseIntegerAllowingTrailingJunk<int> instead of String::toInt.
Also use StringView instead of String.
(WebCore::dataDetectorStringForPath): Use makeString instead of StringBuilder.
* editing/cocoa/HTMLConverter.mm:
(HTMLConverter::computedAttributesForElement): Use
parseIntegerAllowingTrailingJunk<int> instead of String::toInt.
* html/HTMLFrameElement.cpp:
(WebCore::HTMLFrameElement::parseAttribute): Use parseHTMLInteger instead
of parseIntegerAllowingTrailingJunk<int>.
* html/HTMLFrameSetElement.cpp:
(WebCore::HTMLFrameSetElement::parseAttribute): Ditto.
* html/HTMLHRElement.cpp:
(WebCore::HTMLHRElement::collectStyleForPresentationAttribute): Ditto.
* html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::collectStyleForPresentationAttribute): Ditto.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseAttribute): Ditto.
* html/HTMLLIElement.cpp:
(WebCore::HTMLLIElement::parseValue): Ditto.
* html/HTMLMarqueeElement.cpp:
(WebCore::HTMLMarqueeElement::loop const): Use getIntegralAttribute
instead of parseIntegerAllowingTrailingJunk<int>.
* html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::collectStyleForPresentationAttribute):
Use parseHTMLInteger instead of parseIntegerAllowingTrailingJunk<int>.
* html/HTMLTableColElement.cpp:
(WebCore::HTMLTableColElement::parseAttribute): Ditto.
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::parseAttribute): Ditto.
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::restoreAttachedWindowHeight):
Use parseIntegerAllowingTrailingJunk<unsigned> instead of
String::toUInt.
* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::nodeForPath): Use
parseIntegerAllowingTrailingJunk<unsigned> instead of String::toUInt.
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::TreeBuilder::createLayoutBox): Use parseHTMLInteger
instead of AtomString::toInt.
* loader/CrossOriginPreflightResultCache.cpp:
(WebCore::parseAccessControlMaxAge): Use parseInteger<uint64_t> instead
of String::toUIntStrict.
* loader/FTPDirectoryParser.cpp:
(WebCore::parseOneFTPLine): Use parseIntegerAllowingTrailingJunk<unsigned>
instead of String::toUInt.
* loader/PrivateClickMeasurement.cpp:
(WebCore::PrivateClickMeasurement::parseAttributionRequest): Use
parseInteger<uint64_t> instead of String::toUInt64Strict.
* mathml/MathMLSelectElement.cpp:
(WebCore::MathMLSelectElement::getSelectedActionChildAndIndex):
Use getIntegralAttribute instead of parseIntegerAllowingTrailingJunk<int>.
* page/EventSource.cpp:
(WebCore::EventSource::parseEventStreamLine): Use
parseIntegerAllowingTrailingJunk<uint64_t> instead of charactersToUInt64.
* page/Location.cpp:
(WebCore::Location::setPort): Use parseInteger<uint16_t> instead of parseUInt16.
* page/SecurityOriginData.cpp:
(WebCore::SecurityOriginData::fromDatabaseIdentifier): Use
parseIntegerAllowingTrailingJunk<uint16_t> instead of String::toInt, which
allows us to remove some range checking and type conversion.
* page/WindowFeatures.cpp:
(WebCore::setWindowFeature): Use parseIntegerAllowingTrailingJunk<int>
instead of StringView::toInt.
* page/csp/ContentSecurityPolicySourceList.cpp:
(WebCore::ContentSecurityPolicySourceList::parsePort): Use
parseInteger<uint16_t> instead of charactersToIntStrict.
* page/linux/ResourceUsageThreadLinux.cpp:
(WebCore::collectCPUUsage): Use parseInteger<pid_t> instead of
String::toIntStrict. Also removed unneeded special cases for "." and
".." since both will fail to parse as an integer, and this no longer
need to put d_name into a WTF::String.
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(CachedResourceStreamingClient::responseReceived): Use
parseIntegerAllowingTrailingJunk<int> instead of String::toInt.
* platform/graphics/gstreamer/eme/CDMThunder.cpp:
(WebCore::ParsedResponseMessage::ParsedResponseMessage): Use
parseInteger<int> instead of String::toInt to parse a single-digit.
Probably should write this another way.
* platform/network/curl/CookieUtil.cpp:
(WebCore::CookieUtil::parseCookieAttributes): Use
parseIntegerAllowingTrailingJunk<int64_t> instead of String::toInt64.
* platform/network/curl/CurlCacheEntry.cpp:
(WebCore::CurlCacheEntry::setResponseFromCachedHeaders): Use
parseIntegerAllowingTrailingJunk<long long> instead of String::toInt64.
* svg/SVGToOTFFontConversion.cpp:
(WebCore::SVGToOTFFontConverter::appendOS2Table): Use parseHTMLInteger
instead of parseIntegerAllowingTrailingJunk<int>. Might be even better
to refactor to use getIntegralAttribute later.
(WebCore::SVGToOTFFontConverter::appendVORGTable): Ditto.
* testing/Internals.cpp:
(WebCore::Internals::setSFrameCounter): Use parseInteger<uint64_t>
instead of StringView::toUInt64Strict.
2021-05-10 Alex Christensen <achristensen@webkit.org>
css-display-none actions from WKContentRuleList should apply to pages loaded with loadData and loadHTMLString
https://bugs.webkit.org/show_bug.cgi?id=225493
<rdar://77331789>
Reviewed by Darin Adler.
Blocking and https upgrade don't really make sense on the url from loadData and loadHTMLString because blocking would be
incompatible with existing apps and because you're not really connecting to a server, you're just pretending you did.
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::handleSubstituteDataLoadNow):
2021-05-10 Alicia Boya García <aboya@igalia.com>
[MSE][GStreamer] Remove stale PlaybackPipeline.cpp
https://bugs.webkit.org/show_bug.cgi?id=225595
Reviewed by Adrian Perez de Castro.
The WebKitMediaSrc v2 patch removed PlaybackPipeline but accidentally
the .cpp file survived the rebases.
This patch introduces no behavior changes, the file was not being
compiled anymore.
* platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: Removed.
2021-05-10 Philippe Normand <pnormand@igalia.com>
[GStreamer] fast/mediastream/MediaStream-video-element-video-tracks-disabled.html fails
https://bugs.webkit.org/show_bug.cgi?id=225518
Reviewed by Xabier Rodriguez-Calvar.
* platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: Fix out-of-bounds memset().
2021-05-10 Rob Buis <rbuis@igalia.com>
Implement <form>.requestSubmit()
https://bugs.webkit.org/show_bug.cgi?id=197958
Reviewed by Darin Adler.
Implement the requestSubmit method as defined here [1].
Behavior matches Chrome and Firefox.
[1] https://html.spec.whatwg.org/multipage/forms.html#dom-form-requestsubmit
Tests: imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit.html
imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/request-submit-activation.html
imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-requestsubmit-autofocus.html
* html/HTMLButtonElement.cpp:
(WebCore::HTMLButtonElement::defaultEventHandler):
(WebCore::HTMLButtonElement::isSubmitButton const):
* html/HTMLButtonElement.h:
* html/HTMLFormControlElement.h:
(WebCore::HTMLFormControlElement::isSubmitButton const):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::submitImplicitly):
(WebCore::HTMLFormElement::submitIfPossible):
(WebCore::HTMLFormElement::requestSubmit):
(WebCore::HTMLFormElement::findSubmitButton):
(WebCore::HTMLFormElement::submit):
(WebCore::HTMLFormElement::effectiveTarget const):
(WebCore::HTMLFormElement::findSubmitter const):
(WebCore::HTMLFormElement::reportValidity):
(WebCore::HTMLFormElement::prepareForSubmission): Deleted.
(WebCore::HTMLFormElement::findSubmitButton const): Deleted.
* html/HTMLFormElement.h:
* html/HTMLFormElement.idl:
* html/HTMLInputElement.h:
* html/ImageInputType.cpp:
(WebCore::ImageInputType::handleDOMActivateEvent):
* html/ImageInputType.h:
* html/InputType.h:
(WebCore::InputType::isSubmitButton const):
* html/SubmitInputType.cpp:
(WebCore::SubmitInputType::handleDOMActivateEvent):
* loader/FormSubmission.cpp:
(WebCore::FormSubmission::create):
* loader/FormSubmission.h:
2021-05-09 Sam Weinig <weinig@apple.com>
Add back protection of the pixel buffer in ImageBufferCGBackend::toCFData removed in r277237
https://bugs.webkit.org/show_bug.cgi?id=225574
Reviewed by Darin Adler.
In r277237, I accidentally removed a `RefPtr<Uint8ClampedArray> protectedPixelArray`
in ImageBufferCGBackend::toCFData that was needed to avoided crashing in some cases
when running fast/canvas/canvas-toDataURL-jpeg-crash.html.
Since it wasn't super clear what it was doing, this switches to using the more idiomatic
method of keeping the data alive in a CGDataProviderRef by passing the leaked image data
as the context and derefing in the callback lambda.
Just to be consistent, I went to other callers of CGDataProviderCreateWithData and
updated them to be idiomatically consistent.
* platform/graphics/cg/GraphicsContextGLCG.cpp:
(WebCore::GraphicsContextGLOpenGL::paintToCanvas):
(WebCore::releaseImageData): Deleted.
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::ImageBufferCGBackend::toCFData const):
* platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
(WebCore::ImageBufferCGBitmapBackend::create):
2021-05-09 Lauro Moura <lmoura@igalia.com>
[WebXR] Remove reference cycle in WebXRSession
https://bugs.webkit.org/show_bug.cgi?id=225025
<rdar://problem/77111217>
Unreviewed WPE build fix.
* Modules/webxr/WebXRInputSourceArray.h: Add missing namespace.
2021-05-09 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo][Clang] lld-link: error: undefined symbol: public: static class GenericTypedArrayView<>::tryCreate() in CryptoKeyRSAOpenSSL.cpp
https://bugs.webkit.org/show_bug.cgi?id=225581
Unreviewed build for r277142.
* crypto/openssl/CryptoKeyRSAOpenSSL.cpp: Include <JavaScriptCore/TypedArrayInlines.h>.
2021-05-09 Dean Jackson <dino@apple.com>
[WebXR] Remove reference cycle in WebXRSession
https://bugs.webkit.org/show_bug.cgi?id=225025
<rdar://problem/77111217>
Reviewed by Sam Weinig.
Patch by Sam Weinig, who took my bad patch and made it better.
WebXRSession was attempting to create an WebXRInputSourceArray in
its constructor, which itself was trying to hold a strong reference
back to WebXRSession - causing a crash.
* Modules/webxr/WebXRBoundedReferenceSpace.h: Fix small typo.
* Modules/webxr/WebXRFrame.cpp: Use reference in constructor, since we
know the session exists.
(WebCore::WebXRFrame::create):
(WebCore::WebXRFrame::WebXRFrame):
* Modules/webxr/WebXRFrame.h:
* Modules/webxr/WebXRInputSource.cpp: Use a WeakPtr as a reference back
to the WebXRSession.
(WebCore::WebXRInputSource::create):
(WebCore::WebXRInputSource::WebXRInputSource):
(WebCore::WebXRInputSource::session): Add this getter.
(WebCore::WebXRInputSource::update): Check for null.
(WebCore::WebXRInputSource::pollEvents):
(WebCore::WebXRInputSource::createEvent): Deleted - moved to lambda.
* Modules/webxr/WebXRInputSource.h:
* Modules/webxr/WebXRInputSource.idl:
* Modules/webxr/WebXRInputSourceArray.cpp: Add GenerateIsReachable.
(WebCore::WebXRInputSourceArray::create):
(WebCore::WebXRInputSourceArray::WebXRInputSourceArray):
(WebCore::WebXRInputSourceArray::ref):
(WebCore::WebXRInputSourceArray::deref):
(WebCore::WebXRInputSourceArray::update):
(WebCore::WebXRInputSourceArray::handleAddedOrUpdatedInputSources):
* Modules/webxr/WebXRInputSourceArray.h:
* Modules/webxr/WebXRInputSourceArray.idl:
* Modules/webxr/WebXRInputSpace.cpp: Use reference in constructor.
(WebCore::WebXRInputSpace::create):
(WebCore::WebXRInputSpace::WebXRInputSpace):
* Modules/webxr/WebXRInputSpace.h:
* Modules/webxr/WebXRSession.cpp: Use a UniqueRef for input source array.
(WebCore::WebXRSession::onFrame):
* Modules/webxr/WebXRSession.h:
* bindings/scripts/CodeGeneratorJS.pm: Add ImplWebXRSessionRoot to GenerateIsReachable.
(GenerateImplementation):
2021-05-09 Darin Adler <darin@apple.com>
Remove uses of the String::toInt family of functions from the WebCore/platform directory
https://bugs.webkit.org/show_bug.cgi?id=225575
Second half.
Reviewed by Sam Weinig.
* platform/mediastream/mac/ScreenDisplayCapturerMac.mm:
(WebCore::ScreenDisplayCapturerMac::create): Use parseInteger<uint32_t>
instead of String::toUIntStrict.
(WebCore::ScreenDisplayCapturerMac::screenCaptureDeviceWithPersistentID): Ditto.
* platform/mediastream/mac/WindowDisplayCapturerMac.mm:
(WebCore::WindowDisplayCapturerMac::create): Ditto.
(WebCore::WindowDisplayCapturerMac::windowCaptureDeviceWithPersistentID): Ditto.
* platform/network/HTTPParsers.cpp:
(WebCore::parseRange): Use parseInteger<long long> instead of
String::toInt64Strict. Also use StringView so we don't allocate substrings on
the heap just to parse integers within an existing string. And removed unneeded
call to stripWhiteSpace in one place since parseInteger already allows leading
and trailing spaces, and in another case where we need to strip because of an
empty string check, used stripLeadingAndTrailingHTTPSpaces instead.
* platform/network/ParsedContentRange.cpp:
(WebCore::parseContentRange): Use parseInteger<int64_t> instead of
StringView::toInt64Strict.
* platform/network/ParsedRequestRange.cpp:
(WebCore::ParsedRequestRange::parse): Use parseInteger<uint64_t> instead of
StringView::toUInt64Strict.
2021-05-09 Darin Adler <darin@apple.com>
Follow-up to: Remove uses of the String::toInt family of functions from the WebCore/platform directory
https://bugs.webkit.org/show_bug.cgi?id=225575
Reviewed by Sam Weinig.
* html/FTPDirectoryDocument.cpp:
(WebCore::processFilesizeString): Change format to "1000.0" as we discussed.
2021-05-09 Darin Adler <darin@apple.com>
Remove uses of the String::toInt family of functions from the WebCore/platform directory
https://bugs.webkit.org/show_bug.cgi?id=225575
Accidentally committed only half of it.
Reviewed by Sam Weinig.
* platform/DateComponents.cpp: Tweak a comment on the local parseInt function here
that should likely be consolidated with parseInteger at some point.
* platform/Length.cpp:
(WebCore::parseLength): Use parseInteger<int> instead of charactersToIntStrict.
* platform/encryptedmedia/clearkey/CDMClearKey.cpp:
(WebCore::CDMPrivateClearKey::sanitizeSessionId const): Use parseInteger<uint32_t>
instead of String::toUIntStrict.
* platform/graphics/HEVCUtilities.cpp:
(WebCore::parseHEVCCodecParameters): Use parseInteger<uint8/32_t> instead of
toIntegralType<uint8/32_t>.
(WebCore::parseDoViCodecParameters): Ditto.
* platform/graphics/VP9Utilities.cpp:
(WebCore::parseVPCodecParameters): Ditto.
* platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
(WebCore::CDMPrivateMediaSourceAVFObjC::parseKeySystem): Use parseInteger<int>
instead of String::toInt. There's no need for the "allow trailing junk" here
because a regular expression is used to check format before we call parseInteger.
Also removed an unnecessary empty string check, since the regular expression
match check will fail on an empty string.
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::trackDidChangeSelected): Use
parseIntegerAllowingTrailingJunk<uint64_t> instead ot toUInt64.
(WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): Ditto.
(WebCore::SourceBufferPrivateAVFObjC::flush): Ditto.
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Ditto.
(WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples): Ditto.
(WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples): Ditto.
(WebCore::SourceBufferPrivateAVFObjC::canSetMinimumUpcomingPresentationTime const): Ditto.
* platform/graphics/cocoa/HEVCUtilitiesCocoa.mm:
(WebCore::parseStringArrayFromDictionaryToUInt16Vector): Use
parseInteger<uint16_t> instead of toIntegralType<uint16_t>. We could also
consider using -[NSString intValue] here with some range checking instead
of converting to WTF::String.
2021-05-09 Darin Adler <darin@apple.com>
Remove uses of the String::toInt family of functions from WebCore/html and similar directories
https://bugs.webkit.org/show_bug.cgi?id=225577
Reviewed by Sam Weinig.
* dom/Document.cpp:
(WebCore::Document::createEvent): Fix spelling error.
* html/FTPDirectoryDocument.cpp:
(WebCore::processFilesizeString): Use parseIntegerAllowingTrailingJunk<uint64_t>
instead of String::toUInt64.
* html/FormController.cpp:
(WebCore::deserializeFormControlState): Use parseIntegerAllowingTrailingJunk<size_t>
instead of String::toUInt.
(WebCore::SavedFormState::deserialize): Ditto.
* html/HTMLFontElement.cpp:
(WebCore::parseFontSize): Use parseInteger<int> instead of
charactersToIntStrict.
* html/HTMLFrameElement.cpp:
(WebCore::HTMLFrameElement::parseAttribute): Use parseIntegerAllowingTrailingJunk<int>
instead of String::toInt.
* html/HTMLFrameSetElement.cpp:
(WebCore::HTMLFrameSetElement::parseAttribute): Ditto.
* html/HTMLHRElement.cpp:
(WebCore::HTMLHRElement::collectStyleForPresentationAttribute): Ditto.
* html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::collectStyleForPresentationAttribute): Ditto.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseAttribute): Ditto.
* html/HTMLLIElement.cpp:
(WebCore::HTMLLIElement::parseValue): Ditto.
* html/HTMLMarqueeElement.cpp:
(WebCore::HTMLMarqueeElement::loop const): Ditto.
* html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::collectStyleForPresentationAttribute): Ditto.
* html/HTMLTableColElement.cpp:
(WebCore::HTMLTableColElement::parseAttribute): Ditto.
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::parseAttribute): Ditto.
* html/LinkIconCollector.cpp:
(WebCore::LinkIconCollector::iconsOfTypes): Use parseIntegerAllowingTrailingJunk<unsigned>
instead of String::toUInt. Also removed unneeded call to stripWhiteSpace since the
integer parsing function already skips leading and trailing spaces.
* html/MediaFragmentURIParser.cpp:
(WebCore::MediaFragmentURIParser::parseNPTTime): Use parseInteger<int> instead of
String::toInt. The strings passsed in are fixed size and all digits.
* html/TypeAhead.cpp:
(WebCore::TypeAhead::handleEvent): Use parseIntegerAllowingTrailingJunk<int>
instead of String::toInt.
* html/URLDecomposition.cpp:
(WebCore::URLDecomposition::setHost): Use parseInteger<uint16_t> instead of parseUInt16.
(WebCore::parsePort): Ditto.
* html/shadow/DateTimeNumericFieldElement.cpp:
(WebCore::DateTimeNumericFieldElement::handleKeyboardEvent): Use
parseIntegerAllowingTrailingJunk<int> instead of String::toInt.
* html/track/VTTScanner.cpp:
(WebCore::VTTScanner::scanDigits): Use parseInteger<int> instead of
charactersToIntStrict.
* mathml/MathMLSelectElement.cpp:
(WebCore::MathMLSelectElement::getSelectedActionChildAndIndex): Use
parseIntegerAllowingTrailingJunk<int> instead of AtomString::toInt.
2021-05-09 Darin Adler <darin@apple.com>
Remove uses of the String::toInt family of functions from the WebCore/svg and WebCore/workers directories
https://bugs.webkit.org/show_bug.cgi?id=225573
Reviewed by Sam Weinig.
Both SVG and service workers had code that should be moved from headers
into implementation files. This allowed us to use the new parseInteger
function templates without including the header in headers, which may help
keep compile times from getting out of hand.
* Sources.txt: Added the new source files.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* svg/SVGFEConvolveMatrixElement.cpp:
(WebCore::SVGFEConvolveMatrixElement::parseAttribute): Use parseInteger<unsigned>
instead of String::toUIntStrict.
* svg/SVGFETurbulenceElement.cpp:
(WebCore::SVGFETurbulenceElement::parseAttribute): Ditto.
* svg/SVGToOTFFontConversion.cpp:
(WebCore::SVGToOTFFontConverter::appendOS2Table): Use
parseIntegerAllowingTrailingJunk<int> instead of String::toInt. Use
parseIntegerAllowingTrailingJunk<uint8_t> instead of String::toInt,
allowing us to remove range checking to reject values that are out of range.
(WebCore::SVGToOTFFontConverter::appendVORGTable): Ditto.
(WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Ditto.
* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::parseClockValue): Use parseInteger<uint8_t>
instead of String::toUIntStrict. These are all 2-character numeric
strings. Also simplified the logic and used StringView so we don't have to
allocate memory for the substrings.
(WebCore::SVGSMILElement::parseCondition): Use parseInteger<unsigned>
instead of String::toUIntStrict. Also used StringView.
* svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp:
(WebCore::SVGAnimationIntegerFunction::calculateDistance const): Moved
this file here from the header, and used parseInteger<int> rather than
String::toIntStrict.
* svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: Moved
SVGAnimationIntegerFunction::calculateDistance out of the header.
Also marked the class and member functions final. (Could do that for
a lot more of the classes in this file.)
* svg/properties/SVGPropertyTraits.cpp: Added.
(WebCore::SVGPropertyTraits<int>::fromString): Moved this here from the
header and use parseInteger<int> instead of String::toIntStrict.
* svg/properties/SVGPropertyTraits.h: Updated for the above.
* workers/service/ServiceWorkerClientIdentifier.cpp: Added.
(WebCore::ServiceWorkerClientIdentifier::fromString): Moved this here
from the header and use parseInteger<uint64_t> instead of
StringView::toUInt64Strict.
* workers/service/ServiceWorkerClientIdentifier.h: Updated for the above.
Also moved ServiceWorkerClientIdentifierHash from the WTF namespace
to the WebCore namespace.
* workers/service/ServiceWorkerRegistrationKey.cpp:
(WebCore::ServiceWorkerRegistrationKey::fromDatabaseKey): Use
parseInteger<uint16_t> instead of charactersToUIntStrict, allowing us
to remove range checking. Also use StringView::substring instead of
writing out special cases for 8-bit and 16-bit characters.
2021-05-09 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Simplify DisplayList::Iterator part 6: Migrate ItemBufferWritingClient from ItemHandle to a const Variant&
https://bugs.webkit.org/show_bug.cgi?id=224270
Reviewed by Wenson Hsieh.
This patch adds a new Variant that contains all the DisplayList item types, named DisplayListItem. It also migrates
ItemBufferWritingClient from ItemHandle to this new Variant.
There are two benefits to this:
1. The templated overload of ItemBuffer::append() is way simpler now. Previously, we used to allocate a byte buffer
on the stack and run a placement new of the display list item type into it. Now, we can just run the DisplayListItem
constructor instead. Using the Variant does require more stack space, but we only will ever have one of these objects
on the stack at a time.
2. The big table inside RemoteImageBufferProxy::encodeItemOutOfLine() is gone, and is replaced with just 7 lines. This is
one fewer place where we'll have to make sure the DisplayListItem types match a function in an entirely different
framework.
No new tests, because there is no behavior change.
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::copyInto):
(WebCore::DisplayList::safeCopyHelper):
(WebCore::DisplayList::safeCopy):
(WebCore::DisplayList::ItemBuffer::append):
* platform/graphics/displaylists/DisplayListItemBuffer.h:
(WebCore::DisplayList::ItemBufferWritingClient::requiredSizeForItem const):
(WebCore::DisplayList::ItemBufferWritingClient::encodeItemOutOfLine const):
(WebCore::DisplayList::ItemBufferWritingClient::encodeItemInline const):
(WebCore::DisplayList::ItemBuffer::append):
* platform/graphics/displaylists/DisplayListItemType.cpp:
(WebCore::DisplayList::paddedSizeOfTypeAndItemInBytes):
(WebCore::DisplayList::displayListItemType):
* platform/graphics/displaylists/DisplayListItems.h:
* platform/graphics/displaylists/InMemoryDisplayList.cpp:
(WebCore::DisplayList::InMemoryDisplayList::WritingClient::requiredSizeForItem const):
(WebCore::DisplayList::InMemoryDisplayList::WritingClient::encodeItemInline const):
* platform/graphics/displaylists/InMemoryDisplayList.h:
2021-05-09 Myles C. Maxfield <mmaxfield@apple.com>
[Cocoa] Unify last resort fallback font between all Cocoa ports
https://bugs.webkit.org/show_bug.cgi?id=225569
Reviewed by Darin Adler.
Just remove an unnecessary #if.
Covered by existing tests.
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontCache::lastResortFallbackFont):
2021-05-08 Peng Liu <peng.liu6@apple.com>
[GPUP] A small video element enters fullscreen with strange animations
https://bugs.webkit.org/show_bug.cgi?id=225548
Reviewed by Eric Carlson.
Use `FloatRect` instead of `IntRect` to exchange video element location/size
information between WebContent processes and the UI process to avoid information
mismatch due to floating-point rounding.
Manually tested.
* platform/ios/VideoFullscreenInterfaceAVKit.h:
* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(VideoFullscreenInterfaceAVKit::setupFullscreen):
(VideoFullscreenInterfaceAVKit::exitFullscreen):
(VideoFullscreenInterfaceAVKit::preparedToReturnToInline):
(VideoFullscreenInterfaceAVKit::setInlineRect):
2021-05-08 Sam Weinig <weinig@apple.com>
Factor out pixel buffer from DOM specific ImageData class
https://bugs.webkit.org/show_bug.cgi?id=225554
Reviewed by Darin Adler.
Prepare to fix layering violating use of DOM level ImageData being
used by platform code by factoring out the pixel storage into a new
PixelBuffer class. Since it will be a little more general that
ImageData is now (though ImageData will need to gain these soon)
PixelBuffer also captures the pixel format and color space the pixel
data represents.
While here, update ImageData::data() to return a reference rather than
a pointer to indicate it is never null and update all the callers.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSImageDataCustom.cpp:
(WebCore::toJSNewlyCreated):
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::dumpImageBitmap):
(WebCore::CloneSerializer::dumpIfTerminal):
(WebCore::CloneDeserializer::readTerminal):
* html/ImageBitmap.cpp:
(WebCore::ImageBitmap::createPromise):
* html/ImageData.cpp:
(WebCore::ImageData::create):
(WebCore::ImageData::ImageData):
(WebCore::ImageData::deepClone const):
(WebCore::operator<<):
* html/ImageData.h:
(WebCore::ImageData::size const):
(WebCore::ImageData::width const):
(WebCore::ImageData::height const):
(WebCore::ImageData::data const):
(WebCore::ImageData::colorSpace const):
(WebCore::ImageData::format const):
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::createEmptyImageData):
(WebCore::CanvasRenderingContext2DBase::putImageData):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::texImageSourceHelper):
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::buildArrayForImageData):
* platform/graphics/GraphicsContextGL.cpp:
(WebCore::GraphicsContextGL::extractImageData):
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::convertToLuminanceMask):
(WebCore::ImageBufferBackend::getImageData const):
(WebCore::ImageBufferBackend::putImageData):
* platform/graphics/PixelBuffer.cpp: Added.
(WebCore::PixelBuffer::PixelBuffer):
(WebCore::PixelBuffer::deepClone const):
* platform/graphics/PixelBuffer.h: Added.
(WebCore::PixelBuffer::colorSpace const):
(WebCore::PixelBuffer::format const):
(WebCore::PixelBuffer::size const):
(WebCore::PixelBuffer::data const):
* platform/graphics/ShadowBlur.cpp:
(WebCore::ShadowBlur::blurShadowBuffer):
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::readPixelsForPaintResults):
* platform/graphics/cg/GraphicsContextGLCG.cpp:
(WebCore::GraphicsContextGLOpenGL::paintToCanvas):
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::ImageBufferCGBackend::toCFData const):
* platform/graphics/cg/ImageBufferUtilitiesCG.cpp:
(WebCore::cfData):
* platform/graphics/filters/FEColorMatrix.cpp:
(WebCore::FEColorMatrix::platformApplySoftware):
* platform/graphics/filters/FEComponentTransfer.cpp:
(WebCore::FEComponentTransfer::platformApplySoftware):
* platform/graphics/filters/FEComposite.cpp:
(WebCore::FEComposite::platformApplySoftware):
* platform/graphics/filters/FEConvolveMatrix.cpp:
(WebCore::FEConvolveMatrix::platformApplySoftware):
* platform/graphics/filters/FEDisplacementMap.cpp:
(WebCore::FEDisplacementMap::platformApplySoftware):
* platform/graphics/filters/FEDropShadow.cpp:
(WebCore::FEDropShadow::platformApplySoftware):
* platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::FEGaussianBlur::platformApplySoftware):
* platform/graphics/filters/FELighting.cpp:
(WebCore::FELighting::platformApplySoftware):
* platform/graphics/filters/FEMorphology.cpp:
(WebCore::FEMorphology::platformApplySoftware):
* platform/graphics/filters/FETurbulence.cpp:
(WebCore::FETurbulence::platformApplySoftware):
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::forceValidPreMultipliedPixels):
(WebCore::FilterEffect::copyConvertedImageBufferToDestination):
(WebCore::FilterEffect::copyConvertedImageDataToDestination):
(WebCore::FilterEffect::copyUnmultipliedResult):
(WebCore::FilterEffect::copyPremultipliedResult):
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createRasterShape):
2021-05-08 Myles C. Maxfield <mmaxfield@apple.com>
[Cocoa] Unify font collection handling between all Cocoa ports
https://bugs.webkit.org/show_bug.cgi?id=225566
Reviewed by Darin Adler.
Just remove an unnecessary #if.
Covered by existing tests.
* platform/graphics/mac/FontCustomPlatformData.cpp:
(WebCore::createFontCustomPlatformData):
2021-05-08 Myles C. Maxfield <mmaxfield@apple.com>
Add bounds checks around calls to GlyphBuffer::stringOffsetAt()
https://bugs.webkit.org/show_bug.cgi?id=225335
<rdar://problem/75663608>
Reviewed by Simon Fraser and Geoff Garen.
We're getting crash reports that look like they're from string offsets being out-of-bounds.
These string offsets round-trip through Core Text, which is allowed to modify them, which
can end up making them out-of-bounds.
No new tests because I don't have a reproducible test case; just crash reports.
* platform/graphics/FontCascade.cpp:
(WebCore::computeUnderlineType):
* platform/graphics/GlyphBuffer.h:
(WebCore::GlyphBuffer::uncheckedStringOffsetAt const):
(WebCore::GlyphBuffer::checkedStringOffsetAt const):
(WebCore::GlyphBuffer::stringOffsetAt const): Deleted.
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::applyFontTransforms):
(WebCore::WidthIterator::applyExtraSpacingAfterShaping):
2021-05-08 Ricky Mondello <rmondello@apple.com>
Fix a typo
https://bugs.webkit.org/show_bug.cgi?id=225502
Reviewed by Chris Dumez.
* loader/LinkLoader.cpp:
(WebCore::LinkLoader::preconnectIfNeeded):
2021-05-08 Megan Gardner <megan_gardner@apple.com>
Increase stored AppHighlight character limit to 500
https://bugs.webkit.org/show_bug.cgi?id=225558
Reviewed by Tim Horton.
* Modules/highlight/AppHighlightStorage.cpp:
2021-05-07 Zalan Bujtas <zalan@apple.com>
[css-flexbox] Flex item construction may affect sibling flex item height computation
https://bugs.webkit.org/show_bug.cgi?id=225489
Reviewed by Sergio Villar Senin.
Flex item construction triggers layout both on the flex item and on its descendants (see constructFlexItem).
During this layout a percent height descendant may indirectly set an incorrect value on the flex container's
m_hasDefiniteHeight (this is due to the odd way we choose to resolve percent height values on the ancestor chain,
see setOverridingContainingBlockContentLogicalHeight(WTF::nullopt)).
Now this incorrect m_hasDefiniteHeight value (Indefinite) causes the next sibling's (also) percent height
resolve fail as it tells the flex item that the flex container can't help with resolving the percent height value.
As the result we end up with an incorrect, 0px height value for this sibling.
e.g.
<div style="height: 100px; display: flex; flex-direction: column;">
<div id=flexItemA style="height: 50px;"><div style="height: 100%;"></div></div>
<div id=flexItemB style="height: 50%;"></div>
</div>
By the time we get to the construction of flexItemB, the RenderFlexibleBox's (flex container) m_hasDefiniteHeight
is already (and incorrectly) set to Indefinite as the result of us trying to resolve flexItemA's descendant height percentage.
This Indefinite value makes the flexItemB's height resolution fail as we believe that the flex container has indefinite height
e.g "height: auto", while it is clearly resolvable (50% of 100px).
Now if we flip the order and flexItemB comes first, the test case passes fine.
It is very unfortunate that some descendant height resolving process can trigger a state change on the ancestor RenderFlexibleBox, but
fixing it would certainly require some substantial architectural change (e.g. pushing down the constraints to the geometry functions instead of
walking the containing block chain).
In this patch, we just scope m_hasDefiniteHeight so that the RenderFlexibleBox's state is not effected by the flex item construction.
Test: fast/flexbox/flex-column-with-percent-height-descendants.html
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutFlexItems):
2021-05-07 Devin Rousso <drousso@apple.com>
[iOS] fix inconsistency around the meaning of `rate` and `defaultPlaybackRate` between WebKit and AVKit
https://bugs.webkit.org/show_bug.cgi?id=225532
<rdar://problem/77629276>
Reviewed by Eric Carlson.
In AVKit, the `defaultPlaybackRate` is used when playback starts, such as resuming after
pausing. In WebKit, however, `defaultPlaybackRate` is only used when first loading and after
ending scanning, with the `playbackRate` being used in all other cases, including when
resuming after pausing. As such, WebKit should return the `playbackRate` instead of the
`defaultPlaybackRate` in these cases when communicating with AVKit.
* platform/ios/WebAVPlayerController.mm:
(-[WebAVPlayerController setRate:]):
Also `setDefaultPlaybackRate:` if not paused (i.e. `rate != 0`) since WebKit's definition of
`playbackRate` does not change when paused.
* platform/ios/PlaybackSessionInterfaceAVKit.mm:
(WebCore::PlaybackSessionInterfaceAVKit::rateChanged):
Make sure to `setDefaultPlaybackRate:` before `setRate:` as the latter can affect the former.
2021-05-07 Carlos Garcia Campos <cgarcia@igalia.com>
Do not try to remove and already removed node while deleting selection
https://bugs.webkit.org/show_bug.cgi?id=224893
Reviewed by Ryosuke Niwa.
Test: editing/inserting/insert-text-force-repaint-on-load-crash.html
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::removeNode): Return early if the given node doesn't have a parent anymore.
2021-05-07 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Set the -isSourceEditable property when presenting webpage translation popup
https://bugs.webkit.org/show_bug.cgi?id=225515
<rdar://problem/77658040>
Reviewed by Tim Horton.
Set `-[LTUITranslationViewController isSourceEditable]` to `YES` when showing the context menu for editable
content. Instead of plumbing another boolean flag through `ContextMenuClient` and into the client layers through
`handleTranslation()`, we roll all of the webpage translation context menu parameters into a single object
(`TranslationContextMenuInfo`), including a new flag indicating whether or not the translation controller should
be shown in "editable" mode.
* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* loader/EmptyClients.cpp:
* page/ContextMenuClient.h:
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
* page/TranslationContextMenuInfo.h: Added.
Pull the translated text string, selection bounds, menu location, and the new mode flag into a separate struct.
(WebCore::TranslationContextMenuInfo::encode const):
(WebCore::TranslationContextMenuInfo::decode):
2021-05-07 Chris Dumez <cdumez@apple.com>
AudioWorkletProcessor which does not extend base class crashes Safari
https://bugs.webkit.org/show_bug.cgi?id=225449
<rdar://problem/77624792>
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-07 Philippe Normand <pnormand@igalia.com>
[GStreamer][MediaStream] Emit black frames for disabled video tracks
https://bugs.webkit.org/show_bug.cgi?id=225511
Reviewed by Xabier Rodriguez-Calvar.
In case the video track is disabled, emit a black I420 frame. For disabled audio tracks we
might need to silence the corresponding audio frames, this will be investigated in a
follow-up patch.
* platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
2021-05-07 Frédéric Wang <fwang@igalia.com>
Crash in ApplyStyleCommand::applyRelativeFontStyleChange
https://bugs.webkit.org/show_bug.cgi?id=225235
Reviewed by Ryosuke Niwa.
Test: editing/execCommand/font-size-delta-same-node-for-start-and-end-crash.html
In ApplyStyleCommand::applyRelativeFontStyleChange, when the selection start and end have the
same anchor node, the start node of the loop is obtained by calling Position::upstream on the
selection start while end node of the loop is obtained by calling NodeTraversal::next on the
anchor node. This can result in the former being after the latter. This patch fixes this by
moving the end of the loop after the anchor node (similar to what is already done when the
start anchor node is a strict descendant of the end anchor node).
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyRelativeFontStyleChange): Also include the case where
end.deprecatedNode() == start.deprecatedNode() in the conditional.
2021-05-07 Carlos Garnacho <carlosg@gnome.org>
[GTK4] Rewrite GTK gesture support to work for both 3.x and 4.x.
https://bugs.webkit.org/show_bug.cgi?id=212324
Reviewed by Carlos Garcia Campos.
* platform/gtk/GtkVersioning.h:
(gtk_event_controller_get_current_event_state):
(gtk_event_controller_get_current_event_time): New GTK4 portability
helper methods.
2021-05-07 Youenn Fablet <youenn@apple.com>
Add WebRTC logging control in GPUProcess
https://bugs.webkit.org/show_bug.cgi?id=225346
Reviewed by Eric Carlson.
Migrate setEnableLogging to setLoggingLevel as a virtual method so that it can be implemented by WebKit to send logging level to GPUProcess.
Simplify WebCore::LibWebRTCProvider::setLoggingLevel to not differentiate debug from non debug builds.
Manually tested.
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::create):
* page/Page.cpp:
(WebCore::Page::configureLoggingChannel):
* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::computeLogLevel):
(WebCore::LibWebRTCProvider::setRTCLogging):
(WebCore::LibWebRTCProvider::setLoggingLevel):
(WebCore::setLogging): Deleted.
(WebCore::LibWebRTCProvider::setEnableLogging): Deleted.
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:
2021-05-07 Frédéric Wang <fwang@igalia.com>
Crash in InsertTextCommand::positionInsideTextNode
https://bugs.webkit.org/show_bug.cgi?id=223753
Reviewed by Ryosuke Niwa.
Test: editing/deleting/selection-on-empty-table-row.html
This is a follow-up of bug 213514, where removePreviouslySelectedEmptyTableRows was
modified to ensure the selection is properly updated after deleting the last row. This
patch does the same for other rows.
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows): Update comment
about calling raw removeNode and move it to the top of the function. Replace all the calls
to CompositeEditCommand::removeNode with CompositeEditCommand::removeNodeUpdatingStates so
that the selection is adjusted.
2021-05-07 Said Abou-Hallawa <said@apple.com>
[GPU Process] Closing the GPU Process should clear all the back pointers from ItemBuffer to RemoteRenderingBackendProxy
https://bugs.webkit.org/show_bug.cgi?id=224744
<rdar://74592639>
Reviewed by Ryosuke Niwa.
RemoteRenderingBackendProxy::gpuProcessConnectionDidClose() clears the
the backends of all its RemoteImageBufferProxys. It also clears all the
SharedMemory which are referenced by the ItemBufferHandles.
So DisplayList::ImageBuffer::clearBackend() should clear all the
ItemBufferHandles of its DisplayList.
* platform/graphics/displaylists/DisplayListImageBuffer.h:
2021-05-06 Jean-Yves Avenard <jya@apple.com>
ArtworkImageLoader can call callback with null value.
https://bugs.webkit.org/show_bug.cgi?id=225496
rdar://problem/77631799
Reviewed by Eric Carlson.
The ArtworkImageLoader can call the callback with null to indicate an error.
* Modules/mediasession/MediaMetadata.cpp:
(WebCore::MediaMetadata::refreshArtworkImage): Add null check
2021-05-06 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com>
[OpenSSL] Implement CryptoAlgorithmRSA*
https://bugs.webkit.org/show_bug.cgi?id=225294
Reviewed by Don Olmstead.
Implement RSA for OpenSSL.
Implement CryptoAlgorithmRSA_OAEP, CryptoAlgorithmRSA_PSS,
CryptoAlgorithmRSAES_PKCS1_v1_5, CryptoAlgorithmRSASA_PKCS1_v1_5,
and CryptoKeyRSA for OpenSSL.
Note that if such OpenSSL version that does not support RSA_OAEP or
RSA_PSS, the WebCrypto API for those algorithm will return a
NotSupportedError.
Also note that OpenSSL accepts RSA_PSS salt length longer than the hash
length. This makes the
crypto/subtle/rsa-pss-import-key-sign-large-salt.html test fail.
Test: Existing crypto/subtle tests
* crypto/keys/CryptoKeyRSA.h: Use the EVP_PKEY struct for the platform
key.
* crypto/openssl/CryptoAlgorithmHMACOpenSSL.cpp: Move HMACAlgorithm()
to OpenSSLUtilities as DigestAlgorithm().
* crypto/openssl/CryptoAlgorithmRSAES_PKCS1_v1_5OpenSSL.cpp:
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
Implemented.
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
Implemented.
* crypto/openssl/CryptoAlgorithmRSASSA_PKCS1_v1_5OpenSSL.cpp:
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
Implemented.
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
Implemented.
* crypto/openssl/CryptoAlgorithmRSA_OAEPOpenSSL.cpp:
(WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): Implemented.
(WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): Implemented.
* crypto/openssl/CryptoAlgorithmRSA_PSSOpenSSL.cpp:
(WebCore::CryptoAlgorithmRSA_PSS::platformSign): Implemented.
(WebCore::CryptoAlgorithmRSA_PSS::platformVerify): Implemented.
* crypto/openssl/CryptoAlgorithmRegistryOpenSSL.cpp:
(WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
Registered RSAES_PKCS1_v_1_5, RSASSA_PKCS1_v1_5, RSA_OAEP, and RSA_PSS.
* crypto/openssl/CryptoKeyRSAOpenSSL.cpp:
(WebCore::getRSAModulusLength):
(WebCore::convertToBytes):
(WebCore::convertToBigNumber):
(WebCore::CryptoKeyRSA::create):
(WebCore::CryptoKeyRSA::CryptoKeyRSA):
(WebCore::CryptoKeyRSA::isRestrictedToHash const):
(WebCore::CryptoKeyRSA::keySizeInBits const):
(WebCore::exponentVectorToUInt32):
(WebCore::CryptoKeyRSA::generatePair):
(WebCore::CryptoKeyRSA::importSpki):
(WebCore::CryptoKeyRSA::importPkcs8):
(WebCore::CryptoKeyRSA::exportSpki const):
(WebCore::CryptoKeyRSA::exportPkcs8 const):
(WebCore::CryptoKeyRSA::algorithm const):
(WebCore::CryptoKeyRSA::exportData const):
* crypto/openssl/OpenSSLCryptoUniquePtr.h:
(WebCore::OpenSSLCryptoPtrDeleter<EVP_PKEY_CTX>::operator() const):
Added.
(WebCore::OpenSSLCryptoPtrDeleter<RSA>::operator() const): Added.
(WebCore::OpenSSLCryptoPtrDeleter<PKCS8_PRIV_KEY_INFO>::operator() const): Added.
(WebCore::OpenSSLCryptoPtrDeleter<BIGNUM>::operator() const): Added.
(WebCore::OpenSSLCryptoPtrDeleter<BN_CTX>::operator() const): Added.
* crypto/openssl/OpenSSLUtilities.cpp:
(WebCore::digestAlgorithm): Added.
(WebCore::calculateDigest): Added.
* crypto/openssl/OpenSSLUtilities.h:
* platform/OpenSSL.cmake:
2021-05-06 Eric Carlson <eric.carlson@apple.com>
r277122 caused a crash in GPU Process
https://bugs.webkit.org/show_bug.cgi?id=225492
<rdar://problem/77630141>
Reviewed by Jer Noble.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): Have the time observer
call back on the main queue.
2021-05-06 Devin Rousso <drousso@apple.com>
Sampled Page Top Color: make hit tests consider elements with `pointer-events: none`
https://bugs.webkit.org/show_bug.cgi?id=225419
Reviewed by Tim Horton.
Test: SampledPageTopColor.HitTestCSSPointerEventsNone
* rendering/HitTestRequest.h:
(WebCore::HitTestRequest::ignoreCSSPointerEventsProperty const): Added.
* rendering/InlineBox.h:
(WebCore::InlineBox::visibleToHitTesting const):
* rendering/RenderElement.h:
(WebCore::RenderElement::visibleToHitTesting const):
Add `RequestType::IgnoreCSSPointerEventsProperty` that's used inside `visibleToHitTesting`
to control whether `style().pointerEvents() == PointerEvents::None` is checked.
* dom/Document.cpp:
(WebCore::isValidPageSampleLocation):
Include the new `RequestType::IgnoreCSSPointerEventsProperty` since we're not hit testing
for interaction, rather we're hit testing in an attempt to see what will be painted.
* rendering/EllipsisBox.cpp:
(WebCore::EllipsisBox::nodeAtPoint):
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::nodeAtPoint):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::nodeAtPoint):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::nodeAtPoint):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::nodeAtPoint):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::hitTestCulledInline):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::nodeAtPoint):
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::nodeAtPoint):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::nodeAtPoint):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::nodeAtPoint):
Pass the `HitTestRequest` to `visibleToHitTesting`.
2021-05-06 Devin Rousso <drousso@apple.com>
Sampled Page Top Color: don't snapshot if the hit test location is a canvas
https://bugs.webkit.org/show_bug.cgi?id=225418
Reviewed by Tim Horton.
Tests: SampledPageTopColor.HitTestHTMLCanvasWithoutRenderingContext
SampledPageTopColor.HitTestHTMLCanvasWithRenderingContext
* dom/Document.cpp:
(WebCore::isValidPageSampleLocation):
2021-05-06 Jer Noble <jer.noble@apple.com>
REGRESSION (r276870): ASSERTION FAILED: !m_impl || !m_shouldEnableAssertions || m_impl->wasConstructedOnMainThread() == isMainThread() under WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer
https://bugs.webkit.org/show_bug.cgi?id=225371
<rdar://problem/77531907>
Reviewed by Eric Carlson.
In WebKitLegacy, the weakPtr created by createAVPlayer() is constructed on the WebThread, and
dereferenced on the main thread. However, the reason we use a WeakPtr for this call is a long-
since fixed bug in AVFoundation. We can just remove the WeakPtr and rely on AVFoundation to
not call our block after the observer has been removed in the destructor.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
2021-05-06 Eric Carlson <eric.carlson@apple.com>
[GPUP] Reduce MediaPlayer polling frequency when possible
https://bugs.webkit.org/show_bug.cgi?id=225396
<rdar://problem/77562643>
Reviewed by Jer Noble.
Add a currentTime changed callback to MediaPlayerPrivateInterface so a client
doens't have to poll for time changes.
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::setCurrentTimeDidChangeCallback):
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::setCurrentTimeDidChangeCallback):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTimeDidChangeCallback):
(WebCore::MediaPlayerPrivateAVFoundationObjC::currentMediaTimeDidChange const):
2021-05-06 Antoine Quint <graouts@webkit.org>
CSS custom properties on pseudo elements background gradients causes infinite layout and high CPU load
https://bugs.webkit.org/show_bug.cgi?id=194332
<rdar://problem/47873895>
Reviewed by Simon Fraser.
When a background-image uses a CSS custom property the resulting StyleGeneratedImage may not be the same
object as during prior style updates. This caused transitions to be triggered for all style updates for
such background-image values. To fix this, we modify the == operator for StyleGeneratedImage to use
arePointingToEqualData() with the CSSImageGeneratorValue member and added an == operator for the
CSSImageGeneratorValue class to call into the existing equals() methods. These equals() methods
are now overrides of the virtual CSSImageGeneratorValue method.
This change in behavior required a change in RenderElement::updateFillImages() to not only check whether
the images were identical, but to also check whether the renderer was registered as a client on the new
images. To do this, we add a new virtual hasClient() method on StyleImage.
Test: webanimations/css-transition-element-with-gradient-background-image-and-css-custom-property.html
* css/CSSImageGeneratorValue.cpp:
(WebCore::CSSImageGeneratorValue::operator== const):
* css/CSSImageGeneratorValue.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::updateFillImages):
* rendering/style/FillLayer.cpp:
(WebCore::FillLayer::imagesIdentical): Deleted.
* rendering/style/FillLayer.h:
* rendering/style/StyleCachedImage.cpp:
(WebCore::StyleCachedImage::hasClient const):
* rendering/style/StyleCachedImage.h:
* rendering/style/StyleGeneratedImage.cpp:
(WebCore::StyleGeneratedImage::operator== const):
(WebCore::StyleGeneratedImage::hasClient const):
* rendering/style/StyleGeneratedImage.h:
* rendering/style/StyleImage.h:
* rendering/style/StyleMultiImage.cpp:
(WebCore::StyleMultiImage::hasClient const):
* rendering/style/StyleMultiImage.h:
2021-05-06 Philippe Normand <pnormand@igalia.com>
[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 Dean Jackson <dino@apple.com>
[WebXR] Add IOSurface to FrameData::LayerData
https://bugs.webkit.org/show_bug.cgi?id=225428
<rdar://problem/77586270>
Reviewed by Tim Horton.
Original patch by Ada Chan.
Cocoa platforms will use IOSurfaces on FrameData::LayerData.
Add this member, allow it to be encoded and decoded, and fix up
some places where we were copying a FrameData unnecessarily, or
where we have to explicitly copy.
* Modules/webxr/WebXRSession.cpp:
(WebCore::WebXRSession::onFrame): Use WTFMove instead of copying.
* platform/graphics/cocoa/IOSurface.h: Export createFromSurface.
* platform/xr/PlatformXR.h:
(PlatformXR::Device::FrameData::LayerData::encode const):
(PlatformXR::Device::FrameData::LayerData::decode):
(PlatformXR::Device::FrameData::decode):
(PlatformXR::Device::FrameData::copy const):
* testing/WebFakeXRDevice.cpp:
(WebCore::SimulatedXRDevice::frameTimerFired):
2021-05-06 Alicia Boya García <aboya@igalia.com>
[MSE][GStreamer] Remove webKitMediaSrcFinalize
https://bugs.webkit.org/show_bug.cgi?id=225458
Reviewed by Philippe Normand.
webKitMediaSrcFinalize was no longer necessary after moving to
WEBKIT_DEFINE_TYPE as requested by the reviewers. This patch cleans
that up.
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
(webkit_media_src_class_init):
(webKitMediaSrcFinalize): Deleted.
2021-05-06 Mark Lam <mark.lam@apple.com>
Forbid further execution in jsc shell if execution is terminated.
https://bugs.webkit.org/show_bug.cgi?id=225410
rdar://77548608
Reviewed by Michael Saboff.
Re-implement WorkerOrWorkletScriptController::forbidExecution() and
isExecutionForbidden() using the VM's notion of the flag
* workers/WorkerOrWorkletScriptController.cpp:
(WebCore::WorkerOrWorkletScriptController::forbidExecution):
(WebCore::WorkerOrWorkletScriptController::isExecutionForbidden const):
* workers/WorkerOrWorkletScriptController.h:
2021-05-06 Darin Adler <darin@apple.com>
Streamline codec parsing, replacing uses of HashMap with SortedArrayMap
https://bugs.webkit.org/show_bug.cgi?id=225368
Reviewed by Sam Weinig.
* platform/ContentType.cpp:
(WebCore::ContentType::parameter const): Use early return instead of nesting.
Strip HTML spaces, not all whitespace, and do it only once rather than twice.
Fixed a small bug where we search for the second quotation mark in a way that
could find the same quotation mark twice if there is a space before the first
one. Added FIXME comments about a few obvious problems in the parsing algorithm.
Improved efficiency by using StringView, saving the allocation of one temporary
StringImpl in the case where we have some HTML spaces to strip.
(WebCore::ContentType::containerType const): Simplified the implemementation
by taking advantage of the fact that our notFound value is designed to be used
as an argument to functions like String::left, telling them to return the
entire string. Strip HTML spaces, not all whitespace.
* platform/graphics/HEVCUtilities.cpp:
(WebCore::parseHEVCCodecParameters): Take a StringView instead of a String
for greater flexibility and efficiency. Don't store codecName, which is
never used after verifying that it is a legal value here. Don't store the
generalTierFlag, which is never used after verifying that it is a legal
value here. Don't store the constraint flags, which are never used after
verifying that they are legal values here.
(WebCore::makeOptionalFromPointer): Added to make code below cleaner.
(WebCore::parseDoViCodecType): Renamed from codecStringForDoViCodecType
since it now returns an enumeration value instead of a string. Also
take a StringView instead of a String for greater flexibility and efficiency.
Also use a SortedArrayMap instead of a MemoryCompactLookupOnlyRobinHoodHashMap.
(WebCore::profileIDForAlphabeticDoViProfile): Take a StringView instead of
a String for greater flexibility and efficiency. Use a SortedArrayMap instead
of a MemoryCompactLookupOnlyRobinHoodHashMap.
(WebCore::isValidProfileIDForCodec): Take a codec enumeration value parameter
instead of a string.
(WebCore::parseDoViCodecParameters): Take a StringView instead of a String
for greater flexibility and efficiency. Store the codec as an enumeration
instead of a String. Don't create a temporary String just so we can call the
profileIDForAlphabeticDoViProfile function.
* platform/graphics/HEVCUtilities.h: Renamed HEVCParameterSet and
DoViParameterSet to HEVCParameters and DoViParameters. The word "set" is not
helpful in these names. Removed codecName, generalTierFlag, and constraintFlags
from HEVCParameterSet. Changed the parse functions to take StringView instead
of String. Replaced the string codecName in DoViParameterSet with an enumeration
since there are only a few valid values.
* platform/graphics/cocoa/HEVCUtilitiesCocoa.h: Use Optional return value
instead of a bool and an out argument.
* platform/graphics/cocoa/HEVCUtilitiesCocoa.mm:
(WebCore::validateHEVCParameters): Updated to return Optional.
(WebCore::codecType): Updated to take an enumeration value and no longer
need to return an optional. Also renamed from codecTypeForDoViCodecString
since the type now makes this clear without a long function name.
(WebCore::parseStringArrayFromDictionaryToUInt16Vector): Renamed from
CFStringArrayToNumberVector, and moved the dictionary lookup in here.
The old name was a little vague; "NumberVector" doesn't say 16-bit unsigned.
Simplified code by using an Objective-C for loop instead of a block and
enumeration. This cut the size of the function down quite a bit.
(WebCore::validateDoViParameters): Updated to return Optional. Also
refactored to use the imrpoved helper functions above.
* platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp:
(WebCore::videoCodecTypeFromRFC4281Type): Take a StringView instead of a String
for greater flexibility and efficiency.
(WebCore::computeMediaCapabilitiesInfo): Factored out this helper function
so we don't have such complicated callback logic. Refactored to use the new
versions of validateHEVCParameters, validateDoViParameters, and
validateVPParameters.
(WebCore::createMediaPlayerDecodingConfigurationCocoa): Moved most of the
code into computeMediaCapabilitiesInfo; this mostly deals with the callback.
* platform/graphics/cocoa/VP9UtilitiesCocoa.h: Removed extraneous use of extern.
Added const for input-only reference arguments. Changed validateVPParameters to
return Optional instead of a bool with an out argument.
* platform/graphics/cocoa/VP9UtilitiesCocoa.mm:
(WebCore::isVP9CodecConfigurationRecordSupported): Added const.
(WebCore::isVP8CodecConfigurationRecordSupported): Ditto.
(WebCore::isVPCodecConfigurationRecordSupported): Ditto.
(WebCore::validateVPParameters): Refactored to return Optional.
* platform/network/HTTPHeaderMap.h: Removed unneeded includes.
* platform/text/LocaleToScriptMapping.cpp: Moved PackedASCIILowerCodes from
here into the SortedArrayMap.h header.
* testing/Internals.cpp:
(WebCore::Internals::parseHEVCCodecParameters): Tweaked since HEVCParameterSet
is now only the correct name here in the Internals class.
(WebCore::Internals::parseDoViCodecParameters): Ditto. Also added code to
expose the codec enumeration as a string. This is now a testing-only thing.
(WebCore::Internals::parseVPCodecParameters): Ditto.
* testing/Internals.h: Tweaked the ParameterSet types since they now don't
exactly match the structures used in the real code.
* testing/Internals.idl: Removed codecName, generalTierFlag, and
constraintFlags from HEVCParameterSet. Neither codecName nor constraintFlags
was used in any test. And the generalTierFlag test was something we can
do without; the parsed value isn't actually used in any WebKit code.
2021-05-06 Philippe Normand <pnormand@igalia.com>
[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-06 Chris Dumez <cdumez@apple.com>
imported/w3c/web-platform-tests/eventsource/format-utf-8.htm is failing on some platforms
https://bugs.webkit.org/show_bug.cgi?id=225416
<rdar://77529801>
Reviewed by Youenn Fablet.
The HTML specification [1] states that EventSource streams should always be decoded as UTF-8.
However, we had logic in WebKit that was checking the charset of the response and aborting
when the charset is not UTF-8. It looks like we were lucky until now that we would fail to
determine the charset of the response and proceed anyway. However, due to underlying system
changes, in the context of this test, we are now properly detecting the response charset as
"windows-1252" and (incorrectly) aborting. To address the issue, I no longer abort the
connection if the charset is not "utf-8". We do still log a console warning but we proceed
decoding the stream as UTF-8 no matter the response's charset, as per the specification.
[1] https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation
No new tests, covered by existing test that is failing on some platforms.
* page/EventSource.cpp:
(WebCore::EventSource::responseIsValid const):
2021-05-06 Martin Robinson <mrobinson@webkit.org>
[css-scroll-snap] Compute proximity information while snapping
https://bugs.webkit.org/show_bug.cgi?id=224326
Reviewed by Simon Fraser.
Have ScrollSnapOffsetsInfo carry snap area rectangles instead of scroll offset
ranges. This allows proximity information to be handled during snap point selection.
The geometry will be used in a future patch to follow spec behavior for snap
areas that overflow the snapport and when handling masonry layouts.
No new tests. This is just a refactor. It should not change behavior at all.
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::setStateScrollingNodeSnapOffsetsAsFloat): Pass in the new template argument.
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::isNearEnoughToOffsetForProximity): Added.
(WebCore::closestSnapOffsetWithInfoAndAxis): Modified to take in the ScrollSnapOffsetsInfo data
structure and axis along with the viewport size. This function now explicitly determines if a
snap point is too far away to affect scrolling due to scroll-snap proximity.
(WebCore::updateSnapOffsetsForScrollableArea): Add snap areas and snap area indices to SnapOffset.
(WebCore::convertOffsetInfo): Instead of converting scroll offset ranges, convert the snap
area rectangles.
(WebCore::FloatScrollSnapOffsetsInfo::convertUnits const): Ditto.
(WebCore::LayoutScrollSnapOffsetsInfo::convertUnits const): Ditto.
(WebCore::LayoutScrollSnapOffsetsInfo::closestSnapOffset const): Updated to reflect new
internal function.
(WebCore::FloatScrollSnapOffsetsInfo::closestSnapOffset const): Ditto.
* page/scrolling/ScrollSnapOffsetsInfo.h:
(WebCore::ScrollSnapOffsetsInfo::isEqual const): Update to reflect new mem ers.
(WebCore::ScrollSnapOffsetsInfo::offsetsForAxis const): Changed template parameter name.
* page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
(WebCore::ScrollingTreeScrollingNodeDelegateMac::updateFromStateNode): ::convertUnits
takes a new template parameter.
* page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.cpp:
(WebCore::ScrollingTreeScrollingNodeDelegateNicosia::handleWheelEvent): Pass in viewport size.
* platform/ScrollController.cpp:
(WebCore::ScrollController::setNearestScrollSnapIndexForAxisAndOffset): Ditto.
(WebCore::ScrollController::adjustScrollDestination): Ditto.
* platform/ScrollSnapAnimatorState.cpp:
(WebCore::ScrollSnapAnimatorState::setupAnimationForState): Ditto.
(WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset const): Ditto.
(WebCore::operator<<): No longer print snap offset ranges.
* platform/ScrollSnapAnimatorState.h: Remove references to snap offset ranges.
2021-05-06 Philippe Normand <pnormand@igalia.com>
REGRESSION(r271341): media/media-fullscreen-inline.html times out on GTK
https://bugs.webkit.org/show_bug.cgi?id=220540
Reviewed by Xabier Rodriguez-Calvar.
When the GStreamer player client is an <audio> tag it won't render any video, but setting no
explicit video sink on playbin will not prevent video rendering per-se. In that situation
playbin will use autovideosink which will end-up creating a standalone window through
glimagesink or whatever has the highest rank. For now with playbin2 we can use fakevideosink
for such situation. For the playbin3 case we might be able to entirely deactivate video
rendering through stream selection.
Internals::isChangingPresentationMode was enabled for ports not implementing
VIDEO_PRESENTATION_MODE yet, because this test makes use of it.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
(WebCore::MediaPlayerPrivateGStreamer::createVideoSink):
* testing/Internals.cpp:
(WebCore::Internals::isChangingPresentationMode const):
* testing/Internals.h:
* testing/Internals.idl:
2021-05-06 Ryosuke Niwa <rniwa@webkit.org>
Replace raw pointers in SVGElementRareData and SVGDocumentExtensions with WeakHashMap and WeakPtr
https://bugs.webkit.org/show_bug.cgi?id=225440
Reviewed by Antti Koivisto.
Replaced the remaining use of raw pointers to Element in SVGElementRareData and SVGDocumentExtensions
with WeakHashSet and WeakPtr.
This patch also replaces SVGDocumentExtensions::m_elementDependencies with a new WeakHashMap
in SVGElementRareData for clarify & simplicity with a new terminology. When a SVG element A refers
to another element B via href, A's SVGElementRareData::m_referenceTarget is set to B, and A is added
to B's SVGElementRareData::m_referencingElements.
No new tests since there should be no observable behavior differences.
* rendering/svg/RenderSVGResource.cpp:
(WebCore::removeFromCacheAndInvalidateDependencies):
* rendering/svg/RenderSVGResourceContainer.cpp:
(WebCore::RenderSVGResourceContainer::registerResource):
* svg/SVGAnimateMotionElement.cpp:
(WebCore::SVGAnimateMotionElement::applyResultsToTarget):
* svg/SVGDocumentExtensions.cpp:
(WebCore::SVGDocumentExtensions::addPendingResource):
(WebCore::SVGDocumentExtensions::isElementWithPendingResources const):
(WebCore::SVGDocumentExtensions::isPendingResource const): Directly check the existence of
the id in m_pendingResources instead of calling isIdOfPendingResource.
(WebCore::SVGDocumentExtensions::removeElementFromPendingResources):
(WebCore::SVGDocumentExtensions::removePendingResource): Moved to the header to be inlined.
(WebCore::SVGDocumentExtensions::removePendingResourceForRemoval): Deleted. The code is
inlined in removeElementFromPendingResources instead.
(WebCore::SVGDocumentExtensions::markPendingResourcesForRemoval):
(WebCore::SVGDocumentExtensions::takeElementFromPendingResourcesForRemovalMap): Renamed
from removeElementFromPendingResourcesForRemovalMap.
(WebCore::SVGDocumentExtensions::addElementToRebuild): Added.
(WebCore::SVGDocumentExtensions::removeElementToRebuild): Added.
(WebCore::SVGDocumentExtensions::setOfElementsReferencingTarget): Deleted.
(WebCore::SVGDocumentExtensions::addElementReferencingTarget): Deleted.
(WebCore::SVGDocumentExtensions::removeAllTargetReferencesForElement): Deleted.
(WebCore::SVGDocumentExtensions::clearTargetDependencies):
(WebCore::SVGDocumentExtensions::rebuildAllElementReferencesForTarget):
(WebCore::SVGDocumentExtensions::removeAllElementReferencesForTarget): Deleted.
* svg/SVGDocumentExtensions.h:
(WebCore::SVGDocumentExtensions::removePendingResource):
* svg/SVGElement.cpp:
(WebCore::SVGElement::~SVGElement):
(WebCore::SVGElement::removedFromAncestor): Moved the most of logic in SVGDocumentExtensions's
clearTargetDependencies and removeAllElementReferencesForTarget here.
(WebCore::SVGElement::instances const):
(WebCore::SVGElement::referencingElements const): Added.
(WebCore::SVGElement::addReferencingElement): Added.
(WebCore::SVGElement::removeReferencingElement): Added.
(WebCore::SVGElement::removeElementReference): Added.
(WebCore::SVGElement::setCorrespondingElement):
(WebCore::SVGElement::addEventListener):
(WebCore::SVGElement::removeEventListener):
(WebCore::SVGElement::createAnimator):
(WebCore::SVGElement::buildPendingResourcesIfNeeded):
(WebCore::SVGElement::updateRelativeLengthsInformation):
(WebCore::SVGElement::invalidateInstances):
(WebCore:: const): Deleted.
* svg/SVGElement.h:
(WebCore::SVGElement::hasRelativeLengths const):
(WebCore::SVGElement::updateRelativeLengthsInformation):
* svg/SVGElementRareData.h:
(WebCore::SVGElementRareData::addInstance):
(WebCore::SVGElementRareData::removeInstance):
(WebCore::SVGElementRareData::instances const):
(WebCore::SVGElementRareData::addReferencingElement):
(WebCore::SVGElementRareData::removeReferencingElement):
(WebCore::SVGElementRareData::referencingElements const):
(WebCore::SVGElementRareData::takeReferencingElements):
(WebCore::SVGElementRareData::referenceTarget const):
(WebCore::SVGElementRareData::setReferenceTarget):
(WebCore::SVGElementRareData::correspondingElement):
(WebCore::SVGElementRareData::setCorrespondingElement):
(): Deleted.
(WebCore::SVGElementRareData:: const): Deleted.
* svg/SVGFEImageElement.cpp:
(WebCore::SVGFEImageElement::clearResourceReferences):
(WebCore::SVGFEImageElement::buildPendingResource):
* svg/SVGMPathElement.cpp:
(WebCore::SVGMPathElement::buildPendingResource):
(WebCore::SVGMPathElement::clearResourceReferences):
* svg/SVGPathElement.cpp:
(WebCore::SVGPathElement::invalidateMPathDependencies):
* svg/SVGTextPathElement.cpp:
(WebCore::SVGTextPathElement::clearResourceReferences):
(WebCore::SVGTextPathElement::buildPendingResource):
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::invalidateDependentShadowTrees):
* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::clearResourceReferences):
(WebCore::SVGSMILElement::buildPendingResource):
* svg/properties/SVGAttributeAnimator.cpp:
(WebCore::SVGAttributeAnimator::applyAnimatedStylePropertyChange):
(WebCore::SVGAttributeAnimator::removeAnimatedStyleProperty):
(WebCore::SVGAttributeAnimator::applyAnimatedPropertyChange):
2021-05-06 Cameron McCormack <heycam@apple.com>
Split context state change item appending out of DisplayList::Recorder::canAppendItemOfType.
https://bugs.webkit.org/show_bug.cgi?id=225424
Reviewed by Simon Fraser.
It's non-obvious from the name that canAppendItemOfType can also end
up appending an item. So let's split out the context state change
item out into a separate function.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::canAppendItemOfType):
(WebCore::DisplayList::Recorder::appendStateChangeItemIfNecessary):
Added.
* platform/graphics/displaylists/DisplayListRecorder.h:
(WebCore::DisplayList::Recorder::append):
(WebCore::DisplayList::Recorder::itemNeedsState): Added this as a
constexpr helper function, to ensure we make a decision about needing
to call appendStateChangeItemIfNecessary at compile time.
2021-05-06 Cameron McCormack <heycam@apple.com>
Make DisplayList::dump print out the display list contents
https://bugs.webkit.org/show_bug.cgi?id=225431
Reviewed by Simon Fraser.
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::description const):
(WebCore::DisplayList::operator<<): This needs to move so that
argument-dependent lookup for the operator<< call in description()
works.
* platform/graphics/displaylists/DisplayList.h:
2021-05-06 Tim Nguyen <ntim@apple.com>
[mediaqueries] Remove "on-demand" value for any-hover/hover & "forced" value for prefers-contrast
https://bugs.webkit.org/show_bug.cgi?id=225400
Reviewed by Antti Koivisto.
These were both removed from the spec and currently never evaluate to true. They also won't eval to true after this change.
Only change is serialization, since the values will become invalid.
Also:
- Re-synced css/mediaqueries WPTs
- Adjusted any-hover/hover parsing tests accordingly.
* css/CSSValueKeywords.in:
* css/MediaQueryEvaluator.cpp:
(WebCore::prefersContrastEvaluate):
* css/MediaQueryExpression.cpp:
(WebCore::isValidValueForIdentMediaFeature):
2021-05-05 Megan Gardner <megan_gardner@apple.com>
AppHighlight scrolls should be smooth
https://bugs.webkit.org/show_bug.cgi?id=225395
Reviewed by Simon Fraser.
Leverage smooth scrolling experimental feature to allow AppHighlight scrolls
to be smooth.
* Modules/highlight/AppHighlightStorage.cpp:
(WebCore::AppHighlightStorage::attemptToRestoreHighlightAndScroll):
* editing/Editor.cpp:
(WebCore::TemporarySelectionChange::setSelection):
* editing/Editor.h:
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::setSelection):
(WebCore::FrameSelection::updateAndRevealSelection):
(WebCore::FrameSelection::revealSelection):
* editing/FrameSelection.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::scrollTo const):
* page/ScrollBehavior.cpp:
(WebCore::useSmoothScrolling):
* platform/ScrollTypes.h:
2021-05-05 Mark Lam <mark.lam@apple.com>
Introduce VM::hasPendingTerminationException() to make code a little more terse.
https://bugs.webkit.org/show_bug.cgi?id=225412
Reviewed by Michael Saboff.
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::handleResponseOnStreamingAction):
* bindings/js/JSDOMPromise.cpp:
(WebCore::DOMPromise::whenPromiseIsSettled):
* bindings/js/JSDOMPromiseDeferred.cpp:
(WebCore::DeferredPromise::reject):
* bindings/js/ReadableStream.cpp:
(WebCore::invokeReadableStreamFunction):
(WebCore::ReadableStream::lock):
(WebCore::checkReadableStream):
* bindings/js/ReadableStreamDefaultController.cpp:
(WebCore::invokeReadableStreamDefaultControllerFunction):
(WebCore::ReadableStreamDefaultController::error):
(WebCore::ReadableStreamDefaultController::enqueue):
2021-05-05 Aditya Keerthi <akeerthi@apple.com>
[macOS] Use system colors for ActiveButtonText
https://bugs.webkit.org/show_bug.cgi?id=225375
<rdar://problem/75863443>
Reviewed by Tim Horton.
Currently, the ActiveButtonText color keyword returns a hardcoded value
on macOS. This behavior is problematic since AppKit can make changes to
the button style, leaving us with illegible text when a button is
pressed.
To fix, return a system color for ActiveButtonText, so that our pressed
buttons are consistent with the rest of the system.
* rendering/RenderThemeMac.mm:
(WebCore::activeButtonTextColor):
AppKit determines the pressed (active) text color using the cell's
interiorBackgroundStyle. There is not a single system color exposed for
the pressed text color, so it must be determined dynamically.
Unfortunately, this requires us to create an NSButtonCell to determine
the appropriate color. However, this logic is relatively inexpensive,
since we cache exposed system colors.
(WebCore::RenderThemeMac::systemColor const):
Remove the hardcoded value.
2021-05-05 Cameron McCormack <heycam@apple.com>
Remove unused DisplayList::Recorder::ContextState::wasUsedForDrawing
https://bugs.webkit.org/show_bug.cgi?id=225381
Reviewed by Simon Fraser.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::canAppendItemOfType):
(WebCore::DisplayList::Recorder::restore):
* platform/graphics/displaylists/DisplayListRecorder.h:
2021-05-05 Cameron McCormack <heycam@apple.com>
Rename DisplayList::Recorder::appendDrawGraphsItemWithCachedFont.
https://bugs.webkit.org/show_bug.cgi?id=225382
Reviewed by Simon Fraser.
It appends a DrawGlyphsItem, not a DrawGraphsItem.
* platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp:
(WebCore::DisplayList::DrawGlyphsRecorder::recordDrawGlyphs):
(WebCore::DisplayList::DrawGlyphsRecorder::drawGlyphs):
* platform/graphics/displaylists/DisplayListDrawGlyphsRecorderHarfBuzz.cpp:
(WebCore::DisplayList::DrawGlyphsRecorder::drawGlyphs):
* platform/graphics/displaylists/DisplayListDrawGlyphsRecorderWin.cpp:
(WebCore::DisplayList::DrawGlyphsRecorder::drawGlyphs):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::appendDrawGlyphsItemWithCachedFont):
* platform/graphics/displaylists/DisplayListRecorder.h:
2021-05-05 Cameron McCormack <heycam@apple.com>
Fix copy paste error in Recorder::canAppendItemOfType.
https://bugs.webkit.org/show_bug.cgi?id=225380
Reviewed by Simon Fraser.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::canAppendItemOfType):
2021-05-05 Devin Rousso <drousso@apple.com>
Sampled Page Top Color: tie into existing TCADA/RLTT systems so that the value is kept in sync with painting
https://bugs.webkit.org/show_bug.cgi?id=225405
Reviewed by Tim Horton.
Instead of sending an IPC to the UIProcess whenever the logic to determine the sampled page
top color finishes, wait to dispatch the IPC until we're about to render (just like theme
color and page extended background color). On macOS, this means the IPC is dispatched inside
`TiledCoreAnimationDrawingArea::updateRendering`. On iOS, the `Color` is included as part of
the `RemoteLayerTreeTransaction`.
* dom/Document.cpp:
(WebCore::Document::determineSampledPageTopColor):
* page/ChromeClient.h:
(WebCore::ChromeClient::sampledPageTopColorChanged const): Renamed from `didSamplePageTopColor`.
2021-05-05 Devin Rousso <drousso@apple.com>
Sampled Page Top Color: don't snapshot if the hit test location is an image or has an animation
https://bugs.webkit.org/show_bug.cgi?id=225338
Reviewed by Tim Horton.
Tests: SampledPageTopColor.HitTestHTMLImage
SampledPageTopColor.HitTestCSSBackgroundImage
SampledPageTopColor.HitTestCSSAnimation
* dom/Document.h:
* dom/Document.cpp:
(WebCore::isValidPageSampleLocation): Added.
(WebCore::samplePageColor): Added.
(WebCore::Document::determineSampledPageTopColor):
(WebCore::Document::isHitTestLocationThirdPartyFrame): Deleted.
Refactor `isHitTestLocationThirdPartyFrame` (and the `pixelColor` lambda) into `static`
functions that are right above `Document::determineSampledPageTopColor` for clarity and to
allow for more flexibility. In order to check if the hit test node is an image (including
having a CSS `background-image`) or has a CSS animation (or CSS transition), it's necessary
to continue to hit test beyond one node as the image and/or node with the CSS animation may
be an ancestor (or unrelated `position: absolute` node) to the `HitTestResult::innerNode`.
```
<div style="background-image: url(...)">
<button>Lorum ipsum ... </button>
</div>
```
2021-05-05 Tim Nguyen <ntim@apple.com>
Invalid media query keyword values should not be parsable
https://bugs.webkit.org/show_bug.cgi?id=225282
Reviewed by Dean Jackson.
Updated WPT expectations.
* css/MediaQueryExpression.cpp:
(WebCore::isValidValueForIdentMediaFeature):
(WebCore::featureWithValidIdent):
2021-05-05 Alex Christensen <achristensen@webkit.org>
Add WebKitAdditions stubs for new NetworkLoadMetrics
https://bugs.webkit.org/show_bug.cgi?id=225406
<rdar://77563372>
Reviewed by Jer Noble.
I also removed some dead code and added static asserts that do what the dead code was intended to do.
* platform/network/NetworkLoadMetrics.h:
(WebCore::NetworkLoadMetrics::isolatedCopy const):
(WebCore::NetworkLoadMetrics::operator== const):
(WebCore::NetworkLoadMetrics::encode const):
(WebCore::NetworkLoadMetrics::decode):
(WTF::Persistence::Coder<Optional<WebCore::NetworkLoadPriority>>::encode): Deleted.
(WTF::Persistence::Coder<Optional<WebCore::NetworkLoadPriority>>::decode): Deleted.
* platform/network/cocoa/WebCoreNSURLSession.mm:
2021-05-05 Alicia Boya García <aboya@igalia.com>
[MSE][GStreamer] WebKitMediaSrc rework v2
https://bugs.webkit.org/show_bug.cgi?id=225192
Reviewed by Xabier Rodriguez-Calvar.
This patch (re)introduces a new source element for the MSE playback
pipeline. This is an iteration on the previous work on r249205 that
had to be reverted in r251365 because of flaky playbin3 bugs.
This new version avoids these pitfalls by avoiding flushes in
situations where they are avoidable and known to expose bugs.
This re-land shares many of the advantages that motivated the first
patch: seeks massively oversimplified and greater control by no longer
relying on appsrc. It can handle flushes of individual streams
natively.
Work has also gone into decoupling the state of the frame queue from
the state of WebKitMediaSrc so that the backend can survive
transitions from PAUSED to READY and back which
MediaPlayerPrivateGStreamer creates when playback ends. This latter
effort is not complete, and instead this version adds a special case
to inhibit downwards and back upwards transitions, avoiding any
issues.
It is expected that at this point this new backend is at least as
stable as the previous one. No LayoutTest has got worsened
expectations from adding this backend and some have improved.
* platform/GStreamer.cmake:
* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(webKitGLVideoSinkFinalize):
(webKitGLVideoSinkSetMediaPlayerPrivate):
* platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
(WTF::adoptGRef):
(WTF::refGPtr<GstMiniObject>):
(WTF::derefGPtr<GstMiniObject>):
* platform/graphics/gstreamer/GRefPtrGStreamer.h:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::doSeek):
(WebCore::MediaPlayerPrivateGStreamer::updateTracks):
(WebCore::MediaPlayerPrivateGStreamer::handleStreamCollectionMessage):
(WebCore::MediaPlayerPrivateGStreamer::handleMessage):
(WebCore::MediaPlayerPrivateGStreamer::didEnd):
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(WebCore::MediaPlayerPrivateGStreamer::invalidateCachedPosition):
* platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
(WebCore::TrackPrivateBaseGStreamer::setInitialCaps):
(WebCore::TrackPrivateBaseGStreamer::initialCaps):
* platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
(WebCore::AppendPipeline::appsinkCapsChanged):
(WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromStreamingThread):
(WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
* platform/graphics/gstreamer/mse/AppendPipeline.h:
(WebCore::AppendPipeline::demuxerSrcPadCaps):
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::~MediaPlayerPrivateGStreamerMSE):
(WebCore::MediaPlayerPrivateGStreamerMSE::load):
(WebCore::MediaPlayerPrivateGStreamerMSE::play):
(WebCore::MediaPlayerPrivateGStreamerMSE::pause):
(WebCore::MediaPlayerPrivateGStreamerMSE::seek):
(WebCore::MediaPlayerPrivateGStreamerMSE::doSeek):
(WebCore::MediaPlayerPrivateGStreamerMSE::setReadyState):
(WebCore::MediaPlayerPrivateGStreamerMSE::propagateReadyStateToPlayer):
(WebCore::MediaPlayerPrivateGStreamerMSE::asyncStateChangeDone):
(WebCore::MediaPlayerPrivateGStreamerMSE::sourceSetup):
(WebCore::MediaPlayerPrivateGStreamerMSE::updateStates):
(WebCore::MediaPlayerPrivateGStreamerMSE::unblockDurationChanges):
(WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):
(WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected):
(WebCore::MediaPlayerPrivateGStreamerMSE::startSource):
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
(WebCore::MediaPlayerPrivateGStreamerMSE::hasAllTracks const):
(WebCore::MediaPlayerPrivateGStreamerMSE::webKitMediaSrc):
* platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp:
(WebCore::MediaSourcePrivateGStreamer::addSourceBuffer):
(WebCore::MediaSourcePrivateGStreamer::markEndOfStream):
(WebCore::MediaSourcePrivateGStreamer::unmarkEndOfStream):
(WebCore::MediaSourcePrivateGStreamer::waitForSeekCompleted):
(WebCore::MediaSourcePrivateGStreamer::seekCompleted):
(WebCore::MediaSourcePrivateGStreamer::startPlaybackIfHasAllTracks):
* platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h:
* platform/graphics/gstreamer/mse/MediaSourceTrackGStreamer.cpp: Added.
(WebCore::MediaSourceTrackGStreamer::MediaSourceTrackGStreamer):
(WebCore::MediaSourceTrackGStreamer::~MediaSourceTrackGStreamer):
(WebCore::MediaSourceTrackGStreamer::create):
(WebCore::MediaSourceTrackGStreamer::isReadyForMoreSamples):
(WebCore::MediaSourceTrackGStreamer::notifyWhenReadyForMoreSamples):
(WebCore::MediaSourceTrackGStreamer::enqueueObject):
(WebCore::MediaSourceTrackGStreamer::clearQueue):
(WebCore::MediaSourceTrackGStreamer::remove):
* platform/graphics/gstreamer/mse/MediaSourceTrackGStreamer.h: Added.
* platform/graphics/gstreamer/mse/PlaybackPipeline.h: Removed.
* platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
(WebCore::SourceBufferPrivateGStreamer::removedFromMediaSource):
(WebCore::SourceBufferPrivateGStreamer::flush):
(WebCore::SourceBufferPrivateGStreamer::enqueueSample):
(WebCore::SourceBufferPrivateGStreamer::isReadyForMoreSamples):
(WebCore::SourceBufferPrivateGStreamer::notifyClientWhenReadyForMoreSamples):
(WebCore::SourceBufferPrivateGStreamer::allSamplesInTrackEnqueued):
(WebCore::SourceBufferPrivateGStreamer::didReceiveInitializationSegment):
* platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
* platform/graphics/gstreamer/mse/TrackQueue.cpp: Added.
(WebCore::TrackQueue::TrackQueue):
(WebCore::TrackQueue::enqueueObject):
(WebCore::TrackQueue::clear):
(WebCore::TrackQueue::flush):
(WebCore::TrackQueue::notifyWhenLowLevel):
(WebCore::TrackQueue::pop):
(WebCore::TrackQueue::notifyWhenNotEmpty):
(WebCore::TrackQueue::resetNotEmptyHandler):
(WebCore::TrackQueue::checkLowLevel):
(WebCore::TrackQueue::durationEnqueued const):
* platform/graphics/gstreamer/mse/TrackQueue.h: Added.
(WebCore::TrackQueue::isFull const):
(WebCore::TrackQueue::isEmpty const):
(WebCore::TrackQueue::hasNotEmptyHandler const):
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
(WebKitMediaSrcPrivate::streamByName):
(WebKitMediaSrcPrivate::isStarted):
(WTF::adoptGRef):
(WTF::refGPtr<WebKitMediaSrcPad>):
(WTF::derefGPtr<WebKitMediaSrcPad>):
(webkit_media_src_pad_class_init):
(Stream::Stream):
(Stream::StreamingMembers::StreamingMembers):
(findPipeline):
(gstStreamType):
(streamTypeToString):
(webkit_media_src_class_init):
(webkit_media_src_init):
(webKitMediaSrcFinalize):
(webKitMediaSrcEmitStreams):
(webKitMediaSrcTearDownStream):
(webKitMediaSrcActivateMode):
(webKitMediaSrcPadLinked):
(webKitMediaSrcLoop):
(webKitMediaSrcStreamFlush):
(webKitMediaSrcFlush):
(webKitMediaSrcSeek):
(countStreamsOfType):
(webKitMediaSrcGetProperty):
(webKitMediaSrcChangeState):
(webKitMediaSrcSendEvent):
(webKitMediaSrcUriGetType):
(webKitMediaSrcGetProtocols):
(webKitMediaSrcGetUri):
(webKitMediaSrcSetUri):
(webKitMediaSrcUriHandlerInit):
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h:
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamerPrivate.h: Removed.
2021-05-05 Devin Rousso <drousso@apple.com>
Sampled Page Top Color: take additional snapshots further down the page to see if the sampled top color is more than just a tiny strip
https://bugs.webkit.org/show_bug.cgi?id=225323
Reviewed by Beth Dakin.
Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
color needs to extend in order for us to not bail. If the value > 0, we take an additional
snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
the color across the top of the page is only a small strip, these extra snapshot comparisons
will prevent a resulting color from being derived.
Tests: SampledPageTopColor.VerticalGradientBelowMaxDifference
SampledPageTopColor.VerticalGradientAboveMaxDifference
* dom/Document.cpp:
(WebCore::Document::determineSampledPageTopColor):
2021-05-05 Youenn Fablet <youenn@apple.com>
No need to error a fetch body stream if its request or response is stopped
https://bugs.webkit.org/show_bug.cgi?id=225347
Reviewed by Geoffrey Garen.
Test: http/wpt/fetch/fetch-response-body-stop-in-worker.html
* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::stop):
Nullify the source before we error it.
2021-05-05 Sam Weinig <weinig@apple.com>
Add preliminary support for specifying a color space for 2D canvas
https://bugs.webkit.org/show_bug.cgi?id=225286
Reviewed by Dean Jackson.
Tests: fast/canvas/CanvasRenderingContext2DSettings-colorSpace-disabled.html
fast/canvas/CanvasRenderingContext2DSettings-colorSpace-enabled.html
fast/canvas/canvas-color-space-display-p3.html
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
Add new files.
* html/canvas/CanvasRenderingContext2DSettings.idl:
* html/canvas/CanvasRenderingContext2DSettings.h:
Add a new setting blocked member to the CanvasRenderingContext2DSettings
dictionary for specifying a color space.
* html/canvas/PredefinedColorSpace.cpp: Added.
* html/canvas/PredefinedColorSpace.h: Added.
* html/canvas/PredefinedColorSpace.idl: Added.
Add a new IDL enumeration to represent the possible color spaces supported.
For ports that don't support DisplayP3, trying to use it will result in
type error from JS.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::reset):
Add checks for color space and pixel format to 2d context reset optimation.
This can happen if the image buffer is allocated prior to the context being
requested (such as via canvas.toDataURL() or canvas.toBlob()).
(WebCore::HTMLCanvasElement::createImageBuffer const):
Pass the correct color space and pixel format (though
the later is always BGRA8 at the moment) to the ImageBuffer
create function to make a backing store in the right format.
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::createBufferForPainting const):
* html/HTMLVideoElement.h:
Pass color space and pixel format through to ensure the helper
buffer matches the correct color space.
* html/ImageBitmap.cpp:
(WebCore::ImageBitmap::createPromise):
Pass the existing defaults to HTMLVideoElement::createBufferForPainting.
In the future, ImageBitmap will also gain color space and pixel
format specificity and this will be updated.
* html/canvas/CanvasRenderingContext.cpp:
(WebCore::CanvasRenderingContext::pixelFormat const):
(WebCore::CanvasRenderingContext::colorSpace const):
* html/canvas/CanvasRenderingContext.h:
Add virtual base implementations of colorSpace and pixelFormat
which CanvasRenderingContext2D can override to return the
values specified in the CanvasRenderingContext2DSettings.
* html/canvas/CanvasRenderingContext2D.h:
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::fontProxy const):
Fix incorrect formatting.
(WebCore::CanvasRenderingContext2D::pixelFormat const):
(WebCore::CanvasRenderingContext2D::colorSpace const):
Add overrides, return m_settings.colorSpace for colorSpace.
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::drawImage):
(WebCore::CanvasRenderingContext2DBase::createCompositingBuffer):
(WebCore::CanvasRenderingContext2DBase::createPattern):
(WebCore::CanvasRenderingContext2DBase::drawTextUnchecked):
Pass along the colorSpace and pixelFormat when creating buffers.
* html/shadow/DateTimeSymbolicFieldElement.cpp:
Add missing includes that are now needed.
2021-05-05 Philippe Normand <pnormand@igalia.com>
[GStreamer][WebRTC] Wrap incoming audio buffers, complying with fastMalloc restrictions
https://bugs.webkit.org/show_bug.cgi?id=225351
Reviewed by Xabier Rodriguez-Calvar.
The audio thread should avoid calling fastMalloc for performance reasons, so audio buffers
are now wrapped in GStreamer buffers and passed as read-only memories to the observers.
* platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp:
(WebCore::RealtimeIncomingAudioSourceLibWebRTC::OnData):
2021-05-05 Carlos Garcia Campos <cgarcia@igalia.com>
[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-05-05 Ryosuke Niwa <rniwa@webkit.org>
Use WeakHashSet instead of HashSet of raw pointes in Document and SVGDocumentExtensions
https://bugs.webkit.org/show_bug.cgi?id=225390
Reviewed by Antti Koivisto.
Replaced Document's m_documentSuspensionCallbackElements and m_articleElements as well as
SVGDocumentExtensions's m_timeContainers and m_svgFontFaceElements with WeakHashSet.
Also moved m_svgUseElements from Document to SVGDocumentExtensions as a WeakHashSet.
This patch also deletes Document::m_mediaStreamStateChangeElements which was never used,
m_mainArticleElement a WeakPtr instead of a raw pointer, replaces SVGDocumentExtensions's
m_rebuildElements, which is a temporary Vector used during tree mutations, with a Vector
of Refs instead of raw pointers.
No new tests since there should be no observable behavior differences.
* dom/Document.cpp:
(WebCore::Document::~Document): The release assert is moved to ~SVGDocumentExtensions.
(WebCore::Document::resolveStyle):
(WebCore::Document::suspend):
(WebCore::Document::resume):
(WebCore::Document::registerForDocumentSuspensionCallbacks):
(WebCore::Document::unregisterForDocumentSuspensionCallbacks):
(WebCore::Document::addSVGUseElement): Moved to SVGDocumentExtensions.
(WebCore::Document::removeSVGUseElement): Ditto.
(WebCore::Document::registerArticleElement):
(WebCore::Document::unregisterArticleElement):
(WebCore::Document::updateMainArticleElementAfterLayout):
(WebCore::Document::prepareCanvasesForDisplayIfNeeded):
(WebCore::Document::clearCanvasPreparation):
(WebCore::Document::canvasChanged):
(WebCore::Document::canvasDestroyed):
* dom/Document.h:
(WebCore::Document:: const const): Deleted.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::~HTMLCanvasElement):
(WebCore::HTMLCanvasElement::didMoveToNewDocument):
(WebCore::HTMLCanvasElement::removedFromAncestor):
* style/StyleResolver.cpp:
(WebCore::Style::Resolver::addCurrentSVGFontFaceRules):
* svg/SVGDocumentExtensions.cpp:
(WebCore::SVGDocumentExtensions::~SVGDocumentExtensions): Moved the release assertion
from ~Document.
(WebCore::SVGDocumentExtensions::addTimeContainer):
(WebCore::SVGDocumentExtensions::removeTimeContainer):
(WebCore::SVGDocumentExtensions::addUseElementWithPendingShadowTreeUpdate): Moved here
Document::addSVGUseElement.
(WebCore::SVGDocumentExtensions::removeUseElementWithPendingShadowTreeUpdate): Ditto.
(WebCore::SVGDocumentExtensions::startAnimations):
(WebCore::SVGDocumentExtensions::pauseAnimations):
(WebCore::SVGDocumentExtensions::unpauseAnimations):
(WebCore::SVGDocumentExtensions::dispatchLoadEventToOutermostSVGElements):
(WebCore::SVGDocumentExtensions::rebuildElements):
(WebCore::SVGDocumentExtensions::clearTargetDependencies):
(WebCore::SVGDocumentExtensions::removeAllElementReferencesForTarget):
(WebCore::SVGDocumentExtensions::registerSVGFontFaceElement):
(WebCore::SVGDocumentExtensions::unregisterSVGFontFaceElement):
* svg/SVGDocumentExtensions.h:
(WebCore::SVGDocumentExtensions::useElementsWithPendingShadowTreeUpdate const): Added.
(WebCore::SVGDocumentExtensions::svgFontFaceElements const):
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::insertedIntoAncestor):
(WebCore::SVGUseElement::removedFromAncestor):
(WebCore::SVGUseElement::updateShadowTree):
(WebCore::SVGUseElement::invalidateShadowTree):
2021-05-05 Chris Lord <clord@igalia.com>
OffscreenCanvas should preserve context transform after transferToImageBitmap
https://bugs.webkit.org/show_bug.cgi?id=225304
Reviewed by Darin Adler.
transferToImageBitmap should not affect the state of the canvas
context. Instead of returning the actual canvas buffer, to which the
drawing context is tightly bound, return a copy and clear the
original.
No new tests, rebaselined existing tests.
* html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::transferToImageBitmap):
(WebCore::OffscreenCanvas::takeImageBuffer const):
* html/canvas/CanvasRenderingContext2DBase.h:
2021-05-04 Peng Liu <peng.liu6@apple.com>
[GPUP] Implement SourceBufferPrivateRemote::bufferFull()
https://bugs.webkit.org/show_bug.cgi?id=224139
Reviewed by Jer Noble.
* platform/graphics/SourceBufferPrivate.h:
(WebCore::SourceBufferPrivate::setBufferFull): This function will be used
by `SourceBufferPrivateRemote::evictCodedFrames()` and `SourceBufferPrivateRemote::reenqueueMediaIfNeeded()`.
2021-05-04 Antti Koivisto <antti@apple.com>
REGRESSION(iOS 14): Author shadow DOM invalidated unnecessarily on pseudo element change
https://bugs.webkit.org/show_bug.cgi?id=222187
<rdar://problem/74801314>
Reviewed by Ryosuke Niwa.
Hovering the element causes us to invalidate the entire author shadow tree style.
The invalidation is triggered by the user agent stylesheet having some :hover rules targeting pseudo
elements. This should not require invalidation except for those specific elements and only for
UA shadow trees.
This patch optimizes the case and avoids unnecessary invalidations.
Test: fast/shadow-dom/shadow-style-invalidation-pseudo-element.html
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::handleFocusEvent):
(WebCore::HTMLInputElement::handleBlurEvent):
(WebCore::HTMLInputElement::invalidateStyleOnFocusChangeIfNeeded):
Input elements with 'text-overflow:ellipsis' (which is affected by focus) were relying
on spurious invalidations that we now optimize away. Invalidate properly.
* html/HTMLInputElement.h:
* style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::collectMatchingShadowPseudoElementRules):
* style/RuleSet.cpp:
(WebCore::Style::RuleSet::evaluateDynamicMediaQueryRules):
(WebCore::Style::RuleSet::hasShadowPseudoElementRules const): Deleted.
Handle ::cue separately.
* style/RuleSet.h:
(WebCore::Style::RuleSet::cuePseudoRules const):
(WebCore::Style::RuleSet::hasShadowPseudoElementRules const):
* style/StyleInvalidationFunctions.h:
(WebCore::Style::traverseRuleFeatures):
* style/StyleInvalidator.cpp:
(WebCore::Style::Invalidator::collectRuleInformation):
(WebCore::Style::Invalidator::invalidateShadowPseudoElements):
Narrowly invalidate user agent shadow tree pseudo elements.
(WebCore::Style::Invalidator::invalidateInShadowTreeIfNeeded):
* style/StyleInvalidator.h:
2021-05-04 Kenneth Russell <kbr@chromium.org>
WebKit must treat 'webgl' and 'webgl2' as distinct context types
https://bugs.webkit.org/show_bug.cgi?id=222758
Reviewed by Dean Jackson.
Update both the regular getContext and CSS context code paths with
checks distinguishing WebGL 1.0 and 2.0 contexts.
Covered by existing WebGL 2.0 conformance tests.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getContext):
(WebCore::HTMLCanvasElement::getContextWebGL):
2021-05-04 Jer Noble <jer.noble@apple.com>
[Media in GPU Process] Move AudioSessionRoutingArbitratorProxy to the GPU process
https://bugs.webkit.org/show_bug.cgi?id=217535
<rdar://problem/70152548>
Reviewed by Eric Carlson.
Add a new shared object, SharedRoutingArbitrator, to be used both in the UIProcess (when media
in the GPU process is not enabled) and the GPUProcess (when it is).
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/audio/AudioSession.h:
* platform/audio/mac/SharedRoutingArbitrator.h: Added.
* platform/audio/mac/SharedRoutingArbitrator.mm: Added.
(WebCore::SharedRoutingArbitrator::Token::create):
(WebCore::SharedRoutingArbitrator::sharedInstance):
(WebCore::SharedRoutingArbitrator::isInRoutingArbitrationForToken):
(WebCore::SharedRoutingArbitrator::beginRoutingArbitrationForToken):
(WebCore::SharedRoutingArbitrator::endRoutingArbitrationForToken):
2021-05-04 Chris Dumez <cdumez@apple.com>
Blob contentType with charset renders html as plain text
https://bugs.webkit.org/show_bug.cgi?id=225226
Reviewed by Alex Christensen.
Our code would use the Blob's Content-Type (media type) as a MIME type internally. As a result, if the Blob's
media type would contain anything besides the MIME type (e.g. a charget), then it would lead to failures.
Test: fast/files/blob-with-charget-as-main-resource.html
* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::notifyResponseOnSuccess):
* platform/network/HTTPParsers.h:
2021-05-04 Cameron McCormack <heycam@apple.com>
Handle clamping of heights for images affected by background-size and EXIF orientation correctly
https://bugs.webkit.org/show_bug.cgi?id=221005
<rdar://problem/73692426>
Reviewed by Simon Fraser.
GraphicsContext::drawPlatformImage handles requests with source rects
whose heights are greater than the image (which can happen due to
rounding issues) by clamping the source rect. This clamping incorrectly
looks at the CGImage's height, which for an image rotated 90deg due to
EXIF orientation metadata, is the wrong dimension.
Test: fast/images/image-orientation-background-size-bug.html
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawPlatformImage):
2021-05-04 Jer Noble <jer.noble@apple.com>
[Cocoa] Cache the value of MediaPlayerPrivateAVFoundationObjC::assetStatus()
https://bugs.webkit.org/show_bug.cgi?id=225262
Reviewed by Eric Carlson.
Calling into assetStatus() requires querying the load state and value of nine different
AVAsset properties, which adds up if assetStatus() is called often. Once the assetStatus()
value reaches the Loaded state, cache that property, and that of the AVAsset.playable
property, so subsequent queries are just an ivar lookup.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::assetStatus const):
2021-05-04 Jer Noble <jer.noble@apple.com>
REGRESSION (r276883): [Debug] ASSERTION FAILED: index != notFound in WebCore::PlatformMediaSessionManager::setCurrentSession()
https://bugs.webkit.org/show_bug.cgi?id=225332
<rdar://problem/77476145>
Reviewed by Eric Carlson.
PlatformMediaSessionManager will throw an assert if the session being set as "current" via
sessionWillBeginPlayback() isn't active; we activate the session immediately after this line
inside lazyInitialize(), but this looks to be too late. A similar problem may occur in
HTMLMediaElement::playInternal(), so activate the session there too.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::lazyInitialize):
(WebCore::AudioContext::willBeginPlayback):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::playInternal):
2021-05-04 Sergio Villar Senin <svillar@igalia.com>
ASSERTION FAILED: contentSize >= 0 in WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax
https://bugs.webkit.org/show_bug.cgi?id=222711
<rdar://problem/75022692>
Reviewed by Alan Bujtas.
Flexbox code was computing negative content sizes for FrameSet children because RenderFrameSet lacked
a implementation of computePreferredLogicalWidths(). Added basic preferred width computation
to RenderBox so that FrameSet and any other potential new RenderBox child could benefit from it.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePreferredLogicalWidths): Added a basic implementation that calls
computePreferredLogicalWidths(minWidth,maxWidth,borderAndPadding) and clears the flag.
* rendering/RenderBox.h:
(WebCore::RenderBox::computePreferredLogicalWidths): Deleted default implementation.
2021-05-04 Antoine Quint <graouts@webkit.org>
REGRESSION (r260360): animation-wide timing function does not apply to 2-keyframe transform Web Animation
https://bugs.webkit.org/show_bug.cgi?id=225301
<rdar://problem/77452933>
Reviewed by Dean Jackson.
Core Animation has a limitation where an animation-wide cubic timing function with y values outside of the [0-1]
range are not applied correctly since those values are clipped. This is not the case with similar timing functions
applied to a keyframe interval. This is known issue covered by bug 215918.
We worked around this limitation for CSS Transitions in bug 215826. Indeed, in this case we know that the animation
has a single interval and no keyframe-specific timing function, so GraphicsLayerCA would check whether the Animation
object originated from a CSS Transition and set the animation-wide timing function on the generated AnimationValue.
With this patch we generalize this approach to any animation, no matter its origin, that has a single keyframe
interval with no timing function or a timing function that has a linear effect. To do this, we first check in
GraphicsLayerCA::addAnimation*() whether we are dealing with an animation that has an animation-wide cubic timing
function outside of the [0-1] range. If that is not the case, we return early and indicate that this animation
cannot be run accelerated.
If instead that is the case, we pass a new boolean flag down through the call stack to setupAnimation() and
timingFunctionForAnimationValue() where we choose to use the animation-wide timing function on the first keyframe
rather than the animation itself.
Test: webanimations/accelerated-web-animation-with-single-interval-and-easing-y-axis-above-1.html
* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::timingFunctionIsCubicTimingFunctionWithYValueOutOfRange):
(WebCore::keyframeValueListHasSingleIntervalWithLinearOrEquivalentTimingFunction):
(WebCore::GraphicsLayerCA::addAnimation):
(WebCore::GraphicsLayerCA::createAnimationFromKeyframes):
(WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
(WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
(WebCore::GraphicsLayerCA::createFilterAnimationsFromKeyframes):
(WebCore::GraphicsLayerCA::createBasicAnimation):
(WebCore::GraphicsLayerCA::createKeyframeAnimation):
(WebCore::GraphicsLayerCA::createSpringAnimation):
(WebCore::GraphicsLayerCA::setupAnimation):
(WebCore::GraphicsLayerCA::timingFunctionForAnimationValue):
(WebCore::GraphicsLayerCA::setAnimationKeyframes):
(WebCore::GraphicsLayerCA::setTransformAnimationKeyframes):
(WebCore::GraphicsLayerCA::setFilterAnimationKeyframes):
* platform/graphics/ca/GraphicsLayerCA.h:
2021-05-04 Dean Jackson <dino@apple.com>
[WebXR] Move WebXROpaqueFramebuffer to its own file
https://bugs.webkit.org/show_bug.cgi?id=225334
Reviewed by Sam Weinig.
Move WebXROpaqueFramebuffer out of WebXRWebGLLayer.
* Modules/webxr/WebXROpaqueFramebuffer.cpp: Copied from Source/WebCore/Modules/webxr/WebXRWebGLLayer.cpp.
(WebCore::WebXROpaqueFramebuffer::create):
(WebCore::WebXROpaqueFramebuffer::WebXROpaqueFramebuffer):
(WebCore::WebXROpaqueFramebuffer::~WebXROpaqueFramebuffer):
(WebCore::WebXROpaqueFramebuffer::startFrame):
(WebCore::WebXROpaqueFramebuffer::endFrame):
(WebCore::WebXROpaqueFramebuffer::setupFramebuffer):
* Modules/webxr/WebXROpaqueFramebuffer.h: Copied from Source/WebCore/Modules/webxr/WebXRWebGLLayer.h.
(WebCore::WebXROpaqueFramebuffer::handle const):
(WebCore::WebXROpaqueFramebuffer::framebuffer const):
(WebCore::WebXROpaqueFramebuffer::width const):
(WebCore::WebXROpaqueFramebuffer::height const):
* Modules/webxr/WebXRWebGLLayer.cpp:
(WebCore::WebXROpaqueFramebuffer::create): Deleted.
(WebCore::WebXROpaqueFramebuffer::WebXROpaqueFramebuffer): Deleted.
(WebCore::WebXROpaqueFramebuffer::~WebXROpaqueFramebuffer): Deleted.
(WebCore::WebXROpaqueFramebuffer::startFrame): Deleted.
(WebCore::WebXROpaqueFramebuffer::endFrame): Deleted.
(WebCore::WebXROpaqueFramebuffer::setupFramebuffer): Deleted.
* Modules/webxr/WebXRWebGLLayer.h:
(WebCore::WebXROpaqueFramebuffer::handle const): Deleted.
(WebCore::WebXROpaqueFramebuffer::framebuffer const): Deleted.
(WebCore::WebXROpaqueFramebuffer::width const): Deleted.
(WebCore::WebXROpaqueFramebuffer::height const): Deleted.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
2021-05-04 Dean Jackson <dino@apple.com>
[WebXR] Remove renamed IDL files in Xcode project
https://bugs.webkit.org/show_bug.cgi?id=225331
Reviewed by Sam Weinig.
The Xcode project had a bunch of references to files that were
renamed a while ago.
* WebCore.xcodeproj/project.pbxproj:
2021-05-04 Philippe Normand <pnormand@igalia.com>
[WebRTC][GStreamer] fast/mediastream/resize-trim.html is failing
https://bugs.webkit.org/show_bug.cgi?id=192888
Reviewed by Xabier Rodriguez-Calvar.
The test was failing because the GStreamer mock video source was producing garbled frames
and the pixel test in the canvas was failing to detect gray. The frame was garbled because
the test asked "exact" video width that was inferior to the capture video width and we were
not taking this into account when creating a MediaSample from the video frame.
MediaSampleGStreamer::createImageSample() can now optionally resize the video frame
according to the destinationSize, if it was specified.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::toMediaSample):
* platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
(WebCore::MediaSampleGStreamer::createImageSample):
* platform/graphics/gstreamer/MediaSampleGStreamer.h:
(WebCore::MediaSampleGStreamer::createImageSample):
* platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.cpp:
(WebCore::MockRealtimeVideoSourceGStreamer::updateSampleBuffer):
* platform/mock/MockRealtimeVideoSource.h:
2021-05-04 Youenn Fablet <youenn@apple.com>
Use OptionSet for MediaProducer::MediaStateFlags
https://bugs.webkit.org/show_bug.cgi?id=225227
Reviewed by Eric Carlson.
Update code to use a safer MediaProducer::MediaStateFlags type.
No change of behavior, this is a refactoring.
* Modules/airplay/WebMediaSessionManager.cpp:
(WebCore::flagsAreSet):
(WebCore::mediaProducerStateString):
(WebCore::WebMediaSessionManager::showPlaybackTargetPicker):
(WebCore::WebMediaSessionManager::clientStateDidChange):
(WebCore::WebMediaSessionManager::configurePlaybackTargetClients):
(WebCore::WebMediaSessionManager::configurePlaybackTargetMonitoring):
(WebCore::WebMediaSessionManager::configureWatchdogTimer):
* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::mediaState const):
* Modules/mediastream/MediaStream.h:
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::sourceCaptureState):
(WebCore::MediaStreamTrack::captureState):
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::mediaState const):
(WebCore::AudioContext::visibilityStateChanged):
* dom/Document.cpp:
(WebCore::Document::willBeRemovedFromFrame):
(WebCore::Document::updateIsPlayingMedia):
* dom/Document.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
(WebCore::HTMLMediaElement::mediaState const):
* html/HTMLMediaElement.h:
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::playbackStateChangePermitted const):
* page/MediaProducer.h:
(WebCore::MediaProducer::isCapturing):
* page/Page.cpp:
(WebCore::Page::updateIsPlayingMedia):
* page/Page.h:
* testing/Internals.cpp:
(WebCore::Internals::pageMediaState):
2021-05-04 Diego Pino Garcia <dpino@igalia.com>
Unreviewed, fix GTK and WPE builds after r276947
* Headers.cmake: Add missing header 'Modules/highlight/HighlightVisibility.h'.
2021-05-04 Philippe Normand <pnormand@igalia.com>
[GStreamer][Debug] Allow fastMallocs in audio threads
https://bugs.webkit.org/show_bug.cgi?id=225306
Reviewed by Adrian Perez de Castro.
For the time being the GStreamer ports need to allocate audio buffers for WebRTC. This
deserves deeper investigation to avoid the allocations but for now the bots need to be fixed
ASAP.
* platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp:
(WebCore::RealtimeIncomingAudioSourceLibWebRTC::OnData):
* platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
(WebCore::LibWebRTCAudioModule::pollAudioData):
2021-05-03 Frédéric Wang <fwang@igalia.com>
ASSERTION FAILED: !m_needExceptionCheck while converting IDLSequence<T>
https://bugs.webkit.org/show_bug.cgi?id=223789
Reviewed by Mark Lam.
Add RETURN_IF_EXCEPTION after various toJS<T> calls since they can throw exception
for some types T.
* bindings/js/JSDOMConvertSequences.h:
(WebCore::JSConverter<IDLSequence<T>>::convert): Add RETURN_IF_EXCEPTION before appending
the result of toJS<T>.
(WebCore::JSConverter<IDLFrozenArray<T>>::convert): Ditto.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDictionaryImplementationContent): Add a throw scope and add RETURN_IF_EXCEPTION
before setting a dictionary value. Change the potentially unused variable.
(GenerateDefaultToJSONOperationDefinition): Add a RETURN_IF_EXCEPTION before setting a
value of the JSON object.
(NativeToJSValueMayThrow): Add "IDLDictionaryMember" as a possible context for which
exception may be thrown.
* bindings/scripts/test/JS/JSExposedToWorkerAndWindow.cpp:
(WebCore::convertDictionaryToJS): Update expectation.
* bindings/scripts/test/JS/JSTestDefaultToJSON.cpp:
(WebCore::jsTestDefaultToJSONPrototypeFunction_toJSONBody): Ditto.
* bindings/scripts/test/JS/JSTestDefaultToJSONFilteredByExposed.cpp:
(WebCore::jsTestDefaultToJSONFilteredByExposedPrototypeFunction_toJSONBody): Ditto.
* bindings/scripts/test/JS/JSTestDefaultToJSONInherit.cpp:
(WebCore::jsTestDefaultToJSONInheritPrototypeFunction_toJSONBody): Ditto.
* bindings/scripts/test/JS/JSTestDefaultToJSONInheritFinal.cpp:
(WebCore::jsTestDefaultToJSONInheritFinalPrototypeFunction_toJSONBody): Ditto.
* bindings/scripts/test/JS/JSTestDerivedDictionary.cpp:
(WebCore::convertDictionaryToJS): Ditto.
* bindings/scripts/test/JS/JSTestDerivedDictionary2.cpp:
(WebCore::convertDictionaryToJS): Ditto.
* bindings/scripts/test/JS/JSTestDictionaryWithOnlyConditionalMembers.cpp:
(WebCore::convertDictionaryToJS): Ditto.
* bindings/scripts/test/JS/JSTestEmptyDictionary.cpp:
(WebCore::convertDictionaryToJS): Ditto.
* bindings/scripts/test/JS/JSTestInheritedDictionary.cpp:
(WebCore::convertDictionaryToJS): Ditto.
* bindings/scripts/test/JS/JSTestInheritedDictionary2.cpp:
(WebCore::convertDictionaryToJS): Ditto.
* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::jsTestNodePrototypeFunction_toJSONBody): Ditto.
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::convertDictionaryToJS): Ditto.
* bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
(WebCore::convertDictionaryToJS): Ditto.
2021-05-03 Megan Gardner <megan_gardner@apple.com>
Allow AppHighlight visibility to be toggled
https://bugs.webkit.org/show_bug.cgi?id=225276
Reviewed by Wenson Hsieh.
Add supporting infrastructure to allow highlights to be turned on and off.
This is done with a simple state and a forced repaint on the areas that have highlights.
* Modules/highlight/Highlight.cpp:
(WebCore::Highlight::forceRepaint):
* Modules/highlight/Highlight.h:
* Modules/highlight/HighlightRegister.cpp:
(WebCore::HighlightRegister::setActive):
* Modules/highlight/HighlightRegister.h:
(WebCore::HighlightRegister::isActive):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::collectMarkedTextsForHighlights const):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::calculateHighlightColor const):
2021-05-03 Peng Liu <peng.liu6@apple.com>
Remove the quirk to disable "return to element fullscreen from picture-in-picture" for wowhead.com
https://bugs.webkit.org/show_bug.cgi?id=225322
Reviewed by Sam Weinig.
The quirk can be removed since wowhead.com has fixed the issue on the page.
Manually tested.
* page/Quirks.cpp:
(WebCore::Quirks::blocksReturnToFullscreenFromPictureInPictureQuirk const):
2021-05-03 Peng Liu <peng.liu6@apple.com>
Small cleanups in MediaPlayerPrivateMediaSourceAVFObjC and MediaPlayerPrivateAVFoundationObjC
https://bugs.webkit.org/show_bug.cgi?id=225330
Reviewed by Eric Carlson.
Since we have removed `MediaPlayerPrivate::copyVideoTextureToPlatformTexture()` in r273213,
some headers in `MediaPlayerPrivateAVFoundationObjC` and `MediaPlayerPrivateMediaSourceAVFObjC`
can be removed as well. This patch also has some small cleanups.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
* platform/graphics/cocoa/WebCoreDecompressionSession.h:
2021-05-03 Julian Gonzalez <julian_a_gonzalez@apple.com>
Crash in WebCore::nextBoundary()
https://bugs.webkit.org/show_bug.cgi?id=225326
Reviewed by Ryosuke Niwa.
nextBoundary() creates a CharacterIterator and calls range() on it
without first checking if atEnd() has been reached, which can lead
to a null pointer dereference.
* editing/VisibleUnits.cpp:
(WebCore::nextBoundary):
2021-05-03 Alex Christensen <achristensen@webkit.org>
WKWebView: WKURLSchemeHandler request don't have Range headers for custom scheme videos
https://bugs.webkit.org/show_bug.cgi?id=203302
<rdar://63750321>
Reviewed by Jer Noble and Geoff Garen.
* platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
(WebCore::WebCoreAVFResourceLoader::startLoading):
2021-05-03 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] Missing fill color on slider ticks
https://bugs.webkit.org/show_bug.cgi?id=225318
<rdar://problem/77100313>
Reviewed by Wenson Hsieh.
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::paintSliderTicks):
Slider ticks should fill in blue as the knob passes them.
2021-05-03 Sihui Liu <sihui_liu@apple.com>
Unreviewed, reverting r276913.
Commit can cause double release
Reverted changeset:
"Transfer ownership to ARC in
speechSynthesisGetDefaultVoiceIdentifierForLocale"
https://bugs.webkit.org/show_bug.cgi?id=225312
https://commits.webkit.org/r276913
2021-05-03 Devin Rousso <drousso@apple.com>
[macCatalyst] "Enter Full Screen" button in media controls disappears
https://bugs.webkit.org/show_bug.cgi?id=225210
<rdar://problem/77010150>
Reviewed by Eric Carlson.
In order for the "Enter Full Screen" media controls button to stay visible the `<video>`
must return `true` for `HTMLMediaElement::webkitSupportsFullscreen`, which calls into
`MediaPlayerPrivate::supportsFullscreen`. On macOS and iOS, this will always return `true`
because of `ENABLE(FULLSCREEN_API)`, but on macCatalyst that's not enabled, so we instead
use `DeprecatedGlobalSettings::avKitEnabled`, but this is only set in the WebProcess (and
WK1). With the GPUProcess enabled, this value is not set, so the `RemoteMediaPlayerProxy`
will instead get `false`.
This patch removes `DeprecatedGlobalSettings::avKitEnabled` since it's enabled on WK1 and
non-GPUProcess WK2, and the related iOS-only SPI appears to not be used anywhere internally,
instead having callsites just check `HAVE(AVKIT)`.
* page/DeprecatedGlobalSettings.h:
(WebCore::DeprecatedGlobalSettings::setAVKitEnabled): Deleted.
(WebCore::DeprecatedGlobalSettings::avKitEnabled): Deleted.
* page/DeprecatedGlobalSettings.cpp:
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::supportsFullscreen const):
2021-05-03 Philippe Normand <pnormand@igalia.com>
[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-05-03 Sihui Liu <sihui_liu@apple.com>
Transfer ownership to ARC in speechSynthesisGetDefaultVoiceIdentifierForLocale
https://bugs.webkit.org/show_bug.cgi?id=225312
<rdar://problem/77458746>
Reviewed by Chris Fleizach.
To fix memory leak of defaultVoiceURI.
* platform/mac/PlatformSpeechSynthesizerMac.mm:
(WebCore::speechSynthesisGetDefaultVoiceIdentifierForLocale):
2021-05-03 Tim Nguyen <ntim@apple.com>
Remove "no-preference" value for prefers-color-scheme media query
https://bugs.webkit.org/show_bug.cgi?id=212952
Reviewed by Antti Koivisto.
WPT parsing tests still fail due to: https://bugs.webkit.org/show_bug.cgi?id=225282
Updated evaluation tests to use `not (prefers-color-scheme)` instead.
* css/MediaQueryEvaluator.cpp:
(WebCore::prefersColorSchemeEvaluate):
2021-05-03 Antti Koivisto <antti@apple.com>
Move Style::ScopeOrdinal to a header of its own
https://bugs.webkit.org/show_bug.cgi?id=225302
Reviewed by Alan Bujtas.
Se we don't need to include StyleScope.h everywhere via Animation.h.
* WebCore.xcodeproj/project.pbxproj:
* animation/KeyframeEffect.cpp:
* css/DOMCSSRegisterCustomProperty.cpp:
* platform/animation/Animation.h:
* style/ElementRuleCollector.h:
* style/StyleScope.h:
(WebCore::Style::operator++): Deleted.
* style/StyleScopeOrdinal.h: Added.
(WebCore::Style::operator++):
2021-05-03 Zalan Bujtas <zalan@apple.com>
[Multi-column] Remove spanner placeholder when the spanner becomes nested
https://bugs.webkit.org/show_bug.cgi?id=225248
<rdar://77326189>
Reviewed by Antti Koivisto.
Columns spanners (and their subtrees) are moved out of the RenderMultiColumnFlow subtree next to their RenderMultiColumnSet renderers.
Placeholder renderers are inserted at the original position e.g.
<div id=A style="column-count: 2;"><div id=B><div id=C style="column-span: all;"></div></div></div>
RenderBlockFlow (A) (<div column-count: 2>)
RenderMultiColumnFlow
RenderBlockFlow (B) (<div>)
RenderBlockFlow (C) (<div>)
RenderMultiColumnSpannerPlaceholder (placeholder for D)
RenderBlockFlow (D) (<div column-span: all>)
RenderMultiColumnSet
Now if (C) becomes a column spanner, we need to move the descendant spanner (D) back to its original position and move the subtree out starting from the outermost spanner (C).
RenderTreeUdpater normally solves this by tearing down the new spanner (and its subtree) when the 'column-spanner' property changes.
However this spanner property is essentially ignored for floats and out-of-flow boxes (we don't make them spanning the columns) and changing "float" and/or "position" makes
spanners active.
Test: fast/multicol/span/float-becomes-spanner-crash.html
* style/StyleChange.cpp:
(WebCore::Style::determineChange):
2021-05-03 Sam Weinig <weinig@apple.com>
Remove default parameter values for color space and pixel format from ImageBuffer::create to make it clear everwhere we are explicitly requesting SRGB/BGRA8 buffers
https://bugs.webkit.org/show_bug.cgi?id=225288
Reviewed by Anders Carlsson.
To make it super clear exactly what type of ImageBuffers we are creating, this
removes the default parameters for the scale, color space and pixel format from
the ImageBuffer::create() functions.
This allows us to easily see exactly where we are creating 8-bit sRGB buffers
and potentially losing non-sRGB and wide (> 8-bit) source data. In practice, many
of these sites are wrong and should be updated to use a color space and pixel
format matching the source they are going to be copying/buffering.
I did not update the ImageBuffer::createCompatibleBuffer, as it is less clear what
to do about them, or what exactly is meant by "compatible", as it seems to be
inconsistent from one to the other.
Ultimately, if we want to make it easy to create an ImageBuffer that has the same
underlying characteristics of whatever a GraphicsContext is drawing to, we will need
to update GraphicsContext to be able to provide scale, color space and pixel format
information directly. This will probably require some new mechanism for representing
color space that can either be a DestinationColorSpace or a platform specific color
space object (e.g. CGColorSpaceRef).
* Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp:
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::sanitizeDataIfNeeded):
* Modules/mediasession/MediaMetadata.cpp:
(WebCore::ArtworkImageLoader::notifyFinished):
* css/CSSFilterImageValue.cpp:
(WebCore::CSSFilterImageValue::image):
* html/ImageBitmap.cpp:
(WebCore::ImageBitmap::createImageBuffer):
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::createCompositingBuffer):
* html/canvas/ImageBitmapRenderingContext.cpp:
(WebCore::ImageBitmapRenderingContext::setOutputBitmap):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer):
* html/shadow/MediaControlTextTrackContainerElement.cpp:
(WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::indexForData):
(WebCore::InspectorCanvas::buildArrayForCanvasPattern):
* page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRectWithClip):
* page/PageConsoleClient.cpp:
(WebCore::PageConsoleClient::screenshot):
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::preTransformedNativeImageForCurrentFrame):
* platform/graphics/CrossfadeGeneratedImage.cpp:
(WebCore::CrossfadeGeneratedImage::drawPattern):
* platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::createCompatibleBuffer):
* platform/graphics/ImageBuffer.h:
* platform/graphics/ShadowBlur.cpp:
(WebCore::ScratchBuffer::getScratchBuffer):
(WebCore::ShadowBlur::drawRectShadowWithoutTiling):
(WebCore::ShadowBlur::drawInsetShadowWithoutTiling):
(WebCore::ShadowBlur::drawRectShadowWithTiling):
(WebCore::ShadowBlur::drawInsetShadowWithTiling):
(WebCore::ShadowBlur::drawShadowLayer):
* platform/graphics/coreimage/FilterEffectRendererCoreImage.mm:
(WebCore::FilterEffectRendererCoreImage::renderToImageBuffer):
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::imageBufferResult):
(WebCore::FilterEffect::convertImageDataToColorSpace):
(WebCore::FilterEffect::convertImageBufferToColorSpace):
(WebCore::FilterEffect::createImageBufferResult):
* platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp:
(Nicosia::GCGLLayer::swapBuffersIfNeeded):
* platform/graphics/texmap/BitmapTexture.cpp:
(WebCore::BitmapTexture::updateContents):
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::imageBuffer const):
* rendering/CSSFilter.cpp:
(WebCore::CSSFilter::allocateBackingStoreIfNeeded):
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createRasterShape):
* rendering/svg/SVGRenderingContext.cpp:
(WebCore::SVGRenderingContext::createImageBuffer):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::nativeImage):
2021-05-03 Chris Lord <clord@igalia.com>
Decoding an SVG off the main thread causes a crash
https://bugs.webkit.org/show_bug.cgi?id=206055
Reviewed by Darin Adler.
Use BitmapImage::create instead of Image::create in ImageBitmap. This
bypasses use of SVGImage and PDFDocumentImage, which are not safe to
use off the main thread.
No new tests, rebaselined existing tests.
* html/ImageBitmap.cpp:
(WebCore::ImageBitmap::createFromBuffer):
Use BitmapImage instead of Image.
* platform/graphics/Image.cpp:
(WebCore::Image::create):
Add main-thread assert on Image creation.
2021-05-03 Rob Buis <rbuis@igalia.com>
getPropertyValue for url path doesn't return the "#" character
https://bugs.webkit.org/show_bug.cgi?id=215409
Reviewed by Youenn Fablet.
Address post review comments.
* css/SVGCSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::svgPropertyValue):
2021-05-03 Youenn Fablet <youenn@apple.com>
REGRESSION (r276633): fast/mediastream/media-stream-track-interrupted.html is consistently timing out
https://bugs.webkit.org/show_bug.cgi?id=225204
<rdar://problem/77338070>
Reviewed by Eric Carlson.
Reverting to RecursiveLock since resuming a unit will make it notify to unmute sources.
Sources will want to restart audio, thus restarting the unit synchronously.
This triggers the unit to tell its clients that it is restarting, which creates a dead lock.
We should probably update the code to change this, but as a short term fix, we revert to a RecursiveLock.
Covered by fast/mediastream/media-stream-track-interrupted.html no longer timing out.
* platform/mediastream/mac/BaseAudioSharedUnit.cpp:
(WebCore::BaseAudioSharedUnit::audioSamplesAvailable):
* platform/mediastream/mac/BaseAudioSharedUnit.h:
2021-05-03 Youenn Fablet <youenn@apple.com>
Use OptionSet for MediaProducer::MutedStateFlags
https://bugs.webkit.org/show_bug.cgi?id=224550
<rdar://problem/76960294>
Reviewed by Eric Carlson.
Refactoring to improve type safety.
No change of behavior.
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::updateCaptureAccordingToMutedState):
(WebCore::MediaStreamTrack::updateToPageMutedState):
* page/MediaProducer.h:
* page/Page.h:
(WebCore::Page::isAudioMuted const):
(WebCore::Page::isMediaCaptureMuted const):
* testing/Internals.cpp:
(WebCore::Internals::setPageMuted):
2021-05-02 Rob Buis <rbuis@igalia.com>
getPropertyValue for url path doesn't return the "#" character
https://bugs.webkit.org/show_bug.cgi?id=215409
Reviewed by Sam Weinig.
Adapt url serializing in SVG to match Firefox and Chrome.
Test: svg/css/computed-style-url-serializing.html
* css/SVGCSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::svgPropertyValue):
2021-05-02 Sam Weinig <weinig@apple.com>
Add support for DestinationColorSpace::DisplayP3 in preparation for DisplayP3 canvas
https://bugs.webkit.org/show_bug.cgi?id=225280
Reviewed by Anders Carlsson.
Add new ENABLE_DESTINATION_COLOR_SPACE_DISPLAY_P3 macro to declare which ports
support P3 backing stores. Currently, only the Apple/Cocoa ports support it.
When ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3), also define ColorSpaceDestination::DisplayP3.
This is not currently used, but will be in subsequent changes.
* platform/graphics/ColorConversion.cpp:
(WebCore::converColorComponents):
* platform/graphics/ColorSpace.cpp:
(WebCore::operator<<):
* platform/graphics/ColorSpace.h:
(WebCore::callWithColorType):
* platform/graphics/cg/ColorSpaceCG.h:
(WebCore::cachedCGColorSpace):
2021-05-02 Zalan Bujtas <zalan@apple.com>
[LFC] Rename block(inline/table/flex)formattingContext directories to block(inline/table/flex)
https://bugs.webkit.org/show_bug.cgi?id=225275
Reviewed by Antti Koivisto.
The formattingContext postfix is redundant as they are all under the /formattingContexts directory.
* CMakeLists.txt:
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
2021-05-02 Jer Noble <jer.noble@apple.com>
[Perf] Creation of many video elements slows over time
https://bugs.webkit.org/show_bug.cgi?id=225273
Reviewed by Eric Carlson.
In PerformanceTests/Media/VideoElementCreation.html, 1000 video elements are created
per test, and the test reports how long each batch of 1000 element took to create. A
typical run shows the amount of time to run each batch slows over time. The underlying
cause appears to be the cost it takes to iterate over each MediaElementSession inside
PlatformMediaSessionManager and subclasses.
Before a HTMLMediaElement has a src (or after it's emptied) there's no reason for its
MediaElementSession to be tracked by the PlatformMediaSessionManager. It can't play,
pause, be interrupted, or accept remote control commands. So PlatformMediaSession will
be changed so that it does not add itself to the list of its manager's sessions at
creation time; instead a new method, setActive(bool), is added and will be called at
an appropriate time by its clients, HTMLMediaElement and AudioContext.
HTMLMediaElement will activate its mediaSession just before creating its MediaPlayer
inside prepareForLoad() or loadNextSourceChild(), and will deactivate after tearing
down its MediaPlayer inside mediaLoadingFailed().
AudioContext will activate its mediaSession during its own initialization, and deactivate
inside close().
Before this change, on this machine, VideoElementCreation.html showed an incresing time
to video element creation, levelling out at ~400ms per 1000 elements. After this change,
VideoElelementCreation.html shows a constant time to video element creation, averaging
between 4ms and 7ms per 1000 elements.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::close):
(WebCore::AudioContext::lazyInitialize):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::prepareForLoad):
(WebCore::HTMLMediaElement::mediaLoadingFailed):
* platform/audio/PlatformMediaSession.cpp:
(WebCore::PlatformMediaSession::PlatformMediaSession):
(WebCore::PlatformMediaSession::~PlatformMediaSession):
(WebCore::PlatformMediaSession::setActive):
* platform/audio/PlatformMediaSession.h:
2021-05-01 Antti Koivisto <antti@apple.com>
Share style resolvers between author shadow trees with identical style
https://bugs.webkit.org/show_bug.cgi?id=225187
<rdar://problem/77317178>
Reviewed by Sam Weinig.
Style resolvers own style resolution and invalidation rule sets, matched declarations cache, and other things.
With complex stylesheets that can be lot of data. We currently create a style resolver for each author
shadow tree. With web components it is common for a page to have large number of instances of the same
component, and so shadow trees with identical style.
We already deduplicate shadow tree stylesheets (including inline stylesheets based on string equality).
With this patch we'll use these stylesheets as keys for sharing the full style resolvers as well.
* style/StyleScope.cpp:
(WebCore::Style::Scope::createOrFindSharedShadowTreeResolver):
Expand the existing support for sharing between user agent shadow trees and author shadow trees with
empty style. Look up shareable resolvers from a map.
(WebCore::Style::Scope::unshareShadowTreeResolverBeforeMutation):
(WebCore::Style::Scope::makeResolverSharingKey):
Make a key from the active stylesheets and a bit indicating the shadow tree type.
(WebCore::Style::Scope::releaseMemory):
(WebCore::Style::Scope::didChangeStyleSheetEnvironment):
* style/StyleScope.h:
2021-05-01 Sam Weinig <weinig@apple.com>
Move PixelFormat into its own file
https://bugs.webkit.org/show_bug.cgi?id=225272
Reviewed by Darin Adler.
PixelFormat is going to be useful for non-ImageBuffer specific reasons
soon, so let's move it to its own header.
* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/ImageBufferBackend.h:
* platform/graphics/PixelFormat.h: Added.
2021-04-30 Darin Adler <darin@apple.com>
Use SortedArrayMap in a few more places
https://bugs.webkit.org/show_bug.cgi?id=225251
Reviewed by Sam Weinig.
* Modules/encryptedmedia/CDM.h: Removed unneeded includes.
* Modules/indexeddb/server/IDBServer.h: Ditto.
* contentextensions/ContentExtensionActions.h: Ditto.
* css/CSSVariableData.h: Ditto.
* dom/FullscreenManager.h: Ditto.
* dom/ScriptElement.cpp:
(WebCore::isLegacySupportedJavaScriptLanguage): Use SortedArraySet.
(WebCore::ScriptElement::executeClassicScript): Fixed typo.
(WebCore::ScriptElement::executeModuleScript): Ditto.
* inspector/InspectorAuditResourcesObject.cpp: Removed unneeded includes.
* inspector/agents/InspectorNetworkAgent.cpp: Ditto.
* loader/appcache/ApplicationCacheGroup.cpp: Ditto.
* page/UserContentProvider.h: Ditto.
* page/ios/DOMTimerHoldingTank.cpp: Ditto.
* page/scrolling/ScrollingCoordinator.h: Ditto.
* page/scrolling/ScrollingTreeNode.h: Added forward declaration
that used to be inherited from another file where it's not needed.
* platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
(WebCore::GameControllerGamepadProvider::willHandleVendorAndProduct):
Use a switch statement.
* platform/gamepad/mac/HIDGamepadElement.h: Removed unneeded includes.
* platform/graphics/FontPlatformData.cpp: Ditto.
* platform/graphics/HEVCUtilities.cpp: Ditto.
* platform/graphics/IntRectHash.h: Ditto.
* platform/graphics/MIMETypeCache.cpp:
(WebCore::MIMETypeCache::isStaticContainerType): Renamed; this replaces
the old staticContainerTypeList function and just returns false.
* platform/graphics/MIMETypeCache.h: Replaced the staticContainerTypeList
fucntion with an isStaticContainerType function. Also made it, and one
other function, private.
* platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.h: Updated
for the change to MIMETypeCache.
* platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm:
(WebCore::AVAssetMIMETypeCache::isStaticContainerType): Use SortedArraySet.
* platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
Removed unneeded includes.
* platform/graphics/coreimage/FilterEffectRendererCoreImage.h: Ditto.
* platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp: Ditto.
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h: Ditto.
* platform/mediastream/mac/CoreAudioCaptureDeviceManager.h: Ditto.
* platform/mediastream/mac/CoreAudioCaptureSource.h: Ditto.
* platform/network/cf/FormDataStreamCFNet.cpp: Ditto.
* platform/network/mac/UTIUtilities.mm:
(WebCore::UTIFromUnknownMIMEType): Use SortedArrayMap. Also fixed a regression
from r271533 where we accidentally deleted the MIME type model/vnd.reality.
* rendering/ComplexLineLayout.cpp:
(WebCore::setLogicalWidthForTextRun): Use a range-based for loop.
* rendering/updating/RenderTreeUpdater.h: Removed unneeded includes.
* storage/StorageNamespaceProvider.h: Ditto.
* storage/StorageQuotaManager.h: Ditto.
* style/StyleUpdate.h: Ditto.
* svg/SVGFitToViewBox.h: Ditto.
* svg/SVGTests.cpp:
(WebCore::SVGTests::isValid const): Use SortedArraySet.
(WebCore::SVGTests::hasFeatureForLegacyBindings): Ditto.
2021-05-01 Sam Weinig <weinig@apple.com>
Update operations in CanvasImageData.idl to use long rather than float as per spec
https://bugs.webkit.org/show_bug.cgi?id=225263
Reviewed by Simon Fraser.
Use `[EnforceRange] long` to match the current HTML spec.
* html/canvas/CanvasImageData.idl:
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::createImageData const):
(WebCore::CanvasRenderingContext2DBase::getImageData const):
(WebCore::CanvasRenderingContext2DBase::putImageData):
* html/canvas/CanvasRenderingContext2DBase.h:
2021-05-01 Zalan Bujtas <zalan@apple.com>
[LFC] Move formatting contexts to layout/formattingContexts directory
https://bugs.webkit.org/show_bug.cgi?id=225270
Reviewed by Antti Koivisto.
* CMakeLists.txt:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
2021-05-01 Sam Weinig <weinig@apple.com>
Make destination color space enumeration match supported destination color spaces for the port
https://bugs.webkit.org/show_bug.cgi?id=225237
Reviewed by Simon Fraser.
Add ENABLE_DESTINATION_COLOR_SPACE_LINEAR_SRGB and enabled it for all ports
except the Apple Windows port, which is the only one doesn't have any support
for it.
Removes existing behavior of returning SRGB when LinearSRGB was requested in
the Apple Windows port. Now, the callers are responisble for dealing with a
ports lack of support of LinearSRGB, making it very clear at those call sites
that something is different and wrong.
* platform/graphics/Color.cpp:
* platform/graphics/Color.h:
* platform/graphics/ColorConversion.cpp:
* platform/graphics/ColorConversion.h:
Add new functions to perform color conversion to and from an color space
denoted by the ColorSpace or DestinationColorSpace enum. Previously, we
only had convient ways to convert if the color was strongly typed (and this
is implemented using that mechanism). This is useful when converting for
final ouput, such in as the caller in FELighting::drawLighting.
* platform/graphics/cg/ColorSpaceCG.h:
* platform/graphics/ColorSpace.cpp:
* platform/graphics/ColorSpace.h:
* platform/graphics/filters/FELighting.cpp:
* platform/graphics/filters/FilterEffect.h:
* rendering/CSSFilter.cpp:
* rendering/svg/RenderSVGResourceFilter.cpp:
* rendering/svg/RenderSVGResourceMasker.cpp:
Wrap uses of DestinationColorSpace::LinearSRGB in ENABLE(DESTINATION_COLOR_SPACE_LINEAR_SRGB).
2021-05-01 Sam Weinig <weinig@apple.com>
Generated JS bindings for JSValue -> IDL dictionary don't take into account runtime settings
https://bugs.webkit.org/show_bug.cgi?id=225271
Reviewed by Alexey Shvayka.
While we did account for Settings/RuntimeEnabledFeatures/etc when converting from a
dictionary to a JSValue, we forgot to add code to skip trying to read the properties
in on ingestion.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDictionaryImplementationContent):
Match convertDictionaryToJS and add guard + indent if the property has a runtime flag.
* bindings/scripts/test/JS/JSTestDerivedDictionary.cpp:
(WebCore::convertDictionary<TestDerivedDictionary>):
* bindings/scripts/test/JS/JSTestDerivedDictionary2.cpp:
(WebCore::convertDictionary<TestDerivedDictionary2::Dictionary>):
* bindings/scripts/test/JS/JSTestInheritedDictionary.cpp:
(WebCore::convertDictionary<TestInheritedDictionary>):
* bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
(WebCore::convertDictionary<DictionaryImplName>):
Update test results.
2021-05-01 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] Reset the "children inline" state when merging anonymous table boxes
https://bugs.webkit.org/show_bug.cgi?id=225266
<rdar://77327951>
Reviewed by Simon Fraser.
This patch fixes the case when we end up moving block level boxes to an anonymous table box (cell, row) which previously
had inline level boxes only (it happens when the destination ("to") table box has no in-flow children).
Test: fast/table/merge-anonymous-table-cells-with-block-children.html
* rendering/updating/RenderTreeBuilderTable.cpp:
(WebCore::RenderTreeBuilder::Table::collapseAndDetachAnonymousNextSibling):
2021-04-30 Wenson Hsieh <wenson_hsieh@apple.com>
App highlight UI should be disabled when selecting text in image overlays
https://bugs.webkit.org/show_bug.cgi?id=225260
rdar://77359313
Reviewed by Tim Horton.
When both app highlights and image extraction are enabled, parts of the app highlights feature don't play well
with highlights created for text selections inside an image overlay. For the time being, address this by
disabling app highlights in image overlays.
These changes are exercised by a new API test on iOS, and a new layout test for macOS.
Tests: WebKit.AppHighlightsInImageOverlays
fast/images/image-extraction/mac/image-overlay-text-disables-app-highlight-menu-items.html
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::populate):
Don't add app highlight menu items in the case where we've selected text in an image overlay.
* testing/Internals.cpp:
(WebCore::Internals::appHighlightContextMenuItemTitles const):
Add an internal testing hook to expose the localized names of the app highlight menu items to layout tests.
* testing/Internals.h:
* testing/Internals.idl:
2021-04-30 Jer Noble <jer.noble@apple.com>
[Cocoa] Calling into -[AVPlayerItem currentTime] is very expensive
https://bugs.webkit.org/show_bug.cgi?id=225254
Reviewed by Eric Carlson.
Calling into -currentTime is an expensive operation that synchronously calls a shared
background thread, and so can block for potentially long periods of time. Instead,
AVPlayerItem offers an API which will push currentTime changes on a specified dispatch
queue. We can use that API to occasionally update a cached view of the item's currentTime
and combine that cached value with other cached states to accurately calculate an
approximation of the currentTime during playback.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::currentMediaTime const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::currentMediaTimeDidChange):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setRateDouble):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setPlayerRate):
(WebCore::MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange):
2021-04-30 Cameron McCormack <heycam@apple.com>
Defend further against a PlatformCALayer's owner becoming null in PlatformCALayerCocoa::drawLayerContents.
https://bugs.webkit.org/show_bug.cgi?id=225250
<rdar://37608882>
Reviewed by Simon Fraser.
At the end of PlatformCALayer::drawLayerContents, we null check
layerContents for the platformCALayerShowRepaintCounter call but not
the platformCALayerIncrementRepaintCount call.
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::PlatformCALayer::drawLayerContents):
2021-04-30 Cameron McCormack <heycam@apple.com>
Avoid a crash in PlatformCALayer::drawLayerContents when called with a display list recording GraphicsContext.
https://bugs.webkit.org/show_bug.cgi?id=225224
<rdar://76359027>
Reviewed by Simon Fraser.
setIsCALayerContext and setIsAcceleratedContext both assume (and assert)
that the GraphicsContext has a platform context directly in m_data,
but m_data is null when the GraphicsContext a display list recording
context (which is the case when GPUP DOM rendering is enabled). These
calls are unnecessary when not working with a CG-backed GraphicsContext,
so just skip them in this case.
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::PlatformCALayer::drawLayerContents):
2021-04-30 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Add a heuristic to determine whether a synthetic click triggered any meaningful changes
https://bugs.webkit.org/show_bug.cgi?id=225240
rdar://77221196
Reviewed by Tim Horton.
Add plumbing for a `ChromeClient` hook that's called when a mousedown or mouseup event is either prevented by
the page, or handled with a default event handler on the element (e.g. when clicking a link).
Test: fast/events/ios/did-not-handle-meaningful-click.html
* page/ChromeClient.h:
(WebCore::ChromeClient::didHandleOrPreventMouseDownOrMouseUpEvent):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::handleMouseDoubleClickEvent):
(WebCore::EventHandler::handleMouseReleaseEvent):
2021-04-30 Youenn Fablet <youenn@apple.com>
REGRESSION (iOS 14.5): PWA's / Home Screen Apps with Service Workers intermittenly fail to open offline
https://bugs.webkit.org/show_bug.cgi?id=225083
<rdar://problem/77232062>
Reviewed by Alex Christensen.
Manually tested.
* workers/service/server/SWServerWorker.h:
Initialize m_shouldSkipHandleFetch to false by default.
Otherwise, m_shouldSkipHandleFetch might be used uninitialized during a small amount of time.
2021-04-30 Chris Dumez <cdumez@apple.com>
Simplify shouldInvalidateNodeListCachesForAttr() template function
https://bugs.webkit.org/show_bug.cgi?id=225236
Reviewed by Geoffrey Garen.
Simplify shouldInvalidateNodeListCachesForAttr() template function by using if constexpr.
* dom/Node.cpp:
(WebCore::shouldInvalidateNodeListCachesForAttr):
(WebCore::shouldInvalidateNodeListCachesForAttr<numNodeListInvalidationTypes>): Deleted.
2021-04-30 Rob Buis <rbuis@igalia.com>
Move ShouldAllowCrossOriginScrolling to RenderLayer
https://bugs.webkit.org/show_bug.cgi?id=225231
Reviewed by Simon Fraser.
Move ShouldAllowCrossOriginScrolling to RenderLayer.
* rendering/RenderLayer.h:
* rendering/RenderObject.h:
2021-04-30 Youenn Fablet <youenn@apple.com>
REGRESSION (r276633): ASSERTION FAILED: !forbidMallocUseScopeCount || disableMallocRestrictionScopeCount under WebCore::AudioSampleDataSource::create()
https://bugs.webkit.org/show_bug.cgi?id=225196
<rdar://problem/77329071>
Reviewed by Eric Carlson.
Covered by API test no longer crashing.
* Modules/speech/SpeechRecognitionCaptureSourceImpl.cpp:
(WebCore::SpeechRecognitionCaptureSourceImpl::audioSamplesAvailable):
Disabling check here until we figure out a better way of doing things.
2021-04-30 Oriol Brufau <obrufau@igalia.com>
[css-logical] Fix logical shorthands with var()
https://bugs.webkit.org/show_bug.cgi?id=224594
Reviewed by Manuel Rego Casasnovas.
Logical shorthands with var() were not working because when resolving
the pending-substitution value of the equivalent physical longhand,
parseValueWithVariableReferences would parse the logical shorthand into
the logical longhands, which would be different properties than the
physical longhand being resolved.
So this patch compares with the equivalent physical property instead.
Test: imported/w3c/web-platform-tests/css/css-logical/logicalprops-with-variables.html
* css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseValueWithVariableReferences):
2021-04-30 Antti Koivisto <antti@apple.com>
Share style resolvers between author shadow trees without style sheets
https://bugs.webkit.org/show_bug.cgi?id=225102
Reviewed by Sam Weinig.
Prepare for sharing style resolvers (and all the related data) between shadow trees beyond
the currently supported user agent shadow trees. This patch refactors the sharing code
and adds support for sharing resolvers for author shadow trees without style sheets.
Test: fast/shadow-dom/style-resolver-sharing.html
* dom/Document.cpp:
(WebCore::Document::userAgentShadowTreeStyleResolver): Deleted.
(WebCore::Document::didClearStyleResolver): Deleted.
Move the shared UA resolver to Style::Scope.
* dom/Document.h:
* style/StyleResolver.h:
(WebCore::Style::Resolver::wasShared const):
(WebCore::Style::Resolver::setWasShared):
Add a bit indicating if a resolver has been shared between shadow trees.
* style/StyleScope.cpp:
(WebCore::Style::Scope::resolver):
(WebCore::Style::Scope::createDocumentResolver):
(WebCore::Style::Scope::createOrFindSharedShadowTreeResolver):
Factor into a function.
Share user agent shadow tree resolver (as before) and also resolver for empty author shadow trees.
(WebCore::Style::Scope::unshareShadowTreeResolverBeforeMutation):
If we mutate an existing resolver we need to make it unavailable for sharing.
(WebCore::Style::Scope::clearResolver):
(WebCore::Style::Scope::releaseMemory):
(WebCore::Style::Scope::analyzeStyleSheetChange):
If we are about to mutate already shared resolver we need to create a new one.
(WebCore::Style::Scope::updateActiveStyleSheets):
If style sheets change and the resolver is shared always look it up again (since it can't be mutated).
(WebCore::Style::Scope::updateResolver):
(WebCore::Style::Scope::scheduleUpdate):
(WebCore::Style::Scope::insertedInDocument):
(WebCore::Style::Scope::didChangeStyleSheetEnvironment):
(WebCore::Style::Scope::documentScope):
(WebCore::Style::Scope::isForUserAgentShadowTree const):
(WebCore::Style::Scope::shouldUseSharedUserAgentShadowTreeStyleResolver const): Deleted.
(WebCore::Style::Scope::resolverIfExists): Deleted.
* style/StyleScope.h:
(WebCore::Style::Scope::resolverIfExists):
* style/StyleScopeRuleSets.h:
(WebCore::Style::ScopeRuleSets::setIsForShadowScope): Deleted.
(WebCore::Internals::dumpStyleResolvers):
* testing/Internals.h:
* testing/Internals.idl:
Testing support.
2021-04-30 Sergio Villar Senin <svillar@igalia.com>
Nullopt in RenderFlexibleBox::layoutFlexItems in RenderFlexibleBox::layoutBlock via RenderMultiColumnFlow::layout
https://bugs.webkit.org/show_bug.cgi?id=223369
Reviewed by Alan Bujtas.
When computing the main axis extent of a flex item being the main axis also the child's inline axis and the
inline size of the child is auto, we can directly use the min/maxPreferredLogicalWidths instead of having
to call computeLogicalWidthInFragmentUsing(). However we cannot use it straigth away without checking
needsPreferredWidthsRecalculation() first, otherwise the cached preferred width might be no longer valid.
The cached preferred width includes both border and padding. If any of those are percentages, and thus
depend on the size of the containing block, we could end up using obsolete values.
This was making us hit an assertion because the content size suggestion was negative. That's because in order
to compute the content size we were substracting the current borderAndPadding() to the value returned by
minPreferredLogicalWidth(). But the current borderAndPadding() might be larger than the one used to compute the
preferred width before (they must be the same to properly extract the content size) so the content size ended
up being negative.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeMainAxisExtentForChild):
(WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax): Constness adjustments.
(WebCore::RenderFlexibleBox::resolveFlexibleLengths): Ditto.
* rendering/RenderFlexibleBox.h:
2021-04-30 Youenn Fablet <youenn@apple.com>
MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers lambda should check its player is alive
https://bugs.webkit.org/show_bug.cgi?id=225186
<rdar://77267681>
Reviewed by Eric Carlson.
Make sure to check weakThis.
Move the meat of the lambda in a method as a small improvement refactoring.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layersAreInitialized):
2021-04-29 Jean-Yves Avenard <jya@apple.com>
Adopt AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification
https://bugs.webkit.org/show_bug.cgi?id=225170
rdar://77086915
Reviewed by Eric Carlson.
When the AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification is received, the SourceBuffer will now
re-enqueue all audio frames from currentTime.
The handling of AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification is currently broken in AVFoundation.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: Add missing #include
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(-[WebAVSampleBufferErrorListener beginObservingRenderer:]): Add listener
(-[WebAVSampleBufferErrorListener stopObservingRenderer:]): Remove listener
(-[WebAVSampleBufferErrorListener audioRendererWasAutomaticallyFlushed:]):
(WebCore::SourceBufferPrivateAVFObjC::rendererWasAutomaticallyFlushed):
2021-04-29 Jean-Yves Avenard <jya@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=225183
rdar://77251937
Reviewed by Eric Carlson.
Under some circumstances, the decoded image may end up being empty. We need to handle this case.
* Modules/mediasession/MediaMetadata.cpp:
(WebCore::MediaMetadata::refreshArtworkImage): Exit early if image is empty.
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::nowPlayingInfo const): Add assert to clarify code
2021-04-29 Zalan Bujtas <zalan@apple.com>
Floating object are not removed from the initial containing block
https://bugs.webkit.org/show_bug.cgi?id=225198
<rdar://77236776>
Reviewed by Antti Koivisto.
outermostBlockContainingFloatingObject is supposed to find the top most ancestor for an intruding float. Now when the <html> is float positioned,
the initial containing block (RenderView) is the outermost containing block that has reference to this float (see FloatingObject).
removeFloatingOrPositionedChildFromBlockLists() calls outermostBlockContainingFloatingObject() to get the top most renderer where the float cleanup
is supposed to be initiated at. We call this function during style and tree mutation.
These float lists are getting invalidated during layout as well, with a simple call to m_floatingObjects->clear(). It unconditionally takes care of all the floats including
the ones on the initial containing block.
The bug only shows when we try to access the floating list between the style/tree mutation and the subsequent layout.
Test: fast/block/fail-to-remove-float-from-initial-containing-block.html
* rendering/RenderBox.cpp:
(WebCore::outermostBlockContainingFloatingObject):
2021-04-29 Michael Catanzaro <mcatanzaro@gnome.org>
-Wpessimizing-move warnings in LocaleICU.cpp
https://bugs.webkit.org/show_bug.cgi?id=225205
Reviewed by Sam Weinig.
* platform/text/LocaleICU.cpp:
(WebCore::LocaleICU::createLabelVector):
(WebCore::createFallbackMonthLabels):
(WebCore::createFallbackAMPMLabels):
2021-04-29 Alexey Shvayka <shvaikalesh@gmail.com>
[WebIDL] Remove [Reflect] support for constants
https://bugs.webkit.org/show_bug.cgi?id=225119
Reviewed by Sam Weinig.
While reflection of content attributes [1] is a well-known concept, using [Reflect] for
constants doesn't make much sense (as there is no HTML attribute involved) and introduces
conflicting semantics for its value: C++ enum identifier vs. HTML attribute name.
[ImplementedAs] extended attribute is a perfect fit for customizing C++ identifier;
this change expands it to constants. Using ERROR as enum identifier still breaks
Windows build due to #define conflict.
No new tests, no behavior change.
[1] https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#reflecting-content-attributes-in-idl-attributes
* bindings/scripts/CodeGenerator.pm:
(GenerateCompileTimeCheckForEnumsIfNeeded):
* bindings/scripts/IDLAttributes.json:
* bindings/scripts/test/*: Updated.
* html/HTMLTrackElement.idl:
2021-04-29 Aditya Keerthi <akeerthi@apple.com>
REGRESSION (r275431): [iOS] fast/events/touch/ios/mouse-events-dispatch-with-touch.html is timing out
https://bugs.webkit.org/show_bug.cgi?id=225208
<rdar://problem/77042369>
Reviewed by Devin Rousso.
* page/Quirks.cpp:
(WebCore::Quirks::simulatedMouseEventTypeForTarget const):
Remove the `!needsQuirks()` check added in r275431 to restore the
original test behavior.
Note that the test overrides `MouseEventsSimulationEnabled`, which
forces `Quirks::shouldDispatchSimulatedMouseEvents` to return true
regardless of `!needsQuirks()`. Furthermore, `NeedsSiteSpecificQuirks`
defaults to false in WebCore.
This change is safe, since `shouldDispatchSimulatedMouseEvents` still
checks `!needsQuirks()` when `MouseEventsSimulationEnabled` is false.
2021-04-29 Devin Rousso <drousso@apple.com>
Unreviewed, fix crashloop after r276744
<rdar://problem/77333886>
* dom/Document.cpp:
(WebCore::Document::determineSampledPageTopColor):
Don't attempt to get the value from the `Optional<Lab<float>>` unless we know for sure that
it's valid. This amounts to always making sure we either `continue` (or `return` if that
snapshot is not an outlier) instead of only doing it if the snapshot is an outlier.
2021-04-29 Darin Adler <darin@apple.com>
Extend SortedArrayMap further to work on case-folded strings, use in MIMETypeRegistry
https://bugs.webkit.org/show_bug.cgi?id=224968
Reviewed by Sam Weinig.
Using fewer HashSet in MIMETypeRegistry saves code size and reduces memory use.
* platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::supportedImageMIMETypes): Deleted. Replaced
this function with a constexpr array, eliminating the use of HashSet.
(WebCore::makeFixedVector): Added. Helper function used below for the repeated patttern
of converting a constexpr array into a FixedVector<const char*>.
(WebCore::supportedJavaScriptMIMETypes): Deleted.
(WebCore::MIMETypeRegistry::supportedNonImageMIMETypes): Update since
supportedJavaScriptMIMETypeArray is now an array, not a HashSet.
(WebCore::MIMETypeRegistry::pdfMIMETypes): Rewrote to return a FixedVector<const char*>
instead of a HashSet. The only caller makes an NSArray<NSString *>, so there is no need
to involve a hash table or a WTF::String.
(WebCore::MIMETypeRegistry::unsupportedTextMIMETypes): Ditto.
(WebCore::commonMediaTypes): Deleted, merging into the function below.
(WebCore::commonMimeTypesMap): Moved the commonMediaTypes data in here
and use a constexpr array instead of an initializer_list.
(WebCore::MIMETypeRegistry::isSupportedImageMIMEType): Use SortedArraySet
instead of a HashSet for the core supported images types. Moved the code
that checks this against defaultSupportedImageTypes here.
(WebCore::MIMETypeRegistry::isSupportedJavaScriptMIMEType): Use SortedArraySet.
(WebCore::MIMETypeRegistry::isUnsupportedTextMIMEType): Ditto.
(WebCore::MIMETypeRegistry::isPDFMIMEType): Ditto.
(WebCore::MIMETypeRegistry::isPostScriptMIMEType): Use equalLettersIgnoringASCIICase.
For some reason this was the single case-sensitive function in this whole class!
(WebCore::MIMETypeRegistry::isSystemPreviewMIMEType): Use SortedArraySet.
(WebCore::MIMETypeRegistry::systemPreviewMIMETypes): Return a FixedVector.
(WebCore::normalizedImageMIMEType): Renamed this from its old name,
MIMETypeRegistry::normalizedMIMEType, to better reflect that it's only used in
one place. Also added comments to clarify that it's CURL-only and suggest it be
removed eventually.
* platform/MIMETypeRegistry.h: Changed supportedImageMIMETypes, pdfMIMETypes,
unsupportedTextMIMETypes, and systemPreviewMIMETypes to return FixedVector instead
of HashSet. Also removed normalizedMIMEType.
* svg/SVGTransformValue.h: Removed unneeded include of HashMap.h.
* testing/TypeConversions.h: Ditto.
2021-04-29 Sam Weinig <weinig@apple.com>
Add support for CanvasRenderingContext2DSettings
https://bugs.webkit.org/show_bug.cgi?id=225173
Reviewed by Chris Dumez.
Plumb infrastructure for passing a CanvasRenderingContext2DSettings to CanvasRenderingContext2D.
This change only adds the 'desynchronized' flag, which is only a hint, so ignoring
it is an exceptable implementation.
"When a CanvasRenderingContext2D object's desynchronized is true, then the user
agent may optimize the rendering of the canvas to reduce the latency."
- https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-desynchronized
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
Add new files.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getContext):
(WebCore::HTMLCanvasElement::createContext2d):
(WebCore::HTMLCanvasElement::getContext2d):
Pipe CanvasRenderingContext2DSettings to CanvasRenderingContext2D.
* html/HTMLCanvasElement.h:
Forward declare ImageBitmapRenderingContextSettings and remove default values
from functions taking a ImageBitmapRenderingContextSettings. There are few
callers and this allows us to remove an include.
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::create):
(WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
* html/canvas/CanvasRenderingContext2D.h:
Store settings. It is not currently used for anything but returning
itself but will have other state in the future.
* html/canvas/CanvasRenderingContext2D.idl:
Add getContextAttributes() operation from https://html.spec.whatwg.org/multipage/canvas.html#canvasrenderingcontext2d
* html/canvas/CanvasRenderingContext2DSettings.h: Added.
* html/canvas/CanvasRenderingContext2DSettings.idl: Added.
2021-04-29 Chris Dumez <cdumez@apple.com>
Improve local storage size estimation for quota limitation
https://bugs.webkit.org/show_bug.cgi?id=225123
<rdar://problem/77248111>
Reviewed by Alex Christensen.
Improve local storage size estimation for quota limitation:
- Rely on String::sizeInBytes() to compute the String size, instead of using
String::length() * sizeof(UChar)
- Make estimation consistent between StorageMap & LocalStorageDatabase
* storage/StorageMap.cpp:
(WebCore::StorageMap::setItem):
(WebCore::StorageMap::setItemIgnoringQuota):
(WebCore::StorageMap::removeItem):
(WebCore::StorageMap::clear):
(WebCore::StorageMap::importItems):
(WebCore::StorageMap::Impl::copy const):
* storage/StorageMap.h:
2021-04-29 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r276689, r276736, and r276737.
https://bugs.webkit.org/show_bug.cgi?id=225188
Broke platform/ios/ios/storage/domstorage/5mb-quota.html
Reverted changesets:
"Improve local storage size estimation for quota limitation"
https://bugs.webkit.org/show_bug.cgi?id=225123
https://trac.webkit.org/changeset/276689
"REGRESSION(r276689): [ iOS wk2 ]
platform/ios/ios/storage/domstorage/5mb-quota.html is a
constant text failure"
https://bugs.webkit.org/show_bug.cgi?id=225160
https://trac.webkit.org/changeset/276736
"Make sure we invalidate the iterator in StorageMap::clear()"
https://bugs.webkit.org/show_bug.cgi?id=225164
https://trac.webkit.org/changeset/276737
2021-04-29 Antoine Quint <graouts@webkit.org>
Rotation axis parallel to the z axis should not serialize using the "z" keyword for the rotate property
https://bugs.webkit.org/show_bug.cgi?id=225101
Reviewed by Antti Koivisto.
The CSS spec has changed to drop the "z" keyword or any other axis parallel to the z axis when parsing the
rotate property in https://github.com/w3c/csswg-drafts/pull/6147.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::computedRotate):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeRotate):
2021-04-29 Zalan Bujtas <zalan@apple.com>
[LFC][IFC] Incorrect middle alignment for inline boxes when line-height is present
https://bugs.webkit.org/show_bug.cgi?id=225166
<rdar://77272112>
Reviewed by Simon Fraser.
Let's use the layout bounds instead of the baseline when computing the inline box's baseline offset from the root inline box's baseline.
The difference here is that the layout bounds (per spec) is adjusted with the line-height value.
These two values (layout bounds's ascent and the inline box's baseline) resolve to the same value as long as the line-height property is not set.
Tests: fast/inline/incorrect-middle-alignment-with-line-height.html
fast/inline/incorrect-middle-baseline-alignment-with-line-height.html
* layout/inlineformatting/InlineFormattingContextGeometry.cpp:
(WebCore::Layout::LineBoxBuilder::computeLineBoxHeightAndAlignInlineLevelBoxesVertically):
2021-04-29 Said Abou-Hallawa <said@apple.com>
[GPU Process] REGRESSION(r272888): Don't assert the validity of the dataURL mimeType inside GPU Process
https://bugs.webkit.org/show_bug.cgi?id=225175
<rdar://76286963>
Reviewed by Simon Fraser.
* platform/MIMETypeRegistry.h:
Export isSupportedImageMIMETypeForEncoding() so it can be called in WebKit.
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::ImageBufferCGBackend::toCFData const):
Do not assert if we are inside the GPU Process.
2021-04-28 Ryosuke Niwa <rniwa@webkit.org>
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 Chris Dumez <cdumez@apple.com>
Crash under WebCore::AudioNodeOutput::pull(WebCore::AudioBus*, unsigned long)
https://bugs.webkit.org/show_bug.cgi?id=225174
<rdar://77270701>
Unreviewed, revert r274767 as it introduced this crash.
* Modules/webaudio/AudioNodeInput.cpp:
(WebCore::AudioNodeInput::connect):
(WebCore::AudioNodeInput::disconnect):
(WebCore::AudioNodeInput::disable):
(WebCore::AudioNodeInput::enable):
(WebCore::AudioNodeInput::bus):
(WebCore::AudioNodeInput::sumAllConnections):
(WebCore::AudioNodeInput::pull):
* Modules/webaudio/AudioNodeInput.h:
* Modules/webaudio/AudioNodeOutput.cpp:
(WebCore::AudioNodeOutput::disable):
(WebCore::AudioNodeOutput::enable):
* Modules/webaudio/AudioParam.cpp:
(WebCore::AudioParam::calculateFinalValues):
* Modules/webaudio/AudioSummingJunction.cpp:
(WebCore::AudioSummingJunction::addOutput):
(WebCore::AudioSummingJunction::removeOutput):
(WebCore::AudioSummingJunction::updateRenderingState):
(WebCore::AudioSummingJunction::maximumNumberOfChannels const):
* Modules/webaudio/AudioSummingJunction.h:
(WebCore::AudioSummingJunction::renderingOutput):
(WebCore::AudioSummingJunction::renderingOutput const):
(WebCore::AudioSummingJunction::isConnected const):
(WebCore::AudioSummingJunction::numberOfConnections const):
* Modules/webaudio/WebKitAudioPannerNode.cpp:
(WebCore::WebKitAudioPannerNode::notifyAudioSourcesConnectedToNode):
2021-04-28 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Coalesce adjacent selection geometries when rendering individual selection quads
https://bugs.webkit.org/show_bug.cgi?id=225054
Reviewed by Tim Horton.
Add a heuristic to coalesce adjacent selection geometries when `SelectionRenderingBehavior::UseIndividualQuads`
is active. Currently, we pass them directly through to the list of coalesced geometries inside
`RenderObject::collectSelectionGeometries`, but this can lead to almost perfectly adjacent selection quads
showing a narrow gap in between their selection views.
Instead, we can detect this case where neighboring quads can be united into a single quad without significantly
changing the geometry. Rather than append the new selection geometry in this case, we simply adjust the last
selection geometry's quad so that it encompasses the new selection geometry as well, by extending the top right
and bottom right extent points of the last selection quad to the new selection quad's extent points.
See below for more details.
Test: fast/images/image-extraction/ios/coalesce-selection-rects-in-image-overlay.html
* html/HTMLElement.h: `WEBCORE_EXPORT` a couple of helper methods.
* rendering/RenderObject.cpp:
(WebCore::RenderObject::collectSelectionGeometriesInternal):
Avoid sorting selection geometries by bounding rect `logicalLeft` in the case where we're not coalescing
bounding rects (and also update the preceding comment accordingly).
(WebCore::coalesceSelectionGeometryWithAdjacentQuadsIfPossible):
Add a new helper to unite neighboring quads if: (1) the top right and bottom right of the current quad are very
close to the top left and bottom left of the next quad (respectively), and (2) the angle of rotation of the
bounding rect of the current quad is very close to that of the next quad.
(WebCore::RenderObject::collectSelectionGeometries):
Use the above helper method to either coalesce or append selection geometries to the final vector of coalesced
geometries.
2021-04-28 Rob Buis <rbuis@igalia.com>
[aspect-ratio] Treat border/padding correctly for box-sizing: border-box
https://bugs.webkit.org/show_bug.cgi?id=225015
Reviewed by Darin Adler.
When computing logical height in aspect-ratio case, to compute the automatic
minimum size [1] for min-height: auto, the padding was always subtracted,
however it should only be subtracted in the box-sizing: content-box case.
Test: imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-035.html
[1] https://www.w3.org/TR/css-sizing-4/#aspect-ratio-minimum
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalHeight const):
2021-04-28 Devin Rousso <drousso@apple.com>
experiment with averaging sampling colors across the top of the page as the scroll area background
https://bugs.webkit.org/show_bug.cgi?id=224987
<rdar://problem/76251889>
Reviewed by Darin Adler.
Tests: SampledPageTopColor.ZeroMaxDifference
SampledPageTopColor.NegativeMaxDifference
SampledPageTopColor.SolidColor
SampledPageTopColor.DifferentColorsWithoutOutlierBelowMaxDifference
SampledPageTopColor.DifferentColorsWithLeftOutlierAboveMaxDifference
SampledPageTopColor.DifferentColorsWithMiddleOutlierAboveMaxDifference
SampledPageTopColor.DifferentColorsWithRightOutlierAboveMaxDifference
SampledPageTopColor.DifferentColorsIndividuallyAboveMaxDifference
SampledPageTopColor.DifferentColorsCumulativelyAboveMaxDifference
SampledPageTopColor.DisplayP3
SampledPageTopColor.ExperimentalUseSampledPageTopColorForScrollAreaBackgroundColor
* dom/Document.h:
(WebCore::Document::sampledPageTopColor const): Added.
* dom/Document.cpp:
(WebCore::Document::enqueuePaintTimingEntryIfNeeded):
(WebCore::colorDifference): Added.
(WebCore::averageColor): Added.
(WebCore::Document::determineSampledPageTopColor): Added.
Wait until the first contentful paint before sampling. Don't sample if that location would
fall into a 3rd-party `<iframe>`. Currently use 5 snapshots across the top of the page,
allowing for one of either the first or last snapshot to be an outlier, which is not
included in the average of the other snapshots that's used as the final color value. If the
Lab color difference between any two snapshots (unless it's the first or last snapshot as
described above) or across all the (non-outlier) snapshots is too large, bail. Only enabled
if the `SampledPageTopColorMaxDifference` setting is greater than 0.
* page/Page.h:
* page/Page.cpp:
(WebCore::Page::sampledPageTopColor const): Added.
* page/ChromeClient.h:
(WebCore::ChromeClient::didSamplePageTopColor const): Added.
Pass along the `sampledPageTopColor` to the UIProcess after it's determined or if the above
logic bails (so that the `WKWebView` can adjust `_sampledPageTopColor` to `nil`).
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::rootBackgroundColorOrTransparencyChanged):
Use the `sampledPageTopColor` if the `UseSampledPageTopColorForScrollAreaBackgroundColor`
internal preference is enabled instead of the CSS `background-color` of the `<html>`/`<body>`.
2021-04-28 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Web content process occasionally crashes under VisibleSelection::adjustPositionForEnd
https://bugs.webkit.org/show_bug.cgi?id=225072
rdar://77159489
Reviewed by Darin Adler.
Remove a helper method that was added in r276688, which we no longer need.
* dom/Position.h:
(WebCore::Position::isInTreeScope const): Deleted.
2021-04-28 Cameron McCormack <heycam@apple.com>
Don't create custom scrollbars for fullscreen placeholders.
https://bugs.webkit.org/show_bug.cgi?id=225141
<rdar://64800098>
Reviewed by Darin Adler.
We can end up calling RenderScrollbar::createCustomScrollbar with
`element = nullptr` from RenderLayerScrollableArea::createScrollbar,
when the renderer is a RenderFullscreenPlaceholder.
We don't need to bother with scrollbars for the placeholder, so check to
make sure we have a valid element before creating custom scollbars.
Test: fullscreen/full-screen-crash-custom-scrollbars.html
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::createScrollbar):
2021-04-28 Chris Dumez <cdumez@apple.com>
Make sure we invalidate the iterator in StorageMap::clear()
https://bugs.webkit.org/show_bug.cgi?id=225164
Reviewed by Alex Christensen.
I recently introduced StorageMap::clear() but failed to call invalidateIterator()
like we do in other StorageMap functions that modify the internal HashMap. Since
we cleared the HashMap, we don't want to be keeping a HashMap iterator around.
Looking at the code, I do not think this can cause crashes because the
`index >= length()` check would fail in StorageMap::key(unsigned). That said, it
is best not to keep a bad iterator around.
* storage/StorageMap.cpp:
(WebCore::StorageMap::clear):
2021-04-28 Wenson Hsieh <wenson_hsieh@apple.com>
Fine-tune some more selection behaviors in image overlays
https://bugs.webkit.org/show_bug.cgi?id=225121
Reviewed by Tim Horton.
Make some additional minor refinements to selection behaviors in image overlays.
Test: fast/images/image-extraction/mac/select-image-overlay-with-mouse-drag-2.html
DragAndDropTests.DragSelectedTextInImageOverlay
* html/HTMLElement.cpp:
(WebCore::HTMLElement::updateWithImageExtractionResult):
Unless `-webkit-user-select: none;` is explicitly set, make each of the text containers under each line have
`-webkit-user-select: all;`, so that text selection snaps to the boundaries of each piece of text.
* page/DragController.cpp:
(WebCore::DragController::startDrag):
Drive-by fix: avoid dragging image overlay text out as rich text.
* page/EventHandler.cpp:
(WebCore::nodeToSelectOnMouseDownForNode):
Make an exception for image overlay text, such that we don't select text upon handling a "mousedown" event, even
though the text has `-webkit-user-select: all;`. Also, deploy `RefPtr` in a few places while I'm here.
(WebCore::expandSelectionToRespectSelectOnMouseDown):
Drive-by fix: deploy `RefPtr` in a few places.
2021-04-28 Alex Christensen <achristensen@webkit.org>
Add SPI to query whether a URL would be upgraded to HTTPS
https://bugs.webkit.org/show_bug.cgi?id=225154
<rdar://77269904>
Reviewed by Geoff Garen.
Covered by API tests.
* contentextensions/ContentExtensionsBackend.cpp:
(WebCore::ContentExtensions::ContentExtensionsBackend::shouldBeMadeSecure):
* contentextensions/ContentExtensionsBackend.h:
2021-04-28 Basuke Suzuki <basuke.suzuki@sony.com>
[clang] Remove implicit cast related warnings
https://bugs.webkit.org/show_bug.cgi?id=225139
Reviewed by Darin Adler.
Added explicit cast to suppress warning.
Behavior is not changed from implicit cast.
No new tests because there's no behavior change.
* layout/inlineformatting/InlineLine.cpp:
(WebCore::Layout::Line::Run::removeTrailingLetterSpacing):
2021-04-28 Mark Lam <mark.lam@apple.com>
Fix exception assertions in light of the TerminationException.
https://bugs.webkit.org/show_bug.cgi?id=225128
rdar://76694909
Reviewed by Robin Morisset.
A few changes plus rebasing bindings test results.
* Modules/plugins/QuickTimePluginReplacement.mm:
(WebCore::QuickTimePluginReplacement::installReplacement):
* bindings/js/JSDOMExceptionHandling.cpp:
(WebCore::propagateExceptionSlowPath):
(WebCore::throwNotSupportedError):
(WebCore::throwInvalidStateError):
(WebCore::throwSecurityError):
(WebCore::throwDOMSyntaxError):
(WebCore::throwDataCloneError):
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSC_DEFINE_HOST_FUNCTION):
* bindings/js/JSDOMGlobalObjectTask.cpp:
* bindings/js/JSDOMMapLike.cpp:
(WebCore::getBackingMap):
* bindings/js/JSDOMSetLike.cpp:
(WebCore::getBackingSet):
* bindings/js/JSMicrotaskCallback.h:
(WebCore::JSMicrotaskCallback::call):
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readTerminal):
* bindings/js/WritableStream.cpp:
(WebCore::WritableStreamInternal::callFunction):
(WebCore::WritableStream::lock):
* bindings/scripts/CodeGeneratorJS.pm:
(GeneratePut):
(GeneratePutByIndex):
(GenerateDefineOwnProperty):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
(WebCore::JSTestNamedAndIndexedSetterNoIdentifier::put):
(WebCore::JSTestNamedAndIndexedSetterNoIdentifier::putByIndex):
(WebCore::JSTestNamedAndIndexedSetterNoIdentifier::defineOwnProperty):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
(WebCore::JSTestNamedAndIndexedSetterThrowingException::put):
(WebCore::JSTestNamedAndIndexedSetterThrowingException::putByIndex):
(WebCore::JSTestNamedAndIndexedSetterThrowingException::defineOwnProperty):
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
(WebCore::JSTestNamedAndIndexedSetterWithIdentifier::put):
(WebCore::JSTestNamedAndIndexedSetterWithIdentifier::putByIndex):
(WebCore::JSTestNamedAndIndexedSetterWithIdentifier::defineOwnProperty):
* bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
(WebCore::JSTestNamedSetterNoIdentifier::put):
(WebCore::JSTestNamedSetterNoIdentifier::putByIndex):
(WebCore::JSTestNamedSetterNoIdentifier::defineOwnProperty):
* bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
(WebCore::JSTestNamedSetterThrowingException::put):
(WebCore::JSTestNamedSetterThrowingException::putByIndex):
(WebCore::JSTestNamedSetterThrowingException::defineOwnProperty):
* bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
(WebCore::JSTestNamedSetterWithIdentifier::put):
(WebCore::JSTestNamedSetterWithIdentifier::putByIndex):
(WebCore::JSTestNamedSetterWithIdentifier::defineOwnProperty):
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
(WebCore::JSTestNamedSetterWithIndexedGetter::put):
(WebCore::JSTestNamedSetterWithIndexedGetter::putByIndex):
(WebCore::JSTestNamedSetterWithIndexedGetter::defineOwnProperty):
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
(WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::put):
(WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::putByIndex):
(WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::defineOwnProperty):
* bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeableProperties.cpp:
(WebCore::JSTestNamedSetterWithLegacyUnforgeableProperties::put):
(WebCore::JSTestNamedSetterWithLegacyUnforgeableProperties::putByIndex):
(WebCore::JSTestNamedSetterWithLegacyUnforgeableProperties::defineOwnProperty):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
(WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
(WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):
2021-04-28 Zalan Bujtas <zalan@apple.com>
Remove redundant RenderObject::isInFlowRenderFragmentedFlow
https://bugs.webkit.org/show_bug.cgi?id=225152
Reviewed by Antti Koivisto.
Now that RenderObject::isOutOfFlowRenderFragmentedFlow() is gone (r276707), isInFlowRenderFragmentedFlow() is really just a isRenderFragmentedFlow() check.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::selectionGaps):
(WebCore::isChildHitTestCandidate):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::updateStylesForColumnChildren):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::skipContainingBlockForPercentHeightCalculation const):
* rendering/RenderBox.h:
(WebCore::RenderBox::canHaveOutsideFragmentRange const):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::shouldBeNormalFlowOnly const):
(WebCore::RenderLayer::updateLayerPositions):
(WebCore::RenderLayer::updatePagination):
(WebCore::RenderLayer::calculateClipRects const):
* rendering/RenderObject.h:
(WebCore::RenderObject::isRenderGrid const):
(WebCore::RenderObject::isInFlowRenderFragmentedFlow const): Deleted.
* rendering/updating/RenderTreeBuilderMultiColumn.cpp:
(WebCore::RenderTreeBuilder::MultiColumn::multiColumnDescendantInserted):
2021-04-28 Youenn Fablet <youenn@apple.com>
Set audio transceiver nMax to 1
https://bugs.webkit.org/show_bug.cgi?id=225149
<rdar://75956639>
Reviewed by Alex Christensen.
Implement step 8.4 of https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addtransceiver and set nMax for audio to 1.
Test: webrtc/audio-addTransceiver.html
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::createTransceiverBackends):
(WebCore::LibWebRTCMediaEndpoint::addTransceiver):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
* Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
(WebCore::fromRtpTransceiverInit):
* Modules/mediastream/libwebrtc/LibWebRTCUtils.h:
2021-04-28 Chris Dumez <cdumez@apple.com>
Drop ModernUnprefixedWebAudio & AudioWorklet experimental feature flags
https://bugs.webkit.org/show_bug.cgi?id=225130
Reviewed by Eric Carlson.
Drop ModernUnprefixedWebAudio & AudioWorklet experimental feature flags now that
these features have shipped. It also doesn't make sense to disable them given
that the prefixed WebAudio API is no longer exposed and there is no feature flag
to turn the legacy prefixed API back on.
* Modules/webaudio/AnalyserNode.idl:
* Modules/webaudio/AudioBuffer.idl:
* Modules/webaudio/AudioBufferSourceNode.idl:
* Modules/webaudio/AudioContext.idl:
* Modules/webaudio/AudioParamMap.idl:
* Modules/webaudio/AudioProcessingEvent.idl:
* Modules/webaudio/AudioWorklet.idl:
* Modules/webaudio/AudioWorkletNode.idl:
* Modules/webaudio/AudioWorkletNodeOptions.idl:
* Modules/webaudio/BaseAudioContext.idl:
* Modules/webaudio/BiquadFilterNode.idl:
* Modules/webaudio/ChannelMergerNode.idl:
* Modules/webaudio/ChannelSplitterNode.idl:
* Modules/webaudio/ConstantSourceNode.idl:
* Modules/webaudio/ConstantSourceOptions.idl:
* Modules/webaudio/ConvolverNode.idl:
* Modules/webaudio/DelayNode.idl:
* Modules/webaudio/DynamicsCompressorNode.idl:
* Modules/webaudio/GainNode.idl:
* Modules/webaudio/IIRFilterNode.idl:
* Modules/webaudio/MediaElementAudioSourceNode.idl:
* Modules/webaudio/MediaStreamAudioDestinationNode.idl:
* Modules/webaudio/MediaStreamAudioSourceNode.idl:
* Modules/webaudio/OfflineAudioContext.idl:
* Modules/webaudio/OscillatorNode.idl:
* Modules/webaudio/PannerNode.idl:
* Modules/webaudio/PeriodicWave.idl:
* Modules/webaudio/StereoPannerNode.idl:
* Modules/webaudio/WaveShaperNode.idl:
2021-04-28 Zalan Bujtas <zalan@apple.com>
Remove unused RenderObject::isOutOfFlowRenderFragmentedFlow
https://bugs.webkit.org/show_bug.cgi?id=225133
Reviewed by Simon Fraser.
Out-of-flow fragmented flows were originally added for CSS regions (r91760) to provide
an anonymous container for the region content. This is not to be confused with a multi-column box with
"position: absolute/fixed" (such content would still generate an in-flow fragment container).
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeVisibleRectInContainer const):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::mapAbsoluteToLocalPoint const):
* rendering/RenderElement.h:
(WebCore::RenderElement::canContainFixedPositionObjects const):
* rendering/RenderLayer.cpp:
(WebCore::accumulateOffsetTowardsAncestor):
(WebCore::RenderLayer::hitTestContents const):
(WebCore::RenderLayer::calculateClipRects const):
* rendering/RenderLayer.h:
(WebCore::RenderLayer::isRenderFragmentedFlow const):
(WebCore::RenderLayer::isOutOfFlowRenderFragmentedFlow const): Deleted.
* rendering/RenderObject.h:
(WebCore::RenderObject::isInFlowRenderFragmentedFlow const):
(WebCore::RenderObject::isOutOfFlowRenderFragmentedFlow const): Deleted.
2021-04-28 Miguel Gomez <magomez@igalia.com>
Unreviewed, fixing GTK and WPE build with external holepunch enabled after r269907.
* platform/graphics/holepunch/MediaPlayerPrivateHolePunch.h: update signature of load method.
2021-04-28 Manuel Rego Casasnovas <rego@igalia.com>
[selectors] Using a modifier key on an element makes it stop matching :focus-visible
https://bugs.webkit.org/show_bug.cgi?id=225075
Reviewed by Ryosuke Niwa.
When we used a modifier key on a element that was matching :focus-visible, we stopped matching :focus-visible.
That was wrong, we shouldn't just start matching :focus-visible when a modifier key is used but not the other way around.
This patches fixed that without doing any work if the element is already matching :focus-visible when the user type a key.
Test: imported/w3c/web-platform-tests/css/selectors/focus-visible-021.html
* dom/Element.cpp:
(WebCore::shouldAlwaysHaveFocusVisibleWhenFocused): Helper method for inputs and content editable elements.
(WebCore::Element::setFocus): Use the new helper method.
(WebCore::Element::setHasFocusVisible): Add asserts to avoid setting/unsetting :focus-visible flag wrongly.
* dom/Node.cpp:
(WebCore::Node::isContentEditable const): Just mark as const.
(WebCore::Node::isContentRichlyEditable const): Ditto.
* dom/Node.h: Ditto.
* page/EventHandler.cpp:
(WebCore::EventHandler::internalKeyEvent): Don't do anything regarding :focus-visible flag if the element already matches :focus-visible.
2021-04-28 Cameron McCormack <heycam@apple.com>
Make img elements perform source selection even when not in the document.
https://bugs.webkit.org/show_bug.cgi?id=222801
Reviewed by Ryosuke Niwa.
The rules for image source selection in the HTML spec do not prevent
them from running when an <img> is not in the document. So we update
HTMLImageElement to call selectImageSource() when inserted into and
removed from a <picture> without checking whether it's in a document.
Test: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/source-media-outside-doc.html
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::~HTMLImageElement): Remove useless call to
setPictureElement, since all it does is clear a weak pointer.
(WebCore::HTMLImageElement::insertedIntoAncestor):
(WebCore::HTMLImageElement::removedFromAncestor):
2021-04-28 Ian Gilbert <iang@apple.com>
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 Basuke Suzuki <basuke.suzuki@sony.com>
[PlayStation] Suppress warnings for %llu format specifier for uint64_t.
https://bugs.webkit.org/show_bug.cgi?id=225138
Reviewed by Darin Adler.
PRIu64 from <cstdint> should be use to format uint64_t value in printf.
No new tests because there's no behavior change.
* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::startTermination):
2021-04-27 Chris Dumez <cdumez@apple.com>
Improve local storage size estimation for quota limitation
https://bugs.webkit.org/show_bug.cgi?id=225123
Reviewed by Alex Christensen.
Improve local storage size estimation for quota limitation:
- Rely on String::sizeInBytes() to compute the String size, instead of using
String::length() * sizeof(UChar)
- Make estimation consistent between StorageMap & LocalStorageDatabase
* storage/StorageMap.cpp:
(WebCore::StorageMap::setItem):
(WebCore::StorageMap::setItemIgnoringQuota):
(WebCore::StorageMap::removeItem):
(WebCore::StorageMap::clear):
(WebCore::StorageMap::importItems):
(WebCore::StorageMap::Impl::copy const):
* storage/StorageMap.h:
2021-04-27 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Web content process occasionally crashes under VisibleSelection::adjustPositionForEnd
https://bugs.webkit.org/show_bug.cgi?id=225072
rdar://77159489
Reviewed by Darin Adler.
Add a helper method to check whether or not the given `Position` is in a tree scope. See WebKit/ChangeLog for
more details.
Test: editing/selection/ios/clear-selection-while-moving-selection-handles.html
* dom/Position.h:
(WebCore::Position::isInTreeScope const):
2021-04-27 Cameron McCormack <heycam@apple.com>
Associate a picture element with an img only if the img is a direct child.
https://bugs.webkit.org/show_bug.cgi?id=225044
Reviewed by Ryosuke Niwa.
Test: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/img-picture-ancestor.html
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::insertedIntoAncestor):
(WebCore::HTMLImageElement::removedFromAncestor):
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
2021-04-27 Chris Dumez <cdumez@apple.com>
IPC::decoder::decode() should mark decoder as invalid when failing
https://bugs.webkit.org/show_bug.cgi?id=225117
Reviewed by Darin Adler.
IPC::decoder::decode() should mark decoder as invalid when failing, instead of relying
on individual type decoders to do so. This makes type decoders a bit simpler and less
error-prone.
* Modules/highlight/AppHighlight.h:
(WebCore::AppHighlight::decode):
2021-04-27 Alex Christensen <achristensen@webkit.org>
charset in contentType used in Blob.prototype.slice(start, end, contentType) is lost
https://bugs.webkit.org/show_bug.cgi?id=225057
Reviewed by Chris Dumez.
When calling Blob.slice, use the content type from the call, not from the sliced-from blob.
This matches Chrome and Firefox.
When no content type is given, browsers disagree on what happens, so keep existing behavior in that case.
Test: fast/files/blob-content-type.html
* fileapi/Blob.cpp:
(WebCore::Blob::Blob):
* fileapi/ThreadableBlobRegistry.cpp:
(WebCore::ThreadableBlobRegistry::registerBlobURLForSlice):
* fileapi/ThreadableBlobRegistry.h:
* platform/network/BlobRegistry.h:
* platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::registerBlobURLForSlice):
* platform/network/BlobRegistryImpl.h:
2021-04-27 Alexey Shvayka <shvaikalesh@gmail.com>
[JSC] Remove defaultValue() from the method table
https://bugs.webkit.org/show_bug.cgi?id=225032
Reviewed by Darin Adler.
Test: platform/mac/fast/dom/objc-wrapper-toprimitive.html
* bindings/js/JSPluginElementFunctions.cpp:
(WebCore::pluginElementCustomGetOwnPropertySlot):
* bridge/objc/objc_runtime.h:
* bridge/objc/objc_runtime.mm:
(JSC::Bindings::ObjcFallbackObjectImp::finishCreation):
(JSC::Bindings::ObjcFallbackObjectImp::getOwnPropertySlot):
(JSC::Bindings::JSC_DEFINE_HOST_FUNCTION):
(JSC::Bindings::ObjcFallbackObjectImp::defaultValue): Deleted.
* bridge/runtime_object.cpp:
(JSC::Bindings::RuntimeObject::finishCreation):
(JSC::Bindings::RuntimeObject::getOwnPropertySlot):
(JSC::Bindings::JSC_DEFINE_HOST_FUNCTION):
(JSC::Bindings::RuntimeObject::defaultValue): Deleted.
* bridge/runtime_object.h:
2021-04-27 Chris Dumez <cdumez@apple.com>
Copy-on-write semantics should be an internal implementation detail of StorageMap
https://bugs.webkit.org/show_bug.cgi?id=225108
Reviewed by Alex Christensen.
Instead of making the StorageMap RefCounted and requiring the client to potentially
replace its StorageMap whenever it calls functions that modify the StorageMap, the
copy-on-write semantics in now an internal implementation detail of StorageMap.
To achieve this, the following changes were made:
- StorageMap is no longer RefCounted. Instead, it has an internal Impl data member
that is RefCounted.
- The internal Impl data member is the one that gets copied on write.
- Functions that modify the StorageMap no longer need to return a StorageMap.
- Add a clear() function for convenience.
* storage/StorageMap.cpp:
(WebCore::StorageMap::StorageMap):
(WebCore::StorageMap::invalidateIterator):
(WebCore::StorageMap::setIteratorToIndex):
(WebCore::StorageMap::length const):
(WebCore::StorageMap::key):
(WebCore::StorageMap::getItem const):
(WebCore::StorageMap::setItem):
(WebCore::StorageMap::setItemIgnoringQuota):
(WebCore::StorageMap::removeItem):
(WebCore::StorageMap::clear):
(WebCore::StorageMap::contains const):
(WebCore::StorageMap::importItems):
(WebCore::StorageMap::Impl::copy const):
* storage/StorageMap.h:
(WebCore::StorageMap::items const):
(WebCore::StorageMap::Impl::create):
2021-04-27 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] Add borders for better control visibility
https://bugs.webkit.org/show_bug.cgi?id=225058
<rdar://problem/77161616>
Reviewed by Sam Weinig.
The solid gray backgrounds of new form controls have poor visibility on
site's that have gray-ish backgrounds or draw the controls on top of
a gray area. To fix this, borders are added to all controls to ensure
visibility no matter the background.
The border color is the system background color. This means the border
is invisible on white backgrounds in light mode, and dark backgrounds
in dark mode, ensuring the controls match UIKit styles on backgrounds
where they are guaranteed to be visible. However, these borders are
visible when the page/area background has a similar color to the control
background, improving control visibility.
To paint the borders, a mix of UA stylesheet changes and custom painting
changes are used. This approach is taken to maintain our existing level
of stylability. UA stylesheet changes were applied to controls that
specified a "1px solid black" border in the old design. The border is
now brought back, but with a different color. For controls that have
always had completely custom painting (independent of styles), the
border is painted by the theme.
* css/html.css:
Specify a "1px solid -webkit-control-background" border on controls
that previously (pre-redesign) specified a border in the UA stylesheet.
* css/legacyFormControlsIOS.css:
(select:focus):
Move the <select> focus style into the legacy stylesheet, since it
should not apply to the new design.
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::paintCheckbox):
Paint the checkbox border inside the painting rect, and inset the
actual checkbox by the border. This is necessary, checkboxes use
"box-sizing: border-box", and we do not want to increase the overall
size of checkboxes for compatibility reasons.
(WebCore::RenderThemeIOS::paintRadio):
Painted in a similar manner as checkboxes.
(WebCore::RenderThemeIOS::paintProgressBarWithFormControlRefresh):
(WebCore::RenderThemeIOS::paintMeter):
(WebCore::RenderThemeIOS::paintSliderTrackWithFormControlRefresh):
Slider tracks are already inset by the border size, so we can just
draw a border in the available area.
2021-04-27 Alexey Shvayka <shvaikalesh@gmail.com>
[WebIDL] `window.CSS` should be non-callable object with correct Symbol.toStringTag
https://bugs.webkit.org/show_bug.cgi?id=220855
Reviewed by Sam Weinig.
Although `window.CSS` is the only namespace object currently handled by code generator,
it's being extended by multiple Houdini specs [1], so keeping it generated is important.
This patch brings spec compliance [2] and web interop while striking a balance between
reducing generated code, avoiding indirection in the generator, and a small code diff.
Feature-wise, a namespace object is a subset of an interface; so instead of creating a
separate harness for it, like for callback interfaces, namespace objects are converted
to interfaces before being handed over to code generator, with a flag on.
While we can reduce the generated code even further, namely around subspaceForImpl(),
this change rather aligns namespace objects with [JSBuiltin] interfaces to avoid making
generator more complicated and introducing an interface with distinct set of methods.
Web-facing changes for `window.CSS` are:
1. Removed [[Call]] and [[Construct]] methods, making `typeof CSS` return "object",
which is used for feature detection (thus important for web interop).
2. Removed "length" / "name" / "prototype" properties.
3. Changed [[Prototype]] value to %Object.prototype%.
4. Added Symbol.toStringTag property with correct descriptor.
All of the above were proven web-compatible by Blink and Gecko.
Also, this patch limits the usage of NeedsConstructorProperty only to
%Interface%.prototype.constructor, as its name suggests.
[1] https://ishoudinireadyyet.com
[2] https://heycam.github.io/webidl/#namespace-object
Tests: imported/w3c/web-platform-tests/css/cssom/idlharness.html
imported/w3c/web-platform-tests/css/cssom/CSS-namespace-object-class-string.html
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMConstructorNotCallable.h: Added.
(WebCore::JSDOMConstructorNotCallable::subspaceFor):
(WebCore::JSDOMConstructorNotCallable::JSDOMConstructorNotCallable):
(WebCore::JSDOMConstructorNotCallable::initializeProperties):
(WebCore::JSDOMConstructorNotCallable<JSClass>::create):
(WebCore::JSDOMConstructorNotCallable<JSClass>::createStructure):
(WebCore::JSDOMConstructorNotCallable<JSClass>::finishCreation):
* bindings/scripts/CodeGeneratorJS.pm:
(NeedsImplementationClass):
(GenerateHeader):
(GenerateImplementation):
(GeneratePrototypeDeclaration):
(GetConstructorTemplateClassName):
(GenerateConstructorHelperMethods):
(NeedsConstructorProperty):
* bindings/scripts/IDLAttributes.json:
* bindings/scripts/IDLParser.pm:
(convertNamespaceToInterface):
(Parse):
(parseNamespace):
* bindings/scripts/preprocess-idls.pl:
(containsInterfaceOrCallbackInterfaceFromIDL):
(getInterfaceExtendedAttributesFromIDL):
* bindings/scripts/test/JS/*: Updated.
* css/DOMCSSNamespace+CSSPainting.idl:
* css/DOMCSSNamespace+CSSPropertiesandValues.idl:
* css/DOMCSSNamespace.idl:
2021-04-27 Chris Dumez <cdumez@apple.com>
Don't keep local storage data in memory in the NetworkProcess
https://bugs.webkit.org/show_bug.cgi?id=225065
Reviewed by Alex Christensen.
* platform/sql/SQLiteDatabase.h:
* platform/sql/SQLiteFileSystem.h:
Export a couple more symbols.
* storage/StorageMap.cpp:
(WebCore::StorageMap::clear):
* storage/StorageMap.h:
Add a clear() function to StorageMap so that StorageArea doesn't reconstruct a
new StorageMap object unnecessarily when:
- The StorageMap is not shared
- The StorageMap is empty (and clear() is a no-op)
2021-04-27 Youenn Fablet <youenn@apple.com>
SWContextManager::postMessageToServiceWorker should check for valid service worker
https://bugs.webkit.org/show_bug.cgi?id=225096
<rdar://76718162>
Reviewed by Chris Dumez.
There is no guarantee that serviceWorker is not null.
For instance UIProcess may ask WebProcess to terminate all service workers in parallel to network process sending a message to it.
* workers/service/context/SWContextManager.cpp:
(WebCore::SWContextManager::postMessageToServiceWorker):
2021-04-27 Chris Dumez <cdumez@apple.com>
Ask LocalStorage database to free as much memory as possible on memory pressure
https://bugs.webkit.org/show_bug.cgi?id=225109
Reviewed by Geoffrey Garen.
Add releaseMemory() function to SQLiteDatabase that calls sqlite3_db_release_memory()
to free as much memory as possible.
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::releaseMemory):
* platform/sql/SQLiteDatabase.h:
2021-04-27 Brent Fulgham <bfulgham@apple.com>
[iOS] [GPU] The UI process should issue the mach sandbox extension to 'com.apple.AGXCompilerService'
https://bugs.webkit.org/show_bug.cgi?id=225004
<rdar://problem/68362930>
Reviewed by Darin Adler.
In Bug 203915 and Bug 210616 we did work to only extend access to AGX-related graphics facilities on relevant hardware. This was
lost in the transition to the GPU Process and should be added back.
This change moves the definition of the AGX-related services and IOKit classes to the AGXCompilerService compilation unit so that
it can be shared by the WebContent and GPUProcess code paths.
Tested by existing graphics tests.
* platform/cocoa/AGXCompilerService.cpp:
(WebCore::agxCompilerServices):
(WebCore::agxCompilerClasses):
* platform/cocoa/AGXCompilerService.h:
2021-04-27 Antoine Quint <graouts@webkit.org>
Correctly interpolate stroke-dasharray in the discrete case
https://bugs.webkit.org/show_bug.cgi?id=225105
Reviewed by Antti Koivisto.
* animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
2021-04-27 Antoine Quint <graouts@webkit.org>
Fix animation of the visibility CSS property between "hidden" and "collapse"
https://bugs.webkit.org/show_bug.cgi?id=225103
Reviewed by Antti Koivisto.
The Web Animations spec details the special behavior when animating the visibility property
in https://drafts.csswg.org/web-animations-1/#animating-visibility. There it says that when
interpolating between non-visible values, we should use discrete interpolation formula.
* animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
2021-04-27 Antoine Quint <graouts@webkit.org>
Correctly specify interpolation of page-break-* properties
https://bugs.webkit.org/show_bug.cgi?id=225098
Reviewed by Antti Koivisto.
As it turns out the page-break-* properties are shorthands of the break-* properties.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
2021-04-27 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] ASSERTION FAILED: ancestor->style().columnSpan() != ColumnSpan::All || !isValidColumnSpanner(fragmentedFlow, *ancestor) in WebCore::isValidColumnSpanner
https://bugs.webkit.org/show_bug.cgi?id=225078
<rdar://76127681>
Reviewed by Antti Koivisto.
MultiColumnBuilder::multiColumnDescendantInserted() expects up-to-date fragmentedFlowState on the newly inserted renderer.
Test: fast/multicol/nested-spanner-assert.html
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::normalizeTreeAfterStyleChange):
(WebCore::RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock):
2021-04-21 Sergio Villar Senin <svillar@igalia.com>
[css-flexbox] percent children don't resolve against the flex basis on a fully inflexible item with fixed flex-basis
https://bugs.webkit.org/show_bug.cgi?id=210478
Reviewed by Darin Adler.
Flexbox spec defines some additional cases where sizes could be considered definite despite they are
actually indefinite. One of those cases is whenever we have a fully inflexible item with a definite
flex-basis. In that case we should allow desdendants of flex item to resolve against the post-flexing
size of the flex item which is basically the value of the definite flex-basis. Note that in the majority
of cases those percentages are resolved before flexing the item and not recomputed after that.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::useChildOverridingMainSizeForPercentageResolution): let descendants of
fully inflexible flex items with definite flex-basis to resolve against the post-flexing size. Also added
some documentation because that part of the code is far from obvious for the casual reader.
2021-04-27 Youenn Fablet <youenn@apple.com>
Add memory allocation checks in more realtime audio capture/rendering places
https://bugs.webkit.org/show_bug.cgi?id=224750
Reviewed by Eric Carlson.
Add FastMalloc macros to catch memory allocation in audio sensitive threads.
Update LibWebRTCAudioModule and RealtimeIncomingAudioSourceCocoa to not rely on Function creation but rely on Timer for large audio gap logging.
Update BaseAudioSharedUnit to not allocate a vector each time an audio sample is captured.
Covered by existing tests.
* platform/mediastream/RealtimeIncomingAudioSource.h:
* platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
(WebCore::LibWebRTCAudioModule::LibWebRTCAudioModule):
(WebCore::LibWebRTCAudioModule::StartPlayout):
(WebCore::LibWebRTCAudioModule::StopPlayout):
(WebCore::LibWebRTCAudioModule::logTimerFired):
(WebCore::LibWebRTCAudioModule::computeDelayUntilNextPolling):
(WebCore::LibWebRTCAudioModule::pollAudioData):
* platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
* platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.cpp:
(WebCore::AudioMediaStreamTrackRendererCocoa::pushSamples):
* platform/mediastream/mac/BaseAudioSharedUnit.cpp:
(WebCore::BaseAudioSharedUnit::addClient):
(WebCore::BaseAudioSharedUnit::removeClient):
(WebCore::BaseAudioSharedUnit::audioSamplesAvailable):
* platform/mediastream/mac/BaseAudioSharedUnit.h:
* platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:
(WebCore::RealtimeIncomingAudioSourceCocoa::RealtimeIncomingAudioSourceCocoa):
(WebCore::RealtimeIncomingAudioSourceCocoa::startProducingData):
(WebCore::RealtimeIncomingAudioSourceCocoa::stopProducingData):
(WebCore::RealtimeIncomingAudioSourceCocoa::logTimerFired):
(WebCore::RealtimeIncomingAudioSourceCocoa::OnData):
* platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.h:
2021-04-27 Rob Buis <rbuis@igalia.com>
Check globalObject for null
https://bugs.webkit.org/show_bug.cgi?id=223793
Reviewed by Youenn Fablet.
Check globalObject for null in RTCRtpSFrameTransform::createStreams
before deferencing.
Test: http/tests/webrtc/sframe-transform-write.html
* Modules/mediastream/RTCRtpSFrameTransform.cpp:
(WebCore::RTCRtpSFrameTransform::createStreams):
2021-04-27 Frédéric Wang <fwang@igalia.com>
[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 <mo> 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 <mo>.
2021-04-26 Rob Buis <rbuis@igalia.com>
Remove rounding logic in RenderGeometryMap::mapContainer
https://bugs.webkit.org/show_bug.cgi?id=218577
Reviewed by Simon Fraser.
Remove rounding logic in RenderGeometryMap::mapContainer and
add the LayoutSize to FloatPoint using FloatPoint::move() to
match what is done in TransformState::translateMappedCoordinates.
Test: fast/layers/geometry-map-accumulated-offset-assert.html
* platform/graphics/transforms/TransformState.cpp:
(WebCore::TransformState::translateMappedCoordinates):
* rendering/RenderGeometryMap.cpp:
(WebCore::RenderGeometryMap::mapToContainer const):
2021-04-26 Manuel Rego Casasnovas <rego@igalia.com>
REGRESSION (r276264): Reproducible crash in WebCore::UserActionElementSet::clearFlags
https://bugs.webkit.org/show_bug.cgi?id=224957
Reviewed by Ryosuke Niwa.
The crash was due to a problem with the focus and focus-visible flags getting out of sync.
The problem was related to how we deal we script focus in Element::focus(),
we were setting the focus-visible flag before doing focus,
and if the element was moved to a different document in that process,
we were resetting the flag for the same element, but pointing to the new document.
So the old document still kept information about the element and the flag, and it shouldn't.
This patch is based on a patch by Ryosuke Niwa <rniwa@webkit.org>.
The approach to solve the issue is to consolidate the timing for both focus and focus-visible flags
so they don't get out of sync.
For that we add a new FocusVisibility enum to FocusOptions, and we pass it to Element::setFocus()
and use it to pass a different value to Element::setHasFocusVisible().
Test: fast/selectors/focus-visible-crash.html
* dom/Document.cpp:
(WebCore::Document::setFocusedElement):
* dom/Element.cpp:
(WebCore::Element::setFocus):
(WebCore::Element::focus):
* dom/Element.h:
* dom/FocusOptions.h:
* html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::setFocus):
* html/HTMLAreaElement.h:
* html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::setFocus):
* html/HTMLFrameElementBase.h:
* page/EventHandler.cpp:
(WebCore::EventHandler::internalKeyEvent):
* page/FocusController.cpp:
(WebCore::FocusController::advanceFocusInDocumentOrder):
* page/FrameView.cpp:
(WebCore::FrameView::scrollToFragmentInternal):
2021-04-26 Tim Nguyen <ntim@apple.com>
Create a containing block when relevant properties are set in the current element will-change
https://bugs.webkit.org/show_bug.cgi?id=167868
Reviewed by Alan Bujtas.
Per spec, any CSS property that is susceptible to create a containing block should create one when put on the
current element's will-change.
Relevant WPT are enabled.
Test: fast/css/will-change/will-change-creates-containing-block.html
* rendering/RenderElement.h:
(WebCore::RenderElement::canContainFixedPositionObjects const):
(WebCore::RenderElement::canContainAbsolutelyPositionedObjects const):
* rendering/style/WillChangeData.cpp:
(WebCore::WillChangeData::createsContainingBlockForOutOfFlowPositioned const):
* rendering/style/WillChangeData.h:
2021-04-26 Wenson Hsieh <wenson_hsieh@apple.com>
Subdivide image overlay text into one or more elements per line
https://bugs.webkit.org/show_bug.cgi?id=225038
rdar://75505043
Reviewed by Tim Horton and Devin Rousso.
Refactor some image extraction and image overlay code to allow for multiple elements containing text per line.
See comments below for more details.
Changes covered by augmenting existing layout tests.
* html/HTMLElement.cpp:
(WebCore::HTMLElement::updateWithImageExtractionResult):
The crux of this change is in this method. Currently, an image overlay has one or more `div` elements underneath
the root container element, each of which represents a single line (i.e. contains a text node and a line break).
Instead, we make each of these line container `div`s contain one or more `div` elements that represent further
subdivided text within each line.
See the corresponding additions patch for more details.
* html/shadow/imageOverlay.css:
(div#image-overlay):
(div.image-overlay-line, .image-overlay-text):
(.image-overlay-text::selection):
Adjust UA stylesheet to account for the changes in `updateWithImageExtractionResult`.
(div.image-overlay-text): Deleted.
(div.image-overlay-text::selection): Deleted.
* platform/ImageExtractionResult.h:
(WebCore::ImageExtractionTextData::ImageExtractionTextData):
(WebCore::ImageExtractionLineData::ImageExtractionLineData):
(WebCore::ImageExtractionLineData::encode const):
(WebCore::ImageExtractionLineData::decode):
Refactor this data structure, by splitting it into `ImageExtractionLineData` and `ImageExtractionTextData`.
(WebCore::ImageExtractionResult::isEmpty const):
(WebCore::ImageExtractionResult::encode const):
(WebCore::ImageExtractionResult::decode):
* platform/graphics/FloatPoint.h:
(WebCore::FloatPoint::rotate):
Add a helper method to rotate a 2D `FloatPoint` by a given angle, about a given point.
* platform/graphics/GeometryUtilities.cpp:
(WebCore::rotatedBoundingRectWithMinimumAngleOfRotation):
(WebCore::rotatedBoundingRect): Deleted.
* platform/graphics/GeometryUtilities.h:
* testing/Internals.cpp:
(WebCore::getQuad):
(WebCore::makeDataForLine):
(WebCore::Internals::installImageOverlay):
* testing/Internals.h:
* testing/Internals.idl:
Adjust this internal testing hook to accept a list of `ImageOverlayLine` dictionaries, each of which contains a
list of `ImageOverlayText` dictionaries.
2021-04-26 Alex Christensen <achristensen@webkit.org>
Consistently include headers with <Framework/Header.h>
https://bugs.webkit.org/show_bug.cgi?id=225067
Reviewed by Alexey Proskuryakov.
When building with CMake, if a header is included as <Framework/Header.h> in some files
and "Header.h" in others, when compiling a cpp file in the same directory as Header.h,
there doesn't seem to be a way to tell it to include from the Framework directory before
searching the same directory as the cpp file. To solve this, we use consistent include style
for each header.
* editing/cocoa/DictionaryLookup.mm:
* platform/graphics/avfoundation/objc/AVOutputDeviceMenuControllerTargetPicker.mm:
* platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.mm:
* platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
* platform/graphics/cocoa/IOSurface.mm:
* platform/mac/PlatformScreenMac.mm:
* testing/Internals.cpp:
2021-04-26 Alex Christensen <achristensen@webkit.org>
Update Mac-specific CMake files
https://bugs.webkit.org/show_bug.cgi?id=225064
Rubber-stamped by Tim Horton.
* PlatformMac.cmake:
2021-04-26 Said Abou-Hallawa <said@apple.com>
Remove redundant frameDetached() from the SVGImage destructor
https://bugs.webkit.org/show_bug.cgi?id=221616
<rdar://problem/74149106>
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-26 Fujii Hironori <Hironori.Fujii@sony.com>
REGRESSION(r272379) [Win] Some emojis are painted with a blank square on the right side of it
https://bugs.webkit.org/show_bug.cgi?id=225047
Reviewed by Don Olmstead.
imported/w3c/web-platform-tests/mathml/relations/css-styling tests cover this change.
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advanceInternal): Don't add the 0 glyphs for Windows too.
2021-04-26 Alexey Shvayka <shvaikalesh@gmail.com>
[WebIDL] Remove [CallNamedSetterOnlyForSupportedProperties] extended attribute
https://bugs.webkit.org/show_bug.cgi?id=225049
Reviewed by Sam Weinig.
It was part of the old CSSStyleDeclaration named getter implementation,
which was removed in r275808.
No new tests, no behavior change.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateInvokeNamedPropertySetter):
(GeneratePut):
(GeneratePutByIndex):
(GenerateDefineOwnProperty):
* bindings/scripts/IDLAttributes.json:
2021-04-26 Alexey Shvayka <shvaikalesh@gmail.com>
[JSC] OrdinarySet should invoke custom [[Set]] methods
https://bugs.webkit.org/show_bug.cgi?id=217916
Reviewed by Yusuke Suzuki.
Fixes:
1. Legacy platform object's [[Set]] now guards against altered receiver [1].
(aligns with Blink).
2. Direct [[Set]] to window.%Interface% constructor now preserves DontEnum attribute [2].
(aligns with Blink and Gecko).
3. Cross-origin non-index put() now throws SecurityError instead of silently failing [3].
(aligns with Blink and Gecko).
Refactors:
1. Simplifies cross-origin JSDOMWindow::put(), aligning it with JSLocation::put().
2. Replaces lookupPut() with direct setter call in JSRemoteDOMWindow::put().
3. Removes now unused doPutPropertySecurityCheck() methods.
Tests: js/dom/script-tests/reflect-set-onto-dom.js
imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/interface-object-set-receiver.html
http/tests/security/cross-frame-access-object-getPrototypeOf-in-put.html
[1] https://heycam.github.io/webidl/#legacy-platform-object-set (step 1)
[2] https://heycam.github.io/webidl/#define-the-global-property-references (step 3.1.3)
[3] https://html.spec.whatwg.org/multipage/browsers.html#crossoriginset-(-o,-p,-v,-receiver-) (step 4)
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::put):
(WebCore::JSDOMWindow::doPutPropertySecurityCheck): Deleted.
* bindings/js/JSLocationCustom.cpp:
(WebCore::JSLocation::doPutPropertySecurityCheck): Deleted.
* bindings/js/JSRemoteDOMWindowCustom.cpp:
(WebCore::JSRemoteDOMWindow::put):
* bindings/scripts/CodeGeneratorJS.pm:
(GeneratePut):
(GenerateHeader):
* bindings/scripts/test/JS/*: Updated.
* bridge/objc/objc_runtime.h:
* bridge/runtime_array.h:
* bridge/runtime_object.h:
2021-04-26 Don Olmstead <don.olmstead@sony.com>
ANGLE X11 build fixes
https://bugs.webkit.org/show_bug.cgi?id=225003
Reviewed by Kenneth Russell.
X11 headers define a bunch of macros with common terms, interfering with WebCore and WTF
enum values. As a workaround, we explicitly undef them.
This is the same fix as the one to GLContext.h in r274869 but applied to the ANGLE headers
that are including X11.
* platform/graphics/angle/ANGLEHeaders.h:
2021-04-26 Antti Koivisto <antti@apple.com>
Refcount Style::Resolver
https://bugs.webkit.org/show_bug.cgi?id=225048
Reviewed by Ryosuke Niwa.
For safety, and to allow more sharing in the future.
* css/DOMCSSRegisterCustomProperty.cpp:
(WebCore::DOMCSSRegisterCustomProperty::registerProperty):
* dom/Document.cpp:
(WebCore::Document::userAgentShadowTreeStyleResolver):
* dom/Document.h:
* style/StyleResolver.cpp:
Also make the Resolver ISO-allocated.
(WebCore::Style::Resolver::create):
* style/StyleResolver.h:
* style/StyleScope.cpp:
(WebCore::Style::Scope::resolver):
* style/StyleScope.h:
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::Scope::Scope):
(WebCore::Style::TreeResolver::Scope::~Scope):
(WebCore::Style::TreeResolver::styleForStyleable):
(WebCore::Style::TreeResolver::resolveElement):
(WebCore::Style::TreeResolver::resolvePseudoStyle):
(WebCore::Style::TreeResolver::resolve):
* style/StyleTreeResolver.h:
2021-04-26 Enrique Ocaña González <eocanha@igalia.com>
[GStreamer] media/track/in-band/ layout tests introduced in r154908 are failing
https://bugs.webkit.org/show_bug.cgi?id=120665
Reviewed by Philippe Normand.
Solved a deadlock when processing samples from a text track while the main thread is starting to play.
In those circumstances, the text sink is set by Playbin as non-async, so the main thread calling
MediaPlayerPrivateGStreamer::play() is blocked waiting for the preroll to finish. While prerolling,
a text sample is detected in a non-main thread and sent to the main thread for processing. The current
code waits in the non-main thread for the processing to finish, but that won't ever happen because
the main thread is busy in play() waiting for the preroll to complete. Since the non-main thread
doesn't need any result from the main thread, a simple change to avoid the wait is enough to solve the
deadlock.
There was also a bug preventing all the languages of the text tracks being detected on time. Sometimes
the tag event specifying the track language emitted by the demuxer arrives too late to the
webkittextcombiner sink pad (up to several seconds since sent!) and the language remains unset when
the test checks for it. As a result, the test fails because the second track isn't reported to be in
French language ("fr"). The solution to this is to find an earlier (more upstream) pad and listen
there for the (sticky) tag events. There can be multiple tag events, so all of them are checked until
one having the GST_TAG_LANGUAGE_CODE tag is found.
Covered by existing tests (now unskipped).
* platform/graphics/gstreamer/TextSinkGStreamer.cpp:
(webkitTextSinkHandleSample): Don't wait for handleTextSample() to be completed in the main thread. This avoids the deadlock.
* platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
(WebCore::findBestUpstreamPad): Find a pad more upstream than the current one.
(WebCore::TrackPrivateBaseGStreamer::TrackPrivateBaseGStreamer): Call setPad() instead of setting it by hand here.
(WebCore::TrackPrivateBaseGStreamer::setPad): Also manage m_bestUpstreamPad in parallel to m_pad. Add a probe to listen to the tag events instead of checking the "tags" property (the property wasn't present in the best upstream pad).
(WebCore::TrackPrivateBaseGStreamer::disconnect): Remove the probe from m_bestUpstreamPad, instead of removing the old notify::tags listener from m_pad.
(WebCore::TrackPrivateBaseGStreamer::tagsChanged): Check the sticky tag events until the language one is found (or the last event if no language event is available).
* platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h: Added m_bestUpstreamPad and m_eventProbe. Moved setPad() implementation to the cpp file.
2021-04-26 Ryosuke Niwa <rniwa@webkit.org>
Implement ShadowRoot.prototype.delegatesFocus attribute
https://bugs.webkit.org/show_bug.cgi?id=224805
Reviewed by Antti Koivisto.
Added the IDL attribute. Chrome had supported this IDL attribute for ages.
Test: imported/w3c/web-platform-tests/shadow-dom/focus/ShadowRoot-delegatesFocus.html
* dom/ShadowRoot.idl:
2021-04-26 Carlos Garcia Campos <cgarcia@igalia.com>
embed element with the src attribute set prevents WebKitTestRunner from exiting
https://bugs.webkit.org/show_bug.cgi?id=223791
Reviewed by Ryosuke Niwa.
The problem is that the load never finishes, so WTR keeps waiting for the final message from injected bundle
that happens when the page is loaded. When the src attribute is changed,
HTMLPlugInImageElement::updateImageLoaderWithNewURLSoon() is called. That calls
HTMLPlugInImageElement::scheduleUpdateForAfterStyleResolution() that increases the document load event delay
count and queues a style post resolution callback. The document load event delay count is decreased in
HTMLPlugInImageElement::updateAfterStyleResolution(), called by the style post resolution callback. But the
callback is never called because the embed element is not in tree, and it's never added, keeping the document
load event delay unbalanced. We should not call scheduleUpdateForAfterStyleResolution() when the element
is not in render tree, since we know Node::invalidateStyle() will return early and style post resolution
callbacks will not be called. If the element is added to the tree eventually,
scheduleUpdateForAfterStyleResolution() will be called by didRecalcStyle, so the image will be loaded.
Test: fast/images/embed-image-onload-src-change.html
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::updateImageLoaderWithNewURLSoon):
2021-04-25 ChangSeok Oh <changseok@webkit.org>
Fix a crash caused by AVIF decoding failure
https://bugs.webkit.org/show_bug.cgi?id=223843
<rdar://problem/76205084>
Reviewed by Philippe Normand.
A crash happens when the image count is accessed in AVIFImageDecoder::tryDecodeSize.
This is because an instance of AVIFImageReader is destroyed by setFailed()
in AVIFImageReader::parseHeader. Deciding a failure was hasty because
parsing can fail when necessary data is not received yet. To fix this,
we call setFailed in AVIFImageReader::parseHeader only when all data is received.
Test: http/tests/images/avif-partial-load-crash.html
* platform/image-decoders/avif/AVIFImageDecoder.cpp:
(WebCore::AVIFImageDecoder::tryDecodeSize):
* platform/image-decoders/avif/AVIFImageReader.cpp:
(WebCore::AVIFImageReader::parseHeader):
(WebCore::AVIFImageReader::repetitionCount const):
* platform/image-decoders/avif/AVIFImageReader.h:
2021-04-25 Darin Adler <darin@apple.com>
Fix handling of overflow of /= and *= operators with double over Checked<uint64_t> and other 64-bit types.
https://bugs.webkit.org/show_bug.cgi?id=224835
Reviewed by Chris Dumez.
* platform/graphics/gpu/cocoa/GPUBindGroupAllocatorMetal.mm:
(WebCore::GPUBindGroupAllocator::reallocate): Use integer math instead of floating point math to increase
the size by 25% each time through the loop, staying within the capabilities of our checked integer class.
2021-04-25 Cameron McCormack <heycam@apple.com>
Remove templated operator<<(TextStream&, T*) that interferes with raw pointer formatting.
https://bugs.webkit.org/show_bug.cgi?id=224962
Reviewed by Darin Adler.
We can end up calling into this one (which unhelpfully casts its
argument to intptr_t) instead of the `const void*` one in
TextStream.h.
Removing this means we can drop static_cast<const void*>(...) in
various places in debugging output code.
* rendering/RenderLayer.cpp:
(WebCore::outputPaintOrderTreeRecursive):
* rendering/RenderTreeAsText.cpp:
(WebCore::RenderTreeAsText::writeRenderObject):
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeStandardPrefix):
* rendering/svg/SVGRenderTreeAsText.h:
2021-04-25 Ryosuke Niwa <rniwa@webkit.org>
Make more IndexedDB objects iso-heap'ed
https://bugs.webkit.org/show_bug.cgi?id=225029
Reviewed by Darin Adler.
Deployed IsoHeap on more IndexedDB objects.
* Modules/indexeddb/IDBFactory.cpp:
* Modules/indexeddb/IDBFactory.h:
* Modules/indexeddb/IDBGetAllResult.cpp:
* Modules/indexeddb/IDBGetAllResult.h:
* Modules/indexeddb/IDBGetResult.cpp:
* Modules/indexeddb/IDBGetResult.h:
* Modules/indexeddb/IDBIndex.cpp:
* Modules/indexeddb/IDBIndex.h:
* Modules/indexeddb/IDBKey.cpp:
* Modules/indexeddb/IDBKey.h:
* Modules/indexeddb/IDBObjectStore.cpp:
* Modules/indexeddb/IDBObjectStore.h:
* Modules/indexeddb/IDBRecordIdentifier.h: Removed since it's not used anywhere.
* Modules/indexeddb/IDBRequest.cpp:
* Modules/indexeddb/IDBRequest.h:
* Modules/indexeddb/client/IDBConnectionProxy.cpp:
* Modules/indexeddb/client/IDBConnectionProxy.h:
* Modules/indexeddb/client/IDBConnectionToServer.cpp:
* Modules/indexeddb/client/IDBConnectionToServer.h:
* Modules/indexeddb/client/TransactionOperation.cpp:
* Modules/indexeddb/client/TransactionOperation.h:
* Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
* Modules/indexeddb/shared/IDBDatabaseInfo.h:
* WebCore.xcodeproj/project.pbxproj:
2021-04-25 Devin Rousso <drousso@apple.com>
Add `ALWAYS_LOG_WITH_STREAM` macro for easier development/debugging
https://bugs.webkit.org/show_bug.cgi?id=224959
Reviewed by Darin Adler.
It's often very helpful to use existing `operator<<` defined on objects, but annoying to
have to copypaste the boilerplate code that creates a `WTF::TextStream` and uses it in a
`WTFLogAlways` or wait for a debug build to enable existing `LOG_WITH_STREAM`.
* platform/Logging.h:
Move contents of `pal/LogMacros.h` to `wtf/Assertions.h`.
2021-04-25 Felipe Erias <felipeerias@igalia.com>
[css-flexbox] Table layout disregards overriding width
https://bugs.webkit.org/show_bug.cgi?id=224934
Reviewed by Darin Adler.
If a table's parent has set an overriding width on it, that value will get preference over the one from
the table's "width" property. This fixes several tests where the width assigned by the flexbox algorithm
did not match the width of the table after layout.
* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::applyPreferredLogicalWidthQuirks const): Give precedence to the element's
overriding width if it has been set.
* rendering/RenderTable.cpp:
(WebCore::RenderTable::updateLogicalWidth): Give precedence to the element's overriding width if it
has been set, instead of discarding it if it is smaller than the style width.
(WebCore::RenderTable::computePreferredLogicalWidths): Take the overriding width into account when
computing the preferred min/max values for the element.
2021-04-25 Tyler Wilcock <twilco.o@protonmail.com>
css-contain category missing from CSSProperties.json
https://bugs.webkit.org/show_bug.cgi?id=224990
Reviewed by Darin Adler.
* css/CSSProperties.json:
Add missing css-contain category to avoid style lint errors. Example
error:
ERROR: Source/WebCore/css/CSSProperties.json:0: property "contain" has category "css-contain" which is not in the set of categories. [json/syntax] [5]
2021-04-24 Ryosuke Niwa <rniwa@webkit.org>
Deploy Ref/RefPtr in DeleteSelectionCommand
https://bugs.webkit.org/show_bug.cgi?id=225028
Reviewed by Wenson Hsieh.
Deployed smart pointers in DeleteSelectionCommand.
Also deployed ScriptDisallowedScope around the code which accesses the render tree.
No new tests since there should be no observable behavioral differences.
* editing/DeleteSelectionCommand.cpp:
(WebCore::isTableRowEmpty):
(WebCore::isSpecialHTMLElement): Moved from Editing.cpp.
(WebCore::firstInSpecialElement): Ditto.
(WebCore::lastInSpecialElement): Ditto.
(WebCore::positionBeforeContainingSpecialElement): Ditto. Now returns a pair instead of returning
Position and "returning" the special element via an out argument.
(WebCore::positionAfterContainingSpecialElement): Ditto.
(WebCore::DeleteSelectionCommand::initializeStartEnd):
(WebCore::DeleteSelectionCommand::initializePositionData):
(WebCore::DeleteSelectionCommand::handleSpecialCaseBRDelete):
(WebCore::firstEditablePositionInNode):
(WebCore::DeleteSelectionCommand::insertBlockPlaceholderForTableCellIfNeeded):
(WebCore::DeleteSelectionCommand::removeNode):
(WebCore::DeleteSelectionCommand::handleGeneralDelete):
(WebCore::DeleteSelectionCommand::mergeParagraphs):
(WebCore::DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows):
(WebCore::DeleteSelectionCommand::originalStringForAutocorrectionAtBeginningOfSelection):
(WebCore::DeleteSelectionCommand::doApply):
* editing/Editing.cpp:
(WebCore::isRenderedTable): Return false when the node is not a HTMLElement for consistency.
(WebCore::isSpecialHTMLElement): Moved to DeleteSelectionCommand.cpp.
(WebCore::firstInSpecialElement): Ditto.
(WebCore::lastInSpecialElement): Ditto.
(WebCore::positionBeforeContainingSpecialElement): Ditto.
(WebCore::positionAfterContainingSpecialElement): Ditto.
* editing/Editing.h:
2021-04-24 Tim Horton <timothy_horton@apple.com>
Changing the source of a model element with clipping applied does not update the model
https://bugs.webkit.org/show_bug.cgi?id=224917
Reviewed by Simon Fraser.
Tests: model-element/model-element-contents-layer-updates-with-clipping.html
model-element/model-element-contents-layer-updates.html
Previously, a <model> with a contents clipping layer (e.g. border-radius)
would not reparent its contents layer in the right place when setContentsToModel
was called again (because the source changed), leaving the old model
contents layer in place.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateSublayerList):
Ensure that updateSublayerList always parents contentsLayer in one of its two homes:
under contentsClippingLayer, if it exists; otherwise, directly under the primary layer.
(WebCore::GraphicsLayerCA::setContentsToModel):
Drive-by fix a bug revealed by the tests for this patch: when swapping out the
contents layer in setContentsToModel, we also need to mark ContentsRectsChanged,
or the new contents layer will not get its bounds set during the subsequent flush.
(WebCore::GraphicsLayerCA::setContentsToPlatformLayer):
Remove special-case code that was added to fix this bug just for setContentsToPlatformLayer;
this case is now correctly handled for all contents layers by updateSublayerList.
(WebCore::GraphicsLayerCA::dumpInnerLayer const):
* platform/graphics/GraphicsLayerClient.h:
* platform/graphics/ca/PlatformCALayer.cpp:
(WebCore::PlatformCALayer::dumpAdditionalProperties):
* platform/graphics/ca/PlatformCALayer.h:
* testing/Internals.cpp:
(WebCore::toPlatformLayerTreeFlags):
* testing/Internals.h:
* testing/Internals.idl:
Add a bit to platformLayerTreeAsText() that makes PlatformCALayerRemoteModelHosting
dump the size of the model that it is hosting, which is used in the test for this bug.
Remove the IncludeOpacity bit since we can just always log opacity if it's not the default.
2021-04-24 Julian Gonzalez <julian_a_gonzalez@apple.com>
Crash in BreakBlockquoteCommand::doApply()
https://bugs.webkit.org/show_bug.cgi?id=224941
Reviewed by Ryosuke Niwa.
Despite assertions to the contrary, it is possible for there not to be any node
to move into the new blockquote in BreakBlockquoteCommand::doApply() as a result
of layout updates, so remove the assertions and handle this case.
Test: editing/pasteboard/paste-as-quotation-then-paste-crash.html
* editing/BreakBlockquoteCommand.cpp:
(WebCore::BreakBlockquoteCommand::doApply):
2021-04-24 Antoine Quint <graouts@webkit.org>
Improve parsing and computed style of the rotate CSS property
https://bugs.webkit.org/show_bug.cgi?id=225019
Reviewed by Dean Jackson.
There were a few issues with how we parsed the rotate CSS property and how we dealt with it
when resolving the computed style.
When parsing, we required individual vector coordinates to be 1 when others were 0 for a vector
to be considered parallel with the x, y or z axis. We now support any positive value. Then, as
we create the TransformOperation from the CSSValue, we must set the type to ROTATE_3D instead
of ROTATE_Z if the z axis was specified through the CSS value. Indeed, ROTATE_Z is equivalent
to ROTATE and without setting this type to ROTATE_3D, TransformOperation::is3DOperation() would
return false.
This is important because when figuring out the computed style, we should only return an angle
without a rotation vector if TransformOperation::is3DOperation() is false. For the case where
the operation was specified in 3D, we now use the same rule used when parsing to determine
whether the rotation vector is parallel with the x, y or z axis to use the matching keywords.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::computedRotate):
* css/TransformFunctions.cpp:
(WebCore::rotateForValue):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeRotate):
2021-04-24 Antoine Quint <graouts@webkit.org>
Support interpolation of the background-repeat shorthand
https://bugs.webkit.org/show_bug.cgi?id=225016
Reviewed by Dean Jackson.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
2021-04-24 Antoine Quint <graouts@webkit.org>
Fix interpolation of the clip CSS property
https://bugs.webkit.org/show_bug.cgi?id=225017
Reviewed by Dean Jackson.
While we interpolated the clip value correctly, we wouldn't set the RenderStyle bit that
indicates that there is a non-auto value in the first place. With a new dedicated wrapper,
we can ensure we set the bit correctly as we blend, and that we use discrete interpolation
if both the from and to values aren't auto.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
2021-04-24 Antoine Quint <graouts@webkit.org>
Computed style for the translate CSS property should use px for the z value
https://bugs.webkit.org/show_bug.cgi?id=225018
Reviewed by Dean Jackson.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::computedTranslate):
2021-04-24 Tyler Wilcock <twilco.o@protonmail.com>
Refactor ValueRange from enum to enum class
https://bugs.webkit.org/show_bug.cgi?id=224981
Reviewed by Sam Weinig.
Refactor ValueRange from:
enum ValueRange {
ValueRangeAll,
ValueRangeNonNegative
}
to:
enum ValueRange : uint8_t {
All,
NonNegative
}
making it smaller (one byte versus four) and harder to misuse (no
auto-coercion to number types).
* animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
Refactor ValueRangeAll and ValueRangeNonNegative to ValueRange::All
and ValueRange::NonNegative.
* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcValue::create):
Refactor ValueRangeAll and ValueRangeNonNegative to ValueRange::All
and ValueRange::NonNegative.
* css/CSSCalculationValue.h:
(WebCore::CSSCalcValue::createCalculationValue const):
(WebCore::CSSCalcValue::setPermittedValueRange):
Refactor ValueRangeAll and ValueRangeNonNegative to ValueRange::All
and ValueRange::NonNegative.
* css/MediaQueryExpression.cpp:
(WebCore::consumeFirstValue):
Refactor ValueRangeAll and ValueRangeNonNegative to ValueRange::All
and ValueRange::NonNegative.
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeTransformOrigin):
(WebCore::consumeLetterSpacing):
(WebCore::consumeWordSpacing):
(WebCore::consumeTabSize):
(WebCore::consumeTextSizeAdjust):
(WebCore::consumeFontSize):
(WebCore::consumeLineHeight):
(WebCore::consumeSize):
(WebCore::consumeTextIndent):
(WebCore::consumeScrollPadding):
(WebCore::consumeMaxWidthOrHeight):
(WebCore::consumeWidthOrHeight):
(WebCore::consumeMarginOrOffset):
(WebCore::consumeClipComponent):
(WebCore::consumeLineClamp):
(WebCore::consumeHyphenateLimit):
(WebCore::consumeColumnWidth):
(WebCore::consumeGapLength):
(WebCore::consumeZoom):
(WebCore::consumeAnimationIterationCount):
(WebCore::consumeAnimationValue):
(WebCore::consumeLineWidth):
(WebCore::consumeTranslate3d):
(WebCore::consumeNumbers):
(WebCore::consumePerspective):
(WebCore::consumeTransformValue):
(WebCore::consumeTranslate):
(WebCore::consumeScale):
(WebCore::consumeRotate):
(WebCore::consumePositionLonghand):
(WebCore::consumeFlexBasis):
(WebCore::consumeKerning):
(WebCore::consumeStrokeDasharray):
(WebCore::consumeBaselineShift):
(WebCore::consumeRxOrRy):
(WebCore::consumeBorderRadiusCorner):
(WebCore::consumeTextUnderlineOffset):
(WebCore::consumeTextDecorationThickness):
(WebCore::consumeVerticalAlign):
(WebCore::consumeShapeRadius):
(WebCore::consumeBasicShapePolygon):
(WebCore::consumeRadii):
(WebCore::consumeBasicShapeInset):
(WebCore::consumeBorderImageSlice):
(WebCore::consumeBorderImageOutset):
(WebCore::consumeBorderImageWidth):
(WebCore::consumeReflect):
(WebCore::consumeBackgroundSize):
(WebCore::consumeFitContent):
(WebCore::consumeGridBreadth):
(WebCore::consumeInitialLetter):
(WebCore::consumeWebkitMarqueeIncrement):
(WebCore::consumeWebkitMarqueeRepetition):
(WebCore::consumeWebkitMarqueeSpeed):
(WebCore::consumeAspectRatio):
(WebCore::CSSPropertyParser::parseSingleValue):
(WebCore::CSSPropertyParser::consumeBorderSpacing):
(WebCore::CSSPropertyParser::consumeFlex):
Refactor ValueRangeAll and ValueRangeNonNegative to ValueRange::All
and ValueRange::NonNegative.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeNumberOrPercentDividedBy100Raw):
(WebCore::CSSPropertyParserHelpers::CalcParser::CalcParser):
(WebCore::CSSPropertyParserHelpers::consumeNumberRaw):
(WebCore::CSSPropertyParserHelpers::consumeFontWeightNumberRaw):
(WebCore::CSSPropertyParserHelpers::consumeLengthRaw):
(WebCore::CSSPropertyParserHelpers::consumePercentRaw):
(WebCore::CSSPropertyParserHelpers::consumeAngleRaw):
(WebCore::CSSPropertyParserHelpers::consumeAngleWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumeTime):
(WebCore::CSSPropertyParserHelpers::consumePositionComponent):
(WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientPoint):
(WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradient):
(WebCore::CSSPropertyParserHelpers::consumeGradientColorStops):
(WebCore::CSSPropertyParserHelpers::consumeDeprecatedRadialGradient):
(WebCore::CSSPropertyParserHelpers::consumeRadialGradient):
(WebCore::CSSPropertyParserHelpers::consumeFilterFunction):
(WebCore::CSSPropertyParserHelpers::consumeSingleShadow):
(WebCore::CSSPropertyParserHelpers::consumeFontSizeRaw):
(WebCore::CSSPropertyParserHelpers::consumeLineHeightRaw):
Refactor ValueRangeAll and ValueRangeNonNegative to ValueRange::All
and ValueRange::NonNegative.
* css/parser/CSSPropertyParserHelpers.h:
Refactor ValueRangeAll and ValueRangeNonNegative to ValueRange::All
and ValueRange::NonNegative.
* css/parser/CSSPropertyParserWorkerSafe.cpp:
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStretch):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStretchRange):
Refactor ValueRangeAll and ValueRangeNonNegative to ValueRange::All
and ValueRange::NonNegative.
* page/IntersectionObserver.cpp:
(WebCore::parseRootMargin):
Refactor ValueRangeAll and ValueRangeNonNegative to ValueRange::All
and ValueRange::NonNegative.
* platform/CalculationValue.h:
(WebCore::CalculationValue::CalculationValue):
Refactor ValueRangeAll and ValueRangeNonNegative to ValueRange::All
and ValueRange::NonNegative.
* platform/Length.cpp:
(WebCore::convertTo100PercentMinusLength):
(WebCore::blendMixedTypes):
(WebCore::blend):
Refactor ValueRangeAll and ValueRangeNonNegative to ValueRange::All
and ValueRange::NonNegative.
* platform/Length.h:
Refactor enum ValueRange to enum class ValueRange.
* style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertTo100PercentMinusLength):
Refactor ValueRangeAll and ValueRangeNonNegative to ValueRange::All
and ValueRange::NonNegative.
2021-04-24 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] Subtree moving should clear the floats on all the descendants
https://bugs.webkit.org/show_bug.cgi?id=224996
<rdar://76837320>
Reviewed by Antti Koivisto.
While moving a subtree, we invalidate the floating object list so that we don't end up with incorrectly placed floats (they'll get regenerated during the subsequent layout).
A float can be "assigned" to more than one RenderBlockFlow (e.g intruding floats). It's very common that a set of descendant RenderBlockFlow
renderers "see" the same set of floats (each RenderBlockFlow has its own list of floating objects).
Now the invalidation is based on ancestor-to-descendant direction starting with finding the outer most containing block for a particular float (see outermostBlockContainingFloatingObject)
The invalidation logic also expects no gaps in the ancestor chain e.g.
RenderBlockFlow (A) -> float X
RenderBlockFlow (B) -> float X
RenderBlockFlow (C) -> float X
if float X is assigned to both A and C, then it must be assigned to B as well.
RenderBlockFlow::removeFloatingObjects() simply removes the float from the renderer. It does not invalidate the ancestor/descendant chain.
e.g. calling B.removeFloatingObjects() would just remove float X from RenderBlockFlow (B)
RenderBlockFlow (A) -> float X
RenderBlockFlow (B)
RenderBlockFlow (C) -> float X
and any subsequent invalidation attempt would fail to clear up A or C (depending on whether it is initiated on A or C).
Test: fast/multicol/floating-boxes-moved-under-multi-column.html
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::moveChildren):
2021-04-24 Zalan Bujtas <zalan@apple.com>
[LFC] Ignore content height and width when 'contain: size' is present
https://bugs.webkit.org/show_bug.cgi?id=225013
Reviewed by Antti Koivisto.
Enable size containment for "shrink to fit width" and for "height: auto" formatting context roots.
https://www.w3.org/TR/css-contain-2/#size-containment.
* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const):
(WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
2021-04-24 Rob Buis <rbuis@igalia.com>
Move selectedOptions cache invalidation timing
https://bugs.webkit.org/show_bug.cgi?id=224894
Reviewed by Ryosuke Niwa.
Move selectedOptions cache invalidation timing out
of setSelectedState, having it in setSelectedState
can cause selectedOptions cache invalidation while
determining the cache.
Test: fast/dom/HTMLSelectElement/selected-options-item-crash.html
* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::setSelectedState):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::updateListBoxSelection):
(WebCore::HTMLSelectElement::selectOption):
(WebCore::HTMLSelectElement::deselectItemsWithoutValidation):
(WebCore::HTMLSelectElement::restoreFormControlState):
(WebCore::HTMLSelectElement::reset):
(WebCore::HTMLSelectElement::updateSelectedState):
2021-04-23 Ian Gilbert <iang@apple.com>
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-23 Ryosuke Niwa <rniwa@webkit.org>
Crash in constructCustomElementSynchronously
https://bugs.webkit.org/show_bug.cgi?id=224992
<rdar://66988026>
Reviewed by Tadeu Zagallo.
Exit early when the global object is nullptr although this shouldn't happen.
No new tests since we have no reproductions.
* bindings/js/JSCustomElementInterface.cpp:
(WebCore::JSCustomElementInterface::tryToConstructCustomElement): Added a null check.
2021-04-23 Don Olmstead <don.olmstead@sony.com>
Add additional guards around USE_ANGLE
https://bugs.webkit.org/show_bug.cgi?id=225001
Reviewed by Fujii Hironori.
When USE(ANGLE) initializeOpenGLShims isn't used or available.
When USE(ANGLE) the ANGLE shader compiler isn't needed.
* platform/graphics/GLContext.cpp:
(WebCore::initializeOpenGLShimsIfNeeded):
* platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp:
2021-04-23 Cathie Chen <cathiechen@igalia.com>
Not computing image aspect ratios from width and height attributes for lazy loaded images
https://bugs.webkit.org/show_bug.cgi?id=224197
Reviewed by Darin Adler.
This patch supports error images and lazy loaded images (without src attribute) to compute
implicit aspect ratios from width and height attributes. Refactor the code a bit. Added
intrinsicAspectRatioFromWidthHeight() to compute aspect ratio from width and height attributes when
the object is allowed to which is decided by canMapWidthHeightToAspectRatio().
Remove `!downcast<RenderImage>(*this).cachedImage()` constraint, so that images without src attributes
is allowed. As to error images, compute the aspect ratio when the image shouldDisplayBrokenImageIcon().
* rendering/RenderImage.cpp:
(WebCore::RenderImage::canMapWidthHeightToAspectRatio const): To indicate that the object is allowed
to compute aspect ratio from width and height attributes.
(WebCore::RenderImage::computeIntrinsicRatioInformation const): When shouldDisplayBrokenImageIcon(),
try to compute the aspect ratio from attributes width and height.
* rendering/RenderImage.h:
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::intrinsicAspectRatioFromWidthHeight const): Compute the aspect ratio from attributes width and height.
(WebCore::RenderReplaced::computeIntrinsicRatioInformation const):
* rendering/RenderReplaced.h:
(WebCore::RenderReplaced::canMapWidthHeightToAspectRatio const): Ditto.
2021-04-23 Michael Catanzaro <mcatanzaro@igalia.com>
Remove virtual function calls in GraphicsLayer destructors
https://bugs.webkit.org/show_bug.cgi?id=180232
Reviewed by Adrian Perez de Castro.
I notice that ~CoordinatedGraphicsLayer makes a virtual function call to
GraphicsLayer::willBeDestroyed, which makes a virtual function call to
CoordinatedGraphicsLayer::removeFromParent. I think that the functions are being called as
intended, because ~CoordinatedGraphicsLayer has not yet been fully destroyed. However, I'm
reminded of Effective C++ item #9: Never call virtual functions during construction or
destruction ("because such calls will never go to a more derived class than that of the
currently executing constructor or destructor"). This code is almost certain to break if
anyone tries in the future to subclass any of the existing subclasses of GraphicsLayer, so
let's refactor it a bit. This doesn't fix anything, but my hope is that it will make the
code a bit harder to break, and not the opposite.
The main risk here is that some reordering of operations is necessary. The derived class
portion of removeFromParent must now be executed before willBeDestroyed. It can't happen
after, because parent would already be unset by that point. It's hard to be certain that
this won't break anything, but I think it should be fine.
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::willBeDestroyed):
(WebCore::GraphicsLayer::removeFromParentInternal):
(WebCore::GraphicsLayer::removeFromParent):
* platform/graphics/GraphicsLayer.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::~GraphicsLayerCA):
(WebCore::GraphicsLayerCA::willBeDestroyed): Deleted.
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer):
2021-04-23 Darin Adler <darin@apple.com>
Remove decoder memory allocations based on untrusted data (sizes) in the stream; related changes
https://bugs.webkit.org/show_bug.cgi?id=224984
Reviewed by Sam Weinig.
* platform/network/cf/CertificateInfoCFNet.cpp:
(WTF::Persistence::decodeCFData): Removed unneeded check for zero size. Removed code that
locally allocates a vector before bufferIsLargeEnoughToContain is called. Instead use
bufferPointerForDirectRead, which makes does the buffer size check, and pass the pointer
directly to CFDataCreate.
2021-04-23 Chris Dumez <cdumez@apple.com>
Improve our constructDeletedValue() template specializations
https://bugs.webkit.org/show_bug.cgi?id=224889
Reviewed by Darin Adler.
Improve our constructDeletedValue() template specializations and make them more consistent:
- Use placement-new instead of object assignment since we don't want/need to destroy the
existing object (since it is uninitialized).
- Do as little initialization as possible for performance reasons.
* Modules/indexeddb/IDBKeyData.cpp:
(WebCore::IDBKeyData::deletedValue): Deleted.
* Modules/indexeddb/IDBKeyData.h:
(WebCore::IDBKeyDataHashTraits::constructDeletedValue):
(WebCore::IDBKeyDataHashTraits::isDeletedValue):
(WebCore::IDBKeyData::isDeletedValue const): Deleted.
* Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
(WebCore::IDBResourceIdentifier::deletedValue): Deleted.
(WebCore::IDBResourceIdentifier::isHashTableDeletedValue const): Deleted.
* Modules/indexeddb/shared/IDBResourceIdentifier.h:
(WebCore::IDBResourceIdentifierHashTraits::constructDeletedValue):
(WebCore::IDBResourceIdentifierHashTraits::isDeletedValue):
* dom/MessagePortIdentifier.h:
(WTF::HashTraits<WebCore::MessagePortIdentifier>::constructDeletedValue):
(WTF::HashTraits<WebCore::MessagePortIdentifier>::isDeletedValue):
* history/BackForwardItemIdentifier.h:
(WTF::HashTraits<WebCore::BackForwardItemIdentifier>::constructDeletedValue):
(WTF::HashTraits<WebCore::BackForwardItemIdentifier>::isDeletedValue):
* layout/LayoutUnits.h:
(WTF::HashTraits<WebCore::Layout::SlotPosition>::constructDeletedValue):
(WTF::HashTraits<WebCore::Layout::SlotPosition>::isDeletedValue):
* loader/PrivateClickMeasurement.h:
(WebCore::PrivateClickMeasurement::AttributionDestinationSite::matches const):
(WTF::HashTraits<WebCore::PrivateClickMeasurement::SourceSite>::constructDeletedValue):
(WTF::HashTraits<WebCore::PrivateClickMeasurement::SourceSite>::isDeletedValue):
(WTF::HashTraits<WebCore::PrivateClickMeasurement::AttributionDestinationSite>::constructDeletedValue):
(WTF::HashTraits<WebCore::PrivateClickMeasurement::AttributionDestinationSite>::isDeletedValue):
(WebCore::PrivateClickMeasurement::SourceSite::isHashTableDeletedValue const): Deleted.
(WebCore::PrivateClickMeasurement::SourceSite::deletedValue): Deleted.
(WebCore::PrivateClickMeasurement::SourceSite::constructDeletedValue): Deleted.
(WebCore::PrivateClickMeasurement::SourceSite::deleteValue): Deleted.
(WebCore::PrivateClickMeasurement::SourceSite::isDeletedValue const): Deleted.
(WebCore::PrivateClickMeasurement::AttributionDestinationSite::isHashTableDeletedValue const): Deleted.
(WebCore::PrivateClickMeasurement::AttributionDestinationSite::deletedValue): Deleted.
(WebCore::PrivateClickMeasurement::AttributionDestinationSite::constructDeletedValue): Deleted.
(WebCore::PrivateClickMeasurement::AttributionDestinationSite::deleteValue): Deleted.
(WebCore::PrivateClickMeasurement::AttributionDestinationSite::isDeletedValue const): Deleted.
* page/ClientOrigin.h:
(WTF::HashTraits<WebCore::ClientOrigin>::constructDeletedValue):
* page/GlobalWindowIdentifier.h:
(WTF::HashTraits<WebCore::GlobalWindowIdentifier>::constructDeletedValue):
(WTF::HashTraits<WebCore::GlobalWindowIdentifier>::isDeletedValue):
* platform/Cookie.h:
(WTF::HashTraits<WebCore::Cookie>::constructDeletedValue):
(WebCore::Cookie::Cookie): Deleted.
* platform/graphics/FontCache.cpp:
(WebCore::FontPlatformDataCacheKeyHashTraits::constructDeletedValue):
* platform/graphics/FontCache.h:
(WebCore::FontCascadeCacheKeyHashTraits::constructDeletedValue):
* platform/graphics/IntPointHash.h:
(WTF::HashTraits<WebCore::IntPoint>::constructDeletedValue):
(WTF::HashTraits<WebCore::IntPoint>::isDeletedValue):
* rendering/CSSValueKey.h:
(WTF::HashTraits<WebCore::CSSValueKey>::constructDeletedValue):
* workers/service/ServiceWorkerClientIdentifier.h:
(WTF::HashTraits<WebCore::ServiceWorkerClientIdentifier>::constructDeletedValue):
(WTF::HashTraits<WebCore::ServiceWorkerClientIdentifier>::isDeletedValue):
2021-04-23 Xabier Rodriguez Calvar <calvaris@igalia.com>
[GStreamer][EME] cbcs fixes
https://bugs.webkit.org/show_bug.cgi?id=224976
Reviewed by Philippe Normand.
In cbcs you can get from qtdemux buffers without an iv_size
because it had constant_iv_size. We need to check that.
When decryption bails out because of the buffer being unencrypted,
we should TRACE so.
cbcs buffers could not include the subsample_count, we consider 0
as default.
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
(transformInPlace):
2021-04-23 Michael Catanzaro <mcatanzaro@gnome.org>
Improve HashTableDeletedValue of ServiceWorkerRegistrationKey
https://bugs.webkit.org/show_bug.cgi?id=224975
Reviewed by Chris Dumez.
We construct only the SecurityOriginData, no need to construct a full
ServiceWorkerRegistrationKey or URL. No behavior changes.
* workers/service/ServiceWorkerRegistrationKey.h:
(WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue):
(WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::isDeletedValue):
(WebCore::ServiceWorkerRegistrationKey::isHashTableDeletedValue const): Deleted.
(WebCore::ServiceWorkerRegistrationKey::ServiceWorkerRegistrationKey): Deleted.
2021-04-23 Youenn Fablet <youenn@apple.com>
Handle rotation correctly in WebRTC GPUProcess rendering pipeline
https://bugs.webkit.org/show_bug.cgi?id=224927
<rdar://76915991>
Reviewed by Eric Carlson.
Add a routine to update the affine transformn of the root layer.
Manually tested.
* platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h:
* platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:
(WebCore::LocalSampleBufferDisplayLayer::updateRootLayerAffineTransform):
2021-04-23 Philippe Normand <pnormand@igalia.com>
Unreviewed, GStreamer follow-up after r276493
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Remove spurious adoptGRef call, as
this is not transfer-full.
2021-04-23 Philippe Normand <pnormand@igalia.com>
[Media] Allow access to MediaElement id from MediaPlayerPrivate
https://bugs.webkit.org/show_bug.cgi?id=224818
Reviewed by Xabier Rodriguez-Calvar.
A new method is added in the MediaPlayer allowing to query the client media element for its
identifier. That could be useful for accurate naming of the internal player/pipeline in the
MediaPlayerPrivate. If no specific id was set on the media element then the id is empty
string and the MediaPlayerPrivate needs to handle that by forging a unique id.
This also lead me to simplify pipeline-related code in the GStreamer player. The player can
handle only one pipeline in its entire life-time so the code handling pipeline "re-loading"
was actually never hit.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):
* html/HTMLMediaElement.h:
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::elementId const):
* platform/graphics/MediaPlayer.h:
(WebCore::MediaPlayerClient::mediaPlayerElementId const):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::load):
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
(WebCore::MediaPlayerPrivateGStreamer::loadFull): Deleted.
(WebCore::MediaPlayerPrivateGStreamer::setPipeline): Deleted.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2021-04-22 Sergio Villar Senin <svillar@igalia.com>
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-23 Philippe Normand <pnormand@igalia.com>
[LibWebRTC][WPE][GTK] Enable vp9 and NO_MAIN_THREAD_WRAPPING
https://bugs.webkit.org/show_bug.cgi?id=222795
Reviewed by Xabier Rodriguez-Calvar.
Add VP9 encoding and decoding support in the WPE/GTK LibWebRTC backend. The underlying
encoding support is based on LibWebRTC's internal VP9 support. The GStreamer VPx encoders
lack simulcast and high profile support, so can't really be used anyway. The
GStreamerVP8Encoder was removed for this reason as well.
* platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
(WebCore::VP9Decoder::VP9Decoder):
(WebCore::VP9Decoder::Create):
(WebCore::GStreamerVideoDecoderFactory::CreateVideoDecoder):
(WebCore::GStreamerVideoDecoderFactory::GStreamerVideoDecoderFactory):
(WebCore::GStreamerVideoDecoderFactory::GetSupportedFormats const):
* platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.h:
* platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:
* platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
(WebCore::GStreamerVideoEncoder::makeElement):
(WebCore::GStreamerVideoEncoder::createEncoder):
(WebCore::GStreamerVideoEncoder::SetRestrictionCaps):
(WebCore::GStreamerVideoEncoderFactory::CreateVideoEncoder):
(WebCore::GStreamerVideoEncoderFactory::GStreamerVideoEncoderFactory):
(WebCore::GStreamerVideoEncoderFactory::GetSupportedFormats const):
* platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.h:
* platform/mediastream/libwebrtc/LibWebRTCProviderGStreamer.cpp:
(WebCore::LibWebRTCProviderGStreamer::createDecoderFactory):
(WebCore::LibWebRTCProviderGStreamer::createEncoderFactory):
2021-04-22 Tyler Wilcock <twilco.o@protonmail.com>
[css-counter-styles] Parse @counter-style descriptors
https://bugs.webkit.org/show_bug.cgi?id=224718
Reviewed by Darin Adler.
Implement parsing and CSSCounterStyleRule IDL interface for @counter-style descriptors.
See spec for full details on all descriptors:
https://drafts.csswg.org/css-counter-styles-3/#the-counter-style-rule
Test: webexposed/counter-style-image-symbols-not-exposed.html and WPTs
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
Return `nullptr` for new @counter-style descriptor properties.
* css/CSSCounterStyleRule.cpp:
(WebCore::toCounterStyleSystemEnum):
(WebCore::symbolsValidForSystem):
(WebCore::StyleRuleCounterStyle::newValueInvalidOrEqual const):
(WebCore::CSSCounterStyleRule::cssText const):
(WebCore::CSSCounterStyleRule::setName):
(WebCore::CSSCounterStyleRule::setterInternal):
(WebCore::CSSCounterStyleRule::setSystem):
(WebCore::CSSCounterStyleRule::setNegative):
(WebCore::CSSCounterStyleRule::setPrefix):
(WebCore::CSSCounterStyleRule::setSuffix):
(WebCore::CSSCounterStyleRule::setRange):
(WebCore::CSSCounterStyleRule::setPad):
(WebCore::CSSCounterStyleRule::setFallback):
(WebCore::CSSCounterStyleRule::setSymbols):
(WebCore::CSSCounterStyleRule::setAdditiveSymbols):
(WebCore::CSSCounterStyleRule::setSpeakAs):
Implement setters and tangential functionality required by setters.
* css/CSSCounterStyleRule.h:
Replace FIXME with actual descriptor getter and setter
implementations.
* css/CSSProperties.json:
Add @counter-style descriptor properties.
* css/CSSValueKeywords.in:
Add new values required for `system` and `speak-as`
@counter-style descriptor properties.
* css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::isPropertyRuntimeDisabled const):
Ensure new @counter-style descriptors are disabled at runtime based
on CSSParserContext state.
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeCounterStyleSystem):
(WebCore::consumeCounterStyleSymbol):
(WebCore::consumeCounterStyleNegative):
(WebCore::consumeCounterStyleRangeBound):
(WebCore::consumeCounterStyleRange):
(WebCore::consumeCounterStylePad):
(WebCore::consumeCounterStyleSymbols):
(WebCore::consumeCounterStyleAdditiveSymbols):
(WebCore::consumeCounterStyleSpeakAs):
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Parse @counter-style descriptors.
2021-04-22 Megan Gardner <megan_gardner@apple.com>
Sometimes appHighlights are not painted when created.
https://bugs.webkit.org/show_bug.cgi?id=224904
Reviewed by Antti Koivisto.
In order for highlights to be painted correctly, we need to not use the new line layout code,
so we need to opt out when we are repainting due to a highlight being added or removed.
Test: http/wpt/css/css-highlight-api/highlight-text-dynamic.html
* Modules/highlight/Highlight.cpp:
(WebCore::repaintRange):
2021-04-22 Jean-Yves Avenard <jya@apple.com>
Fix color gamut in WebRTC when using VPx software decoder.
https://bugs.webkit.org/show_bug.cgi?id=220972
<rdar://problem/73616455>
Reviewed by Youenn Fablet.
By default, and how libwebrtc is configuring its encoders and decoder, video range levels are used
(16-235). Video range was assumed to use full range instead (0-255), causing blacks to look grey and
whites to appear washed-out.
It is theoretically possible, when using VP9 that full-range level are used. While the information
related to video levels is available at the VP9 codec level; only the color space information is
being made available in libwebrtc's public image data structure, color range isn't.
For now we can assume the default is sufficient, and a follow-up change will be submitted to libwebrtc
later on.
In memory of Dr. Alex. May he rest in peace.
Test: webrtc/video-vp8-videorange.html
* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
(WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferPool):
2021-04-22 Michael Catanzaro <mcatanzaro@gnome.org>
[SOUP] Null pointer dereference in ResourceLoader::didReceiveAuthenticationChallenge
https://bugs.webkit.org/show_bug.cgi?id=224838
Reviewed by Adrian Perez de Castro.
Add a RELEASE_ASSERT_NOT_REACHED() to avoid this warning.
* platform/network/soup/AuthenticationChallenge.h:
2021-04-22 Patrick Griffis <pgriffis@igalia.com>
[SOUP] Show more connection information in the inspector
https://bugs.webkit.org/show_bug.cgi?id=224873
Handle SOUP_HTTP_2_0.
Reviewed by Adrian Perez de Castro.
* platform/network/soup/ResourceResponseSoup.cpp:
(WebCore::ResourceResponse::ResourceResponse):
2021-04-22 Antoine Quint <graouts@webkit.org>
Add discrete animation support for border-image-repeat
https://bugs.webkit.org/show_bug.cgi?id=224923
Reviewed by Antti Koivisto.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* rendering/style/NinePieceImage.cpp:
(WebCore::operator<<):
* rendering/style/NinePieceImage.h:
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::setBorderImageHorizontalRule):
(WebCore::RenderStyle::setBorderImageVerticalRule):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::borderImageHorizontalRule const):
(WebCore::RenderStyle::borderImageVerticalRule const):
2021-04-22 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] Multi-column spanners are not part of the enclosing multi-column renderer's subtree
https://bugs.webkit.org/show_bug.cgi?id=224914
<rdar://76846946>
Reviewed by Simon Fraser.
This patch handles the case when the newly inserted renderer is a column spanner and checking enclosingFragmentedFlow()
on the spanner's new parent returns the incorrect enclosing multi-column renderer.
This can result in having the spanner in multiple multi-column flows.
(Note that the spanners are directly attached to the RenderBlockFlow that establishes the multi-column context, while non-spanner
renderers are part of the RenderMultiColumnFlow subtree. e.g
RenderBlockFlow <- spanner's parent.
RenderMultiColumnFlow
Non-spanner renderer
spanner renderer
calling enclosingFragmentedFlow() on a spanner's parent (RenderBlockFlow) returns the parent multi-column flow -and
not the one it establishes. e.g.
RenderMultiColumnFlow <- parent multi-column flow -in case of nested columns.
RenderBlockFlow <- spanner's parent.
RenderMultiColumnFlow
Non-spanner renderer
spanner renderer
)
Test: fast/multicol/spanner-inserted-to-multiple-multicolumns.html
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock):
2021-04-22 Dean Jackson <dino@apple.com>
[WebXR] Optional button test is incorrect
https://bugs.webkit.org/show_bug.cgi?id=224945
Reviewed by Tim Horton.
Fix a conditional test that was always true.
* testing/WebFakeXRInputController.cpp:
(WebCore::WebFakeXRInputController::getButtonOrPlaceholder const):
(A != B || A != C) -> (A != B && A != C)
2021-04-22 Dean Jackson <dino@apple.com>
[WebXR] Closure is capturing this unnecessarily
https://bugs.webkit.org/show_bug.cgi?id=224946
Reviewed by Tim Horton.
Remove the "this" capture.
* Modules/webxr/WebXRInputSourceArray.cpp:
(WebCore::WebXRInputSourceArray::handleRemovedInputSources):
2021-04-22 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r271644.
https://bugs.webkit.org/show_bug.cgi?id=224908
Caused regression
<http://webkit.org/b/221962|webkit.org/b/221962>
Reverted changeset:
"[css-multicol] OOM with 1px height columns"
https://bugs.webkit.org/show_bug.cgi?id=220490
https://trac.webkit.org/changeset/271644
2021-04-22 Chris Lord <clord@igalia.com>
Implement FontFace in Workers for OffscreenCanvas
https://bugs.webkit.org/show_bug.cgi?id=224178
<rdar://problem/76529024>
Reviewed by Darin Adler.
To comply with spec and complete the OffscreenCanvas implementation,
FontFace needs to be made available on WorkerGlobalScope. This patch
makes it available and fixes crashes using it due to accessing
main-thread only singletons.
No new tests, rebaselined existing tests.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
Add new files WorkerFontLoadRequest.cpp, WorkerFontLoadRequest.h
* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::fontCacheFallingBackToSingleton):
(WebCore::CSSFontFace::font):
* css/CSSFontFace.h:
Use the ScriptExecutionContext's FontCache if possible when loading fonts.
* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
(WebCore::CSSFontFaceSet::matchingFacesExcludingPreinstalledFonts):
Use the correct CSSValuePool and FontCache in
ensureLocalFontFacesForFamilyRegistered. Also clarify a vaguely-named
variable.
* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::CSSFontFaceSource):
Use FontLoadRequest::isPending instead of making assumptions about the
request state on construction.
* css/FontFace.cpp:
(WebCore::FontFace::create):
(WebCore::FontFace::display const):
* css/FontFace.h:
* css/FontFace.idl:
Construct with a ScriptExecutionContext instead of a Document and
make available for Workers.
* css/FontFaceSet.idl:
Expose to Workers.
* loader/FontLoadRequest.h:
(WebCore::FontLoadRequest::isWorkerFontLoadRequest const):
Add isPending function and new type WorkerFontLoadRequest.
* loader/cache/CachedFont.cpp:
(WebCore::CachedFont::createCustomFontData):
Use convertWOFFToSfntIfNecessary().
* loader/cache/CachedFontLoadRequest.h:
Implement FontLoadRequest::isPending.
* platform/graphics/Font.cpp:
(WebCore::Font::create):
(WebCore::Font::Font):
(WebCore::Font::systemFallbackFontForCharacter const):
* platform/graphics/Font.h:
Add an optional FontCache parameter for use with vertical font data
retrieval and add a FontCache parameter to
systemFallbackFontForCharacter instead of using the singleton.
* platform/graphics/FontCache.cpp:
(WebCore::FontCache::fontForPlatformData):
Pass FontCache parameter when creating fonts.
* platform/graphics/FontCache.h:
(WebCore::FontCache::fontCacheFallingBackToSingleton):
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::update const):
* platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
(WebCore::FontCascade::fontForCombiningCharacterSequence const):
Rename fontCacheFallbackToSingleton -> fontCacheFallingBackToSingleton
* platform/graphics/FontCascadeFonts.cpp:
(WebCore::FontCascadeFonts::realizeFallbackRangesAt):
(WebCore::FontCascadeFonts::glyphDataForSystemFallback):
Use familyNamesData instead of familyNames and pass the FontCache
parameter when calling glyphDataForSystemFallback to make this safe
to use in a Worker.
* platform/graphics/FontTaggedSettings.h:
Add missing wtf/Hasher.h include.
* platform/graphics/WOFFFileFormat.cpp:
(WebCore::convertWOFFToSfntIfNecessary):
* platform/graphics/WOFFFileFormat.h:
Add utility function to convert WOFF fonts on non-Cocoa platforms.
* workers/WorkerFontLoadRequest.cpp: Added.
(WebCore::WorkerFontLoadRequest::WorkerFontLoadRequest):
(WebCore::WorkerFontLoadRequest::load):
(WebCore::WorkerFontLoadRequest::ensureCustomFontData):
(WebCore::WorkerFontLoadRequest::createFont):
(WebCore::WorkerFontLoadRequest::setClient):
(WebCore::WorkerFontLoadRequest::didReceiveResponse):
(WebCore::WorkerFontLoadRequest::didReceiveData):
(WebCore::WorkerFontLoadRequest::didFinishLoading):
(WebCore::WorkerFontLoadRequest::didFail):
* workers/WorkerFontLoadRequest.h: Added.
Implement FontLoadRequest for Workers.
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::fonts):
(WebCore::WorkerGlobalScope::fontLoadRequest):
(WebCore::WorkerGlobalScope::beginLoadingFontSoon):
* workers/WorkerGlobalScope.h:
Implement ScriptExecutionContext font-loading related functions.
* workers/WorkerGlobalScope.idl:
Include FontFaceSource.
2021-04-22 Martin Robinson <mrobinson@webkit.org>
[GTK] Turn on editable <input type=date> and <input type=time> fields
https://bugs.webkit.org/show_bug.cgi?id=224921
Reviewed by Carlos Garcia Campos.
Turn on editable date and time inputs for GTK.
No new tests. This is covered by enabling existing <input type=date>
and <input type=time> tests.
* Headers.cmake: Add headers to the list.
* loader/EmptyClients.cpp: Add missing header include.
2021-04-22 Ziran Sun <zsun@igalia.com>
[css-grid] WPT Tests css/css-grid/grid-items/grid-item-percentage-sizes-*.html fail
https://bugs.webkit.org/show_bug.cgi?id=209650
Reviewed by Sergio Villar Senin.
We need to check child's writing mode in order to pick the correct dimension to resolve
percentage height against. Overriding containing block size should also be chosen in favour
of special code for orthogonal writing mode.
This change is an import of Chromium CL at
https://chromium-review.googlesource.com/c/chromium/src/+/1348055.
Three tests that failed are now passing.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePercentageLogicalHeight const):
2021-04-22 Imanol Fernandez <ifernandez@igalia.com>
Implement WebXR Input Sources
https://bugs.webkit.org/show_bug.cgi?id=223257
Reviewed by Youenn Fablet.
This patch implements the platform data definition and the DOM bits required to support WebXR Input Sources, the input mechanism used in WebXR.
Example XR input sources include, but are not limited to, handheld controllers, optically tracked hands, and gaze-based input methods.
More info about the API in:
- https://immersive-web.github.io/webxr/#input
- https://immersive-web.github.io/webxr-gamepads-module/#webxr-device-api-integration
Tested by WebXR WPT.
* Modules/gamepad/Gamepad.h: Add setConnected method.
* Modules/webxr/WebXRGamepad.cpp: Bridge between WebXRInputSource and Gamepad
(WebCore::WebXRGamepad::WebXRGamepad):
* Modules/webxr/WebXRGamepad.h:
* Modules/webxr/WebXRInputSpace.cpp: Instance of WebXRSpace used for WebXRInputSource spaces.
(WebCore::WebXRInputSpace::create):
(WebCore::WebXRInputSpace::WebXRInputSpace):
(WebCore::WebXRInputSpace::nativeOrigin const):
* Modules/webxr/WebXRInputSpace.h:
* Modules/webxr/WebXRFrame.cpp:
(WebCore::WebXRFrame::populatePose): set emulatedPosition based on the spaces.
* Modules/webxr/WebXRInputSource.cpp: Complete WebXRInputSource implementation.
(WebCore::WebXRInputSpace::create):
(WebCore::WebXRInputSpace::WebXRInputSpace):
(WebCore::WebXRInputSpace::nativeOrigin const):
(WebCore::WebXRInputSource::create):
(WebCore::WebXRInputSource::WebXRInputSource):
(WebCore::WebXRInputSource::update):
(WebCore::WebXRInputSource::requiresInputSourceChange):
(WebCore::WebXRInputSource::disconnect):
(WebCore::WebXRInputSource::pollEvents):
(WebCore::WebXRInputSource::createEvent):
* Modules/webxr/WebXRInputSource.h:
(WebCore::WebXRInputSource::handle const):
(WebCore::WebXRInputSource::handedness const):
(WebCore::WebXRInputSource::targetRayMode const):
(WebCore::WebXRInputSource::targetRaySpace const):
(WebCore::WebXRInputSource::gripSpace const):
(WebCore::WebXRInputSource::profiles const):
(WebCore::WebXRInputSource::gamepad const):
* Modules/webxr/WebXRInputSource.idl: Add gamepad attribute.
* Modules/webxr/WebXRInputSourceArray.cpp: Implement input source updates and event dispatching.
(WebCore::WebXRInputSourceArray::create):
(WebCore::WebXRInputSourceArray::WebXRInputSourceArray):
(WebCore::WebXRInputSourceArray::length const):
(WebCore::WebXRInputSourceArray::item const):
(WebCore::WebXRInputSourceArray::clear):
(WebCore::WebXRInputSourceArray::update):
(WebCore::WebXRInputSourceArray::handleRemovedInputSources):
(WebCore::WebXRInputSourceArray::handleAddedOrUpdatedInputSources):
* Modules/webxr/WebXRInputSourceArray.h:
* Modules/webxr/WebXRSession.cpp:
(WebCore::WebXRSession::WebXRSession): Set tracking delegate before initializing tracking and rendering.
(WebCore::WebXRSession::isPositionEmulated const): Add helper method.
(WebCore::WebXRSession::shutdown): Clear WebXRInputSourceArray instance.
(WebCore::WebXRSession::sessionDidInitializeInputSources): Dispatch initial InputSource discovery event.
(WebCore::WebXRSession::onFrame): Update WebXRInputSourceArray instance.
* Modules/webxr/WebXRSession.h:
* Modules/webxr/WebXRSpace.cpp: Add virtual class isPositionEmulated to be used in WebXRFrame.
(WebCore::WebXRSpace::isPositionEmulated const):
* Modules/webxr/WebXRSpace.h:
* Modules/webxr/WebXRSystem.cpp:
(WebCore::WebXRSystem::requestSession): update FIXME comment.
* Modules/webxr/XRHandedness.h: Reuse PlatformXR enum.
* Modules/webxr/XRInputSourceEvent.cpp:
(WebCore::XRInputSourceEvent::XRInputSourceEvent):
(WebCore::XRInputSourceEvent::setFrameActive):
* Modules/webxr/XRInputSourceEvent.h:
* Modules/webxr/XRInputSourcesChangeEvent.h:
* Modules/webxr/XRTargetRayMode.h: Reuse PlatformXR enum.
* platform/gamepad/GamepadConstants.cpp:
(WebCore::xrStandardGamepadMappingString): Add xr-standard gamepad mapping name.
* platform/gamepad/GamepadConstants.h:
* platform/xr/PlatformXR.h: Add Input Source frame data.
* testing/WebFakeXRDevice.cpp: Implement required changes to run and pass WebXR Input Source tests.
(WebCore::SimulatedXRDevice::initializeTrackingAndRendering):
(WebCore::SimulatedXRDevice::frameTimerFired):
(WebCore::WebFakeXRDevice::simulateResetPose):
(WebCore::WebFakeXRDevice::simulateInputSourceConnection):
* testing/WebFakeXRDevice.h:
* testing/WebFakeXRInputController.cpp:
(WebCore::WebFakeXRInputController::create):
(WebCore::WebFakeXRInputController::WebFakeXRInputController):
(WebCore::WebFakeXRInputController::setGripOrigin):
(WebCore::WebFakeXRInputController::setPointerOrigin):
(WebCore::WebFakeXRInputController::disconnect):
(WebCore::WebFakeXRInputController::reconnect):
(WebCore::WebFakeXRInputController::setSupportedButtons):
(WebCore::WebFakeXRInputController::updateButtonState):
(WebCore::WebFakeXRInputController::getFrameData):
(WebCore::WebFakeXRInputController::getButtonOrPlaceholder const):
* testing/WebFakeXRInputController.h:
2021-04-22 Carlos Garcia Campos <cgarcia@igalia.com>
[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-22 Myles C. Maxfield <mmaxfield@apple.com>
[iOS] Web processes recreated after crashing are not created with the right contentSizeCategory
https://bugs.webkit.org/show_bug.cgi?id=224916
Reviewed by Tim Horton.
The constructor of WKWebView sets the contentSizeCategory for the first page.
But if the web process crashes, the new one won't have it set.
This patch simply adds the contentSizeCategory to the WebProcessCreationParameters.
Tests: TextStyleFontSize.Startup
TextStyleFontSize.AfterCrash
* rendering/RenderThemeCocoa.h:
2021-04-22 Alejandro G. Castro <alex@igalia.com>
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-22 Kimmo Kinnunen <kkinnunen@apple.com>
GraphicsContextGLOpenGLCocoa should check that ANGLE is loaded in WK1 releaseCurrentContext
https://bugs.webkit.org/show_bug.cgi?id=224532
<rdar://problem/76632149>
Reviewed by Kenneth Russell.
Avoid crashing in case WK1 is used but ANGLE library is not present.
There are some cases where ANGLE could be omitted for size savings.
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::releaseCurrentContext):
2021-04-21 Fujii Hironori <Hironori.Fujii@sony.com>
[Win] GetDoubleClickTime() returns 0 in the non-interactive window station on Windows 10 version 2004
https://bugs.webkit.org/show_bug.cgi?id=224793
Reviewed by Don Olmstead.
Some editing and events tests using double click were failing on
Windows 10 version 2004 and 20H2. DumpRenderTree.exe creates a
non-interactive window station if it is running as admin. However,
GetDoubleClickTime() returns 0 in the window station on the latest
Windows 10.
* platform/win/GDIUtilities.h:
(WebCore::getDoubleClickTime): Added.
2021-04-21 Zalan Bujtas <zalan@apple.com>
Ignore column spanner property for the inner part of a text control.
https://bugs.webkit.org/show_bug.cgi?id=224757
<rdar://problem/76844224>
Reviewed by Antti Koivisto.
Let's not try to span columns with the _inner_ part of a text control. Such subtrees should be opaque to multi-column layout.
(we already do this for <legend>)
Test: fast/multicol/spanner-inside-text-control.html
* rendering/updating/RenderTreeBuilderMultiColumn.cpp:
(WebCore::isValidColumnSpanner):
2021-04-21 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r276380 and r276386.
https://bugs.webkit.org/show_bug.cgi?id=224912
Caused WPT css/css-counter-styles/cssom test crashes on macOS
WK1 with ASan
Reverted changesets:
"[css-counter-styles] Parse @counter-style descriptors"
https://bugs.webkit.org/show_bug.cgi?id=224718
https://trac.webkit.org/changeset/276380
"CSSComputedStyleDeclaration.cpp should use C++ style
comments"
https://bugs.webkit.org/show_bug.cgi?id=224875
https://trac.webkit.org/changeset/276386
2021-04-21 Peng Liu <peng.liu6@apple.com>
[GPUP] Refactor SourceBuffer::enqueuedSamplesForTrackID() for testing purposes
https://bugs.webkit.org/show_bug.cgi?id=224891
Reviewed by Eric Carlson.
This patch is a preparation to run `MockMediaPlayerMediaSource` in the GPU Process.
`SourceBuffer::enqueuedSamplesForTrackID()` is a synchronous function used for testing
purposes. It works fine when "Media in GPU process" is disabled. However, when
"Media in GPU process" is enabled, we have to use a synchronous IPC message to
implement it. This patch changes it to be a function with a completion handler
parameter, so that we can implement it with an asynchronous IPC message when
we run `MockMediaPlayerMediaSource` in the GPU process.
There is no behavior change when "Media in GPU Process" is disabled.
Covered by existing tests.
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::enqueuedSamplesForTrackID):
* Modules/mediasource/SourceBuffer.h:
* platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::enqueuedSamplesForTrackID):
* platform/graphics/SourceBufferPrivate.h:
(WebCore::SourceBufferPrivate::enqueuedSamplesForTrackID): Deleted.
* platform/mock/mediasource/MockSourceBufferPrivate.cpp:
(WebCore::MockSourceBufferPrivate::enqueuedSamplesForTrackID):
* platform/mock/mediasource/MockSourceBufferPrivate.h:
* testing/Internals.cpp:
(WebCore::Internals::enqueuedSamplesForTrackID):
* testing/Internals.h:
* testing/Internals.idl:
2021-04-21 Chris Dumez <cdumez@apple.com>
Crash under RegistrationDatabase::openSQLiteDatabase()
https://bugs.webkit.org/show_bug.cgi?id=224895
<rdar://64574013>
Reviewed by Geoffrey Garen.
This was a thread-safety issue. The static string in recordsTableSchema() was being used
from several threads without synchronization. The reason is that there can be several
RegistrationDatabase that co-exist (one per SWServer, meaning one per sessionID) and each
RegistrationDatabase was using its own WorkQueue.
To address the issue, all RegistrationDatabase objects now share the same WorkQueue.
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::registrationDatabaseWorkQueue):
(WebCore::RegistrationDatabase::RegistrationDatabase):
2021-04-21 Wenson Hsieh <wenson_hsieh@apple.com>
Introduce helper methods to map FloatQuads to and from content and root view coordinates
https://bugs.webkit.org/show_bug.cgi?id=224883
Reviewed by Tim Horton.
Add new helper methods to transform FloatQuads from content coordinates to root view coordinates, and vice
versa; use these methods in several places throughout WebKit to avoid code duplication.
No change in behavior.
* inspector/agents/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::didPaint):
(WebCore::InspectorTimelineAgent::localToPageQuad): Deleted.
* inspector/agents/InspectorTimelineAgent.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::rootViewToContents const):
(WebCore::ScrollView::contentsToRootView const):
* platform/ScrollView.h:
2021-04-21 Julian Gonzalez <julian_a_gonzalez@apple.com>
Crash in StyledMarkupAccumulator::traverseNodesForSerialization()
https://bugs.webkit.org/show_bug.cgi?id=224836
Reviewed by Ryosuke Niwa.
In traverseNodesForSerialization(), make sure we check if the current node
is a descendant of the pastEnd node even if we not entering the current node.
Test: editing/execCommand/selectAll-copy-crash.html
* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
2021-04-21 Chris Dumez <cdumez@apple.com>
GPUProcess launches unnecessarily when loading the amazon front page
https://bugs.webkit.org/show_bug.cgi?id=224843
Reviewed by Eric Carlson.
Amazon.com was going media-related feature detection like so:
```
!!h.createElement("audio").canPlayType
!!h.createElement("video").canPlayType
```
Constructing an HTMLAudioElement / HTMLVideoElement would initialize a MediaSession
object, which would launch the GPUProcess. Running such code should really not require
launching the GPUProcess though.
To address this, I made the MediaSession initialization lazy. Instead of doing it when
constructing an HTMLMediaElement, we now do it as soon as we actually need a MediaSession
in the mediaSession() getter. This will at the very least happen in prepareForLoad() after
setting the 'src' attribute. However, in cases where the HTMLMediaElement is not used for
anyway meaningful (e.g no 'src' attribute is ever set), then we avoid launching the
GPUProcess.
I have verified on an iPad that visiting the amazon.com front page and searching for
something no longer launches the GPUProcess after this change. This changes also seems to
be a ~3.6% PLUM progression on iPhone and potentially higher on iPad.
* html/HTMLAudioElement.cpp:
(WebCore::HTMLAudioElement::create):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
(WebCore::HTMLMediaElement::initializeMediaSession):
(WebCore::HTMLMediaElement::~HTMLMediaElement):
(WebCore::HTMLMediaElement::registerWithDocument):
(WebCore::HTMLMediaElement::unregisterWithDocument):
(WebCore::HTMLMediaElement::prepareForDocumentSuspension):
(WebCore::HTMLMediaElement::resumeFromDocumentSuspension):
(WebCore::HTMLMediaElement::parseAttribute):
(WebCore::HTMLMediaElement::didFinishInsertingNode):
(WebCore::HTMLMediaElement::prepareForLoad):
(WebCore::HTMLMediaElement::selectMediaResource):
(WebCore::HTMLMediaElement::loadResource):
(WebCore::HTMLMediaElement::mediaLoadingFailed):
(WebCore::HTMLMediaElement::setReadyState):
(WebCore::HTMLMediaElement::seekWithTolerance):
(WebCore::HTMLMediaElement::play):
(WebCore::HTMLMediaElement::playInternal):
(WebCore::HTMLMediaElement::pause):
(WebCore::HTMLMediaElement::pauseInternal):
(WebCore::HTMLMediaElement::setVolume):
(WebCore::HTMLMediaElement::setMuted):
(WebCore::HTMLMediaElement::beginScrubbing):
(WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack):
(WebCore::HTMLMediaElement::sourceWasAdded):
(WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
(WebCore::HTMLMediaElement::addBehaviorRestrictionsOnEndIfNecessary):
(WebCore::HTMLMediaElement::seekToPlaybackPositionEndedTimerFired):
(WebCore::HTMLMediaElement::mediaEngineWasUpdated):
(WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
(WebCore::HTMLMediaElement::pausedForUserInteraction const):
(WebCore::HTMLMediaElement::updatePlayState):
(WebCore::HTMLMediaElement::checkForAudioAndVideo):
(WebCore::HTMLMediaElement::clearMediaPlayer):
(WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
(WebCore::HTMLMediaElement::stop):
(WebCore::HTMLMediaElement::suspend):
(WebCore::HTMLMediaElement::resume):
(WebCore::HTMLMediaElement::visibilityStateChanged):
(WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker):
(WebCore::HTMLMediaElement::wirelessRoutesAvailableDidChange):
(WebCore::HTMLMediaElement::setIsPlayingToWirelessTarget):
(WebCore::HTMLMediaElement::addEventListener):
(WebCore::HTMLMediaElement::removeEventListener):
(WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent):
(WebCore::HTMLMediaElement::remoteHasAvailabilityCallbacksChanged):
(WebCore::HTMLMediaElement::exitFullscreen):
(WebCore::HTMLMediaElement::shouldForceControlsDisplay const):
(WebCore::HTMLMediaElement::configureMediaControls):
(WebCore::HTMLMediaElement::createMediaPlayer):
(WebCore::HTMLMediaElement::mediaPlayerIsFullscreenPermitted const):
(WebCore::HTMLMediaElement::removeBehaviorRestrictionsAfterFirstUserGesture):
(WebCore::HTMLMediaElement::updateRateChangeRestrictions):
(WebCore::HTMLMediaElement::maximumSourceBufferSize const):
(WebCore::HTMLMediaElement::updateMediaState):
(WebCore::HTMLMediaElement::mediaState const):
(WebCore::HTMLMediaElement::purgeBufferedDataIfPossible):
(WebCore::HTMLMediaElement::allowsMediaDocumentInlinePlaybackChanged):
(WebCore::HTMLMediaElement::isVisibleInViewportChanged):
(WebCore::HTMLMediaElement::updateShouldAutoplay):
(WebCore::HTMLMediaElement::updateShouldPlay):
(WebCore::HTMLMediaElement::playbackControlsManagerBehaviorRestrictionsTimerFired):
(WebCore::HTMLMediaElement::setInActiveDocument):
(WebCore::HTMLMediaElement::mediaSession const):
* html/HTMLMediaElement.h:
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::create):
2021-04-21 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Text selection in image overlays should not be limited to rectilinear quads
https://bugs.webkit.org/show_bug.cgi?id=224837
<rdar://76829981>
Reviewed by Tim Horton.
Refactor the iOS-specific `WebCore::SelectionGeometry` such that it is backed by a `FloatQuad` instead of an
`IntRect`, and additionally support a flag to indicate that the selection geometry should render as individual
quads, instead of allowing adjacent rects to be coalesced based on each rects' enclosing bounds.
See comments below for more information.
Test: fast/images/image-extraction/ios/selection-rects-in-image-overlay.html
* html/HTMLElement.cpp:
(WebCore::HTMLElement::selectionRenderingBehavior):
* html/HTMLElement.h:
* platform/ios/SelectionGeometry.cpp:
(WebCore::SelectionGeometry::SelectionGeometry):
Change these constructors to take `FloatQuad` instead of an enclosing bounding box of a quad. Refer to call
sites below.
(WebCore::SelectionGeometry::setLogicalLeft):
(WebCore::SelectionGeometry::setLogicalWidth):
(WebCore::SelectionGeometry::setLogicalTop):
(WebCore::SelectionGeometry::setLogicalHeight):
Adjust these four setters so that they automatically inflate the selection quad to the quad's enclosing bounds
before changing any of the dimensions of the rect. Note that in practice, these methods are only used by code
that attempts to coalesce adjacent selection geometries, in which case we shouldn't be rendering non-rectilinear
quads anyways.
(WebCore::SelectionGeometry::rect const):
This method now computes the enclosing bounding rect of the selection quad. Since this can be called many times
for a single selection geometry, we cache the enclosing bounds in `m_cachedEnclosingRect` to avoid repeated
bounding box computation.
(WebCore::SelectionGeometry::setQuad):
Set the selection quad, and invalidate the enclosing bounding rect.
(WebCore::SelectionGeometry::setRect):
Since we're already setting the quad from an `IntRect`, we can go ahead and set the cached enclosing rect at the
same time to avoid computing it again in the future.
(WebCore::operator<<):
* platform/ios/SelectionGeometry.h:
Add a few new members to `SelectionGeometry`. Instead of maintaining an `IntRect`, store a `FloatRect` in
`m_quad`. Additionally, add a new enum describing how the `SelectionGeometry` should behave. This enum only has
two values: `CoalesceBoundingRects`, indicating that adjacent selection geometries should be coalesced based on
the enclosing bounding rects of their quads, and `UseIndividualQuads`, indicating that each quad should be
rendered individually.
(WebCore::SelectionGeometry::quad const):
(WebCore::SelectionGeometry::logicalLeft const):
(WebCore::SelectionGeometry::logicalWidth const):
(WebCore::SelectionGeometry::logicalTop const):
(WebCore::SelectionGeometry::logicalHeight const):
(WebCore::SelectionGeometry::behavior const):
(WebCore::SelectionGeometry::setBehavior):
(WebCore::SelectionGeometry::rect const): Deleted.
(WebCore::SelectionGeometry::setRect): Deleted.
* rendering/RenderImage.cpp:
(WebCore::RenderImage::collectSelectionGeometries):
* rendering/RenderLineBreak.cpp:
(WebCore::RenderLineBreak::collectSelectionGeometries):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::collectSelectionGeometries):
(WebCore::adjustLineHeightOfSelectionGeometries):
When collecting selection geometry from renderers, avoid coalescing selection geometry when the
`SelectionGeometry` has `SelectionRenderingBehavior::UseIndividualQuads`.
(WebCore::coalesceSelectionGeometries):
(WebCore::RenderObject::collectSelectionGeometriesInternal):
* rendering/RenderText.cpp:
(WebCore::RenderText::collectSelectionGeometries):
2021-04-21 Tyler Wilcock <twilco.o@protonmail.com>
CSSComputedStyleDeclaration.cpp should use C++ style comments
https://bugs.webkit.org/show_bug.cgi?id=224875
Reviewed by Darin Adler.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
Use // instead of /* */ for comments, as this is suggested WebKit
coding style.
2021-04-21 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] Adjust border radius for large buttons and <select>
https://bugs.webkit.org/show_bug.cgi?id=224825
<rdar://problem/76912116>
Reviewed by Wenson Hsieh.
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::adjustRoundBorderRadius):
Larger UIKit buttons do not have a pill-shaped appearance. Match their
appearance for buttons and <select> elements that are natively styled
(ones that do not set "-webkit-appearance: none").
2021-04-21 Adrian Perez de Castro <aperez@igalia.com>
Non-unified build fixes, mid April 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=222652
<rdar://problem/75262285>
Unreviewed non-unified build fixes.
No new tests needed.
* bindings/js/JSWebXRRigidTransformCustom.cpp: Add missing JSDOMConvertBufferSource.h
include.
* bindings/js/JSWebXRSpaceCustom.cpp: Add missing JSWebXRReferenceSpace.h include.
* bindings/js/JSWebXRViewCustom.cpp: Add missing JSDOMConvertBufferSource.h include.
* bindings/js/WorkerModuleScriptLoader.cpp: Add missing ServiceWorkerGlobalScope.h
include.
* css/CSSFontFaceSrcValue.cpp: Add missing CachedFontLoadRequest.h include.
* css/parser/CSSPropertyParserWorkerSafe.cpp: Add missing includes for
CSSFontFaceSrcValue.h, CSSFontFeatureValue.h, CSSUnicodeRangeValue.h, Document.h, and
StyleSheetContents.h; remove (now unneeded) CSSPropertyParserHelpers.h include.
(WebCore::CSSPropertyParserWorkerSafe::parseFont): Sprinkle usage of functions with
missing WebCore:: namespace prefixes.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcLocal): Ditto.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStyleRange): Ditto.
* css/parser/CSSPropertyParserWorkerSafe.h: Add missing CSSPropertyParserHelpers.h
include.
* dom/DocumentFontLoader.cpp: Add missing includes CSSFontSelector.h,
CachedResourceLoader.h, Frame.h, and FrameLoader.h
* editing/AppendNodeCommand.cpp: Add missing CompositeEditCommand.h include.
* editing/DeleteFromTextNodeCommand.cpp: Ditto.
* editing/InsertIntoTextNodeCommand.cpp: Ditto.
* editing/InsertNodeBeforeCommand.cpp: Ditto.
* editing/MergeIdenticalElementsCommand.h: Ditto, and remove unneeded EditCommand.h
include.
* editing/RemoveNodeCommand.cpp: Add missing CompositeEditCommand.h include.
* editing/SetNodeAttributeCommand.cpp: Ditto.
* editing/SetSelectionCommand.cpp: Ditto.
* editing/SplitElementCommand.cpp: Ditto.
* editing/SplitTextNodeCommand.cpp: Ditto.
* loader/cache/CachedFontLoadRequest.h: Add missing FontSelectionAlgorithm.h include.
* platform/graphics/FontTaggedSettings.h: Add missing wtf/Hasher.h include.
* platform/text/BidiContext.cpp: Add missing <mutex> and wtf/NeverDestroyed.h includes.
* workers/WorkerGlobalScopeProxy.h: Forward-declare WebCore::ScriptBuffer.
2021-04-21 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] Update datalist dropdown indicator
https://bugs.webkit.org/show_bug.cgi?id=224844
<rdar://problem/76785950>
Reviewed by Wenson Hsieh.
* css/html.css:
(input::-webkit-list-button):
Updated to use a "small" sized SF symbol.
2021-04-21 Tyler Wilcock <twilco.o@protonmail.com>
[css-counter-styles] Parse @counter-style descriptors
https://bugs.webkit.org/show_bug.cgi?id=224718
Reviewed by Darin Adler.
Implement parsing and CSSCounterStyleRule IDL interface for @counter-style descriptors.
See spec for full details on all descriptors:
https://drafts.csswg.org/css-counter-styles-3/#the-counter-style-rule
Test: webexposed/counter-style-image-symbols-not-exposed.html and WPTs
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
Return `nullptr` for new @counter-style descriptor properties.
* css/CSSCounterStyleRule.cpp:
(WebCore::toCounterStyleSystemEnum):
(WebCore::symbolsValidForSystem):
(WebCore::StyleRuleCounterStyle::newValueInvalidOrEqual const):
(WebCore::CSSCounterStyleRule::cssText const):
(WebCore::CSSCounterStyleRule::setName):
(WebCore::CSSCounterStyleRule::setterInternal):
(WebCore::CSSCounterStyleRule::setSystem):
(WebCore::CSSCounterStyleRule::setNegative):
(WebCore::CSSCounterStyleRule::setPrefix):
(WebCore::CSSCounterStyleRule::setSuffix):
(WebCore::CSSCounterStyleRule::setRange):
(WebCore::CSSCounterStyleRule::setPad):
(WebCore::CSSCounterStyleRule::setFallback):
(WebCore::CSSCounterStyleRule::setSymbols):
(WebCore::CSSCounterStyleRule::setAdditiveSymbols):
(WebCore::CSSCounterStyleRule::setSpeakAs):
Implement setters and tangential functionality required by setters.
* css/CSSCounterStyleRule.h:
Replace FIXME with actual descriptor getter and setter
implementations.
* css/CSSProperties.json:
Add @counter-style descriptor properties.
* css/CSSValueKeywords.in:
Add new values required for `system` and `speak-as`
@counter-style descriptor properties.
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeCounterStyleSystem):
(WebCore::consumeCounterStyleSymbol):
(WebCore::consumeCounterStyleNegative):
(WebCore::consumeCounterStyleRangeBound):
(WebCore::consumeCounterStyleRange):
(WebCore::consumeCounterStylePad):
(WebCore::consumeCounterStyleSymbols):
(WebCore::consumeCounterStyleAdditiveSymbols):
(WebCore::consumeCounterStyleSpeakAs):
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Parse @counter-style descriptors.
2021-04-21 Chris Dumez <cdumez@apple.com>
ASSERTION FAILED: context().isInitialized() ./Modules/webaudio/OfflineAudioDestinationNode.cpp(142)
https://bugs.webkit.org/show_bug.cgi?id=224876
<rdar://76896256>
Reviewed by Eric Carlson.
In OfflineAudioDestinationNode::uninitialize(), we were synchronizing with the
render thread to make sure that OfflineAudioDestinationNode::offlineRender() was
done running before proceeding with uninitialization. However, when an audio
worklet is used, m_renderThread is null and no synchronization with the AudioWorklet
thread would happen. This patch adds the missing synchronization with the AudioWorklet
thread when present.
Test: webaudio/OfflineAudioContext/offlineaudiocontext-uninitialized-crash.html
* Modules/webaudio/OfflineAudioDestinationNode.cpp:
(WebCore::OfflineAudioDestinationNode::uninitialize):
2021-04-21 Simon Fraser <simon.fraser@apple.com>
will-change: transform should affect nested position:fixed
https://bugs.webkit.org/show_bug.cgi?id=167600
Reviewed by Alan Bujtas.
"will-change transform" should make an element a container for position:fixed,
just as a transform does.
Test: fast/css/will-change/will-change-transform-contains-fixed.html
* rendering/RenderElement.h:
(WebCore::RenderElement::canContainFixedPositionObjects):
2021-04-21 Antoine Quint <graouts@webkit.org>
Add discrete animation support for several background CSS properties
https://bugs.webkit.org/show_bug.cgi?id=224871
Reviewed by Antti Koivisto.
We now support animation of background-attachment, background-clip, background-origin
and background-repeat.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setBackgroundAttachment):
(WebCore::RenderStyle::setBackgroundClip):
(WebCore::RenderStyle::setBackgroundOrigin):
(WebCore::RenderStyle::setBackgroundRepeatX):
(WebCore::RenderStyle::setBackgroundRepeatY):
2021-04-21 Zalan Bujtas <zalan@apple.com>
Enable mid-layout render tree dump with floating boxes
https://bugs.webkit.org/show_bug.cgi?id=224878
Reviewed by Simon Fraser.
Floating box geometry dump requires the box to be placed first (see assert(isPlaced()) in FloatingObject::frameRect()).
* rendering/FloatingObjects.cpp:
(WebCore::operator<<):
2021-04-21 Chris Lord <clord@igalia.com>
DOMException should be Serializable
https://bugs.webkit.org/show_bug.cgi?id=224865
Reviewed by Chris Dumez.
Implement serialization of DOMException objects.
No new tests, rebaselined existing tests.
* bindings/js/SerializedScriptValue.cpp:
2021-04-21 Rob Buis <rbuis@igalia.com>
RenderGeometryMap should know about individual transform properties
https://bugs.webkit.org/show_bug.cgi?id=224856
Reviewed by Simon Fraser.
RenderGeometryMap should know about individual transform properties.
Test: fast/transforms/textarea-individual-transform-properties-crash.html
* rendering/RenderGeometryMap.cpp:
(WebCore::RenderGeometryMap::mapToContainer const):
(WebCore::canMapBetweenRenderersViaLayers):
2021-04-21 Don Olmstead <don.olmstead@sony.com>
[CMake] Add OpenGLES2 targets
https://bugs.webkit.org/show_bug.cgi?id=224786
Reviewed by Adrian Perez de Castro.
Use the OpenGL::GLES target.
* CMakeLists.txt:
2021-04-21 Peng Liu <peng.liu6@apple.com>
[GPUP] Refactor the implementation of MediaSource::buffered()
https://bugs.webkit.org/show_bug.cgi?id=224848
Reviewed by Eric Carlson.
This patch is a preparation to run `MockMediaPlayerMediaSource` in the GPU Process.
In the current implementation, `MediaSource::m_buffered` is updated by the caller
of `MediaSource::buffered()`. As a result, when an object from the GPU process
wants to get the value of `m_buffered`, it may need to use a synchronous IPC
message (from the GPU process to a WebContent process), which is bad.
Therefore, there is an `ASSERT_NOT_REACHED()` in `RemoteMediaSourceProxy::buffered()`.
However, `MockMediaPlayerMediaSource` needs to use it for testing purposes.
This patch adds a function `sourceBufferDidChangeBufferedDirty()` to
`MediaSource`, so that `SourceBuffer` can notify the `MediaSource` object to
refresh its `m_buffered` and notify `MediaSourcePrivate` regarding the new value.
When "Media in GPU process" is enabled, `MediaSourcePrivateRemote` will forward
the new value to the GPU process, so that we can avoid the synchronous IPC
message from the GPU process to the WebContent process, and meet the requirement
of `MockMediaPlayerMediaSource`.
There is no behavior change when "Media in GPU Process" is disabled.
Covered by existing tests.
* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::MediaSource):
(WebCore::MediaSource::buffered const):
(WebCore::MediaSource::sourceBufferDidChangeBufferedDirty):
(WebCore::MediaSource::regenerateActiveSourceBuffers):
(WebCore::MediaSource::updateBufferedIfNeeded):
* Modules/mediasource/MediaSource.h:
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::sourceBufferPrivateBufferedDirtyChanged):
* platform/graphics/MediaSourcePrivate.h:
(WebCore::MediaSourcePrivate::bufferedChanged):
2021-04-21 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] <select> decorations should match the text color
https://bugs.webkit.org/show_bug.cgi?id=224831
<rdar://problem/76918959>
Reviewed by Darin Adler.
Currently, <select> decorations always have a system blue color, even
if a different text color is specified. To improve stylability, the
color of the decoration should match the color of the text.
Test: fast/forms/ios/form-control-refresh/select/decoration-color.html
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::paintMenuListButtonDecorationsWithFormControlRefresh):
Use the color property of the style when painting the decoration.
2021-04-21 Michael Catanzaro <mcatanzaro@gnome.org>
URL::URL(HashTableDeletedValueType) triggers -Wuninitialized warnings with GCC 11
https://bugs.webkit.org/show_bug.cgi?id=224755
Reviewed by Chris Dumez
My first thought here was to just always fully-initialize the URL object when used as a
HashTableDeletedValue, but Alex is concerned it might have a performance impact. Instead,
Chris suggested we could use the SecurityOriginData rather than URL to track whether we are
a HashTableDeletedValue. This seems good because it avoids any size increase in
ServiceWorkerRegistrationKey. Additionally, let's follow Darin's advice to construct the
ServiceWorkerRegistrationKey using placement new rather than via assignment to the
uninitialized storage.
There should be no behavior change. (Although we were copying uninitialized data before, it
was never read. Hopefully.)
* workers/service/ServiceWorkerRegistrationKey.h:
(WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue):
(WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::isDeletedValue):
2021-04-21 Simon Fraser <simon.fraser@apple.com>
Enhance scrolling-related trace points
https://bugs.webkit.org/show_bug.cgi?id=224852
Reviewed by Tim Horton.
Add a new trace point when the "display did refresh" ping gets to ThreadedScrollingTree on
the EventDispatcher thread, and add some metadata to the existing displayDidRefresh trace
scope.
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::displayDidRefreshOnScrollingThread):
(WebCore::ThreadedScrollingTree::displayDidRefresh):
2021-04-21 Youenn Fablet <youenn@apple.com>
AudioMediaStreamTrackRendererUnit should not have its data zeroed if one track has not enough data
https://bugs.webkit.org/show_bug.cgi?id=224673
Reviewed by Eric Carlson.
AudioMediaStreamTrackRendererUnit may get data from multiple tracks.
If one track has not enough data, AudioSampleDataSource will zero the buffer while it should leave it unchanged.
If all tracks do not have enough data, AudioMediaStreamTrackRendererUnit will have silent output as the first track will actually zero the buffer.
Manually tested.
* platform/audio/cocoa/AudioSampleDataSource.mm:
(WebCore::AudioSampleDataSource::pullSamplesInternal):
2021-04-21 Zalan Bujtas <zalan@apple.com>
[LFC] Take "contain: size" into account when computing the preferred logical width
https://bugs.webkit.org/show_bug.cgi?id=224850
Reviewed by Antti Koivisto.
The intrinsic sizes of the size containment box are determined as if the element had no content,
following the same logic as when sizing as if empty.
* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingRoot):
* layout/tableformatting/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints):
2021-04-21 Zalan Bujtas <zalan@apple.com>
REGRESSION(r256107): Text moves around when selecting at https://www.tokyo-sports.co.jp/entame/news/2834187/
https://bugs.webkit.org/show_bug.cgi?id=224839
<rdar://74958484>
Reviewed by Darin Adler.
Pass in locale information when constructing the text iterator for the content (locale affects soft wrap opportunities).
Test: fast/text/line-break-with-locale.html
* layout/inlineformatting/InlineTextItem.cpp:
(WebCore::Layout::InlineTextItem::createAndAppendTextItems):
* layout/inlineformatting/text/TextUtil.cpp: In addition to locale, add missing line breaking mode.
(WebCore::Layout::TextUtil::lineBreakIteratorMode):
* layout/inlineformatting/text/TextUtil.h:
2021-04-21 Ziran Sun <zsun@igalia.com>
[css-grid] last-baseline shouldn't affect baseline alignment
https://bugs.webkit.org/show_bug.cgi?id=224538
Reviewed by Darin Adler and Javier Fernandez.
According to discussions at https://github.com/w3c/csswg-drafts/issues/5293,
"align-self: last baseline" should not interfere with baseline alignment in
first row. This change is to make sure this is checked while deciding
whether an item participates in baseline alignment.
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::firstLineBaseline const):
(WebCore::RenderGrid::isBaselineAlignmentForChild const):
2021-04-21 Martin Robinson <mrobinson@webkit.org>
Add basic (non-momentum) wheel event handling for scroll snap
https://bugs.webkit.org/show_bug.cgi?id=222594
Reviewed by Darin Adler.
Test: css3/scroll-snap/scroll-snap-wheel-event.html
Enable scroll snapping for basic wheel events on GTK+ and WPE. The Mac port
has special wheel handling due to momentum scrolling. Other scroll-snap-enabled
ports can just use a basic version.
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::scroll): Accept a bitmask of options now. This
will allow using this method when handling wheel events that do not animate.
(WebCore::ScrollAnimator::handleWheelEvent): Trigger ::scroll with
scroll snapping enabled and pass the appropriate option to disable animations.
(WebCore::ScrollAnimator::processWheelEventForScrollSnap): Deleted.
* platform/ScrollAnimator.h:
(WebCore::ScrollAnimator::ScrollAnimator::processWheelEventForScrollSnap): Made
this a method that can be overridden by subclasses.
* platform/mac/ScrollAnimatorMac.h: Added processWheelEventForScrollSnap.
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::scroll): Pay attention to the NeverAnimate bitmask now.
(WebCore::ScrollAnimatorMac::processWheelEventForScrollSnap): Added.
2021-04-21 Youenn Fablet <youenn@apple.com>
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-21 Tim Horton <timothy_horton@apple.com>
Long-pressing a data detectors link causes the link to be followed
https://bugs.webkit.org/show_bug.cgi?id=224847
<rdar://problem/72889738>
Reviewed by Wenson Hsieh.
New API tests: iOSMouseSupport.{EndedTouchesTriggerClick,CancelledTouchesDoNotTriggerClick}
* page/EventHandler.h:
2021-04-21 Youenn Fablet <youenn@apple.com>
[ BigSur wk2 ARM64 ] http/wpt/webrtc/change-encoded-transform.html is a flakey crash
https://bugs.webkit.org/show_bug.cgi?id=224696
<rdar://problem/76780020>
Reviewed by Eric Carlson.
Sometimes the video sender delegate will be recreated on the fly.
In that case, it might receive a frame from the old delegate before processing an existing frame.
This makes the encoder queue being null.
To prevent this we update backends to only register once.
Covered by tests no longer crashing.
* Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverTransformBackend.cpp:
(WebCore::LibWebRTCRtpReceiverTransformBackend::setTransformableFrameCallback):
* Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverTransformBackend.h:
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderTransformBackend.cpp:
(WebCore::LibWebRTCRtpSenderTransformBackend::setTransformableFrameCallback):
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderTransformBackend.h:
2021-04-21 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Avoid triggering image extraction for animated images
https://bugs.webkit.org/show_bug.cgi?id=224851
Reviewed by Megan Gardner.
Avoid adding the "Reveal Image" context menu item for animated images. Testing is currently blocked on
webkit.org/b/224641.
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::populate):
2021-04-21 Megan Gardner <megan_gardner@apple.com>
Support scrolling to a selected AppHighlight
https://bugs.webkit.org/show_bug.cgi?id=224773
Reviewed by Tim Horton.
Test: AppHighlights::AppHighlightCreateAndRestoreAndScroll
* Modules/highlight/AppHighlightStorage.cpp:
(WebCore::AppHighlightStorage::restoreAndScrollToAppHighlight):
(WebCore::AppHighlightStorage::attemptToRestoreHighlightAndScroll):
(WebCore::AppHighlightStorage::restoreUnrestoredAppHighlights):
(WebCore::AppHighlightStorage::restoreAppHighlight): Deleted.
* Modules/highlight/AppHighlightStorage.h:
* WebCore.xcodeproj/project.pbxproj:
* editing/Editor.cpp:
(WebCore::TemporarySelectionChange::setSelection):
* page/Page.cpp:
(WebCore::Page::doAfterUpdateRendering):
2021-04-20 Ian Gilbert <iang@apple.com>
Crash in CompositeEditCommand::insertNodeAt
https://bugs.webkit.org/show_bug.cgi?id=224504
Reviewed by Ryosuke Niwa.
CompositeEditCommand::cleanupAfterDeletion will remove text nodes that only
have a newline. Added check inside FormatBlockCommand::formatRange to avoid
a null pointer dereference on a removed node.
Test: editing/execCommand/format-block-remove-text-node-crash.html
* editing/FormatBlockCommand.cpp:
(WebCore::FormatBlockCommand::formatRange):
2021-04-20 Basuke Suzuki <basuke.suzuki@sony.com>
[clang] Remove implicit cast related warnings.
https://bugs.webkit.org/show_bug.cgi?id=224797
Reviewed by Darin Adler.
Added explicit cast to suppress warning.
Behavior is not changed from implicit cast.
No new tests because there's no behavior change.
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::adjustLinePositionForPagination):
2021-04-20 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Prevent GPU and WebContent processes from attempting to connect to the AppSSO service
https://bugs.webkit.org/show_bug.cgi?id=224834
<rdar://problem/72157514>
Reviewed by Jiewen Tan.
Call version of '_protocolClassForRequest' that tells CFNetwork to ignore AppSSO flows
when building for a platform that supports it.
* platform/mac/WebCoreNSURLExtras.mm:
(WebCore::URLByCanonicalizingURL):
2021-04-20 Devin Rousso <drousso@apple.com>
Parse `theme_color` in web application manifests and pass it along to `-[WKWebView themeColor]`
https://bugs.webkit.org/show_bug.cgi?id=224796
Reviewed by Darin Adler.
* Modules/applicationmanifest/ApplicationManifest.h:
(WebCore::ApplicationManifest::encode const):
(WebCore::ApplicationManifest::decode):
* Modules/applicationmanifest/ApplicationManifestParser.h:
* Modules/applicationmanifest/ApplicationManifestParser.cpp:
(WebCore::ApplicationManifestParser::parse):
(WebCore::ApplicationManifestParser::ApplicationManifestParser):
(WebCore::ApplicationManifestParser::parseManifest):
(WebCore::ApplicationManifestParser::logDeveloperWarning):
(WebCore::ApplicationManifestParser::parseColor): Added.
* loader/cache/CachedApplicationManifest.h:
* loader/cache/CachedApplicationManifest.cpp:
(WebCore::CachedApplicationManifest::process):
Pass an actual `Document` instead of a `ScriptExecutionContext` so that we can notify it
when finished parsing the JSON (`Document::processApplicationManifest`).
* dom/Document.h:
(WebCore::Document::themeColor const):
* dom/Document.cpp:
(WebCore::Document::processMetaElementThemeColor): Added.
(WebCore::Document::themeColorChanged): Added.
(WebCore::Document::processApplicationManifest): Added.
(WebCore::Document::processThemeColor): Deleted.
Use the theme color from `<meta name="theme-color">` if valid, falling back to the theme
color from `"theme_color"` in the web application manifest (if specified). Only notify the
UIProcess of changes to `<meta name="theme-color">` or the `"theme_color"` in the web
application manifest if the new value is the value that would be used.
* html/HTMLMetaElement.cpp:
(WebCore::HTMLMetaElement::attributeChanged):
(WebCore::HTMLMetaElement::removedFromAncestor):
(WebCore::HTMLMetaElement::process):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::rootBackgroundColorOrTransparencyChanged):
Drive-by: Rename `Document::processThemeColor` to `Document::processMetaElementThemeColor`
so that it's more specific to `<meta name="theme-color">`.
* page/ChromeClient.h:
(WebCore::ChromeClient::themeColorChanged const):
(WebCore::ChromeClient::pageExtendedBackgroundColorDidChange const):
Drive-by: Remove the `Color` parameter since it's not actually used in the WebProcess.
2021-04-20 Michael Catanzaro <mcatanzaro@gnome.org>
Lots of spurious -Wnonnull warnings with GCC 11
https://bugs.webkit.org/show_bug.cgi?id=224452
Reviewed by Darin Adler.
* css/CSSValue.h:
(WebCore::CSSValue::deref):
* css/StyleRule.h:
(WebCore::StyleRuleBase::deref const):
* dom/Node.h:
(WebCore::Node::deref const):
2021-04-20 Wenson Hsieh <wenson_hsieh@apple.com>
Rename WebCore::SelectionRect to WebCore::SelectionGeometry
https://bugs.webkit.org/show_bug.cgi?id=224820
Reviewed by Megan Gardner.
To prepare for rendering non-rectilinear selection quads on iOS using UIKit, rename `WebCore::SelectionRect` to
`WebCore::SelectionGeometry`. In a subsequent patch, this class will be backed by a `FloatQuad` instead of an
`IntRect`, and will additionally contain a flag indicating whether it should render using the bounding rect of
the quad (and should additionally be coalesced with surrounding selection rects), or if it should render the
selection quad without coalescing.
No change in behavior.
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper textRectsFromMarkers:withText:]):
* page/DragController.cpp:
* page/TextIndicator.cpp:
(WebCore::initializeIndicator):
* platform/ios/SelectionGeometry.cpp: Renamed from Source/WebCore/platform/ios/SelectionRect.cpp.
(WebCore::SelectionGeometry::SelectionGeometry):
(WebCore::SelectionGeometry::setLogicalLeft):
(WebCore::SelectionGeometry::setLogicalWidth):
(WebCore::SelectionGeometry::setLogicalTop):
(WebCore::SelectionGeometry::setLogicalHeight):
(WebCore::operator<<):
* platform/ios/SelectionGeometry.h: Renamed from Source/WebCore/platform/ios/SelectionRect.h.
(WebCore::SelectionGeometry::rect const):
(WebCore::SelectionGeometry::logicalLeft const):
(WebCore::SelectionGeometry::logicalWidth const):
(WebCore::SelectionGeometry::logicalTop const):
(WebCore::SelectionGeometry::logicalHeight const):
(WebCore::SelectionGeometry::direction const):
(WebCore::SelectionGeometry::minX const):
(WebCore::SelectionGeometry::maxX const):
(WebCore::SelectionGeometry::maxY const):
(WebCore::SelectionGeometry::lineNumber const):
(WebCore::SelectionGeometry::isLineBreak const):
(WebCore::SelectionGeometry::isFirstOnLine const):
(WebCore::SelectionGeometry::isLastOnLine const):
(WebCore::SelectionGeometry::containsStart const):
(WebCore::SelectionGeometry::containsEnd const):
(WebCore::SelectionGeometry::isHorizontal const):
(WebCore::SelectionGeometry::isInFixedPosition const):
(WebCore::SelectionGeometry::isRubyText const):
(WebCore::SelectionGeometry::pageNumber const):
(WebCore::SelectionGeometry::setRect):
(WebCore::SelectionGeometry::setDirection):
(WebCore::SelectionGeometry::setMinX):
(WebCore::SelectionGeometry::setMaxX):
(WebCore::SelectionGeometry::setMaxY):
(WebCore::SelectionGeometry::setLineNumber):
(WebCore::SelectionGeometry::setIsLineBreak):
(WebCore::SelectionGeometry::setIsFirstOnLine):
(WebCore::SelectionGeometry::setIsLastOnLine):
(WebCore::SelectionGeometry::setContainsStart):
(WebCore::SelectionGeometry::setContainsEnd):
(WebCore::SelectionGeometry::setIsHorizontal):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::collectSelectionGeometries):
(WebCore::RenderImage::collectSelectionRects): Deleted.
* rendering/RenderImage.h:
* rendering/RenderLineBreak.cpp:
(WebCore::RenderLineBreak::collectSelectionGeometries):
(WebCore::RenderLineBreak::collectSelectionRects): Deleted.
* rendering/RenderLineBreak.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::collectSelectionGeometries):
(WebCore::adjustLineHeightOfSelectionGeometries):
(WebCore::coalesceSelectionGeometries):
(WebCore::RenderObject::collectSelectionGeometriesWithoutUnionInteriorLines):
(WebCore::RenderObject::collectSelectionGeometriesInternal):
(WebCore::RenderObject::collectSelectionRects): Deleted.
(WebCore::adjustLineHeightOfSelectionRects): Deleted.
(WebCore::coalesceSelectionRects): Deleted.
(WebCore::RenderObject::collectSelectionRectsWithoutUnionInteriorLines): Deleted.
(WebCore::RenderObject::collectSelectionRectsInternal): Deleted.
* rendering/RenderObject.h:
* rendering/RenderSelectionInfo.cpp:
(WebCore::RenderSelectionInfo::RenderSelectionInfo):
* rendering/RenderText.cpp:
(WebCore::RenderText::collectSelectionGeometries):
(WebCore::RenderText::collectSelectionGeometriesForLineBoxes):
(WebCore::RenderText::selectionRectForRepaint):
(WebCore::RenderText::collectSelectionRects): Deleted.
(WebCore::RenderText::collectSelectionRectsForLineBoxes): Deleted.
* rendering/RenderText.h:
2021-04-20 Sam Weinig <weinig@apple.com>
Separated models don't get opacity set on them at all
https://bugs.webkit.org/show_bug.cgi?id=224763
Reviewed by Tim Horton.
Test: model-element/model-element-graphics-layers-opacity.html
This certainly won't be the way things land once separated/optimized
layer semantics are better understood, but for now, it is useful to
explicitly propogate the opacity of the owing layer to the content
layer if the content layer is a model layer. In the future, we may want
to do this for any separated child (and conversely, only to the content
layer if it is separated), but this will allow us to play a bit futher
in our experimentation.
Also adds support for dumping the opacity of a content layer to make
this testable.
* platform/graphics/GraphicsLayerClient.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setContentsToModel):
(WebCore::GraphicsLayerCA::purposeNameForInnerLayer const):
(WebCore::GraphicsLayerCA::dumpInnerLayer const):
* testing/Internals.cpp:
(WebCore::toPlatformLayerTreeFlags):
* testing/Internals.h:
* testing/Internals.idl:
2021-04-20 Kate Cheney <katherine_cheney@apple.com>
Preconnect tasks and preflight checks do not correctly mark app-bound context string
https://bugs.webkit.org/show_bug.cgi?id=224779
<rdar://problem/76738879>
Reviewed by Brent Fulgham.
Tests: http/tests/in-app-browser-privacy/context-string-preconnect.html
http/tests/in-app-browser-privacy/context-string-preflight.html
* loader/CrossOriginAccessControl.cpp:
(WebCore::createAccessControlPreflightRequest):
CORS preflight case.
2021-04-20 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] Update date/time picker appearance
https://bugs.webkit.org/show_bug.cgi?id=224794
<rdar://problem/76785859>
Reviewed by Wenson Hsieh.
* en.lproj/Localizable.strings:
Remove now unused string.
* platform/LocalizedStrings.cpp:
* platform/LocalizedStrings.h:
* platform/cocoa/LocalizedStringsCocoa.mm:
(WebCore::formControlDoneButtonTitle):
Moved definition out of PLATFORM(WATCHOS) in LocalizedStrings.cpp and
into LocalizedStringsCocoa, so that the "Done" string can be used by
PLATFORM(IOS_FAMILY).
2021-04-20 Fujii Hironori <Hironori.Fujii@sony.com>
editing/execCommand/insert-image-in-composed-list.html is crashing
https://bugs.webkit.org/show_bug.cgi?id=224801
Reviewed by Don Olmstead.
This crash were happened for Release builds of GTK port compiled
by GCC and WinCairo port compiled by Clang 12.
As per the comment of Position::containerNode(), it returns null
in some cases.
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::removeRedundantBlocks): Added
null checking for the return value of Position::containerNode().
2021-04-20 Aditya Keerthi <akeerthi@apple.com>
REGRESSION (r275523): [iOS] Opaque system fill colors are incorrect in dark mode
https://bugs.webkit.org/show_bug.cgi?id=224800
<rdar://problem/76878335>
Reviewed by Darin Adler.
r275523 updated form control backgrounds to use opaque variants of
system colors. This change was implemented by blending the system
colors over a white background. However, in dark mode, the colors
should be blended over a black background, to retain a dark appearance.
Updated an existing test to validate the colors in light and dark mode.
* rendering/RenderThemeIOS.mm:
(WebCore::systemColorFromCSSValueSystemColorInformation):
Added a useDarkAppearance parameter, so that the system color can be
blended over black when necessary.
(WebCore::systemColorFromCSSValueID):
(WebCore::RenderThemeIOS::cssValueToSystemColorMap const):
2021-04-20 Basuke Suzuki <basuke.suzuki@sony.com>
Remove UNUSED warnings based on the configuration.
https://bugs.webkit.org/show_bug.cgi?id=224787
Reviewed by Darin Adler.
Added UNUSED_VARIABLE or its variant to suppress warnings based on the configuration.
No new tests because it just for suppression of the warnings.
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):
* page/PageConsoleClient.cpp:
(WebCore::snapshotCanvas):
* page/PerformanceLogging.cpp:
(WebCore::PerformanceLogging::didReachPointOfInterest):
* platform/graphics/freetype/FontCacheFreeType.cpp:
(WebCore::FontCache::systemFallbackForCharacters):
* platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
2021-04-19 Darin Adler <darin@apple.com>
Refactor sorted array mapping machinery in LocaleToScriptMapping.cpp for reuse elsewhere
https://bugs.webkit.org/show_bug.cgi?id=224733
Reviewed by Yusuke Suzuki.
* Modules/indexeddb/client/IDBConnectionToServer.h: Removed unneeded includes.
* Modules/mediastream/RTCRtpSFrameTransformer.h: Ditto.
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: Ditto.
* Modules/webauthn/AuthenticatorCoordinatorClient.h: Ditto.
* Modules/websockets/WebSocketChannel.cpp: Ditto.
* Modules/websockets/WebSocketDeflater.cpp: Ditto.
* bindings/IDLTypes.h: Ditto.
* bridge/jsc/BridgeJSC.h: Ditto.
* contentextensions/DFANode.h: Ditto.
* contentextensions/NFAToDFA.cpp: Ditto.
* contentextensions/Term.h: Ditto.
* css/typedom/StylePropertyMap.h: Ditto.
* css/typedom/StylePropertyMapReadOnly.cpp: Ditto.
* cssjit/SelectorCompiler.cpp: Ditto.
* platform/text/LocaleToScriptMapping.cpp:
(WebCore::scriptNameToCode): Refactor to use SortedArrayMap. Also changed to take StringView.
(WebCore::localeToScriptCodeForFontSelection): Ditto. Cut down on memory allocation by using
StringView instead of String while looping through substrings.
* platform/text/LocaleToScriptMapping.h: Changed scriptNameToCode to take StringView.
2021-04-20 Zalan Bujtas <zalan@apple.com>
[LFC] Implement Box::isSizeContainmentBox()
https://bugs.webkit.org/show_bug.cgi?id=224799
Reviewed by Antti Koivisto.
This is part of https://www.w3.org/TR/css-contain-2/#containment-size
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::isSizeContainmentBox const):
* layout/layouttree/LayoutBox.h:
2021-04-20 Kimmo Kinnunen <kkinnunen@apple.com>
AudioSourceProviderAVFObjC uses atomic variables but also locks with mutex
https://bugs.webkit.org/show_bug.cgi?id=224543
Reviewed by Darin Adler.
Remove the use of std::atomic, the variables are already protected by the
mutex.
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::provideInput):
(WebCore::AudioSourceProviderAVFObjC::process):
2021-04-20 Martin Robinson <mrobinson@webkit.org>
Re-land: Eliminate ScrollAnimatorGeneric::m_smoothAnimation
https://bugs.webkit.org/show_bug.cgi?id=222588
Reviewed by Žan Doberšek.
No new tests. This change should not change behavior.
Eliminate the extra ScrollAnimationSmooth in ScrollAnimatorGeneric. The base
class already knows how to do scroll animations for programmatic scrolls,
so we can reuse that animation for doing ScrollAnimator::scroll(...). This
makes the code easier to understand and should simplify managing interactions
between the different animations in the future.
Changes since first version: Now only update the current position of the animation
if it is not active. This is the behavior that was used in ScrollAnimatorGeneric
and is the correct behavior when using ScrollAnimationSmooth.
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::ScrollAnimator): Renamed m_animationProgrammaticScroll
to m_scrollAnimation. The more generic name reflects the fact that it is also
used for doing scrolling from UI interaction now.
(WebCore::ScrollAnimator::scroll): Use the ScrollAnimationSmooth member to do
animated scrolls when necessary.
(WebCore::ScrollAnimator::scrollToPositionWithoutAnimation): Make sure the animation
is up to date with the current position when scrolling without it. This is
how ScrollAnimatorGeneric treated its ScrollAnimationSmooth.
(WebCore::ScrollAnimator::scrollToPositionWithAnimation): Rename member.
(WebCore::ScrollAnimator::cancelAnimations): Ditto.
(WebCore::ScrollAnimator::willEndLiveResize): Ditto.
(WebCore::ScrollAnimator::didAddVerticalScrollbar): Ditto.
(WebCore::ScrollAnimator::didAddHorizontalScrollbar): Ditto.
* platform/ScrollAnimator.h: Ditto.
* platform/generic/ScrollAnimatorGeneric.cpp:
(WebCore::ScrollAnimatorGeneric::ScrollAnimatorGeneric): Eliminate ScrollAnimationSmooth.
(WebCore::ScrollAnimatorGeneric::scrollToPositionWithoutAnimation): Ditto.
(WebCore::ScrollAnimatorGeneric::didAddVerticalScrollbar): Ditto.
(WebCore::ScrollAnimatorGeneric::didAddHorizontalScrollbar): Ditto.
(WebCore::ScrollAnimatorGeneric::ensureSmoothScrollingAnimation): Deleted.
(WebCore::ScrollAnimatorGeneric::scroll): Deleted.
(WebCore::ScrollAnimatorGeneric::willEndLiveResize): Deleted.
* platform/generic/ScrollAnimatorGeneric.h:
2021-04-20 Chris Lord <clord@igalia.com>
Don't use the full CSS parser for CSSFontFaceSet
https://bugs.webkit.org/show_bug.cgi?id=224749
Reviewed by Darin Adler.
Replace use of the full CSS parser in CSSFontFaceSet with
CSSPropertyParserWorkerSafe::parseFont to parse font shorthands. This
makes CSSFontFaceSet safe to use in a Worker (required for
OffscreenCanvas) and ought also to be faster, at the cost of a slight
increase in lines of code.
No new tests, covered by existing tests.
* css/CSSFontFaceSet.cpp:
(WebCore::computeFontSelectionRequest):
(WebCore::CSSFontFaceSet::matchingFacesExcludingPreinstalledFonts):
2021-04-20 Tim Nguyen <ntim@apple.com>
Implement CSS display property 2-value syntax
https://bugs.webkit.org/show_bug.cgi?id=224574
Reviewed by Darin Adler.
Except for list-item which doesn't have layout support for different variants.
Also fix a WPT to expect the most backwards-compatible form for `display: flow` computed value.
Test: web-platform-tests/css/css-display/parsing/display-valid.html
* css/CSSValueKeywords.in:
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
(WebCore::CSSParserFastPaths::isKeywordPropertyID):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeDisplay):
(WebCore::CSSPropertyParser::parseSingleValue):
2021-04-19 Antti Koivisto <antti@apple.com>
Render tree updates for Text node content mutations should happen during rendering update
https://bugs.webkit.org/show_bug.cgi?id=222406
<rdar://problem/74822830>
Reviewed by Simon Fraser.
Calls to Text.insertData and similar should not mutate render tree synchronously.
Instead render tree should be updated during the next rendering update along with
any style changes.
These updates already go via RenderTreeUpdater. We just need to save the information
about which nodes need updating so the next rendering update can pick them up.
This seems to help with some performance benchmarks.
* dom/CharacterData.cpp:
(WebCore::CharacterData::parserAppendData):
(WebCore::CharacterData::setDataAndUpdate):
Move in-tree check to the updateRendererAfterContentChange and make it use isConnected().
* dom/Document.cpp:
(WebCore::Document::removedLastRef):
(WebCore::Document::resolveStyle):
Include the text update when updating the render tree.
(WebCore::Document::updateTextRenderer):
Create a text update that will get flushed during the next rendering update.
(WebCore::Document::needsStyleRecalc const):
We need to recalc if there are pending text updates.
* dom/Document.h:
* dom/Text.cpp:
(WebCore::Text::splitText):
Use updateRendererAfterContentChange instead of poking render tree directly.
(WebCore::Text::updateRendererAfterContentChange):
* rendering/updating/RenderTreeUpdater.cpp:
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::TreeResolver):
(WebCore::Style::TreeResolver::resolve):
* style/StyleTreeResolver.h:
(WebCore::Style::TreeResolver::TreeResolver):
* style/StyleUpdate.cpp:
(WebCore::Style::Update::addText):
Merge text updates.
(WebCore::Style::Update::addPossibleRoot):
* style/StyleUpdate.h:
(WebCore::Style::Update::roots const):
(WebCore::Style::Update:: const): Deleted.
Refcount the nodes since this now has longer lifetime.
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::deleteInsignificantText):
Ensure we leave deleteInsignificantText with updated render tree. Clients expect that.
Do layout (instead of just style update) for consistency, deleteInsignificantText does one anyway in beginning.
* editing/markup.cpp:
(WebCore::replaceChildrenWithFragment):
Pending text update may ref the node so this refcount assert is not correct.
* style/StyleUpdate.cpp:
(WebCore::Style::Update::addText):
2021-04-19 Said Abou-Hallawa <said@apple.com>
cachedCGColor() and nsColor() are not thread-safe
https://bugs.webkit.org/show_bug.cgi?id=223033
Reviewed by Chris Dumez.
These functions will break if they are used by a worker thread.
* platform/graphics/cg/ColorCG.cpp:
(WebCore::cachedCGColor):
* platform/graphics/mac/ColorMac.mm:
(WebCore::nsColor):
2021-04-19 Wenson Hsieh <wenson_hsieh@apple.com>
Rename FloatQuad::isEmpty() to boundingBoxIsEmpty() and reimplement isEmpty()
https://bugs.webkit.org/show_bug.cgi?id=224769
Reviewed by Tim Horton.
The existing `isEmpty()` method on `FloatQuad` only checks that the bounding box of the quad is empty (as
indicated by the comment above the method declaration). This means `isEmpty()` returns `false` in cases where
the quad consists of one or more non-rectilinear line segments, even though the quad contains no area.
To address this, we rename the existing `isEmpty()` helper to `boundingBoxIsEmpty()` and reintroduce an
`isEmpty()` method that accounts for quads which are equivalent to non-rectilinear line segments.
No change in behavior.
* inspector/InspectorOverlay.cpp:
(WebCore::drawFragmentHighlight):
* platform/graphics/FloatQuad.cpp:
* platform/graphics/FloatQuad.h:
(WebCore::FloatQuad::isEmpty const): Deleted.
(WebCore::FloatQuad::boundingBoxIsEmpty const):
2021-04-19 Patrick Angle <pangle@apple.com>
Web Inspector: Grid overlay column line label placement copy/paste error
https://bugs.webkit.org/show_bug.cgi?id=224777
Reviewed by Devin Rousso.
In grid overlays, a typo meant for all column line labels after the initial line, only the start of the line was
used for placement, where it is more accurate to use the start and end points to match the behavior of the first
line. This had no visual impact because subsequent lines do not currently have their labels adjusted further into
the grid, only flipped into the grid but still referencing the same point. This patch corrects the value of
`gapLabelLine` to always be a line on which the label can be placed, instead of a single point.
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::buildGridOverlay):
2021-04-19 Zalan Bujtas <zalan@apple.com>
[LFC][IFC] LineCandidate.inlineContent should be ignored when reverting
https://bugs.webkit.org/show_bug.cgi?id=224771
<rdar://76760857>
Reviewed by Antti Koivisto.
LineCandidate.inlineContent is a set of candidate runs for the line and when the line breaker says "please revert" (move back to an earlier position on the line)
these runs should all be ignored as they did not make it to the line.
(inlineContentIsFullyCommitted flag got confused when the number of candidate runs matched the number of runs we managed to put on the line as part of the revert. It did not take the "revert" bit into account.)
Test: fast/inline/crash-when-revert-has-trailing-line-break.html
* layout/inlineformatting/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::placeInlineContent):
2021-04-19 Chris Dumez <cdumez@apple.com>
SVG Images launch the GPUProcess unnecessarily
https://bugs.webkit.org/show_bug.cgi?id=224770
Reviewed by Eric Carlson.
Make sure MediaPlayer::supportsType() returns early for MIME types that can definitely
not be media, to avoid launch the GPUProcess unnecessarily.
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::supportsType):
2021-04-19 Manuel Rego Casasnovas <rego@igalia.com>
[selectors] Script focus and :focus-visible
https://bugs.webkit.org/show_bug.cgi?id=224598
Reviewed by Darin Adler.
Implement :focus-visible behavior when a script moves focus.
An element will match :focus-visible when a script move focus if the last focused element was not focused via mouse click.
This patch makes WebKit behaves like Chromium and Firefox and pass all the related tests.
There's an ongoing discussion about 6 tests that are marked as ".tentative" in the following issue:
https://github.com/web-platform-tests/wpt/issues/28505
Test: web-platform-tests/css/selectors/focus-visible-script-focus-*
* dom/Document.cpp:
(WebCore::Document::adjustFocusedNodeOnNodeRemoval): Just update FocusOptions initializer.
(WebCore::Document::setFocusedElement): Store if the last element has been focused by mouse click or not.
* dom/Document.h: New member m_latestFocusTrigger.
(WebCore::Document::wasLastFocusByClick const): Method to check status of m_latestFocusTrigger.
* dom/Element.cpp:
(WebCore::Element::focus): When there's a script focus, this checks if the last element was focused
by mouse click in order to make it match :focus-visible.
* dom/FocusOptions.h: Add FocusTrigger enum to know if an element has been focused via mouse click or not.
This refers to the "focus trigger" concept on the HTML spec (see https://html.spec.whatwg.org/multipage/interaction.html).
* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchMouseEvent): Pass FocusTrigger:Click in setFocusedElement() call.
2021-04-19 Darin Adler <darin@apple.com>
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-19 Antti Koivisto <antti@apple.com>
CSSValuePool should be non-copyable
https://bugs.webkit.org/show_bug.cgi?id=224764
Reviewed by Alan Bujtas.
* css/CSSValuePool.h:
2021-04-19 Zalan Bujtas <zalan@apple.com>
[LFC] The layout containment box establishes an absolute positioning containing block and a fixed positioning containing block
https://bugs.webkit.org/show_bug.cgi?id=224754
Reviewed by Antti Koivisto.
https://www.w3.org/TR/css-contain-2/#containment-layout.
"The layout containment box establishes an absolute positioning containing block and a fixed positioning containing block."
* layout/layouttree/LayoutBox.h:
(WebCore::Layout::Box::isContainingBlockForFixedPosition const):
(WebCore::Layout::Box::isContainingBlockForOutOfFlowPosition const):
2021-04-19 Zalan Bujtas <zalan@apple.com>
[LFC] Layout containment box establishes an independent formatting context
https://bugs.webkit.org/show_bug.cgi?id=224753
Reviewed by Antti Koivisto.
https://www.w3.org/TR/css-contain-2/#containment-layout.
"The layout containment box establishes an independent formatting context."
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::establishesIndependentFormattingContext const):
2021-04-19 Michael Catanzaro <mcatanzaro@gnome.org>
Silence various -Wreturn-type warnings
https://bugs.webkit.org/show_bug.cgi?id=224756
Reviewed by Don Olmstead.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::mixColorComponents):
* inspector/InspectorOverlay.cpp:
(WebCore::expectedSizeForLayoutLabel):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::usedClear):
(WebCore::RenderStyle::usedFloat):
2021-04-19 Wenson Hsieh <wenson_hsieh@apple.com>
Unreviewed, fix the build after r276181
<rdar://problem/76832595>
Add a couple of missing forward declarations for `IntRect` and `IntPoint`.
* page/ContextMenuClient.h:
2021-04-19 Youenn Fablet <youenn@apple.com>
Add assertions to check for no memory allocation in AudioMediaStreamTrackRendererUnit rendering thread
https://bugs.webkit.org/show_bug.cgi?id=224674
Reviewed by Eric Carlson.
Add ForbidMallocUseForCurrentThreadScope in audio rendering code path to prevent memory allocation.
Rename inputProc to renderingCallback.
Remove use of AudioMediaStreamTrackRendererUnit::singleton and instead use the pointer given to renderingCallback.
This is safe as AudioMediaStreamTrackRendererUnit destructor stops the audio unit.
* platform/mediastream/mac/AudioMediaStreamTrackRendererUnit.cpp:
(WebCore::AudioMediaStreamTrackRendererUnit::createAudioUnitIfNeeded):
(WebCore::AudioMediaStreamTrackRendererUnit::render):
(WebCore::AudioMediaStreamTrackRendererUnit::renderingCallback):
(WebCore::AudioMediaStreamTrackRendererUnit::inputProc): Deleted.
* platform/mediastream/mac/AudioMediaStreamTrackRendererUnit.h:
2021-04-19 Zalan Bujtas <zalan@apple.com>
[LFC] Implement Box::isLayoutContainmentBox
https://bugs.webkit.org/show_bug.cgi?id=224740
Reviewed by Antti Koivisto.
This is part of https://www.w3.org/TR/css-contain-2/#containment-layout
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::isLayoutContainmentBox const):
(WebCore::Layout::Box::isInternalTableBox const):
* layout/layouttree/LayoutBox.h:
(WebCore::Layout::Box::isInternalRubyBox const):
2021-04-19 Kimmo Kinnunen <kkinnunen@apple.com>
Enable -Wthread-safety, add attributes to custom lock classes, and provide macros to declare guards
https://bugs.webkit.org/show_bug.cgi?id=221614
<rdar://problem/74396781>
Reviewed by David Kilzer.
Add -Wthread-safety to compile flags.
* Configurations/Base.xcconfig:
2021-04-19 Youenn Fablet <youenn@apple.com>
Make RealtimeIncomingAudioSourceCocoa preallocate audio buffer
https://bugs.webkit.org/show_bug.cgi?id=224672
Reviewed by Eric Carlson.
Instead of allocating the buffer on valid data, we wait for data to be of the correct sample rate.
We preallocate the buffer accordingly in constructor to avoid allocation in the webrtc audio thread.
Default is 1 channel since mono is what webrtc encoders mostly do these days.
Covered by existing tests.
* platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:
(WebCore::RealtimeIncomingAudioSourceCocoa::RealtimeIncomingAudioSourceCocoa):
(WebCore::RealtimeIncomingAudioSourceCocoa::OnData):
2021-04-19 Youenn Fablet <youenn@apple.com>
Move from RecursiveLock to Lock in RealtimeMediaSource
https://bugs.webkit.org/show_bug.cgi?id=224671
Reviewed by Eric Carlson.
RecursiveLock is more expensive as it allocates memory and not useful here.
Covered by existing tests.
* platform/mediastream/RealtimeMediaSource.h:
* platform/mediastream/RealtimeOutgoingAudioSource.h:
* platform/mediastream/RealtimeOutgoingVideoSource.h:
2021-04-19 Youenn Fablet <youenn@apple.com>
Reduce crackling at start of playing a live audio track
https://bugs.webkit.org/show_bug.cgi?id=218898
<rdar://problem/71625010>
Reviewed by Eric Carlson.
We often hear crackles at the beginning of playing a MediaStreamTrack.
This is due to starting at a point where there is not enough data, so we start rendering and quickly run short of data.
Our heuristic to start was not good since we were not accounting to LibWebRTC audio module which sends audio samples by batch of 5 samples.
So we would have needed to at least have 6 samples to be sure to not run out of data.
What this patch does:
- Add an extra parameter to AudioSampleDataSource so that we do not start until we have at least been pushed a given number of sample count.
- Change LibWebRTAudioModule to send audio samples by batch of 3 (hence 30 ms) instead of 5
- Set this new parameter to 2 for local tracks and 4 for remote tracks
- Add a new boolean to AudioSampleDataSource to know whether we start the track for the first time or not. If we start it, use the new parameter to buffer enough data.
Otherwise, use current heuristic.
We also reduce the AudioSampleDataSource buffer to 0.5 seconds instead of 2 seconds, since 2 seconds is too much for real time audio.
Manually tested.
* platform/audio/cocoa/AudioSampleDataSource.h:
* platform/audio/cocoa/AudioSampleDataSource.mm:
(WebCore::AudioSampleDataSource::create):
(WebCore::AudioSampleDataSource::AudioSampleDataSource):
(WebCore::AudioSampleDataSource::pullSamplesInternal):
* platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
(WebCore::LibWebRTCAudioModule::pollFromSource):
* platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
* platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.cpp:
(WebCore::pollSamplesCount):
(WebCore::AudioMediaStreamTrackRendererCocoa::pushSamples):
* platform/mediastream/mac/MediaStreamTrackAudioSourceProviderCocoa.cpp:
(WebCore::MediaStreamTrackAudioSourceProviderCocoa::MediaStreamTrackAudioSourceProviderCocoa):
* platform/mediastream/mac/WebAudioSourceProviderCocoa.h:
* platform/mediastream/mac/WebAudioSourceProviderCocoa.mm:
(WebCore::WebAudioSourceProviderCocoa::prepare):
2021-04-19 Imanol Fernandez <ifernandez@igalia.com>
Enable GL_ANGLE_instanced_arrays WebGL extension in WPE
https://bugs.webkit.org/show_bug.cgi?id=224438
Reviewed by Darin Adler.
Tested by WebGL WPT.
* html/canvas/ANGLEInstancedArrays.cpp:
(WebCore::ANGLEInstancedArrays::supported):
* platform/graphics/opengl/ExtensionsGLOpenGLES.cpp:
(WebCore::ExtensionsGLOpenGLES::supportsExtension):
2021-04-19 Felipe Erias <felipeerias@igalia.com>
[css-flexbox] Table layout disregards overriding height
https://bugs.webkit.org/show_bug.cgi?id=224665
Reviewed by Sergio Villar Senin.
Update table layout to take into account the overriding height set by the element's parent.
This was causing several WPT tests to fail.
* rendering/RenderTable.cpp:
(WebCore::RenderTable::layout):
During layout, set the computed height so that it is at least as large as the overriding height
provided by the element's parent (if any) minus the height that will be taken up by captions.
This additional height will be distributed among the table's sections so its total height matches
the overriding value.
2021-04-19 Martin Robinson <mrobinson@webkit.org>
[css-scroll-snap] Properly support fractional scroll steps in WebCore::ScrollAnimator::scroll
https://bugs.webkit.org/show_bug.cgi?id=224176
Reviewed by Simon Fraser.
Stop using the ScrollableArea's position to calculate scroll snap positions in ScrollAnimator::snap.
The position stored in ScrollAnimator is a floating point position, while the one stored in ScrollableArea
is an integer position. This currently isn't an issue, because all callers of ScrollAnimator::scroll
use integer scroll offsets, but this will allow this function to be used in the future for precise
scrolling delta.
No new tests. This doesn't change any behavior, since all callers currently use
integer scroll offsets, but a future change will make use of this fix.
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::scroll): Get the current scroll position from the ScrollAnimator,
which stores it in floating point. Also, only call into the scroll snap code if we actually
have scroll offsets.
(WebCore::ScrollAnimator::offsetFromPosition): Added this helper.
(WebCore::ScrollAnimator::positionFromOffset): Ditto.
(WebCore::ScrollAnimator::deltaFromStep): Return a delta instead of a position so this helper
can be used with offsets or positions.
(WebCore::ScrollAnimator::positionFromStep): Deleted.
* platform/ScrollAnimator.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::scroll): Use the new helper.j
2021-04-19 Philippe Normand <pnormand@igalia.com>
[WPE][GTK] Enable AVIF decoder as experimental feature and unskip tests
https://bugs.webkit.org/show_bug.cgi?id=224663
Reviewed by Xabier Rodriguez-Calvar.
Refactor the AVIF build options out of the GTK port so they can be reused by other CMake ports.
* PlatformGTK.cmake:
* platform/ImageDecoders.cmake:
* platform/image-decoders/avif/AVIFImageDecoder.cpp:
* platform/image-decoders/avif/AVIFImageReader.cpp:
* platform/image-decoders/avif/AVIFUniquePtr.h:
2021-04-18 Wenson Hsieh <wenson_hsieh@apple.com>
Selected image overlay text should never be visible
https://bugs.webkit.org/show_bug.cgi?id=224734
<rdar://problem/76806399>
Reviewed by Darin Adler.
Make a slight adjustment to the UA stylesheet to ensure that image overlay text is never visible. See below for
more details.
Test: fast/images/image-extraction/image-overlay-with-selection-styles.html
* html/shadow/imageOverlay.css:
(div.image-overlay-text::selection):
Enforce selected text styles for image overlay text.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::selectionPseudoStyle const):
Make an additional adjustment when computing selection pseudo styles for UA shadow root content. Currently, for
elements inside a UA shadow root, we always immediately ascend to the shadow host; this means that `::selection`
pseudo selectors currently don't work in UA stylesheets, since they're skipped when resolving styles, upon
painting selected text.
To fix this, we can let the element's own pseudo styles take precedence over the shadow host's renderer in the
case where we have a selection pseudo style. While we're here, also replace a few raw pointers with `RefPtr`.
2021-04-18 Rob Buis <rbuis@igalia.com>
Support contain: layout
https://bugs.webkit.org/show_bug.cgi?id=223569
Reviewed by Darin Adler.
This patch implements layout containment as specified[1].
It adds shouldApplyLayoutContainment to check whether the
element applies for layout containment. Is so, then:
- an independent formatting context is established.
- any overflow is treated as ink overflow.
- an absolute positioning and fixed positioning
containing block is established.
- a stacking context is created.
- for baseline handling, the box is treated as having no
baseline. For grid/flexible box containers/items, this needs
a baseline synthesized from the border edges [2], for buttons it
requires a baseline synthesized from the margin edges [2, 3].
[1] https://drafts.csswg.org/css-contain-2/#layout-containment
[2] https://drafts.csswg.org/css-align-3/#synthesize-baseline
[3] https://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::firstLineBaseline const):
(WebCore::RenderBlock::inlineBlockBaseline const):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::firstLineBaseline const):
(WebCore::RenderBlockFlow::inlineBlockBaseline const):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::createsNewFormattingContext const):
(WebCore::RenderBox::layoutOverflowRectForPropagation const):
* rendering/RenderBox.h:
* rendering/RenderButton.cpp:
(WebCore::RenderButton::baselinePosition const):
* rendering/RenderElement.h:
(WebCore::RenderElement::canContainFixedPositionObjects const):
(WebCore::RenderElement::canContainAbsolutelyPositionedObjects const):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::firstLineBaseline const):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::firstLineBaseline const):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::baselinePosition const):
* rendering/RenderObject.cpp:
(WebCore::objectIsRelayoutBoundary):
(WebCore::shouldApplyLayoutContainment):
* rendering/RenderObject.h:
(WebCore::RenderObject::isAtomicInlineLevelBox const):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::firstLineBaseline const):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::containsLayout const):
* style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::adjust const):
2021-04-18 Sam Weinig <weinig@apple.com>
GraphicsLayer::distributeOpacity, GraphicsLayer::setOpacityInternal and GraphicsLayer::accumulatedOpacity are never used
https://bugs.webkit.org/show_bug.cgi?id=224732
Reviewed by Darin Adler.
Remove dead code.
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::accumulatedOpacity const): Deleted.
(WebCore::GraphicsLayer::distributeOpacity): Deleted.
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::setOpacityInternal): Deleted.
* platform/graphics/ca/GraphicsLayerCA.cpp:
* platform/graphics/ca/GraphicsLayerCA.h:
2021-04-18 Antoine Quint <graouts@webkit.org>
Fix interpolation of the rotate CSS property
https://bugs.webkit.org/show_bug.cgi?id=224730
Reviewed by Dean Jackson.
Implement the CSS Transforms spec about animating the rotateZ() function
for the simplified case where only the angle is interpolated.
* platform/graphics/transforms/RotateTransformOperation.cpp:
(WebCore::RotateTransformOperation::blend):
2021-04-18 Youenn Fablet <youenn@apple.com>
Blob URLs should use for their owner origin for CSP checks
https://bugs.webkit.org/show_bug.cgi?id=224535
<rdar://76458106>
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-04-18 Cathie Chen <cathiechen@igalia.com>
The implicit aspect-ratio from width and height attributes with float value is not accurate enough
https://bugs.webkit.org/show_bug.cgi?id=224664
Reviewed by Darin Adler.
The width and height attributes should impact the aspect ratio only not the intrinsic size which should be from the content.
Since computeAspectRatioInformationForRenderBox doesn't change the intrinsic size now, so we can remove it from computePreferredLogicalWidths.
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeIntrinsicRatioInformation const): Width and height attributes change intrinsicRatio only, not intrinsicSize.
(WebCore::RenderReplaced::computePreferredLogicalWidths): computeAspectRatioInformationForRenderBox doesn't change intrinsicSize now, so we can remove this.
2021-04-17 Yusuke Suzuki <ysuzuki@apple.com>
Use binary-search in LocaleToScriptMapping
https://bugs.webkit.org/show_bug.cgi?id=224727
Reviewed by Darin Adler.
This patch removes HashMaps in LocaleToScriptMapping, and binary-search onto the constant data arrays.
These maps are not frequently used. Keys of the maps can be encoded into uint32_t or uint64_t so that
comparison becomes super cheap and we can initialize this array at compile-time.
We introduce ScriptName(uint32_t) and LocaleName(uint64_t) instead of String. And ues it and generate
sorted constant data array for mappings. We use binary-search to look entry up. Since # of entries are
not huge (~200), comparisons are extremely cheap (uint32_t / uint64_t comparison), and this is not a
hot code, we can just use binary-search here and eliminate HashMaps' memory allocation.
* platform/text/LocaleToScriptMapping.cpp:
(WebCore::PackedASCIILowerCodes::PackedASCIILowerCodes):
(WebCore::PackedASCIILowerCodes::parse):
(WebCore::PackedASCIILowerCodes::operator==):
(WebCore::PackedASCIILowerCodes::operator!=):
(WebCore::PackedASCIILowerCodes::operator<):
(WebCore::PackedASCIILowerCodes::operator<=):
(WebCore::PackedASCIILowerCodes::operator>):
(WebCore::PackedASCIILowerCodes::operator>=):
(WebCore::PackedASCIILowerCodes::value const):
(WebCore::scriptNameToCode):
(WebCore::localeToScriptCodeForFontSelection):
2021-04-17 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Add some support for webpage translation in WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=224683
<rdar://problem/75641882>
Reviewed by Darin Adler.
Remove compile-time guards around `ContextMenuItemTagAddHighlightToCurrentGroup` and
`ContextMenuItemTagAddHighlightToNewGroup`, so that we can keep these internal WebCore context menu tags in sync
with the SPI-exposed enum values in `WebUIDelegatePrivate.h`. See WebKitLegacy ChangeLog for more details.
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
(WebCore::ContextMenuController::checkOrEnableIfNeeded const):
* platform/ContextMenuItem.cpp:
(WebCore::isValidContextMenuAction):
* platform/ContextMenuItem.h:
2021-04-17 Wenson Hsieh <wenson_hsieh@apple.com>
Remove PromisedAttachmentInfo::blobURL and adjacent code
https://bugs.webkit.org/show_bug.cgi?id=224720
Reviewed by Ryosuke Niwa.
Remove this member of `PromisedAttachmentInfo`. See WebKit ChangeLog for more details.
* editing/Editor.cpp:
(WebCore::Editor::promisedAttachmentInfo):
* platform/PromisedAttachmentInfo.h:
(WebCore::PromisedAttachmentInfo::operator bool const):
2021-04-17 Tim Nguyen <ntim@apple.com>
Add support for inline-{start/end} values to float & clear properties
https://bugs.webkit.org/show_bug.cgi?id=218087
Reviewed by Antti Koivisto & Zalan Bujtas.
Imported reftests from: https://github.com/web-platform-tests/wpt/commit/47e7176242e2ca4ca68d6cfe032619ccf44d55a6
Enabled: imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear.html
Tests: imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-1.html
imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-2.html
imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-3.html
imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-4.html
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator Clear const):
(WebCore::CSSPrimitiveValue::operator Float const):
* css/CSSValueKeywords.in:
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
* display/css/DisplayStyle.cpp:
(WebCore::Display::Style::Style):
* layout/integration/LayoutIntegrationBoxTree.cpp:
(WebCore::LayoutIntegration::BoxTree::buildTree):
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::isFloatingPositioned const):
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::TreeBuilder::createLayoutBox):
(WebCore::Layout::TreeBuilder::buildTableStructure):
* rendering/ComplexLineLayout.cpp:
(WebCore::ComplexLineLayout::layoutRunsAndFloats):
(WebCore::ComplexLineLayout::layoutRunsAndFloatsInRange):
* rendering/FloatingObjects.cpp:
(WebCore::FloatingObject::FloatingObject):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeBlockPreferredLogicalWidths const):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::marginOffsetForSelfCollapsingBlock):
(WebCore::RenderBlockFlow::marginBeforeEstimateForChild const):
(WebCore::RenderBlockFlow::computeLogicalLocationForFloat):
(WebCore::RenderBlockFlow::positionNewFloats):
(WebCore::RenderBlockFlow::clearFloats):
(WebCore::RenderBlockFlow::getClearDelta):
(WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
* rendering/RenderBlockFlow.h:
* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleBR):
* rendering/line/LineBreaker.cpp:
(WebCore::LineBreaker::reset):
* rendering/line/LineBreaker.h:
(WebCore::LineBreaker::usedClear):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::usedClear):
(WebCore::RenderStyle::usedFloat):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::isFloating const):
(WebCore::RenderStyle::initialFloating):
* rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<):
* rendering/style/RenderStyleConstants.h:
* style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::adjust const):
2021-04-17 Basuke Suzuki <basuke.suzuki@sony.com>
[Curl] Remove warnings on curl layer.
https://bugs.webkit.org/show_bug.cgi?id=224721
Reviewed by Darin Adler.
Remove unused parameters to prevent warnings. For CurlRequest, it passes
member variable to private method which is meaningless so that it was
removed.
Covered by existing test files.
* platform/network/curl/CookieJarDB.cpp:
(WebCore::CookieJarDB::createPrepareStatement):
* platform/network/curl/CurlFormDataStream.cpp:
(WebCore::CurlFormDataStream::read):
* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::setupTransfer):
(WebCore::CurlRequest::setupPUT):
(WebCore::CurlRequest::setupPOST):
* platform/network/curl/CurlRequest.h:
* platform/network/curl/NetworkStorageSessionCurl.cpp:
(WebCore::NetworkStorageSession::setCookiesFromDOM const):
2021-04-17 Chris Lord <clord@igalia.com>
Create local copy of CSSParserContext in CSSPropertyParserWorkerSafe
https://bugs.webkit.org/show_bug.cgi?id=224675
Reviewed by Darin Adler.
Make sure to hold a copy of the CSSParserContext in
CSSPropertyParserWorkerSafe functions as CSSParserImpl only takes a
reference.
* css/parser/CSSParserWorkerSafe.cpp:
2021-04-17 Tyler Wilcock <twilco.o@protonmail.com>
Consider making CSSStyleSheet::rules() just an alias of CSSStyleSheet::cssRules().
https://bugs.webkit.org/show_bug.cgi?id=197725
Reviewed by Darin Adler.
To match other browsers (Blink and Gecko) and pass a WPT, CSSStyleSheet.rules now aliases
CSSStyleSheet.cssRulesForBindings. CSSStyleSheet.rulesForBindings is deleted.
Tested by
imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet.html.
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::rulesForBindings): Deleted.
(WebCore::CSSStyleSheet::rules): Deleted.
* css/CSSStyleSheet.h:
Change `rules()` to be an inlined alias for `cssRulesForBindings()`.
* css/CSSStyleSheet.idl:
Remove [ImplementedAs=rulesForBindings], as this function has been
deleted.
2021-04-17 Tyler Wilcock <twilco.o@protonmail.com>
Media queries with max-width greater than 999999999px evaluate to false
https://bugs.webkit.org/show_bug.cgi?id=224097
Reviewed by Darin Adler.
We now evaluate <length> values in media queries with double
precision instead of int precision to match other browsers and pass a WPT.
See similar method in Chromium:
https://github.com/chromium/chromium/blob/09a0b960b27f6e08fbe67ad97e6c4fb55ada383f/third_party/blink/renderer/core/css/media_query_evaluator.cc#L436
Test: fast/media/media-query-lengths-evaluate-with-double-precision.html
and WPT imported/w3c/web-platform-tests/css/mediaqueries/min-width-001.xht
* css/MediaQueryEvaluator.cpp:
(WebCore::computeLength):
Return Optional<double> rather than int& out-value.
(WebCore::deviceHeightEvaluate):
(WebCore::deviceWidthEvaluate):
(WebCore::heightEvaluate):
(WebCore::widthEvaluate):
Evaluate `length` values as doubles instead of ints.
2021-04-17 Zalan Bujtas <zalan@apple.com>
[Cleanup] Remove redundant BreakingContext::m_currentStyle
https://bugs.webkit.org/show_bug.cgi?id=224717
Reviewed by Antti Koivisto.
* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::BreakingContext):
(WebCore::BreakingContext::initializeForCurrentObject):
(WebCore::BreakingContext::handleBR):
(WebCore::BreakingContext::handleText):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):
2021-04-17 Brent Fulgham <bfulgham@apple.com>
Perform port blocking earlier in the load
https://bugs.webkit.org/show_bug.cgi?id=224525
<rdar://problem/75440591>
Unreviewed follow-up (suggested by David Kilzer)
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::willSendRequest): Restore an m_frame nullptr check.,
2021-04-17 Basuke Suzuki <basuke.suzuki@sony.com>
[clang 11] Remove warning when converting WebCore::maxValueForCssLength from int to float
https://bugs.webkit.org/show_bug.cgi?id=224714
Reviewed by Chris Dumez.
On clang 11, the conversion from const int WebCore::maxValueForCssLength (= 33554429) to
float generates conversion warning:
> warning: implicit conversion from 'const int' to 'float' changes value from 33554429 to 33554428
Changing the target type from float to double works for this. Length constructor accept double
so that there's no drawback with this change.
No test because it's compiler behavior.
* style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertWordSpacing):
2021-04-17 Sam Weinig <weinig@apple.com>
Move RuntimeEnabledFeatures to Settings (Part 1)
https://bugs.webkit.org/show_bug.cgi?id=224440
Reviewed by Alex Christensen.
Move a few RuntimeEnabledFeatures to Settings to consolidate settings
in one object and removes the need for additional boilerplate. This
is now possible as Settings are now accessible in workers.
Moves PeerConnectionEnabled, WebGLUsingMetal, WebGL2Enabled, WebGPUEnabled
and MaskWebGLStringsEnabled.
* Modules/mediastream/RTCAnswerOptions.idl:
* Modules/mediastream/RTCCertificate.idl:
* Modules/mediastream/RTCConfiguration.idl:
* Modules/mediastream/RTCDTMFSender.idl:
* Modules/mediastream/RTCDTMFToneChangeEvent.idl:
* Modules/mediastream/RTCDataChannel.idl:
* Modules/mediastream/RTCDataChannelEvent.idl:
* Modules/mediastream/RTCIceCandidate.idl:
* Modules/mediastream/RTCIceCandidateInit.idl:
* Modules/mediastream/RTCIceConnectionState.idl:
* Modules/mediastream/RTCIceGatheringState.idl:
* Modules/mediastream/RTCIceServer.idl:
* Modules/mediastream/RTCIceTransport.idl:
* Modules/mediastream/RTCIceTransportState.idl:
* Modules/mediastream/RTCOfferAnswerOptions.idl:
* Modules/mediastream/RTCOfferOptions.idl:
* Modules/mediastream/RTCPeerConnection.idl:
* Modules/mediastream/RTCPeerConnectionIceErrorEvent.idl:
* Modules/mediastream/RTCPeerConnectionIceEvent.idl:
* Modules/mediastream/RTCPeerConnectionState.idl:
* Modules/mediastream/RTCPriorityType.idl:
* Modules/mediastream/RTCRtcpParameters.idl:
* Modules/mediastream/RTCRtpCapabilities.idl:
* Modules/mediastream/RTCRtpCodecCapability.idl:
* Modules/mediastream/RTCRtpCodecParameters.idl:
* Modules/mediastream/RTCRtpCodingParameters.idl:
* Modules/mediastream/RTCRtpContributingSource.idl:
* Modules/mediastream/RTCRtpDecodingParameters.idl:
* Modules/mediastream/RTCRtpEncodingParameters.idl:
* Modules/mediastream/RTCRtpFecParameters.idl:
* Modules/mediastream/RTCRtpHeaderExtensionParameters.idl:
* Modules/mediastream/RTCRtpParameters.idl:
* Modules/mediastream/RTCRtpReceiver.idl:
* Modules/mediastream/RTCRtpRtxParameters.idl:
* Modules/mediastream/RTCRtpSendParameters.idl:
* Modules/mediastream/RTCRtpSender.idl:
* Modules/mediastream/RTCRtpSynchronizationSource.idl:
* Modules/mediastream/RTCRtpTransceiver.idl:
* Modules/mediastream/RTCRtpTransceiverDirection.idl:
* Modules/mediastream/RTCSdpType.idl:
* Modules/mediastream/RTCSessionDescription.idl:
* Modules/mediastream/RTCSignalingState.idl:
* Modules/mediastream/RTCStatsReport.idl:
* Modules/mediastream/RTCTrackEvent.idl:
* Modules/webgpu/GPUBindGroupLayoutBinding.idl:
* Modules/webgpu/GPUBindGroupLayoutDescriptor.idl:
* Modules/webgpu/GPUBlendDescriptor.idl:
* Modules/webgpu/GPUBufferDescriptor.idl:
* Modules/webgpu/GPUBufferUsage.idl:
* Modules/webgpu/GPUCanvasContext.idl:
* Modules/webgpu/GPUColor.idl:
* Modules/webgpu/GPUColorStateDescriptor.idl:
* Modules/webgpu/GPUColorWrite.idl:
* Modules/webgpu/GPUCompareFunction.idl:
* Modules/webgpu/GPUDepthStencilStateDescriptor.idl:
* Modules/webgpu/GPUErrorFilter.idl:
* Modules/webgpu/GPUExtent3D.idl:
* Modules/webgpu/GPULoadOp.idl:
* Modules/webgpu/GPUOrigin3D.idl:
* Modules/webgpu/GPUOutOfMemoryError.idl:
* Modules/webgpu/GPURequestAdapterOptions.idl:
* Modules/webgpu/GPUSamplerDescriptor.idl:
* Modules/webgpu/GPUShaderStage.idl:
* Modules/webgpu/GPUStoreOp.idl:
* Modules/webgpu/GPUTextureDescriptor.idl:
* Modules/webgpu/GPUTextureFormat.idl:
* Modules/webgpu/GPUTextureUsage.idl:
* Modules/webgpu/GPUUncapturedErrorEvent.idl:
* Modules/webgpu/GPUValidationError.idl:
* Modules/webgpu/GPUVertexAttributeDescriptor.idl:
* Modules/webgpu/GPUVertexBufferDescriptor.idl:
* Modules/webgpu/GPUVertexInputDescriptor.idl:
* Modules/webgpu/Navigator+GPU.idl:
* Modules/webgpu/NavigatorGPU.cpp:
* Modules/webgpu/WebGPU.idl:
* Modules/webgpu/WebGPUAdapter.idl:
* Modules/webgpu/WebGPUBindGroup.idl:
* Modules/webgpu/WebGPUBindGroupBinding.idl:
* Modules/webgpu/WebGPUBindGroupDescriptor.idl:
* Modules/webgpu/WebGPUBindGroupLayout.idl:
* Modules/webgpu/WebGPUBuffer.idl:
* Modules/webgpu/WebGPUBufferBinding.idl:
* Modules/webgpu/WebGPUCommandBuffer.idl:
* Modules/webgpu/WebGPUCommandEncoder.idl:
* Modules/webgpu/WebGPUComputePassEncoder.idl:
* Modules/webgpu/WebGPUComputePipeline.idl:
* Modules/webgpu/WebGPUComputePipelineDescriptor.idl:
* Modules/webgpu/WebGPUDevice.idl:
* Modules/webgpu/WebGPUDeviceErrorScopes.idl:
* Modules/webgpu/WebGPUDeviceEventHandler.idl:
* Modules/webgpu/WebGPUPipelineDescriptorBase.idl:
* Modules/webgpu/WebGPUPipelineLayout.idl:
* Modules/webgpu/WebGPUPipelineLayoutDescriptor.idl:
* Modules/webgpu/WebGPUProgrammablePassEncoder.idl:
* Modules/webgpu/WebGPUProgrammableStageDescriptor.idl:
* Modules/webgpu/WebGPUQueue.idl:
* Modules/webgpu/WebGPURenderPassDescriptor.idl:
* Modules/webgpu/WebGPURenderPassEncoder.idl:
* Modules/webgpu/WebGPURenderPipeline.idl:
* Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
* Modules/webgpu/WebGPUSampler.idl:
* Modules/webgpu/WebGPUShaderModule.idl:
* Modules/webgpu/WebGPUShaderModuleDescriptor.idl:
* Modules/webgpu/WebGPUSwapChain.idl:
* Modules/webgpu/WebGPUTexture.idl:
* Modules/webgpu/WebGPUTextureView.idl:
* Modules/webgpu/WorkerNavigator+GPU.idl:
* Modules/webgpu/WorkerNavigatorGPU.cpp:
* Modules/webxr/Navigator+WebXR.idl:
* Modules/webxr/WebXRBoundedReferenceSpace.idl:
* Modules/webxr/WebXRFrame.idl:
* Modules/webxr/WebXRInputSource.idl:
* Modules/webxr/WebXRInputSourceArray.idl:
* Modules/webxr/WebXRLayer.idl:
* Modules/webxr/WebXRPose.idl:
* Modules/webxr/WebXRReferenceSpace.idl:
* Modules/webxr/WebXRRenderState.idl:
* Modules/webxr/WebXRRigidTransform.idl:
* Modules/webxr/WebXRSession.idl:
* Modules/webxr/WebXRSpace.idl:
* Modules/webxr/WebXRSystem.cpp:
* Modules/webxr/WebXRSystem.idl:
* Modules/webxr/WebXRView.idl:
* Modules/webxr/WebXRViewerPose.idl:
* Modules/webxr/WebXRViewport.idl:
* Modules/webxr/WebXRWebGLLayer.idl:
* Modules/webxr/XREnvironmentBlendMode.idl:
* Modules/webxr/XREye.idl:
* Modules/webxr/XRHandedness.idl:
* Modules/webxr/XRInputSourceEvent.idl:
* Modules/webxr/XRInputSourcesChangeEvent.idl:
* Modules/webxr/XRInteractionMode.idl:
* Modules/webxr/XRReferenceSpaceEvent.idl:
* Modules/webxr/XRReferenceSpaceType.idl:
* Modules/webxr/XRRenderStateInit.idl:
* Modules/webxr/XRSessionEvent.idl:
* Modules/webxr/XRSessionInit.idl:
* Modules/webxr/XRSessionMode.idl:
* Modules/webxr/XRTargetRayMode.idl:
* Modules/webxr/XRVisibilityState.idl:
* Modules/webxr/XRWebGLLayerInit.idl:
* html/HTMLCanvasElement.cpp:
* html/canvas/WebGL2RenderingContext.cpp:
* html/canvas/WebGL2RenderingContext.idl:
* html/canvas/WebGLRenderingContextBase.cpp:
* html/canvas/WebGLTransformFeedback.idl:
* html/canvas/WebGLVertexArrayObject.idl:
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::peerConnectionEnabled const): Deleted.
(WebCore::RuntimeEnabledFeatures::setPeerConnectionEnabled): Deleted.
(WebCore::RuntimeEnabledFeatures::setWebGLUsingMetal): Deleted.
(WebCore::RuntimeEnabledFeatures::webGLUsingMetal const): Deleted.
(WebCore::RuntimeEnabledFeatures::setWebGL2Enabled): Deleted.
(WebCore::RuntimeEnabledFeatures::webGL2Enabled const): Deleted.
(WebCore::RuntimeEnabledFeatures::setWebGPUEnabled): Deleted.
(WebCore::RuntimeEnabledFeatures::webGPUEnabled const): Deleted.
(WebCore::RuntimeEnabledFeatures::setMaskWebGLStringsEnabled): Deleted.
(WebCore::RuntimeEnabledFeatures::maskWebGLStringsEnabled const): Deleted.
* testing/FakeXRBoundsPoint.idl:
* testing/FakeXRButtonStateInit.idl:
* testing/FakeXRInputSourceInit.idl:
* testing/FakeXRRigidTransformInit.idl:
* testing/FakeXRViewInit.idl:
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
(WebCore::InternalSettings::setWebGL2Enabled): Deleted.
(WebCore::InternalSettings::setWebGPUEnabled): Deleted.
* testing/InternalSettings.h:
* testing/InternalSettings.idl:
* testing/Internals.cpp:
* testing/WebFakeXRDevice.idl:
* testing/WebFakeXRInputController.idl:
* testing/WebXRTest.idl:
* testing/XRSimulateUserActivationFunction.idl:
2021-04-17 Tim Nguyen <ntim@apple.com>
Don't omit conic gradient starting angle when serializing when starting angle is under 0
https://bugs.webkit.org/show_bug.cgi?id=224719
Reviewed by Ryosuke Niwa.
Updated pre-existing test to cover this case.
Test: LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/background-image-computed.sub.html
* css/CSSGradientValue.cpp:
(WebCore::CSSConicGradientValue::customCSSText const):
2021-04-17 Zalan Bujtas <zalan@apple.com>
[Cleanup] Modernize TrailingObjects
https://bugs.webkit.org/show_bug.cgi?id=224712
Reviewed by Antti Koivisto.
Remove redundant c'tor and start using enum class.
* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleText):
(WebCore::checkWhitespaceCollapsingTransitions):
(WebCore::BreakingContext::handleEndOfLine):
* rendering/line/TrailingObjects.cpp:
(WebCore::TrailingObjects::updateWhitespaceCollapsingTransitionsForTrailingBoxes):
* rendering/line/TrailingObjects.h:
(WebCore::TrailingObjects::setTrailingWhitespace):
(WebCore::TrailingObjects::clear):
(WebCore::TrailingObjects::TrailingObjects): Deleted.
2021-04-17 Zalan Bujtas <zalan@apple.com>
[Cleanup] BreakingContext::handleText should consistently use the cached renderer
https://bugs.webkit.org/show_bug.cgi?id=224711
Reviewed by Antti Koivisto.
Since this function is not supposed to increment the renderer, let's replace m_current.renderer() with "renderer".
* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleText):
* rendering/line/TrailingObjects.h:
(WebCore::TrailingObjects::setTrailingWhitespace):
2021-04-17 Zalan Bujtas <zalan@apple.com>
[Cleanup] inlineLogicalWidth should take const RenderObject&
https://bugs.webkit.org/show_bug.cgi?id=224700
Reviewed by Antti Koivisto.
1. inlineLogicalWidth takes const RenderObject& now.
2. Both previousInFlowSibling and shouldAddBorderPaddingMargin moved to inlineLogicalWidth
* rendering/line/BreakingContext.h:
(WebCore::inlineLogicalWidth):
(WebCore::BreakingContext::handleOutOfFlowPositioned):
(WebCore::BreakingContext::handleEmptyInline):
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::handleText):
(WebCore::shouldAddBorderPaddingMargin): Deleted.
(WebCore::previousInFlowSibling): Deleted.
2021-04-17 Philippe Normand <pnormand@igalia.com>
Unreviewed, GTK LTS build fix after r276197
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::configureMediaStreamAudioTracks):
2021-04-17 Philippe Normand <pnormand@igalia.com>
[GStreamer][MediaStream] fast/mediastream/play-newly-added-audio-track.html is failing since added in r260380
https://bugs.webkit.org/show_bug.cgi?id=210840
Reviewed by Xabier Rodriguez-Calvar.
The test was failing mainly because our mediastreamsrc GStreamer element wasn't creating the
corresponding AudioTrackPrivateMediaStream object. The media player should propagate its
volume/mute/is-playing states to the source element. And also until now our mediastreamsrc
element was handling at most one audio track and at most one audio track, but it turns out
multiple audio tracks can be added actually. So I refactored the element internals
accordingly. The InternalSource is now directly observing the corresponding
RealtimeMediaSource, which simplified some code. Observing is also now suspended/resumed
depending on the element state.
We don't implement a GStreamer AudioMediaStreamTrackRenderer class yet, because actual
rendering is still performed from the WebProcess, so early returns were added in
AudioTrackPrivateMediaStream to handle this case.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::updateTracks):
(WebCore::MediaPlayerPrivateGStreamer::configureMediaStreamAudioTracks):
(WebCore::MediaPlayerPrivateGStreamer::setVolume):
(WebCore::MediaPlayerPrivateGStreamer::setMuted):
(WebCore::MediaPlayerPrivateGStreamer::updateStates):
(WebCore::MediaPlayerPrivateGStreamer::didEnd):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* platform/mediastream/AudioTrackPrivateMediaStream.cpp:
(WebCore::AudioTrackPrivateMediaStream::createRenderer):
(WebCore::AudioTrackPrivateMediaStream::setLogger):
(WebCore::AudioTrackPrivateMediaStream::clear):
(WebCore::AudioTrackPrivateMediaStream::setVolume):
(WebCore::AudioTrackPrivateMediaStream::setAudioOutputDevice):
(WebCore::AudioTrackPrivateMediaStream::volume const):
(WebCore::AudioTrackPrivateMediaStream::audioSamplesAvailable):
(WebCore::AudioTrackPrivateMediaStream::startRenderer):
(WebCore::AudioTrackPrivateMediaStream::stopRenderer):
(WebCore::AudioTrackPrivateMediaStream::createNewRenderer):
* platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
(mediaStreamTrackPrivateGetTags):
(WebKitMediaStreamObserver::didRemoveTrack):
(webkitMediaStreamSrcConstructed):
(webkitMediaStreamSrcDispose):
(webkitMediaStreamSrcChangeState):
(webkitMediaStreamSrcPostStreamCollection):
(webkitMediaStreamSrcAddPad):
(ProbeData::ProbeData):
(webkitMediaStreamSrcPadProbeCb):
(webkitMediaStreamSrcAddTrack):
(webkitMediaStreamSrcSetStream):
(webkitMediaStreamSrcTrackEnded):
(InternalSource::trackEnded):
(webkitMediaStreamSrcConfigureAudioTracks):
* platform/mediastream/gstreamer/GStreamerMediaStreamSource.h:
2021-04-16 Brent Fulgham <bfulgham@apple.com>
Perform port blocking earlier in the load
https://bugs.webkit.org/show_bug.cgi?id=224525
<rdar://problem/75440591>
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-04-16 Basuke Suzuki <basuke.suzuki@sony.com>
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-16 Ryosuke Niwa <rniwa@webkit.org>
Deploy Ref/RefPtr in Editor
https://bugs.webkit.org/show_bug.cgi?id=224708
Reviewed by Wenson Hsieh.
Deployed smart pointers in WebCore::Editor.
Also deployed ScriptDisallowedScope around the code which accesses the render tree.
* dom/Position.cpp:
(WebCore::Position::containerOrParentElement const): Added.
* dom/Position.h:
* editing/Editor.cpp:
(WebCore::Editor::selectionForCommand):
(WebCore::Editor::pasteAsPlainText):
(WebCore::Editor::pasteAsFragment):
(WebCore::Editor::shouldInsertFragment):
(WebCore::Editor::replaceSelectionWithFragment):
(WebCore::Editor::respondToChangedContents):
(WebCore::Editor::hasBidiSelection const):
(WebCore::Editor::selectionUnorderedListState const):
(WebCore::Editor::selectionOrderedListState const):
(WebCore::Editor::findEventTargetFrom const):
(WebCore::Editor::findEventTargetFromSelection const):
(WebCore::notifyTextFromControls):
(WebCore::Editor::willApplyEditing const):
(WebCore::Editor::appliedEditing):
(WebCore::Editor::insertTextWithoutSendingTextEvent):
(WebCore::Editor::performCutOrCopy):
(WebCore::Editor::simplifyMarkup): Replaced the manual tree traversal by treeOrder(~).
(WebCore::Editor::copyImage):
(WebCore::Editor::setBaseWritingDirection):
(WebCore::Editor::baseWritingDirectionForSelectionStart const):
(WebCore::Editor::setComposition):
(WebCore::Editor::advanceToNextMisspelling):
(WebCore::Editor::markMisspellingsAfterTypingToWord): Use containerOrParentElement.
(WebCore::Editor::isSpellCheckingEnabledFor const):
(WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
(WebCore::Editor::markAndReplaceFor):
(WebCore::scanForTelephoneNumbers):
(WebCore::Editor::scanSelectionForTelephoneNumbers): Restrucuted the code with makeScopeExit
to exit early instead of nesting if's.
(WebCore::findFirstMarkable):
(WebCore::Editor::selectionStartHasMarkerFor const):
(WebCore::Editor::resolveTextCheckingTypeMask):
(WebCore::Editor::stringForCandidateRequest const):
(WebCore::Editor::fontAttributesAtSelectionStart):
(WebCore::Editor::promisedAttachmentInfo):
(WebCore::Editor::styleForSelectionStart):
(WebCore::Editor::fontForSelection):
* editing/Editor.h:
* page/DragController.cpp:
(WebCore::DragController::dispatchTextInputEventFor):
2021-04-16 Darin Adler <darin@apple.com>
font-size with viewport units in calc() doesn't change when viewport resizes
https://bugs.webkit.org/show_bug.cgi?id=224614
Reviewed by Zalan Bujtas.
* css/CSSToLengthConversionData.cpp:
(WebCore::CSSToLengthConversionData::zoom const): Updated since m_zoom is now optional.
We use effectiveZoom when m_zoom is not specified, which is the same semantic that was
implemented before with a separate boolean.
(WebCore::CSSToLengthConversionData::viewportWidthFactor const): When calling the
setHasViewportUnits function as a side effect, use m_viewportDependencyDetectionStyle,
rather than always using m_style. This lets us handle the font-size case correctly.
Also removed the explicit computingFontSize check for the same reason.
(WebCore::CSSToLengthConversionData::viewportHeightFactor const): Ditto.
(WebCore::CSSToLengthConversionData::viewportMinFactor const): Ditto.
(WebCore::CSSToLengthConversionData::viewportMaxFactor const): Ditto.
* css/CSSToLengthConversionData.h: Added a new member, m_viewportDependencyDetectionStyle,
which defaults to the same value as m_style. Also changed m_zoom to use Optional instead
of a separate boolean and an ignored "must be 1.0" value. Initialized data members in
the modern way, allowing us to use the default constructor.
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueFontSize): Pass in the builder's style as the
viewportDependencyDetectionStyle. This does the same thing that the existing code to
call setHasViewportUnits did directly, but does it even for more complex cases involving
calc(). Also made the isLength and isCalculatedPercentageWithLength cases more similar
to each other and left a FIXME behind about taking that a bit further, but doing that
probably requires creating some more test cases.
2021-04-16 Ian Gilbert <iang@apple.com>
Nullptr deref in CompositeEditCommand::isRemovableBlock in DeleteSelectionCommand::removeRedundantBlocks
https://bugs.webkit.org/show_bug.cgi?id=224518
Reviewed by Ryosuke Niwa.
Add null check in case node is removed while iterating over tree.
Test: editing/execCommand/remove-node-during-command-crash.html
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::removeRedundantBlocks):
2021-04-16 Cameron McCormack <heycam@apple.com>
Place vertical scrollbars at (inline/block)-end edge in all writing modes.
https://bugs.webkit.org/show_bug.cgi?id=224224
Reviewed by Simon Fraser.
Tests: fast/scrolling/v-rl-scrollbars-initial-position-dynamic.html
fast/scrolling/v-rl-scrollbars-initial-position.html
fast/scrolling/vertical-scrollbar-position.html
We currently only consider moving a vertical scrollbar to the left for
`writing-mode: horizontal-{tb,bt}; direction: rtl` containers. But
ideally we should always place the vertical scrollbar at the end edge
of the container (whether that's the inline-end edge, when using a
horizontal writing mode, or the block-end edge, when using a vertical
writing mode).
Some functions calling the existing shouldPlaceBlockDirectionScrollbarOnLeft
instead really care about whether the vertical scrollbar is on the
left, not whether the block direction scrollbar is on the left (since
for vertical writing modes, the block direction scrollbar is the
horizontal one on the bottom). So we rename this to
shouldPlaceVerticalScrollbarOnLeft, make it return true for
`writing-mode: vertical-rl`, and adjust callers that really do care
only about block direction scrollbars to additionally check their
writing mode.
* page/EventHandler.cpp:
(WebCore::EventHandler::selectCursor):
* page/FrameView.cpp:
(WebCore::FrameView::shouldPlaceVerticalScrollbarOnLeft const):
* page/FrameView.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::documentScrollPositionRelativeToViewOrigin const):
(WebCore::ScrollView::updateScrollbars):
(WebCore::ScrollView::scrollCornerRect const):
(WebCore::ScrollView::locationOfContents const):
* platform/ScrollableArea.h:
* platform/adwaita/ScrollbarThemeAdwaita.cpp:
(WebCore::ScrollbarThemeAdwaita::paint):
* platform/gtk/ScrollbarThemeGtk.cpp:
(WebCore::widgetTypeForScrollbar):
(WebCore::ScrollbarThemeGtk::paint):
* platform/mac/ScrollbarThemeMac.mm:
(WebCore::ScrollbarThemeMac::didCreateScrollerImp):
* platform/win/PopupMenuWin.h:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::logicalLeftOffsetForContent const):
(WebCore::RenderBlock::logicalRightOffsetForContent const):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::determineLogicalLeftPositionForChild):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paddingBoxRect const):
(WebCore::RenderBox::contentBoxLocation const):
(WebCore::RenderBox::overflowClipRect const):
(WebCore::RenderBox::computePositionedLogicalWidth const):
(WebCore::RenderBox::flippedClientBoxRect const):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::constrainingRectForStickyPosition const):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):
(WebCore::RenderLayer::resize):
(WebCore::RenderLayer::overflowControlsRects const):
(WebCore::RenderLayer::offsetFromResizeCorner const):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::positionForClipLayer const):
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::shouldPlaceVerticalScrollbarOnLeft const):
* rendering/RenderLayerModelObject.h:
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::shouldPlaceVerticalScrollbarOnLeft const):
(WebCore::RenderLayerScrollableArea::overflowControlsRects const):
(WebCore::RenderLayerScrollableArea::computeScrollOrigin):
(WebCore::RenderLayerScrollableArea::updateScrollbarsAfterLayout):
(WebCore::RenderLayerScrollableArea::drawPlatformResizerImage):
(WebCore::RenderLayerScrollableArea::hitTestResizerInFragments const):
(WebCore::RenderLayerScrollableArea::updateScrollbarsAfterStyleChange):
* rendering/RenderLayerScrollableArea.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::itemBoundingBoxRect):
(WebCore::RenderListBox::paintScrollbar):
(WebCore::RenderListBox::isPointInOverflowControl):
(WebCore::RenderListBox::listIndexAtOffset):
(WebCore::RenderListBox::invalidateScrollbarRect):
(WebCore::RenderListBox::convertFromScrollbarToContainingView const):
(WebCore::RenderListBox::convertFromContainingViewToScrollbar const):
* rendering/RenderListBox.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::repaintViewRectangle const):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::shouldPlaceVerticalScrollbarOnLeft const):
* rendering/style/RenderStyle.h:
2021-04-16 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Refactor some webpage translation code
https://bugs.webkit.org/show_bug.cgi?id=224680
Work towards <rdar://75641882>
Reviewed by Tim Horton.
In preparation for fixing https://webkit.org/b/224683, refactor some codepaths for handling webpage translation
via the context menu on macOS, in WebKit2.
Currently, the context menu action for `ContextMenuItemTagTranslate` is fully handled in the client layer in
WebKit2, using state in `m_activeContextMenuContextData`. However, to make this action work in WebKitLegacy as
well, we need the ability to call back into the `ContextMenuController` to handle the action, since context menu
actions in WebKitLegacy only target the shared `WebMenuTarget` instance, which only knows about the context menu
controller rather than the `WebHTMLView` that vended the menu item.
Instead of adding logic in `WebMenuTarget` to dig the `WebHTMLView` corresponding to the focused frame out of
the context menu controller, it makes more sense to plumb this call through the (already-established)
`ContextMenuClient`. While this has the disadvantage of requiring an extra IPC hop on the WebKit2 case, it also
has the advantage that we can lazily compute the selection bounds and menu location in root view coordinates
only if the user has selected this menu action, which makes context menu data (slightly) cheaper to compute.
No change in behavior.
* loader/EmptyClients.cpp:
* page/ContextMenuClient.h:
* page/ContextMenuContext.h:
(WebCore::ContextMenuContext::setSelectionBounds): Deleted.
(WebCore::ContextMenuContext::selectionBounds const): Deleted.
Remove code for computing and setting selection bounds. This was only added in support of webpage translation;
instead of computing this up front, we can instead send this information only when the action is invoked.
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
Move logic for computing the selection bounds and menu location in root view coordinates out of `populate` and
into `contextMenuItemSelected`, only in the case where the action is `ContextMenuItemTagTranslate`.
(WebCore::ContextMenuController::populate):
2021-04-16 Jiewen Tan <jiewen_tan@apple.com>
Allow using the platform authenticator on non-Touch ID Macs according to Internal requirements
https://bugs.webkit.org/show_bug.cgi?id=224639
<rdar://74698346>
Reviewed by Daniel Bates.
Covered by new tests within existing test files.
* testing/MockWebAuthenticationConfiguration.h:
* testing/MockWebAuthenticationConfiguration.idl:
Mock testing support.
2021-04-16 Peng Liu <peng.liu6@apple.com>
[GPUP] WebContent process should not create AVOutputContext instances when media in GPU Process is enabled
https://bugs.webkit.org/show_bug.cgi?id=224469
Reviewed by Eric Carlson.
This patch modifies `MediaPlaybackTargetContext` to provide interfaces to serialize/deserialize
`AVOutputContext` and modifies `MediaPlaybackTargetCocoa` to use `MediaPlaybackTargetContext` to
manage its `AVOutputContext` instead of keeping a pointer to the `AVOutputContext` object.
With these changes, a WebContent process can forward a serialized `AVOutputContext` object
to other processes (e.g., the GPU process) without deserializing it. Therefore, the WebContent
process does not need access to the CoreMedia routing service. So we can remove the fix (r275669)
for bug 224328.
Covered by existing tests.
* Modules/airplay/WebMediaSessionManager.cpp:
(WebCore::WebMediaSessionManager::setMockMediaPlaybackTargetPickerState):
* Modules/airplay/WebMediaSessionManager.h:
* Headers.cmake:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
Modify the project file because `MediaPlaybackTargetContext` is used in Cocoa ports only.
* page/ChromeClient.h:
(WebCore::ChromeClient::setMockMediaPlaybackTargetPickerState):
* page/Page.cpp:
(WebCore::Page::setMockMediaPlaybackTargetPickerState):
* page/Page.h:
* platform/graphics/MediaPlaybackTarget.h:
(WebCore::MediaPlaybackTarget::hasActiveRoute const):
(WebCore::MediaPlaybackTarget::deviceName const):
(WebCore::MediaPlaybackTarget::supportsRemoteVideoPlayback):
(): Deleted.
* platform/graphics/MediaPlaybackTargetContext.h: Removed.
* platform/graphics/avfoundation/MediaPlaybackTargetCocoa.h:
(WebCore::MediaPlaybackTargetCocoa::outputContext const): Deleted.
* platform/graphics/avfoundation/MediaPlaybackTargetCocoa.mm:
(WebCore::MediaPlaybackTargetCocoa::create):
(WebCore::MediaPlaybackTargetCocoa::MediaPlaybackTargetCocoa):
(WebCore::MediaPlaybackTargetCocoa::~MediaPlaybackTargetCocoa):
(WebCore::toMediaPlaybackTargetCocoa):
(WebCore::MediaPlaybackTargetCocoa::supportsRemoteVideoPlayback const): Deleted.
(WebCore::MediaPlaybackTargetCocoa::targetContext const): Deleted.
(WebCore::MediaPlaybackTargetCocoa::hasActiveRoute const): Deleted.
(WebCore::MediaPlaybackTargetCocoa::deviceName const): Deleted.
Don't directly use `AVOutputContext` in this class.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::isCurrentPlaybackTargetWireless const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget):
* platform/graphics/cocoa/MediaPlaybackTargetContext.h: Added.
(WebCore::MediaPlaybackTargetContext::MediaPlaybackTargetContext):
(WebCore::MediaPlaybackTargetContext::type const):
(WebCore::MediaPlaybackTargetContext::mockState const):
(WebCore::MediaPlaybackTargetContext::outputContext const):
(WebCore::MediaPlaybackTargetContext::serializedOutputContext const):
(WebCore::MediaPlaybackTargetContext::encodingRequiresPlatformData const):
* platform/graphics/cocoa/MediaPlaybackTargetContext.mm: Added.
(WebCore::MediaPlaybackTargetContext::MediaPlaybackTargetContext):
(WebCore::MediaPlaybackTargetContext::deviceName const):
(WebCore::MediaPlaybackTargetContext::hasActiveRoute const):
(WebCore::MediaPlaybackTargetContext::supportsRemoteVideoPlayback const):
(WebCore::MediaPlaybackTargetContext::serializeOutputContext):
(WebCore::MediaPlaybackTargetContext::deserializeOutputContext):
* platform/mock/MediaPlaybackTargetMock.cpp:
(WebCore::MediaPlaybackTargetMock::create):
(WebCore::MediaPlaybackTargetMock::MediaPlaybackTargetMock):
(WebCore::toMediaPlaybackTargetMock):
(WebCore::MediaPlaybackTargetMock::targetContext const): Deleted.
* platform/mock/MediaPlaybackTargetMock.h:
(WebCore::MediaPlaybackTargetMock::state const):
* platform/mock/MediaPlaybackTargetPickerMock.cpp:
(WebCore::MediaPlaybackTargetPickerMock::externalOutputDeviceAvailable):
(WebCore::MediaPlaybackTargetPickerMock::startingMonitoringPlaybackTargets):
(WebCore::MediaPlaybackTargetPickerMock::invalidatePlaybackTargets):
(WebCore::MediaPlaybackTargetPickerMock::setState):
* platform/mock/MediaPlaybackTargetPickerMock.h:
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setMockMediaPlaybackTargetPickerState):
2021-04-16 Zalan Bujtas <zalan@apple.com>
Remove redundant renderObject in BreakingContext::handleText
https://bugs.webkit.org/show_bug.cgi?id=224682
Reviewed by Darin Adler.
* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleText):
2021-04-16 Basuke Suzuki <basuke.suzuki@sony.com>
[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 Alex Christensen <achristensen@webkit.org>
Disable ApplicationCache with linkedOnOrAfter check
https://bugs.webkit.org/show_bug.cgi?id=224629
Reviewed by Brady Eidson.
ApplicationCache has been deprecated for two years in WebKit with a message to developers since r227225.
Firefox removed support in https://bugzilla.mozilla.org/show_bug.cgi?id=1619673 which shipped with Firefox 84 on Dec 15, 2020.
Chrome removed support in https://bugs.chromium.org/p/chromium/issues/detail?id=582750 by default in Chrome 85 on August 25, 2020
but they have a reverse origin trial program running right now so that some origins have it working, but they are planning to remove
even that support October 2021.
We have kept it working for a reason related to rdar://38505756, specifically the 4th and 5th comment in that bug.
That reason is now passed.
This patch removes support for new apps but keeps it working for 3rd party apps linked with existing SDKs. Once those apps update
to a new SDK, they will be unable to use ApplicationCache. They will need to migrate to use fetch service workers instead.
* platform/cocoa/VersionChecks.h:
2021-04-16 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r273733.
https://bugs.webkit.org/show_bug.cgi?id=224686
Broke mouse wheel scrolling speed
Reverted changeset:
"Eliminate ScrollAnimatorGeneric::m_smoothAnimation"
https://bugs.webkit.org/show_bug.cgi?id=222588
https://trac.webkit.org/changeset/273733
2021-04-16 Alex Christensen <achristensen@webkit.org>
Reduce maximum HashTable entry size to 128 bytes
https://bugs.webkit.org/show_bug.cgi?id=224381
Reviewed by Yusuke Suzuki.
* inspector/agents/InspectorAnimationAgent.cpp:
(WebCore::InspectorAnimationAgent::willApplyKeyframeEffect):
(WebCore::InspectorAnimationAgent::stopTrackingDeclarativeAnimation):
* inspector/agents/InspectorAnimationAgent.h:
2021-04-16 Tyler Wilcock <twilco.o@protonmail.com>
[css-counter-styles] Parse and add feature flag for @counter-style
https://bugs.webkit.org/show_bug.cgi?id=223150
Reviewed by Darin Adler.
Parse @counter-style (without implementing descriptor parsing) behind
a new feature flag, CSSCounterStyleAtRulesEnabled. A separate feature
flag for @counter-style <image> symbol values has also been added, as
image symbols have extra complexities that we won't want to hold the
entire feature back on.
https://www.w3.org/TR/css-counter-styles-3
The CSSCounterStyleRule IDL interface is also added and implemented,
and similarly feature flagged.
https://www.w3.org/TR/css-counter-styles-3/#apis
Test: webexposed/counter-style-is-not-exposed.html and existing WPTs.
* CMakeLists.txt:
Add CSSCounterStyleRule.idl.
* DerivedSources-input.xcfilelist:
Add CSSCounterStyleRule.idl.
* DerivedSources-output.xcfilelist:
Add JSCSSCounterStyleRule.h and JSCSSCounterStyleRule.cpp.
* DerivedSources.make:
Add CSSCounterStyleRule.idl.
* Sources.txt:
Add CSSCounterStyleRule.cpp and JSCSSCounterStyleRule.cpp.
* WebCore.xcodeproj/project.pbxproj:
Add CounterStyle.h, CounterStyle.cpp, and CounterStyle.idl.
* bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJSNewlyCreated):
Support CSSCounterStyleRule.
* bindings/js/WebCoreBuiltinNames.h:
Add macro(CSSCounterStyleRule) to generate counter-style built-in
names.
* css/CSSCounterStyleRule.cpp: Added.
(WebCore::StyleRuleCounterStyle::StyleRuleCounterStyle):
(WebCore::StyleRuleCounterStyle::create):
(WebCore::StyleRuleCounterStyle::mutableProperties):
(WebCore::CSSCounterStyleRule::CSSCounterStyleRule):
(WebCore::CSSCounterStyleRule::reattach):
(WebCore::CSSCounterStyleRule::cssText const):
* css/CSSCounterStyleRule.h: Added.
(isType): Add specialized rule.isCounterStyleRule() implementation.
* css/CSSCounterStyleRule.idl: Added.
* css/CSSRule.cpp: Add new StyleRuleType::CounterStyle COMPILE_ASSERT.
* css/CSSRule.h:
Add COUNTER_STYLE_RULE constant. Also add comment `// WebIDL enum` to
disable enum_casing lint, since these values are named to match IDL
attributes.
* css/CSSRule.idl: Add COUNTER_STYLE_RULE constant behind flag.
* css/StyleRule.cpp:
(WebCore::StyleRuleBase::destroy):
(WebCore::StyleRuleBase::copy const):
(WebCore::StyleRuleBase::createCSSOMWrapper const):
Handle newly added StyleRuleType::CounterStyle.
* css/StyleRule.h:
(WebCore::StyleRuleBase::isCounterStyleRule const): Added.
* css/StyleRuleType.h: Add StyleRuleType::CounterStyle
* css/StyleSheetContents.cpp:
(WebCore::traverseRulesInVector):
(WebCore::StyleSheetContents::traverseSubresources const):
If @counter-style image symbols flag is enabled, do traverse
subresources.
* css/parser/CSSAtRuleID.cpp:
If the @counter-style feature flag is enabled, return newly added
CSSAtRuleCounterStyle ID.
(WebCore::cssAtRuleID):
* css/parser/CSSAtRuleID.h:
Add CSSAtRuleCounterStyle ID.
* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
* css/parser/CSSParserContext.h:
(WebCore::CSSParserContextHash::hash):
Add cssCounterStyleAtRulesEnabled and
cssCounterStyleAtRuleImageSymbolsEnabled flags.
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.
* css/parser/CSSParserImpl.cpp:
(WebCore::computeNewAllowedRules):
(WebCore::CSSParserImpl::consumeAtRule):
(WebCore::CSSParserImpl::consumeCounterStyleRule): Added.
(WebCore::CSSParserImpl::consumeDeclarationList):
(WebCore::CSSParserImpl::consumeDeclaration):
* css/parser/CSSParserImpl.h:
Handle new @counter-style rule.
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseValue): Handle
StyleRuleType::CounterStyle.
(WebCore::consumeCounterContent):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Add placeholder for future @counter-style descriptor parsing work.
* css/parser/CSSPropertyParser.h:
Add parseCounterStyleDescriptor method
* css/parser/CSSPropertyParserHelpers.h:
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
Add new flag that allows consumed custom ident values to be lowercased
on-parse. This is necessary for some <counter-style-name> values.
(WebCore::CSSPropertyParserHelpers::isPredefinedCounterStyle): Added.
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleName):
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleNameInPrelude):
Parse @counter-style names, both in-prelude names and non-prelude
names (e.g. as part of the `extends` descriptor).
2021-04-16 Chris Dumez <cdumez@apple.com>
Unreviewed GTK / WinCairo build fix after Antoine's r276141.
Just add the BlendingContext constructor this time because there are too many build failures.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyBlendingContext::CSSPropertyBlendingContext):
(WebCore::CSSPropertyBlendingContext::client): Deleted.
* platform/animation/AnimationUtilities.h:
(WebCore::BlendingContext::BlendingContext):
* platform/graphics/nicosia/NicosiaAnimation.cpp:
(Nicosia::blendFunc):
(Nicosia::applyTransformAnimation):
2021-04-16 Chris Dumez <cdumez@apple.com>
Unreviewed attempt to fix GTK's build after Antoine's r276141.
* platform/graphics/nicosia/NicosiaAnimation.cpp:
(Nicosia::blendFunc):
(Nicosia::applyTransformAnimation):
2021-04-16 Chris Dumez <cdumez@apple.com>
Unreviewed build fix after Antoine's r276141.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyBlendingContext::CSSPropertyBlendingContext):
2021-04-16 Antoine Quint <graouts@webkit.org>
Refactor parameters to blending functions
https://bugs.webkit.org/show_bug.cgi?id=224433
Reviewed by Dean Jackson.
Reduce the number of parameters passed to the blending functions such that we package
the client and progress together and track whether the animation is discrete instead
of computing it several times. This information is now passed as a BlendingContext
parameter, and a CSSPropertyBlendingContext private to CSSPropertyAnimation.
When we support composite operations, we'll just need to add a new member to that
struct instead of modifying all the method signatures.
Since we are modifying the method signatures, we also change the RenderStyle pointers
to references since we would never pass in a null value.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyBlendingContext::CSSPropertyBlendingContext):
(WebCore::blendFunc):
(WebCore::blendFilterOperations):
(WebCore::blendFilter):
(WebCore::crossfadeBlend):
(WebCore::AnimationPropertyWrapperBase::canInterpolate const):
(WebCore::PropertyWrapperGetter::value const):
(WebCore::canInterpolateCaretColor):
(WebCore::CSSPropertyAnimation::blendProperties):
(WebCore::CSSPropertyAnimation::propertiesEqual):
(WebCore::CSSPropertyAnimation::canPropertyBeInterpolated):
* animation/CSSPropertyAnimation.h:
* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::setAnimatedPropertiesInStyle):
* css/CSSCrossfadeValue.cpp:
(WebCore::blendFunc):
(WebCore::CSSCrossfadeValue::blend const):
* css/CSSCrossfadeValue.h:
* css/CSSGradientValue.cpp:
(WebCore::RadialGradientAdapter::normalizeStopsAndEndpointsOutsideRange):
(WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange):
(WebCore::CSSGradientValue::computeStops):
* platform/Length.cpp:
(WebCore::blendMixedTypes):
(WebCore::blend):
* platform/Length.h:
* platform/LengthPoint.h:
(WebCore::blend):
* platform/LengthSize.h:
(WebCore::blend):
* platform/animation/AnimationUtilities.h:
(WebCore::blend):
* platform/graphics/ColorBlending.cpp:
(WebCore::blend):
(WebCore::blendWithoutPremultiply):
* platform/graphics/ColorBlending.h:
* platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
(WebCore::PlatformCAFilters::colorMatrixValueForFilter):
* platform/graphics/filters/FilterOperation.cpp:
(WebCore::BasicColorMatrixFilterOperation::blend):
(WebCore::BasicComponentTransferFilterOperation::blend):
(WebCore::InvertLightnessFilterOperation::blend):
(WebCore::BlurFilterOperation::blend):
(WebCore::DropShadowFilterOperation::blend):
* platform/graphics/filters/FilterOperation.h:
(WebCore::FilterOperation::blend):
* platform/graphics/transforms/IdentityTransformOperation.h:
* platform/graphics/transforms/Matrix3DTransformOperation.cpp:
(WebCore::createOperation):
(WebCore::Matrix3DTransformOperation::blend):
* platform/graphics/transforms/Matrix3DTransformOperation.h:
* platform/graphics/transforms/MatrixTransformOperation.cpp:
(WebCore::MatrixTransformOperation::blend):
* platform/graphics/transforms/MatrixTransformOperation.h:
* platform/graphics/transforms/PerspectiveTransformOperation.cpp:
(WebCore::PerspectiveTransformOperation::blend):
* platform/graphics/transforms/PerspectiveTransformOperation.h:
* platform/graphics/transforms/RotateTransformOperation.cpp:
(WebCore::RotateTransformOperation::blend):
* platform/graphics/transforms/RotateTransformOperation.h:
* platform/graphics/transforms/ScaleTransformOperation.cpp:
(WebCore::ScaleTransformOperation::blend):
* platform/graphics/transforms/ScaleTransformOperation.h:
* platform/graphics/transforms/SkewTransformOperation.cpp:
(WebCore::SkewTransformOperation::blend):
* platform/graphics/transforms/SkewTransformOperation.h:
* platform/graphics/transforms/TransformOperation.h:
* platform/graphics/transforms/TransformOperations.cpp:
(WebCore::TransformOperations::blendByMatchingOperations const):
(WebCore::TransformOperations::blendByUsingMatrixInterpolation const):
(WebCore::TransformOperations::blend const):
* platform/graphics/transforms/TransformOperations.h:
* platform/graphics/transforms/TranslateTransformOperation.cpp:
(WebCore::TranslateTransformOperation::blend):
* platform/graphics/transforms/TranslateTransformOperation.h:
* rendering/style/BasicShapes.cpp:
(WebCore::BasicShapeCircle::blend const):
(WebCore::BasicShapeEllipse::blend const):
(WebCore::BasicShapePolygon::blend const):
(WebCore::BasicShapePath::blend const):
(WebCore::BasicShapeInset::blend const):
* rendering/style/BasicShapes.h:
(WebCore::BasicShapeCenterCoordinate::blend const):
(WebCore::BasicShapeRadius::blend const):
* style/Styleable.cpp:
(WebCore::propertyInStyleMatchesValueForTransitionInMap):
(WebCore::updateCSSTransitionsForStyleableAndProperty):
* svg/SVGLengthValue.cpp:
(WebCore::SVGLengthValue::blend):
* svg/SVGPathBlender.cpp:
(WebCore::blendFloatPoint):
(WebCore::SVGPathBlender::blendAnimatedDimensonalFloat):
(WebCore::SVGPathBlender::blendArcToSegment):
2021-04-16 Antoine Quint <graouts@webkit.org>
Blend using calc() when necessary
https://bugs.webkit.org/show_bug.cgi?id=224670
Reviewed by Antti Koivisto.
We need to blend between lengths when their types are not the same. However, we would take
some shortcuts in the following cases and blend using just one value:
1. either the from or to value was a 0 value,
2. progress was 0 or 1.
Now we use the mixed types code path if the types are different or either the from or to
value is a calculated value. The single exception where we don't actually end up generating
a CalculationValue is when we know that one of the two values is 0 and not a percentage, in
which case we run a simple blend.
Due to this approach, we stopped returning the value as-is in some cases where progress was
0 or 1. To avoid regressions in this area, we made the LengthBoxPropertyWrapper clone the from
or to value in the discrete case, as some other areas of the code do not know how to deal with
calculated Length values, for instance valueForImageSliceSide(const Length&).
* animation/CSSPropertyAnimation.cpp:
* platform/Length.cpp:
(WebCore::blendMixedTypes):
(WebCore::blend):
* platform/LengthBox.h:
(WebCore::LengthBox::LengthBox):
* platform/RectEdges.h:
(WebCore::RectEdges::RectEdges):
2021-04-16 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] Do not try to collapse anonymous blocks when cleaning up the first-letter subtree
https://bugs.webkit.org/show_bug.cgi?id=224667
<rdar://76616098>
Reviewed by Antti Koivisto.
We construct a dedicated renderer for the first letter content and in some cases wrap it into an anonymous block.
This subtree needs to be destroyed when the associated RenderText is getting deleted. During this cleanup process
we may find the wrapper anonymous block redundant and initiate a sibling block collapsing. However this collapsing
may interfere with the initial delete (the associated RenderText) and lead to unexpected result.
Let's reserve the anonymous collapsing for the initial remove.
* rendering/updating/RenderTreeBuilderFirstLetter.cpp:
(WebCore::RenderTreeBuilder::FirstLetter::cleanupOnDestroy):
2021-04-16 Zalan Bujtas <zalan@apple.com>
[IFC] Incorrect box height when scrollbar takes padding box space
https://bugs.webkit.org/show_bug.cgi?id=224546
<rdar://problem/76666402>
Reviewed by Antti Koivisto.
This patch fixes the case when a non-overlay scrollbar can't be accomodated in the padding/content box area (e.g <div style="height: 10px; overflow: scroll">...)
In the legacy render tree the non-overlay scrollbar size is already taken into account when calling RenderBox::contentWidth/Height (paddingBoxHeight/Width), so
we just have to check how much space they actully take (currently maximum of 15px).
Test: fast/inline-block/non-overlay-scrollbar-incorrect-padding.html
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::updateLayoutBoxDimensions):
2021-04-16 Ryosuke Niwa <rniwa@webkit.org>
Deploy Ref/RefPtr in ApplyStyleCommand
https://bugs.webkit.org/show_bug.cgi?id=224662
Reviewed by Antti Koivisto.
Deployed smart pointers in ApplyStyleCommand. Also deployed ScriptDisallowedScope around the code
which accesses the render tree in ApplyStyleCommand::applyInlineStyleToPushDown.
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
(WebCore::dummySpanAncestorForNode):
(WebCore::ApplyStyleCommand::cleanupUnstyledAppleStyleSpans):
(WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi):
(WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
(WebCore::highestEmbeddingAncestor):
(WebCore::ApplyStyleCommand::applyInlineStyle):
(WebCore::ApplyStyleCommand::fixRangeAndApplyInlineStyle):
(WebCore::containsNonEditableRegion):
(WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
(WebCore::ApplyStyleCommand::shouldApplyInlineStyleToRun):
(WebCore::ApplyStyleCommand::highestAncestorWithConflictingInlineStyle):
(WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
(WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
(WebCore::ApplyStyleCommand::removeInlineStyle):
(WebCore::ApplyStyleCommand::mergeStartWithPreviousIfIdentical):
(WebCore::ApplyStyleCommand::mergeEndWithNextIfIdentical):
(WebCore::ApplyStyleCommand::surroundNodeRangeWithElement):
(WebCore::ApplyStyleCommand::applyInlineStyleChange):
(WebCore::ApplyStyleCommand::joinChildTextNodes):
* editing/ApplyStyleCommand.h:
2021-04-16 Ryosuke Niwa <rniwa@webkit.org>
Deploy Ref/RefPtr/WeakPtr in EditCommand and CompositeEditCommand
https://bugs.webkit.org/show_bug.cgi?id=224659
Reviewed by Antti Koivisto.
Deployed Ref/RefPtr/WeakPtr across CompositeEditCommand and EditCommand.
Also wrapped sections of code that access render tree with ScriptDisallowedScope.
* editing/CompositeEditCommand.cpp:
(WebCore::postTextStateChangeNotification):
(WebCore::CompositeEditCommand::ensureComposition):
(WebCore::CompositeEditCommand::isRemovableBlock): Let a raw pointer to the parent node here
since the only thing we do is to call hasOneChild on it.
(WebCore::CompositeEditCommand::insertNodeBefore):
(WebCore::CompositeEditCommand::insertNodeAfter):
(WebCore::CompositeEditCommand::insertNodeAt):
(WebCore::CompositeEditCommand::removeChildrenInRange):
(WebCore::CompositeEditCommand::replaceElementWithSpanPreservingChildrenAndAttributes):
(WebCore::CompositeEditCommand::positionOutsideTabSpan):
(WebCore::CompositeEditCommand::textNodeForRebalance const): Renamed from canRebalance and
now returns the text node after downcasting so that rebalanceWhitespaceAt doesn't need to have
a lone downcast without a type check.
(WebCore::CompositeEditCommand::rebalanceWhitespaceAt):
(WebCore::CompositeEditCommand::rebalanceWhitespaceOnTextSubstring):
(WebCore::CompositeEditCommand::prepareWhitespaceAtPositionForSplit):
(WebCore::CompositeEditCommand::deleteInsignificantText):
(WebCore::CompositeEditCommand::addBlockPlaceholderIfNeeded):
(WebCore::CompositeEditCommand::cloneParagraphUnderNewElement):
(WebCore::CompositeEditCommand::moveParagraphs):
* editing/CompositeEditCommand.h:
(WebCore::CompositeEditCommand): Now inherits from CanMakeWeakPtr.
(WebCore::toCompositeEditCommand): Deleted.
* editing/EditCommand.cpp:
(WebCore::EditCommand::EditCommand): Initialize m_startingSelection and m_endingSelection directly
since setStartingSelection and setEndingSelection now stores "this" pointer in RefPtr.
There is no behavior difference since m_parent and CompositeEditCommand::m_composition if applicable
are both nullptr at this point.
(WebCore::compositionIfPossible):
(WebCore::EditCommand::isEditingTextAreaOrTextInput const): Use enclosingTextFormControl instead
of duplicating the code here.
(WebCore::EditCommand::setStartingSelection):
(WebCore::EditCommand::setEndingSelection):
(WebCore::EditCommand::setParent):
(WebCore::EditCommand::postTextStateChangeNotification):
* editing/EditCommand.h:
(WebCore::EditCommand::parent const):
* editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::doApply):
2021-04-16 Youenn Fablet <youenn@apple.com>
Remove a no longer necessary callOnMainThread in Worker::createRTCRtpScriptTransformer
https://bugs.webkit.org/show_bug.cgi?id=224539
Reviewed by Darin Adler.
* workers/Worker.cpp:
(WebCore::Worker::createRTCRtpScriptTransformer):
ThreadSafeRefCounted already handles it with the DestructionThread::Main option.
2021-04-15 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r276107.
https://bugs.webkit.org/show_bug.cgi?id=224653
It broke non-Cocoa clean builds
Reverted changeset:
"[GPUP] WebContent process should not create AVOutputContext
instances when media in GPU Process is enabled"
https://bugs.webkit.org/show_bug.cgi?id=224469
https://trac.webkit.org/changeset/276107
2021-04-15 Lauro Moura <lmoura@igalia.com>
REGRESSION(r276039) [GTK] Build failures on Ubuntu 18.04
https://bugs.webkit.org/show_bug.cgi?id=224644
<rdar://problem/76742835>
Unreviewed build fix.
* bindings/js/JSDOMSetLike.cpp: Add missing Inlines header as
suggested by Mark.
2021-04-15 Don Olmstead <don.olmstead@sony.com>
Remove TilingData class
https://bugs.webkit.org/show_bug.cgi?id=224643
Reviewed by Yusuke Suzuki.
It doesn't seem to be used anywhere and the code hasn't been touched in almost a decade.
* PlatformMac.cmake:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/gpu/TilingData.cpp: Removed.
* platform/graphics/gpu/TilingData.h: Removed.
2021-04-15 Don Olmstead <don.olmstead@sony.com>
[CMake] OpenGL libraries not linked when ANGLE isn't used
https://bugs.webkit.org/show_bug.cgi?id=224642
Reviewed by Fujii Hironori.
Move the block linking and including OpenGL libraries outside of the ANGLE related checks
to catch the case where OpenGL is needed but WebGL and ANGLE are disabled.
Also removes an include for the platform/gpu directory as that's only used for WebGPU.
* CMakeLists.txt:
2021-04-15 Sergio Villar Senin <svillar@igalia.com>
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-15 Peng Liu <peng.liu6@apple.com>
[GPUP] WebContent process should not create AVOutputContext instances when media in GPU Process is enabled
https://bugs.webkit.org/show_bug.cgi?id=224469
Reviewed by Eric Carlson.
This patch modifies `MediaPlaybackTargetContext` to provide interfaces to serialize/deserialize
`AVOutputContext` and modifies `MediaPlaybackTargetCocoa` to use `MediaPlaybackTargetContext` to
manage its `AVOutputContext` instead of keeping a pointer to the `AVOutputContext` object.
With these changes, a WebContent process can forward a serialized `AVOutputContext` object
to other processes (e.g., the GPU process) without deserializing it. Therefore, the WebContent
process does not need access to the CoreMedia routing service. So we can remove the fix (r275669)
for bug 224328.
Covered by existing tests.
* Modules/airplay/WebMediaSessionManager.cpp:
(WebCore::WebMediaSessionManager::setMockMediaPlaybackTargetPickerState):
* Modules/airplay/WebMediaSessionManager.h:
* Headers.cmake:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
Modify the project file because `MediaPlaybackTargetContext` is used in Cocoa ports only.
* page/ChromeClient.h:
(WebCore::ChromeClient::setMockMediaPlaybackTargetPickerState):
* page/Page.cpp:
(WebCore::Page::setMockMediaPlaybackTargetPickerState):
* page/Page.h:
* platform/graphics/MediaPlaybackTarget.h:
(WebCore::MediaPlaybackTarget::hasActiveRoute const):
(WebCore::MediaPlaybackTarget::deviceName const):
(WebCore::MediaPlaybackTarget::supportsRemoteVideoPlayback):
(): Deleted.
* platform/graphics/MediaPlaybackTargetContext.h: Removed.
* platform/graphics/avfoundation/MediaPlaybackTargetCocoa.h:
(WebCore::MediaPlaybackTargetCocoa::outputContext const): Deleted.
* platform/graphics/avfoundation/MediaPlaybackTargetCocoa.mm:
(WebCore::MediaPlaybackTargetCocoa::create):
(WebCore::MediaPlaybackTargetCocoa::MediaPlaybackTargetCocoa):
(WebCore::MediaPlaybackTargetCocoa::~MediaPlaybackTargetCocoa):
(WebCore::toMediaPlaybackTargetCocoa):
(WebCore::MediaPlaybackTargetCocoa::supportsRemoteVideoPlayback const): Deleted.
(WebCore::MediaPlaybackTargetCocoa::targetContext const): Deleted.
(WebCore::MediaPlaybackTargetCocoa::hasActiveRoute const): Deleted.
(WebCore::MediaPlaybackTargetCocoa::deviceName const): Deleted.
Don't directly use `AVOutputContext` in this class.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::isCurrentPlaybackTargetWireless const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget):
* platform/graphics/cocoa/MediaPlaybackTargetContext.h: Added.
(WebCore::MediaPlaybackTargetContext::MediaPlaybackTargetContext):
(WebCore::MediaPlaybackTargetContext::type const):
(WebCore::MediaPlaybackTargetContext::mockState const):
(WebCore::MediaPlaybackTargetContext::outputContext const):
(WebCore::MediaPlaybackTargetContext::serializedOutputContext const):
(WebCore::MediaPlaybackTargetContext::encodingRequiresPlatformData const):
* platform/graphics/cocoa/MediaPlaybackTargetContext.mm: Added.
(WebCore::MediaPlaybackTargetContext::MediaPlaybackTargetContext):
(WebCore::MediaPlaybackTargetContext::deviceName const):
(WebCore::MediaPlaybackTargetContext::hasActiveRoute const):
(WebCore::MediaPlaybackTargetContext::supportsRemoteVideoPlayback const):
(WebCore::MediaPlaybackTargetContext::serializeOutputContext):
(WebCore::MediaPlaybackTargetContext::deserializeOutputContext):
* platform/mock/MediaPlaybackTargetMock.cpp:
(WebCore::MediaPlaybackTargetMock::create):
(WebCore::MediaPlaybackTargetMock::MediaPlaybackTargetMock):
(WebCore::toMediaPlaybackTargetMock):
(WebCore::MediaPlaybackTargetMock::targetContext const): Deleted.
* platform/mock/MediaPlaybackTargetMock.h:
(WebCore::MediaPlaybackTargetMock::state const):
* platform/mock/MediaPlaybackTargetPickerMock.cpp:
(WebCore::MediaPlaybackTargetPickerMock::externalOutputDeviceAvailable):
(WebCore::MediaPlaybackTargetPickerMock::startingMonitoringPlaybackTargets):
(WebCore::MediaPlaybackTargetPickerMock::invalidatePlaybackTargets):
(WebCore::MediaPlaybackTargetPickerMock::setState):
* platform/mock/MediaPlaybackTargetPickerMock.h:
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setMockMediaPlaybackTargetPickerState):
2021-04-15 Tim Horton <timothy_horton@apple.com>
Add a mechanism to dump the PlatformCALayer subtree of a GraphicsLayer, for testing
https://bugs.webkit.org/show_bug.cgi?id=224595
Reviewed by Simon Fraser.
Test: fast/harness/platform-layer-tree-as-text.html
Add internals.platformLayerTreeAsText(), which takes a (composited) Element
and returns the recursive PlatformCALayer tree under that element's backing
layer's primary layer.
This is intended to be used in a future patch in order to test a fix
that is only currently testable by observing the platform layer tree.
I've separated it from that patch in order to get the test rebaselining
out of the way in a behavior-neutral patch.
The motivation for a new method instead of a layerTreeAsText() flag
is this: if you make each GraphicsLayerCA dump its PlatformCALayers
(as a "show me the platform sublayers recursively" flag might do),
each GraphicsLayerCA also dumps its children's platform sublayers.
Thus the easiest way to get sane logging for testing is to target
the specific element you're interested in; thus, a new method.
* page/Frame.cpp:
(WebCore::Frame::layerTreeAsText const): Deleted.
* page/Frame.h:
Move layerTreeAsText to RenderLayerCompositor, where it probably belongs.
* page/Page.h: Fix a typo.
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::platformLayerTreeAsText const):
* platform/graphics/GraphicsLayerClient.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::purposeNameForInnerLayer const):
When dumping a PlatformCALayer, look up its purpose by checking which
layer member it is, instead of having it passed in. This way, we can
look it up even when we've reached this layer by crawling down the
PlatformCALayer tree.
(WebCore::GraphicsLayerCA::dumpInnerLayer const):
Clean up the PlatformCALayer dumping; make it multi-line and more
consistent with GraphicsLayer's dumping (a future patch will add more properties).
(WebCore::GraphicsLayerCA::dumpAdditionalProperties const):
Use dumpInnerLayer when dumping PlatformCALayers from a GraphicsLayer dump,
but with a bit set to disable dumping children, to maintain the exising output
and avoid each layer also dumping its children's platform layers, as mentioned above.
(WebCore::GraphicsLayerCA::platformLayerTreeAsText const):
(WebCore::dumpInnerLayer): Deleted.
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
Add a getter for the set of sublayers of a PlatformCALayerCocoa that
themselves have PlatformCALayers (thus the -forLogging; I didn't want
anybody to accidentally think that this gets *all* of the sublayers).
(WebCore::PlatformCALayerCocoa::sublayersForLogging):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateCompositingForLayerTreeAsTextDump):
Consolidate all of the pre-layer-tree-dumping setup work, so it can
be shared between layerTreeAsText and platformLayerTreeAsText.
(WebCore::RenderLayerCompositor::layerTreeAsText):
(WebCore::RenderLayerCompositor::platformLayerTreeAsText):
* rendering/RenderLayerCompositor.h:
* testing/Internals.cpp:
(WebCore::Internals::layerTreeAsText const):
Adopt the RenderLayerCompositor version of layerTreeAsText.
Don't bother doing layout, RenderLayerCompositor does it.
(WebCore::toPlatformLayerTreeFlags):
(WebCore::Internals::platformLayerTreeAsText const):
* testing/Internals.h:
* testing/Internals.idl:
2021-04-15 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Support the Translate menu item in editable selected text
https://bugs.webkit.org/show_bug.cgi?id=224625
<rdar://problem/76723022>
Reviewed by Tim Horton and Devin Rousso.
Adjust some logic in `ContextMenuController` to ensure that the "Translate" context menu item shows up for
selected text in both editable and non-editable fields. To do this, we pull code for appending the menu items
out into a separate lambda function, which we use in both cases. This also allows us to remove some duplicated
code between the editable and non-editable codepaths.
Test: fast/events/contextmenu-actions-in-selected-text.html
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::populate):
Additionally, set `selectedText` and `selectionBounds` in both cases, as long as there is selected text.
2021-04-15 Ian Gilbert <iang@apple.com>
Null pointer dereference on MediaStreamAudioSourceNode destructor
https://bugs.webkit.org/show_bug.cgi?id=224573
Reviewed by Eric Carlson.
Add null pointer check in case the capture source no longer exists.
Test: webaudio/destroy-audio-source-node-with-no-track-crash.html
* platform/mediastream/mac/MediaStreamTrackAudioSourceProviderCocoa.cpp:
(WebCore::MediaStreamTrackAudioSourceProviderCocoa::hasNewClient):
2021-04-15 Julian Gonzalez <julian_a_gonzalez@apple.com>
Crash in ReplaceSelectionCommand::mergeEndIfNeeded()
https://bugs.webkit.org/show_bug.cgi?id=224587
Reviewed by Ryosuke Niwa.
Return early in mergeEndIfNeeded() if either of our VisiblePositions are null.
Test: editing/inserting/insert-horizontal-rule-with-style-crash.html
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::mergeEndIfNeeded):
2021-04-15 Manuel Rego Casasnovas <rego@igalia.com>
Move FocusRemovalEventsMode into FocusOptions
https://bugs.webkit.org/show_bug.cgi?id=224549
<rdar://problem/76695885>
Reviewed by Darin Adler.
Follow-up patch to use braces initializer for FocusOptions struct and simplify the code.
* dom/Document.cpp:
(WebCore::Document::adjustFocusedNodeOnNodeRemoval):
2021-04-15 Alex Christensen <achristensen@webkit.org>
Add deprecation macros
https://bugs.webkit.org/show_bug.cgi?id=224624
* platform/audio/mac/AudioHardwareListenerMac.cpp:
(WebCore::isAudioHardwareProcessRunning):
(WebCore::currentDeviceSupportedBufferSizes):
(WebCore::processIsRunningPropertyDescriptor):
(WebCore::outputDevicePropertyDescriptor):
* platform/audio/mac/AudioSessionMac.mm:
(WebCore::defaultDevice):
(WebCore::defaultDeviceTransportIsBluetooth):
(WebCore::AudioSessionPrivate::addSampleRateObserverIfNeeded):
(WebCore::AudioSessionPrivate::addBufferSizeObserverIfNeeded):
(WebCore::AudioSession::sampleRate const):
(WebCore::AudioSession::bufferSize const):
(WebCore::AudioSession::maximumNumberOfOutputChannels const):
(WebCore::AudioSession::setPreferredBufferSize):
(WebCore::AudioSession::isMuted const):
(WebCore::AudioSession::addMutedStateObserver):
(WebCore::AudioSession::removeMutedStateObserver):
* platform/graphics/mac/GraphicsChecksMac.cpp:
(WebCore::attachToAppleGraphicsControl):
* platform/mediastream/mac/CoreAudioCaptureDevice.cpp:
(WebCore::getDeviceInfo):
(WebCore::CoreAudioCaptureDevice::CoreAudioCaptureDevice):
(WebCore::CoreAudioCaptureDevice::relatedAudioDeviceIDs):
* platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
(WebCore::deviceHasInputStreams):
(WebCore::deviceHasOutputStreams):
(WebCore::isValidCaptureDevice):
(WebCore::CoreAudioCaptureDeviceManager::coreAudioCaptureDevices):
(WebCore::computeAudioDeviceList):
* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioSharedUnit::defaultOutputDevice):
2021-04-15 Don Olmstead <don.olmstead@sony.com>
ANGLE is only being built when WebGL is enabled
https://bugs.webkit.org/show_bug.cgi?id=224555
Reviewed by Fujii Hironori.
Remove any ENABLE(WEBGL) guards that reference functionality that isn't WebGL specific.
Modify the CMakeLists file to build with USE_ANGLE_EGL when ENABLE_WEBGL is OFF.
* CMakeLists.txt:
* platform/graphics/GLContext.h:
* platform/graphics/angle/ANGLEHeaders.h:
* platform/graphics/egl/GLContextEGL.cpp:
(WebCore::GLContextEGL::platformContext):
* platform/graphics/egl/GLContextEGL.h:
* platform/graphics/glx/GLContextGLX.cpp:
(WebCore::GLContextGLX::platformContext):
* platform/graphics/glx/GLContextGLX.h:
* platform/graphics/opengl/TemporaryOpenGLSetting.cpp:
* platform/graphics/opengl/TemporaryOpenGLSetting.h:
2021-04-15 Mark Lam <mark.lam@apple.com>
Optimize the DeferTermination scope to be more efficient.
https://bugs.webkit.org/show_bug.cgi?id=224619
Reviewed by Saam Barati.
* workers/WorkerOrWorkletScriptController.cpp:
2021-04-15 Antoine Quint <graouts@webkit.org>
calc() should not contain 0 values other than percentages
https://bugs.webkit.org/show_bug.cgi?id=224611
Reviewed by Simon Fraser.
A calc() value containing a 0px value, such as calc(10% + 0px), was incorrectly serialized
as-is for the computed style, instead of the simplified form containing on the percentage.
For the correct behavior we need to make four changes in css/CSSCalculationValue.cpp:
1. in createCSS(const CalcExpressionNode&, const RenderStyle&), when dealing with a node
that is CalcExpressionNodeType::Length, we return nullptr in the case then node's Length
is a 0 value that's not a percentage,
2. additionally, in createCSS(const Vector<std::unique_ptr<CalcExpressionNode>>&, const RenderStyle&),
we no longer bail when a nullptr value is returned for a child and instead proceed with the
processing of further children, ensuring that a 0px value in, say, a Sum operation is removed
while retaining other non-zero values,
3. back in createCSS(const CalcExpressionNode&, const RenderStyle&), for CalcExpressionNodeType::Operation
nodes, when there is single parameter to a Sum operation we return that parameter rather than
a Sum operation, and do the same for a Negate operation, making sure we return negated node if
it is the second child,
4. finally, in CSSCalcOperationNode::buildCSSText(const CSSCalcExpressionNode&, StringBuilder&)
when we serialize a calculated value, we do not enclose the value in a `calc()` string if the
node is a CSSCalcPrimitiveValueNode.
* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcOperationNode::buildCSSText):
(WebCore::createCSS):
2021-04-15 Mark Lam <mark.lam@apple.com>
Refactor inline functions out of HashMapImpl.h into HashMapImplInlines.h.
https://bugs.webkit.org/show_bug.cgi?id=224616
rdar://76713709
Reviewed by Yusuke Suzuki.
* bindings/js/SerializedScriptValue.cpp:
2021-04-15 Alex Christensen <achristensen@webkit.org>
Use WTF::Function instead of std::function in SVGPropertyAnimatorFactory::attributeAnimatorCreator
https://bugs.webkit.org/show_bug.cgi?id=224586
Reviewed by Darin Adler.
sizeof(WTF::Function<void()>) is 8.
sizeof(std::function<void()>) is 48.
* svg/properties/SVGPropertyAnimatorFactory.h:
(WebCore::SVGPropertyAnimatorFactory::attributeAnimatorCreator):
2021-04-14 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Image extraction fails in Google search results
https://bugs.webkit.org/show_bug.cgi?id=224527
<rdar://problem/76500331>
Reviewed by Andy Estes.
Override the `-webkit-user-select` CSS property in Google search results pages, and make a slight adjustment to
the user agent stylesheet.
Test: fast/images/image-extraction/image-overlay-in-image-with-zero-font-size.html
* html/HTMLElement.cpp:
(WebCore::HTMLElement::updateWithImageExtractionResult):
* html/shadow/imageOverlay.css:
(div#image-overlay):
Additionally force a default value for the font size and font family of the image overlay text, so that a
cascading font size of 0 won't end up breaking logic for computing image overlay CSS transforms. See layout test
for more details.
* page/Quirks.cpp:
(WebCore::Quirks::needsToForceUserSelectWhenInstallingImageOverlay const):
* page/Quirks.h:
2021-04-15 Antti Koivisto <antti@apple.com>
Remove unused RunIterator::setAtEnd
https://bugs.webkit.org/show_bug.cgi?id=224597
Reviewed by Zalan Bujtas.
* layout/integration/LayoutIntegrationLineIteratorLegacyPath.h:
(WebCore::LayoutIntegration::LineIteratorLegacyPath::atEnd const):
(WebCore::LayoutIntegration::LineIteratorLegacyPath::setAtEnd): Deleted.
* layout/integration/LayoutIntegrationLineIteratorModernPath.h:
(WebCore::LayoutIntegration::LineIteratorModernPath::atEnd const):
(WebCore::LayoutIntegration::LineIteratorModernPath::setAtEnd):
* layout/integration/LayoutIntegrationRunIterator.cpp:
(WebCore::LayoutIntegration::RunIterator::setAtEnd): Deleted.
* layout/integration/LayoutIntegrationRunIterator.h:
* layout/integration/LayoutIntegrationRunIteratorLegacyPath.h:
(WebCore::LayoutIntegration::RunIteratorLegacyPath::atEnd const):
(WebCore::LayoutIntegration::RunIteratorLegacyPath::setAtEnd): Deleted.
* layout/integration/LayoutIntegrationRunIteratorModernPath.h:
(WebCore::LayoutIntegration::RunIteratorModernPath::atEnd const):
(WebCore::LayoutIntegration::RunIteratorModernPath::setAtEnd):
2021-04-15 Philippe Normand <pnormand@igalia.com>
[WebRTC][GStreamer] Build and use the openh264 based encoder if present on the system
https://bugs.webkit.org/show_bug.cgi?id=202538
<rdar://problem/76047172>
Reviewed by Xabier Rodriguez-Calvar.
Enable the openh264 encoder if it is available, it would be preferred over existing
GStreamer H.264 encoders in such case.
* platform/mediastream/libwebrtc/GStreamerVideoCommon.cpp:
(WebCore::supportedH264Formats):
* platform/mediastream/libwebrtc/GStreamerVideoCommon.h:
* platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
* platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
(WebCore::GStreamerVideoEncoderFactory::CreateVideoEncoder):
(WebCore::GStreamerVideoEncoderFactory::GetSupportedFormats const):
2021-04-15 Youenn Fablet <youenn@apple.com>
Make RTCEncodedVideoFrameMetadata.contributingSources undefined until properly supported
https://bugs.webkit.org/show_bug.cgi?id=224540
Reviewed by Eric Carlson.
We are not yet ready to expose contributing sources for video.
It seems better to have the corresponding field be undefined instead of an empty array.
Covered by updated test.
* Modules/mediastream/RTCEncodedVideoFrame.idl:
* Modules/mediastream/RTCRtpTransformableFrame.h:
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransformableFrame.cpp:
(WebCore::LibWebRTCRtpTransformableFrame::videoMetadata const):
2021-04-15 Chris Lord <clord@igalia.com>
Make FontFace parsing worker-safe
https://bugs.webkit.org/show_bug.cgi?id=224426
Reviewed by Darin Adler.
Make CSS FontFace property parsing safe to do in a Worker. Instead of
constructing a rule per property and using the full CSSPropertyParser
path, instead factor out the specific, necessary property parsers into a
new CSSPropertyParserWorkerSafe and make sure they're safe to use in a
Worker (mainly by allowing for specifying the CSSValuePool so that
main-thread singletons don't get used).
No new tests, no change in behavior.
* Sources.txt: Add CSSPropertyParserWorkerSafe.cpp/.h
* WebCore.xcodeproj/project.pbxproj:
* css/FontFace.cpp: Call setters with the ScriptExecutionContext so
that we have access to ::cssValuePool() and use new worker-safe
parser functions.
(WebCore::FontFace::create):
(WebCore::FontFace::setFamily):
(WebCore::FontFace::setStyle):
(WebCore::FontFace::setWeight):
(WebCore::FontFace::setStretch):
(WebCore::FontFace::setUnicodeRange):
(WebCore::FontFace::setFeatureSettings):
(WebCore::FontFace::setDisplay):
* css/FontFace.h:
* css/FontFace.idl:
* css/parser/CSSParser.cpp: Move WorkerSafe parsing functions to
CSSPropertyParserWorkerSafe and remove now-unnecessary
parseFontFaceDescriptor.
* css/parser/CSSParser.h:
* css/parser/CSSPropertyParser.cpp: Move FontFace property parsers to
CSSPropertyParserWorkerSafe.
(WebCore::CSSPropertyParser::parseSingleValue):
(WebCore::CSSPropertyParser::parseFontFaceDescriptor):
(WebCore::CSSPropertyParser::consumeFont):
* css/parser/CSSPropertyParser.h:
* css/parser/CSSPropertyParserHelpers.cpp: Add WorkerSafe variants for
some of the basic consume helpers.
(WebCore::CSSPropertyParserHelpers::CalcParser::CalcParser):
(WebCore::CSSPropertyParserHelpers::CalcParser::consumeValue):
(WebCore::CSSPropertyParserHelpers::CalcParser::consumeInteger):
(WebCore::CSSPropertyParserHelpers::CalcParser::consumeNumber):
(WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
(WebCore::CSSPropertyParserHelpers::consumeFontWeightNumberWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumePercent):
(WebCore::CSSPropertyParserHelpers::consumePercentWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumeAngle):
(WebCore::CSSPropertyParserHelpers::consumeAngleWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumeIdent):
(WebCore::CSSPropertyParserHelpers::consumeIdentWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumeFontRaw):
* css/parser/CSSPropertyParserHelpers.h:
(WebCore::CSSPropertyParserHelpers::consumeIdent):
(WebCore::CSSPropertyParserHelpers::consumeIdentWorkerSafe):
* css/parser/CSSPropertyParserWorkerSafe.cpp: Added.
(WebCore::CSSPropertyParserWorkerSafe::parseFont):
(WebCore::CSSPropertyParserWorkerSafe::parseColor):
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceSrc):
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceStyle):
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceWeight):
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceStretch):
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceUnicodeRange):
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceFeatureSettings):
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceDisplay):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcURI):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcLocal):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrc):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStyle):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStyleKeywordValue):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStyleRange):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontWeightAbsoluteKeywordValue):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontWeightAbsoluteRange):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontWeightAbsolute):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStretchKeywordValue):
(WebCore::CSSPropertyParserHelpersWorkerSafe::fontStretchIsWithinRange):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStretch):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStretchRange):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceUnicodeRange):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFeatureTag):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFeatureSettings):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceFontDisplay):
* css/parser/CSSPropertyParserWorkerSafe.h: Added.
* dom/ScriptExecutionContext.cpp: Add ::cssValuePool().
(WebCore::ScriptExecutionContext::cssValuePool):
* dom/ScriptExecutionContext.h:
* html/canvas/CanvasRenderingContext2D.cpp: Update due to refactoring.
(WebCore::CanvasRenderingContext2D::setFontWithoutUpdatingStyle):
* html/canvas/CanvasStyle.cpp:
(WebCore::parseColor):
* html/canvas/OffscreenCanvasRenderingContext2D.cpp:
(WebCore::OffscreenCanvasRenderingContext2D::setFont):
* workers/WorkerGlobalScope.h:
2021-04-15 Manuel Rego Casasnovas <rego@igalia.com>
Move FocusRemovalEventsMode into FocusOptions
https://bugs.webkit.org/show_bug.cgi?id=224549
Reviewed by Darin Adler.
This patch is just a refactoring that moves FocusRemovalEventsMode enum into FocusOptions.
This allows us to simplify some method signatures, as they'll just receive a FocusOptions parameter, instead of two parameters for FocusRemovalEventsMode and FocusDirection.
There is no change of behavior, just a code refactoring.
* dom/Document.cpp:
(WebCore::Document::adjustFocusedNodeOnNodeRemoval):
(WebCore::Document::setFocusedElement):
* dom/Document.h:
(WebCore::Document::setFocusedElement):
* dom/Element.cpp:
(WebCore::Element::focus):
* dom/FocusOptions.h:
* page/FocusController.cpp:
(WebCore::FocusController::setFocusedElement):
* page/FocusController.h:
(WebCore::FocusController::setFocusedElement):
2021-04-09 Sergio Villar Senin <svillar@igalia.com>
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 <zalan@apple.com>
[RenderTreeBuilder] Cleanup the inline tree when moving subtrees
https://bugs.webkit.org/show_bug.cgi?id=224342
<rdar://76349279>
Reviewed by Antti Koivisto.
When an inline box is moved over to a different BFC (<span>), any inline level descendant (<span><img></span>) 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 Youenn Fablet <youenn@apple.com>
Update RTCScriptTransform constructor up to spec
https://bugs.webkit.org/show_bug.cgi?id=224447
Reviewed by Eric Carlson.
Remove built-in support for message ports in RTCRtpScriptTransform/RTCRtpScriptTransformer.
Instead pass a transfer object to RTCRtpScriptTransform constructor used jointly with options to enable the same behavior.
This aligns with the change made in https://github.com/w3c/webrtc-encoded-transform/pull/96.
Covered by updated tests.
* Modules/mediastream/RTCRtpScriptTransform.cpp:
(WebCore::RTCRtpScriptTransform::create):
(WebCore::RTCRtpScriptTransform::RTCRtpScriptTransform):
* Modules/mediastream/RTCRtpScriptTransform.h:
* Modules/mediastream/RTCRtpScriptTransform.idl:
* Modules/mediastream/RTCRtpScriptTransformer.cpp:
(WebCore::RTCRtpScriptTransformer::create):
(WebCore::RTCRtpScriptTransformer::RTCRtpScriptTransformer):
(WebCore::RTCRtpScriptTransformer::options):
* Modules/mediastream/RTCRtpScriptTransformer.h:
(WebCore::RTCRtpScriptTransformer::port): Deleted.
* Modules/mediastream/RTCRtpScriptTransformer.idl:
* workers/DedicatedWorkerGlobalScope.cpp:
(WebCore::DedicatedWorkerGlobalScope::createRTCRtpScriptTransformer):
* workers/DedicatedWorkerGlobalScope.h:
* workers/Worker.cpp:
(WebCore::Worker::createRTCRtpScriptTransformer):
* workers/Worker.h:
2021-04-15 Youenn Fablet <youenn@apple.com>
REGRESSION(Safari 14): iframe with blob url does not work with sandboxing
https://bugs.webkit.org/show_bug.cgi?id=222312
<rdar://problem/74927624>
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-15 Carlos Garcia Campos <cgarcia@igalia.com>
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-15 Ryosuke Niwa <rniwa@webkit.org>
Deploy Ref/RefPtr in ReplaceSelectionCommand
https://bugs.webkit.org/show_bug.cgi?id=224591
Reviewed by Jiewen Tan.
Deployed Ref/RefPtr in ReplaceSelectionCommand.cpp per guidelines we outlined in
https://lists.webkit.org/pipermail/webkit-dev/2020-September/031386.html
* editing/ReplaceSelectionCommand.cpp:
(WebCore::positionAvoidingPrecedingNodes):
(WebCore::ReplacementFragment::ReplacementFragment):
(WebCore::ReplacementFragment::removeUnrenderedNodes):
(WebCore::ReplacementFragment::removeInterchangeNodes):
(WebCore::ReplaceSelectionCommand::shouldMerge):
(WebCore::fragmentNeedsColorTransformed): Protected the code accessing the render tree
with ScriptDisallowedScope::InMainThread.
(WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
(WebCore::ReplaceSelectionCommand::makeInsertedContentRoundTrippableWithHTMLTreeBuilder):
(WebCore::ReplaceSelectionCommand::moveNodeOutOfAncestor):
(WebCore::ReplaceSelectionCommand::positionAtEndOfInsertedContent const):
(WebCore::handleStyleSpansBeforeInsertion):
(WebCore::ReplaceSelectionCommand::handleStyleSpans):
(WebCore::enclosingInline):
(WebCore::ReplaceSelectionCommand::doApply):
(WebCore::ReplaceSelectionCommand::shouldPerformSmartReplace const):
(WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace):
(WebCore::ReplaceSelectionCommand::mergeTextNodesAroundPosition):
(WebCore::singleChildList):
(WebCore::deepestSingleChildList):
(WebCore::ReplaceSelectionCommand::insertAsListItems):
(WebCore::ReplaceSelectionCommand::performTrivialReplace):
2021-04-14 Antti Koivisto <antti@apple.com>
Preloaded async scripts should use the same priority as the normally loaded ones
https://bugs.webkit.org/show_bug.cgi?id=224537
Reviewed by Sam Weinig.
Use the same priority (medium instead of low) when preloading.
Factor default priorities to a separate type making it easier to keep them in sync.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/LoadableClassicScript.cpp:
(WebCore::LoadableClassicScript::load):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::process):
* html/parser/HTMLResourcePreloader.cpp:
(WebCore::PreloadRequest::resourceRequest):
* loader/DefaultResourceLoadPriority.cpp: Added.
(WebCore::DefaultResourceLoadPriority::forResourceType):
* loader/DefaultResourceLoadPriority.h: Added.
* loader/LinkLoader.cpp:
(WebCore::LinkLoader::preloadIfNeeded):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::CachedResource):
(WebCore::CachedResource::setLoadPriority):
(WebCore::CachedResource::defaultPriorityForResourceType): Deleted.
* loader/cache/CachedResource.h:
(WebCore::CachedResource::identifierForLoadWithoutResourceLoader const):
2021-04-14 Tim Nguyen <ntim@apple.com>
Omit default position/angle when serializing radial & conic gradients
https://bugs.webkit.org/show_bug.cgi?id=223892
Reviewed by Antti Koivisto.
Test: LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/background-image-computed.sub.html
* css/CSSGradientValue.cpp:
(WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange):
(WebCore::CSSLinearGradientValue::customCSSText const):
(WebCore::CSSRadialGradientValue::customCSSText const):
(WebCore::CSSConicGradientValue::customCSSText const):
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::isCenterPosition const):
* css/CSSPrimitiveValue.h:
2021-04-14 Don Olmstead <don.olmstead@sony.com>
[Nicosia] NicosiaGCGLLayer is unneeded when ENABLE_WEBGL is OFF
https://bugs.webkit.org/show_bug.cgi?id=224557
Reviewed by Michael Catanzaro.
Add an ENABLE(WEBGL) guard around NicosiaGCGLLayer.
* platform/graphics/nicosia/texmap/NicosiaGCGLLayer.cpp:
* platform/graphics/nicosia/texmap/NicosiaGCGLLayer.h:
2021-04-14 Ryosuke Niwa <rniwa@webkit.org>
Avoid indirect load in ContainerNode::hasOneChild()
https://bugs.webkit.org/show_bug.cgi?id=224589
Reviewed by Chris Dumez.
Getting nextSibling() will involve loading the first child into the register.
Avoid that and just check m_firstChild and m_lastChild instead to avoid this extra memory load.
* dom/ContainerNode.h:
(WebCore::ContainerNode::hasOneChild const):
2021-04-14 Ryosuke Niwa <rniwa@webkit.org>
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 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Make image extraction interactions work for elements inside links
https://bugs.webkit.org/show_bug.cgi?id=224576
<rdar://problem/76664721>
Reviewed by Devin Rousso.
Make a slight adjustment to `EventHandler::canMouseDownStartSelect` to allow selection to begin when handling a
mousedown over text inside an image overlay.
Test: fast/images/image-extraction/mac/select-image-overlay-in-link-with-mouse-drag.html
* html/HTMLElement.cpp:
(WebCore::HTMLElement::isImageOverlayText):
Add an overloaded version of this helper method that takes a pointer instead of a reference, and use it in
several places where we current check the nullity of a `Node*` before dereferencing it and passing it into
`isImageOverlayText()`.
* html/HTMLElement.h:
* page/DragController.cpp:
(WebCore::DragController::draggableElement const):
* page/EventHandler.cpp:
(WebCore::EventHandler::canMouseDownStartSelect):
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::updateSelectionForMouseDrag):
Additionally, make it so that we only invalidate a click (i.e. prevent mouse release from dispatching a click
event) in `EventHandler::updateSelectionForMouseDrag` in the case where we're selecting text in an image
overlay, if the selection hasn't actually changed.
2021-04-14 Devin Rousso <drousso@apple.com>
[Apple Pay] add WKA hooks for `ApplePayModifier`
https://bugs.webkit.org/show_bug.cgi?id=224585
<rdar://problem/76669793>
Reviewed by Wenson Hsieh.
* Modules/applepay/paymentrequest/ApplePayModifier.h:
2021-04-14 Chris Dumez <cdumez@apple.com>
Flaky crash under AudioSummingJunction::removeOutput() on Debug bots
https://bugs.webkit.org/show_bug.cgi?id=224584
Reviewed by Eric Carlson.
Add DisableMallocRestrictionsForCurrentThreadScope to allow the heap allocation until I can investigate
if we can avoid it.
* Modules/webaudio/AudioSummingJunction.cpp:
(WebCore::AudioSummingJunction::removeOutput):
2021-04-13 BJ Burg <bburg@apple.com>
Web Inspector: add setting to allow inspecting Web Inspector
https://bugs.webkit.org/show_bug.cgi?id=224082
<rdar://75695002>
Reviewed by Devin Rousso.
Add a property to check if inspecting inspector is allowed,
and to enable/disable upon loading the frontend or toggling the setting.
* en.lproj/Localizable.strings:
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::inspectInspector):
(WebCore::InspectorFrontendHost::allowsInspectingInspector):
(WebCore::InspectorFrontendHost::setAllowsInspectingInspector):
* inspector/InspectorFrontendHost.h:
* inspector/InspectorFrontendHost.idl:
2021-04-14 Sam Weinig <weinig@apple.com>
Use range-for loop in target contrast selection to simplify/improve code readability
https://bugs.webkit.org/show_bug.cgi?id=224512
Reviewed by Darin Adler.
Address some additional post landing feedback from Darin.
- Use range-for loop in target contrast selection.
- Use double to represent luminance, lightness and contrast everywhere.
This avoid unnecessary conversions to and from float.
- Rename Color::contrastRatio(Color, Color) to just contrastRatio(Color, Color)
and move it ColorLuminance.h/cpp with the other contrastRatio overloads.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
Add ColorLuminance.cpp
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::selectFirstColorThatMeetsOrExceedsTargetContrast):
Convert colorsToCompareAgainst to an r-value since vector is never used after
calling this.
(WebCore::CSSPropertyParserHelpers::selectFirstColorWithHighestContrast):
Convert colorsToCompareAgainst to an r-value since vector is never used after
calling this. Also, switch to a range-for loop to aid readability.
(WebCore::CSSPropertyParserHelpers::parseColorContrastFunctionParameters):
Move colorsToCompareAgainst to the select functions.
* platform/graphics/Color.h:
* platform/graphics/Color.cpp:
(WebCore::Color::lightness const):
(WebCore::Color::luminance const):
Use double to represent lightness and luminance.
(WebCore::Color::contrastRatio): Deleted.
Moved to ColorLuminance.h/cpp
* platform/graphics/ColorLuminance.cpp: Added.
(WebCore::contrastRatio):
* platform/graphics/ColorLuminance.h:
(WebCore::relativeLuminance):
(WebCore::contrastRatio):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::disabledTextColor const):
* rendering/TextPaintStyle.cpp:
(WebCore::textColorIsLegibleAgainstBackgroundColor):
Use double to represent luminance and constrast everywhere.
2021-04-14 Antti Koivisto <antti@apple.com>
RunIterator::traverseNext/PreviousOnLineIgnoringLineBreak should skip over WBRs
https://bugs.webkit.org/show_bug.cgi?id=224545
rdar://76101143
Reviewed by Zalan Bujtas.
Test: fast/editing/wbr-iterator-crash.html
* layout/integration/LayoutIntegrationRunIterator.cpp:
(WebCore::LayoutIntegration::RunIterator::traverseNextOnLineIgnoringLineBreak):
(WebCore::LayoutIntegration::RunIterator::traversePreviousOnLineIgnoringLineBreak):
Skip over (instead of bailing) runs with isLineBreak() set. It is true for <WBR> so there can be multiple on a line.
2021-04-14 Lauro Moura <lmoura@igalia.com>
REGRESSION(r275948) Wrap sh::ShaderVariable into UniqueRef to fit in HashMap
https://bugs.webkit.org/show_bug.cgi?id=224567
Unreviewed build fix.
* platform/graphics/opengl/ExtensionsGLOpenGLCommon.cpp:
(WebCore::ExtensionsGLOpenGLCommon::getTranslatedShaderSourceANGLE):
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp:
(WebCore::GraphicsContextGLOpenGL::precisionsMatch const):
(WebCore::GraphicsContextGLOpenGL::mappedSymbolInShaderSourceMap):
(WebCore::GraphicsContextGLOpenGL::originalSymbolInShaderSourceMap):
(WebCore::GraphicsContextGLOpenGL::mappedSymbolName):
(WebCore::GraphicsContextGLOpenGL::shaderSource):
2021-04-14 Julian Gonzalez <julian_a_gonzalez@apple.com>
Crash in ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds()
https://bugs.webkit.org/show_bug.cgi?id=224520
Reviewed by Ryosuke Niwa.
Adopt RefPtr<Node> instead of using plain Node* here to avoid a crash.
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds):
2021-04-14 Devin Rousso <drousso@apple.com>
[iOS] limit how often `WebAVPlayerController` notifies the `PlaybackSessionModel` about changes to playback speed
https://bugs.webkit.org/show_bug.cgi?id=224515
<rdar://problem/75901463>
Reviewed by Eric Carlson.
This change will cause `HTMLMediaElement::setPlaybackRate` to not send IPC back and forth
between the WebProcess and UIProcess, as a modification to the `WebAVPlayerController` in
the UIProcess would notify its `PlaybackSessionModel` "delegate", which would in turn make
it's way back to the related `HTMLMediaElement::setPlaybackRate` in the WebProcess.
* platform/ios/WebAVPlayerController.mm:
(-[WebAVPlayerController init]):
(-[WebAVPlayerController dealloc]):
(-[WebAVPlayerController defaultPlaybackRate]): Added.
(-[WebAVPlayerController setDefaultPlaybackRate:]): Added.
(-[WebAVPlayerController rate]): Added.
(-[WebAVPlayerController setRate:]): Added.
(-[WebAVPlayerController observeValueForKeyPath:ofObject:change:context:]):
Instead of relying on ObjC KVO on `self` to handle changes to `defaultPlaybackRate` (and
`rate`), create an actual `setDefaultPlaybackRate:` so that we can handle cases where the
value is the same. Limit when we notify the `PlaybackSessionModel` to only when it has a
different value.
* platform/cocoa/PlaybackSessionModel.h:
* platform/cocoa/PlaybackSessionModelMediaElement.h:
* platform/cocoa/PlaybackSessionModelMediaElement.mm:
(WebCore::PlaybackSessionModelMediaElement::setPlaybackRate): Added.
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(VideoFullscreenControllerContext::setPlaybackRate): Added.
Add support for handling when the `rate` of the `AVPlayerController` changes too.
2021-04-14 Kate Cheney <katherine_cheney@apple.com>
Service worker soft-update loads not being marked app-bound
https://bugs.webkit.org/show_bug.cgi?id=223200
<rdar://problem/75438555>
Reviewed by Youenn Fablet.
We need to mark requests initiated by service worker soft updates as
app-bound based on the last navigation. We should get this value from the
NetworkResourceLoader and store it in SWServerRegistration so we can
use it to build a new request.
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::startScriptFetch):
* workers/service/server/SWServer.h:
Pass the entire SWServerRegistration to SWServer::startScriptFetch
now that we need more than one value from it. Move shouldRefreshCache
logic here instead of SWServerJobQueue::runUpdateJob.
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::runUpdateJob):
* workers/service/server/SWServerRegistration.cpp:
(WebCore::SWServerRegistration::scheduleSoftUpdate):
* workers/service/server/SWServerRegistration.h:
(WebCore::SWServerRegistration::isAppBound):
2021-04-14 Eric Carlson <eric.carlson@apple.com>
Allow text tracks to purge cues outside of the buffered range
https://bugs.webkit.org/show_bug.cgi?id=224489
Reviewed by Jer Noble.
TextTrackCues associated in-band tracks live "forever" - until the video element
is deleted or reloaded. This is fine for relatively short files, but not so good
for long lived files (eg. a very long live stream), or for timed metadata where
the "cue" size can be much larger than a text sample.
Allow text tracks to opt in to purging cues who's time range does not intersect
with the `buffered` range, where audio and video data is also not available. Only
AVFoundation backed in-band tracks opt in at this time, because AVFoundation will
redeliver cues if a time range is played again.
Tested manually as the only way to test this currently would be with an HLS stream
that would have to play too long for a layout test, or with an MSE text track but
we won't support text tracks in MSE yet.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerBufferedTimeRangesChanged): Allow tracks
that support purging cues to do so.
* html/HTMLMediaElement.h:
* html/track/InbandDataTextTrack.h: Return true for shouldPurgeCuesFromUnbufferedRanges();
* html/track/InbandGenericTextTrack.h: Ditto.
* html/track/TextTrack.cpp:
(WebCore::TextTrack::removeCuesNotInTimeRanges): Remove all cues who's time range
does not intersect with the buffered range.
* html/track/TextTrack.h:
(WebCore::TextTrack::shouldPurgeCuesFromUnbufferedRanges const):
2021-04-14 Antti Koivisto <antti@apple.com>
Remove unused InlineBox::next/previousLeafOnLineIgnoringLineBreak()
https://bugs.webkit.org/show_bug.cgi?id=224542
Reviewed by Zalan Bujtas.
* rendering/InlineBox.cpp:
(WebCore::InlineBox::nextLeafOnLineIgnoringLineBreak const): Deleted.
(WebCore::InlineBox::previousLeafOnLineIgnoringLineBreak const): Deleted.
* rendering/InlineBox.h:
2021-04-14 Frédéric Wang <fwang@igalia.com>
Crash in RenderBlock::addOverflowFromChildren
https://bugs.webkit.org/show_bug.cgi?id=223539
Reviewed by Ryosuke Niwa.
For an <svg> element that is a direct child of a <foreignObject>, a RenderSVGRoot is
generally created. However, a RenderSVGViewportContainer is currently created instead if
the element is inside a shadow tree. This is leading to bad state during the layout of
the foreign object, causing a debug assertion and a nullptr crash. This patch fixes this
issue by always treating direct <svg> child of <foreignObject> as an outermost SVG element.
Tests: svg/foreignObject/svg-child-of-foreign-object-in-shadow-tree-crash.html
svg/outermost-svg-root.html
* svg/SVGElement.cpp:
(WebCore::SVGElement::isOutermostSVGSVGElement const): Lower down the priority of the rule
"is in shadow tree".
2021-04-14 Zalan Bujtas <zalan@apple.com>
InlineBox should not hold a reference to RenderObject
https://bugs.webkit.org/show_bug.cgi?id=224506
Reviewed by Antti Koivisto.
The InlineBox/RenderObject relationship is somewhat error-prone (see RenderBox::setInlineBoxWrapper vs. InlineElementBox::extractLine) and it's rather easy to delete one without letting the other know.
* rendering/InlineBox.cpp:
(WebCore::InlineBox::showNodeTreeForThis const):
(WebCore::InlineBox::showLineTreeForThis const):
(WebCore::InlineBox::caretMinOffset const):
(WebCore::InlineBox::caretMaxOffset const):
(WebCore::InlineBox::adjustPosition):
(WebCore::InlineBox::selectionState):
(WebCore::InlineBox::canAccommodateEllipsis const):
(WebCore::InlineBox::locationIncludingFlipping const):
(WebCore::InlineBox::flipForWritingMode const):
* rendering/InlineBox.h:
(WebCore::InlineBox::renderer const):
(WebCore::InlineBox::boxModelObject const):
(WebCore::InlineBox::InlineBox):
2021-04-14 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] Indeterminate progress bars should update at 60fps
https://bugs.webkit.org/show_bug.cgi?id=224372
<rdar://problem/76416848>
Reviewed by Wenson Hsieh.
* rendering/RenderProgress.cpp:
(WebCore::RenderProgress::animationTimerFired):
Added a FIXME to state that progress bar animation should be performed
as part of the rendering update lifecycle. Progress bars have always
maintained their own timers for animation, however, the update interval
may not always match the display's refresh rate.
* rendering/RenderThemeIOS.mm:
Ensure a smoother animation by increasing the frame rate to 60fps.
2021-04-14 Carlos Garcia Campos <cgarcia@igalia.com>
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 <rbuis@igalia.com>
Make SVGElement::getBoundingBox retrieve bbox from RenderObject
https://bugs.webkit.org/show_bug.cgi?id=224482
Reviewed by Zalan Bujtas.
Make SVGElement::getBoundingBox retrieve bbox from RenderObject.
Also make it const and return an Optional.
* dom/Element.cpp:
(WebCore::Element::boundsInRootViewSpace):
(WebCore::Element::absoluteEventBounds):
(WebCore::Element::boundingAbsoluteRectWithoutLayout):
* page/ResizeObservation.cpp:
(WebCore::ResizeObservation::computeObservedSize const):
* svg/SVGElement.cpp:
(WebCore::SVGElement::getBoundingBox const):
(WebCore::SVGElement::getBoundingBox): Deleted.
* svg/SVGElement.h:
2021-04-13 Kimmo Kinnunen <kkinnunen@apple.com>
AudioSourceProviderAVFObjC should lock all multithreaded objects
https://bugs.webkit.org/show_bug.cgi?id=224230
Reviewed by Eric Carlson.
Lock following objects with TapStorage::lock:
AudioSourceProviderAVFObjC::m_tapStorage
AudioSourceProviderAVFObjC::m_avPlayerItem
Do not clear the tapStorage nor the _this pointer from
the audio thread. This is a race that cannot be overcome
since the main thread needs to access the m_tapStorage pointer to
lock the m_tapStorage pointer for modification.
Initialize m_tap in more robust way, in case initialization fails.
Do not leave stale m_tapStorage present when destroying the mixer.
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::~AudioSourceProviderAVFObjC):
(WebCore::AudioSourceProviderAVFObjC::destroyMixIfNeeded):
(WebCore::AudioSourceProviderAVFObjC::createMixIfNeeded):
(WebCore::AudioSourceProviderAVFObjC::initCallback):
(WebCore::AudioSourceProviderAVFObjC::finalizeCallback):
2021-04-13 Fujii Hironori <Hironori.Fujii@sony.com>
Table caption jumps to the bottom of the table after simplified table relayout
https://bugs.webkit.org/show_bug.cgi?id=187903
<rdar://problem/42506245>
Reviewed by Zalan Bujtas.
Test: fast/table/caption-simplified-layout.html
* rendering/RenderTable.cpp:
(WebCore::RenderTable::simplifiedNormalFlowLayout):
Do not call layoutCaptions().
2021-04-13 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Simplify DisplayList::Iterator part 4: Move DisplayList::Iterator to its own .h/.cpp files
https://bugs.webkit.org/show_bug.cgi?id=224146
Reviewed by Wenson Hsieh.
This doesn't actually change any lines of code; it just moves code into different files.
This patch isn't strictly necessary, but I think it helps, because the iterator contains
a non-trivial amount of logic.
No new tests because there is no behavior change.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::begin const):
(WebCore::DisplayList::DisplayList::end const):
(WebCore::DisplayList::DisplayList::iterator::atEnd const): Deleted.
(WebCore::DisplayList::DisplayList::iterator::updateCurrentDrawingItemExtent): Deleted.
(WebCore::DisplayList::DisplayList::iterator::updateCurrentItem): Deleted.
(WebCore::DisplayList::DisplayList::iterator::advance): Deleted.
(WebCore::DisplayList::DisplayList::iterator::clearCurrentItem): Deleted.
(WebCore::DisplayList::DisplayList::iterator::moveToEnd): Deleted.
(WebCore::DisplayList::DisplayList::iterator::moveCursorToStartOfCurrentBuffer): Deleted.
* platform/graphics/displaylists/DisplayList.h:
(WebCore::DisplayList::DisplayList::iterator::iterator): Deleted.
(WebCore::DisplayList::DisplayList::iterator::~iterator): Deleted.
(WebCore::DisplayList::DisplayList::iterator::operator==): Deleted.
(WebCore::DisplayList::DisplayList::iterator::operator!=): Deleted.
(WebCore::DisplayList::DisplayList::iterator::operator++): Deleted.
(WebCore::DisplayList::DisplayList::iterator::operator* const): Deleted.
(WebCore::DisplayList::DisplayList::iterator::itemBuffer const): Deleted.
(WebCore::DisplayList::DisplayList::begin const): Deleted.
(WebCore::DisplayList::DisplayList::end const): Deleted.
* platform/graphics/displaylists/DisplayListIterator.cpp: Added.
(WebCore::DisplayList::DisplayList::Iterator::atEnd const):
(WebCore::DisplayList::DisplayList::Iterator::updateCurrentDrawingItemExtent):
(WebCore::DisplayList::DisplayList::Iterator::updateCurrentItem):
(WebCore::DisplayList::DisplayList::Iterator::advance):
(WebCore::DisplayList::DisplayList::Iterator::clearCurrentItem):
(WebCore::DisplayList::DisplayList::Iterator::moveToEnd):
(WebCore::DisplayList::DisplayList::Iterator::moveCursorToStartOfCurrentBuffer):
* platform/graphics/displaylists/DisplayListIterator.h: Added.
(WebCore::DisplayList::DisplayList::Iterator::Iterator):
(WebCore::DisplayList::DisplayList::Iterator::~Iterator):
(WebCore::DisplayList::DisplayList::Iterator::operator==):
(WebCore::DisplayList::DisplayList::Iterator::operator!=):
(WebCore::DisplayList::DisplayList::Iterator::operator++):
(WebCore::DisplayList::DisplayList::Iterator::operator* const):
(WebCore::DisplayList::DisplayList::Iterator::itemBuffer const):
* platform/graphics/displaylists/DisplayListReplayer.cpp:
2021-04-13 Alex Christensen <achristensen@webkit.org>
Disable YouTube Flash and QuickTime plug in replacements on iOS
https://bugs.webkit.org/show_bug.cgi?id=224453
Reviewed by Chris Dumez.
* page/Settings.yaml:
2021-04-13 Ziran Sun <zsun@igalia.com>
[css-grid] Incorrect track sizing when using relative sized items in 'auto' column tracks
https://bugs.webkit.org/show_bug.cgi?id=191627
Reviewed by Javier Fernandez.
This is a reland of r274596. The original patch was reverted because Google logo is not visible
on google.com.
Containing block for a grid item is the grid area it's located in. During the GridTrackSizingAlgorithm,
we determine that this item has a relative size (percent in this case) and that the grid area is still
indefinite. Hence, we set nullopt for the grid area width and mark the item for layout. During the item's
layout, we call this RenderBox::containingBlockLogicalWidthForContent to determine the available height.
However, this method checks the containing block's width if the overridingContentLogicalWidth is nullopt,
which is incorrect for grid items. We should never use the grid container for resolving grid item's size.
This change is to return 0_lu for grid item when overridingContainingBlockContentLogicalWidth() returns
nullopt rather than use containing block's width. It also comments that there might be an issue with
RenderBox::containingBlockLogicalHeightForContent for grid item. It should return whatever value we get from
overridingContainingBlockContentLogicalHeight(), including WTF::nullopt.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::containingBlockLogicalWidthForContent const):
(WebCore::RenderBox::containingBlockLogicalHeightForContent const):
2021-04-13 Devin Rousso <drousso@apple.com>
[WebIDL] includes for `Conditional` dictionary members should also be guarded
https://bugs.webkit.org/show_bug.cgi?id=224501
<rdar://problem/76598492>
Reviewed by Tim Horton.
WebKitAdditions sometimes needs to conditionally include IDL files and in those cases the
generated `JS*.h` might not get created even though the wrapped C++ type does exist. In
these cases, we should also guard the `#include JS*.h` (in addition to the already guarded
usage of the wrapped C++ type in `convertDictionary`).
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDictionaryImplementationContent):
* bindings/scripts/test/TestDictionary.idl: Added.
* bindings/scripts/test/JS/JSTestDictionary.h: Added.
* bindings/scripts/test/JS/JSTestDictionary.cpp: Added.
* bindings/scripts/test/TestDictionaryWithOnlyConditionalMembers.idl:
* bindings/scripts/test/JS/JSTestDictionaryWithOnlyConditionalMembers.cpp:
* bindings/scripts/test/SupplementalDependencies.dep:
2021-04-13 Said Abou-Hallawa <said@apple.com>
[GPU Process] Make ImageBuffer calculate its memoryCost() from its size
https://bugs.webkit.org/show_bug.cgi?id=224306
Reviewed by Simon Fraser.
Instead of round-trip processes to get the backend memoryCost(), we can
calculate it from the size and the bytes alignment of each row in the
backend. These are static values so in the case of RemoteImageBufferProxy,
there is no need to ensure the backend is created in GPUP and it is mapped
in the Web Process.
* platform/graphics/ConcreteImageBuffer.h:
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::calculateBackendSize):
(WebCore::ImageBufferBackend::calculateMemoryCost):
(WebCore::ImageBufferBackend::ImageBufferBackend):
* platform/graphics/ImageBufferBackend.h:
(WebCore::ImageBufferBackend::calculateExternalMemoryCost):
(WebCore::ImageBufferBackend::memoryCost const): Deleted.
(WebCore::ImageBufferBackend::externalMemoryCost const): Deleted.
(WebCore::ImageBufferBackend::bytesPerRow const): Deleted.
- This is the general case of the backend which is 4-bytes aligned rows.
- calculateSafeBackendSize() returns the size whose bytesPerRow does not
overflow unsigned and whose memoryCost does not not overflow size_t.
* platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp:
(WebCore::ImageBufferCairoImageSurfaceBackend::calculateSafeBackendSize):
(WebCore::ImageBufferCairoImageSurfaceBackend::calculateBytesPerRow):
(WebCore::ImageBufferCairoImageSurfaceBackend::calculateMemoryCost):
(WebCore::ImageBufferCairoImageSurfaceBackend::create):
(WebCore::ImageBufferCairoImageSurfaceBackend::bytesPerRow const):
* platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.h:
cairo_format_stride_for_width() is used to calculate the bytesPerRow()
for Cairo port.
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::ImageBufferCGBackend::calculateBytesPerRow):
* platform/graphics/cg/ImageBufferCGBackend.h:
This is the CG case when the backend is 4-bytes aligned rows.
* platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
(WebCore::ImageBufferCGBitmapBackend::calculateSafeBackendSize):
(WebCore::ImageBufferCGBitmapBackend::calculateMemoryCost):
(WebCore::ImageBufferCGBitmapBackend::create):
(WebCore::ImageBufferCGBitmapBackend::bytesPerRow const):
* platform/graphics/cg/ImageBufferCGBitmapBackend.h:
This is the CG bitmap case where the backend is 4-bytes aligned rows.
* platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
(WebCore::ImageBufferIOSurfaceBackend::calculateSafeBackendSize):
(WebCore::ImageBufferIOSurfaceBackend::calculateBytesPerRow):
(WebCore::ImageBufferIOSurfaceBackend::calculateMemoryCost):
(WebCore::ImageBufferIOSurfaceBackend::calculateExternalMemoryCost):
(WebCore::ImageBufferIOSurfaceBackend::create):
(WebCore::ImageBufferIOSurfaceBackend::context const):
(WebCore::ImageBufferIOSurfaceBackend::calculateBackendSize): Deleted.
(WebCore::ImageBufferIOSurfaceBackend::memoryCost const): Deleted.
(WebCore::ImageBufferIOSurfaceBackend::externalMemoryCost const): Deleted.
* platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
IOSurfaceAlignProperty() is used to align the CG bytesPerRow to the proper
IOSurface alignment.
2021-04-13 Razvan Caliman <rcaliman@apple.com>
Web Inspector: Forced color scheme should reset on page refresh
https://bugs.webkit.org/show_bug.cgi?id=224485
<rdar://76227216>
Reviewed by BJ Burg.
Reset the forced color scheme on page reload to keep in sync with Web Inspector
behavior for other forced states, like pseudo-classes.
* page/Page.cpp:
(WebCore::Page::didCommitLoad):
2021-04-13 Alex Christensen <achristensen@webkit.org>
Remove SharedBuffer's equality operators with Ref<SharedBuffer>
https://bugs.webkit.org/show_bug.cgi?id=224464
Reviewed by Chris Dumez.
No change in behavior.
I'm doing this to make a Ref comparator for all Refs to remove another reason we use RefPtr instead of Ref, even when they're all non-null.
See bug 224412
* platform/SharedBuffer.h:
(WebCore::operator==): Deleted.
(WebCore::operator!=): Deleted.
* platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionForKeyIDs const):
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
2021-04-13 Kimmo Kinnunen <kkinnunen@apple.com>
AudioSourceProviderAVFObjC should check for m_client when dispatching setFormat
https://bugs.webkit.org/show_bug.cgi?id=224479
Reviewed by Eric Carlson.
Use a weak pointer to schedule the setFormat client callback.
If client is unset before any callback is run, cancel the
pending callbacks.
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::destroyMixIfNeeded):
(WebCore::AudioSourceProviderAVFObjC::createMixIfNeeded):
(WebCore::AudioSourceProviderAVFObjC::prepare):
2021-04-13 Kimmo Kinnunen <kkinnunen@apple.com>
AudioSourceProviderAVFObjC::setClient should check for m_avAssetTrack
https://bugs.webkit.org/show_bug.cgi?id=224478
Reviewed by Eric Carlson.
Check for m_avAssetTrack when setting the client.
This is done for consistency, it is unclear if this affects
real world content.
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::setClient):
(WebCore::AudioSourceProviderAVFObjC::setPlayerItem):
(WebCore::AudioSourceProviderAVFObjC::setAudioTrack):
(WebCore::AudioSourceProviderAVFObjC::destroyMixIfNeeded):
(WebCore::AudioSourceProviderAVFObjC::createMixIfNeeded):
2021-04-13 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r275889.
https://bugs.webkit.org/show_bug.cgi?id=224488
Unintentional commit
Reverted changeset:
https://trac.webkit.org/changeset/275889
2021-04-13 Sihui Liu <sihui_liu@apple.com>
Make WebIDBServer not block main thread during initialization
https://bugs.webkit.org/show_bug.cgi?id=224299
Reviewed by Geoffrey Garen.
* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::IDBServer):
* Modules/indexeddb/server/IDBServer.h:
(WebCore::IDBServer::IDBServer::lock): Deleted.
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::abortActiveTransactions):
2021-04-13 Frédéric Wang <fwang@igalia.com>
ASSERTION FAILED: !m_needExceptionCheck in CloneSerializer::serialize with postMessage({g:42})
https://bugs.webkit.org/show_bug.cgi?id=223785
Reviewed by Yusuke Suzuki.
Test: js/dom/missing-exception-check-in-clone-serializer-serialize.html
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::serialize): Use a local throw scope within this method and
handle potential exceptions.
(WebCore::CloneBase::shouldTerminate): Deleted.
2021-04-13 Philippe Normand <pnormand@igalia.com>
[GTK][WPE] Avif decoder build broken
https://bugs.webkit.org/show_bug.cgi?id=224232
Reviewed by Carlos Garcia Campos.
libavif 0.9.0 introduces an API break. avifDecoderParse() no
longer takes the image data as input. Instead, an avifIO object
needs to be associated with an avifDecoder and the avifDecoder
calls the read() method of the avifIO object to read image data
incrementally.
* platform/image-decoders/avif/AVIFImageReader.cpp:
(WebCore::AVIFImageReader::parseHeader):
(WebCore::AVIFImageReader::decodeFrame):
2021-04-13 Philippe Normand <pnormand@igalia.com>
[GStreamer] CaptureDevice monitoring is not implemented
https://bugs.webkit.org/show_bug.cgi?id=222889
Reviewed by Xabier Rodriguez-Calvar.
GStreamer capture device events are notified through a message bus associated to the the
GstDeviceMonitor, so we need to watch out for those messages and notify the
RealtimeSourceMediaCenter accordingly.
* platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:
(WebCore::GStreamerCaptureDeviceManager::~GStreamerCaptureDeviceManager):
(WebCore::GStreamerCaptureDeviceManager::captureDevices):
(WebCore::GStreamerCaptureDeviceManager::addDevice):
(WebCore::GStreamerCaptureDeviceManager::refreshCaptureDevices):
* platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h:
2021-04-13 Frédéric Wang <fwang@igalia.com>
ASSERTION FAILED: !m_needExceptionCheck in RTCPeerConnection::CertificateParameters
https://bugs.webkit.org/show_bug.cgi?id=223788
Reviewed by Ryosuke Niwa.
Test: js/dom/missing-exception-check-in-convertNumbers.html
* bindings/js/JSDOMConvertNumbers.h:
(WebCore::Converter<IDLFloat>::convert): Handle potential exceptions thrown by toNumber.
(WebCore::Converter<IDLDouble>::convert): Ditto.
2021-04-13 Rob Buis <rbuis@igalia.com>
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-13 Youenn Fablet <youenn@apple.com>
SFrameTransform should be able to take array buffer views as input
https://bugs.webkit.org/show_bug.cgi?id=224437
Reviewed by Eric Carlson.
Add support for processing ArrayBufferView.
We still output ArrayBuffer as output.
Test: webrtc/sframe-transform-buffer-source.html
* Modules/mediastream/RTCRtpSFrameTransform.cpp:
(WebCore::transformFrame):
(WebCore::RTCRtpSFrameTransform::createStreams):
2021-04-12 Sergio Villar Senin <svillar@igalia.com>
[css-flexbox] CDC COVID Vaccine Tracker: Safari garbles data table
https://bugs.webkit.org/show_bug.cgi?id=222581
Reviewed by Zalan Bujtas.
With nested flexboxes in which the flex-basis is a percentage the current code that stretches the item forces a relayout
of the children because it thinks it has percentage height descendants. That happens because we call
computePercentageLogicalHeights() with a mock percentage length to check whether a size is definite and that call performs
the addPercentageHeightDescendants() call. We should avoid calling the latter in those cases as we're just trying to
figure out whether we can compute the flex-basis used value or not.
Adding a new parameter to the aforementioned method so that the percentage height descendants map could be left untouched
in those cases where we just want to test size definiteness.
Apart from making the implementation more correct this brings some performance improvements for the cases described in the
first paragraph as it can be seen in the provided performance test (24.5% of improvement).
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePercentageLogicalHeight const):
* rendering/RenderBox.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::canComputePercentageFlexBasis const):
(WebCore::RenderFlexibleBox::childMainSizeIsDefinite const):
(WebCore::RenderFlexibleBox::useChildOverridingMainSizeForPercentageResolution):
* rendering/RenderFlexibleBox.h:
2021-04-13 Ryosuke Niwa <rniwa@webkit.org>
Use WTF::compactMap in HTMLSlotElement
https://bugs.webkit.org/show_bug.cgi?id=224470
Reviewed by Antti Koivisto.
Cleaned up the code in assignedNodes and assignedElements with WTF::compactMap.
* html/HTMLSlotElement.cpp:
(WebCore::HTMLSlotElement::assignedNodes const):
(WebCore::HTMLSlotElement::assignedElements const):
2021-04-13 Philippe Normand <pnormand@igalia.com>
[GStreamer] CaptureDevice monitor used from UIProcess
https://bugs.webkit.org/show_bug.cgi?id=222888
Reviewed by Youenn Fablet .
Move the device observer infrastructure from the WebKit UserMediaProcessManager to the
RealtimeMediaSourceCenter.
* platform/mediastream/CaptureDevice.h:
(WebCore::haveDevicesChanged):
* platform/mediastream/RealtimeMediaSourceCenter.cpp:
(WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter):
(WebCore::RealtimeMediaSourceCenter::Observer::~Observer):
(WebCore::RealtimeMediaSourceCenter::addDevicesChangedObserver):
(WebCore::RealtimeMediaSourceCenter::removeDevicesChangedObserver):
(WebCore::RealtimeMediaSourceCenter::captureDevicesChanged):
(WebCore::RealtimeMediaSourceCenter::triggerDevicesChangedObservers):
(WebCore::RealtimeMediaSourceCenter::setDevicesChangedObserver): Deleted.
* platform/mediastream/RealtimeMediaSourceCenter.h:
(WebCore::RealtimeMediaSourceCenter::Observer::devicesChanged):
2021-04-13 Antoine Quint <graouts@webkit.org>
calc() simplification for a multiplication should apply the multiplication to each value of an addition
https://bugs.webkit.org/show_bug.cgi?id=224376
Reviewed by Simon Fraser.
An expression such as calc(0.5 * (100% + 100px)) should be simplified to calc(50% + 50px). We produce
these types of expressions when blending between a percentage and a dimension, and they can also be
specified explicitly in style.
* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcOperationNode::combineChildren):
2021-04-13 Said Abou-Hallawa <said@apple.com>
SVG paced value animations overwrite user-provided keyTimes
https://bugs.webkit.org/show_bug.cgi?id=109010
Reviewed by Ryosuke Niwa.
If the calcMode is Paced, the 'keyTimes' attribute is ignored. Distances
between the 'values' are used produce an even pace of change across the
animation.
When changing calcMode, times defined in the 'keyTimes' attribute should
be used instead. To fix this, SVGAnimationElement can maintain two lists
for keyTimes: (1) keyTimesFromAttribute (2) keyTimesForPaced.
One of these lists will be picked by a new function 'keyTimes()' based
on the current calcMode.
Specs: https://www.w3.org/TR/SVG11/animate.html#CalcModeAttribute
Test: svg/animations/animate-calcMode-paced-overwrite-key-times.html
* svg/SVGAnimationElement.cpp:
(WebCore::SVGAnimationElement::parseAttribute):
(WebCore::SVGAnimationElement::calculateKeyTimesForCalcModePaced):
(WebCore::SVGAnimationElement::keyTimes const):
(WebCore::SVGAnimationElement::calculateKeyTimesIndex const):
(WebCore::SVGAnimationElement::calculatePercentFromKeyPoints const):
(WebCore::SVGAnimationElement::calculatePercentForFromTo const):
(WebCore::SVGAnimationElement::currentValuesFromKeyPoints const):
(WebCore::SVGAnimationElement::currentValuesForValuesAnimation):
(WebCore::SVGAnimationElement::startedActiveInterval):
(WebCore::SVGAnimationElement::updateAnimation):
* svg/SVGAnimationElement.h:
2021-04-12 Ryosuke Niwa <rniwa@webkit.org>
TextManipulationController should use weak pointers to Node
https://bugs.webkit.org/show_bug.cgi?id=215913
Reviewed by Wenson Hsieh.
Use WeakHashSet for m_manipulatedTextsWithNewContent, m_textNodesWithNewRenderer, and m_manipulatedNodes.
Also made TextManipulationController::removeNode take Node& instead of Node*.
* dom/Node.cpp:
(WebCore::Node::~Node):
(WebCore::Node::moveNodeToNewDocument):
* editing/TextManipulationController.cpp:
(WebCore::TextManipulationController::observeParagraphs):
(WebCore::TextManipulationController::didCreateRendererForElement):
(WebCore::TextManipulationController::didUpdateContentForText):
(WebCore::TextManipulationController::didCreateRendererForTextNode):
(WebCore::TextManipulationController::scheduleObservationUpdate):
(WebCore::TextManipulationController::replace):
(WebCore::TextManipulationController::removeNode):
* editing/TextManipulationController.h:
2021-04-12 Don Olmstead <don.olmstead@sony.com>
Remove GraphicsContextGLOpenGLPrivate
https://bugs.webkit.org/show_bug.cgi?id=224446
Reviewed by Myles C. Maxfield.
GraphicsContextGLOpenGLPrivate is dead code. It requires AppleWin to turn on WebGL which
it does not. This removes all references to it.
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp:
(WebCore::GraphicsContextGLOpenGL::create): Deleted.
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): Deleted.
(WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL): Deleted.
(WebCore::GraphicsContextGLOpenGL::setContextLostCallback): Deleted.
(WebCore::GraphicsContextGLOpenGL::setErrorMessageCallback): Deleted.
(WebCore::GraphicsContextGLOpenGL::makeContextCurrent): Deleted.
(WebCore::GraphicsContextGLOpenGL::checkGPUStatus): Deleted.
(WebCore::GraphicsContextGLOpenGL::isGLES2Compliant const): Deleted.
(WebCore::GraphicsContextGLOpenGL::platformLayer const): Deleted.
* platform/graphics/opengl/GraphicsContextGLOpenGLPrivate.cpp: Removed.
* platform/graphics/opengl/GraphicsContextGLOpenGLPrivate.h: Removed.
2021-04-12 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r275793.
https://bugs.webkit.org/show_bug.cgi?id=224466
Caused crashes on <http://facebook.com|facebook.com>
Reverted changeset:
"calc() simplification for a multiplication should apply the
multiplication to each value of an addition"
https://bugs.webkit.org/show_bug.cgi?id=224376
https://trac.webkit.org/changeset/275793
2021-04-12 Zalan Bujtas <zalan@apple.com>
Unreviewed, reverting r275761.
Caused InlineBox invalidation bugs.
Reverted changeset:
"[RenderTreeBuilder] Cleanup the inline box wrappers when
moving subtrees"
https://bugs.webkit.org/show_bug.cgi?id=224342
https://commits.webkit.org/r275761
2021-04-12 BJ Burg <bburg@apple.com>
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-12 Chris Dumez <cdumez@apple.com>
webaudio/AudioListener/audiolistener-set-position.html is leaking PannerNodes
https://bugs.webkit.org/show_bug.cgi?id=224399
Reviewed by Geoffrey Garen.
The test was leaking all its nodes and contexts due to several logic issues in our code.
Tests: webaudio/OfflineAudioContext/offlineaudiocontext-can-only-render-once.html
webaudio/OfflineAudioContext/offlineaudiocontext-leak-after-rendering-with-nodes.html
* Modules/webaudio/AudioScheduledSourceNode.cpp:
(WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode):
(WebCore::AudioScheduledSourceNode::virtualHasPendingActivity const):
(WebCore::AudioScheduledSourceNode::finish):
* Modules/webaudio/AudioScheduledSourceNode.h:
1. Stop using an ActiveDOMObject::PendingActivity to keep our wrapper alive as this was causing
a reference cycle. PendingActivity keeps a ref to |this| and this is ref'ing the PendingActivity.
2 things could break the cycle:
- finish() gets called but the audio context may go away without finish getting called.
- didBecomeMarkedForDeletion() gets called. However, it was getting called from
AudioNode::markNodeForDeletionIfNecessary(). This function would early return if m_normalRefCount
is not 0. Here m_normalRefCount could NOT be 0, since PendingActity was ref'ing the Node.
2. Instead of a PendingActivity, we now override ActiveDOMObject::virtualHasPendingActivity() to keep
the wrapper alive. The behavior is the same since its return true when the state is not finished
and the node has not been marked for deletion. However, I added a condition to make sure it starts
returning false as soon as the context is closed. There is also no need to keep the JS wrapper alive
if there is no 'ended' event listener.
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::lazyInitialize):
Early return if lazyInitialize() gets called for an audiocontext is closed. Nothing prevents JS from
creating an AudioNode after the AudioContext is closed. Constructing an AudioNode ends up lazy
initializing the audio context. In such case, we would already early return in release because if the
m_isAudioThreadFinished check. However, we would crash in debug because of the m_isAudioThreadFinished
ASSERT().
* Modules/webaudio/BaseAudioContext.h:
Make clear() member function protected so it can get called by OfflineAudioContext when rendering is
complete.
* Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::uninitialize):
Stop rejecting the suspend promises when the OfflineAudioContext gets uninitialized. Previously this
would only happen on navigation so we did not notice the issue. However, the OfflineAudioContext now
gets uninitialized as soon as it is done rendering and rejecting those promises in this case would
start causing test failures.
(WebCore::OfflineAudioContext::didFinishOfflineRendering):
- Stop clearing the m_didStartOfflineRendering flag when rendering is finished. This flag is called
[[rendering started]] in the WebAudio specification [1]. As per the specification, it gets set to true
in startRendering() and never gets reset to false. This means that an offline audio context cannot
start rendering again once it is done rendering. I have added a layout test for this behavior change
and verified that this test is passing is both Firefox and Chrome.
[1] https://webaudio.github.io/web-audio-api/#dom-offlineaudiocontext-startrendering
- Call uninitialize() and clear() when rendering has finished to clear as much memory as possible as
soon as we can. This is acceptable because it is no longer possible to start rendering again once
it's finished. Previously, uninitialize() / clear() would only happen when navigating away and when
the document would get destroyed.
2021-04-12 Chris Dumez <cdumez@apple.com>
OfflineAudioContext with nodes that completed rendering do not get freed until navigating away
https://bugs.webkit.org/show_bug.cgi?id=224439
Reviewed by Geoffrey Garen.
Tests: webaudio/OfflineAudioContext/offlineaudiocontext-can-only-render-once.html
webaudio/OfflineAudioContext/offlineaudiocontext-leak-after-rendering-with-nodes.html
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::finishedRendering):
* Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::didFinishOfflineRendering):
2021-04-12 Ada Chan <ada.chan@apple.com>
Initial implementation of WebChromeClient::enumerateImmersiveXRDevices() and XRDeviceProxy
https://bugs.webkit.org/show_bug.cgi?id=224353
Reviewed by Dean Jackson.
Remove PlatformXRDeviceCocoa as WebKit::XRDeviceProxy will be implementing PlatformXR::Device.
Implement the encode/decode methods to enable PlatformXR::Device::FrameData to
be sent over IPC.
* platform/xr/PlatformXR.h:
(PlatformXR::Device::trackingAndRenderingClient const):
(PlatformXR::Device::FrameData::FloatQuaternion::encode const):
(PlatformXR::Device::FrameData::FloatQuaternion::decode):
(PlatformXR::Device::FrameData::Pose::encode const):
(PlatformXR::Device::FrameData::Pose::decode):
(PlatformXR::Device::FrameData::Fov::encode const):
(PlatformXR::Device::FrameData::Fov::decode):
(PlatformXR::Device::FrameData::View::encode const):
(PlatformXR::Device::FrameData::View::decode):
(PlatformXR::Device::FrameData::StageParameters::encode const):
(PlatformXR::Device::FrameData::StageParameters::decode):
(PlatformXR::Device::FrameData::LayerData::encode const):
(PlatformXR::Device::FrameData::LayerData::decode):
(PlatformXR::Device::FrameData::encode const):
(PlatformXR::Device::FrameData::decode):
* platform/xr/cocoa/PlatformXRCocoa.h:
(): Deleted.
2021-04-12 Antoine Quint <graouts@webkit.org>
border-image-width computed values should be a calc() value if it contains a percentage
https://bugs.webkit.org/show_bug.cgi?id=224420
Reviewed by Simon Fraser.
When handling calc() values containing a percentage, we must retain the calc() form when creating
the computed style for border-image-width.
* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapNinePieceImageQuad):
2021-04-12 Youenn Fablet <youenn@apple.com>
Add support for RTCEncodedFrame metadata
https://bugs.webkit.org/show_bug.cgi?id=224430
Reviewed by Eric Carlson.
Expose metadata given from backend.
Audio sender side uses a regular TransformableFrameInterface instead of a TransformableAudioFrameInterface.
Make sure to not call GetHeader() in that case.
Test: http/wpt/webrtc/metadata-transform.html
* Modules/mediastream/RTCEncodedAudioFrame.cpp:
(WebCore::RTCEncodedAudioFrame::timestamp const):
(WebCore::RTCEncodedAudioFrame::getMetadata):
* Modules/mediastream/RTCEncodedAudioFrame.h:
* Modules/mediastream/RTCEncodedAudioFrame.idl:
* Modules/mediastream/RTCEncodedVideoFrame.cpp:
(WebCore::RTCEncodedVideoFrame::timestamp const):
(WebCore::RTCEncodedVideoFrame::getMetadata):
* Modules/mediastream/RTCEncodedVideoFrame.h:
* Modules/mediastream/RTCEncodedVideoFrame.idl:
* Modules/mediastream/RTCRtpTransformableFrame.h:
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.cpp:
(WebCore::LibWebRTCRtpTransformBackend::Transform):
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransformableFrame.cpp:
(WebCore::LibWebRTCRtpTransformableFrame::LibWebRTCRtpTransformableFrame):
(WebCore::LibWebRTCRtpTransformableFrame::timestamp const):
(WebCore::LibWebRTCRtpTransformableFrame::audioMetadata const):
(WebCore::LibWebRTCRtpTransformableFrame::videoMetadata const):
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransformableFrame.h:
2021-04-12 Sam Weinig <weinig@apple.com>
Remove unused 'DefaultDefineOwnProperty' extended attribute support
https://bugs.webkit.org/show_bug.cgi?id=224436
Reviewed by Antti Koivisto.
The old CSSStyleDeclaration named-getter based implementation was
the last user so this can now be removed.
* bindings/scripts/CodeGeneratorJS.pm:
(InstanceOverridesDefineOwnProperty):
* bindings/scripts/IDLAttributes.json:
2021-04-12 Philippe Normand <pnormand@igalia.com>
[GStreamer][WebRTC] An audio track should be muted when capture is interrupted by the OS.
https://bugs.webkit.org/show_bug.cgi?id=196606
Reviewed by Xabier Rodriguez-Calvar.
Add basic interruption support in the audio capture source and mock audio capture source.
* platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
(WebCore::GStreamerAudioCaptureSource::interrupted const):
(WebCore::GStreamerAudioCaptureSource::setInterruptedForTesting):
* platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h:
* platform/mediastream/gstreamer/GStreamerCapturer.cpp:
(WebCore::GStreamerCapturer::setupPipeline):
(WebCore::GStreamerCapturer::interrupted const):
(WebCore::GStreamerCapturer::setInterrupted):
* platform/mediastream/gstreamer/GStreamerCapturer.h:
* platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.cpp:
(WebCore::MockRealtimeAudioSourceGStreamer::setInterruptedForTesting):
* platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.h:
2021-04-12 Sam Weinig <weinig@apple.com>
Update color-contrast() to support a target contrast ratio
https://bugs.webkit.org/show_bug.cgi?id=224411
Reviewed by Antti Koivisto.
Updated fast/css/parsing-color-contrast.html with new test cases.
* css/CSSValueKeywords.in:
Add new keywords, AA and AA-large which are constants for contrast ratios of 4.5
and 3.0 respectively.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
Remove now incorrect comment about adding support for fallback as fallback
has been removed from the spec.
(WebCore::CSSPropertyParserHelpers::selectFirstColorThatMeetsOrExceedsTargetContrast):
(WebCore::CSSPropertyParserHelpers::selectFirstColorWithHighestContrast):
(WebCore::CSSPropertyParserHelpers::parseColorContrastFunctionParameters):
Add support for the new optional target contrast ratio in color-contrast() that was
recently added to CSS Color 5.
2021-04-12 Antti Koivisto <antti@apple.com>
Descendant style relations are sometimes reset when they shouldn't
https://bugs.webkit.org/show_bug.cgi?id=224431
rdar://76267783
Reviewed by Sam Weinig.
Some style relations computed during resolution of descendants are set on a parent element.
The parent element shouldn't reset them unless we are actually also computing the descendants.
Test: fast/css/first-letter-style-relation-crash.html
* dom/Element.cpp:
(WebCore::Element::resetStyleRelations):
(WebCore::Element::resetChildStyleRelations):
(WebCore::Element::resetAllDescendantStyleRelations):
Split resetStyleRelations into separate parts.
* dom/Element.h:
(WebCore::Element::styleAffectedByEmpty const):
(WebCore::Element::childrenAffectedByForwardPositionalRules const):
(WebCore::Element::descendantsAffectedByForwardPositionalRules const):
(WebCore::Element::childrenAffectedByBackwardPositionalRules const):
(WebCore::Element::descendantsAffectedByBackwardPositionalRules const):
(WebCore::Element::childrenAffectedByPropertyBasedBackwardPositionalRules const):
(WebCore::Element::setStyleAffectedByEmpty):
(WebCore::Element::setChildrenAffectedByForwardPositionalRules):
(WebCore::Element::setDescendantsAffectedByForwardPositionalRules):
(WebCore::Element::setChildrenAffectedByBackwardPositionalRules):
(WebCore::Element::setDescendantsAffectedByBackwardPositionalRules):
(WebCore::Element::setChildrenAffectedByPropertyBasedBackwardPositionalRules):
* dom/ElementRareData.h:
(WebCore::ElementRareData::resetStyleRelations): Deleted.
* dom/Node.h:
(WebCore::Node::StyleBitfields::clearFlags):
(WebCore::Node::clearStyleFlags):
(WebCore::Node::StyleBitfields::dynamicStyleRelations const): Deleted.
(WebCore::Node::StyleBitfields::setDynamicStyleRelation): Deleted.
(WebCore::Node::StyleBitfields::clearDynamicStyleRelations): Deleted.
(WebCore::Node::hasDynamicStyleRelationFlag const): Deleted.
(WebCore::Node::setDynamicStyleRelationFlag): Deleted.
Remove the meaningless DynamicStyleRelation concept and merge these flags with the others.
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveElement):
(WebCore::Style::TreeResolver::resolveComposedTree):
Only clear the descendant or child style relation bits if we are actually re-resolving
descendants or children.
2021-04-12 Rob Buis <rbuis@igalia.com>
Clamp overridingContentLogicalWidth/Height to zero
https://bugs.webkit.org/show_bug.cgi?id=224310
Reviewed by Sergio Villar Senin.
Clamp overridingContentLogicalWidth/Height to zero.
Test: fast/css-grid-layout/negative-overriding-content-logical-height-crash.html
* rendering/RenderBox.h:
(WebCore::RenderBox::overridingContentLogicalWidth const):
(WebCore::RenderBox::overridingContentLogicalHeight const):
2021-04-12 Philippe Normand <pnormand@igalia.com>
[MSE][GStreamer] Crash in WebCore::PlaybackPipeline::addSourceBuffer when setting duration and preload is set to none
https://bugs.webkit.org/show_bug.cgi?id=224260
Reviewed by Xabier Rodriguez-Calvar.
Disable delayed loading for the GStreamer MSE player, we want the MSE source element to be
configured ASAP, otherwise the playback pipeline will fail in various ways (duration
notifications sent too early, crashes in addSourceBuffer, crashes in attachTracks, and so
on).
Test: media/media-source/media-source-no-preload-set-duration-crash.html
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):
2021-04-12 Youenn Fablet <youenn@apple.com>
Make sure all frames get transformed when overriding a transform with another one
https://bugs.webkit.org/show_bug.cgi?id=224367
Reviewed by Eric Carlson.
We were previously removing the old transform, then attaching the new transforn.
There was a time where no transform was attached and a few samples could get missed.
To prevent this, we add a new code path where we transfer a backend from one transform to another.
In that case, we synchronoulsy change the input callback from the old one to the new one instead of setting it to null in between.
Test: http/wpt/webrtc/change-encoded-transform.html
* Modules/mediastream/RTCRtpReceiver.cpp:
(WebCore::RTCRtpReceiver::setTransform):
* Modules/mediastream/RTCRtpReceiver.h:
* Modules/mediastream/RTCRtpReceiverBackend.h:
* Modules/mediastream/RTCRtpScriptTransform.cpp:
(WebCore::RTCRtpScriptTransform::~RTCRtpScriptTransform):
(WebCore::RTCRtpScriptTransform::willClearBackend):
(WebCore::RTCRtpScriptTransform::clear):
* Modules/mediastream/RTCRtpScriptTransform.h:
* Modules/mediastream/RTCRtpScriptTransformer.cpp:
(WebCore::RTCRtpScriptTransformer::clear):
* Modules/mediastream/RTCRtpScriptTransformer.h:
* Modules/mediastream/RTCRtpSender.cpp:
(WebCore::RTCRtpSender::setTransform):
* Modules/mediastream/RTCRtpSender.h:
* Modules/mediastream/RTCRtpSenderBackend.h:
* Modules/mediastream/RTCRtpTransform.cpp:
(WebCore::RTCRtpTransform::from):
(WebCore::RTCRtpTransform::attachToReceiver):
(WebCore::RTCRtpTransform::attachToSender):
(WebCore::RTCRtpTransform::backendTransferedToNewTransform):
* Modules/mediastream/RTCRtpTransform.h:
(WebCore::RTCRtpTransform::takeBackend):
* Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.cpp:
(WebCore::LibWebRTCRtpReceiverBackend::rtcRtpTransformBackend):
* Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h:
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
(WebCore::LibWebRTCRtpSenderBackend::LibWebRTCRtpSenderBackend):
(WebCore::LibWebRTCRtpSenderBackend::rtcRtpTransformBackend):
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
2021-04-12 Frédéric Wang <fwang@igalia.com>
Out of memory crash with find('a'.repeat(2**30))
https://bugs.webkit.org/show_bug.cgi?id=223787
Reviewed by Ryosuke Niwa.
SearchBuffer::SearchBuffer allocates a buffer whose capacity is at least 8 times the size of
the searched text and at least 8192. It's possible to hit an out-of-memory crash by passing
a very long string to window.find. Since there is no reason to search for arbitrary large
text, limit it to a maximum length of 64kB.
Test: editing/find/find-long-string-crash.html
* page/DOMWindow.cpp:
(WebCore::DOMWindow::find const): Exit early if the string length is larger than a limit.
2021-04-12 Chris Lord <clord@igalia.com>
Refactor font loading to make it possible for Worker to implement it
https://bugs.webkit.org/show_bug.cgi?id=224277
Reviewed by Darin Adler.
Introduce FontLoadRequest and FontLoadRequestClient as an abstraction
separate from CachedFont and CachedFontClient to allow for separate
implementations. Also move Document-specific font-loading behaviour
from CSSFontSelector into Document and add non-Document specific
accessors to ScriptExecutionContext.
These changes should allow for custom font loading to be implementable
on a Worker, which will be necessary for FontFace support in
OffscreenCanvas.
No new tests, no change in behavior.
* Headers.cmake: Added FontLoadRequest.h, CachedFontLoadRequest.h
and DocumentFontLoader.h.
* Sources.txt: Added DocumentFontLoader.cpp.
* WebCore.xcodeproj/project.pbxproj: Added files listed above.
* css/CSSFontFace.cpp: Update to not require Document for custom font loading.
(WebCore::CSSFontFace::appendSources):
* css/CSSFontFaceSource.cpp: Update to use FontLoadRequest instead of CachedFont.
(WebCore::CSSFontFaceSource::CSSFontFaceSource):
(WebCore::CSSFontFaceSource::~CSSFontFaceSource):
(WebCore::CSSFontFaceSource::opportunisticallyStartFontDataURLLoading):
(WebCore::CSSFontFaceSource::fontLoaded):
(WebCore::CSSFontFaceSource::load):
(WebCore::CSSFontFaceSource::font):
(WebCore::CSSFontFaceSource::isSVGFontFaceSource const):
* css/CSSFontFaceSource.h:
* css/CSSFontFaceSrcValue.cpp: Update to use FontLoadRequest and
ScriptExecutionContext instead of CachedResourceLoader.
(WebCore::CSSFontFaceSrcValue::fontLoadRequest):
* css/CSSFontFaceSrcValue.h:
* css/CSSFontSelector.cpp: Remove Document-specific code.
(WebCore::CSSFontSelector::CSSFontSelector):
(WebCore::CSSFontSelector::~CSSFontSelector):
(WebCore::CSSFontSelector::clearFonts):
* css/CSSFontSelector.h:
* dom/Document.cpp: Implement ScriptExecutionContext::fontLoadRequest
and ::beginLoadingFontSoon.
(WebCore::Document::~Document):
(WebCore::Document::removedLastRef):
(WebCore::Document::resolveStyle):
(WebCore::Document::suspendFontLoading):
(WebCore::Document::fontLoadRequest):
(WebCore::Document::beginLoadingFontSoon):
(WebCore::Document::suspend):
(WebCore::Document::resume):
* dom/Document.h:
* dom/DocumentFontLoader.cpp: Added. New class to handle Document-specific
font-loading code that was previously in CSSFontSelector and
CSSFontFaceSrcValue.
(WebCore::DocumentFontLoader::DocumentFontLoader):
(WebCore::DocumentFontLoader::~DocumentFontLoader):
(WebCore::DocumentFontLoader::cachedFont):
(WebCore::DocumentFontLoader::beginLoadingFontSoon):
(WebCore::DocumentFontLoader::loadPendingFonts):
(WebCore::DocumentFontLoader::fontLoadingTimerFired):
(WebCore::DocumentFontLoader::stopLoadingAndClearFonts):
(WebCore::DocumentFontLoader::suspendFontLoading):
(WebCore::DocumentFontLoader::resumeFontLoading):
* dom/DocumentFontLoader.h:
* dom/ScriptExecutionContext.cpp: Add functions to initiate font load requests.
(WebCore::ScriptExecutionContext::fontLoadRequest):
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::beginLoadingFontSoon):
* loader/DocumentLoader.cpp: CSSFontSelector::suspendFontLoadingTimer
is now Document::suspendFontLoading.
(WebCore::DocumentLoader::stopLoading):
* loader/FontLoadRequest.h: Added. An interface to manage font loading
that abstracts some of the behaviour of CachedResource, CachedFont and
CachedFontClient.
(WebCore::FontLoadRequestClient::fontLoaded):
(WebCore::FontLoadRequestClient::isCachedFontLoadRequest const):
* loader/cache/CachedFontLoadRequest.h: Added. An implementation of
FontLoadRequest for CachedFont.
* workers/WorkerGlobalScope.cpp: Remove now-redundant CSSFontSelector call.
(WebCore::WorkerGlobalScope::~WorkerGlobalScope):
2021-04-12 Adrian Perez de Castro <aperez@igalia.com>
[WPE][GTK] Use g_object_notify_by_pspec() whenever possible
https://bugs.webkit.org/show_bug.cgi?id=224366
Reviewed by Carlos Garcia Campos.
Keep a static array with the GParamSpec pointer for each property, and trigger
property change notifications using g_object_notify_by_pspec() to avoid looking
up by its name each time.
No new tests needed.
* platform/graphics/gstreamer/TextCombinerPadGStreamer.cpp:
(webkit_text_combiner_pad_class_init):
2021-04-12 Youenn Fablet <youenn@apple.com>
Use DestructionThread::Main for RTCRtpScriptTransform
https://bugs.webkit.org/show_bug.cgi?id=224368
<rdar://76404727>
Reviewed by Eric Carlson.
It is safer to make it DestructionThread::Main to guarantee it is destroyed in main thread.
* Modules/mediastream/RTCRtpScriptTransform.h:
2021-04-11 Cameron McCormack <heycam@apple.com>
Fix initial horizontal scrollbar position when vertical scrollbar is on the left.
https://bugs.webkit.org/show_bug.cgi?id=224409
Reviewed by Darin Adler.
Scrollable elements that place their vertical scrollbar on the left
(e.g. when they're `direction: rtl` or when the OS language is RTL and
the relevant setting to always follow OS scrollbar side is used) have
an incorrect scroll origin, which leads to creating a horizontal
scrollbar with an incorrect initial offset. This is because
RenderLayerScrollableArea::computeScrollDimensions runs prior to the
scrollbars being created. So whenever we start or stop having a
(non-overlay) vertical scrollbar on the left, we need to recompute
the scroll origin and fix up the horizontal scrollbar's offset.
Tests: fast/scrolling/rtl-scrollbars-initial-position-dynamic.html
fast/scrolling/rtl-scrollbars-initial-position.html
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::computeScrollDimensions):
(WebCore::RenderLayerScrollableArea::computeScrollOrigin): Split this
out of computeScrollDimensions so we can call it from
updateScrollbarsAfterLayout and updateScrollbarsAfterStyleChange, and
have it ask the horizontal scrollbar to update its offset. We could
condition this on the scroll origin actually having changed, but
that's going to be a similar check that Scrollbar::offsetDidChange
does to ensure the offset value did indeed change. We don't want to
condition this on shouldPlaceBlockDirectionScrollbarOnLeft(), since
that's dependent on the current style, and we may be reacting to a
style change removed the vertical scrollbar on the left.
(WebCore::RenderLayerScrollableArea::updateScrollbarsAfterLayout):
(WebCore::RenderLayerScrollableArea::updateScrollbarsAfterStyleChange):
* rendering/RenderLayerScrollableArea.h:
2021-04-11 Darin Adler <darin@apple.com>
[Mac] Add a missing null check to slider thumb focus rendering
https://bugs.webkit.org/show_bug.cgi?id=224418
rdar://76450584
Reviewed by Sam Weinig.
* rendering/RenderThemeMac.h: Changed updateFocusedState to take a pointer.
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::updateFocusedState): Check pointer for null. This was the
missing null check.
(WebCore::RenderThemeMac::paintSliderThumb): Pass delegate pointer instead of reference.
Also made sure we always update the focused state. Old code took the approach of just not
updating focus state when it encountered null for the focus delegate, but that's not a
good strategy. In future we may also want to change the focusDelegate function signature
to make it clear it will never return null, but that's not critical right now.
(WebCore::RenderThemeMac::setSearchCellState): Update since updateFocusedState now
takes a pointer.
2021-04-11 Sam Weinig <weinig@apple.com>
Reduce compile time and binary size cost of enabling proper CSSStyleDeclaration property access behavior
https://bugs.webkit.org/show_bug.cgi?id=222518
<rdar://problem/75136887>
Reviewed by Darin Adler.
Re-implement proper (not using named-getters) support for the CSSStyleDeclaration bindings
using a new DelegateToSharedSyntheticAttribute extended atttribute which allows IDL attributes
to share a custom getter / setter implementation and delegate their implementation to it. When
using this functionality, the synthetic attribute's implementation is passed the original property
name so it can implement functionality based on it.
We use this for CSSStyleDeclaration by breaking the huge list of generated properties into
four groups, each with their own synthetic attribute. The groups are based on the different
transformation rules in the spec.
* bindings/js/JSDOMAttribute.h:
(WebCore::IDLAttribute::setPassingPropertyName):
(WebCore::IDLAttribute::getPassingPropertyName):
Add overloads of get/set that pass the property name to the provided function. These can't
be simple overloads of get/set as MSVC does not allow overloading with only a non-type
template parameters differentiating.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateInterface):
Eagerly generate the any synthetic attributes before the rest of code generation,
matching the behavior of other synthetic constructions like map/set/stringifiers.
(GetAttributeGetterName):
(GetAttributeSetterName):
Add special cases to getter/setter name generation to forward to the generated
name of the synthetic attribute when delegating.
(GenerateImplementation):
Extract attribute function forward declaration genation into a new GenerateAttributeGetterAndSetterDeclaration
subroutine and use it for generation of both normal and synthetic attributes. Also adds
synthetic attributes to the list of attributes to generate function implementations for.
(GenerateAttributeGetterAndSetterDeclaration):
Extracted from GenerateImplementation. Adds extra condition to bail if DelegateToSharedSyntheticAttribute
is specified.
(GenerateAttributeGetterBodyDefinition):
Add support for the new CallWith=PropertyName extended attribute by adding a PropertyName
argument to the signature of getter body if it is present. Removes now unnecessary support
for the CSSProperty extended attribute.
(GenerateAttributeGetterTrampolineDefinition):
Switch function name from get to getPassingPropertyName if CallWith=PropertyName is specified.
(GenerateAttributeGetterDefinition):
Adds extra condition to bail if DelegateToSharedSyntheticAttribute is specified.
(GenerateAttributeSetterBodyDefinition):
Add support for the new CallWith=PropertyName extended attribute by adding a PropertyName
argument to the signature of getter body if it is present. Removes now unnecessary support
for the CSSProperty extended attribute.
(GenerateAttributeSetterTrampolineDefinition):
Switch function name from get to getPassingPropertyName if CallWith=PropertyName is specified.
(GenerateAttributeSetterDefinition):
Adds extra condition to bail if DelegateToSharedSyntheticAttribute is specified.
(GenerateCallWith):
Add support for the PropertyName value to CallWith.
(MakeSharedSyntheticAttribute):
Helper to generate the synthetic attribute from the base attribute with DelegateToSharedSyntheticAttribute
specefied. Maintains all existing extended attributes of the base attribute except
DelegateToSharedSyntheticAttribute is replaced with IsSharedSyntheticAttribute to avoid
infinite recursion.
(AddSharedSyntheticAttributesIfNeeded):
Helper to find all delegating attributes and generate / store the synthetic attributes.
(GetSharedSyntheticAttribute):
Helper to get the corresponding synthetic attribute given an attribute with
DelegateToSharedSyntheticAttribute specified on it.
* bindings/scripts/IDLAttributes.json:
Removes CSSProperty. Adds DelegateToSharedSyntheticAttribute. Adds PropertyName value to
CallWith and SetterCallWith.
* css/CSSStyleDeclaration.cpp:
(WebCore::lookupCSSPropertyFromIDLAttribute):
(WebCore::CSSStyleDeclaration::propertyValueForCamelCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::setPropertyValueForCamelCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::propertyValueForWebKitCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::setPropertyValueForWebKitCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::propertyValueForDashedIDLAttribute):
(WebCore::CSSStyleDeclaration::setPropertyValueForDashedIDLAttribute):
(WebCore::CSSStyleDeclaration::propertyValueForEpubCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::setPropertyValueForEpubCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::namedItem): Deleted.
(WebCore::CSSStyleDeclaration::setNamedItem): Deleted.
(WebCore::CSSStyleDeclaration::supportedPropertyNames const): Deleted.
* css/CSSStyleDeclaration.h:
Replace named-getter based implementation with helpers based on the definitions
in the CSSOM spec (plus one special set for 'epub' specializations we currently
maintain).
* css/CSSStyleDeclaration.idl:
Remove !ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION sections now that
we can fully support ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION.
* css/makeprop.pl:
Remove !ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION sections now that
we can fully support ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION.
Replaces CSSProperty extended attributes with DelegateToSharedSyntheticAttribute and
CallWith=PropertyName, which together allow us to implement all the attributes with just
8 implementation functions.
* bindings/scripts/test/BindingTestGlobalConstructors.idl:
* bindings/scripts/test/JS/JSTestCSSProperty.cpp: Removed.
* bindings/scripts/test/JS/JSTestCSSProperty.h: Removed.
* bindings/scripts/test/JS/JSTestDelegateToSharedSyntheticAttribute.cpp: Added.
* bindings/scripts/test/JS/JSTestDelegateToSharedSyntheticAttribute.h: Added.
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* bindings/scripts/test/SupplementalDependencies.dep:
* bindings/scripts/test/TestCSSProperty.idl: Removed.
* bindings/scripts/test/TestDelegateToSharedSyntheticAttribute.idl: Added.
Replace CSSProperty tests with DelegateToSharedSyntheticAttribute tests and update results
all around for new generation.
2021-04-11 Rob Buis <rbuis@igalia.com>
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-10 Chris Dumez <cdumez@apple.com>
Regression(r275668) Potential null pointer deref in AudioParam::exponentialRampToValueAtTime(float, double)
https://bugs.webkit.org/show_bug.cgi?id=224400
<rdar://76450376>
Reviewed by Ryosuke Niwa.
In r275668, I added null-checks for the AudioContext in AudioParam, now that it holds a WeakPtr to its
context. However, I missed a null-check in AudioParam::exponentialRampToValueAtTime(). This patch adds
the missing check.
Test: webaudio/AudioParam/audioparam-exponentialRampToValueAtTime-nocontext-crash.html
* Modules/webaudio/AudioParam.cpp:
2021-04-10 Chris Dumez <cdumez@apple.com>
[ macOS ] 3 webaudio/OfflineAudioContext/ layout-tests are flakey text failures
https://bugs.webkit.org/show_bug.cgi?id=224387
<rdar://problem/76468058>
Reviewed by Eric Carlson.
Replace internals.numberOfBaseAudioContexts() test infrastructure with
internals.baseAudioContextIdentifier() & internals.isBaseAudioContextAlive().
This allows tests to check if specific BaseAudioContext instances created by the
tests are actually alive. As a result, the tests are no longer impacted by tests
running before them (and potentially leaking, see Bug 224399) or in parallel to
them in the same process.
This is the same approach we used for leak testing Documents (internals.documentIdentifier()
& internals.isDocumentAlive()).
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::generateAudioContextID):
(WebCore::liveAudioContexts):
(WebCore::BaseAudioContext::BaseAudioContext):
(WebCore::BaseAudioContext::~BaseAudioContext):
(WebCore::BaseAudioContext::isContextAlive):
* Modules/webaudio/BaseAudioContext.h:
(WebCore::BaseAudioContext::contextID const):
* testing/Internals.cpp:
(WebCore::Internals::countMatchesForText):
(WebCore::Internals::baseAudioContextIdentifier):
(WebCore::Internals::isBaseAudioContextAlive):
* testing/Internals.h:
* testing/Internals.idl:
2021-04-10 Mark Lam <mark.lam@apple.com>
Enable VMTraps checks in RETURN_IF_EXCEPTION.
https://bugs.webkit.org/show_bug.cgi?id=224078
rdar://75037057
Reviewed by Keith Miller.
1. Add DeferTermination in WorkerOrWorkletScriptController::initScript().
This allows us to avoid having to make all exception checking in
WorkerOrWorkletScriptController::initScript() very thorough and complete.
Currently, they aren't.
2. Fix WorkerOrWorkletScriptController::evaluate() to handle the TerminationException.
3. Fix JSEventListener::handleEvent() to handle the TerminationException correctly.
Previously, in one case, it was checking scope.exception() for the exception,
but the exception has already been taken out of there.
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* workers/WorkerOrWorkletScriptController.cpp:
(WebCore::WorkerOrWorkletScriptController::evaluate):
(WebCore::WorkerOrWorkletScriptController::initScript):
2021-04-10 Zalan Bujtas <zalan@apple.com>
RenderFlexibleBox::m_hasDefiniteHeight should not need to be mutable
https://bugs.webkit.org/show_bug.cgi?id=224404
Reviewed by Antti Koivisto.
Let's just fix constness instead.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth):
(WebCore::RenderFlexibleBox::crossAxisIntrinsicExtentForChild):
(WebCore::RenderFlexibleBox::useChildAspectRatio):
(WebCore::RenderFlexibleBox::childMainSizeIsDefinite):
(WebCore::RenderFlexibleBox::childCrossSizeIsDefinite):
(WebCore::RenderFlexibleBox::childHasIntrinsicMainAxisSize):
(WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth const): Deleted.
(WebCore::RenderFlexibleBox::crossAxisIntrinsicExtentForChild const): Deleted.
(WebCore::RenderFlexibleBox::useChildAspectRatio const): Deleted.
(WebCore::RenderFlexibleBox::childMainSizeIsDefinite const): Deleted.
(WebCore::RenderFlexibleBox::childCrossSizeIsDefinite const): Deleted.
(WebCore::RenderFlexibleBox::childHasIntrinsicMainAxisSize const): Deleted.
* rendering/RenderFlexibleBox.h:
2021-04-09 Antoine Quint <graouts@webkit.org>
calc() simplification for a multiplication should apply the multiplication to each value of an addition
https://bugs.webkit.org/show_bug.cgi?id=224376
Reviewed by Simon Fraser.
An expression such as calc(0.5 * (100% + 100px)) should be simplified to calc(50% + 50px). We produce
these types of expressions when blending between a percentage and a dimension, and they can also be
specified explicitly in style.
* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcOperationNode::combineChildren):
2021-04-09 Simon Fraser <simon.fraser@apple.com>
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-09 Jean-Yves Avenard <jya@apple.com>
Media Session action should default to the MediaElement's default when no MediaSession handler are set
https://bugs.webkit.org/show_bug.cgi?id=224278
<rdar://problem/76339841>
Reviewed by Youenn Fablet .
When a media session doesn't explicitly define an action handler, we use the media element
default action of the same type.
Media Session doesn't track a particular media element, instead it loosely defines a guessed playback state
that tracks if some element in the current document is playing and not muted or otherwise paused.
(see https://w3c.github.io/mediasession/#playback-state-model)
We therefore need to determine what is currently the most suitable media element available in this document.
Unlike the Media Controller and the Now Playing policy that will only ever select a media
if it is currently playing and not muted, for the Media Session we may have to interact with paused media elements.
For this we add a new PlaybackControlsPurpose named MediaSession defining new search criterias.
A media element will be up for selection if it's playable (according to autoplay policy). From then,
the best element will be selected accoring to its visibility, its size, if it's beeing played previously and
the last time it was interacted with.
Test: media/media-session/default-actionHandlers.html
* Modules/mediasession/MediaSession.cpp:
(WebCore::platformCommandForMediaSessionAction): New convenience method to convert one datatype into another.
(WebCore::MediaSession::callActionHandler): Use user defined handler if present or run the related action on
the most suitable media element
(WebCore::MediaSession::activeMediaElement const): Determine the currently active media element in the current
Media Session's document.
* Modules/mediasession/MediaSession.h:
* html/HTMLMediaElement.cpp:
(WebCore::mediaElementSessionInfoForSession): Add new hasEverNotifiedAboutPlaying member.
(WebCore::preferMediaControlsForCandidateSessionOverOtherCandidateSession): Amend sorting algorithm to cater
for the MediaSession criterias described above.
(WebCore::mediaSessionMayBeConfusedWithMainContent): When using MediaSession purpose, there is no possible
ambiguity, amend as such.
(WebCore::HTMLMediaElement::bestMediaElementForRemoteControls): Renamed from bestMediaElementForShowingPlaybackControlsManager
method to better match how the method is actually used.
* html/HTMLMediaElement.h:
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::canShowControlsManager const): Amend for new Media Session criterias.
(WebCore::MediaElementSession::didReceiveRemoteControlCommand): Always let MediaSession manage the actions handling.
* html/MediaElementSession.h:
* page/Page.cpp:
(WebCore::Page::playbackControlsManagerUpdateTimerFired): amend following method rename.
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::nowPlayingEligibleSession): amend following method rename.
* testing/Internals.cpp:
(WebCore::Internals::bestMediaElementForRemoteControls): Renamed from bestMediaElementForShowingPlaybackControlsManager as above.
(WebCore::Internals::sendMediaSessionAction): amend following method rename.
* testing/Internals.h: Rename method
* testing/Internals.idl: Rename method
2021-04-09 Fujii Hironori <Hironori.Fujii@sony.com>
[Cairo][GPUP] GraphicsContextGLOpenGL::paintToCanvas can't paint into a remote canvas
https://bugs.webkit.org/show_bug.cgi?id=224271
Reviewed by Don Olmstead.
WebGL canvas tests were failing for WinCairo port since r274327
enabled GPU process for canvas rendering. In the current
implementation of WebKitTestRunner, 2D canvases are in GPU
process, while WebGL canvases are in WebContent process. Remote
canvases in GPU process failed to drawImage() with a WebGL canvas
what is in WebContent process.
GraphicsContextGLOpenGL::paintToCanvas of Cairo port was painting
directly into PlatformContextCairo. It also should use
GraphicsContext::drawNativeImage as well as CG port does.
* platform/graphics/cairo/GraphicsContextGLCairo.cpp:
(WebCore::GraphicsContextGLOpenGL::paintToCanvas):
2021-04-09 Jer Noble <jer.noble@apple.com>
WTF SoftLinking macros can cause collisions with their target functions
https://bugs.webkit.org/show_bug.cgi?id=224379
<rdar://76434202>
Reviewed by Eric Carlson.
Don't include the SoftLinkLibxslt.h file in the .cpp file.
* xml/SoftLinkLibxslt.cpp:
* xml/SoftLinkLibxslt.h:
2021-04-09 Ziran Sun <zsun@igalia.com>
[css-grid] Set hasIntrinsicWidth & hasIntrinsicHeight properties for SVG element's intrinsic size
https://bugs.webkit.org/show_bug.cgi?id=223504
Reviewed by Javier Fernandez.
In RenderReplaced::computeReplacedLogicalWidth/RenderReplaced::computeReplacedLogicalHeight(),
hasIntrinsicWidth and hasIntrinsicHeight are decided by whether the value is bigger than 0.
This is not alway true. The SVG element sets its hasIntrinsicWidth/hasIntrinsicHeight property
in line with its lengthType(). This change adds checks for SVG element cases specifically.
* platform/graphics/FloatSize.h:
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeReplacedLogicalWidth const):
(WebCore::RenderReplaced::computeReplacedLogicalHeight const):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::computeIntrinsicRatioInformation const):
2021-04-08 Darin Adler <darin@apple.com>
[Cocoa] Reduce usage of autorelease, fix mistakes noticed nearby code using autorelease
https://bugs.webkit.org/show_bug.cgi?id=224340
Reviewed by Anders Carlsson.
* bridge/objc/objc_instance.h: Added a static member function isInStringValue to
help factor the _web_description method better.
* bridge/objc/objc_instance.mm:
(JSC::Bindings::ObjcInstance::stringValue const): Removed unneeded WTF prefixes.
(JSC::Bindings::ObjcInstance::isInStringValue): Added.
(-[NSObject _web_description]): Moved this out of the C++ namespace since it's an
Objective-C class implementation. Refactored for simplicity.
2021-04-08 Antoine Quint <graouts@webkit.org>
calc() values resulting from blending mixed type lengths should be simplified
https://bugs.webkit.org/show_bug.cgi?id=224322
Reviewed by Sam Weinig.
While we simplify calc() values upon parsing such that operations are resolved and
values are sorted (percentages first then alphabetically by unit), we didn't do this
when creating calc() values during blending of lengths of mixed types.
* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcValue::create const):
2021-04-09 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] Cleanup the inline box wrappers when moving subtrees
https://bugs.webkit.org/show_bug.cgi?id=224342
<rdar://76349279>
Reviewed by Antti Koivisto.
When an inline box is moved over to a different BFC (<span>), any inline level descendant (<span><img></span>) should release its inline box wrapper. This inline box wrapper (e.g. InlineFlowBox)
will eventually be destroy during the subsequent line layout of the original BFC.
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::move):
2021-04-09 Carlos Garcia Campos <cgarcia@igalia.com>
[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-04-09 Ziran Sun <zsun@igalia.com>
[css-flexbox] max-height percentages are wrongly resolved for replaced grid items in nested percentage flexboxes
https://bugs.webkit.org/show_bug.cgi?id=223931
Reviewed by Javier Fernandez.
This change is to make sure that when overridingContainingBlockContentLogicalHeight of a replaced's containing block
element is indefinite, % max-height of the replaced element is resolved to none.
Test: imported/w3c/web-platform-tests/css/css-flexbox/percentage-max-height-004.html
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight const):
2021-04-09 Philippe Normand <pnormand@igalia.com>
Unreviewed, GStreamer Thunder decryptor build fix after r275599
* platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp:
(decrypt):
2021-04-09 Carlos Garcia Campos <cgarcia@igalia.com>
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-04-09 Philippe Normand <pnormand@igalia.com>
[GStreamer] fast/canvas/canvas-createPattern-video-loading.html is failing since r218170
https://bugs.webkit.org/show_bug.cgi?id=173410
Reviewed by Xabier Rodriguez-Calvar.
When a flush has been requested by the GL video sink, allocate a new copy of the sample
which has to be released. The copy is necessary so that the video dimensions can still be
fetched and also for canvas rendering. The release is necessary because the sample might
have been allocated by a hardware decoder and memory might have to be reclaimed by a
non-sysmem buffer pool.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::flushCurrentBuffer):
(WebCore::MediaPlayerPrivateGStreamer::paint):
2021-04-09 Ziran Sun <zsun@igalia.com>
[css-grid] Fix min/max widths of grid affected by ancestor
https://bugs.webkit.org/show_bug.cgi?id=222100
Reviewed by Reviewed by Javier Fernandez.
It's a reland of r273435, which got reverted because it broke
imported/w3c/web-platform-tests/css/css-flexbox/percentage-max-height-003.html. This change
narrows down the fix specificallly to the case when logical-width is recomputed.
We need to recalculate min/max widths of child that depend on the ancestor.
Before update logical-width, for element that needs preferredWidth recalcution,
it is necessary to make sure that min/max widths are set dirty.
This change is an import of chromium CL at
https://chromium-review.googlesource.com/c/chromium/src/+/527640/
Only the parts that apply to this issue are imported.
Tests were already imported in WPT.
* rendering/RenderBlock.cpp:
(WebCore::shouldRecalculateMinMaxWidthsAffectedByAncestor):
(WebCore::RenderBlock::recomputeLogicalWidth):
2021-04-09 Yusuke Suzuki <ysuzuki@apple.com>
ServiceWorker should save module scripts
https://bugs.webkit.org/show_bug.cgi?id=224356
<rdar://problem/75634897>
Reviewed by Youenn Fablet.
Test: http/wpt/service-workers/persistent-modules.html
In this patch, we call setScriptResource / scriptResource while loading service-worker module scripts in module loaders,
so that we can ensure that they are saved on the disk.
* bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::notifyFinished):
* bindings/js/WorkerModuleScriptLoader.cpp:
(WebCore::WorkerModuleScriptLoader::load):
(WebCore::WorkerModuleScriptLoader::notifyFinished):
(WebCore::WorkerModuleScriptLoader::notifyClientFinished):
* bindings/js/WorkerModuleScriptLoader.h:
2021-04-08 Fujii Hironori <Hironori.Fujii@sony.com>
[Win] Wrong KeyboardEvent.key for numeric key pad with NumLock
https://bugs.webkit.org/show_bug.cgi?id=224352
Reviewed by Don Olmstead.
`8` key on a numeric key pad with NumLock dispatched a wrong
KeyboardEvent with `ArrowUp` as the `key` value. It should be `8`.
WindowsKeyNames::domKeyFromLParam computed a virtual key by
MapVirtualKey and a scan code. But, it should use a real virtual
key conveyed by WPARAM of WM_KEYDOWN and WM_KEYUP events.
* platform/win/KeyEventWin.cpp:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
* platform/win/WindowsKeyNames.cpp:
(WebCore::WindowsKeyNames::domKeyFromParams):
(WebCore::WindowsKeyNames::domKeyFromLParam): Deleted.
* platform/win/WindowsKeyNames.h:
2021-04-08 Wenson Hsieh <wenson_hsieh@apple.com>
Add a completion handler argument to `ChromeClient::requestImageExtraction`
https://bugs.webkit.org/show_bug.cgi?id=224348
Reviewed by Tim Horton.
See WebKit/ChangeLog for more details. No change in behavior.
* html/HTMLElement.h:
Export an existing helper method.
* page/ChromeClient.h:
(WebCore::ChromeClient::requestImageExtraction):
Add a (null-by-default) `CompletionHandler` argument to this client method, for future use by accessibility.
2021-04-08 Tim Horton <timothy_horton@apple.com>
Safari unit tests sometimes fail an ASSERTion in IOSurface.mm's optionsFor32BitSurface()
https://bugs.webkit.org/show_bug.cgi?id=224351
<rdar://problem/76405354>
Reviewed by Wenson Hsieh.
New API test: NavigationSwipeTests.DoNotAssertWhenSnapshottingZeroSizeView
* platform/graphics/cocoa/IOSurface.mm:
(WebCore::IOSurface::IOSurface):
Add assertions that IOSurface size is non-empty at the beginning of the constructor.
We already have downstream ones (e.g. the bytesPerRow and totalBytes
assertions inside optionsFor32BitSurface()), but they are after doing
some math and calling IOSurfaceAlignProperty, so it's tempting to blame
that instead of the input. This way, we fail right at the input, making
it more obvious what's up.
2021-04-08 Alex Christensen <achristensen@webkit.org>
REGRESSION(r273541) WKWebView can't load NSURLRequest subclasses
https://bugs.webkit.org/show_bug.cgi?id=224338
<rdar://76192721>
Reviewed by Brent Fulgham.
We used to use SPI to extract the CFURLRequestRef, but now we just call encodeWithCoder and initWithCoder.
That's great for many reasons, but to stay binary compatible we have to continue to support NSURLRequest subclasses.
They fail in two possible ways:
1. In ObjC, you can do wild and crazy things such as overriding encodeWithCoder and not calling [super encodeWithCoder:coder];
2. The process decoding the request (one of our auxiliary processes) almost certainly has not linked with the definition of the subclass.
This makes us receive an NSException like this when calling decodeObjectOfClasses:forKey:
*** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (TestURLRequest) for key (root) because no class named "TestURLRequest" was found;
the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target).
If the class was renamed, use setClassName:forClass: to add a class translation mapping to NSKeyedUnarchiver
To solve this problem, when attempting to encode a request that is not an NSURLRequest or NSMutableURLRequest, use existing code in ResourceRequest to extract
the parts we use into an NSMutableURLRequest that we can successfully decode.
* platform/network/cf/ResourceRequest.h:
* platform/network/cocoa/ResourceRequestCocoa.mm:
(WebCore::ResourceRequest::replacePlatformRequest):
2021-04-08 Kyle Piddington <kpiddington@apple.com>
[Metal ANGLE] check to see that a Metal device is available before selecting the backend.
https://bugs.webkit.org/show_bug.cgi?id=224341
Some platforms, including virtual machines, do not support Metal.
If we cannot create a default device, fall back on selecting the OpenGL backend.
Reviewed by Dean Jackson.
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::platformSupportsMetal):
(WebCore::InitializeEGLDisplay):
Added Metal header include, and runtime check to ensure a metal device can be created before selecting the Metal backend.
2021-04-08 Chris Dumez <cdumez@apple.com>
Suspended OfflineAudioContext objects are leaking
https://bugs.webkit.org/show_bug.cgi?id=224333
Reviewed by Darin Adler.
When offline rendering is suspended, we now release the ActiveDOMObject::PendingActivity we hold
to keep the OfflineAudioContext and its wrapper alive during rendering. The JS has to keep a
reference to the context's wrapper anyway if they ever want to resume rendering.
Test: webaudio/OfflineAudioContext/offlineaudiocontext-leak-while-suspended.html
* Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::didSuspendRendering):
2021-04-08 Jiewen Tan <jiewen_tan@apple.com>
Unreviewed, a comment fix
* crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
(WebCore::encryptAES_GCM):
(WebCore::decyptAES_GCM):
Removes unnecessary comments.
2021-04-08 Rob Buis <rbuis@igalia.com>
Remove virtual from RenderBox::availableLogicalWidth
https://bugs.webkit.org/show_bug.cgi?id=224332
Reviewed by Darin Adler.
Remove virtual from RenderBox::availableLogicalWidth since
it is not overridden.
* rendering/RenderBox.h:
(WebCore::RenderBox::availableLogicalWidth const):
2021-04-08 Chris Dumez <cdumez@apple.com>
OfflineAudioContext objects are leaking
https://bugs.webkit.org/show_bug.cgi?id=224279
Reviewed by Darin Adler.
OfflineAudioContext objects were always leaking due to 2 reference cycles:
1. BaseAudioContext -> m_listener (AudioListener) -> m_positionX (AudioParam) -> m_context (BaseAudioContext)
2. BaseAudioContext -> m_destinationNode (AudioDestinationNode) -> m_context (BaseAudioContext)
For reference cycle 1, I made AudioSummingJunction (base class of AudioParam) hold a weak pointer to the
AudioContext instead of a Ref<>. I don't think there is a good reason for an AudioSummingJunction (AudioParam
or AudioNodeInput) to keep its AudioContext alive. AudioNodes already keep their AudioContext alive.
AudioNodeInputs and AudioParams are associated to AudioNodes.
For reference cycle 2, I made AudioDestinationNode not hold a strong pointer to its context but instead a
weak pointer. Since keeping an AudioDestinationNode alive should keep its AudioContext alive, I made it so
that ref'ing the AudioDestinationNode refs its BaseAudioContext. Also, BaseAudioContext::m_destinationNode
is now a UniqueRef<> instead of a RefPtr<> to avoid a cycle.
Tests: webaudio/OfflineAudioContext/offlineaudiocontext-leak-after-rendering.html
webaudio/OfflineAudioContext/offlineaudiocontext-leak.html
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::baseLatency):
(WebCore::AudioContext::getOutputTimestamp):
(WebCore::AudioContext::close):
(WebCore::AudioContext::destination):
(WebCore::AudioContext::destination const):
(WebCore::AudioContext::suspendRendering):
(WebCore::AudioContext::resumeRendering):
(WebCore::AudioContext::startRendering):
(WebCore::AudioContext::lazyInitialize):
(WebCore::AudioContext::mediaState const):
(WebCore::AudioContext::mayResumePlayback):
(WebCore::AudioContext::suspendPlayback):
(WebCore::AudioContext::pageMutedStateDidChange):
* Modules/webaudio/AudioContext.h:
- Drop some null checks now that m_destinationNode can no longer be null.
- Capture an ActiveDOMObject::PendingActivity when doing async work that ends up resolving a Promise, so that
we keep both the object and its wrapper alive for the duration of the async work.
* Modules/webaudio/AudioDestinationNode.cpp:
(WebCore::AudioDestinationNode::ref):
(WebCore::AudioDestinationNode::deref):
* Modules/webaudio/AudioDestinationNode.h:
Have AudioDestinationNode override AudioNode's ref() / deref() to forward the refcounting
to its BaseAudioContext, instead of using the AudioNode's internal refCount.
* Modules/webaudio/AudioListener.cpp:
(WebCore::AudioListener::updateValuesIfNeeded):
(WebCore::AudioListener::setPosition):
(WebCore::AudioListener::setOrientation):
Add some null-checks for AudioParam::context() now that AudioParam holds a WeakPtr to its
context.
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::toWeakOrStrongContext):
(WebCore::AudioNode::AudioNode):
(WebCore::AudioNode::connect):
(WebCore::AudioNode::sampleRate const):
(WebCore::AudioNode::markNodeForDeletionIfNecessary):
(WebCore::AudioNode::contextForBindings):
(WebCore::AudioNode::context):
(WebCore::AudioNode::context const):
* Modules/webaudio/AudioNode.h:
- Hold the BaseAudioContext as a WeakPtr instead of a Ref<> if the AudioNode is an
AudioDestinationNode. This avoids a reference cycle since the BaseAudioContext owns the
AudioDestinationNode. Even though we are using a WeakPtr, it is safe to assume that
the context is not null because ref'ing an AudioDestinationNode refs its BaseAudioContext.
- Make sure markNodeForDeletionIfNecessary() has no effect for AudioDestinationNode since
BaseAudioContext now owns the AudioDestinationNode when we take care of destroying its
destination node when destroyed.
* Modules/webaudio/AudioNodeInput.cpp:
(WebCore::AudioNodeInput::connect):
(WebCore::AudioNodeInput::disconnect):
(WebCore::AudioNodeInput::outputEnabledStateChanged):
(WebCore::AudioNodeInput::updateInternalBus):
(WebCore::AudioNodeInput::bus):
(WebCore::AudioNodeInput::internalSummingBus):
(WebCore::AudioNodeInput::sumAllConnections):
(WebCore::AudioNodeInput::pull):
Add assertions that the context is not null. There were already assertions that we are the graph
owner, which means we are holding the BaseAudioContext's lock, which means that the audio context
is alive.
* Modules/webaudio/AudioParam.cpp:
(WebCore::AudioParam::value):
(WebCore::AudioParam::setValueForBindings):
(WebCore::AudioParam::smooth):
(WebCore::AudioParam::hasSampleAccurateValues const):
(WebCore::AudioParam::calculateSampleAccurateValues):
(WebCore::AudioParam::calculateFinalValues):
(WebCore::AudioParam::calculateTimelineValues):
(WebCore::AudioParam::connect):
(WebCore::AudioParam::disconnect):
Add null-checks for the AudioContext now that the AudioParam is only holding a WeakPtr to its
BaseAudioContext (to avoid a reference cycle).
* Modules/webaudio/AudioSummingJunction.cpp:
(WebCore::AudioSummingJunction::AudioSummingJunction):
(WebCore::AudioSummingJunction::~AudioSummingJunction):
(WebCore::AudioSummingJunction::markRenderingStateAsDirty):
(WebCore::AudioSummingJunction::addOutput):
(WebCore::AudioSummingJunction::removeOutput):
(WebCore::AudioSummingJunction::updateRenderingState):
(WebCore::AudioSummingJunction::outputEnabledStateChanged):
* Modules/webaudio/AudioSummingJunction.h:
(WebCore::AudioSummingJunction::context):
(WebCore::AudioSummingJunction::context const):
- Hold a WeakPtr to the BaseAudioContext to avoid a reference cycle.
- Deal with the fact that the audio context may be null now that we're holding a WeakPtr
to it (except when holding the graph lock)
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::BaseAudioContext):
(WebCore::BaseAudioContext::~BaseAudioContext):
(WebCore::BaseAudioContext::numberOfInstances):
(WebCore::BaseAudioContext::lazyInitialize):
(WebCore::BaseAudioContext::clear):
(WebCore::BaseAudioContext::uninitialize):
(WebCore::BaseAudioContext::stop):
(WebCore::BaseAudioContext::sampleRate const):
(WebCore::BaseAudioContext::decodeAudioData):
(WebCore::BaseAudioContext::markForDeletion):
(WebCore::BaseAudioContext::deleteMarkedNodes):
(WebCore::BaseAudioContext::setPendingActivity):
(WebCore::BaseAudioContext::workletIsReady):
* Modules/webaudio/BaseAudioContext.h:
(WebCore::BaseAudioContext::destination):
(WebCore::BaseAudioContext::destination const):
(WebCore::BaseAudioContext::currentSampleFrame const):
(WebCore::BaseAudioContext::currentTime const):
- Switch m_destinationNode from RefPtr<> to UniqueRef<> since the AudioContext is now
the owner of the destinationNode and since refing the destination node actually refs
its BaseAudioContext.
- Drop some null checks now that m_destinationNode can no longer be null.
- Rename makePendingActivity() to setPendingActivity() to avoid a naming conflict with
ActiveDOMObject::makePendingActivity().
* Modules/webaudio/DefaultAudioDestinationNode.h:
* Modules/webaudio/OfflineAudioDestinationNode.h:
- Drop create() factory functions and make the constructor public now that the BaseAudioContext owns
its destination node via a UniqueRef<>.
- Make some member functions public as they are virtual and they now called on the subclass instead of the
base class (and these functions are public in the base class).
* Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::startOfflineRendering):
(WebCore::OfflineAudioContext::resumeOfflineRendering):
* Modules/webaudio/OfflineAudioContext.h:
- Drop some null checks now that m_destinationNode can no longer be null.
- Capture an ActiveDOMObject::PendingActivity when doing async work that ends up resolving a Promise, so that
we keep both the object and its wrapper alive for the duration of the async work.
* Modules/webaudio/WebKitAudioContext.cpp:
(WebCore::WebKitAudioContext::close):
Drop null checks for the destination node now that it can never be null.
* dom/ShadowRoot.cpp:
* rendering/FloatingObjects.cpp:
* rendering/RootInlineBox.cpp:
Update classes used of size restrictions since the size of a WeakPtr is not longer the same as the size of a
pointer when debug assertions are enabled. As long as they are the same size in release builds, there is no
memory use concern.
* testing/Internals.cpp:
(WebCore::Internals::numberOfBaseAudioContexts const):
* testing/Internals.h:
* testing/Internals.idl:
Add testing function to check how many BaseAudioContexts are alive, so that we can write layout tests and check
for leaks.
2021-04-08 Youenn Fablet <youenn@apple.com>
Streams: new test failure for canceling the branches of an errored tee'd stream
https://bugs.webkit.org/show_bug.cgi?id=223558
<rdar://problem/75924807>
Reviewed by Alex Christensen.
Align with latest version of the spec.
Covered by updated test.
* Modules/streams/ReadableStreamInternals.js:
(readableStreamTee):
(readableStreamTeePullFunction):
2021-04-08 Andres Gonzalez <andresg_22@apple.com>
VoiceOver does not echo text insertions and deletions when a contenteditable div has a non editable descendant element with a content editable child
https://bugs.webkit.org/show_bug.cgi?id=223818
Reviewed by Chris Fleizach.
Test: accessibility/nested-textareas-value-changed-notifications.html
AXObjectCache::textChanged now only notifies the closest non-native text
control of value changes. This avoid the problem of multiple value
changed notifications in a row when there are nested text areas.
Removed AccessibilityRenderObject::textChanged and moved that
functionality to AXObjectCache::textChanged, where it belongs.
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::textChanged):
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityObjectInterface.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::textChanged): Deleted.
* accessibility/AccessibilityRenderObject.h:
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::textChanged): Deleted.
* accessibility/isolatedtree/AXIsolatedObject.h:
2021-04-08 Youenn Fablet <youenn@apple.com>
Broken transition when video player with MediaStream changes size
https://bugs.webkit.org/show_bug.cgi?id=224161
<rdar://problem/76366061>
Reviewed by Eric Carlson.
In case of animation that changes the root layer bounds, we need to synchronously update
the buffer layer as well.
Manually tested.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rootLayerBoundsDidChange):
2021-04-08 Simon Fraser <simon.fraser@apple.com>
Compact GraphicsContextState
https://bugs.webkit.org/show_bug.cgi?id=224317
Reviewed by Jon Lee.
Shrink GraphicsContextState from 192 to 184 bytes. This saves space in all the
GraphicsContext state stacks, and on pages with filters and canvas there can be
many of these.
* platform/graphics/GraphicsContext.h:
2021-04-08 Sihui Liu <sihui_liu@apple.com>
Remove logging for investigating http/tests/IndexedDB/storage-limit-1.html failure
https://bugs.webkit.org/show_bug.cgi?id=223086
<rdar://problem/75591816>
Reviewed by Chris Dumez.
* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::diskUsage):
* Modules/indexeddb/server/IDBServer.h:
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::databasesSizeForDirectory):
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:
* storage/StorageQuotaManager.cpp:
(WebCore::StorageQuotaManager::requestSpaceOnBackgroundThread):
(WebCore::StorageQuotaManager::tryGrantRequest):
(WebCore::StorageQuotaManager::setLoggingEnabled): Deleted.
* storage/StorageQuotaManager.h:
2021-04-08 Antti Koivisto <antti@apple.com>
Revert r273621 because iPhone PLT regression
https://bugs.webkit.org/show_bug.cgi?id=224323
Unreviewed.
* dom/CharacterData.cpp:
(WebCore::CharacterData::parserAppendData):
(WebCore::CharacterData::setDataAndUpdate):
* dom/Document.cpp:
(WebCore::Document::removedLastRef):
(WebCore::Document::resolveStyle):
(WebCore::Document::updateTextRenderer):
(WebCore::Document::needsStyleRecalc const):
* dom/Document.h:
* dom/Text.cpp:
(WebCore::Text::splitText):
(WebCore::Text::updateRendererAfterContentChange):
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::deleteInsignificantText):
* editing/markup.cpp:
(WebCore::replaceChildrenWithFragment):
* rendering/updating/RenderTreeUpdater.cpp:
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::TreeResolver):
(WebCore::Style::TreeResolver::resolve):
* style/StyleTreeResolver.h:
(WebCore::Style::TreeResolver::TreeResolver): Deleted.
* style/StyleUpdate.cpp:
(WebCore::Style::Update::addText):
(WebCore::Style::Update::addPossibleRoot):
* style/StyleUpdate.h:
(WebCore::Style::Update:: const):
(WebCore::Style::Update::roots const): Deleted.
2021-04-08 Youenn Fablet <youenn@apple.com>
Update SFrame implementation to latest version
https://bugs.webkit.org/show_bug.cgi?id=224276
Reviewed by Eric Carlson.
Update implementation according to latest draft at https://github.com/eomara/sframe/blob/master/draft-omara-sframe.md.
In particular, we derive keys with new algorithm and the generation of the signature by including header and data length as well as nonce.
Test: webrtc/sframe-test-vectors.html
* Modules/mediastream/RTCRtpSFrameTransform.cpp:
(WebCore::RTCRtpSFrameTransform::setCounterForTesting):
* Modules/mediastream/RTCRtpSFrameTransform.h:
* Modules/mediastream/RTCRtpSFrameTransformer.cpp:
(WebCore::computeIV):
(WebCore::RTCRtpSFrameTransformer::updateEncryptionKey):
(WebCore::RTCRtpSFrameTransformer::decryptFrame):
(WebCore::RTCRtpSFrameTransformer::encryptFrame):
(WebCore::RTCRtpSFrameTransformer::computeEncryptedDataSignature):
* Modules/mediastream/RTCRtpSFrameTransformer.h:
* Modules/mediastream/RTCRtpSFrameTransformerCocoa.cpp:
(WebCore::RTCRtpSFrameTransformer::computeSaltKey):
(WebCore::createBaseSFrameKey):
(WebCore::RTCRtpSFrameTransformer::computeAuthenticationKey):
(WebCore::RTCRtpSFrameTransformer::computeEncryptionKey):
(WebCore::encodeBigEndian):
(WebCore::RTCRtpSFrameTransformer::computeEncryptedDataSignature):
* testing/Internals.cpp:
(WebCore::Internals::setSFrameCounter):
* testing/Internals.h:
* testing/Internals.idl:
2021-04-08 Xabier Rodriguez Calvar <calvaris@igalia.com>
Unreviewed. Fixed build warning.
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h: Avoid C-linkage warning.
2021-04-07 Julian Gonzalez <julian_a_gonzalez@apple.com>
Nullptr dereference in ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline
https://bugs.webkit.org/show_bug.cgi?id=224259
Reviewed by Ryosuke Niwa.
When pruning after removing the end <br> in ReplaceSelectionCommand::doApply(), make sure
that insertedNodes is updated properly (given that we may be removing an ancestor
of the start or end of insertedNodes).
Test: editing/inserting/insert-display-contents-crash.html
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::InsertedNodes::willRemovePossibleAncestorNode):
(WebCore::ReplaceSelectionCommand::InsertedNodes::willRemoveNode):
(WebCore::ReplaceSelectionCommand::doApply):
* editing/ReplaceSelectionCommand.h:
2021-04-07 Jean-Yves Avenard <jya@apple.com>
Site could crash if MediaRemote framework isn't available.
https://bugs.webkit.org/show_bug.cgi?id=224308
<rdar://problem/76273591>
Reviewed by Eric Carlson.
Check that MediaRemote framework is available before calling any of its method.
We put the check in the two static methods calling MediaRemote in order to keep all code dealing with MediaRemote in the same place.
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::clearNowPlayingInfo): Add a test with isMediaRemoteFrameworkAvailable
(WebCore::MediaSessionManagerCocoa::setNowPlayingInfo): Add a test with isMediaRemoteFrameworkAvailable
2021-04-02 Darin Adler <darin@apple.com>
Use Hasher more, remove IntegerHasher, fix hashing-related mistakes
https://bugs.webkit.org/show_bug.cgi?id=224138
Reviewed by Chris Dumez.
* contentextensions/ContentExtensionRule.h:
(WebCore::ContentExtensions::TriggerHash::hash): Use computeHash to
hash all the fields instead of a custom-written algorithm. The custom
algorithm had some magic numbers, repeatedly hashed hashes, and combined
hashes using exclusive or. The new one is almost certainly better.
* contentextensions/Term.h:
(WebCore::ContentExtensions::Term::CharacterSet::hash const):
Use computeHash to hash the boolean and the characters rather than
using intHash and pairIntHash.
* css/parser/CSSParserContext.cpp:
(WebCore::add): Moved the hashing here from the header. Fixed the
mistake where this was using & instead of | and so none of the booleans
were having any effect on the hash value.
* css/parser/CSSParserContext.h: Use WTF_MAKE_STRUCT_FAST_ALLOCATED so
we don't have to say public: explicitly. Also moved all the function
members to the bottom of the struct. This is typically preferred style
for structures as opposed to classes. Since the data members are the
primary interface, they are first, and all function members are secondary
and so they come after.
(WebCore::CSSParserContextHash::hash): Use convertHash instead of
a custom written hash function. The custom written function was combining
hahes using exclusive or, not a best practice, and also had a mistake
where it used & instead of | and so the "bits" local variable was always 0.
* html/FormController.cpp: Use HashTraits instead of WTF::GenericHashTraits.
* platform/encryptedmedia/CDMProxy.h: Removed unneedes includes.
* platform/graphics/Font.cpp: Changed CharacterFallbackMapKey into a
simple struct with no additional function members or static data members.
Changed CharacterFallbackMapKeyHash to use computeHash to calculate the
hash, instead of IntegerHasher. Probably better to hash the pointer of
the AtomString rather than hashing the hash, but either way, we should
have the best implementation for AtomString hashing in the Hasher class.
Added CharacterFallbackMapKeyHashTraits instead of using
SimpleClassHashTraits. Use the value U_SENTINEL for the UChar32 character,
which is the same as the -1 used before, but slightly clearer why it's OK.
(WebCore::Font::systemFallbackFontForCharacter const): Use HashMap::ensure
instead of HashMap::add to make the logic simpler.
* platform/graphics/Font.h: Use bool instead of uint8_t as the base type
for the No/Yes enumeration IsForPlatformFont.
* platform/graphics/FontCache.cpp: Removed unneeded "using namespace WTF",
which is not our best practice, especially given unified builds.
Changed FontPlatformDataCacheKey into a simple struct, removing all the
hash-related member functions. Also used struct-style naming for the
members without an "m_" prefix. Used the type FontFamilyName for the
family name, which means we will use FontCascadeDescription's system
for hashing and comparing family names for equality without having to
remember do to so explicitly. Changed FontPlatformDataCacheKeyHash to
use computeHash. The old version had unnecessarily complex logic to
handle Optional and was unnecessarily hashing hashes.
(WebCore::FontCache::cachedFontPlatformData): Renamed to remove "get"
from the function's name. Also use shorter argument and local variable
names that are single words, and updated since FontPlatformDataCacheKey
is now a struct without a constructor.
(WebCore::FontCache::fontForFamily): Use shorter names.
(WebCore::operator==): To compare two FontCascadeCacheKey objects,
use a simpler constructions, depending on the fact that Vector already
has an == operator and we are using FontFamilyName for the elements
of the vector, which has a correct == operator.
(WebCore::FontCascadeCacheKeyHash::hash): Use computeHash since
the FontFamilyName hashing is now correct, and we can rely on the
way Hasher knows how to iterate a collection.
(WebCore::FontCache::retrieveOrAddCachedFonts): Update since
FontCascadeCacheEntry is now a simple struct. Also use constexpr a bit.
(WebCore::FontCache::invalidate): Use copyToVectorOf<> to simplify the
code that calls fontCacheInvalidated on all the font selectors.
* platform/graphics/FontCache.h: Use "using" instead of "typedef".
Remove FontDescriptionKey::computeHash.
(WebCore::add): An overload of add for Hasher to include a
FontDescriptionKey in a hash, which just lists all the data members.
The old version did a hash of hashes, but that's not needed any more.
Updated FontDescriptionKeyHash to use the Hasher version of ComputeHash.
Added FontFamilyName. Change FontCascadeCacheKey to use a vector of
FontFamilyName instead of AtomString. In FontCascadeCacheEntry, use
WTF_MAKE_STRUCT_FAST_ALLOCATED instead of WTF_MAKE_FAST_ALLOCATED
and also got rid of the unneeeded constructor.
(WebCore::FontCascadeCacheKeyHashTraits::constructDeletedValue):
Use the deleted value of FontDescriptionKey.
(WebCore::FontCascadeCacheKeyHashTraits::isDeletedValue): Ditto.
Renamed getCachedFontPlatformData to just cachedFontPlatformData.
* platform/graphics/FontGenericFamilies.h: Use HashTraits instead of
WTF::GenericHashTraits.
* platform/graphics/FontSelectionAlgorithm.h:
(WebCore::FontSelectionRange::uniqueValue const): Deleted.
(WebCore::add): Add both the minimum and maximum values to the hash
separately instead of combining them. For now, this makes the way
they are hashed a bit inefficient, but that can be re-tightened up by
improving the algorithm of Hasher if we like. Should be fine for our
needs either way.
* platform/graphics/FontTaggedSettings.cpp:
(WebCore::FontFeatureSettings::hash const): Deleted.
(WebCore::FontVariationSettings::hash const): Deleted.
* platform/graphics/FontTaggedSettings.h: Added overloads of the
add(Hasher&) function for std::array<char, 4> and FontTaggedSetting<T>.
Got rid of many uses of pass by reference instead of value for FontTag,
since it fits into a 32-bit register and bth more source code and less
efficient to pass by value.
* platform/graphics/Gradient.cpp: Removed "using WTF::pairIntHash" since
that's now done in the WTF header.
* platform/graphics/cg/GraphicsContextCG.cpp: Ditto. Also removed
"using WTF::GenericHashTraits", which was unhelpful. The GenericHashTraits
template is only really needed when specializing HashTraits, which
already has to be done within the WTF namespace. In all other cases, we
should just use HashTraits instead.
* platform/graphics/cg/SubimageCacheWithTimer.h: Use HashTraits
instead of WTF::GenericHashTraits.
* platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
Move the data members to the top of the FontFamilySpecificationKey struct.
Removed unneeded computeHash function and WTF prefix from safeCFEqual.
(WebCore::FontFamilySpecificationKeyHash::hash): Call the Hasher version
of computeHash directly to hash the two items in this structure.
* platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
(WebCore::SystemFontDatabaseCoreText::CascadeListParameters::hash const):
Use computeHash instead of IntegerHasher. Also renamed the hash function
struct from CascadeListParameters::CascadeListParametersHash to
CascadeListParameters::Hash.
* platform/graphics/mac/ComplexTextControllerCoreText.mm:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
Removed now-unneeded WTF prefixes from calls to safeCFEqual.
* rendering/TextAutoSizing.h: Use HashTraits instead of WTF::GenericHashTraits.
* rendering/style/RenderStyle.cpp:
(WebCore::computeFontHash): Use computeHash instead of IntegerHasher.
Still not great that we hash a hash here, but we can improve that later.
* workers/service/ServiceWorkerClientIdentifier.h:
(WebCore::ServiceWorkerClientIdentifier::decode): Removed unneeded
WTFMove on ObjectIdentifier, which are just integers, so move vs. copy
is not an important distinction.
(WebCore::ServiceWorkerClientIdentifier::hash const): Use computeHash
instead of combining intHash with StringHasher::hashMemory. This fixes
two mistakes: one is that there is no need to hash a hash. The second is
that intHash takes a 32-bit integer as its parameter, so high bits
of object identifiers were discarded unnecessarily.
* workers/service/ServiceWorkerContextData.h: Removed unneeded include.
* workers/service/ServiceWorkerGlobalScope.h: Added now-needed include
of URLHash.h, since we removed it from a widely-included header.
* workers/service/context/SWContextManager.h: Ditto.
* workers/service/server/ServiceWorkerThreadProxy.h: Ditto.
* workers/service/server/RegistrationStore.h: Ditto.
* workers/service/server/SWServer.h: Ditto.
* workers/service/server/SWServerToContextConnection.h: Ditto.
* workers/service/server/SWServerWorker.h: Ditto.
2021-04-07 Mark Lam <mark.lam@apple.com>
Rename and make the TerminationException a singleton.
https://bugs.webkit.org/show_bug.cgi?id=224295
Reviewed by Keith Miller.
In the WorkerOrWorkletScriptController constructor, we ensure the TerminationException
because workers need to support termination requests.
* bindings/js/JSDOMExceptionHandling.cpp:
(WebCore::reportException):
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSC_DEFINE_HOST_FUNCTION):
(WebCore::handleResponseOnStreamingAction):
* bindings/js/JSDOMPromise.cpp:
(WebCore::DOMPromise::whenPromiseIsSettled):
* bindings/js/JSDOMPromiseDeferred.cpp:
(WebCore::DeferredPromise::reject):
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* bindings/js/ReadableStream.cpp:
(WebCore::invokeReadableStreamFunction):
(WebCore::ReadableStream::lock):
(WebCore::checkReadableStream):
* bindings/js/ReadableStreamDefaultController.cpp:
(WebCore::invokeReadableStreamDefaultControllerFunction):
(WebCore::ReadableStreamDefaultController::error):
(WebCore::ReadableStreamDefaultController::enqueue):
* workers/WorkerOrWorkletScriptController.cpp:
(WebCore::WorkerOrWorkletScriptController::WorkerOrWorkletScriptController):
(WebCore::WorkerOrWorkletScriptController::evaluate):
(WebCore::WorkerOrWorkletScriptController::linkAndEvaluateModule):
(WebCore::WorkerOrWorkletScriptController::loadAndEvaluateModule):
2021-04-07 Simon Fraser <simon.fraser@apple.com>
Remove RepaintLayoutRectsMap
https://bugs.webkit.org/show_bug.cgi?id=224217
Reviewed by Zalan Bujtas.
RepaintLayoutRectsMap was a side table used to map RenderLayerModelObjects to
repaint rects for their corresponding layers. However, this HashMap could
get large, and waste more space than if we just stored the repaint rects
on RenderLayer.
For example, on twitter.com we could have about 2000 RenderLayers; increasing
their size by 32 bytes (the size of the two LayoutRects) adds 62KB, but RepaintLayoutRectsMap
would contain about 1950 entries with a capacity of 8192, wasting around 200KB.
So moving repaint rects into RenderLayer is a memory saving. This patch does so
without using Optional<> since that introduces extra padding.
* rendering/ComplexLineLayout.cpp:
(WebCore::ComplexLineLayout::layoutRunsAndFloats):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
(WebCore::RenderLayer::updateLayerPositions):
(WebCore::RenderLayer::repaintRectIncludingNonCompositingDescendants const):
(WebCore::RenderLayer::computeRepaintRects):
(WebCore::RenderLayer::setRepaintRects):
(WebCore::RenderLayer::clearRepaintRects):
(WebCore::RenderLayer::updateLayerPositionsAfterScroll):
(WebCore::RenderLayer::calculateClipRects const):
* rendering/RenderLayer.h:
(WebCore::RenderLayer::repaintRects const):
(WebCore::RenderLayer::hasComputedRepaintRects const): Deleted.
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::willBeDestroyed):
(WebCore::RenderLayerModelObject::destroyLayer):
(WebCore::RenderLayerModelObject::styleDidChange):
(WebCore::RenderLayerModelObject::layerRepaintRects const):
(WebCore::RepaintLayoutRects::RepaintLayoutRects): Deleted.
(WebCore::RenderLayerModelObject::hasRepaintLayoutRects const): Deleted.
(WebCore::RenderLayerModelObject::setRepaintLayoutRects): Deleted.
(WebCore::RenderLayerModelObject::clearRepaintLayoutRects): Deleted.
(WebCore::RenderLayerModelObject::repaintLayoutRects const): Deleted.
(WebCore::RenderLayerModelObject::computeRepaintLayoutRects): Deleted.
* rendering/RenderLayerModelObject.h:
(WebCore::RepaintLayoutRects::RepaintLayoutRects): Deleted.
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::scrollTo):
2021-04-07 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity in various DisplayList related code paths
https://bugs.webkit.org/show_bug.cgi?id=224304
Reviewed by Wenson Hsieh.
Add DisplayList::shrinkToFit() and have it shrink the vector of drawing extents (this
could be extended to shrink item buffers at some point). Call the shrink from
FontCascade which caches glyph buffers as an optimization.
Reduce the inline capacity of the Recorder's context stack; this sticks around
for GPU process canvases.
Reduce the inline capacity of the DrawGyph buffers from 128 to 16, as these items
persist for FontCascade cached lists (until a memory warning).
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::displayListForTextRun const):
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::shrinkToFit):
* platform/graphics/displaylists/DisplayList.h:
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::DrawGlyphs::glyphs const):
* platform/graphics/displaylists/DisplayListRecorder.h:
2021-04-07 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity under CSSFontFace::setUnicodeRange()
https://bugs.webkit.org/show_bug.cgi?id=224266
Reviewed by Devin Rousso.
We know how big the Vector<UnicodeRange> is up-front.
* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::setUnicodeRange):
2021-04-07 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity under RuleFeatureSet::collectFeatures()
https://bugs.webkit.org/show_bug.cgi?id=224248
Reviewed by Devin Rousso.
The RuleSets constructed ensureInvalidationRuleSets() were never shrunk,
causing up to 500KB of wasted vector capacity on youtube.com.
This change calls shrinkToFit() on the RuleSets, and on the InvalidationRuleSet
vector.
* style/StyleScopeRuleSets.cpp:
(WebCore::Style::ensureInvalidationRuleSets):
2021-04-07 Simon Fraser <simon.fraser@apple.com>
Reduce Vector<> wasted capacity in some RuleSet code
https://bugs.webkit.org/show_bug.cgi?id=224160
Reviewed by Antti Koivisto.
Dynamic media rule-related vectors were not getting shrunk because m_dynamicMediaQueryRules
was constructed after the shrinkToFit() calls, and itself was not shrunk.
Also re-order member variables to reduce padding.
Saves 60-120KB on a nytimes page.
* style/RuleSet.cpp:
(WebCore::Style::RuleSet::addRulesFromSheet):
(WebCore::Style::RuleSet::evaluateDynamicMediaQueryRules):
(WebCore::Style::shrinkDynamicRules):
(WebCore::Style::RuleSet::shrinkToFit):
* style/RuleSet.h:
(WebCore::Style::RuleSet::DynamicMediaQueryRules::shrinkToFit):
2021-04-07 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity in RenderLayer lists
https://bugs.webkit.org/show_bug.cgi?id=224170
Reviewed by Sam Weinig.
Shrink RenderLayer normal flow and z-order lists.
This saves about 800KB on twitter.com.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateNormalFlowList):
(WebCore::RenderLayer::rebuildZOrderLists):
2021-04-07 Zalan Bujtas <zalan@apple.com>
[LFC][IFC] Remove InlineLines and InlineLineBoxes inline capacity of 10
https://bugs.webkit.org/show_bug.cgi?id=224296
Reviewed by Antti Koivisto.
A casual browsing session shows that the average line count is ~1.4. Having 10 as initial capacity seems a little excessive.
(and neither PerformanceTests/Layout/line-layout-inline-block.html nor PerformanceTests/Layout/line-layout-inline-level-boxes.html microbenchmarks show regression locally)
* layout/inlineformatting/InlineFormattingState.h:
2021-04-07 Chris Dumez <cdumez@apple.com>
Drop unnecessary NDEBUG checks in ServiceWorkerContainer
https://bugs.webkit.org/show_bug.cgi?id=224285
Reviewed by Youenn Fablet.
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
(WebCore::ServiceWorkerContainer::scheduleJob):
(WebCore::ServiceWorkerContainer::jobFailedWithException):
(WebCore::ServiceWorkerContainer::queueTaskToFireUpdateFoundEvent):
(WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
(WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
(WebCore::ServiceWorkerContainer::startScriptFetchForJob):
(WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
(WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
(WebCore::ServiceWorkerContainer::destroyJob):
(WebCore::ServiceWorkerContainer::addRegistration):
(WebCore::ServiceWorkerContainer::removeRegistration):
(WebCore::ServiceWorkerContainer::queueTaskToDispatchControllerChangeEvent):
(WebCore::ServiceWorkerContainer::contextIdentifier):
* workers/service/ServiceWorkerContainer.h:
2021-04-07 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity in StyleRuleKeyframes
https://bugs.webkit.org/show_bug.cgi?id=224264
Reviewed by Antti Koivisto.
Shrink StyleRuleKeyframes::m_keyframes. Saves 23KB on youtube.com.
* css/CSSKeyframesRule.cpp:
(WebCore::StyleRuleKeyframes::shrinkToFit):
* css/CSSKeyframesRule.h:
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeKeyframesRule):
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeAnimationShorthand):
2021-04-07 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity in StyleSheetContents
https://bugs.webkit.org/show_bug.cgi?id=224250
Reviewed by Darin Adler.
Call shrinkToFit() on the StyleSheetContents created in CSSParserImpl::parseStyleSheet()
in order to shrink m_importRules and m_childRules, which can waste about 100KB on
youtube.com.
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::parseStyleSheet):
2021-04-07 Zalan Bujtas <zalan@apple.com>
REGRESSION (r270849): Button content fails to render on apple.com "Blood Oxygen"/"ECG"
https://bugs.webkit.org/show_bug.cgi?id=224261
Reviewed by Simon Fraser.
1. The changeRequiresRecompositeLayer check in RenderStyle::diff should come after
changeRequiresRepaintIfTextOrBorderOrOutline since RepaintIfTextOrBorderOrOutline is at
a higher priority in StyleDifference.
2. Ensure that we trigger setNeedsCompositingConfigurationUpdate on diff >= StyleDifference::RecompositeLayer.
Test: fast/text/text-repaint-when-pointer-event-property-changes.html
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerStyleChanged):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::diff const):
2021-04-07 Rob Buis <rbuis@igalia.com>
Ignore non-null lastQuote ASSERT when continuation is broken
https://bugs.webkit.org/show_bug.cgi?id=218576
Reviewed by Zalan Bujtas.
Ignore non-null lastQuote when continuation is broken.
* rendering/updating/RenderTreeBuilder.h:
(WebCore::RenderTreeBuilder::hasBrokenContinuation const):
(WebCore::RenderTreeBuilder::setHasBrokenContinuation):
* rendering/updating/RenderTreeBuilderInline.cpp:
(WebCore::RenderTreeBuilder::Inline::splitInlines):
* rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
(WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
2021-04-07 Imanol Fernandez <ifernandez@igalia.com>
Use frameData instead of scheduleOnNextFrame calls in WebFakeXRDevice
https://bugs.webkit.org/show_bug.cgi?id=223580
Reviewed by Youenn Fablet.
This patch makes the WebFakeXRDevice code more robust by getting rid of the scheduleOnNextFrame calls.
Tested by WebXR WPT.
* testing/WebFakeXRDevice.cpp:
(WebCore::SimulatedXRDevice::setViews):
(WebCore::SimulatedXRDevice::setNativeBoundsGeometry):
(WebCore::SimulatedXRDevice::setViewerOrigin):
(WebCore::SimulatedXRDevice::frameTimerFired):
(WebCore::WebFakeXRDevice::setViews):
(WebCore::WebFakeXRDevice::setViewerOrigin):
(WebCore::WebFakeXRDevice::setFloorOrigin):
* testing/WebFakeXRDevice.h:
* testing/WebXRTest.cpp:
(WebCore::WebXRTest::simulateDeviceConnection):
2021-04-07 Philippe Normand <pnormand@igalia.com>
[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-07 Enrique Ocaña González <eocanha@igalia.com>
[EME][GStreamer] Abort decryptor operations immediately and without errors on flush
https://bugs.webkit.org/show_bug.cgi?id=223742
Reviewed by Xabier Rodriguez-Calvar.
A decryptor transformInPlace() operation can cause potentially long waits in
two situations:
- transformInPlace() is waiting to get the cdmProxy.
- The CDMProxy::decrypt() method is internally waiting for a specific key to
become available.
If a seek operation is performed during those long waits, the main thread will
be blocked until the seek finishes the conditions those long waits are waiting
for will never be fulfilled (because the operations that complete them happen
in the main thread, which is blocked), the internal wait timeouts will trigger
and the decoder will trigger an unrecoverable error.
The solution for this is to break the waits by issuing the right notifications,
and to detect the flushes performed by the seek, distinguising this special
"abort" case from a regular error, so that the situation is no longer
unrecoverable.
This solution involves changes in several layers. A public
CDMProxy::abortWaitingForKey() method is exposed to allow the decryptor to
awake the inner waitFor() that checks for the key. The cdmProxy wait is also
awaken in case there's no cdmProxy available yet.
In order to distinguish if the awakenings are caused by real errors (no
cdmProxy, no key available) or by a flush operation (caused by the seek), the
decryptor first needs to keep track of the "flushing" state and allow other
objects to know about it. CDMProxy is one of those objects, but due to layer
limitations it can't directly ask about it to the decryptor (it can't "see"
it).
A new CDMProxyDecryptionClient interface is created, and the decryptor will
hold an implementation of it (as CDMProxyDecryptorClientImplementation).
CDMProxy can then know the client isAborting(), and the client will know the
decryptor and will ask about it.
As the pipeline, and thus the decryptor, can be destroyed at any moment,
the client holds a WeakPtr to the decryptor and will only ask if isAborting()
if the pointer is still alive.
* platform/encryptedmedia/CDMProxy.cpp:
(WebCore::CDMProxy::abortWaitingForKey const): Notify waiting threads.
(WebCore::CDMProxy::tryWaitForKeyHandle const): Take a client and ask it if it's aborting.
(WebCore::CDMProxy::getOrWaitForKeyHandle const): Pass the client along.
(WebCore::CDMProxy::getOrWaitForKeyValue const): Ditto.
* platform/encryptedmedia/CDMProxy.h: Declaration and usage of the CDMProxyDecryptionClient interface.
* platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp:
(WebCore::CDMProxyClearKey::cencSetDecryptionKey): Pass the client along from the context.
* platform/graphics/gstreamer/eme/CDMProxyClearKey.h: Store client in the cencDecryptContext.
* platform/graphics/gstreamer/eme/CDMProxyThunder.cpp:
(WebCore::CDMProxyThunder::getDecryptionSession const): Pass the client along from the context.
(WebCore::CDMProxyThunder::decrypt): Abort operations aren't an error, so just trigger a warning if there's no session.
* platform/graphics/gstreamer/eme/CDMProxyThunder.h: Store client in DecryptionContext.
* platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
(decrypt): Ask for client to the superclass and store it in the context.
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
(CDMProxyDecryptionClientImplementation::CDMProxyDecryptionClientImplementation): Implementation of the CDMProxyDecryptionClient interface.
(CDMProxyDecryptionClientImplementation::isAborting): Ask if the decryptor is flushing.
(constructed): Initialize the client.
(transformInPlace): Check the flush status after waiting for the CDMProxy and for the decryption performed by the subclasses. Release the lock when not needed.
(isCDMProxyAvailable): Renamed mutex to be more generic.
(attachCDMProxy): Ditto. Also renamed condition for the same reason.
(sinkEventHandler): Manage isFlushing status and awake waits for cdmProxy or for session depending on the lifecycle stage.
(webKitMediaCommonEncryptionDecryptIsFlushing): Expose isFlushing status.
(webKitMediaCommonEncryptionDecryptGetCDMProxyDecryptionClient): Return Weak reference to the client.
(changeState): Renamed condition.
(setContext): Renamed mutex.
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h: New getters for isFlushing and the client.
* platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp:
(decrypt): Ask for client to the superclass and store it in the context.
2021-04-07 Enrique Ocaña González <eocanha@igalia.com>
[GStreamer] Only seek to change the rate un updatePlaybackRate() when needed
https://bugs.webkit.org/show_bug.cgi?id=224235
Reviewed by Alicia Boya Garcia.
A seek is used by MediaPlayerPrivateGStreamer to update the playback
rate used in the pipeline. There's a special case when the rate is 0.0.
This actually means "paused" and, when set, the pipeline is changed to
PAUSED and no updatePlaybackRate() call is made because of an early
return (and therefore, no seek). When the rate is restored to a
non-zero value, the pipeline is set again to PLAYING, but a
call to updatePlaybackRate() is done, which implies an unconditional
seek.
It should be possible to do the seek in updatePlaybackRate() only if the
rate changed with respect to the original one, instead of always doing
it. This would avoid unneeded seeks, which are complex operations that
can trigger collateral issues such as the one addressed in
https://bugs.webkit.org/show_bug.cgi?id=223742.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::updatePlaybackRate): Only seek when the playback rate hasn't changed.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Document m_lastPlaybackRate purpose.
2021-04-07 Rob Buis <rbuis@igalia.com>
Make synthesizedBaselineFromContentBox return LayoutUnit
https://bugs.webkit.org/show_bug.cgi?id=224234
Reviewed by Javier Fernandez.
Make synthesizedBaselineFromContentBox return LayoutUnit. This
makes it consistent with synthesizedBaselineFromBorderBox.
* rendering/RenderButton.cpp:
(WebCore::synthesizedBaselineFromContentBox):
(WebCore::RenderButton::baselinePosition const):
2021-04-07 Alejandro G. Castro <alex@igalia.com>
[GTK][WPE] Wrong frame scrolled when view is horizontally scrolled with async scrolling enabled
https://bugs.webkit.org/show_bug.cgi?id=222900
Reviewed by Žan Doberšek.
We need to use the scrolling offset in the parent when collecting
the descendant layers at a point. We substract the boundsOrigin to
make sure we transform the point considering the scrolling offset.
Test: fast/scrolling/scrolling-inside-scrolled-overflowarea.html
* page/scrolling/nicosia/ScrollingTreeNicosia.cpp:
(WebCore::collectDescendantLayersAtPoint):
2021-04-07 Ryosuke Niwa <rniwa@webkit.org>
REGRESSION(r274812): Release assert in Document::updateLayout() after calling focus({preventScroll: true}) on a textarea
https://bugs.webkit.org/show_bug.cgi?id=224262
Reviewed by Antti Koivisto.
The regression was caused by Element::focus not updating the selection when preventScroll is set to true.
Fixed it by always updating the selection whenever Element::focus is called.
Test: fast/forms/textarea/textarea-focus-prevent-scroll-crash.html
* dom/Element.cpp:
(WebCore::Element::focus):
(WebCore::Element::findTargetAndUpdateFocusAppearance): Renamed from revealFocusedElement.
* dom/Element.h:
* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchMouseEvent):
2021-04-07 Stephan Szabo <stephan.szabo@sony.com>
[PlayStation] Provide a non-empty User Agent
https://bugs.webkit.org/show_bug.cgi?id=224216
Reviewed by Ross Kirsling.
Add non-empty implementation of User Agent code for port.
* platform/playstation/UserAgentPlayStation.cpp:
2021-04-06 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Simplify DisplayList::Iterator part 5: Tweak the return type of DisplayList::Iterator::operator*()
https://bugs.webkit.org/show_bug.cgi?id=224148
Reviewed by Wenson Hsieh.
This patch migrates from
struct Value {
Optional<ItemHandle> item;
Optional<FloatRect> extent;
size_t itemSizeInBuffer { 0 };
};
Value operator*() const;
to
struct Value {
ItemHandle item;
Optional<FloatRect> extent;
size_t itemSizeInBuffer { 0 };
};
Optional<Value> operator*() const
There are two reasons for this:
1. Philosophically, if the item is nullopt, then all the stuff in the Value is also meaningless
2. Part of the iterator's API contract is that if the item is nullopt, you're not allowed to keep
iterating - doing this will lead to an infinite loop. Promoting the optional makes it more
likely that this API contract is followed in the future.
No new tests because there is no behavior change.
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::asText const):
(WebCore::DisplayList::DisplayList::dump const):
* platform/graphics/displaylists/DisplayList.h:
(WebCore::DisplayList::DisplayList::iterator::operator* const):
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::Replayer::replay):
2021-04-06 Zalan Bujtas <zalan@apple.com>
[LFC][IFC] InlineFormattingState::shrinkToFit should shrink InlineItems too
https://bugs.webkit.org/show_bug.cgi?id=224258
Reviewed by Simon Fraser.
* layout/inlineformatting/InlineFormattingState.h:
(WebCore::Layout::InlineFormattingState::shrinkToFit):
* layout/integration/LayoutIntegrationCoverage.cpp:
2021-04-06 Jean-Yves Avenard <jya@apple.com>
Fix logic error in MediaMetadataInit
https://bugs.webkit.org/show_bug.cgi?id=224252
<rdar://problem/76291386>
Reviewed by Eric Carlson.
Fix inverted logic error in decode that would have caused it to return early.
* Modules/mediasession/MediaMetadataInit.h:
(WebCore::MediaMetadataInit::decode):
2021-04-06 Sihui Liu <sihui_liu@apple.com>
[ Catalina WK2 Release ] http/tests/IndexedDB/storage-limit-1.https.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=213292
<rdar://problem/64447734>
Reviewed by Geoffrey Garen.
Test http/tests/IndexedDB/collect-IDB-objects.https.html, which runs right before
http/tests/IndexedDB/storage-limit-1.https.html, will delete databases after test completetion. During deletion,
we create a new database if it does not exist, extract database version from it, and then delete database files.
This creation can happen during storage-limit-1.https.html run and interrupt testing for quota. To fix the
flakiness and make the deletion more efficient, let's not create a new database during deletion if database
does not exist.
* Modules/indexeddb/server/IDBBackingStore.h:
* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::databaseVersion):
* Modules/indexeddb/server/MemoryIDBBackingStore.h:
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::databaseVersion):
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::deleteBackingStore):
2021-04-06 Eric Carlson <eric.carlson@apple.com>
REGRESSION (r275538): [ macOS ] TestWebKitAPI.WebKitLegacy.MediaPlaybackSleepAssertion and TestWebKitAPI.SleepDisabler.Pause consistently failing
https://bugs.webkit.org/show_bug.cgi?id=224249
<rdar://problem/76286539>
Reviewed by Jer Noble.
No new tests, this fixes two API tests.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): Use m_requestedRate
when choosing the pitch correction algorithm.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setPlayerRate): Ditto.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setPreservesPitch): Ditto.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setPitchCorrectionAlgorithm): Ditto.
(WebCore::MediaPlayerPrivateAVFoundationObjC::playerItemStatusDidChange): Ditto.
2021-04-06 Jer Noble <jer.noble@apple.com>
Unreviewed build fix after 275571: add declaration for new method (and make the constness match).
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::currentPositionApproximatelyEqualTo const):
(WebCore::MediaSessionCoordinator::currentPositionApproximatelyEqualTo): Deleted.
* Modules/mediasession/MediaSessionCoordinator.h:
2021-04-06 Jer Noble <jer.noble@apple.com>
[MediaSession] Add optional mediaTime and hostTime arguments to the playSession() command.
https://bugs.webkit.org/show_bug.cgi?id=224173
Reviewed by Eric Carlson.
When receiving a playSession() method that has an optional mediaTime argument, perform a
seekAction before the matching playAction if the current media time is not already approximately
equal to the mediaTime argument.
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::playSession):
(WebCore::MediaSessionCoordinator::currentPositionApproximatelyEqualTo):
* Modules/mediasession/MediaSessionCoordinator.h:
* Modules/mediasession/MediaSessionCoordinatorPrivate.h:
2021-04-06 Said Abou-Hallawa <said@apple.com>
Replace the Optional metadata of ImageSource by a single OptionSet and the underlying metadata
https://bugs.webkit.org/show_bug.cgi?id=224202
Reviewed by Simon Fraser.
Encapsulating the metadata in a Optionals adds extra memory cost. Replace
these Optionals by the underlying metadata and an OptionSet to tell which
ones are cached.
* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::ImageSource):
(WebCore::ImageSource::frameAtIndexCacheIfNeeded):
Instead of assertion index < m_frames.size(), we can return defaultFrame().
This will used in many callers which checks the size before calling it.
(WebCore::ImageSource::clearMetadata):
(WebCore::ImageSource::metadataCacheIfNeeded):
(WebCore::ImageSource::firstFrameMetadataCacheIfNeeded):
These two template functions will be used to return and cache, if needed,
the image metadata. The first function uses the ImageDecoder while the
second one uses the first ImageFrame of the image.
(WebCore::ImageSource::encodedDataStatus):
(WebCore::ImageSource::frameCount):
(WebCore::ImageSource::repetitionCount):
(WebCore::ImageSource::uti):
(WebCore::ImageSource::filenameExtension):
(WebCore::ImageSource::accessibilityDescription):
(WebCore::ImageSource::hotSpot):
(WebCore::ImageSource::orientation):
(WebCore::ImageSource::densityCorrectedSize):
(WebCore::ImageSource::sourceSize):
(WebCore::ImageSource::singlePixelSolidColor):
(WebCore::ImageSource::maximumSubsamplingLevel):
(WebCore::ImageSource::frameDecodingStatusAtIndex):
(WebCore::ImageSource::frameHasAlphaAtIndex):
(WebCore::ImageSource::frameHasFullSizeNativeImageAtIndex):
(WebCore::ImageSource::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex):
(WebCore::ImageSource::frameSubsamplingLevelAtIndex):
(WebCore::ImageSource::frameSizeAtIndex):
(WebCore::ImageSource::frameBytesAtIndex):
(WebCore::ImageSource::frameDurationAtIndex):
(WebCore::ImageSource::frameOrientationAtIndex):
(WebCore::ImageSource::frameImageAtIndex):
(WebCore::ImageSource::frameImageAtIndexCacheIfNeeded):
(WebCore::ImageSource::metadata): Deleted.
(WebCore::ImageSource::frameMetadataAtIndex): Deleted.
(WebCore::ImageSource::frameMetadataAtIndexCacheIfNeeded): Deleted.
* platform/graphics/ImageSource.h:
(WebCore::ImageSource::frameAtIndex):
2021-04-06 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Simplify DisplayList::Iterator part 3: Reorder #include dependencies to allow for ItemBuffer{Writing,Reading}Client to know about DisplayList item types
https://bugs.webkit.org/show_bug.cgi?id=224145
Reviewed by Wenson Hsieh.
ItemBuffer{Writing,Reading}Client exists within DisplayListItemBuffer.h. The DisplayList item types exist within DisplayListItems.h.
Previously, the #include path was:
DisplayListItems.h -> DisplayList.h -> DisplayListItemBuffer.h
However, this means that DisplayListItemBuffer.h can't see what's inside DisplayListItems.h.
After this patch, the #include path is:
DisplayList.h -> DisplayListItemBuffer.h -> DisplayListItems.h
This is important because ItemBuffer{Writing,Reading}Client have encodeItem() and decodeItem() functions, which will need to know
about DisplayList item types if we want to migrate away from ItemHandle.
No new tests because there is no behavior change.
* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
* platform/graphics/displaylists/DisplayListItemBuffer.h:
* platform/graphics/displaylists/DisplayListItemBufferIdentifier.h: Added.
* platform/graphics/displaylists/DisplayListItems.h:
2021-04-06 Brent Fulgham <bfulgham@apple.com>
Add additional page load diagnostic logging
https://bugs.webkit.org/show_bug.cgi?id=224194
<rdar://problem/76227175>
Reviewed by Alex Christensen.
This patch adds new logging to help us diagnose and investigate page load failures.
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::init): Add logging for some unusual conditions:
(1) A loader cannot be created because the document loader is nullptr.
(2) A load is cancelled because it violates security policy.
(3) A load was cancelled during 'willSendRequest' processing.
(4) A load was cancelled because the request was null.
(WebCore::ResourceLoader::loadDataURL): Log when a data load was cancelled.
(WebCore::ResourceLoader::willSendRequestInternal): Log when a cross-origin redirect is triggered, and when a redirect is
to a dataURL and will be handled locally.
(WebCore::ResourceLoader::didFinishLoadingOnePart): Log when a load is cancelled after it finished.
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal): Log when an ongoing load has unexpectedly reached terminal state. Remove a
spammy log message that indicates when a redirect response is null (which just means its a normal load).
(WebCore::SubresourceLoader::didFinishLoading): Log when a finished load unexpectedly did not reach terminal state.
(WebCore::SubresourceLoader::notifyDone): Log when a load could not finish because the document loader was nullptr.
2021-04-06 Patrick Angle <pangle@apple.com>
Web Inspector: Grid overlay label style cleanup
https://bugs.webkit.org/show_bug.cgi?id=224240
Reviewed by BJ Burg.
Clean up grid overlay label styling by:
- Make all labels use a translucent background. This patch chooses a middle ground between the existing
translucent labels that matched the color of the rulers, and the solid white background used by line
numbers/names for maximum legibility.
- Bumping the label padding by 1px to improve legibility.
- Bumping the label arrow size by 2px to make it easier to understand where a label is pointing, particularly
for labels where the edge position is not `Middle`.
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::drawGridOverlay):
(WebCore::InspectorOverlay::buildGridOverlay):
2021-04-06 Patrick Angle <pangle@apple.com>
Web Inspector: Grid overlay track size labels should show implicit `auto` value and no computed size
https://bugs.webkit.org/show_bug.cgi?id=224199
Reviewed by BJ Burg.
Previously, implicit `auto` track sizes were only shown if there were some number of explicit track sizes for
that track direction (rows/columns). To resolve this, `authoredGridTrackSizes` now only returns explicit
authored track sizes, and buildGridOverlay then infers `auto` for all remaining tracks. This will also help
resolve bug 224200 by providing a way to distinguish explicit and implicit tracks.
After discussion, this patch also removes the computed size of tracks from labels, as that information is
available in the box model diagram for children elements and having that information in these labels further
cramped often limited space for overlay labels.
* inspector/InspectorOverlay.cpp:
(WebCore::authoredGridTrackSizes):
(WebCore::InspectorOverlay::buildGridOverlay):
2021-04-06 Patrick Angle <pangle@apple.com>
Web Inspector: Grid overlay line numbers should not include implicit tracks in negative line number calculations.
https://bugs.webkit.org/show_bug.cgi?id=224200
Reviewed by BJ Burg.
Use the `authoredTrackColumnSizes`/`authoredTrackRowSizes` to determine if the line is an explicit grid line or
implicit grid line (starting with the patch for bug 224199 those vectors will only contain the explicit lines).
Only explicit lines should have a negative number for addressing the line, and those numbers should start with
the last explicit line. Because each track is bounded by two lines, there will always be one more explicit line
than there is explicit track, including the case where there are no explicit tracks, which will still have a
single explicit line numbered `-1`.
Additionally, line numbers are now separated by an em-space to improve legibility, where previously the bullet
looked like a multiplication symbol between two numbers.
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::buildGridOverlay):
2021-04-06 Mike Gorse <mgorse@suse.com>
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-04-06 Philippe Normand <pnormand@igalia.com>
REGRESSION(r275275): Broke some build configs lacking openh264
https://bugs.webkit.org/show_bug.cgi?id=224244
Unreviewed, manual revert of r275275 and r275409.
* platform/mediastream/libwebrtc/GStreamerVideoCommon.cpp:
(WebCore::gstreamerSupportedH264Codecs):
(WebCore::supportedH264Formats): Deleted.
* platform/mediastream/libwebrtc/GStreamerVideoCommon.h:
* platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
* platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
(WebCore::GStreamerVideoEncoderFactory::CreateVideoEncoder):
(WebCore::GStreamerVideoEncoderFactory::GetSupportedFormats const):
2021-04-06 Simon Fraser <simon.fraser@apple.com>
Shrink some IndexedDB-related classes
https://bugs.webkit.org/show_bug.cgi?id=224221
Reviewed by Geoffrey Garen.
Shrink some enum classes, and re-order data members to optimize packing in
IDBRequest and IDBKeyRangeData.
A couple of data members of IDBRequest were made private with protected setters.
This shrinks IDBRequest from 496 bytes to 448 bytes, and IDBKeyRangeData from 96
to 72 bytes on x86_64.
* Modules/indexeddb/IDBKeyData.h:
* Modules/indexeddb/IDBKeyRangeData.cpp:
(WebCore::IDBKeyRangeData::IDBKeyRangeData):
* Modules/indexeddb/IDBKeyRangeData.h:
(WebCore::IDBKeyRangeData::IDBKeyRangeData):
* Modules/indexeddb/IDBObjectStore.h:
* Modules/indexeddb/IDBOpenDBRequest.cpp:
(WebCore::IDBOpenDBRequest::IDBOpenDBRequest):
(WebCore::IDBOpenDBRequest::versionChangeTransactionDidFinish):
(WebCore::IDBOpenDBRequest::onSuccess):
(WebCore::IDBOpenDBRequest::onUpgradeNeeded):
(WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::IDBRequest):
* Modules/indexeddb/IDBRequest.h:
(WebCore::IDBRequest::setReadyState):
(WebCore::IDBRequest::setShouldExposeTransactionToDOM):
* Modules/indexeddb/IndexedDB.h:
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
* Modules/indexeddb/server/MemoryIndex.h:
* Modules/indexeddb/server/MemoryObjectStore.h:
* Modules/indexeddb/shared/IDBCursorInfo.h:
* Modules/indexeddb/shared/IDBGetAllRecordsData.h:
2021-04-06 Ryosuke Niwa <rniwa@webkit.org>
Assert failure in isCloneInShadowTreeOfSVGUseElement
https://bugs.webkit.org/show_bug.cgi?id=224174
Reviewed by Darin Adler and Antti Koivisto.
The bug was caused by two related but distinct issues:
1. An element can have an instance that had been removed from a use element's shadow tree
but not yet deleted. Because SVGElement clears its correspondingElement in its destructor,
when addEventListener is called on such an element, it can try to add an event listener
on this instance which is in the process of getting disposed.
2. DOM mutation events can be fired on the corresponding element of an instance inside
a use elements shadow tree with EventQueueScope in the stack when the event is schedueld
via Node::dispatchScopedEvent, e.g. because use element's shadow tree was updated during
a style update at the beginning of document.execComand. Because SVGUseElement::cloneTarget
constructs the shadow tree by cloning the original tree while it's disconnected from the
document, Node::dispatchSubtreeModifiedEvent sees isInShadowTree() to be false and happily
tries to dispach DOMSubtreeModified event using Node::dispatchScopedEvent. This works fine
when the event is dispatched synchronously since these elements had never been exposed to
any scripts yet and they are still disconnected so no scripts have had an opportunity to
attach an event listener. But when EventQueueScope in the stack, Node::dispatchScopedEvent
will queue up the event and fire it later when those instance elements had been inserted
into use element's shadow tree.
This patch addresses (1) by severing correspondingElement relationship as soon as an instance
is removed from its use element's shadow tree, and (2) by not dispatching a scheduled mutation
event if the target is inside a shadow tree. Note that this patch also addresses (2) for
a regular shadow tree attached by author scripts.
Tests: fast/shadow-dom/mutation-event-in-shadow-tree.html
svg/dom/mutate-symbol-subtree-referenced-by-use-during-execCommand.html
svg/dom/update-svg-use-shadow-tree-with-execCommand.html
* dom/ScopedEventQueue.cpp:
(WebCore::ScopedEventQueue::dispatchEvent const):
* svg/SVGElement.cpp:
(WebCore::SVGElement::~SVGElement):
(WebCore::SVGElement::removedFromAncestor):
(WebCore::SVGElement::addEventListener):
(WebCore::SVGElement::removeEventListener):
2021-04-06 Eric Carlson <eric.carlson@apple.com>
[Cocoa] audio played at 2x speed video is not pitch corrected
https://bugs.webkit.org/show_bug.cgi?id=224238
rdar://75868284
Reviewed by Jer Noble.
We need to use the _intended_ playback rate when deciding which pitch correction
algorithm to use. MediaPlayerPrivateAVFoundationObjC::m_cachedRate is used for this,
but r274592 stopped setting m_cachedRate in MediaPlayerPrivateAVFoundationObjC::setPlayerRate
because it is also set when AVPlayer KVOs that the rate changed.
Tested manually.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::setPlayerRate): Set m_cachedRate.
2021-04-06 David Kilzer <ddkilzer@apple.com>
UBSan: RenderView.cpp:831:9: runtime error: load of value nnn, which is not a valid value for type 'bool'
<https://webkit.org/b/224157>
Reviewed by Darin Adler.
Tests: editing/inserting/insert-list-user-select-none-crash.html
fast/dom/clientWidthAfterDocumentIsRemoved.html
fast/scrolling/iframe-scrollable-after-back.html
fast/text/crash-font-family-parsed.html
html5lib/generated/run-template-write.html
imported/blink/plugins/renderless-plugin-creation-doesnt-crash-without-frame.html
imported/w3c/web-platform-tests/css/cssom-view/scrolling-no-browsing-context.html
imported/w3c/web-platform-tests/dom/ranges/Range-mutations-appendChild.html
imported/w3c/web-platform-tests/html/browsers/the-window-object/named-access-on-the-window-object/navigated-named-objects.window.html
imported/w3c/web-platform-tests/html/semantics/forms/the-label-element/clicking-interactive-content.html
imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_template.html
imported/w3c/web-platform-tests/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html
imported/w3c/web-platform-tests/selection/addRange-12.html
imported/w3c/web-platform-tests/shadow-dom/untriaged/html-elements-in-shadow-trees/html-forms/test-001.html
media/track/track-remove-crash.html
svg/custom/animate-reference-crash.html
* rendering/RenderView.h:
(WebCore::RenderView::m_wasAccumulatingRepaintRegion):
- Add default initialization.
2021-04-06 Jiewen Tan <jiewen_tan@apple.com>
WebCrypto in Safari will not AES-GCM encrypt 0 bytes
https://bugs.webkit.org/show_bug.cgi?id=224083
<rdar://75093377>
Reviewed by Youenn Fablet.
CommonCrypto will bail out both the encryption and decryption process if the dataOut is a null pointer.
To workaround the issue, this patch forces the dataOut to be a non-null pointer.
Test: crypto/subtle/aes-gcm-generate-key-encrypt-decrypt-null-plain-text.html
* crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
(WebCore::encryptAES_GCM):
(WebCore::decyptAES_GCM):
2021-04-06 Patrick Angle <pangle@apple.com>
Web Inspector: Grid overlay areas appear offset from their actual areas when the grid container has a border set
https://bugs.webkit.org/show_bug.cgi?id=224201
Reviewed by BJ Burg.
As of r274096, it is no longer correct to subtract the first track's position for either axis from the edge
lines of areas. This change resolves that, bringing this math in line with how other grid lines are laid out.
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::buildGridOverlay):
2021-04-06 Alicia Boya García <aboya@igalia.com>
[GStreamer] At EOS, change position to match duration, not the other way around.
https://bugs.webkit.org/show_bug.cgi?id=224237
Reviewed by Philippe Normand.
The criteria used to check if playback has finished is currentTime >=
duration. Currently MediaPlayerPrivateGStreamer::didEnd() ensures this
in an awkward way: by changing the duration so that it matches
currentTime, rather than the other way around.
This meant a duration change at the end of playback most of the time,
with a slightly different duration each time, since currentTime is
cached periodically.
This patch reworks that function to work more naturally and less racy:
First, only if the stream doesn't have a set duration (e.g. live
stream), we set a duration to currentTime, as defined in the spec.
Second, at EOS we update currentTime to match duration, rather than
the other way around.
This patch doesn't introduce changes in test results.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::didEnd):
2021-04-06 Tyler Wilcock <twilco.o@protonmail.com>
Non-unified build fixes, early April 2021
https://bugs.webkit.org/show_bug.cgi?id=224091
Reviewed by Simon Fraser.
The SelectionRestorationMode enum has been moved out of Document.h so
the entirety of Document.h doesn't need to be included just for that
enum.
* Headers.cmake:
Add SelectionRestorationMode.h.
* WebCore.xcodeproj/project.pbxproj:
Add SelectionRestorationMode.h.
* dom/Document.h:
Move SelectionRestorationMode enum to its own file.
* dom/Element.h:
Add forward declaration for enum class SelectionRestorationMode. Rearrange
existing enum class forward declarations alphabetically.
* dom/SelectionRestorationMode.h: Added.
* dom/FocusOptions.h:
* history/CachedPage.cpp:
* html/HTMLFormControlElement.cpp:
* html/HTMLInputElement.h:
* html/HTMLLabelElement.cpp:
* html/HTMLLegendElement.cpp:
* html/HTMLTextAreaElement.h:
* html/InputType.cpp:
* page/EventHandler.cpp:
* page/FocusController.cpp:
Add #include "SelectionRestorationMode.h".
* workers/service/context/ServiceWorkerThreadProxy.cpp:
Add #include "ServiceWorkerGlobalScope.h" to fix:
ServiceWorkerThreadProxy.cpp:287:53: error: invalid use of incomplete type
'WTF::match_constness_t<WebCore::ScriptExecutionContext, WebCore::ServiceWorkerGlobalScope>'
{aka 'class WebCore::ServiceWorkerGlobalScope'}
2021-04-06 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] Use opaque system colors for control backgrounds
https://bugs.webkit.org/show_bug.cgi?id=224131
<rdar://problem/75975709>
Reviewed by Tim Horton.
r274600 introduced the use of system colors for control backgrounds.
However, the system fill colors are not opaque, leading to poor
visibility on certain page/element backgrounds.
To fix, use an opaque variant of the system fill colors, as if they
were drawn on top of a white background. Note that UIKit does not
expose these opaque variants, leaving us to make the adjustments
ourselves.
* css/CSSValueKeywords.in:
Replace the system fill color keywords with opaque variants. The old
colors are fine to remove, since they were only introduced in r274600,
and have no external clients.
* css/html.css:
Replace all system fill colors with their opaque variants.
* rendering/RenderThemeIOS.mm:
(WebCore::cssValueSystemColorInformationList):
Renamed CSSValueIDAndSelector to CSSValueSystemColorInformation to
account for the addition of new fields to support opaque fill colors.
Storing the blendOverWhite and opacity fields in the list allows us
to resolve the color once and store it in a cache, rather than
applying the adjustments each time.
(WebCore::systemColorFromCSSValueSystemColorInformation):
Use the blendOverWhite and opacity information from the
CSSValueSystemColorInformation to determine the final color.
(WebCore::systemColorFromCSSValueID):
Call into systemColorFromCSSValueSystemColorInformation to avoid
duplicating logic.
(WebCore::RenderThemeIOS::cssValueToSystemColorMap):
(WebCore::RenderThemeIOS::systemColor):
(WebCore::RenderThemeIOS::checkboxRadioBackgroundColor):
(WebCore::RenderThemeIOS::paintProgressBarWithFormControlRefresh):
(WebCore::RenderThemeIOS::paintMeter):
(WebCore::RenderThemeIOS::paintSliderTrackWithFormControlRefresh):
2021-04-06 Tadeu Zagallo <tzagallo@apple.com>
Handle OOM in ScriptExecutionContext::reportUnhandledPromiseRejection
https://bugs.webkit.org/show_bug.cgi?id=223777
<rdar://66271491>
Reviewed by Yusuke Suzuki.
It's possible to fail to allocate the error message in ScriptExecutionContext::reportUnhandledPromiseRejection,
in which case we should report an OOM exception instead of crashing.
Test: js/Promise-reject-large-string.html
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection):
2021-04-06 Patrick Angle <pangle@apple.com>
Web Inspector: Grid overlay does not honor writing modes and RTL layout direction.
https://bugs.webkit.org/show_bug.cgi?id=224127
Reviewed by BJ Burg.
Grid overlays did not previous honor writing modes and RTL layout direction correctly. The underlying math was
correct, but the 'origin' of the element's grid, and the direction in which rows and columns increased, was not
handled correctly. This patch resolves this by taking writing mode and direction into account when calculating
row/column line positions as well as correctly orienting layout label arrows based on the current writing
mode/direction.
Area names have been moved to the center of their respective areas, which both helps to make sure the label is
within the area for all writing modes/direction/transformation, as well as improved legibility on smaller grids
where area names were previously behind other labels.
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::backgroundPathForLayoutLabel):
(WebCore::InspectorOverlay::drawLayoutLabel):
(WebCore::InspectorOverlay::drawGridOverlay):
- `backgroundPathForLayoutLabel`, `drawLayoutLabel`, and `drawGridOverlay` now interpret the `None` arrow direction
as using the label's location as its center, not top-left.
(WebCore::authoredGridTrackSizes):
- Drive-by removal of extra whitespace.
(WebCore::InspectorOverlay::buildGridOverlay):
- Use the element's computed style to determine writing mode and direction (which takes into account the `dir` attribute).
- Adjust columnLineAt and rowLineAt calculations based on writing mode and direction.
- Adjust all arrow directions and positions based on writing mode and direction.
2021-04-06 Stephan Szabo <stephan.szabo@sony.com>
[PlayStation] Fix build of DiagnosticLoggingDomain.h
https://bugs.webkit.org/show_bug.cgi?id=224205
Reviewed by Don Olmstead.
No new tests, build fix only.
* page/DiagnosticLoggingDomain.h: Include wtf/EnumTraits.h
2021-04-06 Philippe Normand <pnormand@igalia.com>
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-06 Zalan Bujtas <zalan@apple.com>
[LFC][Integration] Enable inline box support (RenderInline)
https://bugs.webkit.org/show_bug.cgi?id=220148
<rdar://problem/72768785>
Reviewed by Antti Koivisto.
Use the modern line layout for content like <span>content inside an inline box</span>.
* layout/integration/LayoutIntegrationCoverage.cpp:
2021-04-06 Philippe Normand <pnormand@igalia.com>
[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 <audio> element.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::sourceSetup):
(WebCore::MediaPlayerPrivateGStreamer::hasFirstSampleReachedSink const):
(WebCore::MediaPlayerPrivateGStreamer::videoSinkCapsChanged):
(WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
(WebCore::MediaPlayerPrivateGStreamer::updateTracks):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
(webkitMediaStreamSrcPostStreamCollection):
(webkitMediaStreamSrcSetStream):
* platform/mediastream/gstreamer/GStreamerMediaStreamSource.h:
2021-04-06 Philippe Normand <pnormand@igalia.com>
[GTK][GStreamer] Web Audio - Media element source - Audio is cracking.
https://bugs.webkit.org/show_bug.cgi?id=196293
Reviewed by Xabier Rodriguez-Calvar.
The provider client might request samples faster than the current clock speed, so this sink
should process buffers as fast as possible. The cracks were consequence of the audio sink of
the AudioDestination starving off.
* platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
(WebCore::AudioSourceProviderGStreamer::handleNewDeinterleavePad):
2021-04-06 Philippe Normand <pnormand@igalia.com>
[GStreamer] Heap allocation exceptions
https://bugs.webkit.org/show_bug.cgi?id=224188
Reviewed by Xabier Rodriguez-Calvar.
The current GStreamer audio-related backends can't yet avoid heap allocations in the audio
thread, so we need exceptions for those cases.
* platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
(WebCore::AudioSourceProviderGStreamer::provideInput):
* platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp:
(gstMemoryFastMallocNew):
* platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::audioSamplesAvailable):
2021-04-06 Philippe Normand <pnormand@igalia.com>
[GStreamer][MediaStream] AudioSource triggering critical warnings
https://bugs.webkit.org/show_bug.cgi?id=224180
Reviewed by Xabier Rodriguez-Calvar.
Keep track of audio channel offsets and store them as metadata in audio buffers. This is
used by downstream elements such as the audio convert elements.
* Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp:
(WebCore::copyBusData):
(WebCore::MediaStreamAudioSource::consumeAudio):
2021-04-06 Antti Koivisto <antti@apple.com>
[LFC][Integration] Disable LFC if paginated context has inline boxes
https://bugs.webkit.org/show_bug.cgi?id=224222
Reviewed by Zalan Bujtas.
There are no known problems with this combination but it is untested.
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForChild):
Pass in the RenderBlockFlow and move the existing test requiring it here too.
(WebCore::LayoutIntegration::canUseForLineLayoutWithReason):
2021-04-06 Keith Miller <keith_miller@apple.com>
CloneDeserializer should use ArrayBuffer::tryCreate
https://bugs.webkit.org/show_bug.cgi?id=224218
Reviewed by Antti Koivisto.
Right now CloneDeserializer assumes that every ArrayBuffer allocation during
deserialization will succeed. This is silly since it's an array-like object.
It should call tryCreate and fail the deserialization instead.
Test: fast/dom/Window/post-message-large-array-buffer-should-not-crash.html
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readArrayBuffer):
2021-04-06 Stephan Szabo <stephan.szabo@sony.com>
[PlayStation] Change mediaControlsLocalizedStrings to use unicode escapes
https://bugs.webkit.org/show_bug.cgi?id=224195
Reviewed by Yusuke Suzuki.
* en.lproj/mediaControlsLocalizedStrings.js:
Switch from literal smart quotes to unicode escapes.
2021-04-06 Rob Buis <rbuis@igalia.com>
Migrate layout ascents and descents to LayoutUnits instead of ints
https://bugs.webkit.org/show_bug.cgi?id=133040
Reviewed by Zalan Bujtas.
Migrate layout ascents and descents to LayoutUnits instead of ints.
The actual ascent/descent values are still integral.
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::adjustMaxAscentAndDescent):
(WebCore::InlineFlowBox::computeLogicalBoxHeights):
* rendering/InlineFlowBox.h:
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::alignBoxesInBlockDirection):
(WebCore::setAscentAndDescent):
(WebCore::RootInlineBox::ascentAndDescentForBox const):
* rendering/RootInlineBox.h:
2021-04-06 Chris Lord <clord@igalia.com>
BidiContext caching is not thread-safe
https://bugs.webkit.org/show_bug.cgi?id=224179
Reviewed by Darin Adler.
Make BidiContext ThreadSafeRefCounted and make shared context creation
thread-safe. This is needed by OffscreenCanvas to use text in Workers.
No new tests, covered by existing tests.
* platform/text/BidiContext.cpp:
(WebCore::BidiContext::create):
* platform/text/BidiContext.h:
2021-04-06 Frédéric Wang <fwang@igalia.com>
Nullptr crash in EventPath::eventTargetRespectingTargetRules
https://bugs.webkit.org/show_bug.cgi?id=222718
Reviewed by Ryosuke Niwa.
During executions of "undo" and "redo" commands, beforeinput and input events are dispatched
on root editable elements. It is however possible that these elements had been disconnected,
causing nullptr crash. This patch exits the command execution early if that's the case.
Test: editing/undo/undo-with-disconnected-editable-element-crash.html
* editing/CompositeEditCommand.cpp:
(WebCore::EditCommandComposition::areRootEditabledElementsConnected): Add helper function
to check whether m_startingRootEditableElement and m_endingRootEditableElement are still
connected.
(WebCore::EditCommandComposition::unapply): Exit early if root editable elements are no
longer connected. Put this after the layout update.
(WebCore::EditCommandComposition::reapply): Ditto.
* editing/CompositeEditCommand.h: Declare new helper function.
2021-03-24 Sergio Villar Senin <svillar@igalia.com>
[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-06 Rob Buis <rbuis@igalia.com>
Move synthesizedBaselineFromBorderBox to RenderBox
https://bugs.webkit.org/show_bug.cgi?id=224186
Reviewed by Javier Fernandez.
Move synthesizedBaselineFromBorderBox to RenderBox since there are
various call sites using it.
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::inlineBlockBaseline const):
* rendering/RenderBox.cpp:
(WebCore::synthesizedBaselineFromBorderBox):
* rendering/RenderBox.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::synthesizedBaselineFromBorderBox): Deleted.
* rendering/RenderGrid.cpp:
(WebCore::synthesizedBaselineFromBorderBox): Deleted.
2021-04-05 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity in CSSSegmentedFontFace
https://bugs.webkit.org/show_bug.cgi?id=224167
Reviewed by Myles C. Maxfield.
Shrink FontRanges.m_ranges. This saves about 12KB on youtube.com.
* css/CSSSegmentedFontFace.cpp:
(WebCore::CSSSegmentedFontFace::fontRanges):
* platform/graphics/FontRanges.h:
(WebCore::FontRanges::shrinkToFit):
2021-04-05 Chris Dumez <cdumez@apple.com>
Make sure we no longer show the previous page when running a JS prompt
https://bugs.webkit.org/show_bug.cgi?id=215782
<rdar://problem/67698601>
Reviewed by Darin Adler.
Add linked-on-after check for the behavior change to minimize the risk of
breakage.
* platform/cocoa/VersionChecks.h:
2021-04-05 Alex Christensen <achristensen@webkit.org>
Resurrect Mac CMake build
https://bugs.webkit.org/show_bug.cgi?id=224084
Reviewed by Tim Horton.
* PlatformMac.cmake:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/mac/WebGLBlocklist.mm:
* platform/text/cocoa/LocalizedDateCache.h: Renamed from Source/WebCore/platform/text/ios/LocalizedDateCache.h.
* platform/text/cocoa/LocalizedDateCache.mm: Renamed from Source/WebCore/platform/text/ios/LocalizedDateCache.mm.
(WebCore::localizedDateCache):
(WebCore::_localeChanged):
(WebCore::LocalizedDateCache::LocalizedDateCache):
(WebCore::LocalizedDateCache::~LocalizedDateCache):
(WebCore::LocalizedDateCache::localeChanged):
(WebCore::LocalizedDateCache::formatterForDateType):
(WebCore::LocalizedDateCache::maximumWidthForDateType):
(WebCore::LocalizedDateCache::createFormatterForType):
(WebCore::LocalizedDateCache::calculateMaximumWidth):
* testing/cocoa/WebViewVisualIdentificationOverlay.mm:
2021-04-05 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity in SVGPathByteStream
https://bugs.webkit.org/show_bug.cgi?id=224165
Reviewed by Said Abou-Hallawa.
On youtube.com, about 50KB of vector capacity is wasted in SVGPathByteStream,
so shrink them after parsing.
* svg/SVGPathByteStream.h:
(WebCore::SVGPathByteStream::shrinkToFit):
* svg/SVGPathParser.cpp:
(WebCore::SVGPathParser::parseToByteStream):
2021-04-05 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity in CSSVariableData
https://bugs.webkit.org/show_bug.cgi?id=224164
Reviewed by Anders Carlsson.
Shrink m_tokens. This saves 2.7MB on youtube.com.
* css/CSSVariableData.cpp:
(WebCore::CSSVariableData::CSSVariableData):
2021-04-05 Wenson Hsieh <wenson_hsieh@apple.com>
REGRESSION: ASSERTION FAILED: settings().textAutosizingEnabled() && settings().textAutosizingUsesIdempotentMode() on various tests
https://bugs.webkit.org/show_bug.cgi?id=209450
<rdar://problem/60799255>
Reviewed by Tim Horton.
When running layout tests without idempotent text autosizing after layout tests with idempotent text autosizing
enabled, it's possible to get into a state where the text size adjustment timer (which is used to schedule
idempotent text autosizing style adjustments) is scheduled, but idempotent text autosizing is disabled before
the timer fires. This causes the assertion in `resetIdempotentTextAutosizingIfNeeded` to fail, leading to a
debug assertion.
To prevent this, we simply add a client method to call out to WebPage to stop its idempotent text autosizing
timer when the idempotent text autosizing WebCore setting changes to disabled.
This fixes assertions on these four tests, which are normally run after fast/text-autosizing:
- fast/text/control-characters/visible-control-characters-1.html
- fast/text/firstline/001.html
- fast/text-indicator/text-indicator-empty-link.html
- fast/text/basic/001.html
* page/ChromeClient.h:
(WebCore::ChromeClient::textAutosizingUsesIdempotentModeChanged):
Add the new chrome client hook (see WebKit2 change for more details).
* page/SettingsBase.cpp:
(WebCore::SettingsBase::textAutosizingUsesIdempotentModeChanged):
Replace the existing settings change handler (`setNeedsRecalcStyleInAllFrames`) with a custom change handler
(`textAutosizingUsesIdempotentModeChanged`) that invokes the client hook above, in addition to flagging all
frames for a style recalc.
* page/SettingsBase.h:
2021-04-05 Simon Fraser <simon.fraser@apple.com>
Shrink the Vector<> of keyframe values
https://bugs.webkit.org/show_bug.cgi?id=224154
Reviewed by Sam Weinig.
The Vector<double> returned by CSSParserImpl::consumeKeyframeKeyList()
wasted 152KB of vector capacity on nytimes.com pages, so shrink it.
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeKeyframeKeyList):
2021-04-05 Zalan Bujtas <zalan@apple.com>
No need to update the list marker number during internal move (e.g. result of anonymous collapsing)
https://bugs.webkit.org/show_bug.cgi?id=224142
<rdar://76101241>
Reviewed by Antti Koivisto.
Let's not update the marker numbers when the reason for re-parenting is "internal move"
which means the renderer's insertion point remains the same (e.g collapsing its anonymous parent).
* rendering/RenderElement.cpp:
(WebCore::RenderElement::insertedIntoTree):
(WebCore::RenderElement::willBeRemovedFromTree):
* rendering/RenderElement.h:
* rendering/RenderFragmentContainer.cpp:
(WebCore::RenderFragmentContainer::insertedIntoTree):
(WebCore::RenderFragmentContainer::willBeRemovedFromTree):
* rendering/RenderFragmentContainer.h:
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::insertedIntoTree):
(WebCore::RenderListItem::willBeRemovedFromTree):
* rendering/RenderListItem.h:
* rendering/RenderMultiColumnFlow.cpp:
(WebCore::RenderMultiColumnFlow::willBeRemovedFromTree):
* rendering/RenderMultiColumnFlow.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::insertedIntoTree):
(WebCore::RenderObject::willBeRemovedFromTree):
* rendering/RenderObject.h:
* rendering/RenderQuote.cpp:
(WebCore::RenderQuote::insertedIntoTree):
(WebCore::RenderQuote::willBeRemovedFromTree):
* rendering/RenderQuote.h:
* rendering/RenderTableCaption.cpp:
(WebCore::RenderTableCaption::insertedIntoTree):
(WebCore::RenderTableCaption::willBeRemovedFromTree):
* rendering/RenderTableCaption.h:
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::willBeRemovedFromTree):
* rendering/RenderTableCell.h:
* rendering/RenderTableCol.cpp:
(WebCore::RenderTableCol::insertedIntoTree):
(WebCore::RenderTableCol::willBeRemovedFromTree):
* rendering/RenderTableCol.h:
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::willBeRemovedFromTree):
* rendering/RenderTableRow.h:
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::willBeRemovedFromTree):
* rendering/RenderTableSection.h:
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::insertedIntoTree):
(WebCore::RenderSVGRoot::willBeRemovedFromTree):
* rendering/svg/RenderSVGRoot.h:
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::attachToRenderElementInternal):
(WebCore::RenderTreeBuilder::move):
(WebCore::RenderTreeBuilder::detachFromRenderElement):
* rendering/updating/RenderTreeBuilder.h:
2021-04-05 Alex Christensen <achristensen@webkit.org>
WebSocketChannel buffers use memory after going idle (64K wasted on facebook.com
https://bugs.webkit.org/show_bug.cgi?id=224193
Reviewed by Simon Fraser.
* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::processFrame):
2021-04-05 Chris Dumez <cdumez@apple.com>
Make sure the Frame always gets destroyed on the main thread
https://bugs.webkit.org/show_bug.cgi?id=224213
<rdar://75131946>
Reviewed by Alex Christensen.
Make sure the Frame always gets destroyed on the main thread.
Since http://trac.webkit.org/changeset/181791, Frame is ThreadSafeRefCounted and captured
on other threads. We should make sure the Frame is always destroyed on the main thread
though, since it is a main thread object and we hold WeakPtrs to it in many places.
* page/AbstractFrame.h:
2021-04-05 Simon Fraser <simon.fraser@apple.com>
Wasted vector capacity in FEColorMatrix and filters
https://bugs.webkit.org/show_bug.cgi?id=224169
Reviewed by Said Abou-Hallawa.
When building filter effects, avoid the inputEffects() having a larger
capacity than needed.
Shrink the Vector<float> which is input to FEColorMatrix.
This saves around 40KB on facebook.com feed pages.
* platform/graphics/filters/FEColorMatrix.cpp:
(WebCore::FEColorMatrix::FEColorMatrix):
(WebCore::FEColorMatrix::create):
* platform/graphics/filters/FEColorMatrix.h:
* rendering/CSSFilter.cpp:
(WebCore::CSSFilter::build):
(WebCore::endMatrixRow): Deleted.
(WebCore::lastMatrixRow): Deleted.
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::buildPrimitives const):
* svg/SVGFEColorMatrixElement.cpp:
(WebCore::SVGFEColorMatrixElement::build const):
* svg/SVGFEComponentTransferElement.cpp:
(WebCore::SVGFEComponentTransferElement::build const):
* svg/SVGFEConvolveMatrixElement.cpp:
(WebCore::SVGFEConvolveMatrixElement::build const):
* svg/SVGFEDiffuseLightingElement.cpp:
(WebCore::SVGFEDiffuseLightingElement::build const):
* svg/SVGFEDropShadowElement.cpp:
(WebCore::SVGFEDropShadowElement::build const):
* svg/SVGFEGaussianBlurElement.cpp:
(WebCore::SVGFEGaussianBlurElement::build const):
* svg/SVGFEMergeElement.cpp:
(WebCore::SVGFEMergeElement::build const):
* svg/SVGFEMorphologyElement.cpp:
(WebCore::SVGFEMorphologyElement::build const):
* svg/SVGFEOffsetElement.cpp:
(WebCore::SVGFEOffsetElement::build const):
* svg/SVGFESpecularLightingElement.cpp:
(WebCore::SVGFESpecularLightingElement::build const):
* svg/SVGFETileElement.cpp:
(WebCore::SVGFETileElement::build const):
2021-04-05 Saam Barati <sbarati@apple.com>
Enable QuotaExceededError on non GSTREAMER platforms
https://bugs.webkit.org/show_bug.cgi?id=224136
<rdar://71219720>
Reviewed by Jer Noble.
This fixes a memory leak in Disney+ where we end up queuing up the entire
video because we never communicate to the page that they should stop queuing
more data.
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::appendBufferInternal):
2021-04-05 Chris Dumez <cdumez@apple.com>
Make sure service workers use a ScriptSourceCode backed by file-mapped memory when possible
https://bugs.webkit.org/show_bug.cgi?id=224088
Reviewed by Yusuke Suzuki.
To run a worker, we were constructing a ScriptSourceCode from the source String and calling
JSC::evaluate. ScriptSourceCode would construct a JSC::StringSourceProvider, which would
keep the source String alive for the lifetime of the provider. This is problematic since
those worker scripts may be big and keeping heap-allocated version of them in memory is
expensive.
To address the issue, this patch introduces a new JSC::SourceProvider subclass named
ScriptBufferSourceProvider, which uses a ScriptBuffer internally. ScriptBuffer has the
benefit of being able to hold file-mapped data. We only convert the ScriptBuffer to
a String whenever necessary (When the script contains non-ascii characters and JSC
requests a StringView to the script). If we do end up converting the ScriptBuffer to
a String, this String will get cleared on memory pressure. This is similar to what
CachedScriptSourceProvider / CachedScript do on the main thread.
In the warm case, where the service worker script is coming from disk, we create
the ScriptBufferSourceProvider right away from a file-mapped ScriptBuffer, thus
greatly reducing dirty memory use. In the cold case, we initially construct the
ScriptBufferSourceProvider using a ScriptBuffer that is not file-mapped. However,
once the script is saved to disk (via SWScriptStorage), we replace the
ScriptBufferSourceProvider's ScriptBuffer with the new file-mapped version in
order to reduce dirty memory use in this case too.
* WebCore.xcodeproj/project.pbxproj:
Add ScriptBufferSourceProvider.h to the project.
* bindings/js/ScriptBufferSourceProvider.h: Added.
- Add new ScriptBufferSourceProvider, which is a JSC::SourceProvider subclass that
uses a ScriptBuffer as backing instead of a String. This allows us to use file-mapped
memory whenever possible, thus reducing dirty memory use. This provider provides
similar functionality to CachedScriptSourceProvider / CachedScript but works with
a ScriptBuffer and can be used off the main thread.
- We only transform the SharedBuffer into a String when strictly necessary, meaning
that the ScriptBuffer contains non-ascii characters and JSC is asking for a StringView
to the script.
- The class supports clearing the String copy of the script (done on memory pressure)
and replacing the ScriptBuffer (with a new file-mapped version).
* bindings/js/ScriptSourceCode.h:
(WebCore::ScriptSourceCode::ScriptSourceCode):
(WebCore::ScriptSourceCode::m_code):
(WebCore::ScriptSourceCode::provider):
Add new constructors taking a ScriptBuffer instead of a String for the source code.
We then use the new ScriptBufferSourceProvider internally instead of the
StringSourceProvider.
* workers/DedicatedWorkerThread.cpp:
(WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
* workers/DedicatedWorkerThread.h:
Use ScriptBuffer instead of String.
* workers/ScriptBuffer.cpp:
(WebCore::ScriptBuffer::empty):
(WebCore::ScriptBuffer::append):
(WebCore::operator!=):
* workers/ScriptBuffer.h:
(WebCore::ScriptBuffer::isEmpty const):
Add some functionality to SCriptBuffer to make it more convenient to use.
* workers/Worker.cpp:
(WebCore::Worker::notifyFinished):
Convert ScriptBuffer to a String since this is what WebInspector expects.
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::importScripts):
- When importing a new script, we now construct a ScriptSourceCode from a
ScriptBuffer instead of a String.
- We also store a weak pointer to the ScriptBufferSourceProvider used by the ScriptSourceCode
on the WorkerGlobalScope. This is so that we can ask those ScriptBufferSourceProvider objects
to clear their cached String representation of the script source on memory pressure. It is
also needed so we can replace the ScriptBufferSourceProvider's ScriptBuffer with a file-mapped
version when one becomes available.
(WebCore::WorkerGlobalScope::releaseMemory):
In addition to deleting JS code and doing garbage collection, we now also ask the
ScriptBufferSourceProvider objects to clear their cached String representation of the script
source.
(WebCore::WorkerGlobalScope::deleteJSCodeAndGC):
Moved the logic to delete JS code and doing GC from releaseMemory() to a new function, now
that releaseMemory() needs to do more things.
(WebCore::WorkerGlobalScope::setMainScriptSourceProvider):
(WebCore::WorkerGlobalScope::addImportedScriptSourceProvider):
Functions used to store the CachedScriptSourceProvider objects for the scripts used by the
worker on the WorkerGlobalScope. We keep weak pointers to those.
(WebCore::WorkerGlobalScope::clearDecodedScriptData):
Function used to ask the ScriptBufferSourceProvider objects to clear their cached String
representation of the script source on memory pressure.
(WebCore::WorkerGlobalScope::updateSourceProviderBuffers):
Function used to ask the ScriptBufferSourceProvider objects to replace their ScriptBuffers
with file-backed versions.
* workers/WorkerGlobalScope.h:
* workers/WorkerGlobalScopeProxy.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
* workers/WorkerMessagingProxy.h:
Use ScriptBuffer instead of String.
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::WorkerScriptLoader):
(WebCore::WorkerScriptLoader::loadSynchronously):
(WebCore::WorkerScriptLoader::didReceiveData):
* workers/WorkerScriptLoader.h:
(WebCore::WorkerScriptLoader::script):
Use ScriptBuffer instead of String to hold the script source. We eventually need a ScriptBuffer
since this is what the Worker now needs to launch. Also, in the service worker case, we may
get a ScriptBuffer right away from the scriptResourceMap, without going to the network at all.
* workers/WorkerThread.cpp:
(WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
(WebCore::WorkerThread::WorkerThread):
Use ScriptBuffer instead of String.
(WebCore::WorkerThread::evaluateScriptIfNecessary):
- When evaluating the main worker script, we now construct a ScriptSourceCode from a
ScriptBuffer instead of a String.
- We also store a weak pointer to the ScriptBufferSourceProvider used by the ScriptSourceCode
on the WorkerGlobalScope. This is so that we can ask those ScriptBufferSourceProvider objects
to clear their cached String representation of the script source on memory pressure. It is
also needed so we can replace the ScriptBufferSourceProvider's ScriptBuffer with a file-mapped
version when one becomes available.
* workers/WorkerThread.h:
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerFetchResult.h:
* workers/service/ServiceWorkerGlobalScope.cpp:
(WebCore::ServiceWorkerGlobalScope::didSaveScriptsToDisk):
* workers/service/ServiceWorkerJobClient.h:
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::ServiceWorkerThread):
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::updateWorker):
* workers/service/server/SWServer.h:
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::scriptFetchFinished):
Use ScriptBuffer instead of String.
2021-04-05 Fujii Hironori <Hironori.Fujii@sony.com>
[Win][WK2] Implement IPC::Semaphore to run WebGL in GPU process
https://bugs.webkit.org/show_bug.cgi?id=224014
Reviewed by Don Olmstead.
* platform/graphics/PlatformDisplay.cpp:
(WebCore::PlatformDisplay::sharedDisplay): GPU process calls this
function in IPC thread. Removed the assertion checking the main
thread.
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp:
(WebCore::GraphicsContextGLOpenGL::createForGPUProcess): Added.
2021-04-05 Cameron McCormack <heycam@apple.com>
Fix max-content on tables with percentage cell widths.
https://bugs.webkit.org/show_bug.cgi?id=221165
Reviewed by Zalan Bujtas.
When `width: max-content` is specified on an element, any percentages
on content inside the element that are relative to the containing block
width should be treated as auto. Percentages on table cells and columns
in tables using auto table layout are not quite relative to the
containing block width, but do have a similar influence. So when
computing the intrinsic width of a table for the purpose of determining
the max-content value to use, ignore any percentages specified on table
cells and columns.
This change makes us match Firefox and Chrome on the test case.
Test: fast/table/percent-width-max-content.html
* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::computeIntrinsicLogicalWidths):
* rendering/AutoTableLayout.h:
* rendering/FixedTableLayout.cpp:
(WebCore::FixedTableLayout::computeIntrinsicLogicalWidths):
* rendering/FixedTableLayout.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeIntrinsicLogicalWidthUsing const): Call
into the new computeIntrinsicKeywordLogicalWidths function so that
tables can return different values for layout and intrinsic keyword
calculation.
* rendering/RenderBox.h:
(WebCore::RenderBox::computeIntrinsicKeywordLogicalWidths const):
Added to support computing intrinsic keyword lengths that differ from
those returned by computeIntrinsicLogicalWidths.
* rendering/RenderTable.cpp:
(WebCore::RenderTable::computeIntrinsicLogicalWidths const): Factored
this out to allow specifying an argument for whether the intrinsics
being computed are for layout or for instrinsic keyword calculation,
like max-content.
(WebCore::RenderTable::computeIntrinsicKeywordLogicalWidths const):
Added. This is the only override of the default implementation in
RenderBox.
* rendering/RenderTable.h:
* rendering/TableLayout.h:
2021-04-05 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Simplify DisplayList::Iterator part 1: Require encoding/decoding delegates for non-inline display list items
https://bugs.webkit.org/show_bug.cgi?id=223849
Reviewed by Wenson Hsieh.
Requiring delegates for non-inline display list items has these advantages:
- DisplayList::Iterator::updateCurrentItem() only has 2 codepaths instead of 3.
- ItemBuffer::m_itemsToDestroyInAllocatedBuffers can be deleted entirely.
- The conditional inside ItemBuffer::append() can be simplified from
!T::isInlineItem && m_writingClient to just !T::isInlineItem, which I think makes the
function significantly more readable.
There are a few places where we were using non-inline display list items without a delegate:
This patch adds two new "null" delegates, and hooks them up to a subclass of DisplayList,
called InMemoryDisplayList. Clients who want to use in-memory display lists (like the
DrawGlyphs cache) can just use this class, and retain their calling pattern they were using
before. Also, this patch adds InMemoryDisplayList without adding any virtual functions to
DisplayList.
No new tests because there is no behavior change.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* html/HTMLCanvasElement.cpp:
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::displayListForTextRun const):
* platform/graphics/FontCascade.h:
(WebCore::FontCascade::displayListForTextRun):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::recursiveCommitChanges):
(WebCore::GraphicsLayerCA::platformCALayerPaintContents):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::iterator::updateCurrentItem):
* platform/graphics/displaylists/DisplayListDrawingContext.h:
(WebCore::DisplayList::DrawingContext::replayedDisplayList const):
* platform/graphics/displaylists/DisplayListImageBuffer.h:
(WebCore::DisplayList::ImageBuffer::ImageBuffer):
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::copyInto):
(WebCore::DisplayList::ItemBuffer::ItemBuffer):
(WebCore::DisplayList::ItemBuffer::operator=):
(WebCore::DisplayList::ItemBuffer::clear):
(WebCore::DisplayList::ItemBuffer::append):
(WebCore::DisplayList::m_allocatedBuffers): Deleted.
* platform/graphics/displaylists/DisplayListItemBuffer.h:
(WebCore::DisplayList::ItemHandle::get const):
(WebCore::DisplayList::ItemBufferWritingClient::~ItemBufferWritingClient):
(WebCore::DisplayList::ItemBufferWritingClient::createItemBuffer):
(WebCore::DisplayList::ItemBufferWritingClient::requiredSizeForItem const):
(WebCore::DisplayList::ItemBufferWritingClient::encodeItemOutOfLine const):
(WebCore::DisplayList::ItemBufferWritingClient::encodeItemInline const):
(WebCore::DisplayList::ItemBufferWritingClient::didAppendData):
(WebCore::DisplayList::ItemBuffer::append):
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::Replayer::replay):
* platform/graphics/displaylists/DisplayListReplayer.h:
* platform/graphics/displaylists/InMemoryDisplayList.cpp: Added.
(WebCore::DisplayList::InMemoryDisplayList::WritingClient::requiredSizeForItem const):
(WebCore::DisplayList::InMemoryDisplayList::WritingClient::encodeItemInline const):
(WebCore::DisplayList::InMemoryDisplayList::ReadingClient::decodeItem):
(WebCore::DisplayList::InMemoryDisplayList::InMemoryDisplayList):
(WebCore::DisplayList::InMemoryDisplayList::~InMemoryDisplayList):
* platform/graphics/displaylists/InMemoryDisplayList.h: Copied from Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.h.
* rendering/GlyphDisplayListCache.h:
2021-04-05 Jer Noble <jer.noble@apple.com>
[MediaSession] Small refactoring of MediaSession implementation classes
https://bugs.webkit.org/show_bug.cgi?id=224141
Reviewed by Eric Carlson.
A smorgasboard of small refactoring changes:
- Don't call action handlers by default in response to coordinator requests.
- Since we don't call the action handlers, we don't need the internal methods.
- Simplify the call site by defining the action details inline.
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::seekSessionToTime):
(WebCore::MediaSessionCoordinator::playSession):
(WebCore::MediaSessionCoordinator::pauseSession):
(WebCore::MediaSessionCoordinator::setSessionTrack):
(WebCore::MediaSessionCoordinator::internalSeekTo): Deleted.
(WebCore::MediaSessionCoordinator::internalPlay): Deleted.
(WebCore::MediaSessionCoordinator::internalPause): Deleted.
(WebCore::MediaSessionCoordinator::internalSetTrack): Deleted.
* Modules/mediasession/MediaSessionCoordinator.h:
* Modules/mediasession/MediaSessionCoordinatorPrivate.h:
2021-04-05 Yusuke Suzuki <ysuzuki@apple.com>
Define AtomString(ASCIILiteral) and use ASCIILiteral more to avoid memory allocation
https://bugs.webkit.org/show_bug.cgi?id=224125
Reviewed by Saam Barati.
We apply "..."_s more. This avoids allocating of string storage when creating StringImpl.
* accessibility/AccessibilityObject.cpp:
(WebCore::initializeRoleMap):
* dom/ScriptElement.cpp:
(WebCore::isLegacySupportedJavaScriptLanguage):
* editing/EditorCommand.cpp:
(WebCore::createCommandMap):
* html/Autofill.cpp:
(WebCore::fieldNameMap):
* platform/LegacySchemeRegistry.cpp:
(WebCore::builtinLocalURLSchemes):
(WebCore::builtinSecureSchemes):
(WebCore::builtinSchemesWithUniqueOrigins):
(WebCore::builtinEmptyDocumentSchemes):
(WebCore::builtinCanDisplayOnlyIfCanRequestSchemes):
(WebCore::builtinCORSEnabledSchemes):
* platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::systemPreviewMIMETypes):
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::hasValidAverageCharWidth const):
* platform/graphics/HEVCUtilities.cpp:
(WebCore::codecStringForDoViCodecType):
(WebCore::profileIDForAlphabeticDoViProfile):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::staticMIMETypeList):
* platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm:
(WebCore::AVAssetMIMETypeCache::staticContainerTypeList):
* platform/graphics/cg/ImageSourceCGWin.cpp:
(WebCore::preferredExtensionForImageType):
* svg/SVGTests.cpp:
(WebCore::supportedSVGFeatures):
2021-04-02 Ryosuke Niwa <rniwa@webkit.org>
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-04-02 Alexey Shvayka <shvaikalesh@gmail.com>
Remove [Replaceable] extended attribute from `document.all`
https://bugs.webkit.org/show_bug.cgi?id=223883
Reviewed by Darin Adler.
[Replaceable] semantics was introduced around 2003 to work around a web-compat issue.
Since then, `document.all` was revised multiple times and standardized as [[IsHTMLDDA]]
object without a setter, which was proven to be compatible with the web.
This patch aligns WebKit with the spec [1], Blink, and Gecko.
iOS apps are unlikely to accidentally depend on subtleties in `document.all` behavior since
they were authored long after it became obsolete.
Old versions of libraries, originally designed for the web, are also unlikely to rely on
previous behavior, because `document.all` was never replaceable in some popular browsers.
[1] https://html.spec.whatwg.org/multipage/obsolete.html#Document-partial
Tests: fast/dom/undetectable-document-all.html
imported/w3c/web-platform-tests/html/dom/idlharness.https.html
* dom/Document+HTMLObsolete.idl:
2021-04-02 Chris Dumez <cdumez@apple.com>
Introduce ScriptBuffer class to wrap SharedBuffer containing a script
https://bugs.webkit.org/show_bug.cgi?id=224092
Reviewed by Yusuke Suzuki and Geoff Garen.
Introduce ScriptBuffer class to wrap SharedBuffer containing a script. We started using SharedBuffer to represent
worker scripts instead of String, so that they can hold file mapped data and be shared across processes.
This patch introduces a new ScriptBuffer to wrap those SharedBuffers. The type makes it clearer what type of
data we're dealing with. The helper functions used to convert between String and SharedBuffer can now simply
be member functions on ScriptBuffer. This also simplifies IPC code.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
Add new ScriptBuffer class to project files.
* inspector/agents/worker/ServiceWorkerAgent.cpp:
(WebCore::ServiceWorkerAgent::getInitializationInfo):
Use ScriptBuffer::toString() instead of scriptBufferToString().
* workers/ScriptBuffer.cpp: Added.
(WebCore::ScriptBuffer::ScriptBuffer):
(WebCore::ScriptBuffer::toString const):
(WebCore::ScriptBuffer::containsSingleFileMappedSegment const):
(WebCore::operator==):
* workers/ScriptBuffer.h: Added.
(WebCore::ScriptBuffer::ScriptBuffer):
(WebCore::ScriptBuffer::buffer const):
(WebCore::ScriptBuffer::isolatedCopy const):
(WebCore::ScriptBuffer::operator bool const):
New ScriptBuffer class that wraps a SharedBuffer representation of a script.
This class helps make it clear what data we're dealing with. It also facilitates
conversion to and from a String when needed. The class also has its own IPC
coder at WebKit layer to encode the script as a ShareableResource when file
mapped.
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadSynchronously):
Use ScriptBuffer::toString() instead of scriptBufferToString().
And use StringBuffer constructor that takes a String instead of stringToScriptBuffer().
* workers/service/SWClientConnection.h:
* workers/service/ServiceWorkerContextData.cpp:
(WebCore::ServiceWorkerContextData::isolatedCopy const):
* workers/service/ServiceWorkerContextData.h:
(WebCore::ServiceWorkerContextData::ImportedScript::encode const):
(WebCore::ServiceWorkerContextData::ImportedScript::decode):
(WebCore::ServiceWorkerContextData::ImportedScript::isolatedCopy const):
(WebCore::ServiceWorkerContextData::encode const):
(WebCore::ServiceWorkerContextData::decode):
- Use ScriptBuffer instead of RefPtr<SharedBuffer> for scripts.
- Drop scriptBufferToString() & stringToScriptBuffer() as they are no longer needed.
- Move IPC coders for ServiceWorkerContextData back from WebCoreArgumentCoders back
to the WebCore class, now that the coders no longer need to deal with ShareableResource
directly. We now encode / decode ScriptBuffer objects and its coder takes care of
using a ShareableResource whenever possible.
* workers/service/ServiceWorkerGlobalScope.cpp:
(WebCore::ServiceWorkerGlobalScope::didSaveScriptsToDisk):
* workers/service/ServiceWorkerGlobalScope.h:
* workers/service/context/SWContextManager.cpp:
(WebCore::SWContextManager::didSaveScriptsToDisk):
* workers/service/context/SWContextManager.h:
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::ServiceWorkerThread):
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::didSaveScriptsToDisk):
* workers/service/context/ServiceWorkerThreadProxy.h:
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::doPushChanges):
(WebCore::RegistrationDatabase::importRecords):
* workers/service/server/RegistrationStore.cpp:
(WebCore::RegistrationStore::didSaveWorkerScriptsToDisk):
* workers/service/server/RegistrationStore.h:
* workers/service/server/SWScriptStorage.cpp:
(WebCore::SWScriptStorage::store):
(WebCore::SWScriptStorage::retrieve):
* workers/service/server/SWScriptStorage.h:
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::didSaveWorkerScriptsToDisk):
(WebCore::SWServer::updateWorker):
* workers/service/server/SWServer.h:
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::scriptFetchFinished):
* workers/service/server/SWServerToContextConnection.h:
* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::SWServerWorker):
(WebCore::SWServerWorker::didSaveScriptsToDisk):
* workers/service/server/SWServerWorker.h:
(WebCore::SWServerWorker::script const):
Use ScriptBuffer instead of SharedBuffer.
2021-04-02 Chris Dumez <cdumez@apple.com>
Unreviewed, reverting r275434.
Need to figure out a better strategy to chose the color
Reverted changeset:
"Make sure we are no longer show the previous page when
running a JS prompt"
https://bugs.webkit.org/show_bug.cgi?id=215782
https://commits.webkit.org/r275434
2021-04-02 Simon Fraser <simon.fraser@apple.com>
Allow wheel events to trigger high frequency DisplayLinks
https://bugs.webkit.org/show_bug.cgi?id=224095
Reviewed by Sam Weinig.
Adjust some logging so it's clear which process code is running in.
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::displayLinkFired):
* platform/graphics/DisplayRefreshMonitorManager.cpp:
(WebCore::DisplayRefreshMonitorManager::ensureMonitorForDisplayID):
2021-04-02 David Kilzer <ddkilzer@apple.com>
UBSan: AlternativeTextController::dismiss()/dismissSoon(): runtime error: load of value nnn, which is not a valid value for type 'bool'
<https://webkit.org/b/223903>
Reviewed by Wenson Hsieh.
Covered by 449 layout tests using WebKit compiled with UBSan.
* editing/AlternativeTextController.h:
- Initialize m_isActive and m_isDismissedByEditing.
2021-04-02 Chris Dumez <cdumez@apple.com>
Make sure we are no longer show the previous page when running a JS prompt
https://bugs.webkit.org/show_bug.cgi?id=215782
<rdar://problem/67698601>
Reviewed by Simon Fraser.
Add linked-on-after check for the behavior change to minimize the risk of
breakage.
* platform/cocoa/VersionChecks.h:
2021-04-02 Devin Rousso <drousso@apple.com>
[iPadOS] unable to reorder tabs on `*.mybinder.org`
https://bugs.webkit.org/show_bug.cgi?id=224034
<rdar://problem/51770057>
Reviewed by Brent Fulgham.
* page/Quirks.h:
* page/Quirks.cpp:
(WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
(WebCore::Quirks::shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented const):
(WebCore::Quirks::simulatedMouseEventTypeForTarget const):
Modify `Quirks::shouldDispatchSimulatedMouseEvents` to accept an `EventTarget` so that we
can limit dispatching touch events as mouse events on `*.mybinder.org` to only the tab bar.
* dom/EventNames.h:
(WebCore::EventNames::isTouchRelatedEventType const):
* dom/Node.cpp:
(WebCore::Node::moveNodeToNewDocument):
(WebCore::tryAddEventListener):
(WebCore::tryRemoveEventListener):
(WebCore::Node::defaultEventHandler):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::addEventListener):
(WebCore::DOMWindow::removeEventListener):
Pass in the `EventTarget` when calling `Quirks::shouldDispatchSimulatedMouseEvents`.
2021-04-02 Zalan Bujtas <zalan@apple.com>
[AspectRatio] Out-of-flow box with intrinsic width (e.g. <img>) may trigger infinite recursion
https://bugs.webkit.org/show_bug.cgi?id=224113
Reviewed by Rob Buis.
This covers the case when the out-of-flow box has intrinsic width (replaced box) and
the max-width is also set to "intrinsic" meaning content size dependent. In such cases
the aspect ratio computation ends up recursing around RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth.
This path checks if the out-of-flow box's horizontal size is also constrained by the intrinsic width.
Test: fast/replaced/infinite-recursion-with-intrinsic-width.html
* rendering/RenderBox.cpp:
(WebCore::shouldComputeLogicalWidthFromAspectRatioAndInsets):
2021-04-02 Chris Dumez <cdumez@apple.com>
Delete JS code and trigger garbage collection in worker threads on memory pressure
https://bugs.webkit.org/show_bug.cgi?id=224110
Reviewed by Geoffrey Garen.
Delete JS code and trigger garbage collection in worker threads on memory pressure,
to release as much memory as possible. We were previously only doing this in the
common (main thread) VM.
For the garbage collection logic, I tried to match what the GCController is doing
for the commonVM but apply it to worker VMs.
* page/MemoryRelease.cpp:
(WebCore::releaseCriticalMemory):
* workers/WorkerGlobalScope.cpp:
(WebCore::allWorkerGlobalScopeIdentifiers):
(WebCore::WorkerGlobalScope::WorkerGlobalScope):
(WebCore::WorkerGlobalScope::~WorkerGlobalScope):
(WebCore::WorkerGlobalScope::releaseMemory):
(WebCore::WorkerGlobalScope::releaseMemoryInWorkers):
* workers/WorkerGlobalScope.h:
2021-04-02 Aditya Keerthi <akeerthi@apple.com>
Do not paint native decorations for search fields without '-webkit-appearance: searchfield'
https://bugs.webkit.org/show_bug.cgi?id=223946
<rdar://problem/75621365>
Reviewed by Antti Koivisto.
On iOS, sites that use <input type="search"> have been observed to draw
their own icons next to the field. Since we draw our own icon for
search fields, this results in an unwanted icon on some sites, such as
on chanel.com. However, in this case, the site specifies
"-webkit-appearance: textfield" on the search input, indicating a desire
to remove the native search field appearance. To remove the unwanted
icon, we should not paint decorations for search fields without
"-webkit-appearance: searchfield".
To achieve this behavior, adjust the -webkit-appearance value on the
pseudo element containing the icon when the search field has a different
-webkit-appearance value, so that the native painting is elided. The
decision to not simply set "display: none" on the element was made so
that sites can still customize the decoration should they choose to do
so. Note that on macOS, Web Inspector paints their own search icon
using the pseudo element.
No new tests. A layout test is not possible since SearchFieldResultsButtonElement
is inaccessible through DOM APIs. A reference mismatch test is not
possible since changing the -webkit-appearance property on a search field
already results in visual changes. Existing tests were rebaselined to
account for the fact that the decoration is removed when changing
-webkit-appearance, so we do have test coverage.
* html/HTMLElement.h:
(WebCore::HTMLElement::isSearchFieldResultsButtonElement const):
* html/shadow/TextControlInnerElements.cpp:
(WebCore::SearchFieldResultsButtonElement::SearchFieldResultsButtonElement):
(WebCore::SearchFieldResultsButtonElement::resolveCustomStyle):
If the searchfield's appearance is not "searchfield", adjust the
appearance of the results button to NoControlPart. For compatibility
reasons, the adjustment is skipped if the author has specified the
results attribute on the searchfield. This is determined by checking
the maxResults of the input element.
If the adjustment needs to be performed, we elide standard style
adjustments from the theme by setting canAdjustStyleForAppearance to
false. Without this, the call to resolveStyle will apply native styles
to the element, since it does not know we are about to reset appearance.
* html/shadow/TextControlInnerElements.h:
(isType):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle):
(WebCore::RenderTheme::adjustSearchFieldDecorationStyle const):
Skip style adjustment and reset the appearance when necessary.
* rendering/RenderTheme.h:
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveElement):
Resolve all descendants if the appearance property of a search input is
changed. Without this change, the style of the results button is not
resolved when making a dynamic style change to the appearance of the
search input.
2021-04-02 Chris Fleizach <cfleizach@apple.com>
AX: textRectsFromMarkers always fails
https://bugs.webkit.org/show_bug.cgi?id=223556
<rdar://74256003>
Reviewed by Zalan Bujtas.
The textRectsFromMarkers:text: method is always failing to return a valid answer because when we try to extend
the search range of text to search, we're creating a range that can't be iterated with a CharacterIterator.
Test: accessibility/ios-simulator/text-rects-for-range-matches.html
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::rangeMatchesTextNearRange):
2021-04-02 Tyler Wilcock <twilco.o@protonmail.com>
Non-unified build fixes, early April 2021
https://bugs.webkit.org/show_bug.cgi?id=224091
Reviewed by Alex Christensen.
Non-unified build fixes, April 2021.
* bindings/scripts/CodeGeneratorJS.pm:
(AddToIncludesForIDLType):
For IDLs that have a property with a type of `undefined`, also add #include "JSDOMConvertBase.h" to
the generated binding source file. This fixes a build error in
DerivedSources/JSWebGLLoseContext.cpp that looked like:
WebCore/DerivedSources/JSWebGLLoseContext.cpp:147:78: error: expected primary-expression before > token
RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.loseContext(); })));
Thanks to Darin Adler for figuring this out.
To see the full error, go here: https://bugs.webkit.org/show_bug.cgi?id=223150#c14
* dom/EventContext.h:
* dom/FocusOptions.h:
* loader/ResourceLoadInfo.cpp:
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
* platform/network/soup/SoupNetworkSession.cpp:
* rendering/RenderLayerModelObject.cpp:
* style/Styleable.cpp:
* workers/service/server/SWScriptStorage.cpp:
* workers/service/server/SWScriptStorage.h:
* Modules/mediastream/RTCDataChannelRemoteSource.h:
Fix 'invalid use of incomplete type <TYPE>' or '<TYPE> does not name a type' errors.
* bindings/scripts/test/JS/JSTestCEReactions.cpp:
* bindings/scripts/test/JS/JSTestCallTracer.cpp:
* bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp:
* bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
* bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
* bindings/scripts/test/JS/JSTestConditionalIncludes.cpp:
* bindings/scripts/test/JS/JSTestDomainSecurity.cpp:
* bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestLegacyNoInterfaceObject.cpp:
* bindings/scripts/test/JS/JSTestMapLikeWithOverriddenOperations.cpp:
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeableProperties.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns.cpp:
* bindings/scripts/test/JS/JSTestNode.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestOperationConditional.cpp:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
* bindings/scripts/test/JS/JSTestSetLikeWithOverriddenOperations.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
* bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
Update bindings via `run-bindings-tests --reset-results` to add new "JSDOMConvertBase.h" include.
2021-04-02 Chris Lord <clord@igalia.com>
Implement text rendering on OffscreenCanvas in a Worker
https://bugs.webkit.org/show_bug.cgi?id=202793
Reviewed by Darin Adler.
Add a CSSFontSelector and FontCache to WorkerGlobalScope and via
interface changes to ScriptExecutionContext and FontSelector, use them
as appropriate after enabling text functions on Worker threads with
OffscreenCanvas.
No new tests, rebaselined existing tests.
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::CSSFontSelector):
(WebCore::m_version):
(WebCore::CSSFontSelector::~CSSFontSelector):
(WebCore::CSSFontSelector::fontRangesForFamily):
(WebCore::CSSFontSelector::fallbackFontAt):
* css/CSSFontSelector.h:
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::genericFontFamily):
(WebCore::CSSPropertyParserHelpers::genericFontFamilyIndex):
* css/parser/CSSPropertyParserHelpers.h:
* dom/Document.h:
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::fontCache):
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::cssFontSelector):
* dom/make_names.pl:
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::canDrawText):
* html/canvas/OffscreenCanvasRenderingContext2D.cpp:
(WebCore::OffscreenCanvasRenderingContext2D::setFont):
* platform/graphics/FontCache.cpp:
(WebCore::FontDataCacheKeyHash::hash):
(WebCore::FontDataCacheKeyHash::equal):
(WebCore::FontDataCacheKeyTraits::emptyValue):
(WebCore::FontDataCacheKeyTraits::constructDeletedValue):
(WebCore::FontDataCacheKeyTraits::isDeletedValue):
(WebCore::FontCache::create):
(WebCore::FontCache::singleton):
(WebCore::FontCache::FontCache):
(WebCore::FontCache::getCachedFontPlatformData):
(WebCore::FontCache::fontForPlatformData):
(WebCore::FontCache::purgeInactiveFontDataIfNeeded):
(WebCore::FontCache::purgeInactiveFontData):
(WebCore::FontCache::verticalData):
(WebCore::FontCache::fontCount):
(WebCore::FontCache::inactiveFontCount):
(WebCore::FontCache::invalidate):
* platform/graphics/FontCache.h:
(WebCore::FontCache::fontCacheFallbackToSingleton):
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::isCurrent const):
(WebCore::FontCascade::update const):
* platform/graphics/FontCascadeFonts.cpp:
(WebCore::FontCascadeFonts::FontCascadeFonts):
(WebCore::realizeNextFallback):
(WebCore::FontCascadeFonts::realizeFallbackRangesAt):
* platform/graphics/FontSelector.h:
* platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
(WebCore::FontCascade::fontForCombiningCharacterSequence const):
* platform/graphics/freetype/FontCacheFreeType.cpp:
(WebCore::getFamilyNameStringFromFamily):
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueFontFamily):
* style/StyleResolveForFontRaw.cpp:
(WebCore::Style::useFixedDefaultSize):
(WebCore::Style::resolveForFontRaw):
* style/StyleResolveForFontRaw.h:
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::~WorkerGlobalScope):
(WebCore::WorkerGlobalScope::cssFontSelector):
(WebCore::WorkerGlobalScope::fontCache):
* workers/WorkerGlobalScope.h:
2021-04-02 Youenn Fablet <youenn@apple.com>
No audio output when unplugged wired headset during a call
https://bugs.webkit.org/show_bug.cgi?id=216389
<rdar://problem/68692800>
Reviewed by Eric Carlson.
Implement shouldOverridePauseDuringRouteChange for media elements.
If it is a media stream backed video element, do not pause on active audio route change.
Implement internal API to write a layout test.
Refactoring to share more code between WebCore and WebKit and implement the internal API.
Improve isolation of MediaSessionHelper by moving all its members from protected to private.
Test: fast/mediastream/MediaStream-video-element-change-audio-route.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::shouldOverridePauseDuringRouteChange const):
* html/HTMLMediaElement.h:
* platform/audio/ios/MediaSessionHelperIOS.h:
(WebCore::MediaSessionHelper::MediaSessionHelper):
* platform/audio/ios/MediaSessionHelperIOS.mm:
(MediaSessionHelper::activeAudioRouteDidChange):
(MediaSessionHelper::applicationWillEnterForeground):
(MediaSessionHelper::applicationDidEnterBackground):
(MediaSessionHelper::applicationWillBecomeInactive):
(MediaSessionHelper::applicationDidBecomeActive):
(MediaSessionHelper::mediaServerConnectionDied):
(MediaSessionHelper::externalOutputDeviceAvailableDidChange):
(MediaSessionHelper::isPlayingToAutomotiveHeadUnitDidChange):
(MediaSessionHelper::activeVideoRouteDidChange):
(MediaSessionHelper::startMonitoringWirelessRoutes):
(MediaSessionHelper::stopMonitoringWirelessRoutes):
(MediaSessionHelperiOS::MediaSessionHelperiOS):
(MediaSessionHelperiOS::startMonitoringWirelessRoutesInternal):
(MediaSessionHelperiOS::stopMonitoringWirelessRoutesInternal):
(MediaSessionHelperiOS::mediaServerConnectionDied):
(MediaSessionHelperiOS::setIsPlayingToAutomotiveHeadUnit):
(MediaSessionHelperiOS::activeAudioRouteDidChange):
(MediaSessionHelperiOS::activeVideoRouteDidChange):
(MediaSessionHelperiOS::externalOutputDeviceAvailableDidChange):
(MediaSessionHelperiOS::startMonitoringWirelessRoutes): Deleted.
(MediaSessionHelperiOS::stopMonitoringWirelessRoutes): Deleted.
(MediaSessionHelperiOS::applicationDidBecomeActive): Deleted.
(MediaSessionHelperiOS::applicationDidEnterBackground): Deleted.
(MediaSessionHelperiOS::applicationWillBecomeInactive): Deleted.
(MediaSessionHelperiOS::applicationWillEnterForeground): Deleted.
* testing/Internals.cpp:
(WebCore::Internals::activeAudioRouteDidChange):
* testing/Internals.h:
* testing/Internals.idl:
2021-04-02 Youenn Fablet <youenn@apple.com>
Start observing outgoing audio/video sources asynchronously
https://bugs.webkit.org/show_bug.cgi?id=224040
Reviewed by Eric Carlson.
We delay sending media a little bit to guarantee that senders can be
assigned a transform synchronously at creation time.
This guarantees all sent media will go through the transform.
Difficult to test in practice as this would be very racy.
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
(WebCore::operator==):
(WebCore::LibWebRTCRtpSenderBackend::startSource):
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
2021-04-02 Rob Buis <rbuis@igalia.com>
Subpixel layout: Switch inlines' baseline positioning from int to LayoutUnit.
https://bugs.webkit.org/show_bug.cgi?id=133932
Reviewed by Zalan Bujtas.
This change converts the int returns type to LayoutUnit.
To match the old behavior, the implicit toInt() calls
have been replaced by explicit toInt() calls.
* rendering/GridBaselineAlignment.cpp:
(WebCore::GridBaselineAlignment::ascentForChild const):
* rendering/InlineBox.cpp:
(WebCore::InlineBox::baselinePosition const):
* rendering/InlineBox.h:
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::baselinePosition const):
* rendering/InlineTextBox.h:
* rendering/RenderAttachment.cpp:
(WebCore::RenderAttachment::baselinePosition const):
* rendering/RenderAttachment.h:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::baselinePosition const):
(WebCore::RenderBlock::firstLineBaseline const):
(WebCore::RenderBlock::inlineBlockBaseline const):
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::firstLineBaseline const):
(WebCore::RenderBlockFlow::inlineBlockBaseline const):
* rendering/RenderBlockFlow.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::baselinePosition const):
* rendering/RenderBox.h:
(WebCore::RenderBox::firstLineBaseline const):
(WebCore::RenderBox::inlineBlockBaseline const):
* rendering/RenderBoxModelObject.h:
* rendering/RenderButton.cpp:
(WebCore::RenderButton::baselinePosition const):
* rendering/RenderButton.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::synthesizedBaselineFromBorderBox):
(WebCore::RenderFlexibleBox::baselinePosition const):
(WebCore::RenderFlexibleBox::firstLineBaseline const):
(WebCore::RenderFlexibleBox::inlineBlockBaseline const):
* rendering/RenderFlexibleBox.h:
* rendering/RenderGrid.cpp:
(WebCore::synthesizedBaselineFromBorderBox):
(WebCore::RenderGrid::baselinePosition const):
(WebCore::RenderGrid::firstLineBaseline const):
(WebCore::RenderGrid::inlineBlockBaseline const):
* rendering/RenderGrid.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::baselinePosition const):
* rendering/RenderInline.h:
* rendering/RenderLineBreak.cpp:
(WebCore::RenderLineBreak::baselinePosition const):
* rendering/RenderLineBreak.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::baselinePosition const):
* rendering/RenderListBox.h:
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::baselinePosition const):
* rendering/RenderListMarker.h:
* rendering/RenderMenuList.h:
* rendering/RenderSlider.cpp:
(WebCore::RenderSlider::baselinePosition const):
* rendering/RenderSlider.h:
* rendering/RenderTable.cpp:
(WebCore::RenderTable::baselinePosition const):
(WebCore::RenderTable::inlineBlockBaseline const):
(WebCore::RenderTable::firstLineBaseline const):
* rendering/RenderTable.h:
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::firstLineBaseline const):
* rendering/RenderTableSection.h:
* rendering/RenderTextControl.h:
* rendering/RenderTextControlMultiLine.cpp:
(WebCore::RenderTextControlMultiLine::baselinePosition const):
* rendering/RenderTextControlMultiLine.h:
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::baselinePosition const):
* rendering/RootInlineBox.h:
* rendering/mathml/RenderMathMLBlock.cpp:
(WebCore::RenderMathMLBlock::baselinePosition const):
(WebCore::RenderMathMLTable::firstLineBaseline const):
* rendering/mathml/RenderMathMLBlock.h:
(WebCore::RenderMathMLBlock::ascentForChild):
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::firstLineBaseline const):
* rendering/mathml/RenderMathMLFraction.h:
* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::firstLineBaseline const):
* rendering/mathml/RenderMathMLOperator.h:
* rendering/mathml/RenderMathMLPadded.cpp:
(WebCore::RenderMathMLPadded::firstLineBaseline const):
* rendering/mathml/RenderMathMLPadded.h:
* rendering/mathml/RenderMathMLRow.cpp:
(WebCore::RenderMathMLRow::firstLineBaseline const):
* rendering/mathml/RenderMathMLRow.h:
* rendering/mathml/RenderMathMLScripts.cpp:
(WebCore::RenderMathMLScripts::firstLineBaseline const):
* rendering/mathml/RenderMathMLScripts.h:
* rendering/mathml/RenderMathMLSpace.cpp:
(WebCore::RenderMathMLSpace::firstLineBaseline const):
* rendering/mathml/RenderMathMLSpace.h:
* rendering/mathml/RenderMathMLToken.cpp:
(WebCore::RenderMathMLToken::firstLineBaseline const):
* rendering/mathml/RenderMathMLToken.h:
2021-04-02 Philippe Normand <pnormand@igalia.com>
REGRESSION(r268176): [GStreamer] media/video-orientation-canvas.html fails
https://bugs.webkit.org/show_bug.cgi?id=223850
Reviewed by Carlos Alberto Lopez Perez.
The GL pipeline used by the player is now able to handle image rotation tags itself. Manual
handling of the image rotation tags is now performed only when the pipeline is not able to
do it by itself.
* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(webKitGLVideoSinkConstructed):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
(WebCore::getVideoOrientation):
(WebCore::MediaPlayerPrivateGStreamer::updateVideoSizeAndOrientationFromCaps):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2021-04-01 Yusuke Suzuki <ysuzuki@apple.com>
[WTF] Introduce RobinHoodHashTable
https://bugs.webkit.org/show_bug.cgi?id=223895
Reviewed by Fil Pizlo.
* Modules/mediacapabilities/MediaCapabilities.cpp:
(WebCore::bucketMIMETypes):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::popupValue const):
* dom/Element.cpp:
(WebCore::canAttachAuthorShadowRoot):
* dom/QualifiedName.h:
* dom/make_names.pl:
(printNamesHeaderFile):
(printFactoryCppFile):
(printWrapperFactoryCppFile):
* editing/FormatBlockCommand.cpp:
(WebCore::isElementForFormatBlock):
* editing/RemoveFormatCommand.cpp:
(WebCore::isElementForRemoveFormatCommand):
* editing/ReplaceSelectionCommand.cpp:
(WebCore::isProhibitedParagraphChild):
* html/Autofill.cpp:
(WebCore::fieldNameMap):
* html/HTMLDocument.cpp:
(WebCore::HTMLDocument::isCaseSensitiveAttribute):
* html/HTMLObjectElement.cpp:
(WebCore::preventsParentObjectFromExposure):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::createCaseMap):
(WebCore::adjustSVGTagNameCase):
(WebCore::adjustAttributes):
(WebCore::createForeignAttributesMap):
(WebCore::adjustForeignAttributes):
(WebCore::addNamesWithPrefix): Deleted.
* page/DebugPageOverlays.cpp:
(WebCore::touchEventRegionColors):
(WebCore::NonFastScrollableRegionOverlay::drawRect):
* page/PerformanceUserTiming.cpp:
(WebCore::restrictedMarkNamesToNavigationTimingFunctionMap):
* platform/cocoa/MIMETypeRegistryCocoa.mm:
(WebCore::extensionsForMIMETypeMap):
* platform/graphics/FontCascade.cpp:
(WebCore::useBackslashAsYenSignForFamily):
(WebCore::FontCascade::hasValidAverageCharWidth const):
* platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
(WebCore::validInitDataTypes):
* platform/graphics/cg/UTIRegistry.cpp:
(WebCore::defaultSupportedImageTypes):
* platform/graphics/cg/UTIRegistry.h:
* platform/graphics/cocoa/HEVCUtilitiesCocoa.mm:
(WebCore::codecTypeForDoViCodecString):
* platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::SourceBufferParserWebM::supportedVideoCodecs):
(WebCore::SourceBufferParserWebM::supportedAudioCodecs):
* platform/graphics/cocoa/SourceBufferParserWebM.h:
* rendering/svg/SVGResources.cpp:
(WebCore::clipperFilterMaskerTags):
(WebCore::markerTags):
(WebCore::fillAndStrokeTags):
(WebCore::chainableResourceTags):
* style/StyleAdjuster.cpp:
(WebCore::Style::hasEffectiveDisplayNoneForDisplayContents):
* svg/SVGAnimationElement.cpp:
(WebCore::SVGAnimationElement::isSupportedAttribute):
* svg/SVGElement.cpp:
(WebCore::createAttributeNameToCSSPropertyIDMap):
(WebCore::SVGElement::animatableAttributeForName):
(WebCore::SVGElement::cssPropertyIdForSVGAttributeName):
* svg/SVGTests.cpp:
(WebCore::SVGTests::addSupportedAttributes):
* svg/SVGTests.h:
* svg/SVGUseElement.cpp:
(WebCore::createAllowedElementSet):
(WebCore::isDisallowedElement):
* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::isSupportedAttribute):
* xml/XPathFunctions.cpp:
(WebCore::XPath::createFunctionMap):
* xml/XPathParser.cpp:
(WebCore::XPath::createAxisNamesMap):
2021-04-02 Youenn Fablet <youenn@apple.com>
Bail out early if encoded frame is written twice
https://bugs.webkit.org/show_bug.cgi?id=224041
Reviewed by Eric Carlson.
Test: http/wpt/webrtc/write-twice-transform.html
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.cpp:
(WebCore::LibWebRTCRtpTransformBackend::processTransformedFrame):
In case the frame is written twice, the second write is considered as a no-op.
2021-04-01 Cameron McCormack <heycam@apple.com>
Remove redundant #if in RuntimeApplicationChecks.h.
https://bugs.webkit.org/show_bug.cgi?id=224037
Reviewed by Alexey Proskuryakov.
* platform/RuntimeApplicationChecks.h:
2021-04-01 Zalan Bujtas <zalan@apple.com>
Expand on shouldComputeLogicalWidthFromAspectRatioAndInsets return logic
https://bugs.webkit.org/show_bug.cgi?id=224057
Reviewed by Rob Buis.
In this patch we also start checking against logicalWidth/height instead of just width/height.
* rendering/RenderBox.cpp:
(WebCore::shouldComputeLogicalWidthFromAspectRatioAndInsets):
(WebCore::RenderBox::shouldComputeLogicalHeightFromAspectRatio const):
(WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatio const):
(WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatioAndInsets const): Deleted.
* rendering/RenderBox.h:
2021-04-01 Alex Christensen <achristensen@webkit.org>
REGRESSION(r272469) QuickLook previews broken in some places on macOS
https://bugs.webkit.org/show_bug.cgi?id=224086
Reviewed by Tim Horton.
The linked-on-or-after check saves us from most compatibility problems, but QuickLook on macOS was broken.
It uses schemes x-apple-ql-id and x-apple-ql-magic, which we allow to continue to have non-null origins.
Covered by API tests.
* page/SecurityOrigin.cpp:
(WebCore::shouldTreatAsUniqueOrigin):
2021-04-01 Alex Christensen <achristensen@webkit.org>
Add more deprecation macros.
I missed one in r275298
* platform/network/cocoa/CertificateInfoCocoa.mm:
(WebCore::CertificateInfo::dump const):
2021-04-01 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r274381.
https://bugs.webkit.org/show_bug.cgi?id=224080
Caused stuttery select scrolling
Reverted changeset:
"Add basic (non-momentum) wheel event handling for scroll
snap"
https://bugs.webkit.org/show_bug.cgi?id=222594
https://trac.webkit.org/changeset/274381
2021-04-01 Rob Buis <rbuis@igalia.com>
aspect-ratio not recomputed on hover
https://bugs.webkit.org/show_bug.cgi?id=224028
Reviewed by Zalan Bujtas.
Detect change in aspect-ratio on hover.
Test: imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-dynamic-aspect-ratio.html
* rendering/style/RenderStyle.cpp:
(WebCore::rareNonInheritedDataChangeRequiresLayout):
2021-04-01 Chris Dumez <cdumez@apple.com>
Have the ServiceWorker process hold on to a file mapped version of the service worker scripts to save dirty memory
https://bugs.webkit.org/show_bug.cgi?id=224015
<rdar://75637679>
Reviewed by Geoffrey Garen.
Since r275267, the Network process holds on the file mapped (mmap'd) versions of the service worker
scripts instead of heap allocated versions, in order to decrease its dirty memory use. However, the
ServiceWorker process (which is often a regular WebProcess) was still using heap allocated service
worker scripts. This patch is a follow-up to make sure the NetworkProcess sends its file mapped
scripts to the ServiceWorker processes as ShareableResource handles in order to decrease the dirty
memory usage of the ServiceWorker processes as well.
No new tests, no Web-facing behavior change, just a decrease in dirty memory use in the ServiceWorker
processes (which may be WebProcesses). I have done local testing with a very large service worker
that uses a ~100MB main script, which imports another ~100MB sub-script. With my change, dirty
memory usage goes from ~440MB to ~230MB in both the cold and warm cases ("Cold" meaning that the
service worker was just registed and downloaded from the network and "Warm" meaning that the
service worker had been previously registed and was loaded straight from the SWScriptStorage).
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::hasOneSegment const):
Add a utility function to SharedBuffer to check if it contains a single data segment.
(WebCore::SharedBuffer::DataSegment::containsMappedFileData const):
Add a utility function to check if a SharedBuffer DataSegment contains a MappedFileData object.
* platform/SharedBuffer.h:
* workers/service/ServiceWorkerContextData.h:
(WebCore::ServiceWorkerContextData::ImportedScript::isolatedCopy const):
Move IPC encoders / decoders for ServiceWorkerContextData and ServiceWorkerContextData::ImportedScript
to the WebKit layer, in WebCoreArgumentCoders. This allows us to encode / decode the scripts as
WebKit::ShareableHandle whenever possible. This way, when the NetworkProcess sends a
ServiceWorkerContextData to the ServiceWorker process to launch a service worker, both the
ServiceWorker process and the Network process share the same mmap'd versions of the scripts and we
save on dirty memory use. This helps reduce dirty memory use in the ServiceWorker process in the
warm case, where the scripts are loaded straight from the disk (via SWScriptStorage).
* workers/service/ServiceWorkerGlobalScope.cpp:
(WebCore::ServiceWorkerGlobalScope::didSaveScriptsToDisk):
* workers/service/ServiceWorkerGlobalScope.h:
* workers/service/context/SWContextManager.cpp:
(WebCore::SWContextManager::didSaveScriptsToDisk):
* workers/service/context/SWContextManager.h:
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::didSaveScriptsToDisk):
* workers/service/context/ServiceWorkerThreadProxy.h:
* workers/service/server/SWServerToContextConnection.h:
* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::didSaveScriptsToDisk):
In the cold case, once the NetworkProcess is done saving the scripts to disk, it now sends the
file mapped version of the scripts to the ServiceWorker process, so that it can also replace
its heap-allocated copies and save on dirty memory use.
2021-04-01 Fujii Hironori <Hironori.Fujii@sony.com>
[WebGL] Use GraphicsContextGLOpenGLManager for ports using TextureMapper
https://bugs.webkit.org/show_bug.cgi?id=224035
Reviewed by Don Olmstead.
Use GraphicsContextGLOpenGLManager for GTK, WPE and WinCairo ports
to reduce duplicated code.
GraphicsContextGLOpenGLBase.cpp isn't used by Cocoa ports.
No behavior change.
* PlatformMac.cmake:
* Sources.txt:
* SourcesCocoa.txt:
* platform/graphics/opengl/GraphicsContextGLOpenGLManager.h:
* platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp:
(WebCore::GraphicsContextGLOpenGL::create):
(WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):
(WebCore::activeContexts): Deleted.
2021-04-01 Chris Lord <clord@igalia.com>
Make FontCache constructable and safe to use off the main thread
https://bugs.webkit.org/show_bug.cgi?id=223997
Reviewed by Darin Adler.
So that we can have a separate FontCache for use with OffscreenCanvas
on Worker threads, make FontCache constructable/destructable and
ref-counted.
This also changes some functions so that they no longer rely on static
AtomString variables, as these paths would not be safe to use off the
main thread, and changes main-thread checks to creation-thread checks.
No new tests, no change in behavior.
* platform/graphics/FontCache.cpp:
(WebCore::FontCache::alternateFamilyName):
(WebCore::FontCache::getCachedFontPlatformData):
(WebCore::FontCache::fontForFamily):
(WebCore::FontCache::similarFont):
* platform/graphics/FontCache.h:
(WebCore::FontCache::fontForFamily):
(WebCore::FontCache::getCachedFontPlatformData):
* platform/graphics/FontCascadeFonts.cpp:
(WebCore::FontCascadeFonts::FontCascadeFonts):
(WebCore::FontCascadeFonts::glyphDataForCharacter):
* platform/graphics/FontCascadeFonts.h:
(WebCore::FontCascadeFonts::primaryFont):
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontCache::similarFont):
(WebCore::FontCache::platformAlternateFamilyName):
* platform/graphics/freetype/FontCacheFreeType.cpp:
(WebCore::FontCache::lastResortFallbackFont):
(WebCore::getFamilyNameStringFromFamily):
(WebCore::FontCache::platformAlternateFamilyName):
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::FontCache::fontFromDescriptionAndLogFont):
(WebCore::FontCache::lastResortFallbackFont):
(WebCore::FontCache::platformAlternateFamilyName):
2021-04-01 Mark Lam <mark.lam@apple.com>
Fix some missing exception checks in HTMLMediaElement methods.
https://bugs.webkit.org/show_bug.cgi?id=224038
rdar://69573092
Reviewed by Eric Carlson.
Test: media/missing-exception-checks-in-HTMLMediaElement-methods.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setupAndCallJS):
(WebCore::HTMLMediaElement::updateCaptionContainer):
(WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
(WebCore::HTMLMediaElement::setControllerJSProperty):
(WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
(WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
(WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):
2021-04-01 Jean-Yves Avenard <jya@apple.com>
Previous artwork isn't cleared when NowPlaying info doesn't contain an artwork
https://bugs.webkit.org/show_bug.cgi?id=224031
<rdar://76044544>
Reviewed by Youenn Fablet.
Manually tested, no framework available to test such change.
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::setNowPlayingInfo): use MRMediaRemoteSetNowPlayingInfoWithMergePolicy instead.
* platform/mac/MediaRemoteSoftLink.h: Soft link MRMediaRemoteSetNowPlayingInfoWithMergePolicy
* platform/mac/MediaRemoteSoftLink.mm:
2021-04-01 Jean-Yves Avenard <jya@apple.com>
Now Playing artwork doesn't update when changed.
https://bugs.webkit.org/show_bug.cgi?id=223731
<rdar://problem/75823923>
Now Playing and Media Remote requires a unique identifier for the currently playing item.
If the same identifier is provided for every call to MRMediaRemoteSetNowPlayingInfo,
then some updates may be skipped.
In earlier changes, the MediaSessionElement identifier was combined with the Media Element
identifier which broke Now Playing as the MediaSession identifier never changes for the
lifetime of the web content process.
So we create a new method HTMLMediaElement::mediaUniqueIdentifier with a new MediaUniqueIdentifier
that willthat will be updated whenever the source of a media element changes and stop
using the MediaSession identifier when dealing with Now Playing.
Reviewed by Eric Carlson.
Manually tested, no framework available to test such change.
* WebCore.xcodeproj/project.pbxproj: Add MediaUniqueIdentifier.h
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::prepareForLoad): Use setCurrentSrc instead of directly modifying m_currentSrc.
(WebCore::HTMLMediaElement::selectMediaResource): Use setCurrentSrc instead of directly modifying m_currentSrc.
(WebCore::HTMLMediaElement::loadResource): Use setCurrentSrc instead of directly modifying m_currentSrc.
(WebCore::HTMLMediaElement::setCurrentSrc): Add convenience method, generate new MediaUniqueIdentifier each time m_currentSrc is modified.
(WebCore::HTMLMediaElement::mediaUniqueIdentifier const): Return unique media identifier.
(WebCore::HTMLMediaElement::mediaSessionUniqueIdentifier const): Deleted.
* html/HTMLMediaElement.h:
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::nowPlayingInfo const):
* platform/audio/NowPlayingInfo.h: Use MediaUniqueIdentifier for uniqueIdentifier member.
(WebCore::NowPlayingInfo::decode):
* platform/audio/PlatformMediaSessionManager.h: Use MediaUniqueIdentifier instead.
(WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingInfoUniqueIdentifier const):
set kMRMediaRemoteNowPlayingInfoArtworkIdentifier in CFDictionary to the source of the artwork.
Workaround a bug in Media Controller component.
* platform/audio/cocoa/MediaSessionManagerCocoa.h:
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::setNowPlayingInfo):
* platform/mac/MediaRemoteSoftLink.h: Soft-link kMRMediaRemoteNowPlayingInfoArtworkIdentifier symbol.
* platform/mac/MediaRemoteSoftLink.mm:
* testing/Internals.h: Add missing header.
2021-04-01 Devin Rousso <drousso@apple.com>
Limit the number of buttons shown in media controls
https://bugs.webkit.org/show_bug.cgi?id=223909
Reviewed by Eric Carlson.
When in fullscreen, it's possible to have five different buttons to the right of "Play":
- AirPlay
- Enter Picture in Picture
- Audio/Languages
- Exit Full Screen
- More...
This turns the UI into something of an "icon soup" and should really be avoided, especially
now that `OverflowButton` allows for a single button to have multiple actions (via a native
contextmenu). This matches AVKit behavior.
Tests: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-dropping-controls.html:
media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles.html:
media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-styles.html:
media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-constructor.html:
media/modern-media-controls/macos-inline-media-controls/macos-inline-media-dropping-controls.html:
* Modules/modern-media-controls/controls/inline-media-controls.js:
(InlineMediaControls.prototype.layout):
(InlineMediaControls.prototype._droppableButtons):
(InlineMediaControls.prototype._collapsableButtons): Added.
* Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
(MacOSFullscreenMediaControls):
(MacOSFullscreenMediaControls.prototype.layout):
(MacOSFullscreenMediaControls.prototype._collapsableButtons): Added.
Limit the number of `visible` buttons in `rightContainer.children` by iteratively marking
`dropped = true` on buttons that are also in `_collapsableButtons` until either there are
no iterations left (`i < 0`) or the number of visible buttons is below the maximum (2 for
inline and 3 for fullscreen).
* Modules/modern-media-controls/controls/pip-button.js:
(PiPButton.prototype.get contextMenuOptions): Added.
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::showMediaControlsContextMenu):
Add support for `includePictureInPicture` to the native contextmenu.
* en.lproj/Localizable.strings:
* testing/Internals.idl:
* testing/Internals.h:
* testing/Internals.cpp:
(WebCore::Internals::setMediaControlsMaximumRightContainerButtonCountOverride): Added.
* html/HTMLMediaElement.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setMediaControlsMaximumRightContainerButtonCountOverride): Added.
* Modules/modern-media-controls/media/media-controller.js:
(MediaController.prototype.set maximumRightContainerButtonCountOverride): Added.
Add a way to override the default maximum right container button count for testing. This is
useful for testing the functionality of a specific button when not in the collapsed state,
allowing for tests to not have to worry about other state that may affect collapsing (e.g.
the AirPlay button is shown when there are AirPlay targets).
2021-04-01 Zalan Bujtas <zalan@apple.com>
Cleanup shouldComputeLogicalWidthFromAspectRatio and shouldComputeLogicalWidthFromAspectRatioAndInsets
https://bugs.webkit.org/show_bug.cgi?id=224044
Reviewed by Antti Koivisto.
Let's use "return foo()" (or "return !foo()") instead of
if (!foo())
return true;
return false;
* rendering/RenderBox.cpp:
(WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatio const):
(WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatioAndInsets const):
2021-04-01 Aditya Keerthi <akeerthi@apple.com>
[iOS] '-webkit-appearance: none' is not respected for searchfield decorations
https://bugs.webkit.org/show_bug.cgi?id=224018
Reviewed by Antti Koivisto.
Specifying '-webkit-appearance: none' on a searchfield decoration
pseudo-element fails to hide the native icon. This issue arises from
the fact that we add the icon in the UA stylesheet, rather than painting
it in the theme.
To fix, remove the styles from the UA stylesheet, and paint the icon in
RenderThemeIOS. If a different '-webkit-appearance' is specified the
theme will not adjust styles or paint the icon.
Test: fast/forms/ios/form-control-refresh/search/search-decoration-appearance.html
* css/html.css:
Remove the UA styles for searchfield decorations so that they are not
applied when specifying a different -webkit-appearance.
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::adjustSearchFieldDecorationPartStyle const):
Adjust the style to match the native appearance.
(WebCore::RenderThemeIOS::paintSearchFieldDecorationPart):
Paint the native icon.
(WebCore::RenderThemeIOS::adjustSearchFieldResultsDecorationPartStyle const):
(WebCore::RenderThemeIOS::paintSearchFieldResultsDecorationPart):
(WebCore::RenderThemeIOS::adjustSearchFieldResultsButtonStyle const):
(WebCore::RenderThemeIOS::paintSearchFieldResultsButton):
2021-04-01 Martin Robinson <mrobinson@igalia.com>
Expose an alias for ScrollSnapOffsetInfo<T> to make it easier to use
https://bugs.webkit.org/show_bug.cgi?id=223986
Reviewed by Sergio Villar Senin.
No new tests. This should not change behavior.
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::setStateScrollingNodeSnapOffsetsAsFloat): Use new aliases.
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::FloatScrollSnapOffsetsInfo::convertUnits const): Ditto.
(WebCore::LayoutScrollSnapOffsetsInfo::convertUnits const): Ditto.
(WebCore::LayoutScrollSnapOffsetsInfo::closestSnapOffset const): Ditto.
(WebCore::FloatScrollSnapOffsetsInfo::closestSnapOffset const): Ditto.
(WebCore::ScrollSnapOffsetsInfo<float>::convertUnits const): Deleted.
(WebCore::ScrollSnapOffsetsInfo<LayoutUnit>::convertUnits const): Deleted.
(WebCore::ScrollSnapOffsetsInfo<LayoutUnit>::closestSnapOffset const): Deleted.
(WebCore::ScrollSnapOffsetsInfo<float>::closestSnapOffset const): Deleted.
* page/scrolling/ScrollSnapOffsetsInfo.h: Ditto.
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::setSnapOffsetsInfo): Ditto.
* page/scrolling/ScrollingStateScrollingNode.h:
(WebCore::ScrollingStateScrollingNode::snapOffsetsInfo const): Ditto.
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::snapOffsetsInfo const): Ditto.
* page/scrolling/ScrollingTreeScrollingNode.h: Ditto.
* platform/ScrollController.cpp:
(WebCore::ScrollController::updateScrollSnapPoints): Ditto.
* platform/ScrollController.h: Ditto.
* platform/ScrollSnapAnimatorState.h:
(WebCore::ScrollSnapAnimatorState::snapOffsetInfo const): Ditto.
(WebCore::ScrollSnapAnimatorState::setSnapOffsetInfo): Ditto.
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::ensureSnapOffsetsInfo): Ditto.
(WebCore::ScrollableArea::snapOffsetInfo const): Ditto.
(WebCore::ScrollableArea::setScrollSnapOffsetInfo): Ditto.
* platform/ScrollableArea.h: Ditto.
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::gestureShouldBeginSnap): Ditto.
2021-04-01 Rob Buis <rbuis@igalia.com>
Use Element for checking Settings in CSSComputedStyleDeclaration
https://bugs.webkit.org/show_bug.cgi?id=223598
Reviewed by Darin Adler.
Use Element for checking Settings in CSSComputedStyleDeclaration.
Right now renderer is used but this will not work for non-rendered elements.
Tests: fast/css/rotate-invalidate-if-disabled.html
fast/css/scale-invalidate-if-disabled.html
fast/css/translate-invalidate-if-disabled.html
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
2021-04-01 Youenn Fablet <youenn@apple.com>
Add some logging to RTCRtpSender and RTCRtpReceiver
https://bugs.webkit.org/show_bug.cgi?id=223991
Reviewed by Eric Carlson.
Add some logging around transforms.
No change of behavior.
* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
* Modules/mediastream/RTCRtpReceiver.cpp:
(WebCore::RTCRtpReceiver::RTCRtpReceiver):
(WebCore::RTCRtpReceiver::setTransform):
(WebCore::RTCRtpReceiver::logChannel const):
* Modules/mediastream/RTCRtpReceiver.h:
* Modules/mediastream/RTCRtpReceiver.idl:
* Modules/mediastream/RTCRtpSender.cpp:
(WebCore::RTCRtpSender::RTCRtpSender):
(WebCore::RTCRtpSender::setTransform):
(WebCore::RTCRtpSender::logChannel const):
* Modules/mediastream/RTCRtpSender.h:
* Modules/mediastream/RTCRtpSender.idl:
2021-03-31 Antoine Quint <graouts@webkit.org>
Move AnimationTimeline methods related to Styleable to Styleable
https://bugs.webkit.org/show_bug.cgi?id=224012
Reviewed by Dean Jackson.
A number of public methods on AnimationTimeline make no use of any AnimationTimeline instance
variables and instead call into Styleable:
void elementWasRemoved(const Styleable&);
void willChangeRendererForStyleable(const Styleable&);
void cancelDeclarativeAnimationsForStyleable(const Styleable&);
void animationWasAddedToStyleable(WebAnimation&, const Styleable&);
void animationWasRemovedFromStyleable(WebAnimation&, const Styleable&);
void removeDeclarativeAnimationFromListsForOwningElement(WebAnimation&, const Styleable&);
void updateCSSAnimationsForStyleable(const Styleable&, const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle, const RenderStyle* parentElementStyle);
void updateCSSTransitionsForStyleable(const Styleable&, const RenderStyle& currentStyle, const RenderStyle& newStyle);
These really belong on Styleable so we move them all over to that class with a new .cpp class
for these non-trivial methods.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* animation/AnimationTimeline.cpp:
(WebCore::AnimationTimeline::removeAnimation):
(WebCore::AnimationTimeline::animationWasAddedToStyleable): Deleted.
(WebCore::removeCSSTransitionFromMap): Deleted.
(WebCore::AnimationTimeline::animationWasRemovedFromStyleable): Deleted.
(WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement): Deleted.
(WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup): Deleted.
(WebCore::AnimationTimeline::elementWasRemoved): Deleted.
(WebCore::AnimationTimeline::willChangeRendererForStyleable): Deleted.
(WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable): Deleted.
(WebCore::shouldConsiderAnimation): Deleted.
(WebCore::AnimationTimeline::updateCSSAnimationsForStyleable): Deleted.
(WebCore::keyframeEffectForElementAndProperty): Deleted.
(WebCore::propertyInStyleMatchesValueForTransitionInMap): Deleted.
(WebCore::transitionCombinedDuration): Deleted.
(WebCore::transitionMatchesProperty): Deleted.
(WebCore::compileTransitionPropertiesInStyle): Deleted.
(WebCore::AnimationTimeline::updateCSSTransitionsForStyleableAndProperty): Deleted.
(WebCore::AnimationTimeline::updateCSSTransitionsForStyleable): Deleted.
* animation/AnimationTimeline.h:
* animation/DeclarativeAnimation.cpp:
(WebCore::DeclarativeAnimation::disassociateFromOwningElement):
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::setEffectInternal):
(WebCore::WebAnimation::setTimeline):
(WebCore::WebAnimation::effectTargetDidChange):
(WebCore::WebAnimation::persist):
* dom/Element.cpp:
(WebCore::Element::removedFromAncestor):
* dom/PseudoElement.cpp:
(WebCore::PseudoElement::clearHostElement):
* rendering/updating/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::tearDownRenderers):
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::createAnimatedElementUpdate):
* style/Styleable.cpp: Copied from Source/WebCore/animation/AnimationTimeline.cpp.
(WebCore::Styleable::animationWasAdded const):
(WebCore::removeCSSTransitionFromMap):
(WebCore::Styleable::removeDeclarativeAnimationFromListsForOwningElement const):
(WebCore::Styleable::animationWasRemoved const):
(WebCore::removeCSSAnimationCreatedByMarkup):
(WebCore::Styleable::elementWasRemoved const):
(WebCore::Styleable::willChangeRenderer const):
(WebCore::Styleable::cancelDeclarativeAnimations const):
(WebCore::shouldConsiderAnimation):
(WebCore::Styleable::updateCSSAnimations const):
(WebCore::keyframeEffectForElementAndProperty):
(WebCore::propertyInStyleMatchesValueForTransitionInMap):
(WebCore::transitionCombinedDuration):
(WebCore::transitionMatchesProperty):
(WebCore::compileTransitionPropertiesInStyle):
(WebCore::updateCSSTransitionsForStyleableAndProperty):
(WebCore::Styleable::updateCSSTransitions const):
* style/Styleable.h:
2021-03-31 Simon Fraser <simon.fraser@apple.com>
Feed preferred frames per second back to the UI process for each DisplayRefreshMonitor
https://bugs.webkit.org/show_bug.cgi?id=224023
Reviewed by Sam Weinig.
DisplayRefreshMonitors should be responsive to the frame rate demands of their clients,
so move from a model where DisplayRefreshMonitor has setPreferredFramesPerSecond()
to one where it computes maxClientPreferredFramesPerSecond().
DisplayRefreshMonitor needs to recompute maxClientPreferredFramesPerSecond when clients
are added, removed, or when the preferred frame rate of a client changes.
For now, just one of the DisplayRefreshMonitor implementations responds to adjustPreferredFramesPerSecond:
DisplayRefreshMonitorMac sends IPC to the UI process, which DisplayLink can use on a per-connection
basis to throttle the frequency of display updates sent to that process (which is important
for power).
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::addClient):
(WebCore::DisplayRefreshMonitor::removeClient):
(WebCore::DisplayRefreshMonitor::maximumClientPreferredFramesPerSecond const):
(WebCore::DisplayRefreshMonitor::computeMaxPreferredFramesPerSecond):
(WebCore::DisplayRefreshMonitor::clientPreferredFramesPerSecondChanged):
* platform/graphics/DisplayRefreshMonitor.h:
(WebCore::DisplayRefreshMonitor::maxClientPreferredFramesPerSecond const):
(WebCore::DisplayRefreshMonitor::adjustPreferredFramesPerSecond):
(WebCore::DisplayRefreshMonitor::setPreferredFramesPerSecond): Deleted.
* platform/graphics/DisplayRefreshMonitorClient.cpp:
(WebCore::DisplayRefreshMonitorClient::setPreferredFramesPerSecond):
* platform/graphics/DisplayRefreshMonitorManager.cpp:
(WebCore::DisplayRefreshMonitorManager::clientPreferredFramesPerSecondChanged):
(WebCore::DisplayRefreshMonitorManager::setPreferredFramesPerSecond): Deleted.
* platform/graphics/DisplayRefreshMonitorManager.h:
2021-03-31 Wenson Hsieh <wenson_hsieh@apple.com>
List of extents should be bounds-checked when iterating display list items
https://bugs.webkit.org/show_bug.cgi?id=224019
<rdar://problem/71851600>
Reviewed by Tim Horton.
Add a bounds check before attempting to access the vector of display list drawing item extents. In the case
where we would've otherwise attempted to access an out-of-bounds item, we instead flag ourselves as invalid and
stop early with `StopReplayReason::InvalidItemOrExtent`.
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::setTracksDrawingItemExtents):
Drive-by fix: use `isEmpty()` in the release assertion instead of duplicating code.
(WebCore::DisplayList::DisplayList::iterator::updateCurrentDrawingItemExtent):
(WebCore::DisplayList::DisplayList::iterator::updateCurrentItem):
* platform/graphics/displaylists/DisplayList.h:
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::Replayer::applyItem):
(WebCore::DisplayList::Replayer::replay):
* platform/graphics/displaylists/DisplayListReplayer.h:
Rename the `StopReplayReason::InvalidItem` to `StopReplayReason::InvalidItemOrExtent`, to reflect that we may
also stop replay when encountering invalid item extents.
2021-03-31 Tadeu Zagallo <tzagallo@apple.com>
Missing scope release in JSDOMBuiltinConstructorBase
https://bugs.webkit.org/show_bug.cgi?id=216851
<rdar://problem/69144642>
Reviewed by Yusuke Suzuki.
In JSDOMBuiltinConstructorBase::callFunctionWithCurrentArguments, we should release the
ThrowScope before calling into JavaScript since we don't intend to handle the exception.
Test: js/transform-stream.html
* bindings/js/JSDOMBuiltinConstructorBase.cpp:
(WebCore::JSDOMBuiltinConstructorBase::callFunctionWithCurrentArguments):
2021-03-31 Chris Dumez <cdumez@apple.com>
Use MACH_PORT_VALID() when wanting to check if a mach port is valid
https://bugs.webkit.org/show_bug.cgi?id=224004
Reviewed by Darin Adler.
Use MACH_PORT_VALID() when wanting to check if a mach port is valid, instead of checking for
MACH_PORT_NULL. MACH_PORT_VALID() is the correct way to check for validity since it also checks
for the MACH_PORT_DEAD value.
* page/cocoa/ResourceUsageThreadCocoa.mm:
(WebCore::ResourceUsageThread::platformCollectCPUData):
* platform/graphics/mac/GraphicsChecksMac.cpp:
(WebCore::attachToAppleGraphicsControl):
(WebCore::hasMuxCapability):
2021-03-31 Cameron McCormack <heycam@apple.com>
Avoid creating any complex text runs when font-size is zero.
https://bugs.webkit.org/show_bug.cgi?id=223983
Reviewed by Myles C. Maxfield.
We have existing checks to handle `font-size: 0` on the simple
text path, but not for complex text. Handle this by creating
no complex text runs for text with zero size.
Test: fast/text/font-size-zero-complex.html
* platform/graphics/ComplexTextController.cpp:
(WebCore::ComplexTextController::collectComplexTextRuns):
2021-03-31 Mark Lam <mark.lam@apple.com>
Placate exception check validation below convertVariadicArguments().
https://bugs.webkit.org/show_bug.cgi?id=224027
rdar://68912995
Reviewed by Saam Barati.
Test: js/dom/missing-exception-check-in-convertVariadicArguments.html
* bindings/js/JSDOMConvertVariadic.h:
(WebCore::convertVariadicArguments):
2021-03-31 Venky Dass <yaranamavenkataramana@apple.com>
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-03-31 Eric Carlson <eric.carlson@apple.com>
[macOS] MediaSessionCoordinator should have join and leave methods
https://bugs.webkit.org/show_bug.cgi?id=223955
<rdar://problem/76021588>
Reviewed by Jer Noble.
Add 'join' and 'leave' methods to MediaSessionCoordinator so a page has to opt-in
to participating in a coordinated session and can leave at any time. Don't have
the coordinator automatically call session methods when the private coordinator
finishes, just signal the promise and let the page handle it.
No new tests, updated media/media-session/mock-coordinator.html.
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/mediasession/MediaMetadata.idl: Fix Conditional.
* Modules/mediasession/MediaMetadataPlaylistMixin.idl: Ditto.
* Modules/mediasession/MediaPositionState.h: Add logging template.
(WTF::LogArgument<WebCore::MediaPositionState>::toString):
* Modules/mediasession/MediaSession.cpp:
(WebCore::MediaSession::MediaSession): Switch from beging a ContextDestructionObserver
to an ActiveDOMObject to the wrapper won't be collected while an event dispatch
is pending.
(WebCore::MediaSession::virtualHasPendingActivity const): Prevent collection while
event dispatch is pending.
(WebCore::MediaSession::setPositionState): Improve logging.
(WebCore::MediaPositionState::toJSONString const):
* Modules/mediasession/MediaSession.h:
* Modules/mediasession/MediaSession.idl:
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::join): New.
(WebCore::MediaSessionCoordinator::leave): New.
(WebCore::MediaSessionCoordinator::seekTo): Reject unless state is 'joined'. Don't
call session method.
(WebCore::MediaSessionCoordinator::play): Ditto.
(WebCore::MediaSessionCoordinator::pause): Ditto.
(WebCore::MediaSessionCoordinator::setTrack): Ditto.
(WebCore::MediaSessionCoordinator::positionStateChanged):
(WebCore::MediaSessionCoordinator::playbackStateChanged):
(WebCore::MediaSessionCoordinator::readyStateChanged): Do nothing unless state is
'joined'. Improve logging.
(WebCore::MediaSessionCoordinator::seekSessionToTime): Ditto.
(WebCore::MediaSessionCoordinator::playSession): Ditto.
(WebCore::MediaSessionCoordinator::pauseSession): Ditto.
(WebCore::MediaSessionCoordinator::setSessionTrack): Ditto.
* Modules/mediasession/MediaSessionCoordinator.h:
(WebCore::MediaSessionCoordinator::identifier const):
(WebCore::MediaSessionCoordinator::state const):
* Modules/mediasession/MediaSessionCoordinator.idl:
* Modules/mediasession/MediaSessionCoordinatorMixin.idl: Fix Conditional.
* Modules/mediasession/MediaSessionCoordinatorPrivate.h: Declare new required methods.
* Modules/mediasession/MediaSessionCoordinatorState.h: Define states.
* Modules/mediasession/MediaSessionCoordinatorState.idl:
* Modules/mediasession/MediaSessionPlaylistMixin.idl: Fix Conditional.
* Sources.txt: Add JSMediaSessionCoordinatorState.cpp.
* WebCore.xcodeproj/project.pbxproj:
* testing/MockMediaSessionCoordinator.cpp:
(WebCore::MockMediaSessionCoordinator::join):
(WebCore::MockMediaSessionCoordinator::leave):
(WebCore::MockMediaSessionCoordinator::coordinatorStateChanged):
* testing/MockMediaSessionCoordinator.h:
2021-03-31 Zalan Bujtas <zalan@apple.com>
Remove misleading FIXME comment in RenderBox::shouldComputeLogicalWidthFromAspectRatioAndInsets
https://bugs.webkit.org/show_bug.cgi?id=224020
Reviewed by Simon Fraser.
RenderStyle should not contain such logic (or any layout related logic for that matter).
* rendering/RenderBox.cpp:
(WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatioAndInsets const):
2021-03-31 Chris Lord <clord@igalia.com>
Make FontCache self-contained (remove static global variables)
https://bugs.webkit.org/show_bug.cgi?id=223995
Reviewed by Darin Adler.
This refactors FontCache so that the iOS font lock, the
FontPlatformDataCache, the FontDataCache, the FontVerticalDataCache,
the FontSelector clients list and the generation counter all live on
FontCache instead of in static global variables.
No new tests, no change in behavior.
* platform/graphics/FontCache.cpp:
(WebCore::FontCache::FontCache):
(WebCore::FontPlatformDataCacheKey::isHashTableDeletedValue const):
(WebCore::FontCache::getCachedFontPlatformData):
(WebCore::FontCache::verticalData):
(WebCore::FontCache::fontForPlatformData):
(WebCore::FontCache::purgeInactiveFontDataIfNeeded):
(WebCore::FontCache::purgeInactiveFontData):
(WebCore::FontCache::fontCount):
(WebCore::FontCache::inactiveFontCount):
(WebCore::FontCache::addClient):
(WebCore::FontCache::removeClient):
(WebCore::FontCache::invalidate):
* platform/graphics/FontCache.h:
(WebCore::FontCache::generation const):
2021-03-31 Sam Weinig <weinig@apple.com>
Merge DOMWindow+IndexedDatabase.idl and WorkerGlobalScope+IndexedDatabase.idl into a single WindowOrWorkerGlobalScope+IndexedDatabase.idl to match the IndexedDB spec
https://bugs.webkit.org/show_bug.cgi?id=223856
Reviewed by Sihui Liu.
Replaces DOMWindow+IndexedDatabase.idl and WorkerGlobalScope+IndexedDatabase.idl with
WindowOrWorkerGlobalScope+IndexedDatabase.idl which contains a partial mixin interface
like specified. Also moves implementations of supplements into the cpp file, as the only
use of them is by the two indexedDB static functions.
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/indexeddb/DOMWindow+IndexedDatabase.idl: Removed.
* Modules/indexeddb/DOMWindowIndexedDatabase.cpp: Removed.
* Modules/indexeddb/DOMWindowIndexedDatabase.h: Removed.
* Modules/indexeddb/WindowOrWorkerGlobalScope+IndexedDatabase.idl: Added.
* Modules/indexeddb/WindowOrWorkerGlobalScopeIndexedDatabase.cpp: Added.
(WebCore::DOMWindowIndexedDatabase::supplementName):
(WebCore::WorkerGlobalScopeIndexedDatabase::supplementName):
(WebCore::WindowOrWorkerGlobalScopeIndexedDatabase::indexedDB):
(WebCore::DOMWindowIndexedDatabase::DOMWindowIndexedDatabase):
(WebCore::DOMWindowIndexedDatabase::from):
(WebCore::DOMWindowIndexedDatabase::indexedDB):
(WebCore::WorkerGlobalScopeIndexedDatabase::WorkerGlobalScopeIndexedDatabase):
(WebCore::WorkerGlobalScopeIndexedDatabase::from):
(WebCore::WorkerGlobalScopeIndexedDatabase::indexedDB):
* Modules/indexeddb/WindowOrWorkerGlobalScopeIndexedDatabase.h: Added.
* Modules/indexeddb/WorkerGlobalScope+IndexedDatabase.idl: Removed.
* Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp: Removed.
* Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h: Removed.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMWindowCustom.cpp:
* inspector/agents/InspectorIndexedDBAgent.cpp:
2021-03-30 Simon Fraser <simon.fraser@apple.com>
Assertions in DisplayUpdate when dragging WebView windows between screens with different refresh rates
https://bugs.webkit.org/show_bug.cgi?id=223984
Reviewed by Sam Weinig.
There are various reasons why rigorous assertions in DisplayUpdate::relevantForUpdateFrequency()
are ill advised.
When WebKitLegacy calls windowScreenDidChange() it does not pass in a nominal display
refresh rate, so we assume 60fps. If the screen actually has a non-60fps refresh rate, then
we can get mixed 60/50 state in various places; this change fixes one of them, but such bugs
have to not result in assertions or divide by zero crashes in
DisplayUpdate::relevantForUpdateFrequency().
The second reason is webkit.org/b/212120; we may start DisplayRefreshMonitors with DisplayID
0 before we know what screen we're on, again risking a situation where the actual screen has
a non-60fps refresh rate.
To fix the case where no nominal refresh rate is passed through
Chrome::windowScreenDidChange(), allow a DisplayRefreshMonitor to supply a rate; often, a
DisplayRefreshMonitor can compute one from its knowledge of the display. This requires
DisplayRefreshMonitorManager is able to create a DisplayRefreshMonitor with no client, so
support that with a little refactoring.
Have some DisplayRefreshMonitor implementations supply their nominal display refresh rate
when known.
* page/Chrome.cpp:
(WebCore::Chrome::windowScreenDidChange): No need to early return here; Page does the same check.
* page/Page.cpp:
(WebCore::Page::windowScreenDidChange): Push the call to adjustRenderingUpdateFrequency() into
renderingUpdateScheduler().windowScreenDidChange() as suggested in a previous review.
* page/RenderingUpdateScheduler.cpp:
(WebCore::RenderingUpdateScheduler::windowScreenDidChange):
* platform/graphics/DisplayRefreshMonitor.h:
(WebCore::DisplayRefreshMonitor::displayNominalFramesPerSecond):
* platform/graphics/DisplayRefreshMonitorManager.cpp:
(WebCore::DisplayRefreshMonitorManager::ensureMonitorForDisplayID):
(WebCore::DisplayRefreshMonitorManager::nominalFramesPerSecondForDisplay):
(WebCore::DisplayRefreshMonitorManager::monitorForClient):
* platform/graphics/DisplayRefreshMonitorManager.h:
* platform/graphics/DisplayUpdate.cpp:
(WebCore::DisplayUpdate::relevantForUpdateFrequency const):
* platform/graphics/ios/DisplayRefreshMonitorIOS.h:
* platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
(WebCore::DisplayRefreshMonitorIOS::displayNominalFramesPerSecond):
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp:
(WebCore::LegacyDisplayRefreshMonitorMac::ensureDisplayLink):
(WebCore::LegacyDisplayRefreshMonitorMac::startNotificationMechanism):
(WebCore::LegacyDisplayRefreshMonitorMac::displayNominalFramesPerSecond):
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.h:
2021-03-31 Sihui Liu <sihui_liu@apple.com>
Add logging in IndexedDB to help debug flaky quota tests
https://bugs.webkit.org/show_bug.cgi?id=223578
<rdar://problem/75956789>
Reviewed by Alexey Proskuryakov.
With r274323, we know that the tests fail because of IndexedDB. IndexedDB data should be cleared between tests,
so let's add more logging to see what databases are left.
* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::diskUsage):
* Modules/indexeddb/server/IDBServer.h:
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::databasesSizeForDirectory):
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:
2021-03-31 Alex Christensen <achristensen@webkit.org>
Add deprecation macros.
* platform/network/cf/CertificateInfoCFNet.cpp:
(WebCore::certificatesMatch):
(WebCore::CertificateInfo::certificateChainFromSecTrust):
(WebCore::CertificateInfo::containsNonRootSHA1SignedCertificate const):
2021-03-31 Antoine Quint <graouts@webkit.org>
Remove CA_WHERE_ADDITIVE_TRANSFORMS_ARE_REVERSED
https://bugs.webkit.org/show_bug.cgi?id=224000
Reviewed by Simon Fraser.
Since trunk is no longer maintained on macOS versions earlier than 10.15,
we can remove this compile-time flag.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateAnimations):
2021-03-31 Patrick Angle <pangle@apple.com>
Web Inspector: CSS Grid overlay track sizes are incorrect when inline styles are applied to the element
https://bugs.webkit.org/show_bug.cgi?id=223908
Reviewed by BJ Burg.
Add checking the inline style attributes on an element when collecting authored track sizes for grid overlays.
* inspector/InspectorOverlay.cpp:
(WebCore::authoredGridTrackSizes):
2021-03-31 Chris Dumez <cdumez@apple.com>
ServiceWorkerContextData should not be saved both on ServiceWorkerThread & ServiceWorkerGlobalScope
https://bugs.webkit.org/show_bug.cgi?id=224001
Reviewed by Geoffrey Garen.
ServiceWorkerContextData should not be saved both on ServiceWorkerThread & ServiceWorkerGlobalScope.
ServiceWorkerContextData contains script sources and may use a large amount of memory.
To address the issue, we now clear ServiceWorkerThread's context data once the ServiceWorkerGlobalScope
has been constructed.
* inspector/agents/worker/ServiceWorkerAgent.cpp:
(WebCore::ServiceWorkerAgent::getInitializationInfo):
* workers/service/ServiceWorkerGlobalScope.cpp:
(WebCore::ServiceWorkerGlobalScope::create):
(WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
* workers/service/ServiceWorkerGlobalScope.h:
* workers/service/context/SWContextManager.cpp:
(WebCore::SWContextManager::registerServiceWorkerThreadForInstall):
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::ServiceWorkerThread):
(WebCore::ServiceWorkerThread::createWorkerGlobalScope):
(WebCore::ServiceWorkerThread::heartBeatTimerFired):
(WebCore::ServiceWorkerThread::finishedFiringInstallEvent):
* workers/service/context/ServiceWorkerThread.h:
(WebCore::ServiceWorkerThread::identifier const):
(WebCore::ServiceWorkerThread::jobDataIdentifier const):
(WebCore::ServiceWorkerThread::contextData const): Deleted.
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
* workers/service/context/ServiceWorkerThreadProxy.h:
2021-03-31 Antoine Quint <graouts@webkit.org>
font-stretch should support 0% and disallow animating to a value below 0%
https://bugs.webkit.org/show_bug.cgi?id=223994
Reviewed by Antti Koivisto.
Trying to fix css/css-fonts/animations/font-stretch-interpolation.html showed two issues:
1. we disallowed 0% as a valid value when parsing font-stretch,
2. we allowed negative values when blending.
This patch addresses both.
* animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
* css/parser/CSSPropertyParser.cpp:
(WebCore::fontStretchIsWithinRange):
2021-03-31 Antoine Quint <graouts@webkit.org>
Remove the Silently argument to WebAnimation::cancel()
https://bugs.webkit.org/show_bug.cgi?id=223992
Reviewed by Frédéric Wang.
The recent commit r275228 removed the use of the Silently argument in
AnimationTimeline::cancelDeclarativeAnimationsForStyleable(), which
was the only function that would eventually call into WebAnimation::cancel()
with a value other than the default, Silently::No.
So we remove that argument to WebAnimation::cancel(), its call sites and
WebAnimation::resetPendingTasks() which was called from it.
And since the Silently enum is no longer used outside of WebAnimation.cpp,
we move it to be private.
* animation/AnimationTimeline.cpp:
(WebCore::AnimationTimeline::elementWasRemoved):
(WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable):
* animation/AnimationTimeline.h:
* animation/DeclarativeAnimation.cpp:
(WebCore::DeclarativeAnimation::cancel):
* animation/DeclarativeAnimation.h:
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::cancel):
(WebCore::WebAnimation::resetPendingTasks):
* animation/WebAnimation.h:
* rendering/updating/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::tearDownRenderers):
2021-03-31 Antti Koivisto <antti@apple.com>
Use :is() instead of :matches() on UA stylesheet
https://bugs.webkit.org/show_bug.cgi?id=223996
Reviewed by Antoine Quint.
Use the standard name.
* css/html.css:
(:is(article, aside, nav, section) h1):
(:is(article, aside, nav, section) :is(article, aside, nav, section) h1):
(:is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1):
(:is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1):
(:is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1):
(#endif):
(#if defined(WTF_PLATFORM_IOS_FAMILY) && WTF_PLATFORM_IOS_FAMILY):
(input:is([type="hidden"], [type="image"], [type="file"])):
(input:is([type="radio"], [type="checkbox"])):
(input:is([type="button"], [type="submit"], [type="reset"])):
(input:is([type="button"], [type="submit"], [type="reset"]), input[type="file"]::file-selector-button, button):
(input:is([type="button"], [type="submit"], [type="reset"]):active, input[type="file"]::file-selector-button:active, button:active):
(input:is([type="button"], [type="submit"], [type="reset"]):active, input[type="file"]:active::file-selector-button, button:active):
(input:is([type="button"], [type="submit"], [type="reset"]):active:disabled,):
(input:is([type="button"], [type="submit"], [type="reset"]):disabled,):
(input:is([type="checkbox"], [type="radio"]):checked):
(input:is([type="checkbox"], [type="radio"]):disabled):
(input:is([type="checkbox"], [type="radio"]):checked:disabled):
(:matches(article, aside, nav, section) h1): Deleted.
(:matches(article, aside, nav, section) :matches(article, aside, nav, section) h1): Deleted.
(:matches(article, aside, nav, section) :matches(article, aside, nav, section) :matches(article, aside, nav, section) h1): Deleted.
(:matches(article, aside, nav, section) :matches(article, aside, nav, section) :matches(article, aside, nav, section) :matches(article, aside, nav, section) h1): Deleted.
(:matches(article, aside, nav, section) :matches(article, aside, nav, section) :matches(article, aside, nav, section) :matches(article, aside, nav, section) :matches(article, aside, nav, section) h1): Deleted.
(input:matches([type="hidden"], [type="image"], [type="file"])): Deleted.
(input:matches([type="radio"], [type="checkbox"])): Deleted.
(input:matches([type="button"], [type="submit"], [type="reset"])): Deleted.
(input:matches([type="button"], [type="submit"], [type="reset"]), input[type="file"]::file-selector-button, button): Deleted.
(input:matches([type="button"], [type="submit"], [type="reset"]):active, input[type="file"]::file-selector-button:active, button:active): Deleted.
(input:matches([type="button"], [type="submit"], [type="reset"]):active, input[type="file"]:active::file-selector-button, button:active): Deleted.
(input:matches([type="button"], [type="submit"], [type="reset"]):active:disabled,): Deleted.
(input:matches([type="button"], [type="submit"], [type="reset"]):disabled,): Deleted.
(input:matches([type="checkbox"], [type="radio"]):checked): Deleted.
(input:matches([type="checkbox"], [type="radio"]):disabled): Deleted.
(input:matches([type="checkbox"], [type="radio"]):checked:disabled): Deleted.
2021-03-31 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] Do not merge anonymous table cells with mismatching children types
https://bugs.webkit.org/show_bug.cgi?id=223979
<rdar://76003320>
Reviewed by Antti Koivisto.
A table cell (as it establishes a block formatting context) should only contain either
inline or block level inflow boxes.
* rendering/RenderElement.h:
(WebCore::RenderElement::firstInFlowChild const):
(WebCore::RenderElement::lastInFlowChild const):
* rendering/RenderObject.h:
(WebCore::RenderObject::isInFlow const):
(WebCore::RenderObject::previousInFlowSibling const):
(WebCore::RenderObject::nextInFlowSibling const):
* rendering/updating/RenderTreeBuilderTable.cpp:
(WebCore::canCollapseNextSibling):
(WebCore::RenderTreeBuilder::Table::collapseAndDetachAnonymousNextSibling):
2021-03-31 Antti Koivisto <antti@apple.com>
Animated pseudo element style resolved against wrong parent style
https://bugs.webkit.org/show_bug.cgi?id=223990
rdar://74997361
Reviewed by Antoine Quint.
In createAnimatedElementUpdate we get the parent and parent box styles from the parent stack.
This is wrong for pseudo elements. Their parent style should the host style which is not pushed to the stack.
This matters in style adjuster which may apply wrong adjustments as a result.
Test: fast/animation/pseudo-element-style-adjuster.html
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveElement):
(WebCore::Style::TreeResolver::resolvePseudoStyle):
(WebCore::Style::TreeResolver::createAnimatedElementUpdate):
Make static and provide the parent and parent box styles as parameters.
* style/StyleTreeResolver.h:
2021-03-31 Youenn Fablet <youenn@apple.com>
Apply permission policy to geolocation
https://bugs.webkit.org/show_bug.cgi?id=223248
Reviewed by Eric Carlson.
Only allow third-party iframes if allowed by permission policy,
following https://w3c.github.io/geolocation-api/#permissions-policy.
Covered by API tests.
* Modules/geolocation/Geolocation.cpp:
(WebCore::Geolocation::shouldBlockGeolocationRequests):
* html/FeaturePolicy.cpp:
(WebCore::policyTypeName):
(WebCore::FeaturePolicy::parse):
(WebCore::FeaturePolicy::allows const):
* html/FeaturePolicy.h:
2021-03-31 Thibault Saunier <tsaunier@igalia.com> and Philippe Normand <pnormand@igalia.com>
[WebRTC][GStreamer] Build and use the openh264 based encoder if present on the system
https://bugs.webkit.org/show_bug.cgi?id=202538
Reviewed by Xabier Rodriguez-Calvar and Adrian Perez de Castro.
Enable the openh264 encoder if it is available, it would be preferred over existing
GStreamer H.264 encoders in such case.
* platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
(WebCore::GStreamerVideoEncoder::AddCodecIfSupported):
(WebCore::GStreamerVideoEncoderFactory::CreateVideoEncoder):
2021-03-30 Antoine Quint <graouts@webkit.org>
Computed style for a border-radius corner should never be 0px when the provided width isn't 0px
https://bugs.webkit.org/show_bug.cgi?id=223927
Reviewed by Dean Jackson.
If "border-top-left-radius: 40px 0px" is provided, the computed style would return "0px" since
BuilderConverter::convertRadius() would treat either of the dimensions for the radius being 0
as both being 0.
* style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertRadius):
2021-03-30 Antoine Quint <graouts@webkit.org>
Fix interpolation of box-shadow and text-shadow CSS properties
https://bugs.webkit.org/show_bug.cgi?id=223924
Reviewed by Dean Jackson.
There were three issues with interpolation of ShadowData-backed properties such
as box-shadow and text-shadow:
1. the blur radius should not be allowed to be negative,
2. blending LayoutUnit had accuracy issues,
3. we would allow interpolation to happen when items in lists did not have
matching shadow styles ("inset" vs. unspecified).
* animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
* platform/animation/AnimationUtilities.h:
(WebCore::blend):
2021-03-30 Antoine Quint <graouts@webkit.org>
Computed style for background-position should not use "left" and "top" keywords
https://bugs.webkit.org/show_bug.cgi?id=223878
Reviewed by Simon Fraser.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle): Ensure querying the computed
style for background-position longhands passes in the RenderStyle for the calc() case.
(WebCore::createPositionListForLayer):
2021-03-30 Chris Dumez <cdumez@apple.com>
Service Worker scripts use too much memory in the network process
https://bugs.webkit.org/show_bug.cgi?id=223808
<rdar://75637093>
Reviewed by Geoff Garen.
Previously, the network process would store service worker scripts in a SQLite database.
When starting to use service workers, we would load all those scripts from the database
into memory. This would use a decent amount of memory in the network process.
To address the issue, the approach is this patch is to store the scripts as separate
files on the filesystem instead. This when, when loading them, we can simply mmap() them
and greatly reduce dirty memory usage.
Note that the service worker process (which may be the WebContent process) also keeps a
copy of the imported service worker scripts for the service workers it is running. More
work will be needed in a follow-up but we should be able to extend the approach so that
the service worker process would only have a mmap'd version of those scripts. This would
reduce dirty memory usage on the WebContent/ServiceWorker process side as well. I am
doing this separately though to reduce patch size and facilitate review.
No new tests, there should be no Web-facing behavior change, just a decreased
dirty memory usage in the network process when service workers are used.
I did manual memory testing with a very large service worker that had one ~100MB main
script, importing another ~100MB script.
Here are the memory results without my change:
- Networking (Dirty): 238MB (cold) / 331MB (warm)
- WebContent (Dirty): 441MB (cold) / 857MB (warm)
Here are the memory results with my change:
- Networking (Dirty): 22MB (cold) / 14MB (warm)
- WebContent (Dirty): 440MB (cold) / 438MB (warm)
This shows that ALL memory from the scripts in the network process is no longer marked
as dirty. We also see a significant progression in the WebProcess in the warm case, since
the scripts are coming from the network process as shared memory in this case. There is
no progression in the WebProcess in the cold case yet, since the script were just
downloaded and are coming from the WebProcess to the NetworkProcess. In a follow-up, the
network process could send shared memory back to the WebProcess, after saving the scripts
to disk, so that the WebProcess can replace the copies of its scripts and save more memory.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
Add new SWScriptStorage class to the project.
* inspector/agents/worker/ServiceWorkerAgent.cpp:
(WebCore::ServiceWorkerAgent::getInitializationInfo):
Convert the script type from SharedBuffer to String.
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::operator== const):
Fix assertions that were hitting when comparing to empty SharedBuffers (offset would be 0
and size would be 0). This was caught by API tests since we have some service worker API
tests that use empty worker scripts.
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadSynchronously):
Add some conversion from String to SharedBuffer to the script, and vice-versa, in the
service worker case.
* workers/service/ServiceWorkerContextData.cpp:
(WebCore::ServiceWorkerContextData::isolatedCopy const):
(WebCore::scriptBufferToString):
(WebCore::stringToScriptBuffer):
* workers/service/ServiceWorkerContextData.h:
(WebCore::ServiceWorkerContextData::ImportedScript::isolatedCopy const):
(WebCore::ServiceWorkerContextData::ImportedScript::decode):
(WebCore::ServiceWorkerContextData::decode):
- Store scripts as SharedBuffer instead of String, so that they can hold
mmap'd data.
- Add scriptBufferToString() / stringToScriptBuffer() utility functions to
convert script sources between String and SharedBuffer.
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::ServiceWorkerThread):
Convert from script from SharedBuffer to String.
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::recordsTableSchema):
Update database schema and bump version now that we no longer store the
service worker script inside the SQLite database. Instead, those scripts
are stored separately on the filesystem via SWScriptStorage.
(WebCore::ImportedScriptAttributes::encode const):
(WebCore::ImportedScriptAttributes::decode):
Introduce new ImportedScriptAttributes struct which contains all the data
members of ServiceWorkerContextData::ImportedScript, except for the actual
script source. We now save a HashMap of ImportedScriptAttributes in the
databasae instead of HashMap of ImportedScript since we no longer want to
store imported script sources in the database, but rather store them
separately on the file system.
(WebCore::stripScriptSources):
Utility function to convert a HashMap of ServiceWorkerContextData::ImportedScript
into a HashMap of ImportedScriptAttributes (identical but without the script
source), ready to save in the SQLite database.
(WebCore::populateScriptSourcesFromDisk):
Utility function to construct a HashMap of ServiceWorkerContextData::ImportedScript
from a HasMap of ImportedScriptAttributes, coming from the SQLiteDatabase. The
missing script sources are fetched from the disk via SWScriptStorage.
(WebCore::RegistrationDatabase::~RegistrationDatabase):
Make sure we destroy the SWScriptStorage on the background queue for thread-safety.
(WebCore::RegistrationDatabase::scriptStorageDirectory const):
Returns the path on the filesystem where service worker scripts are stored.
(WebCore::RegistrationDatabase::scriptStorage):
Constructs (if necessary) a SWScriptStorage and return it.
(WebCore::RegistrationDatabase::clearAll):
Make sure we clear all the service worker scripts on disk in addition to the database,
now that they are stored separately.
(WebCore::RegistrationDatabase::doPushChanges):
- Stop storing the script sources in the SQLite database, and instead store them as separate
files on the file system via SWScriptStorage.
- Improve logging
- When done storing the scripts to disk, send these new mmap'd versions back to the
SWServerWorker on the main thread, so that it can replace it's heavy script sources with
these ones. This helps reduce memory usage.
(WebCore::RegistrationDatabase::importRecords):
- Load the script sources from the disk via SWScriptStorage, now that they are no longer
stored in the SQLite database.
- Improve logging.
* workers/service/server/RegistrationDatabase.h:
* workers/service/server/RegistrationStore.cpp:
(WebCore::RegistrationStore::didSaveWorkerScriptsToDisk):
* workers/service/server/RegistrationStore.h:
Pass scripts that were saved to disk from the store to the SWServerWorker so that it
can replace its scripts sources with those new mmap'd version, in order to save memory.
* workers/service/server/SWScriptStorage.cpp: Added.
(WebCore::hashURL):
(WebCore::SWScriptStorage::SWScriptStorage):
(WebCore::SWScriptStorage::registrationDirectory const):
(WebCore::SWScriptStorage::scriptPath const):
(WebCore::SWScriptStorage::store):
(WebCore::SWScriptStorage::retrieve):
(WebCore::SWScriptStorage::clear):
* workers/service/server/SWScriptStorage.h: Added.
Add SWScriptStorage to deal with the storage / retrieval of Service
Worker scripts to / from disk, as files on the file system. When
going a retrieval, we return a script as a SharedBuffer which usually contains
mmap'd() data (we don't use mmap() for files that are smaller than the PAGE_SIZE).
The scripts reside in a Scripts/ folder, beside the database. The scripts are separated
by origin (using SHA256 of the origin as folder name with salt), and then by registration (by
using SHA256 of the registration scope as subfolder name with salt). The file name for the script
is a SHA256 of the script URL with salt.
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::didSaveWorkerScriptsToDisk):
Pass scripts that were saved to disk from the store to the SWServerWorker so that it
can replace its scripts sources with those new mmap'd version, in order to save memory.
(WebCore::SWServer::updateWorker):
Convert script from String to SharedBuffer.
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::scriptFetchFinished):
Convert script from SharedBuffer to String.
* workers/service/server/SWServerToContextConnection.cpp:
(WebCore::SWServerToContextConnection::setScriptResource):
* workers/service/server/SWServerToContextConnection.h:
Take in a ServiceWorkerContextData::ImportedScript for convenience, instead of taking
all its data members as separate parameters.
* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::SWServerWorker):
* workers/service/server/SWServerWorker.h:
(WebCore::SWServerWorker::script const):
Use SharedBuffer type for script instead of String type, so that we can hold on the
mmap'd data and reduce memory usage.
2021-03-30 Devin Rousso <drousso@apple.com>
REGRESSION(r274607): media controls script is visible in Web Inspector even without the engineering "Show WebKit-internal scripts" enabled
https://bugs.webkit.org/show_bug.cgi?id=223961
Reviewed by Yusuke Suzuki.
It turns out that Web Inspector will only ignore scripts that have a source URL directive
that matches `__InjectedScript_*.js`, not those that have a (source) URL matching that.
In addition to Web Inspector ignoring these scripts in the UI, it will also cause the
`Debugger` to not pause in scripts with a matching source URL directive (unless the
local build engineering only "Pause in WebKit-internal scripts" is enabled).
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
Change the `ScriptSourceCode` here to not have a `URL` and have `make-js-file-arrays.py`
add a `//# sourceURL=__InjectedScript_*.js` to the contents before it's encoded.
2021-03-30 Venky Dass <yaranamavenkataramana@apple.com>
Nullptr crash in Crash in WebCore::positionInParentBeforeNode(..) where a NULL check is missing.
https://bugs.webkit.org/show_bug.cgi?id=223639
Reviewed by Ryosuke Niwa.
In positionInParentBeforeNode(..) there is a null check missing on a pointer - hence the crash.
Test: LayoutTests/editing/inserting/edit-style-and-insert-image.html
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::doApply):
2021-03-30 Ryosuke Niwa <rniwa@webkit.org>
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-30 Peng Liu <peng.liu6@apple.com>
[GPUP] Add an IPC message to implement RemoteImageDecoderAVF::clearFrameBufferCache()
https://bugs.webkit.org/show_bug.cgi?id=223707
Reviewed by Youenn Fablet.
No change in observable functionality.
* platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
Export method `clearFrameBufferCache()` so that we can call it from WebKit.
2021-03-30 Antti Koivisto <antti@apple.com>
Nullptr crash in applyCommonButtonPaddingToStyle
https://bugs.webkit.org/show_bug.cgi?id=223917
rdar://57262957
Reviewed by Zalan Bujtas.
* rendering/RenderThemeIOS.mm:
(WebCore::applyCommonButtonPaddingToStyle):
Null check frame.
2021-03-30 Frédéric Wang <fwang@igalia.com>
Release assert in compareAnimationsByCompositeOrder
https://bugs.webkit.org/show_bug.cgi?id=223368
Reviewed by Antoine Quint.
AnimationTimeline::cancelDeclarativeAnimationsForStyleable currently only calls cancel() on
the declarative animation, which means the owning element is still associated to the
animation and that one continues to be accessible via Element's getAnimations(). When members
like pause() are called on that animation, one can obtain inconsistent state for
KeyframeEffectStack, leading to a debug ASSERT(!cssAnimationList->isEmpty()); and a
RELEASE_ASSERT_NOT_REACHED() in compareCSSAnimations(). This patch forces the owning element
to be clear during cancelDeclarativeAnimationsForStyleable in order to address these issues.
More code refactoring and cleanup should be done in follow-up patches, though.
Test: animations/animation-remove-element-crash.html
* animation/AnimationTimeline.cpp:
(WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable): Use cancelFromStyle()
so that the owning element is also cleared.
2021-03-30 Antoine Quint <graouts@webkit.org>
CSS properties backed by StyleImage should not interpolate when one of the values is "none"
https://bugs.webkit.org/show_bug.cgi?id=223929
Reviewed by Dean Jackson.
* animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
2021-03-30 Peng Liu <peng.liu6@apple.com>
Rename MediaElementSession::playbackPermitted() to MediaElementSession::playbackStateChangePermitted()
https://bugs.webkit.org/show_bug.cgi?id=220939
Reviewed by Youenn Fablet.
A follow-up patch of r271870 to rename function `playbackPermitted()` and
the enum class `MediaPlaybackOperation`.
No new tests as there is no change in functionality.
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::userGestureRequired const):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const):
(WebCore::HTMLMediaElement::setReadyState):
(WebCore::HTMLMediaElement::play):
(WebCore::HTMLMediaElement::pause):
(WebCore::HTMLMediaElement::pauseInternal):
(WebCore::HTMLMediaElement::setVolume):
(WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack):
(WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
(WebCore::HTMLMediaElement::updateShouldPlay):
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::playbackStateChangePermitted const):
(WebCore::MediaElementSession::canShowControlsManager const):
(WebCore::MediaElementSession::updateMediaUsageIfChanged):
(WebCore::MediaElementSession::playbackPermitted const): Deleted.
* html/MediaElementSession.h:
2021-03-30 Antoine Quint <graouts@webkit.org>
Account for "hanging" and "each-line" when blending text-interpolation
https://bugs.webkit.org/show_bug.cgi?id=223914
Reviewed by Dean Jackson.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
2021-03-30 Antoine Quint <graouts@webkit.org>
[CSS Backgrounds] WPT test css/css-backgrounds/animations/border-image-width-interpolation.html asserts
https://bugs.webkit.org/show_bug.cgi?id=206578
Reviewed by Dean Jackson.
Ensure we pass the RenderStyle through the methods eventually calling createValue() for calculated lengths.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::valueForNinePieceImageQuad):
(WebCore::valueForNinePieceImage):
(WebCore::valueForReflection):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
2021-03-30 Andres Gonzalez <andresg_22@apple.com>
Fix for accessibility/textarea-insertion-point-line-number.html.
https://bugs.webkit.org/show_bug.cgi?id=223936
<rdar://problem/76007361>
Reviewed by Chris Fleizach.
Test: accessibility/textarea-insertion-point-line-number.html
Added AXCoreObject::insertionPointLineNumber to support this functionality.
This replaces the previous implementation in the wrapper's accessibilityAttributeValue.
There were several problems with the previous implementation that was
doing an unnecessary and buggy round trip from Ranges to indexes and
back to VisiblePositions.
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityObjectInterface.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::insertionPointLineNumber const):
* accessibility/AccessibilityRenderObject.h:
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::insertionPointLineNumber const):
(WebCore::AXIsolatedObject::selectionStart const): Deleted.
(WebCore::AXIsolatedObject::selectionEnd const): Deleted.
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2021-03-29 Simon Fraser <simon.fraser@apple.com>
Allow non-60fps display updates to be driven by DisplayRefreshMonitor
https://bugs.webkit.org/show_bug.cgi?id=223912
Reviewed by Sam Weinig.
Previously, RenderingUpdateScheduler::scheduleAnimation() would return false for any
preferredFramesPerSecond which is not 60fps, causing RenderingUpdateScheduler to fall back
to its timer mechanism. This meant that throttled (e.g. by low power) pages and display
updates on non-60fps display would all use timers. This is undesirable because we want
alignment with display refresh, and to avoid timer drift between multiple throttled
documents.
The fix has two parts. First, we need to fix RenderingUpdateScheduler and
ScriptedAnimationController to compute their frame rates in terms of FramesPerSecond, rather
than Seconds, because using the latter requires conversion to Seconds and back via
m_page.preferredRenderingUpdateInterval() which was awkward. So have Page expose
preferredRenderingUpdateFramesPerSecond().
Also add preferredFramesPerSecond(), and have both it and preferredFrameInterval() take the
"near 60fps" flag as an argument, so doing the common math in AnimationFrameRate.
The second part of the fix is to move "preferredFramesPerSecond" from
RenderingUpdateScheduler to DisplayRefreshMonitorClient, since clients should be able to
request different frame rates. Then we pass the DisplayUpdate to
DisplayRefreshMonitorClient::fireDisplayRefreshIfNeeded(), and finally use it to do the math
of whether to skip an update for this client.
Tested by API tests in AnimationFrameRate.cpp, and by
fast/animation/request-animation-frame-throttling-lowPowerMode.html
* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::interval const): This function (used for testing)
is just a synonym for preferredScriptedAnimationInterval(), but left here because it's exported
and maybe the compiler can inline preferredScriptedAnimationInterval().
(WebCore::ScriptedAnimationController::preferredScriptedAnimationInterval const): Just call
preferredFrameInterval() with throttlingReasons(), which is the union of the reasons for
the page and for this ScriptedAnimationController.
(WebCore::ScriptedAnimationController::throttlingReasons const): No reason not to return m_throttlingReasons
if we don't have a page. Should never happen.
(WebCore::ScriptedAnimationController::shouldRescheduleRequestAnimationFrame const): Logging.
(WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks): Logging.
* page/Page.cpp:
(WebCore::Page::windowScreenDidChange): The display nominal FPS may have changed so recompute the update frequency.
(WebCore::Page::preferredRenderingUpdateFramesPerSecond const): Return the preferred update in FramesPerSecond. Will return
null if throttling results in a < 1fps update.
(WebCore::Page::preferredRenderingUpdateInterval const): Push the "near 60fps" logic into the helper function.
(WebCore::Page::setIsVisuallyIdleInternal): Clearer to use OptionSet<>::set().
(WebCore::Page::handleLowModePowerChange): Ditto.
* page/Page.h:
(WebCore::Page::displayNominalFramesPerSecond const):
(WebCore::Page::throttlingReasons const):
* page/RenderingUpdateScheduler.cpp:
(WebCore::RenderingUpdateScheduler::scheduleAnimation): Remove code that fell back to a timer for any non-60fps rate.
(WebCore::RenderingUpdateScheduler::adjustRenderingUpdateFrequency): Compute if we have to use a timer.
(WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):
(WebCore::RenderingUpdateScheduler::setPreferredFramesPerSecond): Deleted.
* page/RenderingUpdateScheduler.h:
* platform/graphics/AnimationFrameRate.cpp: Simplify some code with halfSpeedThrottlingReasons.
(WebCore::preferredFramesPerSecond): Similar logic to preferredFrameInterval, but for FramesPerSecond values.
(WebCore::preferredFrameInterval):
* platform/graphics/AnimationFrameRate.h:
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::displayDidRefresh):
* platform/graphics/DisplayRefreshMonitorClient.cpp:
(WebCore::DisplayRefreshMonitorClient::setPreferredFramesPerSecond):
(WebCore::DisplayRefreshMonitorClient::fireDisplayRefreshIfNeeded):
* platform/graphics/DisplayRefreshMonitorClient.h:
(WebCore::DisplayRefreshMonitorClient::preferredFramesPerSecond const):
* platform/graphics/DisplayUpdate.cpp:
(WebCore::DisplayUpdate::relevantForUpdateFrequency const): Compute whether this update is relevant
for a client who wants updates at 'preferredFramesPerSecond'.
* platform/graphics/DisplayUpdate.h:
2021-03-30 Antti Koivisto <antti@apple.com>
[LFC][Integration] Elements that overflow inline-blocks are not hit tested correctly
https://bugs.webkit.org/show_bug.cgi?id=223932
rdar://75888718
Reviewed by Zalan Bujtas.
If an inline block has overflowing children (for example due to negative margin) we may fail to hit test them.
Test: fast/inline-block/hit-test-negative-margin-child.html
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::hitTest):
Always descend into inline blocks even if their run didn't hit.
2021-03-30 Mark Lam <mark.lam@apple.com>
Ensure that GlobalPropertyInfo is allocated on the stack.
https://bugs.webkit.org/show_bug.cgi?id=223911
rdar://75865742
Reviewed by Yusuke Suzuki.
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::addBuiltinGlobals):
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::finishCreation):
(WebCore::JSDOMWindowBase::initStaticGlobals):
* bindings/js/JSDOMWindowBase.h:
2021-03-30 Sam Weinig <weinig@apple.com>
Generalize ColorComponents to support an arbritrary number of components (though really we will only ever want 3, 4, or 5)
https://bugs.webkit.org/show_bug.cgi?id=223901
Reviewed by Darin Adler.
Add a length to ColorComponents to allow an arbitrary number of components. This
will be used to support cases where we only want to carry the three color components
(not alpha) and will be useful if we ever need to add back CMYKA support.
A new dedecution guide added allows for cases that currently deduce to remain.
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::makeColorTypeByNormalizingComponentsAfterMix):
(WebCore::CSSPropertyParserHelpers::makeColorTypeByNormalizingComponentsAfterMix<HWBA<float>>):
(WebCore::CSSPropertyParserHelpers::makeColorTypeByNormalizingComponentsAfterMix<HSLA<float>>):
(WebCore::CSSPropertyParserHelpers::fixupHueComponentsPriorToMix):
* platform/graphics/Color.cpp:
(WebCore::Color::colorSpaceAndComponents const):
* platform/graphics/Color.h:
(WebCore::Color::OutOfLineComponents::create):
(WebCore::Color::OutOfLineComponents::components const):
(WebCore::Color::OutOfLineComponents::OutOfLineComponents):
* platform/graphics/ColorComponents.h:
(WebCore::ColorComponents::ColorComponents):
(WebCore::mapColorComponents):
(WebCore::N>::map const):
(WebCore::=):
(WebCore::N>::operator const):
(WebCore::N>::abs const):
(WebCore::N>::get const):
(WebCore::N>::subset const):
(WebCore::perComponentMax):
(WebCore::perComponentMin):
(WebCore::operator==):
(WebCore::operator!=):
(WebCore::ColorComponents<T>::map const): Deleted.
(WebCore::ColorComponents<T>::operator const): Deleted.
(WebCore::ColorComponents<T>::abs const): Deleted.
(WebCore::ColorComponents<T>::get const): Deleted.
* platform/graphics/ColorMatrix.h:
(WebCore::RowCount>::transformedColorComponents const):
(WebCore::applyMatricesToColorComponents):
* platform/graphics/ColorSpace.h:
(WebCore::callWithColorType):
* platform/graphics/ColorTypes.h:
(WebCore::makeFromComponents):
(WebCore::clampedComponent):
(WebCore::clampedComponents):
(WebCore::clampedComponentsExceptAlpha):
(WebCore::makeFromComponentsClamping):
(WebCore::makeFromComponentsClampingExceptAlpha):
(WebCore::asColorComponents):
* platform/graphics/filters/FEColorMatrix.cpp:
* platform/graphics/filters/FEMorphology.cpp:
(WebCore::makeColorComponentsfromPixelValue):
(WebCore::makePixelValueFromColorComponents):
(WebCore::minOrMax):
(WebCore::columnExtremum):
(WebCore::kernelExtremum):
(WebCore::FEMorphology::platformApplyGeneric):
* platform/graphics/filters/FETurbulence.cpp:
(WebCore::FETurbulence::noise2D const):
(WebCore::toIntBasedColorComponents):
(WebCore::FETurbulence::calculateTurbulenceValueForPoint const):
* platform/graphics/filters/FETurbulence.h:
* platform/graphics/filters/FilterOperation.cpp:
(WebCore::hueRotate):
2021-03-30 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] Anonymous table cell collapsing should also cleanup the inline tree
https://bugs.webkit.org/show_bug.cgi?id=223910
Reviewed by Antti Koivisto.
Let's delete the inline tree when the anonymous table cell is collapsed.
It's completely redundant at this point as the content is moved over to a previous sibling.
* rendering/updating/RenderTreeBuilderTable.cpp:
(WebCore::RenderTreeBuilder::Table::collapseAndDetachAnonymousNextSibling):
(WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingCells):
(WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
(WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblings): Deleted.
* rendering/updating/RenderTreeBuilderTable.h:
2021-03-30 Jean-Yves Avenard <jya@apple.com>
Now Playing content isn't updated when media session's Metadata is modified
https://bugs.webkit.org/show_bug.cgi?id=223795
<rdar://problem/75883478>
Reviewed by Eric Carlson.
Manually tested. Ensuring that immediately after modifying the MediaSession metadata, NowPlaying reflects the change.
* Modules/mediasession/MediaSession.h:
(WebCore::MediaSession::Observer::metadataChanged): Change method prototype to avoid unnecessary refcount.
(WebCore::MediaSession::Observer::positionStateChanged): Change method prototype to pass argument by reference rather than value (and easier forward declaration).
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::positionStateChanged): Pass argument by reference rather than value.
* Modules/mediasession/MediaSessionCoordinator.h:
* Modules/mediasession/MediaSessionCoordinatorPrivate.h:
* html/MediaElementSession.cpp: Add MediaSessionObserver class, we use separate proxy to avoid multiple inheritance of CanMakeWeakPtr.
(WebCore::MediaSessionObserver::MediaSessionObserver):
(WebCore::MediaSessionObserver::~MediaSessionObserver):
(WebCore::MediaSessionObserver::actionHandlersChanged):
(WebCore::MediaElementSession::registerWithDocument): Add MediaElementSession as Media Session observer when it's added to the DOM.
(WebCore::MediaElementSession::unregisterWithDocument): Remove MediaElementSession as Media Session observer when it's removed from the DOM.
(WebCore::MediaElementSession::didReceiveRemoteControlCommand): Simplify with new mediaSession() helper.
(WebCore::MediaElementSession::nowPlayingInfo const): Simplify with new mediaSession() helper.
(WebCore::MediaElementSession::mediaSession const): Helper to retrieve associated mediaSession object.
(WebCore::MediaElementSession::ensureIsObservingMediaSession):
(WebCore::MediaElementSession::metadataChanged): Call clientCharacteristicsChanged which will trigger the PlatformMediaSessionManager to refresh the NowPlayingInfo content.
(WebCore::MediaElementSession::positionStateChanged): Method currently doing nothing. Preparing for future change.
(WebCore::MediaElementSession::playbackStateChanged): Method currently doing nothing. Preparing for future change.
(WebCore::MediaElementSession::actionHandlersChanged): Method currently doing nothing. Preparing for future change.
* html/MediaElementSession.h: Add methods.
* platform/cocoa/RemoteCommandListenerCocoa.h: Remove trailing whitespace.
* testing/MockMediaSessionCoordinator.cpp:
(WebCore::MockMediaSessionCoordinator::positionStateChanged): Update for new method prototyping.
* testing/MockMediaSessionCoordinator.h:
2021-03-30 Antoine Quint <graouts@webkit.org>
Account for "cover" and "contain" when interpolating background-size
https://bugs.webkit.org/show_bug.cgi?id=223879
Reviewed by Antti Koivisto.
* animation/CSSPropertyAnimation.cpp:
2021-03-30 Lauro Moura <lmoura@igalia.com>
[GTK][WPE] Timeouts on WPT css/css-images ref-tests after updating WPT import
https://bugs.webkit.org/show_bug.cgi?id=214472
Reviewed by Žan Doberšek.
In some cases, degenerated and corner cases of grandient stops might
trigger really slow operations in Cairo due to extremely high bezier
parameters. For example, the normalization-conic-2.html triggered this
by making the conic code calculate the tangent of 90 degrees for an
interpolation stop.
This commit adds some special handling for these cases to make sure the
interpolation will be inside reasonable values.
Covered by existing tests.
* platform/graphics/cairo/GradientCairo.cpp:
(WebCore::createConic): Handle degenerated stops
2021-03-29 Antoine Quint <graouts@webkit.org>
Enable "hanging" and "each-line" keywords for the text-indent CSS property
https://bugs.webkit.org/show_bug.cgi?id=223851
Reviewed by Antti Koivisto.
We've had support for "hanging" and "each-line" behind the ENABLE_CSS3_TEXT flag. Probably by mistake,
"hanging" itself was parsed and Web-exposed by default. Presumably that was the case because that CSS
keyword existed in the context of SVG.
But LineWidth.cpp already knew how to handle these keywords, so there seems to be no reason to keep
these behind a flag.
So we remove all the ENABLE_CSS3_TEXT guards related to they keywords and address some spec compliance
issue, namely:
1. add the text-indent length or percentage, the "hanging" and "each-line" keywords in that order
in consumeTextIndent(),
2. use that same order for the computed style.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeTextIndent):
* layout/inlineformatting/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::initialConstraintsForLine const):
* rendering/line/LineWidth.cpp:
(WebCore::requiresIndent):
* rendering/style/RenderStyle.cpp:
(WebCore::rareInheritedDataChangeRequiresLayout):
* rendering/style/RenderStyle.h:
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):
* rendering/style/StyleRareInheritedData.h:
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyInheritTextIndent):
(WebCore::Style::BuilderCustom::applyInitialTextIndent):
(WebCore::Style::BuilderCustom::applyValueTextIndent):
2021-03-29 David Kilzer <ddkilzer@apple.com>
Remove unused struct WebCore::AlternativeTextController::AlternativeTextInfo
<https://webkit.org/b/223902>
Reviewed by Wenson Hsieh.
* editing/AlternativeTextController.h:
- Remove unused struct definition.
2021-03-29 Chris Dumez <cdumez@apple.com>
REGRESSION(r274992): Nullptr crash in FontCache::retrieveOrAddCachedFonts
https://bugs.webkit.org/show_bug.cgi?id=223858
<rdar://75883697>
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<WebCore::FontCascadeCacheKey>::emptyValue):
(WTF::HashTraits<WebCore::FontCascadeCacheKey>::constructDeletedValue):
(WTF::HashTraits<WebCore::FontCascadeCacheKey>::isDeletedValue):
2021-03-29 Devin Rousso <drousso@apple.com>
Propagate user gestures through `requestAnimationFrame` just like `setTimeout`
https://bugs.webkit.org/show_bug.cgi?id=223775
<rdar://problem/75860868>
Reviewed by Geoffrey Garen.
`setTimeout` and `requestAnimationFrame` are used somewhat interchangeably on the web.
There should be similar features/affordances for both so that if a developer decides to use
a display-linked animation "loop" instead of a strictly time-based delay (or even a "loop")
they're able to do similar things in the callback/handler.
Test: fast/animation/request-animation-frame-propagate-user-gesture.html
* dom/ScriptedAnimationController.h:
* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::resume):
(WebCore::ScriptedAnimationController::registerCallback):
(WebCore::ScriptedAnimationController::cancelCallback):
(WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks):
Create a private struct for holding more data in the list of callbacks than just the
callback itself. For now, the only other data saved is a `RefPtr<UserGestureToken>`.
* testing/Internals.idl:
* testing/Internals.h:
* testing/Internals.cpp:
(WebCore::Internals::withoutUserGesture): Added.
Add a way for tests to guaranteed run arbitrary code without a user gesture.
2021-03-29 Said Abou-Hallawa <said@apple.com>
[GPU Process] Don't record DisplayList items if the GPU Process has been terminated
https://bugs.webkit.org/show_bug.cgi?id=223864
<rdar://73586187>
Reviewed by Simon Fraser.
Consult the DisplayList::Recorder::Delegate before appending the item.
If the GPU Process was terminated, don't append the item.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::canAppendItemOfType):
(WebCore::DisplayList::Recorder::willAppendItemOfType): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.h:
(WebCore::DisplayList::Recorder::Delegate::canAppendItemOfType):
(WebCore::DisplayList::Recorder::append):
(WebCore::DisplayList::Recorder::Delegate::willAppendItemOfType): Deleted.
2021-03-29 ChangSeok Oh <changseok@webkit.org>
Implement repetition of animated AVIF
https://bugs.webkit.org/show_bug.cgi?id=223127
<rdar://problem/75629284>
Reviewed by Philippe Normand.
This change implements repeating AVIF animation, reflecting the AVIF sequence spec.
As the libavif does not provide a clear repetition count yet, we calculate it
by dividing the track duration by the sum of each frame duration. If the track duration
is not specified, the animation repeats indefinitely. Chromium just indefinitely
repeats all animated avif images.
The repetition count of avif sequence images is not necessarily an integer.
Since ScalableImageDecoder accepts an integer value for repetition,
we round the repetition count in floating point values to conform the current
image decoder design. Later, when we have more reliable testing environment
for the avifs repetition, we will revisit the repetition count in floating point numbers.
No new tests since no reliable test could be created. The latest avif encoder
does not support the repetition count yet.
* platform/image-decoders/avif/AVIFImageDecoder.cpp:
(WebCore::AVIFImageDecoder::repetitionCount const):
(WebCore::AVIFImageDecoder::tryDecodeSize):
* platform/image-decoders/avif/AVIFImageDecoder.h:
* platform/image-decoders/avif/AVIFImageReader.cpp:
(WebCore::AVIFImageReader::repetitionCount const):
* platform/image-decoders/avif/AVIFImageReader.h:
2021-03-29 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Simplify DisplayList::Iterator part 2: Rename setItemBufferClient to setItemBuffer{Writing,Reading}Client
https://bugs.webkit.org/show_bug.cgi?id=223863
Reviewed by Wenson Hsieh.
Currently, we have:
void setItemBufferClient(ItemBufferReadingClient*);
void setItemBufferClient(ItemBufferWritingClient*);
This is unfortunate, because if you want to set one of these clients to nullptr, you have to do:
setItemBufferClient(static_cast<ItemBufferReadingClient*>(nullptr));
Instead, we can just rename these functions to:
void setItemBufferReadingClient(ItemBufferReadingClient*);
void setItemBufferWritingClient(ItemBufferWritingClient*);
So you can just do
setItemBufferReadingClient(nullptr);
No new tests because there is no behavior change.
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::setItemBufferReadingClient):
(WebCore::DisplayList::DisplayList::setItemBufferWritingClient):
(WebCore::DisplayList::DisplayList::setItemBufferClient): Deleted.
* platform/graphics/displaylists/DisplayList.h:
2021-03-29 Eric Carlson <eric.carlson@apple.com>
[macOS] Playback is paused after scrubbing with the touch bar
https://bugs.webkit.org/show_bug.cgi?id=223887
rdar://75597684
Reviewed by Jer Noble.
Test: media/remote-control-command-scrubbing.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::pauseInternal): Don't pause if `m_pausedInternal` is true.
(WebCore::HTMLMediaElement::didReceiveRemoteControlCommand): Support BeginScrubbingCommand
and EndScrubbingCommand.
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::didReceiveRemoteControlCommand): Update enum names.
* platform/audio/PlatformMediaSession.cpp:
(WebCore::convertEnumerationToString): Ditto.
* platform/audio/PlatformMediaSession.h: Add "Command" suffix to BeginScrubbing
and EndScrubbing so they math the enum's naming pattern.
* platform/mac/WebPlaybackControlsManager.mm:
(-[WebPlaybackControlsManager beginTouchBarScrubbing]): Update enum names.
(-[WebPlaybackControlsManager endTouchBarScrubbing]): Update enum names.
* testing/Internals.cpp:
(WebCore::Internals::postRemoteControlCommand): Add "beginscrubbing" and "endscrubbing".
2021-03-29 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo] Custom fonts don't work in GPU process mode
https://bugs.webkit.org/show_bug.cgi?id=223861
Reviewed by Don Olmstead.
Custom fonts didn't work in GPU process mode of WinCairo port
because FontCustomPlatformData was destructed soon. In non-GPU
process mode, FontCustomPlatformData is retained by CachedFont. In
GPU process mode, there is no CachedFont. So, the font resource
handle should be ref-counted and retained by FontPlatformData.
Added a new class FontMemoryResource to ref-count the font
resource handle. Added a new member of Ref<FontMemoryResource> to
FontPlatformData::CreationData struct.
Converted by existing canvas custom font tests.
* PlatformWin.cmake:
* platform/graphics/FontPlatformData.h:
* platform/graphics/opentype/FontMemoryResource.h:
(WebCore::FontMemoryResource::create):
(WebCore::FontMemoryResource::~FontMemoryResource):
(WebCore::FontMemoryResource::FontMemoryResource):
* platform/graphics/opentype/OpenTypeUtilities.cpp:
(WebCore::renameAndActivateFont):
* platform/graphics/opentype/OpenTypeUtilities.h:
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::FontCustomPlatformData):
(WebCore::FontCustomPlatformData::fontPlatformData):
(WebCore::createFontCustomPlatformData):
(WebCore::FontCustomPlatformData::~FontCustomPlatformData): Deleted.
* platform/graphics/win/FontCustomPlatformData.h:
(WebCore::FontCustomPlatformData::FontCustomPlatformData): Deleted.
* platform/graphics/win/FontCustomPlatformDataCairo.cpp:
(WebCore::FontCustomPlatformData::FontCustomPlatformData):
(WebCore::createFontCustomPlatformData):
(WebCore::FontCustomPlatformData::~FontCustomPlatformData): Deleted.
* platform/graphics/win/FontPlatformDataWin.cpp:
(WebCore::FontPlatformData::FontPlatformData):
2021-03-29 Eric Carlson <eric.carlson@apple.com>
[macOS] Add remote MediaSessionCoordinator
https://bugs.webkit.org/show_bug.cgi?id=223854
<rdar://problem/75934650>
Reviewed by Jer Noble.
Rename PlatformMediaSessionCoordinator to MediaSessionCoordinatorPrivate and make
it possible for the MediaSessionCoordinator implementation to be located in another
process.
* Modules/mediasession/MediaPositionState.h:
(WebCore::MediaPositionState::encode const):
(WebCore::MediaPositionState::decode):
* Modules/mediasession/MediaSession.cpp:
* Modules/mediasession/MediaSession.h:
* Modules/mediasession/MediaSessionActionHandler.h:
* Modules/mediasession/MediaSessionCoordinator.cpp:
(WebCore::MediaSessionCoordinator::create):
(WebCore::MediaSessionCoordinator::MediaSessionCoordinator):
(WebCore::MediaSessionCoordinator::seekTo):
(WebCore::MediaSessionCoordinator::play):
(WebCore::MediaSessionCoordinator::pause):
(WebCore::MediaSessionCoordinator::setTrack):
(WebCore::MediaSessionCoordinator::positionStateChanged):
(WebCore::MediaSessionCoordinator::playbackStateChanged):
(WebCore::MediaSessionCoordinator::readyStateChanged):
(WebCore::MediaSessionCoordinator::seekSessionToTime):
(WebCore::MediaSessionCoordinator::playSession):
(WebCore::MediaSessionCoordinator::pauseSession):
(WebCore::MediaSessionCoordinator::setSessionTrack):
(WebCore::MediaSessionCoordinator::internalSeekTo):
(WebCore::MediaSessionCoordinator::internalPlay):
(WebCore::MediaSessionCoordinator::internalPause):
(WebCore::MediaSessionCoordinator::internalSetTrack):
* Modules/mediasession/MediaSessionCoordinator.h:
* Modules/mediasession/MediaSessionCoordinatorPrivate.cpp: Copied from Source/WebCore/platform/graphics/PlatformMediaSessionCoordinator.cpp
(WebCore::MediaSessionCoordinatorPrivate::setLogger):
* Modules/mediasession/MediaSessionCoordinatorPrivate.h: Copied from Source/WebCore/platform/graphics/PlatformMediaSessionCoordinator.h
(WebCore::MediaSessionCoordinatorPrivate::setClient):
(WebCore::MediaSessionCoordinatorPrivate::loggerPtr const):
(WebCore::MediaSessionCoordinatorPrivate::logIdentifier const):
(WebCore::MediaSessionCoordinatorPrivate::client const):
* Modules/mediasession/MediaSessionPlaybackState.h:
* Modules/mediasession/MediaSessionReadyState.h:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/audio/PlatformMediaSession.h:
* platform/graphics/PlatformMediaSessionCoordinator.cpp: Removed.
* platform/graphics/PlatformMediaSessionCoordinator.h: Removed.
* testing/MockMediaSessionCoordinator.cpp:
(WebCore::MockMediaSessionCoordinator::seekTo):
(WebCore::MockMediaSessionCoordinator::play):
(WebCore::MockMediaSessionCoordinator::pause):
(WebCore::MockMediaSessionCoordinator::setTrack):
(WebCore::MockMediaSessionCoordinator::positionStateChanged):
(WebCore::MockMediaSessionCoordinator::readyStateChanged):
(WebCore::MockMediaSessionCoordinator::playbackStateChanged):
(WebCore::MockMediaSessionCoordinator::logChannel const):
* testing/MockMediaSessionCoordinator.h:
(WebCore::MockMediaSessionCoordinator::logClassName const):
2021-03-29 Devin Rousso <drousso@apple.com>
[Payment Request] move added `object data` to `ApplePayModifier`
https://bugs.webkit.org/show_bug.cgi?id=223621
<rdar://problem/75720879>
Reviewed by Wenson Hsieh.
The `object data` in `PaymentDetailsModifier` has a sibling property `required DOMString supportedMethods`
which acts as a "guard" to make sure that the structure of `data` is only limited to that `supportedMethods`
meaning that there's no concern over naming collisions between two different `supportedMethods`. As such,
the `object data` added to `PaymentItem` and `PaymentDetailsBase` and `PaymentShippingOption` should really
be part of `ApplePayModifier` (which is what the `object data` in `PaymentDetailsModifier` is parsed into).
* Modules/applepay/paymentrequest/ApplePayModifier.idl:
* Modules/applepay/paymentrequest/ApplePayModifier.h:
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
(WebCore::convertAndValidate):
(WebCore::merge):
(WebCore::ApplePayPaymentHandler::show):
(WebCore::ApplePayPaymentHandler::computeShippingMethods const):
(WebCore::ApplePayPaymentHandler::computeTotalAndLineItems const):
(WebCore::validate):
(WebCore::ApplePayPaymentHandler::firstApplicableModifier const): Added.
(WebCore::ApplePayPaymentHandler::shippingAddressUpdated):
(WebCore::ApplePayPaymentHandler::shippingOptionUpdated):
(WebCore::ApplePayPaymentHandler::paymentMethodUpdated):
Instead of validating and merging data from the various `ApplePay*Data` objects, get the
first applicable `ApplePayModifier` from the list of `PaymentDetailsModifier` and use that
for validation and data merging (since, as explained above, it now contains the data).
* Modules/paymentrequest/PaymentDetailsBase.idl:
* Modules/paymentrequest/PaymentDetailsBase.h:
* Modules/paymentrequest/PaymentItem.idl:
* Modules/paymentrequest/PaymentItem.h:
* Modules/paymentrequest/PaymentShippingOption.idl:
* Modules/paymentrequest/PaymentShippingOption.h:
* Modules/paymentrequest/PaymentRequest.cpp:
(WebCore::checkAndCanonicalizePaymentItem):
(WebCore::checkAndCanonicalizeTotal):
(WebCore::checkAndCanonicalizeDetails):
(WebCore::PaymentRequest::create):
(WebCore::PaymentRequest::settleDetailsPromise):
Remove the IDL `object data;` and associated members/logic now that the parsed data is all
part of `ApplePayModifier`. These objects are now back to being spec compliant.
* Modules/applepay/ApplePayDetailsUpdateBase.idl:
Drive-by: Add missing inheritance to `ApplePayDetailsUpdateData`.
* Modules/applepay/ApplePayLineItemData.idl:
* Modules/applepay/ApplePayShippingMethodData.idl:
Drive-by: Remove unnecessary attributes.
2021-03-29 Ian Gilbert <iang@apple.com>
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-29 Alex Christensen <achristensen@webkit.org>
Build fix.
* platform/graphics/SourceBufferPrivateClient.h:
I have a build that can't find the MediaDescription destructor from the AudioTrackInformation declaration.
Including MediaDescription.h fixes it.
2021-03-29 Frédéric Wang <fwang@igalia.com>
Release assert in Vector::at in RenderLayoutState::establishLineGrid
https://bugs.webkit.org/show_bug.cgi?id=223368
Reviewed by Zalan Bujtas.
Fix out-of-bound access for layoutStateStack and ensure the whole vector is browsed.
Test: fast/line-grid/establish-line-grid-crash.html
* rendering/RenderLayoutState.cpp:
(WebCore::RenderLayoutState::establishLineGrid): Fix the exit condition.
2021-03-28 Simon Fraser <simon.fraser@apple.com>
Plumb DisplayUpdate through the display refresh monitors
https://bugs.webkit.org/show_bug.cgi?id=223847
Reviewed by Sam Weinig.
Future work will allow DisplayRefreshMonitorClients to request different frame rates, which
are whole fractions of the display's nominal refresh rate. These various frame rate requests
flow up through the DisplayRefreshMonitors, and in WebKit2, up through IPC to the
per-display DisplayLink which may even service multiple processes.
For power reasons, we don't want to trigger display refresh notifications down the chain at
the highest possible frequency; at various stages of propagation the rate might be halved if
that's necessary for downstream clients.
To make this frequency splitting logic simple, this patch introduces DisplayUpdate, which
represents an update of the display, and contains data about it in the form of a numerator
is the frame index, and the denominator is the nominal frame rate. Frame index wraps to zero
every second.
For example, a 60Hz display will generate display refreshes with DisplayUpdates which
sequentially will be { 0, 60 }, { 1, 60 }, { 2, 60 } ... { 59, 60 }, { 0, 60 }. The
zeroth frame is at some arbitrary time and not aligned with wallclock time.
Thus a client with a 30Hz update requirement can simply ignore every odd-numbered frame, and
a client downstream from it with a 15Hz requirement, which only receives those even-numbered
frames, still has enough information to compute which frames to ignore.
Classes which are sources of callbacks for DisplayRefreshMonitor need to generate these
DisplayUpdates; that includes the various platform DisplayRefreshMonitor subclasses in
WebCore, and those in WebKit that live in the UI process and trigger updates over IPC.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* loader/EmptyClients.cpp:
* platform/graphics/AnimationFrameRate.cpp:
* platform/graphics/AnimationFrameRate.h:
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::displayLinkFired):
(WebCore::DisplayRefreshMonitor::dispatchDisplayDidRefresh):
(WebCore::DisplayRefreshMonitor::displayDidRefresh):
* platform/graphics/DisplayRefreshMonitor.h:
* platform/graphics/DisplayRefreshMonitorManager.cpp:
(WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
* platform/graphics/DisplayRefreshMonitorManager.h:
* platform/graphics/DisplayUpdate.cpp: Copied from Source/WebCore/platform/graphics/win/DisplayRefreshMonitorWin.h.
(WebCore::operator<<):
* platform/graphics/DisplayUpdate.h: Copied from Source/WebCore/platform/graphics/gtk/DisplayRefreshMonitorGtk.h.
(WebCore::DisplayUpdate::didUpdate):
(WebCore::DisplayUpdate::encode const):
(WebCore::DisplayUpdate::decode):
* platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp: Assume a 60fps refresh rate but this code
should probably use gdk_frame_clock_get_refresh_info() to get the correct rate.
(WebCore::onFrameClockUpdate):
(WebCore::DisplayRefreshMonitorGtk::displayLinkCallbackFired):
(WebCore::DisplayRefreshMonitorGtk::startNotificationMechanism):
* platform/graphics/gtk/DisplayRefreshMonitorGtk.h:
* platform/graphics/ios/DisplayRefreshMonitorIOS.h:
* platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
(-[WebDisplayLinkHandler initWithMonitor:]):
(-[WebDisplayLinkHandler handleDisplayLink:]):
(WebCore::DisplayRefreshMonitorIOS::displayLinkCallbackFired):
(WebCore::DisplayRefreshMonitorIOS::startNotificationMechanism):
(-[WebDisplayLinkHandler setPreferredFramesPerSecond:]): Deleted.
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp:
(WebCore::displayLinkCallback):
(WebCore::LegacyDisplayRefreshMonitorMac::displayLinkCallbackFired):
(WebCore::LegacyDisplayRefreshMonitorMac::dispatchDisplayDidRefresh):
(WebCore::LegacyDisplayRefreshMonitorMac::nominalFramesPerSecondFromDisplayLink):
(WebCore::LegacyDisplayRefreshMonitorMac::startNotificationMechanism):
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.h:
(WebCore::LegacyDisplayRefreshMonitorMac::currentUpdate const):
* platform/graphics/win/DisplayRefreshMonitorWin.cpp:
(WebCore::DisplayRefreshMonitorWin::DisplayRefreshMonitorWin):
(WebCore::DisplayRefreshMonitorWin::displayLinkCallbackFired):
* platform/graphics/win/DisplayRefreshMonitorWin.h:
2021-03-29 Aditya Keerthi <akeerthi@apple.com>
Use enum classes and OptionSets for ControlStates::States
https://bugs.webkit.org/show_bug.cgi?id=223647
Reviewed by Sam Weinig.
No behavior change.
* dom/Element.cpp:
(WebCore::Element::setActive):
(WebCore::Element::setHovered):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::focusedOrActiveStateChanged):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::disabledStateChanged):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setChecked):
(WebCore::HTMLInputElement::setIndeterminate):
* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::parseAttribute):
* platform/ControlStates.h:
(WebCore::ControlStates::ControlStates):
(WebCore::ControlStates::states const):
(WebCore::ControlStates::setStates):
* platform/adwaita/ThemeAdwaita.cpp:
(WebCore::ThemeAdwaita::paintCheckbox):
(WebCore::ThemeAdwaita::paintRadio):
(WebCore::ThemeAdwaita::paintButton):
(WebCore::ThemeAdwaita::paintSpinButton):
* platform/mac/ThemeMac.mm:
(WebCore::updateStates):
(WebCore::paintToggleButton):
(WebCore::button):
(WebCore::paintButton):
(WebCore::paintStepper):
(WebCore::ThemeMac::ensuredView):
(WebCore::paintColorWell):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::stateChanged const):
(WebCore::RenderTheme::extractControlStatesForRenderer const):
* rendering/RenderTheme.h:
* rendering/RenderThemeAdwaita.cpp:
(WebCore::RenderThemeAdwaita::paintMenuList):
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::checkboxRadioBackgroundColor):
(WebCore::RenderThemeIOS::checkboxRadioIndicatorColor):
(WebCore::RenderThemeIOS::paintCheckbox):
(WebCore::RenderThemeIOS::paintRadio):
2021-03-28 Antoine Quint <graouts@webkit.org>
Add support for animating the vertical-align CSS property
https://bugs.webkit.org/show_bug.cgi?id=223853
Reviewed by Antti Koivisto.
Adding support for animating vertical-align revealed a couple of long-standing issues with
regards to our support for this property.
First off, we didn't honor the "inherit" value since it required a custom builder method
to deal with both RenderStyle::verticalAlign() (the type) and RenderStyle::verticalAlignLength()
(the value).
Then, we would hit an assertion when obtaining the computed style for this property and a
calculated value since we didn't pass the RenderStyle to createValue().
We now correctly interpolate this property per the dedicated WPT test, the only issues remaining
being about how our calc serialization (https://bugs.webkit.org/show_bug.cgi?id=223875).
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSProperties.json:
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyInheritVerticalAlign):
2021-03-28 Sam Weinig <weinig@apple.com>
Remove JSCustomXPathNSResolver.h/JSCustomXPathNSResolver.cpp from the Xcode project as they don't exist
https://bugs.webkit.org/show_bug.cgi?id=223852
Reviewed by Simon Fraser.
* WebCore.xcodeproj/project.pbxproj:
Remove long deleted files.
2021-03-28 Jer Noble <jer.noble@apple.com>
[Cocoa] Exception thrown from -setShouldProvideMediaDataForTrackID:
https://bugs.webkit.org/show_bug.cgi?id=223859
<rdar://75936746>
Reviewed by Eric Carlson.
Protect against undocumented exceptions thrown from -setShouldProvideMediaDataForTrackID:.
* platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.mm:
(WebCore::SourceBufferParserAVFObjC::setShouldProvideMediaDataForTrackID):
2021-03-28 Sam Weinig <weinig@apple.com>
Remove ENABLE_INDEXED_DATABASE & ENABLE_INDEXED_DATABASE_IN_WORKERS, it seems like it is on for all ports
https://bugs.webkit.org/show_bug.cgi?id=223810
Reviewed by Simon Fraser.
Remove ENABLE_INDEXED_DATABASE & ENABLE_INDEXED_DATABASE_IN_WORKERS conditionals.
* Modules/indexeddb/DOMWindow+IndexedDatabase.idl:
* Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
* Modules/indexeddb/DOMWindowIndexedDatabase.h:
* Modules/indexeddb/IDBActiveDOMObject.h:
* Modules/indexeddb/IDBCursor.cpp:
* Modules/indexeddb/IDBCursor.h:
* Modules/indexeddb/IDBCursor.idl:
* Modules/indexeddb/IDBCursorDirection.idl:
* Modules/indexeddb/IDBCursorWithValue.cpp:
* Modules/indexeddb/IDBCursorWithValue.h:
* Modules/indexeddb/IDBCursorWithValue.idl:
* Modules/indexeddb/IDBDatabase.cpp:
* Modules/indexeddb/IDBDatabase.h:
* Modules/indexeddb/IDBDatabase.idl:
* Modules/indexeddb/IDBDatabaseIdentifier.cpp:
* Modules/indexeddb/IDBDatabaseIdentifier.h:
* Modules/indexeddb/IDBDatabaseNameAndVersionRequest.cpp:
* Modules/indexeddb/IDBDatabaseNameAndVersionRequest.h:
* Modules/indexeddb/IDBFactory.cpp:
* Modules/indexeddb/IDBFactory.h:
* Modules/indexeddb/IDBFactory.idl:
* Modules/indexeddb/IDBGetAllResult.cpp:
* Modules/indexeddb/IDBGetAllResult.h:
* Modules/indexeddb/IDBGetResult.cpp:
* Modules/indexeddb/IDBGetResult.h:
* Modules/indexeddb/IDBIndex.cpp:
* Modules/indexeddb/IDBIndex.h:
* Modules/indexeddb/IDBIndex.idl:
* Modules/indexeddb/IDBKey.cpp:
* Modules/indexeddb/IDBKey.h:
* Modules/indexeddb/IDBKeyData.cpp:
* Modules/indexeddb/IDBKeyData.h:
* Modules/indexeddb/IDBKeyPath.cpp:
* Modules/indexeddb/IDBKeyPath.h:
* Modules/indexeddb/IDBKeyRange.cpp:
* Modules/indexeddb/IDBKeyRange.h:
* Modules/indexeddb/IDBKeyRange.idl:
* Modules/indexeddb/IDBKeyRangeData.cpp:
* Modules/indexeddb/IDBKeyRangeData.h:
* Modules/indexeddb/IDBObjectStore.cpp:
* Modules/indexeddb/IDBObjectStore.h:
* Modules/indexeddb/IDBObjectStore.idl:
* Modules/indexeddb/IDBOpenDBRequest.cpp:
* Modules/indexeddb/IDBOpenDBRequest.h:
* Modules/indexeddb/IDBOpenDBRequest.idl:
* Modules/indexeddb/IDBRecordIdentifier.h:
* Modules/indexeddb/IDBRequest.cpp:
* Modules/indexeddb/IDBRequest.h:
* Modules/indexeddb/IDBRequest.idl:
* Modules/indexeddb/IDBRequestCompletionEvent.cpp:
* Modules/indexeddb/IDBRequestCompletionEvent.h:
* Modules/indexeddb/IDBTransaction.cpp:
* Modules/indexeddb/IDBTransaction.h:
* Modules/indexeddb/IDBTransaction.idl:
* Modules/indexeddb/IDBTransactionMode.h:
* Modules/indexeddb/IDBTransactionMode.idl:
* Modules/indexeddb/IDBValue.cpp:
* Modules/indexeddb/IDBValue.h:
* Modules/indexeddb/IDBVersionChangeEvent.cpp:
* Modules/indexeddb/IDBVersionChangeEvent.h:
* Modules/indexeddb/IDBVersionChangeEvent.idl:
* Modules/indexeddb/IndexedDB.h:
* Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp:
* Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h:
* Modules/indexeddb/client/IDBConnectionProxy.cpp:
* Modules/indexeddb/client/IDBConnectionProxy.h:
* Modules/indexeddb/client/IDBConnectionToServer.cpp:
* Modules/indexeddb/client/IDBConnectionToServer.h:
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
* Modules/indexeddb/client/TransactionOperation.cpp:
* Modules/indexeddb/client/TransactionOperation.h:
* Modules/indexeddb/server/IDBBackingStore.h:
* Modules/indexeddb/server/IDBConnectionToClient.cpp:
* Modules/indexeddb/server/IDBConnectionToClient.h:
* Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
* Modules/indexeddb/server/IDBSerialization.cpp:
* Modules/indexeddb/server/IDBSerialization.h:
* Modules/indexeddb/server/IDBSerializationContext.cpp:
* Modules/indexeddb/server/IDBSerializationContext.h:
* Modules/indexeddb/server/IDBServer.cpp:
* Modules/indexeddb/server/IDBServer.h:
* Modules/indexeddb/server/IndexValueEntry.cpp:
* Modules/indexeddb/server/IndexValueEntry.h:
* Modules/indexeddb/server/IndexValueStore.cpp:
* Modules/indexeddb/server/IndexValueStore.h:
* Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
* Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
* Modules/indexeddb/server/MemoryCursor.cpp:
* Modules/indexeddb/server/MemoryCursor.h:
* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
* Modules/indexeddb/server/MemoryIDBBackingStore.h:
* Modules/indexeddb/server/MemoryIndex.cpp:
* Modules/indexeddb/server/MemoryIndex.h:
* Modules/indexeddb/server/MemoryIndexCursor.cpp:
* Modules/indexeddb/server/MemoryIndexCursor.h:
* Modules/indexeddb/server/MemoryObjectStore.cpp:
* Modules/indexeddb/server/MemoryObjectStore.h:
* Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:
* Modules/indexeddb/server/MemoryObjectStoreCursor.h:
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:
* Modules/indexeddb/server/SQLiteIDBCursor.cpp:
* Modules/indexeddb/server/SQLiteIDBCursor.h:
* Modules/indexeddb/server/SQLiteIDBTransaction.cpp:
* Modules/indexeddb/server/SQLiteIDBTransaction.h:
* Modules/indexeddb/server/ServerOpenDBRequest.cpp:
* Modules/indexeddb/server/ServerOpenDBRequest.h:
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
* Modules/indexeddb/server/UniqueIDBDatabase.h:
* Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
* Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
* Modules/indexeddb/shared/IDBCursorInfo.cpp:
* Modules/indexeddb/shared/IDBCursorInfo.h:
* Modules/indexeddb/shared/IDBCursorRecord.h:
* Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
* Modules/indexeddb/shared/IDBDatabaseInfo.h:
* Modules/indexeddb/shared/IDBDatabaseNameAndVersion.h:
* Modules/indexeddb/shared/IDBError.cpp:
* Modules/indexeddb/shared/IDBError.h:
* Modules/indexeddb/shared/IDBGetAllRecordsData.cpp:
* Modules/indexeddb/shared/IDBGetAllRecordsData.h:
* Modules/indexeddb/shared/IDBGetRecordData.cpp:
* Modules/indexeddb/shared/IDBGetRecordData.h:
* Modules/indexeddb/shared/IDBIndexInfo.cpp:
* Modules/indexeddb/shared/IDBIndexInfo.h:
* Modules/indexeddb/shared/IDBIterateCursorData.cpp:
* Modules/indexeddb/shared/IDBIterateCursorData.h:
* Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
* Modules/indexeddb/shared/IDBObjectStoreInfo.h:
* Modules/indexeddb/shared/IDBRequestData.cpp:
* Modules/indexeddb/shared/IDBRequestData.h:
* Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
* Modules/indexeddb/shared/IDBResourceIdentifier.h:
* Modules/indexeddb/shared/IDBResultData.cpp:
* Modules/indexeddb/shared/IDBResultData.h:
* Modules/indexeddb/shared/IDBTransactionInfo.cpp:
* Modules/indexeddb/shared/IDBTransactionInfo.h:
* Modules/indexeddb/shared/IndexKey.cpp:
* Modules/indexeddb/shared/IndexKey.h:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/IDBBindingUtilities.cpp:
* bindings/js/IDBBindingUtilities.h:
* bindings/js/JSDOMConvertIndexedDB.h:
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::scriptExecutionContext const):
(WebCore::scriptModuleLoader):
* bindings/js/JSIDBCursorCustom.cpp:
* bindings/js/JSIDBCursorWithValueCustom.cpp:
* bindings/js/JSIDBIndexCustom.cpp:
* bindings/js/JSIDBObjectStoreCustom.cpp:
* bindings/js/JSIDBRequestCustom.cpp:
* bindings/js/JSIDBSerializationGlobalObject.cpp:
* bindings/js/JSIDBSerializationGlobalObject.h:
* bindings/js/JSIDBTransactionCustom.cpp:
* bindings/js/SerializedScriptValue.cpp:
* bindings/js/SerializedScriptValue.h:
* bindings/js/WebCoreJSClientData.cpp:
(WebCore::JSVMClientData::JSVMClientData):
* bindings/js/WebCoreJSClientData.h:
* dom/Document.cpp:
(WebCore::Document::idbConnectionProxy):
(WebCore::Document::setBackForwardCacheState):
* dom/Document.h:
* dom/EmptyScriptExecutionContext.h:
* dom/EventNames.in:
* dom/EventTargetFactory.in:
* dom/ScriptExecutionContext.h:
* inspector/InspectorController.cpp:
(WebCore::InspectorController::createLazyAgents):
* inspector/agents/InspectorIndexedDBAgent.cpp:
* inspector/agents/InspectorIndexedDBAgent.h:
* loader/EmptyClients.cpp:
* page/DatabaseProvider.h:
* page/Page.cpp:
(WebCore::Page::setSessionID):
(WebCore::Page::clearIDBConnection):
* page/Page.h:
* testing/Internals.cpp:
(WebCore::Internals::numberOfIDBTransactions const):
* testing/Internals.h:
* testing/Internals.idl:
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::WorkerGlobalScope):
(WebCore::WorkerGlobalScope::prepareForDestruction):
(WebCore::WorkerGlobalScope::idbConnectionProxy):
(WebCore::WorkerGlobalScope::stopIndexedDatabase):
(WebCore::WorkerGlobalScope::suspend):
(WebCore::WorkerGlobalScope::resume):
* workers/WorkerGlobalScope.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
* workers/WorkerThread.cpp:
(WebCore::WorkerThread::WorkerThread):
(WebCore::WorkerThread::idbConnectionProxy):
* workers/WorkerThread.h:
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::idbConnectionProxy):
* worklets/WorkletGlobalScope.h:
2021-03-28 Philippe Normand <pnormand@igalia.com>
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-03-28 Chris Dumez <cdumez@apple.com>
Unreviewed, add an exception for a heap allocation on the WebAudio thread.
I recently added assertions to catch heap allocations on the WebAudio threads and failed to
mark this one as allowed (for now).
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::markForDeletion):
2021-03-27 Simon Fraser <simon.fraser@apple.com>
Allow DisplayRefreshMonitor to be more long-lived objects
https://bugs.webkit.org/show_bug.cgi?id=223844
Reviewed by Chris Dumez.
The existing behavior for DisplayRefreshMonitors was that they were created and destroyed
frequently, as their clients are registered and unregistered. In addition, some of
their subclasses had duplicated logic related to how often they fired without clients
before they were removed.
The 1:1 correspondance between DisplayRefreshMonitors and physical displays makes them
a useful place to store per-display information (like refresh rate), which should
persist whether or not they have clients, so this change prepares for that.
The main changes in this patch are:
1. Provide virtual startNotificationMechanism()/stopNotificationMechanism() functions on
DisplayRefreshMonitor that subclasses can use to start their CVDisplayLink or related
functionality.
2. Provide some shared maxUnscheduledFireCount logic that subclasses can tune to
provide the hysteresis used to control the start/stop of the underlying
notification mechanism.
3. Provide a shared dispatchDisplayDidRefresh() function that most implementations
can use.
DisplayRefreshMonitorManager no longer destroys DisplayRefreshMonitors when they lose
all their clients. This means that DisplayRefreshMonitors are never removed, but there
should only ever be as many as there are physical displays, and they are only
active if being scheduled by clients.
* loader/EmptyClients.cpp:
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::stop):
(WebCore::DisplayRefreshMonitor::removeClient):
(WebCore::DisplayRefreshMonitor::requestRefreshCallback):
(WebCore::DisplayRefreshMonitor::firedAndReachedMaxUnscheduledFireCount):
(WebCore::DisplayRefreshMonitor::displayLinkFired):
(WebCore::DisplayRefreshMonitor::dispatchDisplayDidRefresh):
(WebCore::DisplayRefreshMonitor::displayDidRefresh):
* platform/graphics/DisplayRefreshMonitor.h:
(WebCore::DisplayRefreshMonitor::setMaxUnscheduledFireCount):
(WebCore::DisplayRefreshMonitor::mutex):
(WebCore::DisplayRefreshMonitor::displayLinkFired): Deleted.
(WebCore::DisplayRefreshMonitor::stop): Deleted.
(WebCore::DisplayRefreshMonitor::shouldBeTerminated const): Deleted.
(WebCore::DisplayRefreshMonitor::isActive const): Deleted.
(WebCore::DisplayRefreshMonitor::setIsActive): Deleted.
* platform/graphics/DisplayRefreshMonitorManager.cpp:
(WebCore::DisplayRefreshMonitorManager::unregisterClient):
(WebCore::DisplayRefreshMonitorManager::displayDidRefresh):
(WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
* platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp:
(WebCore::DisplayRefreshMonitorGtk::~DisplayRefreshMonitorGtk):
(WebCore::onFrameClockUpdate):
(WebCore::DisplayRefreshMonitorGtk::stop):
(WebCore::DisplayRefreshMonitorGtk::startNotificationMechanism):
(WebCore::DisplayRefreshMonitorGtk::stopNotificationMechanism):
(WebCore::DisplayRefreshMonitorGtk::requestRefreshCallback): Deleted.
(WebCore::DisplayRefreshMonitorGtk::displayLinkFired): Deleted.
* platform/graphics/gtk/DisplayRefreshMonitorGtk.h:
* platform/graphics/ios/DisplayRefreshMonitorIOS.h:
* platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
(-[WebDisplayLinkHandler setPaused:]):
(WebCore::DisplayRefreshMonitorIOS::DisplayRefreshMonitorIOS):
(WebCore::DisplayRefreshMonitorIOS::~DisplayRefreshMonitorIOS):
(WebCore::DisplayRefreshMonitorIOS::stop):
(WebCore::DisplayRefreshMonitorIOS::startNotificationMechanism):
(WebCore::DisplayRefreshMonitorIOS::stopNotificationMechanism):
(WebCore::DisplayRefreshMonitorIOS::requestRefreshCallback): Deleted.
(WebCore::DisplayRefreshMonitorIOS::displayLinkFired): Deleted.
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp:
(WebCore::LegacyDisplayRefreshMonitorMac::LegacyDisplayRefreshMonitorMac):
(WebCore::LegacyDisplayRefreshMonitorMac::stop):
(WebCore::LegacyDisplayRefreshMonitorMac::dispatchDisplayDidRefresh):
(WebCore::LegacyDisplayRefreshMonitorMac::startNotificationMechanism):
(WebCore::LegacyDisplayRefreshMonitorMac::stopNotificationMechanism):
(WebCore::LegacyDisplayRefreshMonitorMac::requestRefreshCallback): Deleted.
(WebCore::LegacyDisplayRefreshMonitorMac::displayLinkFired): Deleted.
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.h:
* platform/graphics/win/DisplayRefreshMonitorWin.cpp:
(WebCore::DisplayRefreshMonitorWin::DisplayRefreshMonitorWin):
(WebCore::DisplayRefreshMonitorWin::startNotificationMechanism):
(WebCore::DisplayRefreshMonitorWin::stopNotificationMechanism):
(WebCore::DisplayRefreshMonitorWin::requestRefreshCallback): Deleted.
(WebCore::DisplayRefreshMonitorWin::displayLinkFired): Deleted.
* platform/graphics/win/DisplayRefreshMonitorWin.h:
2021-03-27 Ryosuke Niwa <rniwa@webkit.org>
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-27 David Kilzer <ddkilzer@apple.com>
UBSan: runtime error: load of value <unknown>, which is not a valid value for type 'const WebCore::RealtimeMediaSourceCapabilities::EchoCancellation'
<https://webkit.org/b/223821>
Reviewed by Chris Dumez.
Tests: fast/mediastream/MediaDevices-addEventListener.html
fast/mediastream/constraint-intrinsic-size.html
http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute.html
http/tests/media/media-stream/get-display-media-iframe-allow-attribute.html
imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-bitrate.https.html
webrtc/addICECandidate-closed.html
webrtc/ice-candidate-sdpMLineIndex.html
webrtc/libwebrtc/descriptionGetters.html
webrtc/peerconnection-page-cache.html
* platform/mediastream/RealtimeMediaSourceCapabilities.h:
(WebCore::CapabilityValueOrRange::union ValueUnion):
- Make asDouble the first union member so C++ member
initializers set all memory.
(WebCore::CapabilityValueOrRange::m_minOrValue):
(WebCore::CapabilityValueOrRange::m_max):
(WebCore::CapabilityValueOrRange::m_type):
(WebCore::RealtimeMediaSourceCapabilities::m_echoCancellation):
- Provide member initializers. Setting a default value for
m_echoCancellation fixes the bug.
(WebCore::RealtimeMediaSourceCapabilities::encode const):
- Drive-by clean-up of encoder statement.
2021-03-27 Antoine Quint <graouts@webkit.org>
Fix build with ENABLE_CSS3_TEXT
https://bugs.webkit.org/show_bug.cgi?id=223841
Reviewed by Darin Adler.
We also remove the -webkit- prefix for the "hanging" and "each-line" keywords since
these are well specified by the CSS Text Module Level 3 spec.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeTextIndent):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setTextIndentType):
(WebCore::RenderStyle::setTextAlignLast):
(WebCore::RenderStyle::setTextJustify):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueTextIndent):
2021-03-27 Kate Cheney <katherine_cheney@apple.com>
PCM: Send report to both click source and attribution destination website
https://bugs.webkit.org/show_bug.cgi?id=223615
<rdar://problem/75849443>
Reviewed by Brent Fulgham.
Introduce 2 new structs for storing the earliest time to send and
seconds until send for the source and destination sites.
* loader/PrivateClickMeasurement.cpp:
(WebCore::PrivateClickMeasurement::isValid const):
(WebCore::PrivateClickMeasurement::hasPreviouslyBeenReported):
(WebCore::randomlyBetweenTwentyFourAndFortyEightHours):
(WebCore::PrivateClickMeasurement::attributeAndGetEarliestTimeToSend):
* loader/PrivateClickMeasurement.h:
(WebCore::PrivateClickMeasurement::AttributionSecondsUntilSendData::hasValidSecondsUntilSendValues):
(WebCore::PrivateClickMeasurement::AttributionSecondsUntilSendData::minSecondsUntilSend):
(WebCore::PrivateClickMeasurement::AttributionSecondsUntilSendData::encode const):
(WebCore::PrivateClickMeasurement::AttributionSecondsUntilSendData::decode):
(WebCore::PrivateClickMeasurement::AttributionTimeToSendData::earliestTimeToSend):
(WebCore::PrivateClickMeasurement::AttributionTimeToSendData::latestTimeToSend):
(WebCore::PrivateClickMeasurement::AttributionTimeToSendData::attributionReportEndpoint):
(WebCore::PrivateClickMeasurement::AttributionTimeToSendData::encode const):
(WebCore::PrivateClickMeasurement::AttributionTimeToSendData::decode):
(WebCore::PrivateClickMeasurement::timesToSend const):
(WebCore::PrivateClickMeasurement::setTimesToSend):
(WebCore::PrivateClickMeasurement::encode const):
(WebCore::PrivateClickMeasurement::decode):
(WebCore::PrivateClickMeasurement::earliestTimeToSend const): Deleted.
(WebCore::PrivateClickMeasurement::setEarliestTimeToSend): Deleted.
2021-03-27 Simon Fraser <simon.fraser@apple.com>
Remove DisplayRefreshMonitor::handleDisplayRefreshedNotificationOnMainThread()
https://bugs.webkit.org/show_bug.cgi?id=223837
Reviewed by Tim Horton.
handleDisplayRefreshedNotificationOnMainThread() is an anachronism left over from
the non-main-thread nature of the CVDisplayLink callback. There's no need to burden
all subclasses of DisplayRefreshMonitor with that detail.
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::displayDidRefresh):
(WebCore::DisplayRefreshMonitor::handleDisplayRefreshedNotificationOnMainThread): Deleted.
* platform/graphics/DisplayRefreshMonitor.h:
* platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp:
(WebCore::DisplayRefreshMonitorGtk::displayLinkFired):
* platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
(WebCore::DisplayRefreshMonitorIOS::displayLinkFired):
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp:
(WebCore::LegacyDisplayRefreshMonitorMac::displayLinkFired):
* platform/graphics/win/DisplayRefreshMonitorWin.cpp:
(WebCore::DisplayRefreshMonitorWin::displayLinkFired):
2021-03-27 Zalan Bujtas <zalan@apple.com>
[Multicolumn] Do not try to re-validate a multicol spanner when the renderer is moved internally
https://bugs.webkit.org/show_bug.cgi?id=223836
<rdar://75742694>
Reviewed by Ryosuke Niwa.
When a renderer becomes a multicol spanner
1. it is moved out of its original tree position and placed as a sibling of the enclosing multicolumn flow and
2. a spanner placeholder is constructed and inserted at the original position
This patch fixes the case when an already placed multicol spanner is internally moved (e.g. collapsing an anonymous block parent)
and we attempt to re-insert this spanner to the multicolumn flow. No spanner state should change due to internal re-parenting.
Test: fast/multicol/spanner-get-re-added-on-move-crash.html
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::attachToRenderElementInternal):
2021-03-26 Ian Gilbert <iang@apple.com>
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 Chris Dumez <cdumez@apple.com>
Avoid heap allocation on the audio thread in BaseAudioContext::scheduleNodeDeletion()
https://bugs.webkit.org/show_bug.cgi?id=223825
Reviewed by Darin Adler.
Avoid heap allocation on the audio thread in BaseAudioContext::scheduleNodeDeletion()
for performance. Stop calling appendVector() on m_nodesToDelete since m_nodesToDelete
is always empty. We can use std::exchange() instead of appendVector() and clear() to
avoid the heap allocation.
The reason m_nodesToDelete is always empty is that BaseAudioContext::scheduleNodeDeletion()
relies on the m_isDeletionScheduled flag to avoid adding to m_nodesToDelete until
m_nodesToDelete is cleared on the main thread and the m_isDeletionScheduled gets reset.
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::clear):
(WebCore::BaseAudioContext::scheduleNodeDeletion):
2021-03-26 Patrick Angle <pangle@apple.com>
Web Inspector: Grid layout labels can be drawn outside the viewport
https://bugs.webkit.org/show_bug.cgi?id=221972
Reviewed by BJ Burg.
Added logic for a best-effort attempt to make sure that layout labels are drawn within the document's bounds, or
at least within the grid itself. Labels are measured and adjusted so that if they would be drawn outside the
document's bounds, they will be pulled inside the grid. This does not guarantee that all labels will be visible
all the time. It is still possible an entire side of a grid will be outside the document's bounds, and this does
not attempt to correct for this case, as the desired anchor points for labels will be outside of the visible
area of the document.
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::fontForLayoutLabel):
- Added helper that creates the FontCascade for layout labels, which is done in a few different places.
(WebCore::InspectorOverlay::backgroundPathForLayoutLabel):
- Added helper to create the Path for the background of layout labels, which is now used in `WebKit::WKInspectorHighlightView`.
(WebCore::expectedSizeForLayoutLabel):
- Gets the expected size of the label based on the text and arrow direction, and does so without needing to
create the entire label background's path.
(WebCore::InspectorOverlay::drawLayoutLabel):
- Support new `LabelArrowEdgePosition` property
(WebCore::InspectorOverlay::drawGridOverlay):
(WebCore::buildLabel):
(WebCore::InspectorOverlay::buildGridOverlay):
* inspector/InspectorOverlay.h:
(WebCore::InspectorOverlay::Highlight::GridHighlightOverlay::Label::encode const):
(WebCore::InspectorOverlay::Highlight::GridHighlightOverlay::Label::decode):
2021-03-26 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] No need to update the counters when the renderer is moved internally
https://bugs.webkit.org/show_bug.cgi?id=223801
<rdar://75835208>
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-26 Chris Fleizach <cfleizach@apple.com>
AX: crash at aom.apple.WebCore: WebCore::AccessibilityProgressIndicator::element const
https://bugs.webkit.org/show_bug.cgi?id=223800
rdar://75861367
Reviewed by Zalan Bujtas.
Prevent unintended renderer access.
No steps to reproduce were available, so a test was not able to be created.
* accessibility/AccessibilityProgressIndicator.cpp:
(WebCore::AccessibilityProgressIndicator::element const):
2021-03-26 Chris Dumez <cdumez@apple.com>
Source/WebCore/editing/cocoa/HTMLConverter.mm:1278:44: runtime error: member call on null pointer of type 'WebCore::ArchiveResource'
https://bugs.webkit.org/show_bug.cgi?id=223696
Reviewed by Alex Christensen.
Fix bug found by UBSan.
* editing/cocoa/HTMLConverter.mm:
(HTMLConverter::_addAttachmentForElement):
- Drop duplicate call to dataSource->subresource(url) as it doesn't seem it can return something else
than null if it returned null the first time around.
- Make sure resource is null-checked before we dereference it to get the MIME type.
2021-03-26 Wenson Hsieh <wenson_hsieh@apple.com>
Allow some image overlay content to render in fully transparent image elements
https://bugs.webkit.org/show_bug.cgi?id=223781
<rdar://problem/75886351>
Reviewed by Tim Horton.
Introduce `ImageOverlayController`, and use it to render selections in image overlay content when the image
overlay's host element is fully transparent.
Test: fast/images/image-extraction/mac/select-word-in-transparent-image-overlay.html
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/Document.cpp:
(WebCore::Document::willBeRemovedFromFrame):
Add plumbing to allow `ImageOverlayController` to uninstall its `PageOverlay` when the document is about to be
detached. See `ImageOverlayController::` below.
* editing/SelectionRectGatherer.cpp:
(WebCore::SelectionRectGatherer::Notifier::~Notifier):
Have `SelectionRectGatherer` notify the image overlay controller as well, when selection rects change.
* page/ChromeClient.h:
(WebCore::ChromeClient::needsImageOverlayControllerForSelectionPainting const):
Add a new client hook that returns whether or not we should use `ImageOverlayController` to paint selections.
If not (i.e. we're on iOS, where we use UIKit to draw selections in the UI process), then we'll never install
page overlays, since `selectionRectsDidChange` is effectively a no-op.
* page/ImageOverlayController.cpp: Added.
(WebCore::ImageOverlayController::ImageOverlayController):
(WebCore::ImageOverlayController::selectionRectsDidChange):
When selection rects change, if the selection is inside an image overlay whose host is completely transparent
(or very close to being completely transparent), then remember the selection rects along with the renderer's
background color, and use this to render selection highlights separately, in a `PageOverlay`.
(WebCore::ImageOverlayController::documentDetached):
If the `Document` containing the current rendered overlay selection is detached, immediately uninstall the
current `PageOverlay`. This ensures that the overlays don't persist through navigation.
(WebCore::ImageOverlayController::installPageOverlayIfNeeded):
(WebCore::ImageOverlayController::uninstallPageOverlayIfNeeded):
Helper methods to add or remove the `PageOverlay` from the current `Page`.
(WebCore::ImageOverlayController::willMoveToPage):
Uninstall the current page overlay if needed.
(WebCore::ImageOverlayController::drawRect):
Use the information stored in `ImageOverlayController::selectionRectsDidChange` to render custom selection
rects.
* page/ImageOverlayController.h: Added.
* page/Page.cpp:
* page/Page.h:
Add an `ImageOverlayController` to the `Page`.
(WebCore::Page::imageOverlayController):
2021-03-26 Don Olmstead <don.olmstead@sony.com>
[CMake] Deprecate using DERIVED_SOURCES_DIR/FOWARDING_HEADERS_DIR directly
https://bugs.webkit.org/show_bug.cgi?id=223763
Reviewed by Michael Catanzaro.
Remove any usages of DERIVED_SOURCES_DIR and FOWARDING_HEADERS_DIR.
* PlatformFTW.cmake:
* PlatformWin.cmake:
2021-03-26 Tim Nguyen <ntim@apple.com>
Make the object-position CSS property animatable.
https://bugs.webkit.org/show_bug.cgi?id=223568
Reviewed by Antoine Quint.
Test: imported/w3c/web-platform-tests/css/css-images/object-position-interpolation.html
* animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
(WebCore::canInterpolateLengthPoints):
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
2021-03-26 Said Abou-Hallawa <said@apple.com>
Allow logging minimal info about uploading media files in the system diagnose
https://bugs.webkit.org/show_bug.cgi?id=223706
Reviewed by Alex Christensen.
Give the WebKit client the ability to log info about the media files which
were submitted to a web server through an HTMLFormElement.
* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::submit):
* loader/EmptyClients.cpp:
* page/DiagnosticLoggingClient.h:
* page/DiagnosticLoggingDomain.h: Copied from Source/WebKit/UIProcess/API/APIDiagnosticLoggingClient.h.
2021-03-26 Imanol Fernandez <ifernandez@igalia.com>
Implement cachedPropertyValue for WebXR [SameObject] attributes
https://bugs.webkit.org/show_bug.cgi?id=223635
Reviewed by Chris Dumez.
[SameObject] is not currently implemented in WebKit. We need to implement custom getters.
Tested by WebXR WPT.
* Modules/webxr/WebXRRigidTransform.h:
(WebCore::WebXRRigidTransform::cachedMatrix):
* Modules/webxr/WebXRRigidTransform.idl:
* Modules/webxr/WebXRView.h:
(WebCore::WebXRView::cachedProjectionMatrix):
* Modules/webxr/WebXRView.idl:
* Modules/webxr/WebXRViewerPose.h:
(WebCore::WebXRViewerPose::cachedViews):
* Modules/webxr/WebXRViewerPose.idl:
* Sources.txt:
* bindings/js/JSWebXRRigidTransformCustom.cpp: Added.
(WebCore::JSWebXRRigidTransform::matrix const):
* bindings/js/JSWebXRViewCustom.cpp: Added.
(WebCore::JSWebXRView::projectionMatrix const):
* bindings/js/JSWebXRViewerPoseCustom.cpp: Added.
(WebCore::JSWebXRViewerPose::views const):
2021-03-26 Devin Rousso <drousso@apple.com>
Adopt AVKit SPI for hiding touch bar seeking controls
https://bugs.webkit.org/show_bug.cgi?id=223773
<rdar://problem/68937617>
Reviewed by Jer Noble.
* platform/mac/WebPlaybackControlsManager.h:
* platform/mac/WebPlaybackControlsManager.mm:
(-[WebPlaybackControlsManager setSeekableTimeRanges:]):
(-[WebPlaybackControlsManager canBeginTouchBarScrubbing]):
If the list of seekable time ranges is empty, we are unable to seek.
2021-03-26 Kimmo Kinnunen <kkinnunen@apple.com>
GraphicsContextGLOpenGL should avoid calling into ANGLE MakeCurrent
https://bugs.webkit.org/show_bug.cgi?id=223511
Reviewed by Kenneth Russell.
Avoid calling ANGLE MakeCurrent for contexts that are already current. Cache the current context pointer into a
global variable. Currently the code adds no locking. For the forseeable future, ANGLE does not support
simultaneous access from multiple threads.
The optimization can be done when run in WebContent process or in GPU process, but not when in WK1. This is because in WK1,
the 3rd party client may run arbitrary code in WebKit thread. This includes code that changes EAGL or AGL state.
This code might change the current context underneath WebKit. In WK1 mode, we already use "volatile context" feature of
ANGLE to reset the platform context on every EGL command. The command we use for this for normal GL commands is EGL_MakeCurrent.
Makes in-process WebGL faster in MotionMark triangles by 6300 -> 9800 pts
Makes GPU process WebGL faster in MotionMark triangles by 5300 -> 7000 pts
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::isCurrentContextPredictable):
(WebCore::InitializeEGLDisplay):
(WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):
(WebCore::GraphicsContextGLOpenGL::makeContextCurrent):
(WebCore::GraphicsContextGLOpenGL::clearCurrentContext):
(WebCore::GraphicsContextGLOpenGL::releaseCurrentContext):
(WebCore::GraphicsContextGLOpenGL::checkGPUStatus):
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
2021-03-25 Antoine Quint <graouts@webkit.org>
Fix interpolation of the caret-color CSS property
https://bugs.webkit.org/show_bug.cgi?id=223181
<rdar://problem/75687413>
Reviewed by Antti Koivisto.
Add support for the "auto" value for the "caret-color" CSS property. That value
is its initial value. We support it with a new boolean flag on StyleRareInheritedData
which we reset to false when setCaretColor() or setVisitedLinkCaretColor() is called.
Then, we can blend this property with the new CaretColorPropertyWrapper wrapper which is
required to correctly get and set the "auto" bit.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* css/CSSProperties.json: We can remove the initial value key since this property is entirely
custom.
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setCaretColor):
(WebCore::RenderStyle::setHasAutoCaretColor):
(WebCore::RenderStyle::setVisitedLinkCaretColor):
(WebCore::RenderStyle::setHasVisitedLinkAutoCaretColor):
(WebCore::RenderStyle::hasAutoCaretColor const):
(WebCore::RenderStyle::hasVisitedLinkAutoCaretColor const):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):
* rendering/style/StyleRareInheritedData.h:
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyInitialCaretColor):
(WebCore::Style::BuilderCustom::applyInheritCaretColor):
(WebCore::Style::BuilderCustom::applyValueCaretColor):
2021-03-26 Jean-Yves Avenard <jya@apple.com>
Fix NowPlayingInfoArtwork operator== logic.
https://bugs.webkit.org/show_bug.cgi?id=223730
<rdar://problem/75822687>
Reviewed by Youenn Fablet.
Gtest NowPlayingInfoArtworkTest added .
* platform/audio/NowPlayingInfo.h:
(WebCore::NowPlayingInfoArtwork::operator== const):
(WebCore::NowPlayingInfoArtwork::operator!= const):
2021-03-26 Rob Buis <rbuis@igalia.com>
Remove ASSERT in RenderListItem::computeMarkerStyle
https://bugs.webkit.org/show_bug.cgi?id=222670
Reviewed by Ryosuke Niwa.
Remove ASSERT in RenderListItem::computeMarkerStyle
since ::marker does not apply to all elements so
getCachedPseudoStyle can return null.
Test: fast/lists/list-item-compute-marker-style-crash.xhtml
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::computeMarkerStyle const):
2021-03-26 Carlos Garcia Campos <cgarcia@igalia.com>
REGRESSION(r272301): [SOUP] default port attribute when persisting credential information with libsecret
https://bugs.webkit.org/show_bug.cgi?id=223782
Reviewed by Adrian Perez de Castro.
Use the default port instead of 0 when the URL omits the port.
* platform/network/soup/AuthenticationChallengeSoup.cpp:
(WebCore::protectionSpaceFromSoupAuthAndURL):
2021-03-26 Yusuke Suzuki <ysuzuki@apple.com>
Use ICUDeleter to encode ucnv_close/uenum_close call into type of deleter of std::unique_ptr
https://bugs.webkit.org/show_bug.cgi?id=223503
Reviewed by Alex Christensen.
Use ICUDeleter<ucnv_close> instead of holding ucnv_close pointer in ICUConverterPtr.
This deleter encodes ucnv_close calls into type so that we do not need to hold a pointer
to ucnv_close.
We also use ICUDeleter<uenum_close> in place where we use UEnumeration.
* Modules/applepay/PaymentRequestValidator.mm:
(WebCore::validateCurrencyCode):
* platform/text/EncodingTables.cpp:
(WebCore::jis0208):
(WebCore::jis0212):
(WebCore::big5):
(WebCore::eucKR):
(WebCore::gb18030):
* platform/text/TextCodecICU.cpp:
(WebCore::TextCodecICU::createICUConverter const):
* platform/text/TextCodecICU.h:
2021-03-26 Jessie Berlin <jberlin@webkit.org>
Update the BEFORE/SINCE, SYSTEM_VERSION_PREFIX, and MACOSX_DEPLOYMENT_TARGET flags
https://bugs.webkit.org/show_bug.cgi?id=223779
Reviewed by Tim Horton.
* Configurations/DebugRelease.xcconfig:
* Configurations/Version.xcconfig:
* Configurations/WebCore.xcconfig:
* Configurations/WebKitTargetConditionals.xcconfig:
2021-03-25 Alex Christensen <achristensen@webkit.org>
Allow WKContentRuleList to block only in frames or only in main frame
https://bugs.webkit.org/show_bug.cgi?id=219001
<rdar://problem/71382045>
Reviewed by Ben Poulain.
This adds load-context to the trigger, which can have an array containing main-frame or iframe.
This makes the trigger only happen in such loading contexts.
* Modules/websockets/ThreadableWebSocketChannel.cpp:
(WebCore::ThreadableWebSocketChannel::validateURL):
* contentextensions/ContentExtension.cpp:
(WebCore::ContentExtensions::ContentExtension::populateConditionCacheIfNeeded):
* contentextensions/ContentExtensionParser.cpp:
(WebCore::ContentExtensions::getTypeFlags):
(WebCore::ContentExtensions::loadTrigger):
* contentextensions/ContentExtensionsBackend.cpp:
(WebCore::ContentExtensions::ContentExtensionsBackend::processContentRuleListsForLoad):
(WebCore::ContentExtensions::ContentExtensionsBackend::processContentRuleListsForPingLoad):
* contentextensions/DFABytecodeInterpreter.cpp:
(WebCore::ContentExtensions::DFABytecodeInterpreter::interpretTestFlagsAndAppendAction):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadResourceSynchronously):
* loader/NetscapePlugInStreamLoader.cpp:
(WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
* loader/PingLoader.cpp:
(WebCore::PingLoader::sendPing):
(WebCore::PingLoader::sendViolationReport):
* loader/ResourceLoadInfo.cpp:
(WebCore::ContentExtensions::toResourceType):
(WebCore::ContentExtensions::readResourceType):
(WebCore::ContentExtensions::readLoadType):
(WebCore::ContentExtensions::readLoadContext):
(WebCore::ContentExtensions::ResourceLoadInfo::getResourceFlags const):
* loader/ResourceLoadInfo.h:
2021-03-25 Wenson Hsieh <wenson_hsieh@apple.com>
Don't add `-webkit-user-select: none;` on image elements with `draggable=true`
https://bugs.webkit.org/show_bug.cgi?id=223774
<rdar://problem/75860124>
Reviewed by Tim Horton.
Avoid adding this presentational CSS style property for image elements marked with `draggable=true`. Since
image elements are already draggable by default and mouse drags over image elements do not trigger text
selection, it's not necessary for the user agent to add this style property. See below for more details.
Test: fast/images/image-extraction/mac/select-word-in-draggable-image-overlay.html
* html/HTMLElement.cpp:
(WebCore::HTMLElement::collectStyleForPresentationAttribute):
If the element is already draggable (barring HTML attributes), don't additionally disable text selection inside
the element when we additionally have `draggable=true` set on the element.
(WebCore::HTMLElement::draggable const):
Refactor this to consult `isDraggableIgnoringAttributes()` when determining whether to check if the `draggable`
attribute value is not `"false"` vs. equal to `"true"`. In the case where the element is already draggable, we
only return `false` here if `draggable=false` is explicitly set.
* html/HTMLElement.h:
(WebCore::HTMLElement::isDraggableIgnoringAttributes const):
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::draggable const): Deleted.
* html/HTMLImageElement.h:
Override `isDraggableIgnoringAttributes` and return `true`.
2021-03-25 Wenson Hsieh <wenson_hsieh@apple.com>
It should be possible to drag images with overlay content
https://bugs.webkit.org/show_bug.cgi?id=223766
<rdar://problem/75856030>
Reviewed by Tim Horton.
Make a few minor adjustments to make drag and drop play well with images with overlay content. See below for
more details.
Test: DragAndDropTests.DragElementWithImageOverlay
* html/HTMLElement.cpp:
(WebCore::HTMLElement::isInsideImageOverlay):
Add a helper method to return whether an individual DOM node is inside an image overlay. Use this in the
existing version of this method that takes a `SimpleRange`.
* html/HTMLElement.h:
* page/DragController.cpp:
(WebCore::DragController::draggableElement const):
Skip all drag source actions except for `Selection` in the case where we're hit-testing to text inside of an
image overlay.
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEvent):
Make `isMouseDownOnLinkOrImage` `false` in the case where we're over image overlay text.
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::nodeForImageData const):
(WebCore::HitTestResult::image const):
(WebCore::HitTestResult::imageRect const):
(WebCore::HitTestResult::absoluteImageURL const):
Teach `HitTestResult` to skip out of image overlay content and find the actual image element when determining
the image URL, image, or image rect.
* rendering/HitTestResult.h:
2021-03-25 Jessie Berlin <jberlin@webkit.org>
Remove 10.13 DEPLOYMENT_TARGETs and SYSTEM_VERSION_PREFIXs
https://bugs.webkit.org/show_bug.cgi?id=223765
Reviewed by Tim Horton.
* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:
* Configurations/Version.xcconfig:
2021-03-25 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] Do not try to normalize the tree while destroying the multicolumn flow
https://bugs.webkit.org/show_bug.cgi?id=223722
<rdar://75731256>
Reviewed by Simon Fraser.
Test: fast/multicol/crash-while-destroying-the-column-context.html
This patch ensures that we don't start moving around parts of the fragmented flow subtree (e.g. collapsing anonymous blocks) while
trying place the spanner renderers back to their original positions as part of the "we don't need multicolumn context anymore".
(e.g spanner placeholder is removed -> triggers anon block collapsing -> moves subtrees around inside the multicolumn subtree -> insertion happens -> spanner placeholder gets re-validated)
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::destroy):
* rendering/updating/RenderTreeBuilder.h:
* rendering/updating/RenderTreeBuilderBlock.cpp:
(WebCore::RenderTreeBuilder::Block::detach):
* rendering/updating/RenderTreeBuilderMultiColumn.cpp:
(WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
(WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval):
(WebCore::RenderTreeBuilder::MultiColumn::multiColumnRelativeWillBeRemoved):
* rendering/updating/RenderTreeBuilderMultiColumn.h:
2021-03-25 Andres Gonzalez <andresg_22@apple.com>
AX: Consider implementing @aria-details.
https://bugs.webkit.org/show_bug.cgi?id=165842
rdar://30725491
Reviewed by Chris Fleizach.
Tests: accessibility/ios-simulator/aria-details.html
accessibility/mac/aria-details.html
- Added [WebAccessibilityObjectWrapper accessibilityDetailsElements] on iOS.
- Added helper function accessibleElementsForObjects to retrieve platform-
specific accessible elements given a collection of AXCoreObjects.
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(accessibleElementsForObjects):
(-[WebAccessibilityObjectWrapper accessibilityDetailsElements]):
(-[WebAccessibilityObjectWrapper accessibilityErrorMessageElements]):
2021-03-25 Cameron McCormack <heycam@apple.com>
Collapse newly adjacent anonymous table cells when a table cell is detached from between them.
https://bugs.webkit.org/show_bug.cgi?id=220934
Reviewed by Zalan Bujtas.
We already had support for collapsing newly adjacent table row cells when a
table row cell is detached from between them. We need to do this for anonymous
table cells too.
Test: fast/table/table-anonymous-cell-collapse.html
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::destroyAndCleanUpAnonymousWrappers): Call
into the RenderTreeBuilder::Table to collapse anonymous table cells when
needed.
* rendering/updating/RenderTreeBuilderTable.cpp:
(WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblings):
Factor out the existing collapseAndDestroyAnonymousSiblingRows into
something re-usable.
(WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingCells):
Added.
(WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
Factored out to collapseAndDestroyAnonymousSiblings.
* rendering/updating/RenderTreeBuilderTable.h:
2021-03-25 Tim Nguyen <ntim@apple.com>
Fix edge cases in normalization of conic-gradient color stops
https://bugs.webkit.org/show_bug.cgi?id=221294
<rdar://problem/74157218>
Reviewed by Darin Adler.
`lastOneOrLessIndex` had an off-by-one error, so it did not go through the
branch handling clamping all the stop offsets when they're all above 1.
Also made `normalizeStopsAndEndpointsOutsideRange` logic easier to follow using
`Optional<size_t>` instead of placeholder values.
Test: web-platform-tests/css/css-images/normalization-conic-2.html
* css/CSSGradientValue.cpp:
(WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange):
2021-03-25 Chris Dumez <cdumez@apple.com>
Address some alignment issues found by UBSan in contentextensions code
https://bugs.webkit.org/show_bug.cgi?id=223748
Reviewed by Darin Adler.
Address some alignment issues found by UBSan in contentextensions code:
- contentextensions/SerializedNFA.h:55:20: runtime error: reference binding to misaligned address 0xnnnnnnnnn for type 'const unsigned long long', which requires 8 byte alignment
- contentextensions/NFAToDFA.cpp:254:29: runtime error: reference binding to misaligned address 0xnnnnnnnnn for type 'const unsigned long long', which requires 8 byte alignment
- contentextensions/DFABytecodeCompiler.cpp:43:5: runtime error: store to misaligned address 0xnnnnnnnnn for type 'unsigned short', which requires 2 byte alignment
Use memcpy() to store/load to/from misaligned address.
* contentextensions/DFABytecodeCompiler.cpp:
(WebCore::ContentExtensions::append):
* contentextensions/NFAToDFA.cpp:
(WebCore::ContentExtensions::epsilonClosureExcludingSelf):
(WebCore::ContentExtensions::NodeIdSetToUniqueNodeIdSetTranslator::translate):
* contentextensions/SerializedNFA.h:
(WebCore::ContentExtensions::SerializedNFA::Range::pointerAt const):
(WebCore::ContentExtensions::SerializedNFA::Range::valueAt const):
(WebCore::ContentExtensions::SerializedNFA::ConstTargetIterator::operator* const):
(WebCore::ContentExtensions::SerializedNFA::ConstTargetIterator::operator-> const):
(WebCore::ContentExtensions::SerializedNFA::ConstRangeIterator::first const):
(WebCore::ContentExtensions::SerializedNFA::ConstRangeIterator::last const):
(WebCore::ContentExtensions::SerializedNFA::ConstRangeIterator::data const):
(WebCore::ContentExtensions::SerializedNFA::ConstRangeIterator::range const):
(WebCore::ContentExtensions::SerializedNFA::transitionsForNode const):
(WebCore::ContentExtensions::SerializedNFA::Range::operator[] const): Deleted.
2021-03-25 Chris Dumez <cdumez@apple.com>
Source/WebCore/xml/parser/CharacterReferenceParserInlines.h:107:33: runtime error: signed integer overflow: 268435455 * 16 cannot be represented in type 'int'
https://bugs.webkit.org/show_bug.cgi?id=223718
Reviewed by Darin Adler.
Use Checked<> for the result in consumeCharacterReference() to deal with overflows
in a well-defined manner.
* xml/parser/CharacterReferenceParserInlines.h:
(WebCore::consumeCharacterReference):
2021-03-25 John Wilander <wilander@apple.com>
PCM: Rename attributeOn to attributionDestination and change the IDL data type of attributionSourceId to unsigned long
https://bugs.webkit.org/show_bug.cgi?id=223661
<rdar://problem/75762075>
Reviewed by Brent Fulgham.
The PR review of the update of the PCM spec lead WebKit, Mozilla, and Google to decide on two changes:
1. Rename attributeOn to attributionDestination
2. Change the IDL data type of attributionSourceId from DOMString to unsigned long
The spec change can be seen in this commit:
https://github.com/privacycg/private-click-measurement/pull/75/commits/8623b5df5e899e6652bc5b00313585f7eeafa797
This patch makes those changes, plus changes names of SPIs, functions, and variables accordingly.
Existing tests were updated.
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::parsePrivateClickMeasurement const):
* html/HTMLAnchorElement.idl:
* html/HTMLAttributeNames.in:
* loader/PrivateClickMeasurement.cpp:
(WebCore::PrivateClickMeasurement::isValid const):
(WebCore::PrivateClickMeasurement::attributionReportAttributeOnURL const):
(WebCore::PrivateClickMeasurement::attributionReportJSON const):
* loader/PrivateClickMeasurement.h:
(WebCore::PrivateClickMeasurement::AttributionDestinationSite::AttributionDestinationSite):
(WebCore::PrivateClickMeasurement::AttributionDestinationSite::operator== const):
(WebCore::PrivateClickMeasurement::AttributionDestinationSite::deletedValue):
(WebCore::PrivateClickMeasurement::AttributionDestinationSite::constructDeletedValue):
(WebCore::PrivateClickMeasurement::AttributionDestinationSiteHash::hash):
(WebCore::PrivateClickMeasurement::AttributionDestinationSiteHash::equal):
(WebCore::PrivateClickMeasurement::PrivateClickMeasurement):
(WebCore::PrivateClickMeasurement::destinationSite const):
(WebCore::PrivateClickMeasurement::encode const):
(WebCore::PrivateClickMeasurement::decode):
(WTF::HashTraits<WebCore::PrivateClickMeasurement::AttributionDestinationSite>::emptyValue):
(WTF::HashTraits<WebCore::PrivateClickMeasurement::AttributionDestinationSite>::constructDeletedValue):
(WTF::HashTraits<WebCore::PrivateClickMeasurement::AttributionDestinationSite>::isDeletedValue):
(WebCore::PrivateClickMeasurement::AttributeOnSite::AttributeOnSite): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSite::operator== const): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSite::matches const): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSite::isHashTableDeletedValue const): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSite::deletedValue): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSite::constructDeletedValue): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSite::deleteValue): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSite::isDeletedValue const): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSiteHash::hash): Deleted.
(WebCore::PrivateClickMeasurement::AttributeOnSiteHash::equal): Deleted.
(WebCore::PrivateClickMeasurement::attributeOnSite const): Deleted.
(WTF::HashTraits<WebCore::PrivateClickMeasurement::AttributeOnSite>::emptyValue): Deleted.
(WTF::HashTraits<WebCore::PrivateClickMeasurement::AttributeOnSite>::constructDeletedValue): Deleted.
(WTF::HashTraits<WebCore::PrivateClickMeasurement::AttributeOnSite>::isDeletedValue): Deleted.
2021-03-25 Chris Dumez <cdumez@apple.com>
Drop unnecessary Settings pre-warming in ProcessWarming::prewarmGlobally()
https://bugs.webkit.org/show_bug.cgi?id=223749
Reviewed by Antti Koivisto.
Drop unnecessary Settings pre-warming in ProcessWarming::prewarmGlobally(). Based on the comment,
it looks like the intention was to prewarm some font families. However, looking at the code, nothing
that gets populated is global and survives the destruction of the Settings object on the next line.
We don't even make any calls to CTFont.
* page/ProcessWarming.cpp:
(WebCore::ProcessWarming::prewarmGlobally):
2021-03-25 Youenn Fablet <youenn@apple.com>
Switch from PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION to filtering interfaces in Network process
https://bugs.webkit.org/show_bug.cgi?id=223679
Reviewed by Eric Carlson.
Covered by webrtc/datachannel/filter-ice-candidate.html.
* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::LibWebRTCProvider::createPeerConnection):
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:
Use set_allow_tcp_listen instead of PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION.
2021-03-25 Ben Nham <nham@apple.com>
Only preheat MTLCopyAllDevices on Mac
https://bugs.webkit.org/show_bug.cgi?id=223747
Reviewed by Chris Dumez.
We should use adoptNS to avoid leaking the array returned by MTLCopyAllDevices. We should
also only do this on Mac because this is only a public API on the Mac, and the issue of
graphics drivers falling out of the dyld shared cache doesn't exist on iOS.
* platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
(WebCore::GPUDevice::prewarm):
2021-03-25 Alex Christensen <achristensen@webkit.org>
WKContentRuleList first-party should include other subdomains of the current registrable domain
https://bugs.webkit.org/show_bug.cgi?id=223728
<rdar://71912579>
Reviewed by John Wilander.
Covered by API tests.
* loader/ResourceLoadInfo.cpp:
(WebCore::ContentExtensions::ResourceLoadInfo::isThirdParty const):
2021-03-25 Youenn Fablet <youenn@apple.com>
Improve RealtimeIncomingVideoSourceCocoa::OnFrame logging to include rotation and size information
https://bugs.webkit.org/show_bug.cgi?id=223741
Reviewed by Eric Carlson.
No change of behavior.
* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
(WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
2021-03-25 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r274826 and r274968.
https://bugs.webkit.org/show_bug.cgi?id=223746
Added broken layout test
Reverted changesets:
"AX: textRectsFromMarkers always fails"
https://bugs.webkit.org/show_bug.cgi?id=223556
https://trac.webkit.org/changeset/274826
"AX: Add functions rectsForTextMarkerRange for testing"
https://bugs.webkit.org/show_bug.cgi?id=223705
https://trac.webkit.org/changeset/274968
2021-03-25 Antoine Quint <graouts@webkit.org>
Improve interpolation of the shape-outside CSS property
https://bugs.webkit.org/show_bug.cgi?id=223738
Reviewed by Antti Koivisto.
While we had logic to deal with cases where ShapeValue objects could not be interpolated, we did not make
use of it in the animation wrapper. We now move this logic from the blendFunc() to the canInterpolate()
override method on the wrapper to correctly interpolate only when possible.
* animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
2021-03-25 Tim Horton <timothy_horton@apple.com>
All Books quirks are flakily not applied in modern WebKit
https://bugs.webkit.org/show_bug.cgi?id=157101
<rdar://problem/25965028>
Reviewed by Darin Adler.
No new tests; I haven't found a way to write a test that doesn't involve
adding a new parameter to the process bootstrap message, which seems
out of the realm of reason for a test.
* bindings/js/CommonVM.cpp:
(WebCore::commonVMSlow):
(WebCore::globalConstRedeclarationShouldThrow): Deleted.
Stop hardcoding globalConstRedeclarationShouldThrow based on the UI process identity.
* platform/RuntimeApplicationChecks.cpp:
(WebCore::isInAuxiliaryProcess):
* platform/RuntimeApplicationChecks.h:
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::applicationBundleIdentifier):
(WebCore::setApplicationBundleIdentifierOverride):
Add an assertion to catch any future case where a bundle check is queried
in a auxiliary process before the hosting application bundle identifier is set.
2021-03-24 Yusuke Suzuki <ysuzuki@apple.com>
All string resources from UserAgentStyleSheets / UserAgentScripts should be used as non-copying StringImpl
https://bugs.webkit.org/show_bug.cgi?id=223685
Reviewed by Saam Barati.
We use StringImpl::createWithoutCopying for string resources from UserAgentStyleSheets / UserAgentScripts to make sure that
these resources do not allocate heap strings.
This patch also fixes HTMLMeterElement's bug (and imageOverlayUserAgentStyleSheet's bug). Previously, we are using String::ConstructFromLiteral,
but this only accepts string literal as it says. As a result, we are dropping the last character since UserAgentStyleSheets's last character is not \0.
* Modules/plugins/QuickTimePluginReplacement.mm:
(WebCore::quickTimePluginReplacementScript):
* WebCoreMacros.cmake:
* dom/Document.cpp:
(WebCore::Document::ensurePlugInsInjectedScript):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::updateWithImageExtractionResult):
* html/HTMLMeterElement.cpp:
(WebCore::HTMLMeterElement::didAddUserAgentShadowRoot):
* rendering/RenderThemeAdwaita.cpp:
(WebCore::RenderThemeAdwaita::extraDefaultStyleSheet):
(WebCore::RenderThemeAdwaita::extraMediaControlsStyleSheet):
(WebCore::RenderThemeAdwaita::mediaControlsScripts):
* rendering/RenderThemeCocoa.mm:
(WebCore::RenderThemeCocoa::mediaControlsStyleSheet):
(WebCore::RenderThemeCocoa::mediaControlsScripts):
* rendering/RenderThemeWin.cpp:
(WebCore::RenderThemeWin::extraDefaultStyleSheet):
(WebCore::RenderThemeWin::extraQuirksStyleSheet):
* style/UserAgentStyle.cpp:
(WebCore::Style::UserAgentStyle::initDefaultStyleSheet):
(WebCore::Style::UserAgentStyle::ensureDefaultStyleSheetsForElement):
2021-03-24 Chris Dumez <cdumez@apple.com>
bindings/js/JSEventListener.cpp:281:91: runtime error: reference binding to null pointer of type 'WebCore::ScriptExecutionContext'
https://bugs.webkit.org/show_bug.cgi?id=223719
Reviewed by Darin Adler.
Make sure we null check the scriptExecutionContext before we dereference it.
* bindings/js/JSEventListener.cpp:
(WebCore::eventHandlerAttribute):
(WebCore::windowEventHandlerAttribute):
2021-03-24 Chris Dumez <cdumez@apple.com>
Port FontDescriptionKey::computeHash() from legacy IntegerHasher to Hasher
https://bugs.webkit.org/show_bug.cgi?id=223701
Reviewed by Darin Adler.
Port FontDescriptionKey::computeHash() from legacy IntegerHasher to Hasher. Hasher
has the benefit of having add() overloads that take in signed integer types.
* platform/graphics/FontCache.h:
(WebCore::FontDescriptionKey::computeHash const):
2021-03-24 Chris Dumez <cdumez@apple.com>
Extend WebAudio heap allocation assertions to cover the pre & post-rendering phases
https://bugs.webkit.org/show_bug.cgi?id=223640
Reviewed by Sam Weinig.
Extend WebAudio heap allocation assertions to cover the pre & post-rendering phases. I had to add
exceptions for some heap allocations that are currently happening during this phase but I
will work to reduce the number of exceptions in follow-ups.
* Modules/webaudio/AudioDestinationNode.cpp:
(WebCore::AudioDestinationNode::render):
* Modules/webaudio/AudioNodeInput.cpp:
(WebCore::AudioNodeInput::updateInternalBus):
* Modules/webaudio/AudioNodeOutput.cpp:
(WebCore::AudioNodeOutput::updateInternalBus):
* Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::addAutomaticPullNode):
(WebCore::BaseAudioContext::updateAutomaticPullNodes):
* platform/audio/AudioDSPKernelProcessor.cpp:
(WebCore::AudioDSPKernelProcessor::initialize):
2021-03-24 Chris Dumez <cdumez@apple.com>
Unreviewed build fix after r274983.
* Modules/mediasession/MediaSession.h:
2021-03-24 Chris Dumez <cdumez@apple.com>
Move TelephoneNumberDetector preloading off the main thread
https://bugs.webkit.org/show_bug.cgi?id=223715
Reviewed by Geoffrey Garen.
Move TelephoneNumberDetector preloading off the main thread. We have evidence that prewarmGlobally() can be slow and hang the main
thread for too long (rdar://75279383). As a result, it is a good idea to prewarm things off the main thread whenever possible.
* page/ProcessWarming.cpp:
(WebCore::ProcessWarming::prewarmGlobally):
* platform/TelephoneNumberDetector.h:
* platform/cocoa/TelephoneNumberDetectorCocoa.cpp:
(WebCore::TelephoneNumberDetector::phoneNumbersScanner):
(WebCore::TelephoneNumberDetector::prewarm):
2021-03-24 Eric Carlson <eric.carlson@apple.com>
[Cocoa] Add Experimental MediaSession coordinator
https://bugs.webkit.org/show_bug.cgi?id=222158
<rdar://problem/74508862>
Reviewed by Jer Noble.
Add an experimental MediaSession coordinator, an object that provides an interface
that allows script to coordinate changes to MediaSession with the User Agent. Also
add an experimental MediaSession playlist interface.
The changes are behind new experimental feature flags,
MediaSessionCoordinatorEnabled and MediaSessionPlaylistEnabled.
Test: media/media-session/mock-coordinator.html
* DerivedSources-input.xcfilelist: Add new IDL files.
* DerivedSources-output.xcfilelist: Add new derived sources.
* DerivedSources.make: Add new IDL.
* Modules/mediasession/MediaMetadata.cpp:
(WebCore::MediaMetadata::create): Set trackIdentifier from init data.
(WebCore::MediaMetadata::setTrackIdentifier): trackIdentifier setter.
* Modules/mediasession/MediaMetadata.h:
(WebCore::MediaMetadata::trackIdentifier const):
* Modules/mediasession/MediaMetadata.idl:
* Modules/mediasession/MediaMetadataInit.h: Add trackIdentifier.
(WebCore::MediaMetadataInit::encode const):
(WebCore::MediaMetadataInit::decode):
* Modules/mediasession/MediaMetadataInit.idl:
* Modules/mediasession/MediaSession.cpp:
(WebCore::MediaSession::MediaSession): Initialize MainThreadGenericEventQueue.
(WebCore::MediaSession::setMetadata): metadataUpdated -> notifyMetadataObservers.
(WebCore::MediaSession::setReadyState): Session readyState setter.
(WebCore::MediaSession::setCoordinator): Coordinator setter. Post 'coordinatorchange'
event after change.
(WebCore::MediaSession::setPlaylist): Playlist setter.
(WebCore::MediaSession::setActionHandler): Call notifyActionHandlerObservers.
(WebCore::MediaSession::setPositionState): Call notifyPositionStateObservers.
(WebCore::MediaSession::metadataUpdated): Call notifyMetadataObservers.
(WebCore::MediaSession::addObserver): New.
(WebCore::MediaSession::removeObserver): New.
(WebCore::MediaSession::forEachObserver): New.
(WebCore::MediaSession::notifyMetadataObservers): New.
(WebCore::MediaSession::notifyPositionStateObservers): New.
(WebCore::MediaSession::notifyPlaybackStateObservers): New.
(WebCore::MediaSession::notifyActionHandlerObservers): New.
(WebCore::MediaSession::notifyReadyStateObservers): New.
* Modules/mediasession/MediaSession.h:
(WebCore::MediaSession::coordinator const):
(WebCore::MediaSession::playlist const):
(WebCore::MediaSession::logger const):
* Modules/mediasession/MediaSession.idl:
* Modules/mediasession/MediaSessionAction.h:
* Modules/mediasession/MediaSessionAction.idl:
* Modules/mediasession/MediaSessionActionDetails.h:
* Modules/mediasession/MediaSessionActionDetails.idl:
MediaSessionCoordinator proxies calls through the PlatformMediaSessionCoordinator,
and then calls the equivalent MediaSession methode if the platform coordinator
is successful.
* Modules/mediasession/MediaSessionCoordinator.cpp: Added.
(WebCore::nextCoordinatorLogIdentifier):
(WebCore::MediaSessionCoordinator::create):
(WebCore::MediaSessionCoordinator::MediaSessionCoordinator):
(WebCore::MediaSessionCoordinator::seekTo):
(WebCore::MediaSessionCoordinator::play):
(WebCore::MediaSessionCoordinator::pause):
(WebCore::MediaSessionCoordinator::setTrack):
(WebCore::MediaSessionCoordinator::setMediaSession):
(WebCore::MediaSessionCoordinator::logChannel):
* Modules/mediasession/MediaSessionCoordinator.h: New.
(WebCore::MediaSessionCoordinator::logger const):
(WebCore::MediaSessionCoordinator::logIdentifier const):
(WebCore::MediaSessionCoordinator::logClassName):
* Modules/mediasession/MediaSessionCoordinator.idl: New.
* Modules/mediasession/NavigatorMediaSession.h:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* dom/EventNames.h:
* dom/EventTargetFactory.in:
* platform/graphics/PlatformMediaSessionCoordinator.h: Added.
(WebCore::PlatformMediaSessionCoordinator::setLogger):
(WebCore::PlatformMediaSessionCoordinator::loggerPtr const):
(WebCore::PlatformMediaSessionCoordinator::logIdentifier const):
(WebCore::PlatformMediaSessionCoordinator::logClassName const):
(WebCore::PlatformMediaSessionCoordinator::logChannel const):
* testing/Internals.cpp:
(WebCore::Internals::registerMockMediaSessionCoordinator): Register the mock
media session coordinator for testing.
* testing/Internals.h:
* testing/Internals.idl:
* testing/MockMediaSessionCoordinator.cpp: Added.
(WebCore::MockMediaSessionCoordinator::create):
(WebCore::MockMediaSessionCoordinator::MockMediaSessionCoordinator):
(WebCore::MockMediaSessionCoordinator::seekTo):
(WebCore::MockMediaSessionCoordinator::play):
(WebCore::MockMediaSessionCoordinator::pause):
(WebCore::MockMediaSessionCoordinator::setTrack):
* testing/MockMediaSessionCoordinator.h: New.
2021-03-24 Chris Dumez <cdumez@apple.com>
Preload graphics drivers on a background thread instead of the main thread
https://bugs.webkit.org/show_bug.cgi?id=223713
Reviewed by Simon Fraser.
Preload graphics drivers on a background thread instead of the main thread. We have evidence of prewarmGlobally() hanging
the main thread (rdar://75279383) so we should do pre-warming off the main thread whenever possible.
r265418 introduced this graphics loader preloading and an earlier version of this patch was simply calling MTLCopyAllDevices()
on a background queue. However, that patch was updated before landing to do the work on the main thread. I think we should go
back to the earlier iteration.
* page/ProcessWarming.cpp:
(WebCore::ProcessWarming::prewarmGlobally):
* platform/graphics/gpu/GPUDevice.h:
* platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
(WebCore::GPUDevice::prewarm):
* platform/graphics/gpu/dawn/GPUDeviceDawn.cpp:
(WebCore::GPUDevice::prewarm):
2021-03-24 Antoine Quint <graouts@webkit.org>
Fix interpolation of the border-spacing property
https://bugs.webkit.org/show_bug.cgi?id=223702
Reviewed by Antti Koivisto.
Test: imported/w3c/web-platform-tests/css/css-tables/animations/border-spacing-interpolation.html
While we already supported animation of border-spacing, we did not correctly clip the interpolated
value to 0.
* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
2021-03-24 Simon Fraser <simon.fraser@apple.com>
Add DisplayLink log channels in WebCore and WebKit
https://bugs.webkit.org/show_bug.cgi?id=223669
Reviewed by Tim Horton.
DisplayRefreshMonitor code involves some non-trivial object
fan-out and WebProcess/UI Process interaction, and it deserves
a log channel.
* platform/Logging.h:
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::displayDidRefresh):
* platform/graphics/DisplayRefreshMonitorManager.cpp:
(WebCore::DisplayRefreshMonitorManager::monitorForClient):
(WebCore::DisplayRefreshMonitorManager::displayDidRefresh):
2021-03-24 Philippe Normand <pnormand@igalia.com>
REGRESSION(r274870) fast/canvas/webgl/texImage2D-mse-flipY-true.html and fast/canvas/webgl/texImage2D-mse-flipY-false.html are crashing
https://bugs.webkit.org/show_bug.cgi?id=223674
Reviewed by Kenneth Russell.
When the srcObject is directly set on a media element, the corresponding URL might still be
empty, so we need to ensure the URI corresponding to the MediaSource blob is not empty,
otherwise uridecodebin would fail to create the right source element.
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::load):
2021-03-24 Aditya Keerthi <akeerthi@apple.com>
REGRESSION (r273154): [iOS] Two magnifier symbols on google.com
https://bugs.webkit.org/show_bug.cgi?id=223700
<rdar://problem/75357965>
Reviewed by Tim Horton.
The iOS form control refresh added a magnifier symbol to
the default appearance of <input type="search">. On iPhone, google.com
uses <input type="search"> for their search field, while drawing their
own magnifier symbol. As a result, two magnifier symbols appear.
Note that on macOS and iPadOS, google.com uses an <input type="text">,
which means this problem is only observed on iPhone. Ideally, google.com
should adopt <input type="text"> on the iPhone version of the site,
matching the other platforms. However, in the meantime, we can hide our
symbol using a quirk.
* html/shadow/TextControlInnerElements.cpp:
(WebCore::SearchFieldResultsButtonElement::SearchFieldResultsButtonElement):
Hide the symbol if the quirk applies.
* page/Quirks.cpp:
(WebCore::Quirks::shouldHideSearchFieldResultsButton const):
Add a quirk to hide the magnifier symbol on google.com and other country
domains.
* page/Quirks.h:
2021-03-24 Youenn Fablet <youenn@apple.com>
Add logging to check whether RealtimeOutgoingVideoSource is applying rotation or not
https://bugs.webkit.org/show_bug.cgi?id=223691
Reviewed by Eric Carlson.
No change of behavior.
* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm:
(WebCore::RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer):
2021-03-24 Chris Dumez <cdumez@apple.com>
Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: 65537 * 65537 cannot be represented in type 'int'
https://bugs.webkit.org/show_bug.cgi?id=223697
Reviewed by Darin Adler.
Make sure FrameView::incrementVisuallyNonEmptyPixelCount() deals with overflows in a well-defined
manner. This fixes the following reports from UBSan:
- Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: 65537 * 65537 cannot be represented in type 'int'
- Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: 65536 * 65536 cannot be represented in type 'int'
- Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: 1116300 * 558150 cannot be represented in type 'int'
- Source/WebCore/page/FrameView.h:990:50: runtime error: signed integer overflow: -33554432 * -33554432 cannot be represented in type 'int'
* page/FrameView.h:
(WebCore::FrameView::incrementVisuallyNonEmptyPixelCount):
2021-03-24 Rob Buis <rbuis@igalia.com>
[css-contain] Parse CSS contain property
https://bugs.webkit.org/show_bug.cgi?id=223252
Reviewed by Sam Weinig.
Address post land review comments.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeContain):
* rendering/style/RenderStyleConstants.h:
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueContain):
2021-03-24 Sam Weinig <weinig@apple.com>
Update CSS Color 5 color-mix() implementation to match the latest draft spec
https://bugs.webkit.org/show_bug.cgi?id=223665
Reviewed by Simon Fraser.
Update to the latest draft spec, which dramatically reduces the complexity of color-mix()
by remove per-component adjusters.
* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::normalizeWhitenessBlackness):
(WebCore::CSSPropertyParserHelpers::consumeColorMixColorSpaceAndComma):
(WebCore::CSSPropertyParserHelpers::consumeColorMixComponent):
(WebCore::CSSPropertyParserHelpers::normalizedMixPercentages):
(WebCore::CSSPropertyParserHelpers::makeColorTypeByNormalizingComponentsAfterMix):
(WebCore::CSSPropertyParserHelpers::makeColorTypeByNormalizingComponentsAfterMix<HWBA<float>>):
(WebCore::CSSPropertyParserHelpers::makeColorTypeByNormalizingComponentsAfterMix<HSLA<float>>):
(WebCore::CSSPropertyParserHelpers::fixupHueComponentsPriorToMix):
(WebCore::CSSPropertyParserHelpers::mixColorComponentsInColorSpace):
(WebCore::CSSPropertyParserHelpers::mixColorComponents):
(WebCore::CSSPropertyParserHelpers::parseColorMixFunctionParameters):
(WebCore::CSSPropertyParserHelpers::HueColorAdjuster::fixupAnglesForInterpolation): Deleted.
(WebCore::CSSPropertyParserHelpers::HueColorAdjuster::HueColorAdjuster): Deleted.
(WebCore::CSSPropertyParserHelpers::ColorAdjuster::ColorAdjuster): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeAdjuster): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeAndUpdateAdjusterAtIndex): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeAndUpdateAdjuster): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeAdjusters): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeMixComponents): Deleted.
(WebCore::CSSPropertyParserHelpers::normalizeAdjusterValues): Deleted.
(WebCore::CSSPropertyParserHelpers::remainingAdjustment): Deleted.
(WebCore::CSSPropertyParserHelpers::mixComponent): Deleted.
(WebCore::CSSPropertyParserHelpers::mixComponentAtIndex): Deleted.
(WebCore::CSSPropertyParserHelpers::mix): Deleted.
(WebCore::CSSPropertyParserHelpers::parseColorMixFunctionParametersUsingAdjusters): Deleted.
Update to the new syntax and remove component adjusters. They may come back for color-adjust()
in the future.
* platform/graphics/ColorModels.h:
* platform/graphics/ColorTypes.h:
(WebCore::clampedComponent):
(WebCore::assertInRange):
* platform/graphics/ColorUtilities.h:
(WebCore::invertedColorWithOverriddenAlpha):
Add support in the color models for annotating more about each component, now including
the type (angle, number or percentage). This allows algorithms generic algorithms to
operate on abstract color type components without specializing for each color type.
2021-03-24 Zan Dobersek <zdobersek@igalia.com>
[GStreamer] Use imxvideoconvert_g2d element inside the sink when available
https://bugs.webkit.org/show_bug.cgi?id=223693
Reviewed by Philippe Normand.
On some iMX platforms we require the use of imxvideoconvert_g2d element
in order to properly convert the visual buffers before they can be
rendered through our pipeline. We expect to require this buffer if it's
present in the GStreamer plugin registry on the system.
We search for this element and, if found, add it to the sink and
position it at the beginning, before the glupload element.
Based on an approach outlined by Gabriel Valcazar.
* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
(webKitGLVideoSinkConstructed):
2021-03-24 Antoine Quint <graouts@webkit.org>
Support animation of the tab-size CSS property
https://bugs.webkit.org/show_bug.cgi?id=223688
Reviewed by Antti Koivisto.
Test: imported/w3c/web-platform-tests/css/css-text/animations/tab-size-interpolation.html
* animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* platform/graphics/TabSize.h:
(WebCore::TabSize::value const):
(WebCore::TabSize::operator bool const):
2021-03-24 Rob Buis <rbuis@igalia.com>
[css-grid] Do not allow negative heights
https://bugs.webkit.org/show_bug.cgi?id=221439
Reviewed by Javier Fernandez.
Do not allow negative heights in calculations.
Test: fast/css-grid-layout/zero-height-crash.html
* rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithm::setup):
* rendering/GridTrackSizingAlgorithm.h:
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeTrackSizesForDefiniteSize):
(WebCore::RenderGrid::gridGap const):
(WebCore::RenderGrid::computeTrackSizesForIndefiniteSize const):
(WebCore::RenderGrid::availableAlignmentSpaceForChildBeforeStretching const):
2021-03-23 Tim Horton <timothy_horton@apple.com>
Consolidate Books bundle checks
https://bugs.webkit.org/show_bug.cgi?id=223664
<rdar://problem/75754750>
Reviewed by Wenson Hsieh.
No new tests, no change in behavior.
* Modules/geolocation/Geolocation.cpp:
(WebCore::isRequestFromIBooks):
* bindings/js/CommonVM.cpp:
(WebCore::globalConstRedeclarationShouldThrow):
* dom/MouseEvent.cpp:
(WebCore::MouseEvent::initMouseEventQuirk):
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::requiresFullscreenForVideoPlayback const):
* inspector/agents/InspectorTimelineAgent.cpp:
(WebCore::currentRunLoop):
* platform/RuntimeApplicationChecks.h:
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::CocoaApplication::isIBooks):
(WebCore::MacApplication::isIBooks): Deleted.
(WebCore::IOSApplication::isIBooks): Deleted.
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::synchronousWillSendRequestEnabled):
* rendering/RenderBox.cpp:
(WebCore::allowMinMaxPercentagesInAutoHeightBlocksQuirk):
Transition to a single bundle check for Books, since the quirks are generally
about book content, not about the app's behavior. Long-term, we should
get rid of these entirely (some are no longer necessary, and the rest
should turn into switches that Books can toggle).
2021-03-23 Simon Fraser <simon.fraser@apple.com>
Add DisplayRefreshMonitorFactory.
https://bugs.webkit.org/show_bug.cgi?id=223648
Reviewed by Chris Dumez.
Future work will require that it's possible to create a DisplayRefreshMonitor
without having a DisplayRefreshMonitorClient. It was also weird that the way to
create a DisplayRefreshMonitor was via the DisplayRefreshMonitorClient, so
this change fixes both by adding DisplayRefreshMonitorFactory.
In WK2, the drawing areas are DisplayRefreshMonitorFactories. If there is no
factory, we fall back to the default implementations.
* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* loader/EmptyClients.cpp:
(WebCore::EmptyDisplayRefreshMonitorFactory::sharedEmptyDisplayRefreshMonitorFactory):
(WebCore::EmptyChromeClient::displayRefreshMonitorFactory const):
(WebCore::EmptyChromeClient::createDisplayRefreshMonitor const): Deleted.
* loader/EmptyClients.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::displayRefreshMonitorFactory const):
(WebCore::ChromeClient::createDisplayRefreshMonitor const): Deleted.
* page/RenderingUpdateScheduler.cpp:
(WebCore::RenderingUpdateScheduler::displayRefreshMonitorFactory const):
(WebCore::RenderingUpdateScheduler::createDisplayRefreshMonitor const): Deleted.
* page/RenderingUpdateScheduler.h:
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::create):
* platform/graphics/DisplayRefreshMonitor.h:
* platform/graphics/DisplayRefreshMonitorClient.cpp:
(WebCore::DisplayRefreshMonitorClient::DisplayRefreshMonitorClient): Deleted.
* platform/graphics/DisplayRefreshMonitorClient.h:
* platform/graphics/DisplayRefreshMonitorFactory.h: Copied from Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.cpp.
* platform/graphics/DisplayRefreshMonitorManager.cpp:
(WebCore::DisplayRefreshMonitorManager::monitorForClient):
* platform/graphics/GraphicsLayerUpdater.cpp:
(WebCore::GraphicsLayerUpdater::GraphicsLayerUpdater):
(WebCore::GraphicsLayerUpdater::displayRefreshMonitorFactory const):
(WebCore::GraphicsLayerUpdater::createDisplayRefreshMonitor const): Deleted.
* platform/graphics/GraphicsLayerUpdater.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::displayRefreshMonitorFactory):
(WebCore::RenderLayerCompositor::createDisplayRefreshMonitor const): Deleted.
* rendering/RenderLayerCompositor.h:
2021-03-23 Kate Cheney <katherine_cheney@apple.com>
Service worker loads are not marked as app-bound
https://bugs.webkit.org/show_bug.cgi?id=222635
<rdar://problem/74395950>
Reviewed by Youenn Fablet.
Fix capitalization error. Add a new function to mark the service
worker document loader as app-bound.
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::setLastNavigationWasAppBound):
(WebCore::DocumentLoader::setlastNavigationWasAppBound): Deleted.
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::setLastNavigationWasAppBound):
* workers/service/context/ServiceWorkerThreadProxy.h:
2021-03-23 Simon Fraser <simon.fraser@apple.com>
Use FramesPerSecond in more places in WebCore
https://bugs.webkit.org/show_bug.cgi?id=223656
Reviewed by Tim Horton.
Use FramesPerSecond rather than 'unsigned' in more places in WebCore.
* page/Chrome.h:
* page/Page.cpp:
(WebCore::Page::windowScreenDidChange):
* page/Page.h:
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::windowScreenDidChange):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::windowScreenDidChange):
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::windowScreenDidChange):
* page/scrolling/ScrollingTree.h:
* platform/HostWindow.h:
2021-03-23 Yusuke Suzuki <ysuzuki@apple.com>
[JSC] Functor for WeakGCMap::ensureValue must not invoke GC
https://bugs.webkit.org/show_bug.cgi?id=223629
Reviewed by Mark Lam.
Test: js/dom/weak-gc-map-ensure-value-should-not-invoke-gc.html
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::createCrossOriginFunction):
(WebCore::JSDOMGlobalObject::createCrossOriginGetterSetter):
2021-03-23 Chris Dumez <cdumez@apple.com>
Unreviewed, rebaseline bindings tests after r274906.
* bindings/scripts/test/JS/JSTestCEReactions.cpp:
* bindings/scripts/test/JS/JSTestCallTracer.cpp:
* bindings/scripts/test/JS/JSTestConditionalIncludes.cpp:
* bindings/scripts/test/JS/JSTestDomainSecurity.cpp:
* bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestLegacyNoInterfaceObject.cpp:
* bindings/scripts/test/JS/JSTestMapLikeWithOverriddenOperations.cpp:
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeableProperties.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns.cpp:
* bindings/scripts/test/JS/JSTestNode.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestOperationConditional.cpp:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
* bindings/scripts/test/JS/JSTestSetLikeWithOverriddenOperations.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
2021-03-23 Chris Dumez <cdumez@apple.com>
Unreviewed build fix after r274832.
* bindings/scripts/CodeGeneratorJS.pm:
(AddToIncludesForIDLType):
2021-03-23 Adrian Perez de Castro <aperez@igalia.com>
[CMake] Use an imported target for the LCMS2 library
https://bugs.webkit.org/show_bug.cgi?id=223442
Reviewed by Carlos Garcia Campos.
No new tests needed.
* PlatformGTK.cmake: Use the LCMS::LCMS2 imported target, only with USE_LCMS enabled.
* PlatformWPE.cmake: Ditto.
2021-03-23 Jer Noble <jer.noble@apple.com>
[Cocoa][Opus] Protect against variable frame duration packets
https://bugs.webkit.org/show_bug.cgi?id=223623
Reviewed by Eric Carlson.
Because frames-per-packet and frame duration are carried within the TOC of each individual
frame, it's theoretically possible to construct an Opus stream where those values change
without a new initialization segment, a situation which CoreAudio does not currently
support. In the case such a stream is encountered, bail with an error code during parsing,
rather than passing such data on to CoreAudio for decoding.
To do so, extract some of the Opus private data parsing code from
createOpusAudioFormatDescription(), into its own method parseOpusPrivateData(). Create a new
struct type OpusCookieContents to recieve this parsed data. And to avoid excessive
allocations during parsing, ensure that these methods support stack-based structures through
an out-param (as opposed to returning an Optional<> struct).
* platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::SourceBufferParserWebM::AudioTrackData::consumeFrameData):
* platform/graphics/cocoa/SourceBufferParserWebM.h:
* platform/graphics/cocoa/WebMAudioUtilitiesCocoa.h:
* platform/graphics/cocoa/WebMAudioUtilitiesCocoa.mm:
(WebCore::parseOpusPrivateData):
(WebCore::cookieFromOpusCookieContents):
(WebCore::createOpusAudioFormatDescription):
(WebCore::cookieFromOpusCodecPrivate): Deleted.
2021-03-23 Chris Dumez <cdumez@apple.com>
[UBSan] dom/Document.cpp:2722:23: runtime error: reference binding to null pointer of type 'JSC::CallFrame'
https://bugs.webkit.org/show_bug.cgi?id=223642
Reviewed by Darin Adler.
Use a raw pointer instead of a reference for the JSC::CallFrame and null check it to make sure
the code is safe and its behavior is defined.
* dom/Document.cpp:
(WebCore::Document::shouldBypassMainWorldContentSecurityPolicy const):
2021-03-23 Jiewen Tan <jiewen_tan@apple.com>
Provide a way to specify platform vs security key when requesting an assertion in the SPI
https://bugs.webkit.org/show_bug.cgi?id=223547
<rdar://74034746>
Reviewed by Brent Fulgham.
Covered by API tests.
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/webauthn/AuthenticatorAttachment.h: Added.
* Modules/webauthn/AuthenticatorAttachment.idl: Added.
* Modules/webauthn/PublicKeyCredentialCreationOptions.h:
* Modules/webauthn/PublicKeyCredentialCreationOptions.idl:
* Modules/webauthn/PublicKeyCredentialRequestOptions.h:
* WebCore.xcodeproj/project.pbxproj:
2021-03-23 Sihui Liu <sihui_liu@apple.com>
Add write barrier to JSValueInWrappedObject for garbage collection
https://bugs.webkit.org/show_bug.cgi?id=198319
Reviewed by Filip Pizlo.
* bindings/js/JSValueInWrappedObject.h:
(WebCore::cachedPropertyValue):
2021-03-23 Aditya Keerthi <akeerthi@apple.com>
[iOS][FCR] Add pressed state for button-like controls
https://bugs.webkit.org/show_bug.cgi?id=223208
<rdar://problem/72399087>
Reviewed by Simon Fraser.
Add a pressed state for buttons, checkboxes, radio buttons, select
elements and date inputs. The pressed state has a 75% opacity applied
to the text and background colors.
* css/html.css:
Explicitly set the default active style on buttons to ensure styles are
are adjusted when the element is pressed.
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
The style adjustment is only performed if the -webkit-appearance property
is not set to none. This ensures we do not override the colors for
custom styled form controls.
(WebCore::adjustInputElementButtonStyle):
(WebCore::RenderThemeIOS::adjustMenuListButtonStyle const):
(WebCore::RenderThemeIOS::adjustButtonStyle const):
(WebCore::RenderThemeIOS::checkboxRadioBackgroundColor):
Factored out the background color determination for checkboxes and
radio buttons into a common method.
(WebCore::RenderThemeIOS::checkboxRadioIndicatorColor):
Factored out the indicator color determination for checkboxes and
radio buttons into a common method.
(WebCore::RenderThemeIOS::paintCheckbox):
(WebCore::RenderThemeIOS::paintRadio):
2021-03-23 Peng Liu <peng.liu6@apple.com>
Enable the quirk to disable firing "webkitendfullscreen" event when a video enters picture-in-picture from fullscreen on espn.com
https://bugs.webkit.org/show_bug.cgi?id=223610
Reviewed by Jer Noble.
A video element entering picture-in-picture from fullscreen will fire a "webkitendfullscreen"
event since r266728, but some sites (e.g., espn.com) do not handle the event properly.
Because they assume the video will resume to inline after exiting fullscreen.
This patch enables the quirk for espn.com to disable firing "webkitendfullscreen" event
in that scenario before they fix the issue in the event handler.
* page/Quirks.cpp:
(WebCore::Quirks::shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk const):
2021-03-23 Chris Dumez <cdumez@apple.com>
dom/WheelEvent.cpp:47:58: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
https://bugs.webkit.org/show_bug.cgi?id=223605
Reviewed by Darin Adler.
Fix issues found by UBSan in the WheelEvent constructor:
- wheelDeltaX / wheelDeltaY have type int and we negate those values to compute deltaX / deltaY (which have type double).
If wheelDeltaX / wheelDeltaY where INT_MIN, then -INT_MIN would overflow. To address the issue, we now cast to double
*before* negating the value.
- When wheelDeltaX / wheelDeltaY are initially 0, we compute their value from deltaX / deltaY. However, deltaX & deltaY
use type double while wheelDeltaX / wheelDeltaY use type int. As a result, values for deltaX / deltaY could end up
being out of range and not fit in wheelDeltaX / wheelDeltaY. To address the issue, we use clampTo<int>() to clamp to
the correct destination range.
Test: fast/events/wheelevent-delta-overflow.html
* dom/WheelEvent.cpp:
(WebCore::WheelEvent::WheelEvent):
(WebCore::WheelEvent::initWebKitWheelEvent):
2021-03-23 Jean-Yves Avenard <jya@apple.com>
Only send image across XPC to GPU process if it changes.
https://bugs.webkit.org/show_bug.cgi?id=223298
<rdar://problem/75559236>
Reviewed by Eric Carlson.
No change in observable functionality.
* platform/NowPlayingManager.cpp:
(WebCore::NowPlayingManager::setNowPlayingInfo): On first image change we store it to a local member variable and set imageData to null.
(WebCore::NowPlayingManager::setNowPlayingInfoPrivate): Check if imageData is null, and if so use cache value.
* platform/NowPlayingManager.h: New member to store cache.
2021-03-23 Chris Dumez <cdumez@apple.com>
Add assertions to guard against heap allocations on the audio thread
https://bugs.webkit.org/show_bug.cgi?id=223226
Reviewed by Darin Adler.
Add assertions to guard against heap allocations on the audio thread during
audio processing, since those are bad for performance. I fixed any of the
issues found by these assertions in dependency bugs. Some issues remain
and are protected by DisableMallocRestrictionsForCurrentThreadScope to avoid
tripping the new assertions.
Right now, the assertions only protect audio processing, not pre/post quantum
rendering casts. Ideally, we'd expand the scope of these assertions to cover
everything that's done on the audio thread but this will require more fixes.
* Modules/webaudio/AudioDestinationNode.cpp:
(WebCore::AudioDestinationNode::render):
* Modules/webaudio/AudioScheduledSourceNode.cpp:
(WebCore::AudioScheduledSourceNode::finish):
* Modules/webaudio/AudioWorkletNode.cpp:
(WebCore::AudioWorkletNode::fireProcessorErrorOnMainThread):
* Modules/webaudio/AudioWorkletProcessor.cpp:
(WebCore::AudioWorkletProcessor::process):
* Modules/webaudio/MediaStreamAudioSourceCocoa.cpp:
(WebCore::MediaStreamAudioSource::consumeAudio):
* Modules/webaudio/ScriptProcessorNode.cpp:
(WebCore::ScriptProcessorNode::process):
2021-03-23 Philippe Normand <pnormand@igalia.com>
[MSE][GStreamer] SIGSEV in webKitMediaSrcFreeStream
https://bugs.webkit.org/show_bug.cgi?id=220091
Reviewed by Xabier Rodriguez-Calvar.
The pipeline used by the MSE player is now able reload the MediaSource from the beginning if
a seek to 0 was requested. The problem was that uridecodebin was creating a new source
element and notifying the player which was then trying to dispose underlying platform track
informations, and also related appsrc elements. The latter was specially problematic because
the appsrc elements ownership was badly handled (elements added to a bin should not be
reused, unless an extra ref is added), leading to racy crashes.
So now when uridecodebin creates a new source element, the player detects this is a new
source and transfers track-related informations to the new element. Additionally, new appsrc
elements are created for the new element and track signals emitted so that the player is
still fully aware of the MSE tracks topology.
No new tests but two existing tests are now passing.
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::load):
(WebCore::MediaPlayerPrivateGStreamerMSE::sourceSetup):
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
* platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp:
(WebCore::MediaSourcePrivateGStreamer::open):
* platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h:
* platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
(WebCore::PlaybackPipeline::addSourceBuffer):
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
(webKitMediaSrcFinalize):
(webKitMediaSrcChangeState):
(webKitMediaSrcFreeStream):
(webKitMediaSrcRestoreTracks):
(webKitMediaSrcSignalTracks):
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h:
2021-03-23 Philippe Normand <pnormand@igalia.com>
[GTK] X11 build fixes
https://bugs.webkit.org/show_bug.cgi?id=223577
Reviewed by Adrian Perez de Castro.
X11 headers define a bunch of macros with common terms, interfering with WebCore and WTF
enum values. As a workaround, we explicitly undef them.
* platform/graphics/GLContext.h:
* platform/graphics/GraphicsContext.h:
2021-03-23 Frédéric Wang <fwang@igalia.com>
Nullptr deref in WebCore::ApplyStyleCommand::applyRelativeFontStyleChange
https://bugs.webkit.org/show_bug.cgi?id=223364
Reviewed by Ryosuke Niwa.
When the editing code creates a span to apply font style change, it may not have editable
style if the document sets extra style (e.g. user-select: all). This is causing a debug
ASSERT in AppendNodeCommand::AppendNodeCommand when the span is inserted and a nullptr
dereference later in release mode. This patch ensures that we skip the font style change
when that happens.
Test: editing/style/apply-font-style-change-crash.html
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyRelativeFontStyleChange): Skip the font style change if
the span insertion failed.
(WebCore::ApplyStyleCommand::surroundNodeRangeWithElement): After inserting the new element,
ensure that the conditions from the ASSERT of AppendNodeCommand::AppendNodeCommand hold and
return failure if they don't.
* editing/ApplyStyleCommand.h: Return a boolean indicating success.
2021-03-23 Zalan Bujtas <zalan@apple.com>
[ContentChangeObserver] Unable to view state details on CDC COVID map
https://bugs.webkit.org/show_bug.cgi?id=223620
<rdar://74284133>
Reviewed by Simon Fraser.
When the content change observer sees some visibility change, it checks if the newly visible content is actionable (e.g. something the user can click on).
A non-actionable content is considered less important than the action behind the "click". So while we trigger the hover state we immediately proceed with click as well.
(e.g. on youtube.com, hovering over the controls (settings, volume etc) brings up a (non-actionable) tooltip and the subsequent click triggers the associated action.
Now on iPadOS, it would require 2 taps on the mute/unmute button to actually mute/unmute the video, if we stopped at the hover state)
This patch implements a quirk for the CDC Covid map so that tapping on the map brings up the numbers dialog and we only submit the click event on the subsequent tap.
* page/Quirks.cpp:
(WebCore::Quirks::shouldTooltipPreventFromProceedingWithClick const):
* page/Quirks.h:
* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::isConsideredActionableContent const): moved the isConsideredClickable logic to a lambda function. Call it when we don't apply the quirk.
(WebCore::ContentChangeObserver::didFinishTransition):
(WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
(WebCore::isConsideredClickable): Deleted.
* page/ios/ContentChangeObserver.h:
2021-03-23 Frédéric Wang <fwang@igalia.com>
Nullopt in DOMSelection::getRangeAt
https://bugs.webkit.org/show_bug.cgi?id=223361
Reviewed by Ryosuke Niwa.
When extending the selection toward a pseudo element, it's possible to reach the
corresponding debug ASSERT in WebCore::Position::Position and later a nullptr dereference in
release mode. This patch fixes start/endPositionForLine to avoid that issue.
Test: editing/selection/modify-by-lineboundary-toward-pseudo-element.html
* editing/VisibleUnits.cpp: Make the two branches of LineEndpointComputationMode consistent
and merge them.
(WebCore::startPositionForLine): For logical ordering, try a non-pseudo element after.
(WebCore::endPositionForLine): For logical ordering, try a non-pseudo element before.
2021-03-23 Frédéric Wang <fwang@igalia.com>
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-23 Kimmo Kinnunen <kkinnunen@apple.com>
REGRESSION(r274860): error: class WebCore::ExtensionsGLOpenGLCommon has no member named drawArraysInstancedANGLE
https://bugs.webkit.org/show_bug.cgi?id=223633
Unreviewed build fix.
Fix WPE build by adding the functions to ExtensionsGLOpenGLCommon as pure virtual functions.
* platform/graphics/opengl/ExtensionsGLOpenGL.h:
* platform/graphics/opengl/ExtensionsGLOpenGLCommon.h:
2021-03-23 Kimmo Kinnunen <kkinnunen@apple.com>
Move instanced drawing functionality from ExtensionsGL to GraphicsContextGL
https://bugs.webkit.org/show_bug.cgi?id=223179
Reviewed by Kenneth Russell.
Remove unused instanced rendering functions from ExtensionsGL.
They are already in GraphicsContextGL interfaces.
ExtensionsGL is being removed as it is redundant. The extension object
is the same object as the context object and not useful.
* platform/graphics/ExtensionsGL.h:
* platform/graphics/angle/ExtensionsGLANGLE.cpp:
* platform/graphics/angle/ExtensionsGLANGLE.h:
* platform/graphics/opengl/ExtensionsGLOpenGL.h:
2021-03-23 Kimmo Kinnunen <kkinnunen@apple.com>
ANGLE is missing the explicit context headers
https://bugs.webkit.org/show_bug.cgi?id=223470
Reviewed by Alexey Proskuryakov.
* platform/graphics/angle/ANGLEHeaders.h:
Remove the hack that was needed when including ANGLE without
the explicit context headers.
2021-03-23 Martin Robinson <mrobinson@igalia.com>
No scrolling momentum with 'scroll-snap-type: x mandatory' if the scroller scrolls vertically
https://bugs.webkit.org/show_bug.cgi?id=213571
<rdar://problem/64715507>
Reviewed by Simon Fraser.
When handling momentum scrolling for scroll containers that snap, use the
predicted momentum scroll destination for axes that do not snap. Using
the initial scroll offset here was causing momentum scrolling in these axes
to end prematurely.
Test: tiled-drawing/scrolling/scroll-snap/scroll-snap-momentum-in-non-snapping-axis.html
* platform/ScrollSnapAnimatorState.cpp:
(WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset const): Use the predicted
scroll offset. Even though the startOffset parameter is no longer used, do not remove
it because it will be used in the fix for https://bugs.webkit.org/show_bug.cgi?id=223406.
2021-03-23 Said Abou-Hallawa <said@apple.com>
SVG links navigate only to internal animation elements and <view> anchors
https://bugs.webkit.org/show_bug.cgi?id=223161
Reviewed by Ryosuke Niwa.
The specs for the SVG anchor element <a> have changed in SVG2.
Link: https://svgwg.org/svg2-draft/linking.html#Links
After deprecating the xlink namespace, the SVG anchor element <a> became
very similar to HTMLs <a> element. They both use attributes in the default
namespace.
* svg/SVGAElement.cpp:
(WebCore::SVGAElement::defaultEventHandler):
2021-03-22 Venky Dass <yaranamavenkataramana@apple.com>
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 Julian Gonzalez <julian_a_gonzalez@apple.com>
Crash in ReplaceSelectionCommand::doApply()
https://bugs.webkit.org/show_bug.cgi?id=223545
Reviewed by Ryosuke Niwa.
Test: editing/execCommand/insert-image-in-composed-list.html
Add a missing check in ReplaceSelectionCommand::doApply()
to prevent calling splitTreeToNode() with nullptr.
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::doApply):
2021-03-22 Ryosuke Niwa <rniwa@webkit.org>
Use JSValueInWrappedObject to keep the JSObject alive for QuickTimePluginReplacement
https://bugs.webkit.org/show_bug.cgi?id=223561
<rdar://75634407>
Reviewed by Geoffrey Garen.
This patch replaces QuickTimePluginReplacement's m_scriptObject member variable by
JSValueInWrappedObject in HTMLPlugInElement and hooks it up with the slot visitor.
Also use WeakPtr instead of a raw pointer for the back reference to the plugin element
in QuickTimePluginReplacement and YouTubePluginReplacement.
* Modules/plugins/PluginReplacement.h:
(WebCore::PluginReplacement::InstallResult): Added; a boolean indicating the installation
had succeeded and the script object for QuickTimePluginReplacement.
(WebCore::PluginReplacement::scriptObject): Deleted.
* Modules/plugins/QuickTimePluginReplacement.h:
* Modules/plugins/QuickTimePluginReplacement.mm:
(WebCore::QuickTimePluginReplacement::QuickTimePluginReplacement): Deployed WeakPtr.
(WebCore::QuickTimePluginReplacement::~QuickTimePluginReplacement): Removed
the superflous de-initialization of the member variables.
(WebCore::QuickTimePluginReplacement::installReplacement): Now returns JSValue
instead of storing it in m_scriptObject.
* Modules/plugins/YouTubePluginReplacement.cpp:
(WebCore::YouTubePluginReplacement::YouTubePluginReplacement): Deployed WeakPtr.
(WebCore::YouTubePluginReplacement::installReplacement):
* Modules/plugins/YouTubePluginReplacement.h:
* bindings/scripts/CodeGeneratorJS.pm:
(InstanceNeedsVisitChildren): Generate visitChildren when an IDL has Plugin attribute.
(GenerateImplementation): Visit the newly added JSValueInWrappedObject.
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot): Store the script object returned
by QuickTimePluginReplacement::installReplacement in the newly added member variable.
(WebCore::HTMLPlugInElement::scriptObjectForPluginReplacement): Updated.
* html/HTMLPlugInElement.h:
(WebCore::HTMLPlugInElement::pluginReplacementScriptObject): Added. Used by visitChildren.
2021-03-22 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process]: Improve getImageData() perf part 1: Add a GetImageData display list item
https://bugs.webkit.org/show_bug.cgi?id=223544
Unreviewed.
I accidentally forgot to commit one line of the patch!!
* platform/graphics/displaylists/DisplayListItems.h:
2021-03-22 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process]: Improve getImageData() perf part 1: Add a GetImageData display list item
https://bugs.webkit.org/show_bug.cgi?id=223544
Reviewed by Wenson Hsieh.
We're moving to a design for getImageData() where the web process and the GPU process
set up a shmem + semaphore ahead-of-time, so that when we encounter a call to getImageData(),
the GPU process can just write into the shmem and signal the semaphore. The web process just
encodes the getImageData() call into the regular display list, flushAsync()s to kick the GPU
process, then just waits on the semaphore. Initial performance testing shows that this is
way, way faster than sending messages containing pixel color data payloads.
This patch is just the first step: Adding a GetImageData display list item. The item
currently gets recorded in the web process and applied in the GPU process, but the application
process currently does nothing.
No new tests because there is no behavior change yet.
* 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/DisplayListItemBuffer.h:
* 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<<):
(WebCore::DisplayList::PutImageData::apply const): Deleted.
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::GetImageData::GetImageData):
(WebCore::DisplayList::GetImageData::outputFormat const):
(WebCore::DisplayList::GetImageData::srcRect const):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::getImageData):
* platform/graphics/displaylists/DisplayListRecorder.h:
2021-03-22 Sam Weinig <weinig@apple.com>
[WebIDL] Remove the need to specify [MayThrowException]
https://bugs.webkit.org/show_bug.cgi?id=180019
Reviewed by Darin Adler and Chris Dumez.
Removes the need to specify [MayThrowException] by deducing it from the bound
signature's return value. Any function returning an ExceptionOr is one that throws.
In most cases, this was already handled by toJS<>(..., impl.func()), which had
overloads for the case that the value was an ExceptionOr. The cases this didn't
work for were funtions that returned void, as toJS<>(..., impl.func()) would not
compile. To work around this, toJS<>() can now take a lambda as its value, and
can determine via the lambda's return type if it needs to throw. For instance,
an IDL operation like:
[MayThrowException] undefined func();
used to generate a bindings body that looked like the following :
auto& impl = castedThis->wrapped();
throwScope.release();
propagateException(*lexicalGlobalObject, throwScope, impl.func());
return JSValue::encode(jsUndefined());
will now generate a bindings body that looks like:
auto& impl = castedThis->wrapped();
RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.func(); })));
which closely mirrors a non-undefined return operation. This wrapped lambda form
is only used for operations returning undefined or promises, as those are the only
functions that can return void, but it would be correct to use them for all types,
if not a bit more noisy and perhaps a tiny compile time cost.
NOTE: The use of `-> decltype(auto)` explicit return type on the lambda is required
to perfectly forward reference types, such as those used by owned promises. Otherwise,
a copy constructor is invoked.
In addition to supporting all operations, this also removes the requirement to annotate
named and indexed getters/setters. This mostly just means always defining a throw scope,
but for named getters it also meant adding a new helper, `visibleNamedPropertyItemAccessorFunctor`
which constructors the item accessor functor for the `accessVisibleNamedProperty`
algorithm rather than hard coding it in the generator.
Due to increased use of toJS, the code generator is now checking more return types
(via AddToImplIncludesForIDLType) so the code generator was able to find a few invalid
return types (e.g. use of Promise<bool> rather than Promise<boolean>, etc.) and these
have been fixed and will be an error going forward. Would be a nice improvement to
the code generator to do type checking up front, rather than as a side effect of
code generation, but we will leave that for another day.
* bindings/js/JSDOMAbstractOperations.h:
(WebCore::visibleNamedPropertyItemAccessorFunctor):
Added. Moves the getterFunctor lambda creation from the GenerateNamedGetterLambda
subroutine in CodeGeneratorJS.pm, but uses deduction and constexpr to determine
if the getter throws.
(WebCore::accessVisibleNamedProperty):
Rename Functor to ItemAccessor to make it a bit more clear what the type does.
* bindings/js/JSDOMConvertBase.h:
(WebCore::toJS):
(WebCore::toJSNewlyCreated):
Replace SFINAE-based overloading of toJS/toJSNewlyCreated with constexpr based
conditionals and add the ability to pass in a functor rather than value. If a
functor is used, additional code paths for void and ExpectionOr<void> are added
which explicitly return jsUndefined().
* bindings/js/JSDOMConvertDate.cpp:
Remove incorrect comment about ExecStates that hasn't applied for a while.
* bindings/js/JSDOMConvertSequences.h:
Fix comment, replacing ExecState with JSGlobalObject. This has been wrong for
a while, and this is just a drive by fix.
* bindings/js/JSDOMExceptionHandling.h:
(WebCore::invokeFunctorPropagatingExceptionIfNecessary):
Use an explicit else as part of the constexpr expression to ensure the functor
is not called, even in debug builds.
* bindings/js/JSDOMPromiseDeferred.cpp:
(WebCore::createDeferredPromise): Deleted.
* bindings/js/JSDOMPromiseDeferred.h:
Remove unused createDeferredPromise function.
* bindings/scripts/CodeGeneratorJS.pm:
(AddMapLikeAttributesAndOperationIfNeeded):
(AddSetLikeAttributesAndOperationIfNeeded):
Fix return type of mapped clear operation to be `any` rather than `undefined`
to match the implementation, which returns a JSValue (e.g. `any`). This is now
required as we actually look at the return type via deduction and need it to match.
(GenerateNamedGetterLambda):
Replace most of the implementation with a call to the new `visibleNamedPropertyItemAccessorFunctor`
helper which returns a lambda with the correct behavior depending on the return type of the inner
lambda passed.
(GenerateGetOwnPropertySlot):
(GenerateGetOwnPropertySlotByIndex):
(GenerateAttributeGetterBodyDefinition):
Match most other parts of the generator and always create a throw scope.
(GenerateOperationDefinition):
Remove explicit call to propagateException now that toJS() will handle that for us.
(GenerateParametersCheck):
Remove explicit call to propagateException now that toJS() will handle that for us.
(GenerateImplementationFunctionCall):
Simplify by using invokeFunctorPropagatingExceptionIfNecessary helper for the "returnArgumentName"
case and relying on toJS handling the other cases.
(NativeToJSValueMayThrow):
Add operation to the list of things that might always throw.
(NativeToJSValue):
Use the lambda wrapped version of toJS for undefined and promise types, which might both
return void and thus require it. To keep most code unchanged, and avoid unnecessary compiler
work, we only use the wrapped version when it might be necessary. If it turns out to be
cheep enough, it might make sense to always use this form for simplicity.
(NeedsExplicitPropagateExceptionCall): Deleted.
* bindings/scripts/IDLAttributes.json:
Remove MayThrowException.
* dom/Element.idl:
* dom/Element.h:
(WebCore::Element::removeAttributeForBindings):
(WebCore::Element::removeAttributeNSForBindings):
Add bindings specific versions of `removeAttribute` and `removeAttributeNS` which
have a void return type (rather than the bool used by the main implementation)
as it is now a requirement that that the bound functions signature match the IDL.
* Modules/cache/DOMCache.idl:
Use the correct interface name, `FetchRequest`, not `Request`.
* Modules/cache/DOMCacheStorage.idl:
Use the correct interface name, `DOMCache`, not `Cache`.
* Modules/encryptedmedia/MediaKeySession.idl:
* Modules/encryptedmedia/MediaKeys.idl:
* dom/Document+StorageAccess.idl:
* page/Navigator+IsLoggedIn.idl:
Use the correct IDL type, `boolean`, not `bool`.
* dom/AbortSignal.idl:
Update whenSignalAborted to match the return type of implementation, which is `boolean`,
not `undefined`.
* testing/ServiceWorkerInternals.idl:
Use the correct interface name, `FetchResponse`, not `Response`.
* workers/service/ServiceWorkerClients.idl:
Use the correct interface names, `ServiceWorkerClient`, not `Client`, and `ServiceWorkerWindowClient`, not `WindowClient`.
* workers/service/ServiceWorkerWindowClient.idl:
Use the correct interface names, `ServiceWorkerWindowClient`, not `WindowClient`.
* Modules/applepay/ApplePaySession.idl:
* Modules/beacon/Navigator+Beacon.idl:
* Modules/cache/DOMWindow+Caches.idl:
* Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl:
* Modules/encryptedmedia/legacy/WebKitMediaKeys.idl:
* Modules/fetch/FetchHeaders.idl:
* Modules/fetch/FetchRequest.idl:
* Modules/fetch/FetchResponse.idl:
* Modules/indexeddb/IDBCursor.idl:
* Modules/indexeddb/IDBDatabase.idl:
* Modules/indexeddb/IDBFactory.idl:
* Modules/indexeddb/IDBIndex.idl:
* Modules/indexeddb/IDBKeyRange.idl:
* Modules/indexeddb/IDBObjectStore.idl:
* Modules/indexeddb/IDBTransaction.idl:
* Modules/mediarecorder/MediaRecorder.idl:
* Modules/mediasession/MediaMetadata.idl:
* Modules/mediasession/MediaSession.idl:
* Modules/mediasource/MediaSource.idl:
* Modules/mediasource/SourceBuffer.idl:
* Modules/mediastream/RTCDTMFSender.idl:
* Modules/mediastream/RTCDataChannel.idl:
* Modules/mediastream/RTCPeerConnection.idl:
* Modules/mediastream/RTCRtpReceiver+Transform.idl:
* Modules/mediastream/RTCRtpSFrameTransform.idl:
* Modules/mediastream/RTCRtpScriptTransformer.idl:
* Modules/mediastream/RTCRtpSender+Transform.idl:
* Modules/mediastream/RTCRtpSender.idl:
* Modules/mediastream/RTCRtpTransceiver.idl:
* Modules/paymentrequest/MerchantValidationEvent.idl:
* Modules/paymentrequest/PaymentRequestUpdateEvent.idl:
* Modules/speech/SpeechRecognition.idl:
* Modules/webaudio/AudioBuffer.idl:
* Modules/webaudio/AudioBufferSourceNode.idl:
* Modules/webaudio/AudioContext.idl:
* Modules/webaudio/AudioListener.idl:
* Modules/webaudio/AudioNode.idl:
* Modules/webaudio/AudioParam.idl:
* Modules/webaudio/AudioScheduledSourceNode.idl:
* Modules/webaudio/AudioWorkletGlobalScope.idl:
* Modules/webaudio/AudioWorkletProcessor.idl:
* Modules/webaudio/BaseAudioContext.idl:
* Modules/webaudio/BiquadFilterNode.idl:
* Modules/webaudio/IIRFilterNode.idl:
* Modules/webaudio/PannerNode.idl:
* Modules/webaudio/WebKitAudioBufferSourceNode.idl:
* Modules/webaudio/WebKitAudioContext.idl:
* Modules/webdatabase/SQLResultSetRowList.idl:
* Modules/webdatabase/SQLTransaction.idl:
* Modules/websockets/WebSocket.idl:
* Modules/webxr/WebXRFrame.idl:
* Modules/webxr/WebXRReferenceSpace.idl:
* Modules/webxr/WebXRSession.idl:
* Modules/webxr/WebXRWebGLLayer.idl:
* animation/Animatable.idl:
* animation/AnimationEffect.idl:
* animation/KeyframeEffect.idl:
* animation/WebAnimation.idl:
* css/CSSGroupingRule.idl:
* css/CSSStyleDeclaration.idl:
* css/CSSStyleSheet.idl:
* css/DOMCSSNamespace+CSSPropertiesandValues.idl:
* css/DOMMatrix.idl:
* css/DOMMatrixReadOnly.idl:
* css/DeprecatedCSSOMPrimitiveValue.idl:
* css/FontFaceSet.idl:
* css/MediaList.idl:
* dom/CharacterData.idl:
* dom/ChildNode.idl:
* dom/CustomElementRegistry.idl:
* dom/DOMImplementation.idl:
* dom/DOMPointReadOnly.idl:
* dom/DataTransferItemList.idl:
* dom/Document+HTML.idl:
* dom/Document.idl:
* dom/Element+DOMParsing.idl:
* dom/Element+PointerEvents.idl:
* dom/EventTarget.idl:
* dom/MessagePort.idl:
* dom/MutationObserver.idl:
* dom/NamedNodeMap.idl:
* dom/Node.idl:
* dom/NodeIterator.idl:
* dom/ParentNode.idl:
* dom/Range+DOMParsing.idl:
* dom/Range.idl:
* dom/Text.idl:
* dom/TextDecoder.idl:
* dom/TextDecoderStreamDecoder.idl:
* dom/TreeWalker.idl:
* fileapi/Blob.idl:
* fileapi/FileReader.idl:
* fileapi/FileReaderSync.idl:
* html/DOMTokenList.idl:
* html/HTMLCanvasElement.idl:
* html/HTMLDialogElement.idl:
* html/HTMLEmbedElement.idl:
* html/HTMLFrameElement.idl:
* html/HTMLIFrameElement.idl:
* html/HTMLInputElement.idl:
* html/HTMLMediaElement.idl:
* html/HTMLObjectElement.idl:
* html/HTMLOptionsCollection.idl:
* html/HTMLSelectElement.idl:
* html/HTMLTableElement.idl:
* html/HTMLTableRowElement.idl:
* html/HTMLTableSectionElement.idl:
* html/HTMLTextAreaElement.idl:
* html/HTMLVideoElement.idl:
* html/OffscreenCanvas.idl:
* html/TimeRanges.idl:
* html/canvas/CanvasDrawImage.idl:
* html/canvas/CanvasFillStrokeStyles.idl:
* html/canvas/CanvasGradient.idl:
* html/canvas/CanvasImageData.idl:
* html/canvas/CanvasPath.idl:
* html/canvas/CanvasPattern.idl:
* html/canvas/CanvasTransform.idl:
* html/canvas/ImageBitmapRenderingContext.idl:
* html/canvas/Path2D.idl:
* html/canvas/WebGL2RenderingContext.idl:
* html/canvas/WebGLRenderingContextBase.idl:
* html/track/TextTrack.idl:
* inspector/InspectorAuditAccessibilityObject.idl:
* inspector/InspectorAuditDOMObject.idl:
* inspector/InspectorAuditResourcesObject.idl:
* loader/appcache/DOMApplicationCache.idl:
* page/Crypto.idl:
* page/DOMSelection.idl:
* page/DOMWindow.idl:
* page/History.idl:
* page/Location.idl:
* page/NavigatorServiceWorker.idl:
* page/Performance+UserTiming.idl:
* page/PerformanceObserver.idl:
* page/UndoManager.idl:
* page/UserMessageHandler.idl:
* page/WindowOrWorkerGlobalScope.idl:
* storage/Storage.idl:
* svg/SVGAngle.idl:
* svg/SVGGeometryElement.idl:
* svg/SVGGraphicsElement.idl:
* svg/SVGLength.idl:
* svg/SVGLengthList.idl:
* svg/SVGMatrix.idl:
* svg/SVGNumberList.idl:
* svg/SVGPathSegList.idl:
* svg/SVGPointList.idl:
* svg/SVGStringList.idl:
* svg/SVGTextContentElement.idl:
* svg/SVGTransform.idl:
* svg/SVGTransformList.idl:
* testing/InternalSettings.idl:
* testing/Internals.idl:
* workers/DedicatedWorkerGlobalScope.idl:
* workers/Worker.idl:
* workers/WorkerGlobalScope.idl:
* workers/service/ExtendableEvent.idl:
* workers/service/FetchEvent.idl:
* workers/service/ServiceWorker.idl:
* workers/service/ServiceWorkerClient.idl:
* worklets/PaintWorkletGlobalScope.idl:
* xml/DOMParser.idl:
* xml/XMLHttpRequest.idl:
* xml/XPathEvaluatorBase.idl:
* xml/XPathExpression.idl:
* xml/XPathResult.idl:
Remove use of [MayThrowException].
* bindings/scripts/test/JS/*:
Remove uses of [MayThrowException] in the tests and update all the test results.
2021-03-22 Fujii Hironori <Hironori.Fujii@sony.com>
Unreviewed build fix for AppleWin after r274827
https://bugs.webkit.org/show_bug.cgi?id=223500
<rdar://problem/75706741>
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::createFontCustomPlatformData):
2021-03-22 Jean-Yves Avenard <jya@apple.com>
Move management of RemoteCommandListener from MediaSessionManagerCocoa into NowPlayingManager.
https://bugs.webkit.org/show_bug.cgi?id=223435
<rdar://problem/75567198>
Reviewed by Eric Carlson.
NowPlaying and RemoteCommandListener kind of do the same things, as such it make sense to combine the two
and hide the implementation details from consumers.
We move the handling of setting and clearing the NowPlayingInfo information to an expanded
NowPlayingManager which now also runs in the webcontent process.
The job to ensure a RemoteCommandListener is set is now up to the NowPlayingManager as well as
dealing with changes in NowPlayingInfo content.
Ideally we would prefer to remove all code related to MediaRemote from MediaSessionManagerCocoa;
however for ease we leave it there to avoid having to deal with objective-C interface in NowPlayingManager.
No change in observable behavior.
* platform/MediaStrategy.h: The two existing methods dealing with NowPlayingInfo are removed, instead we can override the entire creation of the NowPlayingManager.
* platform/MediaStrategy.cpp:
(WebCore::MediaStrategy::createNowPlayingManager const): default implementation for createNowPlayingManager
* platform/NowPlayingManager.cpp: Add methods used in MediaSessionManagerCocoa used to deal with RemoteCommandListener.
(WebCore::NowPlayingManager::didReceiveRemoteControlCommand):
(WebCore::NowPlayingManager::addClient): Add explicit method to add a RemoteCommandListener listener, to be called before calling setNowPlayingInfo if needed.
(WebCore::NowPlayingManager::removeClient): renamed from clearNowPlayingInfoClient.
(WebCore::NowPlayingManager::clearNowPlayingInfo):
(WebCore::NowPlayingManager::clearNowPlayingInfoPrivate): Virtual class with default implementation which will immediately communicate with MediaRemote.
(WebCore::NowPlayingManager::setNowPlayingInfo):
(WebCore::NowPlayingManager::setNowPlayingInfoPrivate): Virtual class with default implementation which will immediately communicate with MediaRemote.
(WebCore::NowPlayingManager::setSupportsSeeking): We explicitly set a different setSupportsSeeking method for code clarity.
(WebCore::NowPlayingManager::addSupportedCommand):
(WebCore::NowPlayingManager::removeSupportedCommand):
(WebCore::NowPlayingManager::setSupportedRemoteCommands):
(WebCore::NowPlayingManager::updateSupportedCommands):
(WebCore::NowPlayingManager::ensureRemoteCommandListenerCreated):
(WebCore::NowPlayingManager::clearNowPlayingInfoClient): Deleted.
* platform/NowPlayingManager.h:
* platform/audio/cocoa/MediaSessionManagerCocoa.h: Remove now unused members
* platform/audio/cocoa/MediaSessionManagerCocoa.mm: Amended to use new NowPlayingManager.
(WebCore::MediaSessionManagerCocoa::MediaSessionManagerCocoa):
(WebCore::MediaSessionManagerCocoa::scheduleSessionStatusUpdate):
(WebCore::MediaSessionManagerCocoa::addSession):
(WebCore::MediaSessionManagerCocoa::removeSession):
(WebCore::MediaSessionManagerCocoa::setCurrentSession):
(WebCore::MediaSessionManagerCocoa::addSupportedCommand):
(WebCore::MediaSessionManagerCocoa::removeSupportedCommand):
(WebCore::MediaSessionManagerCocoa::updateNowPlayingInfo):
2021-03-22 Fujii Hironori <Hironori.Fujii@sony.com>
Unreviewed build fix for AppleWin after r274791
https://bugs.webkit.org/show_bug.cgi?id=223500
<rdar://problem/75706741>
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::createFontCustomPlatformData):
2021-03-22 Chris Fleizach <cfleizach@apple.com>
AX: textRectsFromMarkers always fails
https://bugs.webkit.org/show_bug.cgi?id=223556
<rdar://74256003>
Reviewed by Zalan Bujtas.
The textRectsFromMarkers:text: method is always failing to return a valid answer because when we try to extend
the search range of text to search, we're creating a range that can't be iterated with a CharacterIterator
Test: accessibility/ios-simulator/text-rects-for-range-matches.html
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::rangeMatchesTextNearRange):
2021-03-22 Ian Gilbert <iang@apple.com>
[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 <pangle@apple.com>
Web Inspector: Port grid overlay drawing to iOS
https://bugs.webkit.org/show_bug.cgi?id=223396
Reviewed by BJ Burg.
Enable Grid Overlays to be drawn on iOS be including computed overlay objects in the
`InspectorOverlay::Highlight`. Some refactoring was also done to reduce code duplication in the normal and iOS
paths.
* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
- FloatLine should be accessible from `WebKit::*`
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::paint):
(WebCore::InspectorOverlay::getHighlight):
- Add `GridHighlightOverlay`s to the highlight object for iOS.
(WebCore::InspectorOverlay::drawGridOverlay):
(WebCore::buildLabel):
(WebCore::InspectorOverlay::buildGridOverlay):
- Refactored actual drawing into a separate method to reduce the amount of code duplication needed between the
normal path and the iOS path.
* inspector/InspectorOverlay.h:
(WebCore::InspectorOverlay::Highlight::GridHighlightOverlay::encode const):
(WebCore::InspectorOverlay::Highlight::GridHighlightOverlay::decode):
(WebCore::InspectorOverlay::Highlight::GridHighlightOverlay::Label::encode const):
(WebCore::InspectorOverlay::Highlight::GridHighlightOverlay::Label::decode):
(WebCore::InspectorOverlay::Highlight::GridHighlightOverlay::Area::encode const):
(WebCore::InspectorOverlay::Highlight::GridHighlightOverlay::Area::decode):
- Support encode/decode for sending new Highlight components to the UIProcess.
* platform/graphics/FloatLine.h:
(WebCore::FloatLine::encode const):
(WebCore::FloatLine::decode):
- Support encode/decode as part of serialization of `InspectorOverlay::Highlight`
2021-03-22 Ada Chan <ada.chan@apple.com>
[WebXR] Enumerate XR devices via ChromeClient in WebXRSystem
https://bugs.webkit.org/show_bug.cgi?id=223520
Reviewed by Sam Weinig.
We want to avoid using singletons in the WebProcess and be able
to proxy the devices from the UI process.
* Modules/webxr/WebXRSystem.cpp:
(WebCore::WebXRSystem::ensureImmersiveXRDeviceIsSelected):
Instead of getting the devices from the singleton PlatformXR::Instance,
get them from the ChromeClient.
* WebCore.xcodeproj/project.pbxproj:
Mark PlatformXR.h private so it's visible to WebKit.
* page/ChromeClient.h:
(WebCore::ChromeClient::enumerateImmersiveXRDevices):
The default implementation will call PlatformXR::Instance::enumerateImmersiveXRDevices()
to keep current functionality.
* platform/xr/PlatformXR.h:
Export methods that are now called in ChromeClient.
2021-03-22 Eric Carlson <eric.carlson@apple.com>
AVAudioSessionCaptureDeviceManager should use crossThreadCopy
https://bugs.webkit.org/show_bug.cgi?id=223565
<rdar://75480589>
Reviewed by Youenn Fablet.
Tested manually, this can only be tested on device.
* platform/mediastream/CaptureDevice.h: Change access restriction for member
variables from `private:` to `protected:` so derived classes can access them
directly.
* platform/mediastream/ios/AVAudioSessionCaptureDevice.h:
* platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
(WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice): New constructor.
(WebCore::AVAudioSessionCaptureDevice::isolatedCopy const): New.
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
(WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices): Use
`WTFMove(deviceList).isolatedCopy()` when moving from AVAudioSession queue
to main thread.
(WebCore::AVAudioSessionCaptureDeviceManager::getCaptureDevices): Ditto.
2021-03-22 Patrick Angle <pangle@apple.com>
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 Peng Liu <peng.liu6@apple.com>
[GPUP] Add a "wallTime" field to struct RemoteMediaPlayerState
https://bugs.webkit.org/show_bug.cgi?id=223523
Reviewed by Eric Carlson.
No new tests. Fix test failures:
- media/video-controller-child-rate.html
- media/media-controller-unpause.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::currentMediaTime const): A minor fix for the comment.
2021-03-22 Rob Buis <rbuis@igalia.com>
Enable ability to prevent scrolling in Element.focus()
https://bugs.webkit.org/show_bug.cgi?id=178583
Reviewed by Simon Fraser.
Add FocusOptions parameter to the focus method [1] both
to the IDL as the C++ side. Change Element.focus to not
scroll if FocusOptions.preventScroll is true.
Behavior matches Chrome and Firefox.
Tests: imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-textarea.html
imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-nested-scroll-elements.html
Test: imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-nested-scroll-elements.html
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/Element.cpp:
(WebCore::Element::focus):
* dom/Element.h:
(WebCore::Element::focus):
* dom/FocusOptions.h: Copied from Source/WebCore/html/HTMLOrForeignElement.idl.
* dom/FocusOptions.idl: Copied from Source/WebCore/html/HTMLOrForeignElement.idl.
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::didAttachRenderers):
* html/HTMLLabelElement.cpp:
(WebCore::HTMLLabelElement::focus):
* html/HTMLLabelElement.h:
* html/HTMLLegendElement.cpp:
(WebCore::HTMLLegendElement::focus):
* html/HTMLLegendElement.h:
* html/HTMLOrForeignElement.idl:
* html/InputType.cpp:
(WebCore::InputType::accessKeyAction):
* page/FocusController.cpp:
(WebCore::FocusController::advanceFocusInDocumentOrder):
(WebCore::FocusController::advanceFocusDirectionallyInContainer):
2021-03-22 Devin Rousso <drousso@apple.com>
Remove unused JS and CSS files of media controls
https://bugs.webkit.org/show_bug.cgi?id=214955
<rdar://problem/66604040>
Reviewed by Eric Carlson.
Cocoa platforms are already using modern media controls so there's no reason to keep the old
media controls resources/logic around any longer. It just wastes space.
The non-iOS Apple controls must be kept though as they are still used on Windows.
* Modules/mediacontrols/assets-apple-iOS.svg: Removed.
* Modules/mediacontrols/mediaControlsiOS.css: Removed.
* Modules/mediacontrols/mediaControlsiOS.js: Removed.
* rendering/RenderTheme.h:
(WebCore::RenderTheme::modernMediaControlsStyleSheet): Deleted.
* rendering/RenderThemeCocoa.h:
* rendering/RenderThemeCocoa.mm:
(WebCore::RenderThemeCocoa::purgeCaches): Added.
(WebCore::RenderThemeCocoa::mediaControlsStyleSheet): Added.
(WebCore::RenderThemeCocoa::mediaControlsScripts): Added.
(WebCore::RenderThemeCocoa::mediaControlsBase64StringForIconNameAndType): Added.
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::mediaControlsStyleSheet): Deleted.
(WebCore::RenderThemeIOS::modernMediaControlsStyleSheet): Deleted.
(WebCore::RenderThemeIOS::purgeCaches): Deleted.
(WebCore::RenderThemeIOS::mediaControlsScripts): Deleted.
(WebCore::RenderThemeIOS::mediaControlsBase64StringForIconNameAndType): Deleted.
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::mediaControlsStyleSheet): Deleted.
(WebCore::RenderThemeMac::modernMediaControlsStyleSheet): Deleted.
(WebCore::RenderThemeMac::purgeCaches): Deleted.
(WebCore::RenderThemeMac::mediaControlsScripts): Deleted.
(WebCore::RenderThemeMac::mediaControlsBase64StringForIconNameAndType): Deleted.
Move media controls functions to `RenderThemeCocoa` since they are identical.
* Modules/mediacontrols/MediaControlsHost.idl:
* Modules/mediacontrols/MediaControlsHost.h:
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::shadowRootCSSText):
* css/mediaControls.css:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
(WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::createDocumentStructure):
(WebCore::MediaDocument::defaultEventHandler):
* style/UserAgentStyle.cpp:
(WebCore::Style::UserAgentStyle::ensureDefaultStyleSheetsForElement):
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setModernMediaControlsEnabled): Deleted.
(WebCore::RuntimeEnabledFeatures::modernMediaControlsEnabled const): Deleted.
Replace `ModernMediaControlsEnabled` setting with `ENABLE_MODERN_MEDIA_CONTROLS` build flag.
* html/track/TextTrackCueGeneric.cpp:
Update the static `DEFAULTCAPTIONFONTSIZE` value for modern media controls.
* Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
* Modules/modern-media-controls/controls/text-tracks.css:
Update comments.
* css/mediaControlsiOS.css: Removed.
This file was never included anywhere.
* platform/audio/PlatformMediaSessionManager.h:
(WebCore::PlatformMediaSessionManager::resetHaveEverRegisteredAsNowPlayingApplicationForTesting): added.
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::resetHaveEverRegisteredAsNowPlayingApplicationForTesting): added.
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
Drive-by: Reset `haveEverRegisteredAsNowPlayingApplication` to a consistent state between tests.
This is expected by `LayoutTests/media/now-playing-status-without-media.html`.
* bindings/js/WebCoreBuiltinNames.h:
* WebCore.xcodeproj/project.pbxproj:
2021-03-22 Chris Dumez <cdumez@apple.com>
Reduce number of heap allocations on the audio thread in AudioSampleDataSource
https://bugs.webkit.org/show_bug.cgi?id=223549
Reviewed by Darin Adler.
Reduce number of heap allocations on the audio thread in AudioSampleDataSource
for performance reasons. I got rid of the heap allocations that I could easily
address. Some trickier ones remain.
* platform/audio/cocoa/AudioSampleDataSource.h:
(WebCore::AudioSampleDataSource::inputDescription const):
- Use Optional<> type for m_inputDescription & m_outputDescription data members instead of
std::unique_ptr<> so that we can initialize them without heap allocation.
- Use UniqueRef<> instead of std::unique_ptr<> for m_ringBuffer now that it gets
initialized in the constructor (on the main thread).
* platform/audio/cocoa/AudioSampleDataSource.mm:
(WebCore::AudioSampleDataSource::AudioSampleDataSource):
Initialize m_ringBuffer in the constructor which runs on the main thread, instead of
doing it lazily later on, on the audio rendering thread.
(WebCore::AudioSampleDataSource::~AudioSampleDataSource):
Stop nulling data members out unnecessarily in the destructor.
(WebCore::AudioSampleDataSource::setInputFormat):
Initialize m_inputDescription without doing a heap allocation.
(WebCore::AudioSampleDataSource::setOutputFormat):
- Initialize m_outputDescription without doing a heap allocation.
- Drop initialization of m_ringBuffer now that it is done eagerly in the constructor.
- Drop RunLoop::main().dispatch() just to do logging since this was causing heap allocations.
(WebCore::AudioSampleDataSource::pushSamplesInternal):
(WebCore::AudioSampleDataSource::pushSamples):
(WebCore::AudioSampleDataSource::pullSamplesInternal):
(WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
(WebCore::AudioSampleDataSource::pullSamples):
Drop null checks for m_ringBuffer now that it is initialized eagerly in the constructor
and thus can never be null.
2021-03-22 Devin Rousso <drousso@apple.com>
Fix incorrect fallback values in `PlaybackSessionModelMediaElement` after r274249
https://bugs.webkit.org/show_bug.cgi?id=223584
Reviewed by Eric Carlson.
These values were something I was experimenting with as a way of knowing "has this ever
been changed", but as it turned out there were other ways of achieving this and/or it was
unnecessary to do so.
* platform/cocoa/PlaybackSessionModelMediaElement.mm:
(WebCore::PlaybackSessionModelMediaElement::defaultPlaybackRate const):
(WebCore::PlaybackSessionModelMediaElement::playbackRate const):
2021-03-22 Jean-Yves Avenard <jya@apple.com>
Always perform image decoding in the web content process.
https://bugs.webkit.org/show_bug.cgi?id=223290
<rdar://problem/75559243>
Reviewed by Eric Carlson.
No change in externally observable behaviour.
* Modules/mediasession/MediaMetadata.cpp:
(WebCore::ArtworkImageLoader::notifyFinished): We decode the image into a BitmapImage and handle all potential failures getting there.
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::setNowPlayingInfo): remove FIXME comment.
2021-03-22 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Composition text is not initially highlighted when typing in text fields using Pinyin keyboard
https://bugs.webkit.org/show_bug.cgi?id=223563
<rdar://problem/75564516>
Reviewed by Antti Koivisto.
When enabling line layout integration, composition highlights on iOS don't appear when typing an input string
using the Pinyin keyboard for the first time. This is because the text renderer for the inserted composition
text does not contain inline text boxes when painting the composition text on iOS, so the marked text painting
codepath is never triggered.
On macOS, this isn't an issue because the process of setting the composition changes the selection, which then
changes the highlight state of the `RenderText`, which subsequently calls into `ensureLineBoxes()`. However,
since selections are drawn using UIKit in the UI process on iOS, we don't end up ensuring that inline text boxes
are constructed for the inserted text.
To address this, we follow macOS behavior by ensuring line box construction on the rendered composition text
when setting the composition.
Test: editing/input/composition-underline-in-search-field.html
* editing/Editor.cpp:
(WebCore::Editor::setComposition):
2021-03-22 Chris Dumez <cdumez@apple.com>
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/nan-param.html is failing
https://bugs.webkit.org/show_bug.cgi?id=223583
Reviewed by Eric Carlson.
As per https://webaudio.github.io/web-audio-api/#computation-of-value, we should replace NaN values with
the default value, when computing the value for an AudioParam.
No new tests, rebaselined existing test.
* Modules/webaudio/AudioParam.cpp:
(WebCore::replaceNaNValues):
(WebCore::AudioParam::calculateFinalValues):
2021-03-22 Rob Buis <rbuis@igalia.com>
[css-contain] Parse CSS contain property
https://bugs.webkit.org/show_bug.cgi?id=223252
Reviewed by Darin Adler.
Parse CSS contain property according to the specification [1].
This patch also adds the experimental feature CSSContainment and
makes contain invisible from style when disabled.
[1] https://drafts.csswg.org/css-contain-1/#contain-property
Test: fast/css/contain-invalidate-if-disabled.html
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSProperties.json:
* css/CSSValueKeywords.in:
* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
(WebCore::CSSParserContext::isPropertyRuntimeDisabled const):
* css/parser/CSSParserContext.h:
(WebCore::CSSParserContextHash::hash):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeContain):
(WebCore::CSSPropertyParser::parseSingleValue):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::contain const):
(WebCore::RenderStyle::setContain):
(WebCore::RenderStyle::initialContainment):
(WebCore::RenderStyle::strictContainment):
(WebCore::RenderStyle::contentContainment):
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator== const):
* rendering/style/StyleRareNonInheritedData.h:
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyInitialContain):
(WebCore::Style::BuilderCustom::applyInheritContain):
(WebCore::Style::BuilderCustom::applyValueContain):
2021-03-22 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo] ASSERTION FAILED: isMainThread() in GPU process for some canvas/philip/tests tests
https://bugs.webkit.org/show_bug.cgi?id=223500
Reviewed by Alex Christensen.
Added a new member of FontPlatformData::CreationData to
FontCustomPlatformData struct to transfer custom fonts to GPU
process for WinCairo port.
* PlatformWin.cmake:
* platform/graphics/FontPlatformData.h:
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::createFontCustomPlatformData):
* platform/graphics/win/FontCustomPlatformData.h:
(WebCore::FontCustomPlatformData::FontCustomPlatformData):
* platform/graphics/win/FontCustomPlatformDataCairo.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData):
(WebCore::createFontCustomPlatformData):
* platform/graphics/win/FontPlatformDataCairoWin.cpp:
(WebCore::FontPlatformData::FontPlatformData):
2021-03-22 Youenn Fablet <youenn@apple.com>
RealtimeMediaSource does not need to be a WeakPtr
https://bugs.webkit.org/show_bug.cgi?id=223573
<rdar://75583258>
Reviewed by Eric Carlson.
Remove use of WeakPtr and ref the source instead.
Covered by existing tests.
* platform/mediastream/RealtimeIncomingAudioSource.cpp:
(WebCore::RealtimeIncomingAudioSource::OnChanged):
* platform/mediastream/RealtimeIncomingVideoSource.cpp:
(WebCore::RealtimeIncomingVideoSource::OnChanged):
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::updateHasStartedProducingData):
* platform/mediastream/RealtimeMediaSource.h:
2021-03-22 Philippe Normand <pnormand@igalia.com>
[GStreamer] gst_audio_format_fill_silence() is deprecated in GStreamer 1.20
https://bugs.webkit.org/show_bug.cgi?id=223562
Reviewed by Xabier Rodriguez-Calvar.
Fix GStreamer deprecation warnings.
* platform/graphics/gstreamer/GStreamerCommon.h:
* platform/mediastream/gstreamer/MockRealtimeAudioSourceGStreamer.cpp:
(WebCore::MockRealtimeAudioSourceGStreamer::render):
* platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp:
(WebCore::RealtimeIncomingAudioSourceLibWebRTC::OnData):
* platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData):
2021-03-22 Youenn Fablet <youenn@apple.com>
Async Clipboard read prevents WebRTC IOSurfaces from being released
https://bugs.webkit.org/show_bug.cgi?id=223489
<rdar://problem/75601433>
Reviewed by Eric Carlson.
Instead of dispatching a task to main thread, the task refing a MediaSample,
we store the MediaSample in MediaPlayerPrivateMediaStreamAVFObjC on the background thread and
access it on main thread with a lock.
This ensures that we do not keep more than one media sample per MediaPlayerPrivateMediaStreamAVFObjC, even if main thread is blocked.
Make sure to reset the video transformation according hasChangedOrientation even if there is no media sample available anymore.
Covered by existing tests.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::processNewVideoSample):
2021-03-22 Jean-Yves Avenard <jya@apple.com>
Fix typo introduced in r274586 and revert fix from r274667 to get around compilation error following typo.
https://bugs.webkit.org/show_bug.cgi?id=223554
Reviewed by Eric Carlson.
No test needed.
* testing/Internals.cpp:
(WebCore::Internals::loadArtworkImage):
2021-03-22 Chris Dumez <cdumez@apple.com>
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-22 Zalan Bujtas <zalan@apple.com>
[ macOS debug arm64 ] ASSERTION FAILED: count >= 1 ./rendering/RenderMultiColumnSet.cpp(450) : unsigned int WebCore::RenderMultiColumnSet::columnCount() const
https://bugs.webkit.org/show_bug.cgi?id=223144
<rdar://problem/75381496>
Reviewed by Simon Fraser.
Overflow height computation with infinite constraint should not produce a negative height value.
During the column balancing, we use the "max layout unit" value to indicate infinite available space.
However this max value confuses the height computation in expandToEncompassFragmentedFlowContentsIfNeeded and produces a negative height value.
Let's also ensure that we never trigger undefined behavior as the result of implicitly converting (negative)float to unsigned.
* rendering/RenderFragmentContainerSet.cpp:
(WebCore::RenderFragmentContainerSet::expandToEncompassFragmentedFlowContentsIfNeeded):
* rendering/RenderFragmentedFlow.cpp:
(WebCore::RenderFragmentedFlow::updateFragmentsFragmentedFlowPortionRect):
* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::columnCount const):
2021-03-22 Chris Dumez <cdumez@apple.com>
Implement AbortSignal.abort()
https://bugs.webkit.org/show_bug.cgi?id=223071
<rdar://problem/75575483>
Reviewed by Darin Adler.
Implement AbortSignal.abort() which creates and returns an already aborted AbortSignal:
- https://github.com/whatwg/dom/pull/960
- https://github.com/web-platform-tests/wpt/pull/28003
No new tests, covered by updated test.
* dom/AbortSignal.cpp:
(WebCore::AbortSignal::createAborted):
(WebCore::AbortSignal::AbortSignal):
* dom/AbortSignal.h:
* dom/AbortSignal.idl:
2021-03-22 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Context menu should account for image overlay content
https://bugs.webkit.org/show_bug.cgi?id=223518
<rdar://problem/75505210>
Reviewed by Devin Rousso.
Make some adjustments to allow context menu items for text selection to show up when right clicking on text in
an image overlay.
Test: fast/images/image-extraction/mac/copy-image-overlay-text-with-context-menu.html
* editing/Editor.cpp:
(WebCore::Editor::performCutOrCopy):
Adjust this logic so that we only attempt to write plain text to the system pasteboard when copying text inside
image overlays (this matches the behavior of copying selected text in `textarea` elements and text fields).
* html/HTMLElement.cpp:
(WebCore::HTMLElement::hasImageOverlay const):
(WebCore::imageOverlayHost):
(WebCore::HTMLElement::isInsideImageOverlay):
Add a helper function to determine whether or not a given range in the DOM is inside an image overlay shadow
root. To avoid code duplication, pull out some logic to grab the image overlay's element host (if it exists) out
into a separate static helper function (`imageOverlayHost`), and use it here and also in `isImageOverlayText`.
(WebCore::HTMLElement::isImageOverlayText):
Move the UA shadow root check into `HTMLElement::hasImageOverlay`, so that `hasImageOverlay` can be invoked for
elements with non-UA shadow roots without hitting an assertion.
* html/HTMLElement.h:
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::populate):
Pull logic that determines whether or not we should show text-selection-related context menu items out into a
separate lambda function, so that it's easier to take advantage of early returns; then, in the case where we
have an image URL, additionally show selected text options if the selection is inside the image overlay.
2021-03-22 Sam Weinig <weinig@apple.com>
Use the PropertyName parameter passed to custom getters/setters rather than a redundant const char* in DOM attribute prologues
https://bugs.webkit.org/show_bug.cgi?id=223542
Reviewed by Alexey Shvayka.
Use the PropertyName parameter passed to custom getters/setters rather than a
redundant const char* in DOM attribute prologues. This will allow us to share
IDLAttribute prologue implementations in cases where the same bound function
should be called for multiple attributes, as will be the case for CSSStyleDeclaration.
Also took the opertunity to do some cleanup
- Made CastedThisErrorBehavior conditions use if constexpr to ensure the non-requested
cases are compiled out, even in debug builds.
- Moves all attribute Getter/Setter TypeError related functions to JSC, where there
were already some, to remove duplication of strings and prepare for hoisting setter
prologues in the future (as is already done for getters).
- Remove AttributeSetter::call as it was redundant with invokeFunctorPropagatingExceptionIfNecessary.
* bindings/js/JSDOMAttribute.h:
(WebCore::IDLAttribute::set):
(WebCore::IDLAttribute::setStatic):
(WebCore::IDLAttribute::get):
(WebCore::IDLAttribute::getStatic):
(WebCore::AttributeSetter::call): Deleted.
* bindings/js/JSDOMExceptionHandling.cpp:
(WebCore::rejectPromiseWithGetterTypeError):
(WebCore::makeGetterTypeErrorMessage): Deleted.
(WebCore::throwGetterTypeError): Deleted.
(WebCore::throwSetterTypeError): Deleted.
* bindings/js/JSDOMExceptionHandling.h:
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSC_DEFINE_HOST_FUNCTION):
* bindings/js/JSDOMOperation.h:
(WebCore::IDLOperation::call):
* bindings/js/JSDOMOperationReturningPromise.h:
(WebCore::IDLOperationReturningPromise::call):
(WebCore::IDLOperationReturningPromise::callReturningOwnPromise):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateAttributeGetterTrampolineDefinition):
(GenerateAttributeSetterBodyDefinition):
(GenerateAttributeSetterTrampolineDefinition):
* bindings/scripts/test/JS/*:
Update test results.
2021-03-22 Chris Dumez <cdumez@apple.com>
Avoid heap allocation under AudioNodeInput::disable() / AudioNodeInput::enable()
https://bugs.webkit.org/show_bug.cgi?id=223529
Reviewed by Eric Carlson.
Avoid heap allocation under AudioNodeInput::disable() / AudioNodeInput::enable() since those can
get called on the audio thread.
AudioNodeInput used to have a m_disabledOutputs container to keep disabled outputs separated
from enabled ones (in m_outputs). Instead, we now store all outputs in m_outputs with a 'isEnabled'
flag. As a result, we no longer need to make any heap allocations when enabling/disabling an
output, we merely need to flip a flag in m_outputs.
For convenience, since clients of rendering outputs only care about enabled outputs, I introduced
a new RenderingOutputCollection container with iterators. This way clients do not need to worry
about disabled outputs.
* Modules/webaudio/AudioNodeInput.cpp:
(WebCore::AudioNodeInput::connect):
(WebCore::AudioNodeInput::disconnect):
(WebCore::AudioNodeInput::didDisableOutput):
(WebCore::AudioNodeInput::didEnableOutput):
(WebCore::AudioNodeInput::bus):
(WebCore::AudioNodeInput::sumAllConnections):
(WebCore::AudioNodeInput::pull):
* Modules/webaudio/AudioNodeInput.h:
* Modules/webaudio/AudioNodeOutput.cpp:
(WebCore::AudioNodeOutput::disable):
(WebCore::AudioNodeOutput::enable):
* Modules/webaudio/AudioParam.cpp:
(WebCore::AudioParam::calculateFinalValues):
* Modules/webaudio/AudioSummingJunction.cpp:
(WebCore::AudioSummingJunction::numberOfConnections const):
(WebCore::AudioSummingJunction::addOutput):
(WebCore::AudioSummingJunction::removeOutput):
(WebCore::AudioSummingJunction::updateRenderingState):
(WebCore::AudioSummingJunction::maximumNumberOfChannels const):
(WebCore::AudioSummingJunction::didDisableOutput):
(WebCore::AudioSummingJunction::didEnableOutput):
(WebCore::AudioSummingJunction::RenderingOutputCollection::RenderingOutput::RenderingOutput):
(WebCore::WebCore::AudioSummingJunction::RenderingOutputCollection::remove):
(WebCore::WebCore::AudioSummingJunction::RenderingOutputCollection::setEnabled):
(WebCore::WebCore::AudioSummingJunction::RenderingOutputCollection::RenderingOutputCollection):
* Modules/webaudio/AudioSummingJunction.h:
(WebCore::AudioSummingJunction::RenderingOutputCollection::isEmpty const):
(WebCore::AudioSummingJunction::RenderingOutputCollection::size const):
(WebCore::AudioSummingJunction::RenderingOutputCollection::clear):
(WebCore::AudioSummingJunction::RenderingOutputCollection::append):
(WebCore::AudioSummingJunction::RenderingOutputCollection::ConstIterator::ConstIterator):
(WebCore::AudioSummingJunction::RenderingOutputCollection::ConstIterator::operator* const):
(WebCore::AudioSummingJunction::RenderingOutputCollection::ConstIterator::operator!= const):
(WebCore::AudioSummingJunction::RenderingOutputCollection::ConstIterator::operator++):
(WebCore::AudioSummingJunction::RenderingOutputCollection::begin const):
(WebCore::AudioSummingJunction::RenderingOutputCollection::end const):
(WebCore::AudioSummingJunction::renderingOutputs const):
(WebCore::AudioSummingJunction::isConnected const):
* Modules/webaudio/WebKitAudioPannerNode.cpp:
(WebCore::WebKitAudioPannerNode::notifyAudioSourcesConnectedToNode):
2021-03-22 Youenn Fablet <youenn@apple.com>
Implement RTCDataChannel transfer out of process
https://bugs.webkit.org/show_bug.cgi?id=223443
Reviewed by Eric Carlson.
Add support for serialization/deserialization of RTCDataChannel information so that it can be MessagePort transfered or transfered to out-of-process contexts like Window or Service Worker.
Add infrastructure for remote sources (that allows to send data or close data channels) and remote handlers which receive messages from out-of-process data channels.
Covered by API tests.
* Modules/mediastream/DetachedRTCDataChannel.h: Added.
(WebCore::DetachedRTCDataChannel::DetachedRTCDataChannel):
(WebCore::DetachedRTCDataChannel::memoryCost const):
(WebCore::DetachedRTCDataChannel::encode const):
(WebCore::DetachedRTCDataChannel::decode):
* Modules/mediastream/RTCDataChannel.cpp:
(WebCore::RTCDataChannel::RTCDataChannel):
(WebCore::rtcDataChannelLocalMap):
(WebCore::RTCDataChannel::handlerFromIdentifier):
(WebCore::RTCDataChannel::create):
* Modules/mediastream/RTCDataChannel.h:
* Modules/mediastream/RTCDataChannelRemoteHandler.cpp: Added.
(WebCore::RTCDataChannelRemoteHandler::create):
(WebCore::RTCDataChannelRemoteHandler::RTCDataChannelRemoteHandler):
(WebCore::RTCDataChannelRemoteHandler::~RTCDataChannelRemoteHandler):
(WebCore::RTCDataChannelRemoteHandler::didChangeReadyState):
(WebCore::RTCDataChannelRemoteHandler::didReceiveStringData):
(WebCore::RTCDataChannelRemoteHandler::didReceiveRawData):
(WebCore::RTCDataChannelRemoteHandler::didDetectError):
(WebCore::RTCDataChannelRemoteHandler::bufferedAmountIsDecreasing):
(WebCore::RTCDataChannelRemoteHandler::readyToSend):
(WebCore::RTCDataChannelRemoteHandler::setClient):
(WebCore::RTCDataChannelRemoteHandler::sendStringData):
(WebCore::RTCDataChannelRemoteHandler::sendRawData):
(WebCore::RTCDataChannelRemoteHandler::close):
* Modules/mediastream/RTCDataChannelRemoteHandler.h: Added.
* Modules/mediastream/RTCDataChannelRemoteSource.cpp: Copied from Source/WebCore/platform/mediastream/RTCDataChannelHandler.h.
(WebCore::RTCDataChannelRemoteSource::RTCDataChannelRemoteSource):
(WebCore::RTCDataChannelRemoteSource::~RTCDataChannelRemoteSource):
* Modules/mediastream/RTCDataChannelRemoteSource.h: Added.
(WebCore::RTCDataChannelRemoteSource::create):
(WebCore::RTCDataChannelRemoteSource::sendStringData):
(WebCore::RTCDataChannelRemoteSource::sendRawData):
(WebCore::RTCDataChannelRemoteSource::close):
* Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
(WebCore::LibWebRTCDataChannelHandler::postTask):
* Modules/webaudio/AudioWorkletMessagingProxy.cpp:
(WebCore::AudioWorkletMessagingProxy::createRTCDataChannelRemoteHandlerConnection):
* Modules/webaudio/AudioWorkletMessagingProxy.h:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/SerializedScriptValue.cpp:
(WebCore::SerializedScriptValue::SerializedScriptValue):
* bindings/js/SerializedScriptValue.h:
(WebCore::SerializedScriptValue::encode const):
(WebCore::SerializedScriptValue::decode):
* dom/Document.cpp:
(WebCore::Document::createRTCDataChannelRemoteHandlerConnection):
* dom/Document.h:
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::createRTCDataChannelRemoteHandlerConnection):
* platform/ScriptExecutionContextIdentifier.h: Copied from Source/WebCore/platform/mediastream/RTCDataChannelState.h.
* platform/mediastream/RTCDataChannelHandler.h:
(WebCore::RTCDataChannelInit::encode const):
(WebCore::RTCDataChannelInit::decode):
* platform/mediastream/RTCDataChannelIdentifier.h: Copied from Source/WebCore/platform/mediastream/RTCDataChannelHandler.h.
(WebCore::RTCDataChannelIdentifier::encode const):
(WebCore::RTCDataChannelIdentifier::decode):
* platform/mediastream/RTCDataChannelRemoteHandlerConnection.h: Copied from Source/WebCore/platform/mediastream/RTCDataChannelHandler.h.
* platform/mediastream/RTCDataChannelRemoteSourceConnection.h: Copied from Source/WebCore/platform/mediastream/RTCDataChannelHandler.h.
* platform/mediastream/RTCDataChannelState.h:
* platform/mediastream/RTCPriorityType.h:
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::createRTCDataChannelRemoteHandlerConnection):
* workers/WorkerGlobalScope.h:
* workers/WorkerLoaderProxy.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::createRTCDataChannelRemoteHandlerConnection):
* workers/WorkerMessagingProxy.h:
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::createRTCDataChannelRemoteHandlerConnection):
* workers/service/context/ServiceWorkerThreadProxy.h:
2021-03-22 Simon Fraser <simon.fraser@apple.com>
Fix a mistake in r274725 spotted by Darin.
I accidentally removed the case statement for CSSPropertyWebkitTextSizeAdjust.
* css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::isPropertyRuntimeDisabled const):
2021-03-22 Simon Fraser <simon.fraser@apple.com>
Rename WebCore's DisplayRefreshMonitorMac to indicate that it's only used in legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=223543
Reviewed by Tim Horton.
DisplayRefreshMonitorMac in WebCore is only used for WebKitLegacy; WebProcess doesn't have
WindowServer access so is unable to create CVDisplayLinkRefs.
Rename it to indicate this, and reduce confusion with DisplayRefreshMonitorMac in WebKit2.
Also add an assertion that LegacyDisplayRefreshMonitorMac is not being created in the
WebProcess.
For EmptyPageClients (like the Page used by createPageForSanitizingWebContent()) we need
a DisplayRefreshMonitor implementation that doesn't try to CVDisplayLinkRefs in the
Web Process, so add an EmptyDisplayRefreshMonitor that never fires.
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* loader/EmptyClients.cpp:
(WebCore::EmptyDisplayRefreshMonitor::create):
(WebCore::EmptyDisplayRefreshMonitor::EmptyDisplayRefreshMonitor):
(WebCore::EmptyChromeClient::createDisplayRefreshMonitor const):
* loader/EmptyClients.h:
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor):
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp: Renamed from Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.cpp.
(WebCore::LegacyDisplayRefreshMonitorMac::LegacyDisplayRefreshMonitorMac):
(WebCore::LegacyDisplayRefreshMonitorMac::~LegacyDisplayRefreshMonitorMac):
(WebCore::LegacyDisplayRefreshMonitorMac::stop):
(WebCore::displayLinkCallback):
(WebCore::LegacyDisplayRefreshMonitorMac::requestRefreshCallback):
(WebCore::LegacyDisplayRefreshMonitorMac::displayLinkFired):
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.h: Renamed from Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.h.
(WebCore::LegacyDisplayRefreshMonitorMac::create):
2021-03-22 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Style: Remove unnecessary { }s from case statements in DisplayListItemBuffer.cpp
https://bugs.webkit.org/show_bug.cgi?id=223550
Reviewed by Wenson Hsieh.
They're unnecessary, and none of the other case statements in displaylists/ have them.
Deleting them allows more of the program to fit on the screen at a time.
No new tests because there is no behavior change.
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemHandle::apply):
(WebCore::DisplayList::ItemHandle::destroy):
2021-03-19 Dean Jackson <dino@apple.com>
Link against the ANGLE Shared Library
https://bugs.webkit.org/show_bug.cgi?id=218539
<rdar://problem/69062211>
Reviewed by Tim Horton.
Weak link against libANGLE-shared.dylib.
* Configurations/WebCore.xcconfig:
* Configurations/WebCoreTestSupport.xcconfig:
* Sources.txt:
* SourcesGTK.txt:
* SourcesWPE.txt:
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::isANGLEAvailable):
(WebCore::GraphicsContextGLOpenGL::create):
2021-03-19 Lauro Moura <lmoura@igalia.com>
Unreviewed. WPE Debug build fix after r274695
* platform/xr/openxr/PlatformXROpenXR.cpp:
(PlatformXR::OpenXRDevice::submitFrame):
2021-03-19 Kate Cheney <katherine_cheney@apple.com>
Cannot login to microsoftonline.com without allowing storage access
https://bugs.webkit.org/show_bug.cgi?id=223510
<rdar://problem/75619058>
Reviewed by John Wilander.
This patch introduces two changes:
1. Activate the storage access quirks for default browsers only. This
is the main place we test them, and can lead to unexpected behavior in
apps otherwise.
2. Doesn't cancel the click even if the user denies storage access.
Previously we we were not allowing the click because it produces
unexpected behavior. But, sites like login.microsoftonline.com are used
by multiple Microsoft login flows. Since only a subset require storage
access, canceling the click across the board could be considered
regressing behavior.
Since storage access data is stored in the network process, we
currently cancel the user's click on quirked sites while we wait
asyncronously for the IPC response. If the user grants storage access,
we store this in the web content process and dispatch a synthetic
click. In this case, when the click triggers another storage access
check, we can allow the click because we no longer need to wait for
information from the network process.
We need some heuristic in the web content process to handle the case
of the user denying storage access to know whether to allow a
synthetic click to happen. This patch introduces
hasDeniedCrossPageStorageAccess which stores domains in the web
content process which have been denied storage access via quirk. If
a user has previously denied storage access in that web content
process, we don't prompt again. A new web content process will give them
another opportunity to allow/deny storage access.
* dom/Element.cpp:
(WebCore::Element::dispatchMouseEvent):
* loader/FrameLoaderClient.h:
Add a client function to check if the parent process is a full web
browser, and pass this to the place we apply the quirks.
* loader/ResourceLoadObserver.h:
(WebCore::ResourceLoadObserver::setHasDeniedCrossPageStorageAccess):
(WebCore::ResourceLoadObserver::hasDeniedCrossPageStorageAccess const):
* page/Quirks.cpp:
(WebCore::hasDeniedCrossPageStorageAccess):
(WebCore::Quirks::requestStorageAccessAndHandleClick const):
(WebCore::Quirks::triggerOptionalStorageAccessQuirk const):
* page/Quirks.h:
2021-03-19 Zalan Bujtas <zalan@apple.com>
Unreviewed, reverting r274596.
Google logo is not visible on google.com
Reverted changeset:
"[css-grid] Incorrect track sizing when using relative sized
items in 'auto' column tracks"
https://bugs.webkit.org/show_bug.cgi?id=191627
https://commits.webkit.org/r274596
2021-03-19 Cameron McCormack <heycam@apple.com>
Anonymous table rows do not collapse if there are any other non-anonymous table row siblings.
https://bugs.webkit.org/show_bug.cgi?id=223490
Reviewed by Zalan Bujtas.
Currently, when a RenderTableRow is detached from its parent, we will
check whether all of the remaining RenderTableRow siblings are anonymous
before deciding to merge them. This means that if removing the
RenderTableRow would produce a sequence of anonymous RenderTableRows
that could be collapsed, but we have some other non-anonymous
RenderTableRow as a sibling, then we'll incorrectly skip the collapsing.
Instead we should look only to the previous and next sibling, and
collapse them together if they're both anonymous.
Test: fast/table/table-anonymous-row-collapse.html
* rendering/updating/RenderTreeBuilderTable.cpp:
(WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
Change from requiring all siblings after the detachment to be anonymous, to
looking only at the previous and following siblings.
2021-03-19 Jer Noble <jer.noble@apple.com>
Many media/media-fragments/ tests are crashing due to other tests that run before them.
https://bugs.webkit.org/show_bug.cgi?id=223277
<rdar://problem/75492360>
Reviewed by Eric Carlson.
Work around the crashing function by pre-conforming the fragment identifier according
to the format required by the crashing function.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::hasBrokenFragmentSupport):
(WebCore::conformFragmentIdentifierForURL):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
2021-03-19 Youenn Fablet <youenn@apple.com>
Custom scheme handled origins should be considered secure
https://bugs.webkit.org/show_bug.cgi?id=223423
Reviewed by Alex Christensen.
If an app registers 'custom' as scheme handler, 'custom://localhost/page.html' is considered secure context
but 'custom://test/page.html' is not.
This patch makes it so that any 'custom://XXX/' origin will be considered secure context if 'custom' is a registered scheme handler.
Covered by API test and new test.
Test: http/tests/events/device-orientation-motion-insecure-context.html
* WebCore.xcodeproj/project.pbxproj:
* page/SecurityOrigin.cpp:
(WebCore::shouldTreatAsPotentiallyTrustworthy):
2021-03-19 ChangSeok Oh <changseok@webkit.org>
Animated AVIF support
https://bugs.webkit.org/show_bug.cgi?id=222804
<rdar://problem/75362181>
Reviewed by Philippe Normand.
This change implements animation of the avif sequence. The decoding approach
is similar to ones for other image formats, i.e., decoding frames in BGRA pixels
then bit-copying them into ScalableImageDecoderFrame. The decoded frames are cached
for future use. The repetition is missing in this change. It will be addressed
in separate patches.
The added avif animation test compares the last frame of each avifs and a static
avif image. The embeded avifs images are originated from corresponding webp images
for animated-webp.html, and encoded with timescale 100 (i.e., the duration of each frame
is 0.01s). The total duration and the track duration are same so the added avifs samples
are supposed to be played one time.
Test: fast/images/animated-avif.html
* platform/image-decoders/avif/AVIFImageDecoder.cpp:
(WebCore::AVIFImageDecoder::repetitionCount const):
(WebCore::AVIFImageDecoder::findFirstRequiredFrameToDecode):
(WebCore::AVIFImageDecoder::frameBufferAtIndex):
(WebCore::AVIFImageDecoder::isComplete):
(WebCore::AVIFImageDecoder::tryDecodeSize):
(WebCore::AVIFImageDecoder::decode):
* platform/image-decoders/avif/AVIFImageDecoder.h:
* platform/image-decoders/avif/AVIFImageReader.cpp:
(WebCore::AVIFImageReader::decodeFrame):
(WebCore::AVIFImageReader::imageCount const):
(WebCore::AVIFImageReader::~AVIFImageReader): Deleted.
* platform/image-decoders/avif/AVIFImageReader.h:
2021-03-19 Martin Robinson <mrobinson@igalia.com>
scroll-snap-stop: always not respected during momentum scrolling
https://bugs.webkit.org/show_bug.cgi?id=223406
Reviewed by Simon Fraser.
Test: tiled-drawing/scrolling/scroll-snap/scroll-snap-stop-momentum-scroll.html
* platform/ScrollSnapAnimatorState.cpp:
(WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset const): Enable directional scroll
snapping when handling momentum scrolling. This turns on scroll-snap-stop as well as a few other
features.
2021-03-19 Simon Fraser <simon.fraser@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=223141
Runtime-disabled CSS features still still appear enabled via two-arg CSS.supports()
Address post-landing review comments from Darin.
* css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::isPropertyRuntimeDisabled const):
2021-03-19 Sam Weinig <weinig@apple.com>
Add PropertyName parameter to custom setters to allow shared implementations to do late name lookup
https://bugs.webkit.org/show_bug.cgi?id=223413
Reviewed by Alexey Shvayka.
Update bindings to account for new PropertyName parameter being passed to custom setters.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateAttributeSetterTrampolineDefinition):
* bindings/scripts/test/JS/JSDOMWindow.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSDedicatedWorkerGlobalScope.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSPaintWorkletGlobalScope.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSServiceWorkerGlobalScope.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestCEReactions.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestCSSProperty.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestCallTracer.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestConditionalIncludes.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestConditionallyReadWrite.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestDefaultToJSON.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestDefaultToJSONInherit.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestDefaultToJSONInheritFinal.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestEnabledForContext.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestLegacyNoInterfaceObject.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestMapLikeWithOverriddenOperations.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestSetLikeWithOverriddenOperations.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSWorkerGlobalScope.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
* bindings/scripts/test/JS/JSWorkletGlobalScope.cpp:
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
2021-03-19 Rob Buis <rbuis@igalia.com>
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-19 Xabier Rodriguez Calvar <calvaris@igalia.com>
[GStreamer][EME] Remove DRM resources release
https://bugs.webkit.org/show_bug.cgi?id=223436
Reviewed by Philippe Normand.
Releasing DRM resources should not be needed according to the
spec. If we needed this in the future because of whatever reason
we need to study it again in some other way.
* platform/encryptedmedia/CDMProxy.cpp:
(WebCore::CDMInstanceProxy::trackSession): Deleted.
(WebCore::CDMInstanceSessionProxy::removeFromInstanceProxy): Deleted.
* platform/encryptedmedia/CDMProxy.h:
(WebCore::CDMProxy::releaseDecryptionResources): Deleted.
(WebCore::CDMInstanceSessionProxy::releaseDecryptionResources): Deleted.
(WebCore::CDMInstanceProxy::removeSession): Deleted.
(WebCore::CDMInstanceProxy::releaseDecryptionResources): Deleted.
* platform/encryptedmedia/clearkey/CDMClearKey.cpp:
(WebCore::CDMInstanceClearKey::createSession):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
* platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp:
(WebCore::CDMProxyClearKey::releaseDecryptionResources): Deleted.
* platform/graphics/gstreamer/eme/CDMProxyClearKey.h:
* platform/graphics/gstreamer/eme/CDMThunder.cpp:
(WebCore::CDMInstanceThunder::createSession):
(WebCore::CDMInstanceSessionThunder::requestLicense):
(WebCore::CDMInstanceSessionThunder::closeSession):
(WebCore::CDMInstanceSessionThunder::removeSessionData):
* platform/graphics/gstreamer/eme/CDMThunder.h:
2021-03-19 Devin Rousso <drousso@apple.com>
CSP headers can block default <video> controls
https://bugs.webkit.org/show_bug.cgi?id=223422
<rdar://problem/41192193>
Reviewed by Antoine Quint.
Covered by existing tests.
* Modules/modern-media-controls/controls/icon-service.js:
(IconService.prototype.imageForIconAndLayoutTraits):
In order for an `<img>` to skip CSP checks it must be `isInUserAgentShadowTree` before setting `src`.
* Modules/modern-media-controls/main.js:
(createControls):
Provide the UA `shadowRoot` to the `iconService` so it can temporarily attach the `<img>`.
* dom/Element.cpp:
(WebCore::Element::addShadowRoot):
Web Inspector should be notified about new UA shadow roots before they're modified.
2021-03-19 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r274706.
https://bugs.webkit.org/show_bug.cgi?id=223506
Attempt to fix WPE debug build failed
Reverted changeset:
"Unreviewed, fix WPE debug build after r274695"
https://trac.webkit.org/changeset/274706
2021-03-19 Youenn Fablet <youenn@apple.com>
Disable SFrame compatibility mode for audio senders and receivers
https://bugs.webkit.org/show_bug.cgi?id=223391
<rdar://problem/75538500>
Reviewed by Eric Carlson.
Add RTCRtpSFrameTransformer::setMediaType to allow setting the authentication size.
In case mode is H264/VP8 and media type is audio, set back mode to none.
Covered by API test.
* Modules/mediastream/RTCRtpSFrameTransform.cpp:
(WebCore::RTCRtpSFrameTransform::initializeTransformer):
* Modules/mediastream/RTCRtpSFrameTransformer.h:
(WebCore::RTCRtpSFrameTransformer::setMediaType):
* WebCore.xcodeproj/project.pbxproj:
2021-03-17 Sergio Villar Senin <svillar@igalia.com>
[css-flex] Make {main|cross}SizeForPercentageResolution() return booleans instead of actual sizes
https://bugs.webkit.org/show_bug.cgi?id=223377
Reviewed by Manuel Rego Casasnovas.
These two methods were only called by childLogicalHeightForPercentageResolution() and they either returned
WTF::nullopt or the overridingContentLogicalHeight(). We could simplify a bit the code by returning a boolean
which means whether the overriding content logical height should be used to resolve a percentage or not. Apart
from changing the return value we're also improving the naming so it becomes obvious that we are dealing with
flex items and not the flex container.
We're also removing some comments in those methods that were not really accurate.
No new tests as there is no change in functionality.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::availableLogicalHeightForPercentageComputation const):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeReplacedLogicalHeightUsing const):
(WebCore::RenderBox::availableLogicalHeightUsing const):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight const):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::useChildOverridingCrossSizeForPercentageResolution): Renamed from crossSizeForPercentageResolution.
(WebCore::RenderFlexibleBox::useChildOverridingMainSizeForPercentageResolution): Renamed from mainSizeForPercentageResolution.
(WebCore::RenderFlexibleBox::useChildOverridingLogicalHeightForPercentageResolution): Renamed from childLogicalHeightForPercentageResolution.
(WebCore::RenderFlexibleBox::crossSizeForPercentageResolution): Deleted.
(WebCore::RenderFlexibleBox::mainSizeForPercentageResolution): Deleted.
(WebCore::RenderFlexibleBox::childLogicalHeightForPercentageResolution): Deleted.
* rendering/RenderFlexibleBox.h:
2021-03-19 Diego Pino Garcia <dpino@igalia.com>
Unreviewed, fix WPE debug build after r274695
* platform/xr/openxr/PlatformXROpenXR.cpp:
(PlatformXR::OpenXRDevice::submitFrame):
2021-03-19 Yusuke Suzuki <ysuzuki@apple.com>
WebCore::ThreadGlobalData should not initialize fields eagerly
https://bugs.webkit.org/show_bug.cgi?id=223481
Reviewed by Chris Dumez.
ThreadGlobalData is used in various cases. For example, WebCore::Timer uses it, and
this is even also used in GPUProcess. We observed something (e.g. EventNames, QualifiedNameCache etc.)
is initialized even in GPUProcess just because GPUProcess's audio stack uses WebCore::Timer.
This patch makes these fields lazily-allocated to avoid initializing eagerly in the threads that
are not interested in DOM etc.
* platform/ThreadGlobalData.cpp:
(WebCore::ThreadGlobalData::ThreadGlobalData):
(WebCore::ThreadGlobalData::initializeCachedResourceRequestInitiators):
(WebCore::ThreadGlobalData::initializeEventNames):
(WebCore::ThreadGlobalData::initializeQualifiedNameCache):
(WebCore::ThreadGlobalData::initializeMimeTypeRegistryThreadGlobalData):
(WebCore::ThreadGlobalData::mimeTypeRegistryThreadGlobalData): Deleted.
* platform/ThreadGlobalData.h:
(WebCore::ThreadGlobalData::ThreadGlobalData::cachedResourceRequestInitiators):
(WebCore::ThreadGlobalData::ThreadGlobalData::eventNames):
(WebCore::ThreadGlobalData::ThreadGlobalData::qualifiedNameCache):
(WebCore::ThreadGlobalData::ThreadGlobalData::mimeTypeRegistryThreadGlobalData):
(WebCore::ThreadGlobalData::ThreadGlobalData::threadTimers):
2021-03-18 Simon Fraser <simon.fraser@apple.com>
Attempt to fix the macOS build after r274695.
* platform/graphics/GraphicsContextGL.h:
* testing/WebFakeXRDevice.cpp:
* testing/WebFakeXRDevice.h:
== Rolled over to ChangeLog-2021-03-18 ==