Diff
Modified: trunk/Source/WTF/ChangeLog (293128 => 293129)
--- trunk/Source/WTF/ChangeLog 2022-04-20 22:47:59 UTC (rev 293128)
+++ trunk/Source/WTF/ChangeLog 2022-04-20 23:02:09 UTC (rev 293129)
@@ -1,3 +1,16 @@
+2022-04-20 Chris Dumez <cdu...@apple.com>
+
+ Move true / false AtomStrings to a central location and reuse them
+ https://bugs.webkit.org/show_bug.cgi?id=239530
+
+ Reviewed by Sam Weinig.
+
+ * wtf/text/AtomString.cpp:
+ (WTF::AtomString::init):
+ * wtf/text/AtomString.h:
+ (WTF::trueAtom):
+ (WTF::falseAtom):
+
2022-04-20 Alan Bujtas <za...@apple.com>
[IFC][Integration] Do not call WebPreferences::simpleLineLayoutEnabled in canUseForLineLayoutWithReason
Modified: trunk/Source/WTF/wtf/text/AtomString.cpp (293128 => 293129)
--- trunk/Source/WTF/wtf/text/AtomString.cpp 2022-04-20 22:47:59 UTC (rev 293128)
+++ trunk/Source/WTF/wtf/text/AtomString.cpp 2022-04-20 23:02:09 UTC (rev 293129)
@@ -137,6 +137,8 @@
WTF_EXPORT_PRIVATE MainThreadLazyNeverDestroyed<const AtomString> starAtomData;
WTF_EXPORT_PRIVATE MainThreadLazyNeverDestroyed<const AtomString> xmlAtomData;
WTF_EXPORT_PRIVATE MainThreadLazyNeverDestroyed<const AtomString> xmlnsAtomData;
+WTF_EXPORT_PRIVATE MainThreadLazyNeverDestroyed<const AtomString> trueAtomData;
+WTF_EXPORT_PRIVATE MainThreadLazyNeverDestroyed<const AtomString> falseAtomData;
void AtomString::init()
{
@@ -157,6 +159,8 @@
starAtomData.constructWithoutAccessCheck("*", AtomString::ConstructFromLiteral);
xmlAtomData.constructWithoutAccessCheck("xml", AtomString::ConstructFromLiteral);
xmlnsAtomData.constructWithoutAccessCheck("xmlns", AtomString::ConstructFromLiteral);
+ trueAtomData.constructWithoutAccessCheck("true", AtomString::ConstructFromLiteral);
+ falseAtomData.constructWithoutAccessCheck("false", AtomString::ConstructFromLiteral);
});
}
Modified: trunk/Source/WTF/wtf/text/AtomString.h (293128 => 293129)
--- trunk/Source/WTF/wtf/text/AtomString.h 2022-04-20 22:47:59 UTC (rev 293128)
+++ trunk/Source/WTF/wtf/text/AtomString.h 2022-04-20 23:02:09 UTC (rev 293129)
@@ -293,6 +293,8 @@
extern WTF_EXPORT_PRIVATE MainThreadLazyNeverDestroyed<const AtomString> starAtomData;
extern WTF_EXPORT_PRIVATE MainThreadLazyNeverDestroyed<const AtomString> xmlAtomData;
extern WTF_EXPORT_PRIVATE MainThreadLazyNeverDestroyed<const AtomString> xmlnsAtomData;
+extern WTF_EXPORT_PRIVATE MainThreadLazyNeverDestroyed<const AtomString> trueAtomData;
+extern WTF_EXPORT_PRIVATE MainThreadLazyNeverDestroyed<const AtomString> falseAtomData;
inline const AtomString& nullAtom() { return nullAtomData.get(); }
inline const AtomString& emptyAtom() { return emptyAtomData.get(); }
@@ -299,6 +301,8 @@
inline const AtomString& starAtom() { return starAtomData.get(); }
inline const AtomString& xmlAtom() { return xmlAtomData.get(); }
inline const AtomString& xmlnsAtom() { return xmlnsAtomData.get(); }
+inline const AtomString& trueAtom() { return trueAtomData.get(); }
+inline const AtomString& falseAtom() { return falseAtomData.get(); }
inline AtomString AtomString::fromUTF8(const char* characters, size_t length)
{
@@ -358,7 +362,9 @@
using WTF::AtomString;
using WTF::nullAtom;
using WTF::emptyAtom;
+using WTF::falseAtom;
using WTF::starAtom;
+using WTF::trueAtom;
using WTF::xmlAtom;
using WTF::xmlnsAtom;
Modified: trunk/Source/WebCore/ChangeLog (293128 => 293129)
--- trunk/Source/WebCore/ChangeLog 2022-04-20 22:47:59 UTC (rev 293128)
+++ trunk/Source/WebCore/ChangeLog 2022-04-20 23:02:09 UTC (rev 293129)
@@ -1,3 +1,32 @@
+2022-04-20 Chris Dumez <cdu...@apple.com>
+
+ Move true / false AtomStrings to a central location and reuse them
+ https://bugs.webkit.org/show_bug.cgi?id=239530
+
+ Reviewed by Sam Weinig.
+
+ * dom/mac/ImageControlsMac.cpp:
+ (WebCore::ImageControlsMac::createImageControls):
+ * editing/cocoa/DataDetection.mm:
+ (WebCore::DataDetection::detectContentInRange):
+ * html/HTMLElement.cpp:
+ (WebCore::HTMLElement::contentEditable const):
+ (WebCore::HTMLElement::setContentEditable):
+ (WebCore::trueName): Deleted.
+ (WebCore::falseName): Deleted.
+ * html/shadow/TextControlInnerElements.cpp:
+ (WebCore::TextControlInnerTextElement::updateInnerTextElementEditabilityImpl):
+ * mathml/MathMLPresentationElement.cpp:
+ (WebCore::MathMLPresentationElement::cachedBooleanAttribute):
+ * platform/network/HTTPParsers.cpp:
+ (WebCore::parseStructuredFieldValue):
+ * svg/SVGFEConvolveMatrixElement.cpp:
+ (WebCore::SVGFEConvolveMatrixElement::parseAttribute):
+ * svg/properties/SVGPropertyTraits.h:
+ (WebCore::SVGPropertyTraits<bool>::toString):
+ * xml/XPathValue.cpp:
+ (WebCore::XPath::Value::toString const):
+
2022-04-20 Simon Fraser <simon.fra...@apple.com>
REGRESSION (r281913): Map toolbar flickers when dragging the map on https://gis.ee/
Modified: trunk/Source/WebCore/dom/mac/ImageControlsMac.cpp (293128 => 293129)
--- trunk/Source/WebCore/dom/mac/ImageControlsMac.cpp 2022-04-20 22:47:59 UTC (rev 293128)
+++ trunk/Source/WebCore/dom/mac/ImageControlsMac.cpp 2022-04-20 23:02:09 UTC (rev 293129)
@@ -91,7 +91,7 @@
Ref shadowRoot = element.ensureUserAgentShadowRoot();
auto controlLayer = HTMLDivElement::create(document.get());
controlLayer->setIdAttribute(imageControlsElementIdentifier());
- controlLayer->setAttributeWithoutSynchronization(HTMLNames::contenteditableAttr, "false"_s);
+ controlLayer->setAttributeWithoutSynchronization(HTMLNames::contenteditableAttr, falseAtom());
shadowRoot->appendChild(controlLayer);
static MainThreadNeverDestroyed<const String> shadowStyle(StringImpl::createWithoutCopying(imageControlsMacUserAgentStyleSheet, sizeof(imageControlsMacUserAgentStyleSheet)));
Modified: trunk/Source/WebCore/editing/cocoa/DataDetection.mm (293128 => 293129)
--- trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2022-04-20 22:47:59 UTC (rev 293128)
+++ trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2022-04-20 23:02:09 UTC (rev 293129)
@@ -626,7 +626,7 @@
anchorElement->appendChild(WTFMove(newTextNode));
// Add a special attribute to mark this URLification as the result of data detectors.
- anchorElement->setAttributeWithoutSynchronization(x_apple_data_detectorsAttr, AtomString("true", AtomString::ConstructFromLiteral));
+ anchorElement->setAttributeWithoutSynchronization(x_apple_data_detectorsAttr, trueAtom());
anchorElement->setAttributeWithoutSynchronization(x_apple_data_detectors_typeAttr, dataDetectorTypeForCategory(PAL::softLink_DataDetectorsCore_DDResultGetCategory(coreResult)));
anchorElement->setAttributeWithoutSynchronization(x_apple_data_detectors_resultAttr, identifier);
Modified: trunk/Source/WebCore/html/HTMLElement.cpp (293128 => 293129)
--- trunk/Source/WebCore/html/HTMLElement.cpp 2022-04-20 22:47:59 UTC (rev 293128)
+++ trunk/Source/WebCore/html/HTMLElement.cpp 2022-04-20 23:02:09 UTC (rev 293129)
@@ -574,9 +574,9 @@
case ContentEditableType::Inherit:
return "inherit"_s;
case ContentEditableType::True:
- return "true"_s;
+ return trueAtom();
case ContentEditableType::False:
- return "false"_s;
+ return falseAtom();
case ContentEditableType::PlaintextOnly:
return "plaintext-only"_s;
}
@@ -583,18 +583,6 @@
return "inherit"_s;
}
-static const AtomString& trueName()
-{
- static MainThreadNeverDestroyed<const AtomString> trueValue("true", AtomString::ConstructFromLiteral);
- return trueValue.get();
-}
-
-static const AtomString& falseName()
-{
- static MainThreadNeverDestroyed<const AtomString> falseValue("false", AtomString::ConstructFromLiteral);
- return falseValue.get();
-}
-
static const AtomString& plaintextOnlyName()
{
static MainThreadNeverDestroyed<const AtomString> plaintextOnlyValue("plaintext-only", AtomString::ConstructFromLiteral);
@@ -604,9 +592,9 @@
ExceptionOr<void> HTMLElement::setContentEditable(const String& enabled)
{
if (equalLettersIgnoringASCIICase(enabled, "true"))
- setAttributeWithoutSynchronization(contenteditableAttr, trueName());
+ setAttributeWithoutSynchronization(contenteditableAttr, trueAtom());
else if (equalLettersIgnoringASCIICase(enabled, "false"))
- setAttributeWithoutSynchronization(contenteditableAttr, falseName());
+ setAttributeWithoutSynchronization(contenteditableAttr, falseAtom());
else if (equalLettersIgnoringASCIICase(enabled, "plaintext-only"))
setAttributeWithoutSynchronization(contenteditableAttr, plaintextOnlyName());
else if (equalLettersIgnoringASCIICase(enabled, "inherit"))
@@ -627,7 +615,7 @@
void HTMLElement::setDraggable(bool value)
{
- setAttributeWithoutSynchronization(draggableAttr, value ? trueName() : falseName());
+ setAttributeWithoutSynchronization(draggableAttr, value ? trueAtom() : falseAtom());
}
bool HTMLElement::spellcheck() const
@@ -637,7 +625,7 @@
void HTMLElement::setSpellcheck(bool enable)
{
- setAttributeWithoutSynchronization(spellcheckAttr, enable ? trueName() : falseName());
+ setAttributeWithoutSynchronization(spellcheckAttr, enable ? trueAtom() : falseAtom());
}
void HTMLElement::click()
Modified: trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp (293128 => 293129)
--- trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp 2022-04-20 22:47:59 UTC (rev 293128)
+++ trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp 2022-04-20 23:02:09 UTC (rev 293129)
@@ -151,8 +151,7 @@
void TextControlInnerTextElement::updateInnerTextElementEditabilityImpl(bool isEditable, bool initialization)
{
static MainThreadNeverDestroyed<const AtomString> plainTextOnlyName("plaintext-only", AtomString::ConstructFromLiteral);
- static MainThreadNeverDestroyed<const AtomString> falseName("false", AtomString::ConstructFromLiteral);
- const auto& value = isEditable ? plainTextOnlyName.get() : falseName.get();
+ const auto& value = isEditable ? plainTextOnlyName.get() : falseAtom();
if (initialization) {
Vector<Attribute> attributes { Attribute(contenteditableAttr, value) };
parserSetAttributes(attributes);
Modified: trunk/Source/WebCore/mathml/MathMLPresentationElement.cpp (293128 => 293129)
--- trunk/Source/WebCore/mathml/MathMLPresentationElement.cpp 2022-04-20 22:47:59 UTC (rev 293128)
+++ trunk/Source/WebCore/mathml/MathMLPresentationElement.cpp 2022-04-20 23:02:09 UTC (rev 293129)
@@ -193,9 +193,9 @@
// In MathML, attribute values are case-sensitive.
const AtomString& value = attributeWithoutSynchronization(name);
- if (value == "true")
+ if (value == trueAtom())
attribute = BooleanValue::True;
- else if (value == "false")
+ else if (value == falseAtom())
attribute = BooleanValue::False;
else
attribute = BooleanValue::Default;
Modified: trunk/Source/WebCore/platform/network/HTTPParsers.cpp (293128 => 293129)
--- trunk/Source/WebCore/platform/network/HTTPParsers.cpp 2022-04-20 22:47:59 UTC (rev 293128)
+++ trunk/Source/WebCore/platform/network/HTTPParsers.cpp 2022-04-20 23:02:09 UTC (rev 293129)
@@ -619,7 +619,7 @@
++index;
}
StringView key = header.substring(keyStart, index - keyStart);
- String value = "true"_s;
+ String value = trueAtom();
if (index < header.length() && header[index] == '=') {
++index; // Consume '='.
if (isASCIIAlpha(header[index]) || header[index] == '*') {
Modified: trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp (293128 => 293129)
--- trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp 2022-04-20 22:47:59 UTC (rev 293128)
+++ trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp 2022-04-20 23:02:09 UTC (rev 293129)
@@ -122,9 +122,9 @@
}
if (name == SVGNames::preserveAlphaAttr) {
- if (value == "true")
+ if (value == trueAtom())
m_preserveAlpha->setBaseValInternal(true);
- else if (value == "false")
+ else if (value == falseAtom())
m_preserveAlpha->setBaseValInternal(false);
else
document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing preserveAlphaAttr=\"" + value + "\". Filtered element will not be displayed.");
Modified: trunk/Source/WebCore/svg/properties/SVGPropertyTraits.h (293128 => 293129)
--- trunk/Source/WebCore/svg/properties/SVGPropertyTraits.h 2022-04-20 22:47:59 UTC (rev 293128)
+++ trunk/Source/WebCore/svg/properties/SVGPropertyTraits.h 2022-04-20 23:02:09 UTC (rev 293129)
@@ -39,7 +39,7 @@
static bool initialValue() { return false; }
static bool fromString(const String& string) { return string == "true"; }
static std::optional<bool> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return initialValue(); }
- static String toString(bool type) { return type ? "true"_s : "false"_s; }
+ static String toString(bool type) { return type ? trueAtom() : falseAtom(); }
};
template<>
Modified: trunk/Source/WebCore/xml/XPathValue.cpp (293128 => 293129)
--- trunk/Source/WebCore/xml/XPathValue.cpp 2022-04-20 22:47:59 UTC (rev 293128)
+++ trunk/Source/WebCore/xml/XPathValue.cpp 2022-04-20 23:02:09 UTC (rev 293129)
@@ -128,7 +128,7 @@
return std::signbit(m_number) ? "-Infinity"_s : "Infinity"_s;
return String::number(m_number);
case BooleanValue:
- return m_bool ? "true"_s : "false"_s;
+ return m_bool ? trueAtom() : falseAtom();
}
ASSERT_NOT_REACHED();