Skip to content
Permalink
Browse files
Drop AtomString(const char*, ConstructFromLiteral) constructor
https://bugs.webkit.org/show_bug.cgi?id=239721

Reviewed by Darin Adler.

Drop AtomString(const char*, ConstructFromLiteral) constructor and instead update
the call sites to use the AtomString(ASCIILiteral) one instead. It reduces
complexity to not have several constructor for the same purpose.

* Tools/TestWebKitAPI/Tests/WTF/AtomString.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebCore/Logging.cpp:
(TestWebKitAPI::TEST_F):
* Source/WebKit/NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::resourceType):
* Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
(WebKit::NetworkCache::subresourcesType):
* Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::soupHTTPVersionToString):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::PDFPlugin):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
(WebKit::PDFPluginAnnotation::attach):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
(WebKit::PDFPluginChoiceAnnotation::createAnnotationElement):
* Source/WTF/wtf/text/AtomString.cpp:
(WTF::AtomString::init):
* Source/WTF/wtf/text/AtomString.h:
* Source/WebCore/Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.cpp:
(WebCore::stringForPlaybackTargetAvailability):
* Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::automaticKeyword):
(WebCore::MediaControlsHost::forcedOnlyKeyword):
(WebCore::alwaysOnKeyword):
(WebCore::manualKeyword):
(WebCore::MediaControlsHost::mediaControlsContainerClassName const):
* Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::kind const):
(WebCore::MediaStreamTrack::contentHint const):
* Source/WebCore/Modules/mediastream/RTCDataChannel.cpp:
(WebCore::blobKeyword):
(WebCore::arraybufferKeyword):
* Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp:
(WebCore::YouTubePluginReplacement::installReplacement):
* Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::liveRegionRelevant const):
* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:
(GenerateDefaultValue):
* Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunction_methodWithOptionalAtomStringAndDefaultValueBody):
* Source/WebCore/css/MediaFeatureNames.cpp:
(WebCore::MediaFeatureNames::init):
* Source/WebCore/css/makeprop.pl:
* Source/WebCore/css/parser/CSSParserSelector.cpp:
(WebCore::CSSParserSelector::parsePseudoElementSelector):
* Source/WebCore/dom/ConstantPropertyMap.cpp:
(WebCore::ConstantPropertyMap::nameForProperty const):
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::validateCustomElementName):
* Source/WebCore/dom/EventNames.cpp:
* Source/WebCore/dom/ImageOverlay.cpp:
(WebCore::ImageOverlay::imageOverlayElementIdentifier):
(WebCore::ImageOverlay::imageOverlayDataDetectorClass):
(WebCore::ImageOverlay::imageOverlayLineClass):
(WebCore::ImageOverlay::imageOverlayTextClass):
(WebCore::ImageOverlay::imageOverlayBlockClass):
* Source/WebCore/dom/MutationRecord.cpp:
* Source/WebCore/dom/mac/ImageControlsMac.cpp:
(WebCore::ImageControlsMac::imageControlsElementIdentifier):
(WebCore::ImageControlsMac::imageControlsButtonIdentifier):
* Source/WebCore/dom/make_names.pl:
(printNamesCppFile):
* Source/WebCore/editing/MarkupAccumulator.cpp:
(WebCore::htmlAttributeSerialization):
* Source/WebCore/html/Autocapitalize.cpp:
(WebCore::stringForAutocapitalizeType):
* Source/WebCore/html/Autofill.cpp:
(WebCore::isContactToken):
* Source/WebCore/html/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocumentParser::appendEntry):
(WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate):
(WebCore::FTPDirectoryDocumentParser::createBasicDocument):
* Source/WebCore/html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::parseAttribute):
(WebCore::HTMLAnchorElement::isSystemPreviewLink):
* Source/WebCore/html/HTMLElement.cpp:
(WebCore::toValidDirValue):
* Source/WebCore/html/HTMLFieldSetElement.cpp:
(WebCore::HTMLFieldSetElement::formControlType const):
* Source/WebCore/html/HTMLOptGroupElement.cpp:
(WebCore::HTMLOptGroupElement::formControlType const):
* Source/WebCore/html/HTMLOutputElement.cpp:
(WebCore::HTMLOutputElement::formControlType const):
* Source/WebCore/html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::formControlType const):
* Source/WebCore/html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::scope const):
* Source/WebCore/html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::formControlType const):
* Source/WebCore/html/HTMLTextFormControlElement.cpp:
(WebCore::directionString):
* Source/WebCore/html/InputMode.cpp:
(WebCore::InputModeNames::numeric):
(WebCore::InputModeNames::decimal):
* Source/WebCore/html/InputTypeNames.cpp:
(WebCore::InputTypeNames::checkbox):
(WebCore::InputTypeNames::color):
(WebCore::InputTypeNames::date):
(WebCore::InputTypeNames::datetimelocal):
(WebCore::InputTypeNames::file):
(WebCore::InputTypeNames::hidden):
(WebCore::InputTypeNames::image):
(WebCore::InputTypeNames::month):
(WebCore::InputTypeNames::number):
(WebCore::InputTypeNames::password):
(WebCore::InputTypeNames::radio):
(WebCore::InputTypeNames::range):
(WebCore::InputTypeNames::time):
(WebCore::InputTypeNames::week):
* Source/WebCore/html/MediaController.cpp:
(WebCore::playbackStateWaiting):
(WebCore::playbackStatePlaying):
(WebCore::playbackStateEnded):
* Source/WebCore/html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::createDocumentStructure):
(WebCore::MediaDocument::replaceMediaElementTimerFired):
* Source/WebCore/html/ModelDocument.cpp:
(WebCore::ModelDocumentParser::createDocumentStructure):
* Source/WebCore/html/PDFDocument.cpp:
(WebCore::PDFDocument::createDocumentStructure):
* Source/WebCore/html/PluginDocument.cpp:
(WebCore::PluginDocumentParser::createDocumentStructure):
* Source/WebCore/html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::createContainer):
* Source/WebCore/html/parser/HTMLTreeBuilder.cpp:
(WebCore::createForeignAttributesMap):
* Source/WebCore/html/shadow/DateTimeFieldElements.cpp:
(WebCore::DateTimeDayFieldElement::create):
(WebCore::DateTimeHourFieldElement::create):
(WebCore::DateTimeMeridiemFieldElement::create):
(WebCore::DateTimeMillisecondFieldElement::create):
(WebCore::DateTimeMinuteFieldElement::create):
(WebCore::DateTimeMonthFieldElement::create):
(WebCore::DateTimeSecondFieldElement::create):
(WebCore::DateTimeSymbolicMonthFieldElement::create):
(WebCore::DateTimeYearFieldElement::create):
* Source/WebCore/html/shadow/ShadowPseudoIds.cpp:
(WebCore::ShadowPseudoIds::cue):
(WebCore::ShadowPseudoIds::fileSelectorButton):
(WebCore::ShadowPseudoIds::placeholder):
(WebCore::ShadowPseudoIds::webkitContactsAutoFillButton):
(WebCore::ShadowPseudoIds::webkitCredentialsAutoFillButton):
(WebCore::ShadowPseudoIds::webkitCreditCardAutoFillButton):
(WebCore::ShadowPseudoIds::webkitStrongPasswordAutoFillButton):
(WebCore::ShadowPseudoIds::webkitCapsLockIndicator):
(WebCore::ShadowPseudoIds::webkitColorSwatch):
(WebCore::ShadowPseudoIds::webkitColorSwatchWrapper):
(WebCore::ShadowPseudoIds::webkitDatetimeEdit):
(WebCore::ShadowPseudoIds::webkitDatetimeEditText):
(WebCore::ShadowPseudoIds::webkitDatetimeEditFieldsWrapper):
(WebCore::ShadowPseudoIds::webkitDateAndTimeValue):
(WebCore::ShadowPseudoIds::webkitDetailsMarker):
(WebCore::ShadowPseudoIds::webkitGenericCueRoot):
(WebCore::ShadowPseudoIds::webkitInnerSpinButton):
(WebCore::ShadowPseudoIds::webkitListButton):
(WebCore::ShadowPseudoIds::webkitMediaSliderThumb):
(WebCore::ShadowPseudoIds::webkitMediaSliderContainer):
(WebCore::ShadowPseudoIds::webkitMediaTextTrackContainer):
(WebCore::ShadowPseudoIds::webkitMediaTextTrackDisplay):
(WebCore::ShadowPseudoIds::webkitMediaTextTrackDisplayBackdrop):
(WebCore::ShadowPseudoIds::webkitMediaTextTrackRegion):
(WebCore::ShadowPseudoIds::webkitMediaTextTrackRegionContainer):
(WebCore::ShadowPseudoIds::webkitMeterBar):
(WebCore::ShadowPseudoIds::webkitMeterInnerElement):
(WebCore::ShadowPseudoIds::webkitMeterOptimumValue):
(WebCore::ShadowPseudoIds::webkitMeterSuboptimumValue):
(WebCore::ShadowPseudoIds::webkitMeterEvenLessGoodValue):
(WebCore::ShadowPseudoIds::webkitPluginReplacement):
(WebCore::ShadowPseudoIds::webkitProgressBar):
(WebCore::ShadowPseudoIds::webkitProgressValue):
(WebCore::ShadowPseudoIds::webkitProgressInnerElement):
(WebCore::ShadowPseudoIds::webkitSearchDecoration):
(WebCore::ShadowPseudoIds::webkitSearchResultsButton):
(WebCore::ShadowPseudoIds::webkitSearchResultsDecoration):
(WebCore::ShadowPseudoIds::webkitSearchCancelButton):
(WebCore::ShadowPseudoIds::webkitSliderRunnableTrack):
(WebCore::ShadowPseudoIds::webkitSliderThumb):
(WebCore::ShadowPseudoIds::webkitSliderContainer):
(WebCore::ShadowPseudoIds::webkitTextfieldDecorationContainer):
(WebCore::ShadowPseudoIds::webkitValidationBubble):
(WebCore::ShadowPseudoIds::webkitValidationBubbleArrowClipper):
(WebCore::ShadowPseudoIds::webkitValidationBubbleArrow):
(WebCore::ShadowPseudoIds::webkitValidationBubbleMessage):
(WebCore::ShadowPseudoIds::webkitValidationBubbleIcon):
(WebCore::ShadowPseudoIds::webkitValidationBubbleTextBlock):
(WebCore::ShadowPseudoIds::webkitValidationBubbleHeading):
(WebCore::ShadowPseudoIds::webkitValidationBubbleBody):
* Source/WebCore/html/track/AudioTrack.cpp:
(WebCore::AudioTrack::descriptionKeyword):
(WebCore::AudioTrack::mainDescKeyword):
(WebCore::AudioTrack::translationKeyword):
* Source/WebCore/html/track/TextTrack.cpp:
(WebCore::descriptionsKeyword):
(WebCore::chaptersKeyword):
(WebCore::metadataKeyword):
(WebCore::forcedKeyword):
* Source/WebCore/html/track/VTTRegion.cpp:
(WebCore::upKeyword):
(WebCore::VTTRegion::textTrackCueContainerScrollingClass):
* Source/WebCore/html/track/VideoTrack.cpp:
(WebCore::VideoTrack::signKeyword):
* Source/WebCore/loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::initiatorName const):
* Source/WebCore/loader/cache/CachedResourceRequestInitiators.cpp:
(WebCore::CachedResourceRequestInitiators::CachedResourceRequestInitiators):
* Source/WebCore/page/EventHandler.cpp:
(WebCore::focusDirectionForKey):
* Source/WebCore/page/Quirks.cpp:
(WebCore::Quirks::shouldBypassBackForwardCache const):
* Source/WebCore/platform/CommonAtomStrings.cpp:
* Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm:
(WebCore::PlaybackSessionModelMediaElement::eventNameAll):
* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::useBackslashAsYenSignForFamily):
* Source/WebCore/platform/graphics/FontDescription.cpp:
(WebCore::computeSpecializedChineseLocale):
* Source/WebCore/platform/graphics/MediaPlayer.cpp:
(WebCore::applicationOctetStream):
* Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::metadataType):
* Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontCache::lastResortFallbackFont):
* Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
(WebCore::SystemFontDatabaseCoreText::systemFontParameters):
* Source/WebCore/platform/mac/ThemeMac.mm:
(WebCore::ThemeMac::controlFont const):
* Source/WebCore/platform/network/cocoa/ResourceResponseCocoa.mm:
(WebCore::extractHTTPStatusText):
* Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp:
(WebCore::ResourceResponse::ResourceResponse):
* Source/WebCore/rendering/RenderThemeCocoa.mm:
(WebCore::RenderThemeCocoa::updateCachedSystemFontDescription const):
* Source/WebCore/rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::setFontFromControlSize const):
* Source/WebCore/style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::adjustForSiteSpecificQuirks const):
* Source/WebCore/svg/SVGAnimateMotionElement.cpp:
(WebCore::SVGAnimateMotionElement::rotateMode const):
* Source/WebCore/svg/SVGAnimationElement.cpp:
(WebCore::SVGAnimationElement::setCalcMode):
(WebCore::SVGAnimationElement::setAttributeType):
(WebCore::sumAtom):
* Source/WebCore/svg/SVGStyleElement.cpp:
(WebCore::SVGStyleElement::media const):
* Source/WebCore/svg/animation/SVGSMILElement.cpp:
(WebCore::indefiniteAtom):
(WebCore::SVGSMILElement::restart const):
(WebCore::SVGSMILElement::fill const):
* Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp:
(WebCore::SVGAnimationColorFunction::colorFromString):
* Source/WebCore/svg/properties/SVGPropertyAnimator.h:
(WebCore::SVGPropertyAnimator::adjustForInheritance const):

Canonical link: https://commits.webkit.org/250068@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293548 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Apr 28, 2022
1 parent cefe48d commit 35897b14f77cf88af4b45aeb360c134aa6016e5f
Show file tree
Hide file tree
Showing 82 changed files with 288 additions and 304 deletions.
@@ -156,9 +156,9 @@ void AtomString::init()
// We bypass this by using constructWithoutAccessCheck, which intentionally skips `isMainThread()` check for construction.
// In non WebThread environment, we do not lose the assertion coverage since we already have ASSERT(isUIThread()). And ASSERT(isUIThread()) ensures that this
// is called in system main thread in WebThread platforms.
starAtomData.constructWithoutAccessCheck("*", AtomString::ConstructFromLiteral);
xmlAtomData.constructWithoutAccessCheck("xml", AtomString::ConstructFromLiteral);
xmlnsAtomData.constructWithoutAccessCheck("xmlns", AtomString::ConstructFromLiteral);
starAtomData.constructWithoutAccessCheck("*"_s);
xmlAtomData.constructWithoutAccessCheck("xml"_s);
xmlnsAtomData.constructWithoutAccessCheck("xmlns"_s);
});
}

@@ -61,19 +61,6 @@ class AtomString final {
// FIXME: AtomString doesn’t always have AtomStringImpl, so one of those two names needs to change.
AtomString(UniquedStringImpl* uid);

enum ConstructFromLiteralTag { ConstructFromLiteral };
AtomString(const char* characters, unsigned length, ConstructFromLiteralTag)
: m_string(AtomStringImpl::addLiteral(characters, length))
{
}

template<unsigned characterCount> ALWAYS_INLINE AtomString(const char (&characters)[characterCount], ConstructFromLiteralTag)
: m_string(AtomStringImpl::addLiteral(characters, characterCount - 1))
{
static_assert(characterCount > 1, "AtomStringFromLiteral is not empty");
static_assert((characterCount - 1 <= ((unsigned(~0) - sizeof(StringImpl)) / sizeof(LChar))), "AtomStringFromLiteral cannot overflow");
}

AtomString(ASCIILiteral literal)
: m_string(AtomStringImpl::addLiteral(literal.characters(), literal.length()))
{
@@ -130,6 +130,12 @@ TextStream& TextStream::operator<<(const String& string)
return *this;
}

TextStream& TextStream::operator<<(ASCIILiteral string)
{
m_text.append(string);
return *this;
}

TextStream& TextStream::operator<<(StringView string)
{
m_text.append(string);
@@ -75,6 +75,7 @@ class TextStream {
WTF_EXPORT_PRIVATE TextStream& operator<<(const void*);
WTF_EXPORT_PRIVATE TextStream& operator<<(const AtomString&);
WTF_EXPORT_PRIVATE TextStream& operator<<(const String&);
WTF_EXPORT_PRIVATE TextStream& operator<<(ASCIILiteral);
WTF_EXPORT_PRIVATE TextStream& operator<<(StringView);
// Deprecated. Use the NumberRespectingIntegers FormattingFlag instead.
WTF_EXPORT_PRIVATE TextStream& operator<<(const FormatNumberRespectingIntegers&);
@@ -37,8 +37,8 @@ WTF_MAKE_ISO_ALLOCATED_IMPL(WebKitPlaybackTargetAvailabilityEvent);

static const AtomString& stringForPlaybackTargetAvailability(bool available)
{
static MainThreadNeverDestroyed<const AtomString> availableString("available", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> notAvailableString("not-available", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> availableString("available"_s);
static MainThreadNeverDestroyed<const AtomString> notAvailableString("not-available"_s);

return available ? availableString : notAvailableString;
}
@@ -75,25 +75,25 @@ namespace WebCore {

const AtomString& MediaControlsHost::automaticKeyword()
{
static MainThreadNeverDestroyed<const AtomString> automatic("automatic", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> automatic("automatic"_s);
return automatic;
}

const AtomString& MediaControlsHost::forcedOnlyKeyword()
{
static MainThreadNeverDestroyed<const AtomString> forcedOnly("forced-only", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> forcedOnly("forced-only"_s);
return forcedOnly;
}

static const AtomString& alwaysOnKeyword()
{
static MainThreadNeverDestroyed<const AtomString> alwaysOn("always-on", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> alwaysOn("always-on"_s);
return alwaysOn;
}

static const AtomString& manualKeyword()
{
static MainThreadNeverDestroyed<const AtomString> alwaysOn("manual", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> alwaysOn("manual"_s);
return alwaysOn;
}

@@ -135,7 +135,7 @@ String MediaControlsHost::layoutTraitsClassName() const

const AtomString& MediaControlsHost::mediaControlsContainerClassName() const
{
static MainThreadNeverDestroyed<const AtomString> className("media-controls-container", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> className("media-controls-container"_s);
return className;
}

@@ -114,8 +114,8 @@ MediaStreamTrack::~MediaStreamTrack()

const AtomString& MediaStreamTrack::kind() const
{
static MainThreadNeverDestroyed<const AtomString> audioKind("audio", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> videoKind("video", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> audioKind("audio"_s);
static MainThreadNeverDestroyed<const AtomString> videoKind("video"_s);

if (m_private->isAudio())
return audioKind;
@@ -134,10 +134,10 @@ const String& MediaStreamTrack::label() const

const AtomString& MediaStreamTrack::contentHint() const
{
static MainThreadNeverDestroyed<const AtomString> speechHint("speech", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> musicHint("music", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> detailHint("detail", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> motionHint("motion", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> speechHint("speech"_s);
static MainThreadNeverDestroyed<const AtomString> musicHint("music"_s);
static MainThreadNeverDestroyed<const AtomString> detailHint("detail"_s);
static MainThreadNeverDestroyed<const AtomString> motionHint("motion"_s);

switch (m_private->contentHint()) {
case MediaStreamTrackPrivate::HintValue::Empty:
@@ -49,13 +49,13 @@ WTF_MAKE_ISO_ALLOCATED_IMPL(RTCDataChannel);

static const AtomString& blobKeyword()
{
static MainThreadNeverDestroyed<const AtomString> blob("blob", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> blob("blob"_s);
return blob;
}

static const AtomString& arraybufferKeyword()
{
static MainThreadNeverDestroyed<const AtomString> arraybuffer("arraybuffer", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> arraybuffer("arraybuffer"_s);
return arraybuffer;
}

@@ -85,19 +85,19 @@ void YouTubePluginReplacement::installReplacement(ShadowRoot& root)

auto iframeElement = HTMLIFrameElement::create(HTMLNames::iframeTag, m_parentElement->document());
if (m_attributes.contains<HashTranslatorASCIILiteral>("width"_s))
iframeElement->setAttributeWithoutSynchronization(HTMLNames::widthAttr, AtomString("100%", AtomString::ConstructFromLiteral));
iframeElement->setAttributeWithoutSynchronization(HTMLNames::widthAttr, "100%"_s);

const auto& heightValue = m_attributes.find<HashTranslatorASCIILiteral>("height"_s);
if (heightValue != m_attributes.end()) {
iframeElement->setAttribute(HTMLNames::styleAttr, AtomString("max-height: 100%", AtomString::ConstructFromLiteral));
iframeElement->setAttribute(HTMLNames::styleAttr, "max-height: 100%"_s);
iframeElement->setAttributeWithoutSynchronization(HTMLNames::heightAttr, heightValue->value);
}

iframeElement->setAttributeWithoutSynchronization(HTMLNames::srcAttr, youTubeURL(m_attributes.get<HashTranslatorASCIILiteral>("src"_s)));
iframeElement->setAttributeWithoutSynchronization(HTMLNames::frameborderAttr, AtomString("0", AtomString::ConstructFromLiteral));
iframeElement->setAttributeWithoutSynchronization(HTMLNames::frameborderAttr, "0"_s);

// Disable frame flattening for this iframe.
iframeElement->setAttributeWithoutSynchronization(HTMLNames::scrollingAttr, AtomString("no", AtomString::ConstructFromLiteral));
iframeElement->setAttributeWithoutSynchronization(HTMLNames::scrollingAttr, "no"_s);
m_embedShadowElement->appendChild(iframeElement);
}

@@ -3339,7 +3339,7 @@ const String AccessibilityRenderObject::liveRegionStatus() const

const String AccessibilityRenderObject::liveRegionRelevant() const
{
static MainThreadNeverDestroyed<const AtomString> defaultLiveRegionRelevant("additions text", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> defaultLiveRegionRelevant("additions text"_s);
const AtomString& relevant = getAttribute(aria_relevantAttr);

// Default aria-relevant = "additions text".
@@ -2542,7 +2542,7 @@ sub GenerateDefaultValue
if ($defaultValue eq "\"\"") {
return $useAtomString ? "emptyAtom()" : "emptyString()";
} else {
return $useAtomString ? "AtomString(${defaultValue}, AtomString::ConstructFromLiteral)" : "${defaultValue}_s";
return $useAtomString ? "AtomString(${defaultValue}_s)" : "${defaultValue}_s";
}
}

@@ -6634,7 +6634,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunction_methodWithOptionalA
UNUSED_PARAM(callFrame);
auto& impl = castedThis->wrapped();
EnsureStillAliveScope argument0 = callFrame->argument(0);
auto str = argument0.value().isUndefined() ? AtomString("foo", AtomString::ConstructFromLiteral) : convert<IDLAtomStringAdaptor<IDLDOMString>>(*lexicalGlobalObject, argument0.value());
auto str = argument0.value().isUndefined() ? AtomString("foo"_s) : convert<IDLAtomStringAdaptor<IDLDOMString>>(*lexicalGlobalObject, argument0.value());
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.methodWithOptionalAtomStringAndDefaultValue(WTFMove(str)); })));
}
@@ -35,7 +35,7 @@ void init()
static bool initialized;
if (!initialized) {
initializeCommonAtomStrings();
#define INITIALIZE_GLOBAL(name, string) name.construct(string, AtomString::ConstructFromLiteral);
#define INITIALIZE_GLOBAL(name, string) name.construct(string ## _s);
CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(INITIALIZE_GLOBAL)
#undef INITIALIZE_GLOBAL
initialized = true;
@@ -417,9 +417,9 @@ sub sortByDescendingPriorityAndName
EOF

print GPERF "const char* const propertyNameStrings[numCSSProperties] = {\n";
print GPERF "constexpr ASCIILiteral propertyNameStrings[numCSSProperties] = {\n";
foreach my $name (@names) {
print GPERF " \"$name\",\n";
print GPERF " \"$name\"_s,\n";
}
print GPERF "};\n\n";

@@ -524,13 +524,13 @@ sub sortByDescendingPriorityAndName
return true;
}
const char* getPropertyName(CSSPropertyID id)
ASCIILiteral getPropertyName(CSSPropertyID id)
{
if (id < firstCSSProperty)
return 0;
return { };
int index = id - firstCSSProperty;
if (index >= numCSSProperties)
return 0;
return { };
return propertyNameStrings[index];
}
@@ -544,10 +544,8 @@ sub sortByDescendingPriorityAndName
static AtomString* propertyStrings = new AtomString[numCSSProperties]; // Intentionally never destroyed.
AtomString& propertyString = propertyStrings[index];
if (propertyString.isNull()) {
const char* propertyName = propertyNameStrings[index];
propertyString = AtomString(propertyName, strlen(propertyName), AtomString::ConstructFromLiteral);
}
if (propertyString.isNull())
propertyString = propertyNameStrings[index];
return propertyString;
}
@@ -913,7 +911,7 @@ sub sortWithPrefixedPropertiesLast
bool isInternalCSSProperty(const CSSPropertyID);
bool isEnabledCSSProperty(const CSSPropertyID);
bool isCSSPropertyEnabledBySettings(const CSSPropertyID, const Settings* = nullptr);
const char* getPropertyName(CSSPropertyID);
ASCIILiteral getPropertyName(CSSPropertyID);
const AtomString& getPropertyNameAtomString(CSSPropertyID id);
String getPropertyNameString(CSSPropertyID id);
String getJSPropertyName(CSSPropertyID);
@@ -64,9 +64,9 @@ std::unique_ptr<CSSParserSelector> CSSParserSelector::parsePseudoElementSelector
name = pseudoTypeString.convertToASCIILowercase();
else {
if (equalLettersIgnoringASCIICase(pseudoTypeString, "-webkit-input-placeholder"_s))
name = AtomString("placeholder", AtomString::ConstructFromLiteral);
name = "placeholder"_s;
else if (equalLettersIgnoringASCIICase(pseudoTypeString, "-webkit-file-upload-button"_s))
name = AtomString("file-selector-button", AtomString::ConstructFromLiteral);
name = "file-selector-button"_s;
else {
ASSERT_NOT_REACHED();
name = pseudoTypeString.convertToASCIILowercase();
@@ -50,15 +50,15 @@ const ConstantPropertyMap::Values& ConstantPropertyMap::values() const

const AtomString& ConstantPropertyMap::nameForProperty(ConstantProperty property) const
{
static MainThreadNeverDestroyed<const AtomString> safeAreaInsetTopName("safe-area-inset-top", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> safeAreaInsetRightName("safe-area-inset-right", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> safeAreaInsetBottomName("safe-area-inset-bottom", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> safeAreaInsetLeftName("safe-area-inset-left", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> fullscreenInsetTopName("fullscreen-inset-top", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> fullscreenInsetLeftName("fullscreen-inset-left", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> fullscreenInsetBottomName("fullscreen-inset-bottom", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> fullscreenInsetRightName("fullscreen-inset-right", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> fullscreenAutoHideDurationName("fullscreen-auto-hide-duration", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> safeAreaInsetTopName("safe-area-inset-top"_s);
static MainThreadNeverDestroyed<const AtomString> safeAreaInsetRightName("safe-area-inset-right"_s);
static MainThreadNeverDestroyed<const AtomString> safeAreaInsetBottomName("safe-area-inset-bottom"_s);
static MainThreadNeverDestroyed<const AtomString> safeAreaInsetLeftName("safe-area-inset-left"_s);
static MainThreadNeverDestroyed<const AtomString> fullscreenInsetTopName("fullscreen-inset-top"_s);
static MainThreadNeverDestroyed<const AtomString> fullscreenInsetLeftName("fullscreen-inset-left"_s);
static MainThreadNeverDestroyed<const AtomString> fullscreenInsetBottomName("fullscreen-inset-bottom"_s);
static MainThreadNeverDestroyed<const AtomString> fullscreenInsetRightName("fullscreen-inset-right"_s);
static MainThreadNeverDestroyed<const AtomString> fullscreenAutoHideDurationName("fullscreen-auto-hide-duration"_s);

switch (property) {
case ConstantProperty::SafeAreaInsetTop:
@@ -1322,9 +1322,9 @@ CustomElementNameValidationStatus Document::validateCustomElementName(const Atom
#if ENABLE(MATHML)
const auto& annotationXmlLocalName = MathMLNames::annotation_xmlTag->localName();
#else
static MainThreadNeverDestroyed<const AtomString> annotationXmlLocalName("annotation-xml", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> annotationXmlLocalName("annotation-xml"_s);
#endif
static MainThreadNeverDestroyed<const AtomString> colorProfileLocalName("color-profile", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> colorProfileLocalName("color-profile"_s);

if (localName == SVGNames::font_faceTag->localName()
|| localName == SVGNames::font_face_formatTag->localName()
@@ -23,8 +23,7 @@

namespace WebCore {

#define INITIALIZE_EVENT_NAME(name) \
name##Event(#name, AtomString::ConstructFromLiteral),
#define INITIALIZE_EVENT_NAME(name) name##Event(#name ## _s),

EventNames::EventNames()
: DOM_EVENT_NAMES_FOR_EACH(INITIALIZE_EVENT_NAME) dummy(0)
@@ -70,33 +70,33 @@ namespace ImageOverlay {

static const AtomString& imageOverlayElementIdentifier()
{
static MainThreadNeverDestroyed<const AtomString> identifier("image-overlay", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> identifier("image-overlay"_s);
return identifier;
}

static const AtomString& imageOverlayDataDetectorClass()
{
static MainThreadNeverDestroyed<const AtomString> className("image-overlay-data-detector-result", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> className("image-overlay-data-detector-result"_s);
return className;
}

#if ENABLE(IMAGE_ANALYSIS)

static const AtomString& imageOverlayLineClass()
{
static MainThreadNeverDestroyed<const AtomString> className("image-overlay-line", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> className("image-overlay-line"_s);
return className;
}

static const AtomString& imageOverlayTextClass()
{
static MainThreadNeverDestroyed<const AtomString> className("image-overlay-text", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> className("image-overlay-text"_s);
return className;
}

static const AtomString& imageOverlayBlockClass()
{
static MainThreadNeverDestroyed<const AtomString> className("image-overlay-block", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> className("image-overlay-block"_s);
return className;
}

@@ -175,19 +175,19 @@ class MutationRecordWithNullOldValue final : public MutationRecord {

const AtomString& ChildListRecord::type()
{
static MainThreadNeverDestroyed<const AtomString> childList("childList", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> childList("childList"_s);
return childList;
}

const AtomString& AttributesRecord::type()
{
static MainThreadNeverDestroyed<const AtomString> attributes("attributes", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> attributes("attributes"_s);
return attributes;
}

const AtomString& CharacterDataRecord::type()
{
static MainThreadNeverDestroyed<const AtomString> characterData("characterData", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> characterData("characterData"_s);
return characterData;
}

@@ -54,13 +54,13 @@ namespace ImageControlsMac {

static const AtomString& imageControlsElementIdentifier()
{
static MainThreadNeverDestroyed<const AtomString> identifier("image-controls", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> identifier("image-controls"_s);
return identifier;
}

static const AtomString& imageControlsButtonIdentifier()
{
static MainThreadNeverDestroyed<const AtomString> identifier("image-controls-button", AtomString::ConstructFromLiteral);
static MainThreadNeverDestroyed<const AtomString> identifier("image-controls-button"_s);
return identifier;
}

0 comments on commit 35897b1

Please sign in to comment.