Diff
Modified: trunk/Source/WebCore/ChangeLog (294137 => 294138)
--- trunk/Source/WebCore/ChangeLog 2022-05-13 01:41:21 UTC (rev 294137)
+++ trunk/Source/WebCore/ChangeLog 2022-05-13 01:49:32 UTC (rev 294138)
@@ -1,3 +1,38 @@
+2022-05-12 Matt Woodrow <mattwood...@apple.com>
+
+ Quirk Flightaware.com to use the older number serialization path.
+ https://bugs.webkit.org/show_bug.cgi?id=240320
+
+ Reviewed by Simon Fraser.
+
+ Ensures that serialization of matrix() CSS properties uses the older serialization (which
+ matches ECMA script serialization) since this site expects these to be comparable as strings.
+
+ No new tests, since this is a site-specific quirk.
+
+ * css/CSSFunctionValue.cpp:
+ (WebCore::CSSFunctionValue::customCSSText const):
+ * css/CSSFunctionValue.h:
+ * css/CSSPrimitiveValue.cpp:
+ (WebCore::CSSPrimitiveValue::formatNumberValue const):
+ (WebCore::CSSPrimitiveValue::customCSSText const):
+ * css/CSSPrimitiveValue.h:
+ * css/CSSValue.cpp:
+ (WebCore::CSSValue::cssText const):
+ * css/CSSValue.h:
+ (WebCore::CSSValue::CSSValue):
+ * css/CSSValueList.cpp:
+ (WebCore::CSSValueList::customCSSText const):
+ * css/CSSValueList.h:
+ * css/PropertySetCSSStyleDeclaration.cpp:
+ (WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal):
+ * css/StyleProperties.cpp:
+ (WebCore::StyleProperties::getPropertyValue const):
+ * css/StyleProperties.h:
+ * page/Quirks.cpp:
+ (WebCore::Quirks::needsFlightAwareSerializationQuirk const):
+ * page/Quirks.h:
+
2022-05-12 J Pascoe <j_pas...@apple.com>
[WebAuthn] Remove document focus requirement for conditional mediation requests
Modified: trunk/Source/WebCore/css/CSSFunctionValue.cpp (294137 => 294138)
--- trunk/Source/WebCore/css/CSSFunctionValue.cpp 2022-05-13 01:41:21 UTC (rev 294137)
+++ trunk/Source/WebCore/css/CSSFunctionValue.cpp 2022-05-13 01:49:32 UTC (rev 294138)
@@ -30,12 +30,12 @@
namespace WebCore {
-String CSSFunctionValue::customCSSText() const
+String CSSFunctionValue::customCSSText(Document* document) const
{
StringBuilder result;
result.append(getValueName(m_name));
result.append('(');
- result.append(CSSValueList::customCSSText());
+ result.append(CSSValueList::customCSSText(document));
result.append(')');
return result.toString();
}
Modified: trunk/Source/WebCore/css/CSSFunctionValue.h (294137 => 294138)
--- trunk/Source/WebCore/css/CSSFunctionValue.h 2022-05-13 01:41:21 UTC (rev 294137)
+++ trunk/Source/WebCore/css/CSSFunctionValue.h 2022-05-13 01:49:32 UTC (rev 294138)
@@ -37,7 +37,7 @@
return adoptRef(*new CSSFunctionValue(name));
}
- String customCSSText() const;
+ String customCSSText(Document* = nullptr) const;
CSSValueID name() const { return m_name; }
Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (294137 => 294138)
--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp 2022-05-13 01:41:21 UTC (rev 294137)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp 2022-05-13 01:49:32 UTC (rev 294138)
@@ -42,6 +42,7 @@
#include "Length.h"
#include "NodeRenderStyle.h"
#include "Pair.h"
+#include "Quirks.h"
#include "Rect.h"
#include "RenderStyle.h"
#include "RenderView.h"
@@ -1227,6 +1228,8 @@
NEVER_INLINE String CSSPrimitiveValue::formatNumberValue(StringView suffix) const
{
+ if (m_cachedCSSTextUsesLegacyPrecision)
+ return formatIntegerValue(suffix);
if (std::isnan(m_value.num) || std::isinf(m_value.num))
return formatInfiniteOrNanValue(suffix);
return makeString(FormattedCSSNumber::create(m_value.num), suffix);
@@ -1514,7 +1517,7 @@
return String();
}
-String CSSPrimitiveValue::customCSSText() const
+String CSSPrimitiveValue::customCSSText(Document* document) const
{
// FIXME: return the original value instead of a generated one (e.g. color
// name if it was specified) - check what spec says about this
@@ -1521,10 +1524,13 @@
CSSTextCache& cssTextCache = WebCore::cssTextCache();
- if (m_hasCachedCSSText) {
+ bool needsQuirk = document && document->quirks().needsFlightAwareSerializationQuirk();
+
+ if (m_hasCachedCSSText && m_cachedCSSTextUsesLegacyPrecision == needsQuirk) {
ASSERT(cssTextCache.contains(this));
return cssTextCache.get(this);
}
+ m_cachedCSSTextUsesLegacyPrecision = needsQuirk;
String text = formatNumberForCustomCSSText();
Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.h (294137 => 294138)
--- trunk/Source/WebCore/css/CSSPrimitiveValue.h 2022-05-13 01:41:21 UTC (rev 294137)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.h 2022-05-13 01:49:32 UTC (rev 294138)
@@ -190,7 +190,7 @@
template<typename T> inline operator T() const; // Defined in CSSPrimitiveValueMappings.h
- String customCSSText() const;
+ String customCSSText(Document* = nullptr) const;
bool equals(const CSSPrimitiveValue&) const;
Modified: trunk/Source/WebCore/css/CSSValue.cpp (294137 => 294138)
--- trunk/Source/WebCore/css/CSSValue.cpp 2022-05-13 01:41:21 UTC (rev 294137)
+++ trunk/Source/WebCore/css/CSSValue.cpp 2022-05-13 01:49:32 UTC (rev 294138)
@@ -246,7 +246,7 @@
return relativeURL.isEmpty() || relativeURL.startsWith('#');
}
-String CSSValue::cssText() const
+String CSSValue::cssText(Document* document) const
{
switch (classType()) {
case AspectRatioClass:
@@ -278,7 +278,7 @@
case FontVariationClass:
return downcast<CSSFontVariationValue>(*this).customCSSText();
case FunctionClass:
- return downcast<CSSFunctionValue>(*this).customCSSText();
+ return downcast<CSSFunctionValue>(*this).customCSSText(document);
case LinearGradientClass:
return downcast<CSSLinearGradientValue>(*this).customCSSText();
case RadialGradientClass:
@@ -300,7 +300,7 @@
case GridTemplateAreasClass:
return downcast<CSSGridTemplateAreasValue>(*this).customCSSText();
case PrimitiveClass:
- return downcast<CSSPrimitiveValue>(*this).customCSSText();
+ return downcast<CSSPrimitiveValue>(*this).customCSSText(document);
case ReflectClass:
return downcast<CSSReflectValue>(*this).customCSSText();
case ShadowClass:
@@ -314,7 +314,7 @@
case UnicodeRangeClass:
return downcast<CSSUnicodeRangeValue>(*this).customCSSText();
case ValueListClass:
- return downcast<CSSValueList>(*this).customCSSText();
+ return downcast<CSSValueList>(*this).customCSSText(document);
case ValuePairClass:
return downcast<CSSValuePair>(*this).customCSSText();
case LineBoxContainClass:
Modified: trunk/Source/WebCore/css/CSSValue.h (294137 => 294138)
--- trunk/Source/WebCore/css/CSSValue.h 2022-05-13 01:41:21 UTC (rev 294137)
+++ trunk/Source/WebCore/css/CSSValue.h 2022-05-13 01:49:32 UTC (rev 294138)
@@ -35,6 +35,7 @@
class CSSStyleDeclaration;
class CachedResource;
class DeprecatedCSSOMValue;
+class Document;
class StyleSheetContents;
enum CSSPropertyID : uint16_t;
@@ -77,7 +78,7 @@
}
Type cssValueType() const;
- String cssText() const;
+ String cssText(Document* = nullptr) const;
ASCIILiteral separatorCSSText() const;
bool isPrimitiveValue() const { return m_classType == PrimitiveClass; }
@@ -248,6 +249,7 @@
, m_hasCachedCSSText(false)
, m_valueSeparator(SpaceSeparator)
, m_isImplicit(false)
+ , m_cachedCSSTextUsesLegacyPrecision(false)
, m_classType(classType)
{
}
@@ -275,6 +277,7 @@
unsigned m_valueSeparator : ValueSeparatorBits;
unsigned m_isImplicit : 1;
+ mutable unsigned m_cachedCSSTextUsesLegacyPrecision : 1;
private:
unsigned m_classType : ClassTypeBits; // ClassType
Modified: trunk/Source/WebCore/css/CSSValueList.cpp (294137 => 294138)
--- trunk/Source/WebCore/css/CSSValueList.cpp 2022-05-13 01:41:21 UTC (rev 294137)
+++ trunk/Source/WebCore/css/CSSValueList.cpp 2022-05-13 01:49:32 UTC (rev 294138)
@@ -83,12 +83,12 @@
return newList.releaseNonNull();
}
-String CSSValueList::customCSSText() const
+String CSSValueList::customCSSText(Document* document) const
{
StringBuilder result;
auto separator = separatorCSSText();
for (auto& value : m_values)
- result.append(result.isEmpty() ? ""_s : separator, value.get().cssText());
+ result.append(result.isEmpty() ? ""_s : separator, value.get().cssText(document));
return result.toString();
}
Modified: trunk/Source/WebCore/css/CSSValueList.h (294137 => 294138)
--- trunk/Source/WebCore/css/CSSValueList.h 2022-05-13 01:41:21 UTC (rev 294137)
+++ trunk/Source/WebCore/css/CSSValueList.h 2022-05-13 01:49:32 UTC (rev 294138)
@@ -66,7 +66,7 @@
bool hasValue(CSSValue*) const;
Ref<CSSValueList> copy();
- String customCSSText() const;
+ String customCSSText(Document* = nullptr) const;
bool equals(const CSSValueList&) const;
bool equals(const CSSValue&) const;
Modified: trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp (294137 => 294138)
--- trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp 2022-05-13 01:41:21 UTC (rev 294137)
+++ trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp 2022-05-13 01:49:32 UTC (rev 294138)
@@ -26,8 +26,11 @@
#include "CSSRule.h"
#include "CSSStyleSheet.h"
#include "CustomElementReactionQueue.h"
+#include "DOMWindow.h"
#include "HTMLNames.h"
#include "InspectorInstrumentation.h"
+#include "JSDOMGlobalObject.h"
+#include "JSDOMWindowBase.h"
#include "MutationObserverInterestGroup.h"
#include "MutationRecord.h"
#include "StyleProperties.h"
@@ -299,7 +302,16 @@
String PropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPropertyID propertyID)
{
- String value = m_propertySet->getPropertyValue(propertyID);
+ Document* doc = nullptr;
+ JSDOMObject* wrap = wrapper();
+ if (wrap) {
+ JSDOMGlobalObject* global = wrap->globalObject();
+ if (global) {
+ DOMWindow& window = activeDOMWindow(*global);
+ doc = window.document();
+ }
+ }
+ String value = m_propertySet->getPropertyValue(propertyID, doc);
if (!value.isEmpty())
return value;
Modified: trunk/Source/WebCore/css/StyleProperties.cpp (294137 => 294138)
--- trunk/Source/WebCore/css/StyleProperties.cpp 2022-05-13 01:41:21 UTC (rev 294137)
+++ trunk/Source/WebCore/css/StyleProperties.cpp 2022-05-13 01:49:32 UTC (rev 294138)
@@ -174,7 +174,7 @@
return false;
}
-String StyleProperties::getPropertyValue(CSSPropertyID propertyID) const
+String StyleProperties::getPropertyValue(CSSPropertyID propertyID, Document* document) const
{
if (auto value = getPropertyCSSValue(propertyID)) {
switch (propertyID) {
@@ -188,7 +188,7 @@
return makeString(downcast<CSSPrimitiveValue>(*value).doubleValue() / 100);
FALLTHROUGH;
default:
- return value->cssText();
+ return value->cssText(document);
}
}
Modified: trunk/Source/WebCore/css/StyleProperties.h (294137 => 294138)
--- trunk/Source/WebCore/css/StyleProperties.h 2022-05-13 01:41:21 UTC (rev 294137)
+++ trunk/Source/WebCore/css/StyleProperties.h 2022-05-13 01:49:32 UTC (rev 294138)
@@ -90,7 +90,7 @@
PropertyReference propertyAt(unsigned) const;
WEBCORE_EXPORT RefPtr<CSSValue> getPropertyCSSValue(CSSPropertyID) const;
- WEBCORE_EXPORT String getPropertyValue(CSSPropertyID) const;
+ WEBCORE_EXPORT String getPropertyValue(CSSPropertyID, Document* = nullptr) const;
WEBCORE_EXPORT std::optional<Color> propertyAsColor(CSSPropertyID) const;
WEBCORE_EXPORT CSSValueID propertyAsValueID(CSSPropertyID) const;
Modified: trunk/Source/WebCore/page/Quirks.cpp (294137 => 294138)
--- trunk/Source/WebCore/page/Quirks.cpp 2022-05-13 01:41:21 UTC (rev 294137)
+++ trunk/Source/WebCore/page/Quirks.cpp 2022-05-13 01:49:32 UTC (rev 294138)
@@ -1337,6 +1337,18 @@
#endif
}
+// FIXME: remove this once rdar://92531240 has been fixed.
+bool Quirks::needsFlightAwareSerializationQuirk() const
+{
+ if (!needsQuirks())
+ return false;
+
+ if (!m_needsFlightAwareSerializationQuirk)
+ m_needsFlightAwareSerializationQuirk = equalLettersIgnoringASCIICase(m_document->url().host(), "flightaware.com"_s);
+
+ return *m_needsFlightAwareSerializationQuirk;
+}
+
bool Quirks::needsBlackFullscreenBackgroundQuirk() const
{
// MLB.com sets a black background-color on the :backdrop pseudo element, which WebKit does not yet support. This
Modified: trunk/Source/WebCore/page/Quirks.h (294137 => 294138)
--- trunk/Source/WebCore/page/Quirks.h 2022-05-13 01:41:21 UTC (rev 294137)
+++ trunk/Source/WebCore/page/Quirks.h 2022-05-13 01:49:32 UTC (rev 294138)
@@ -133,6 +133,7 @@
bool needsHDRPixelDepthQuirk() const;
bool needsAkamaiMediaPlayerQuirk(const HTMLVideoElement&) const;
+ bool needsFlightAwareSerializationQuirk() const;
bool needsBlackFullscreenBackgroundQuirk() const;
@@ -194,6 +195,7 @@
mutable std::optional<bool> m_shouldBypassAsyncScriptDeferring;
mutable std::optional<bool> m_needsVP9FullRangeFlagQuirk;
mutable std::optional<bool> m_needsHDRPixelDepthQuirk;
+ mutable std::optional<bool> m_needsFlightAwareSerializationQuirk;
mutable std::optional<bool> m_needsBlackFullscreenBackgroundQuirk;
mutable std::optional<bool> m_requiresUserGestureToPauseInPictureInPicture;
mutable std::optional<bool> m_requiresUserGestureToLoadInPictureInPicture;