Title: [288516] branches/safari-613-branch
Revision
288516
Author
[email protected]
Date
2022-01-24 17:55:58 -0800 (Mon, 24 Jan 2022)

Log Message

Cherry-pick r288245. rdar://problem/85878291

    Limit the deprecated CSSOMPrimitiveValue to formerly standardized unit types
    https://bugs.webkit.org/show_bug.cgi?id=233651
    <rdar://problem/85878291>

    Reviewed by Darin Adler.

    Source/WebCore:

    This removes support, and makes it clear that these deprecated APIs shouldn't be exposing
    anything more modern than what is standardized in DOM Level 2 Style. Hopefully this avoids
    others in future adding support for new units.

    Other changes included as they are necessary to make improved test not assert.

    Test: fast/css/CSSPrimitiveValue-modern-length.html

    * css/CSSUnits.cpp:
    (WebCore::unitCategory): Ensure this is complete for all units.
    (WebCore::canonicalUnitTypeForCategory): Ensure this is complete for all unit categories.
    * css/DeprecatedCSSOMPrimitiveValue.cpp:
    (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType const): Remove post-DOM Level 2 Style values.
    (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue const): Remove post-DOM Level 2 Style values.
    (WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue const): Add comment.
    * css/DeprecatedCSSOMPrimitiveValue.h: Remove post-DOM Level 2 Style constants.
    * css/DeprecatedCSSOMPrimitiveValue.idl: Remove post-DOM Level 2 Style constants.
    * css/CSSPrimitiveValue.cpp:
    (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor): Change to return std::optional, making explicit when there is no scaling factor.
    (WebCore::CSSPrimitiveValue::doubleValueInternal const): Handle std::optional return.
    * css/CSSPrimitiveValue.h:
    (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor): Change to return std::optional, making explicit when there is no scaling factor.
    * page/PrintContext.cpp:
    (WebCore::PrintContext::computedPageMargin): Handle std::optional return.

    LayoutTests:

    Updated/moved test to cover all modern length units, not just ic.

    * fast/css/CSSPrimitiveValue-ic-expected.txt: Removed.
    * fast/css/CSSPrimitiveValue-ic.html: Removed.
    * fast/css/CSSPrimitiveValue-modern-length-expected.txt: Added.
    * fast/css/CSSPrimitiveValue-modern-length.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288245 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Removed Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (288515 => 288516)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-01-25 01:55:53 UTC (rev 288515)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-01-25 01:55:58 UTC (rev 288516)
@@ -1,5 +1,69 @@
 2022-01-24  Alan Coon  <[email protected]>
 
+        Cherry-pick r288245. rdar://problem/85878291
+
+    Limit the deprecated CSSOMPrimitiveValue to formerly standardized unit types
+    https://bugs.webkit.org/show_bug.cgi?id=233651
+    <rdar://problem/85878291>
+    
+    Reviewed by Darin Adler.
+    
+    Source/WebCore:
+    
+    This removes support, and makes it clear that these deprecated APIs shouldn't be exposing
+    anything more modern than what is standardized in DOM Level 2 Style. Hopefully this avoids
+    others in future adding support for new units.
+    
+    Other changes included as they are necessary to make improved test not assert.
+    
+    Test: fast/css/CSSPrimitiveValue-modern-length.html
+    
+    * css/CSSUnits.cpp:
+    (WebCore::unitCategory): Ensure this is complete for all units.
+    (WebCore::canonicalUnitTypeForCategory): Ensure this is complete for all unit categories.
+    * css/DeprecatedCSSOMPrimitiveValue.cpp:
+    (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType const): Remove post-DOM Level 2 Style values.
+    (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue const): Remove post-DOM Level 2 Style values.
+    (WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue const): Add comment.
+    * css/DeprecatedCSSOMPrimitiveValue.h: Remove post-DOM Level 2 Style constants.
+    * css/DeprecatedCSSOMPrimitiveValue.idl: Remove post-DOM Level 2 Style constants.
+    * css/CSSPrimitiveValue.cpp:
+    (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor): Change to return std::optional, making explicit when there is no scaling factor.
+    (WebCore::CSSPrimitiveValue::doubleValueInternal const): Handle std::optional return.
+    * css/CSSPrimitiveValue.h:
+    (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor): Change to return std::optional, making explicit when there is no scaling factor.
+    * page/PrintContext.cpp:
+    (WebCore::PrintContext::computedPageMargin): Handle std::optional return.
+    
+    LayoutTests:
+    
+    Updated/moved test to cover all modern length units, not just ic.
+    
+    * fast/css/CSSPrimitiveValue-ic-expected.txt: Removed.
+    * fast/css/CSSPrimitiveValue-ic.html: Removed.
+    * fast/css/CSSPrimitiveValue-modern-length-expected.txt: Added.
+    * fast/css/CSSPrimitiveValue-modern-length.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288245 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-19  Sam Sneddon  <[email protected]>
+
+            Limit the deprecated CSSOMPrimitiveValue to formerly standardized unit types
+            https://bugs.webkit.org/show_bug.cgi?id=233651
+            <rdar://problem/85878291>
+
+            Reviewed by Darin Adler.
+
+            Updated/moved test to cover all modern length units, not just ic.
+
+            * fast/css/CSSPrimitiveValue-ic-expected.txt: Removed.
+            * fast/css/CSSPrimitiveValue-ic.html: Removed.
+            * fast/css/CSSPrimitiveValue-modern-length-expected.txt: Added.
+            * fast/css/CSSPrimitiveValue-modern-length.html: Added.
+
+2022-01-24  Alan Coon  <[email protected]>
+
         Cherry-pick r288180. rdar://problem/84440841
 
     Loupe sometimes flips to the bottom of the page when dragging the end of a selection to the top of a page with selection flipping.

Deleted: branches/safari-613-branch/LayoutTests/fast/css/CSSPrimitiveValue-ic-expected.txt (288515 => 288516)


--- branches/safari-613-branch/LayoutTests/fast/css/CSSPrimitiveValue-ic-expected.txt	2022-01-25 01:55:53 UTC (rev 288515)
+++ branches/safari-613-branch/LayoutTests/fast/css/CSSPrimitiveValue-ic-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
@@ -1,15 +0,0 @@
-Testing behaviors of CSSPrimitiveValue on the ic unit.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
-PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
-PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
-PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
-PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
-PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: branches/safari-613-branch/LayoutTests/fast/css/CSSPrimitiveValue-ic.html (288515 => 288516)


--- branches/safari-613-branch/LayoutTests/fast/css/CSSPrimitiveValue-ic.html	2022-01-25 01:55:53 UTC (rev 288515)
+++ branches/safari-613-branch/LayoutTests/fast/css/CSSPrimitiveValue-ic.html	2022-01-25 01:55:58 UTC (rev 288516)
@@ -1,22 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src=""
-</head>
-<body>
-<div id="test-div" style="width: 1ic;"></div>
-<script>
-description("Testing behaviors of CSSPrimitiveValue on the ic unit.");
-
-var divWidth = document.getElementById("test-div").style.getPropertyCSSValue("width");
-
-shouldBe("divWidth.primitiveType", "CSSPrimitiveValue.CSS_UNKNOWN");
-
-shouldThrowErrorName("divWidth.getFloatValue(CSSPrimitiveValue.CSS_S)", "InvalidAccessError");
-shouldThrowErrorName("divWidth.getCounterValue()", "InvalidAccessError");
-shouldThrowErrorName("divWidth.getRGBColorValue()", "InvalidAccessError");
-shouldThrowErrorName("divWidth.getRectValue()", "InvalidAccessError");
-shouldThrowErrorName("divWidth.getStringValue()", "InvalidAccessError");
-</script>
-<script src=""
-</body>

Added: branches/safari-613-branch/LayoutTests/fast/css/CSSPrimitiveValue-modern-length-expected.txt (0 => 288516)


--- branches/safari-613-branch/LayoutTests/fast/css/CSSPrimitiveValue-modern-length-expected.txt	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/fast/css/CSSPrimitiveValue-modern-length-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
@@ -0,0 +1,123 @@
+Testing behaviors of CSSPrimitiveValue on the Q unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+Testing behaviors of CSSPrimitiveValue on the cap unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+Testing behaviors of CSSPrimitiveValue on the ch unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+Testing behaviors of CSSPrimitiveValue on the ic unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+Testing behaviors of CSSPrimitiveValue on the lh unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+Testing behaviors of CSSPrimitiveValue on the rcap unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+Testing behaviors of CSSPrimitiveValue on the rch unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+Testing behaviors of CSSPrimitiveValue on the rem unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+Testing behaviors of CSSPrimitiveValue on the rex unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+Testing behaviors of CSSPrimitiveValue on the ric unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+Testing behaviors of CSSPrimitiveValue on the rlh unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+Testing behaviors of CSSPrimitiveValue on the vb unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+Testing behaviors of CSSPrimitiveValue on the vh unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+Testing behaviors of CSSPrimitiveValue on the vi unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+Testing behaviors of CSSPrimitiveValue on the vmax unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+Testing behaviors of CSSPrimitiveValue on the vmin unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+Testing behaviors of CSSPrimitiveValue on the vw unit.
+PASS divWidth.primitiveType is CSSPrimitiveValue.CSS_UNKNOWN
+PASS divWidth.getFloatValue(CSSPrimitiveValue.CSS_S) threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getCounterValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRGBColorValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getRectValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS divWidth.getStringValue() threw exception InvalidAccessError: The object does not support the operation or argument..
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-613-branch/LayoutTests/fast/css/CSSPrimitiveValue-modern-length.html (0 => 288516)


--- branches/safari-613-branch/LayoutTests/fast/css/CSSPrimitiveValue-modern-length.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/fast/css/CSSPrimitiveValue-modern-length.html	2022-01-25 01:55:58 UTC (rev 288516)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<div id="test-div"></div>
+<script>
+var unsupported = ["Q", "cap", "ch", "ic", "lh", "rcap", "rch", "rem", "rex",
+                   "ric", "rlh", "vb", "vh", "vi", "vmax", "vmin", "vw"];
+
+for (var unit of unsupported) {
+  debug("Testing behaviors of CSSPrimitiveValue on the " + unit + " unit.");
+
+  document.getElementById("test-div").style.width = "1" + unit;
+  var divWidth = document.getElementById("test-div").style.getPropertyCSSValue("width");
+
+  shouldBe("divWidth.primitiveType", "CSSPrimitiveValue.CSS_UNKNOWN");
+
+  shouldThrowErrorName("divWidth.getFloatValue(CSSPrimitiveValue.CSS_S)", "InvalidAccessError");
+  shouldThrowErrorName("divWidth.getCounterValue()", "InvalidAccessError");
+  shouldThrowErrorName("divWidth.getRGBColorValue()", "InvalidAccessError");
+  shouldThrowErrorName("divWidth.getRectValue()", "InvalidAccessError");
+  shouldThrowErrorName("divWidth.getStringValue()", "InvalidAccessError");
+}
+</script>
+<script src=""
+</body>

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (288515 => 288516)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-01-25 01:55:53 UTC (rev 288515)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-01-25 01:55:58 UTC (rev 288516)
@@ -1,5 +1,87 @@
 2022-01-24  Alan Coon  <[email protected]>
 
+        Cherry-pick r288245. rdar://problem/85878291
+
+    Limit the deprecated CSSOMPrimitiveValue to formerly standardized unit types
+    https://bugs.webkit.org/show_bug.cgi?id=233651
+    <rdar://problem/85878291>
+    
+    Reviewed by Darin Adler.
+    
+    Source/WebCore:
+    
+    This removes support, and makes it clear that these deprecated APIs shouldn't be exposing
+    anything more modern than what is standardized in DOM Level 2 Style. Hopefully this avoids
+    others in future adding support for new units.
+    
+    Other changes included as they are necessary to make improved test not assert.
+    
+    Test: fast/css/CSSPrimitiveValue-modern-length.html
+    
+    * css/CSSUnits.cpp:
+    (WebCore::unitCategory): Ensure this is complete for all units.
+    (WebCore::canonicalUnitTypeForCategory): Ensure this is complete for all unit categories.
+    * css/DeprecatedCSSOMPrimitiveValue.cpp:
+    (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType const): Remove post-DOM Level 2 Style values.
+    (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue const): Remove post-DOM Level 2 Style values.
+    (WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue const): Add comment.
+    * css/DeprecatedCSSOMPrimitiveValue.h: Remove post-DOM Level 2 Style constants.
+    * css/DeprecatedCSSOMPrimitiveValue.idl: Remove post-DOM Level 2 Style constants.
+    * css/CSSPrimitiveValue.cpp:
+    (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor): Change to return std::optional, making explicit when there is no scaling factor.
+    (WebCore::CSSPrimitiveValue::doubleValueInternal const): Handle std::optional return.
+    * css/CSSPrimitiveValue.h:
+    (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor): Change to return std::optional, making explicit when there is no scaling factor.
+    * page/PrintContext.cpp:
+    (WebCore::PrintContext::computedPageMargin): Handle std::optional return.
+    
+    LayoutTests:
+    
+    Updated/moved test to cover all modern length units, not just ic.
+    
+    * fast/css/CSSPrimitiveValue-ic-expected.txt: Removed.
+    * fast/css/CSSPrimitiveValue-ic.html: Removed.
+    * fast/css/CSSPrimitiveValue-modern-length-expected.txt: Added.
+    * fast/css/CSSPrimitiveValue-modern-length.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288245 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-19  Sam Sneddon  <[email protected]>
+
+            Limit the deprecated CSSOMPrimitiveValue to formerly standardized unit types
+            https://bugs.webkit.org/show_bug.cgi?id=233651
+            <rdar://problem/85878291>
+
+            Reviewed by Darin Adler.
+
+            This removes support, and makes it clear that these deprecated APIs shouldn't be exposing
+            anything more modern than what is standardized in DOM Level 2 Style. Hopefully this avoids
+            others in future adding support for new units.
+
+            Other changes included as they are necessary to make improved test not assert.
+
+            Test: fast/css/CSSPrimitiveValue-modern-length.html
+
+            * css/CSSUnits.cpp:
+            (WebCore::unitCategory): Ensure this is complete for all units.
+            (WebCore::canonicalUnitTypeForCategory): Ensure this is complete for all unit categories.
+            * css/DeprecatedCSSOMPrimitiveValue.cpp:
+            (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType const): Remove post-DOM Level 2 Style values.
+            (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue const): Remove post-DOM Level 2 Style values.
+            (WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue const): Add comment.
+            * css/DeprecatedCSSOMPrimitiveValue.h: Remove post-DOM Level 2 Style constants.
+            * css/DeprecatedCSSOMPrimitiveValue.idl: Remove post-DOM Level 2 Style constants.
+            * css/CSSPrimitiveValue.cpp:
+            (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor): Change to return std::optional, making explicit when there is no scaling factor.
+            (WebCore::CSSPrimitiveValue::doubleValueInternal const): Handle std::optional return.
+            * css/CSSPrimitiveValue.h:
+            (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor): Change to return std::optional, making explicit when there is no scaling factor.
+            * page/PrintContext.cpp:
+            (WebCore::PrintContext::computedPageMargin): Handle std::optional return.
+
+2022-01-24  Alan Coon  <[email protected]>
+
         Cherry-pick r288180. rdar://problem/84440841
 
     Loupe sometimes flips to the bottom of the page when dragging the end of a selection to the top of a page with selection flipping.

Modified: branches/safari-613-branch/Source/WebCore/css/CSSPrimitiveValue.cpp (288515 => 288516)


--- branches/safari-613-branch/Source/WebCore/css/CSSPrimitiveValue.cpp	2022-01-25 01:55:53 UTC (rev 288515)
+++ branches/safari-613-branch/Source/WebCore/css/CSSPrimitiveValue.cpp	2022-01-25 01:55:58 UTC (rev 288516)
@@ -959,9 +959,8 @@
     return true;
 }
 
-double CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(CSSUnitType unitType)
+std::optional<double> CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(CSSUnitType unitType)
 {
-    double factor = 1.0;
     // FIXME: the switch can be replaced by an array of scale factors.
     switch (unitType) {
     // These are "canonical" units in their respective categories.
@@ -970,52 +969,52 @@
     case CSSUnitType::CSS_MS:
     case CSSUnitType::CSS_HZ:
     case CSSUnitType::CSS_DPPX:
-        break;
+        return 1.0;
+
     case CSSUnitType::CSS_X:
         // This is semantically identical to (canonical) dppx
-        break;
+        return 1.0;
+
     case CSSUnitType::CSS_CM:
-        factor = cssPixelsPerInch / cmPerInch;
-        break;
+        return cssPixelsPerInch / cmPerInch;
+
     case CSSUnitType::CSS_DPCM:
-        factor = cmPerInch / cssPixelsPerInch; // (2.54 cm/in)
-        break;
+        return cmPerInch / cssPixelsPerInch; // (2.54 cm/in)
+
     case CSSUnitType::CSS_MM:
-        factor = cssPixelsPerInch / mmPerInch;
-        break;
+        return cssPixelsPerInch / mmPerInch;
+
     case CSSUnitType::CSS_Q:
-        factor = cssPixelsPerInch / QPerInch;
-        break;
+        return cssPixelsPerInch / QPerInch;
+
     case CSSUnitType::CSS_IN:
-        factor = cssPixelsPerInch;
-        break;
+        return cssPixelsPerInch;
+
     case CSSUnitType::CSS_DPI:
-        factor = 1 / cssPixelsPerInch;
-        break;
+        return 1 / cssPixelsPerInch;
+
     case CSSUnitType::CSS_PT:
-        factor = cssPixelsPerInch / 72.0;
-        break;
+        return cssPixelsPerInch / 72.0;
+
     case CSSUnitType::CSS_PC:
-        factor = cssPixelsPerInch * 12.0 / 72.0; // 1 pc == 12 pt
-        break;
+        return cssPixelsPerInch * 12.0 / 72.0; // 1 pc == 12 pt
+
     case CSSUnitType::CSS_RAD:
-        factor = degreesPerRadianDouble;
-        break;
+        return degreesPerRadianDouble;
+
     case CSSUnitType::CSS_GRAD:
-        factor = degreesPerGradientDouble;
-        break;
+        return degreesPerGradientDouble;
+
     case CSSUnitType::CSS_TURN:
-        factor = degreesPerTurnDouble;
-        break;
+        return degreesPerTurnDouble;
+
     case CSSUnitType::CSS_S:
     case CSSUnitType::CSS_KHZ:
-        factor = 1000;
-        break;
+        return 1000;
+
     default:
-        break;
+        return std::nullopt;
     }
-
-    return factor;
 }
 
 ExceptionOr<float> CSSPrimitiveValue::getFloatValue(CSSUnitType unitType) const
@@ -1112,13 +1111,21 @@
 
     double convertedValue = doubleValue();
 
+    // If we don't need to scale it, don't worry about if we can scale it.
+    if (sourceUnitType == targetUnitType)
+        return convertedValue;
+
     // First convert the value from primitiveUnitType() to canonical type.
-    double factor = conversionToCanonicalUnitsScaleFactor(sourceUnitType);
-    convertedValue *= factor;
+    auto sourceFactor = conversionToCanonicalUnitsScaleFactor(sourceUnitType);
+    if (!sourceFactor.has_value())
+        return std::nullopt;
+    convertedValue *= sourceFactor.value();
 
     // Now convert from canonical type to the target unitType.
-    factor = conversionToCanonicalUnitsScaleFactor(targetUnitType);
-    convertedValue /= factor;
+    auto targetFactor = conversionToCanonicalUnitsScaleFactor(targetUnitType);
+    if (!targetFactor.has_value())
+        return std::nullopt;
+    convertedValue /= targetFactor.value();
 
     return convertedValue;
 }

Modified: branches/safari-613-branch/Source/WebCore/css/CSSPrimitiveValue.h (288515 => 288516)


--- branches/safari-613-branch/Source/WebCore/css/CSSPrimitiveValue.h	2022-01-25 01:55:53 UTC (rev 288515)
+++ branches/safari-613-branch/Source/WebCore/css/CSSPrimitiveValue.h	2022-01-25 01:55:58 UTC (rev 288516)
@@ -192,7 +192,7 @@
 
     bool equals(const CSSPrimitiveValue&) const;
 
-    static double conversionToCanonicalUnitsScaleFactor(CSSUnitType);
+    static std::optional<double> conversionToCanonicalUnitsScaleFactor(CSSUnitType);
     static String unitTypeString(CSSUnitType);
 
     static double computeUnzoomedNonCalcLengthDouble(CSSUnitType, double value, CSSPropertyID, const FontMetrics* = nullptr, const FontCascadeDescription* = nullptr, const FontCascadeDescription* rootFontDescription = nullptr, const RenderView* = nullptr);

Modified: branches/safari-613-branch/Source/WebCore/css/CSSUnits.cpp (288515 => 288516)


--- branches/safari-613-branch/Source/WebCore/css/CSSUnits.cpp	2022-01-25 01:55:53 UTC (rev 288515)
+++ branches/safari-613-branch/Source/WebCore/css/CSSUnits.cpp	2022-01-25 01:55:58 UTC (rev 288516)
@@ -40,6 +40,36 @@
     case CSSUnitType::CSS_PC:
     case CSSUnitType::CSS_Q:
     case CSSUnitType::CSS_IC:
+    case CSSUnitType::CSS_EMS:
+    case CSSUnitType::CSS_EXS:
+    case CSSUnitType::CSS_CHS:
+    case CSSUnitType::CSS_REMS:
+    case CSSUnitType::CSS_LHS:
+    case CSSUnitType::CSS_RLHS:
+    case CSSUnitType::CSS_VW:
+    case CSSUnitType::CSS_VH:
+    case CSSUnitType::CSS_VMIN:
+    case CSSUnitType::CSS_VMAX:
+    case CSSUnitType::CSS_VB:
+    case CSSUnitType::CSS_VI:
+    case CSSUnitType::CSS_SVW:
+    case CSSUnitType::CSS_SVH:
+    case CSSUnitType::CSS_SVMIN:
+    case CSSUnitType::CSS_SVMAX:
+    case CSSUnitType::CSS_SVB:
+    case CSSUnitType::CSS_SVI:
+    case CSSUnitType::CSS_LVW:
+    case CSSUnitType::CSS_LVH:
+    case CSSUnitType::CSS_LVMIN:
+    case CSSUnitType::CSS_LVMAX:
+    case CSSUnitType::CSS_LVB:
+    case CSSUnitType::CSS_LVI:
+    case CSSUnitType::CSS_DVW:
+    case CSSUnitType::CSS_DVH:
+    case CSSUnitType::CSS_DVMIN:
+    case CSSUnitType::CSS_DVMAX:
+    case CSSUnitType::CSS_DVB:
+    case CSSUnitType::CSS_DVI:
         return CSSUnitCategory::Length;
     case CSSUnitType::CSS_MS:
     case CSSUnitType::CSS_S:
@@ -57,7 +87,29 @@
     case CSSUnitType::CSS_DPI:
     case CSSUnitType::CSS_DPCM:
         return CSSUnitCategory::Resolution;
-    default:
+    case CSSUnitType::CSS_ATTR:
+    case CSSUnitType::CSS_CALC:
+    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_LENGTH:
+    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_NUMBER:
+    case CSSUnitType::CSS_COUNTER:
+    case CSSUnitType::CSS_COUNTER_NAME:
+    case CSSUnitType::CSS_DIMENSION:
+    case CSSUnitType::CSS_FONT_FAMILY:
+    case CSSUnitType::CSS_FR:
+    case CSSUnitType::CSS_IDENT:
+    case CSSUnitType::CSS_PAIR:
+    case CSSUnitType::CSS_PROPERTY_ID:
+    case CSSUnitType::CSS_QUAD:
+    case CSSUnitType::CSS_QUIRKY_EMS:
+    case CSSUnitType::CSS_RECT:
+    case CSSUnitType::CSS_RGBCOLOR:
+    case CSSUnitType::CSS_SHAPE:
+    case CSSUnitType::CSS_STRING:
+    case CSSUnitType::CSS_UNICODE_RANGE:
+    case CSSUnitType::CSS_UNKNOWN:
+    case CSSUnitType::CSS_URI:
+    case CSSUnitType::CSS_VALUE_ID:
+    case CSSUnitType::CustomIdent:
         return CSSUnitCategory::Other;
     }
 }
@@ -79,7 +131,7 @@
         return CSSUnitType::CSS_HZ;
     case CSSUnitCategory::Resolution:
         return CSSUnitType::CSS_DPPX;
-    default:
+    case CSSUnitCategory::Other:
         return CSSUnitType::CSS_UNKNOWN;
     }
 }

Modified: branches/safari-613-branch/Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.cpp (288515 => 288516)


--- branches/safari-613-branch/Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.cpp	2022-01-25 01:55:53 UTC (rev 288515)
+++ branches/safari-613-branch/Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.cpp	2022-01-25 01:55:58 UTC (rev 288516)
@@ -34,28 +34,16 @@
     
 unsigned short DeprecatedCSSOMPrimitiveValue::primitiveType() const
 {
-    // FIXME: Some of these are never exposed to the web because code elsewhere prevents it. We can ASSERT_NOT_REACHED for those.
-    // FIXME: Some of these should return CSS_UNKNOWN instead of hard-coded numbers not mentioned in the IDL file.
-
     switch (m_value->primitiveType()) {
     case CSSUnitType::CSS_ATTR:                         return CSS_ATTR;
-    case CSSUnitType::CSS_CALC:                         return 113;
-    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_LENGTH:  return 115;
-    case CSSUnitType::CSS_CALC_PERCENTAGE_WITH_NUMBER:  return 114;
-    case CSSUnitType::CSS_CHS:                          return 109;
     case CSSUnitType::CSS_IC:                           return CSS_UNKNOWN;
     case CSSUnitType::CSS_CM:                           return CSS_CM;
     case CSSUnitType::CSS_COUNTER:                      return CSS_COUNTER;
-    case CSSUnitType::CSS_COUNTER_NAME:                 return 110;
     case CSSUnitType::CSS_DEG:                          return CSS_DEG;
     case CSSUnitType::CSS_DIMENSION:                    return CSS_DIMENSION;
-    case CSSUnitType::CSS_DPCM:                         return 32;
-    case CSSUnitType::CSS_DPI:                          return 31;
-    case CSSUnitType::CSS_DPPX:                         return 30;
     case CSSUnitType::CSS_EMS:                          return CSS_EMS;
     case CSSUnitType::CSS_EXS:                          return CSS_EXS;
     case CSSUnitType::CSS_FONT_FAMILY:                  return CSS_STRING;
-    case CSSUnitType::CSS_FR:                           return 33;
     case CSSUnitType::CSS_GRAD:                         return CSS_GRAD;
     case CSSUnitType::CSS_HZ:                           return CSS_HZ;
     case CSSUnitType::CSS_IDENT:                        return CSS_IDENT;
@@ -62,38 +50,24 @@
     case CSSUnitType::CustomIdent:                      return CSS_IDENT;
     case CSSUnitType::CSS_IN:                           return CSS_IN;
     case CSSUnitType::CSS_KHZ:                          return CSS_KHZ;
-    case CSSUnitType::CSS_LHS:                          return 35;
     case CSSUnitType::CSS_MM:                           return CSS_MM;
     case CSSUnitType::CSS_MS:                           return CSS_MS;
     case CSSUnitType::CSS_NUMBER:                       return CSS_NUMBER;
-    case CSSUnitType::CSS_PAIR:                         return 100;
     case CSSUnitType::CSS_PC:                           return CSS_PC;
     case CSSUnitType::CSS_PERCENTAGE:                   return CSS_PERCENTAGE;
     case CSSUnitType::CSS_PROPERTY_ID:                  return CSS_IDENT;
     case CSSUnitType::CSS_PT:                           return CSS_PT;
     case CSSUnitType::CSS_PX:                           return CSS_PX;
-    case CSSUnitType::CSS_Q:                            return 34;
-    case CSSUnitType::CSS_QUAD:                         return 112;
-    case CSSUnitType::CSS_QUIRKY_EMS:                   return 120;
     case CSSUnitType::CSS_RAD:                          return CSS_RAD;
     case CSSUnitType::CSS_RECT:                         return CSS_RECT;
-    case CSSUnitType::CSS_REMS:                         return 108;
     case CSSUnitType::CSS_RGBCOLOR:                     return CSS_RGBCOLOR;
-    case CSSUnitType::CSS_RLHS:                         return 36;
     case CSSUnitType::CSS_S:                            return CSS_S;
-    case CSSUnitType::CSS_SHAPE:                        return 111;
     case CSSUnitType::CSS_STRING:                       return CSS_STRING;
-    case CSSUnitType::CSS_TURN:                         return 107;
-    case CSSUnitType::CSS_UNICODE_RANGE:                return 102;
     case CSSUnitType::CSS_UNKNOWN:                      return CSS_UNKNOWN;
     case CSSUnitType::CSS_URI:                          return CSS_URI;
     case CSSUnitType::CSS_VALUE_ID:                     return CSS_IDENT;
-    case CSSUnitType::CSS_VH:                           return CSS_VH;
-    case CSSUnitType::CSS_VMAX:                         return CSS_VMAX;
-    case CSSUnitType::CSS_VMIN:                         return CSS_VMIN;
-    case CSSUnitType::CSS_VW:                           return CSS_VW;
-    case CSSUnitType::CSS_X:                            return 37;
 
+    // All other, including newer types, should return UNKNOWN.
     default:                                            return CSS_UNKNOWN;
     }
 }
@@ -100,8 +74,6 @@
 
 ExceptionOr<float> DeprecatedCSSOMPrimitiveValue::getFloatValue(unsigned short unitType) const
 {
-    // FIXME: Some of these values do not need to be exposed as a destination type. Remove cases below and give InvalidAccessError instead.
-
     switch (unitType) {
     case CSS_CM:            return m_value->getFloatValue(CSSUnitType::CSS_CM);
     case CSS_DEG:           return m_value->getFloatValue(CSSUnitType::CSS_DEG);
@@ -121,27 +93,8 @@
     case CSS_PX:            return m_value->getFloatValue(CSSUnitType::CSS_PX);
     case CSS_RAD:           return m_value->getFloatValue(CSSUnitType::CSS_RAD);
     case CSS_S:             return m_value->getFloatValue(CSSUnitType::CSS_S);
-    case CSS_VH:            return m_value->getFloatValue(CSSUnitType::CSS_VH);
-    case CSS_VMAX:          return m_value->getFloatValue(CSSUnitType::CSS_VMAX);
-    case CSS_VMIN:          return m_value->getFloatValue(CSSUnitType::CSS_VMIN);
-    case CSS_VW:            return m_value->getFloatValue(CSSUnitType::CSS_VW);
 
-    case 30:                return m_value->getFloatValue(CSSUnitType::CSS_DPPX);
-    case 31:                return m_value->getFloatValue(CSSUnitType::CSS_DPI);
-    case 32:                return m_value->getFloatValue(CSSUnitType::CSS_DPCM);
-    case 33:                return m_value->getFloatValue(CSSUnitType::CSS_FR);
-    case 34:                return m_value->getFloatValue(CSSUnitType::CSS_Q);
-    case 35:                return m_value->getFloatValue(CSSUnitType::CSS_LHS);
-    case 36:                return m_value->getFloatValue(CSSUnitType::CSS_RLHS);
-    case 37:                return m_value->getFloatValue(CSSUnitType::CSS_X);
-    case 107:               return m_value->getFloatValue(CSSUnitType::CSS_TURN);
-    case 108:               return m_value->getFloatValue(CSSUnitType::CSS_REMS);
-    case 109:               return m_value->getFloatValue(CSSUnitType::CSS_CHS);
-    case 113:               return m_value->getFloatValue(CSSUnitType::CSS_CALC);
-    case 114:               return m_value->getFloatValue(CSSUnitType::CSS_CALC_PERCENTAGE_WITH_NUMBER);
-    case 115:               return m_value->getFloatValue(CSSUnitType::CSS_CALC_PERCENTAGE_WITH_LENGTH);
-    case 120:               return m_value->getFloatValue(CSSUnitType::CSS_QUIRKY_EMS);
-
+    // All other, including newer types, should raise an exception.
     default:                return Exception { InvalidAccessError };
     }
 }
@@ -153,6 +106,8 @@
     case CSS_IDENT:     return m_value->stringValue();
     case CSS_STRING:    return m_value->stringValue();
     case CSS_URI:       return m_value->stringValue();
+
+    // All other, including newer types, should raise an exception.
     default:            return Exception { InvalidAccessError };
     }
 }

Modified: branches/safari-613-branch/Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.h (288515 => 288516)


--- branches/safari-613-branch/Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.h	2022-01-25 01:55:53 UTC (rev 288515)
+++ branches/safari-613-branch/Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.h	2022-01-25 01:55:58 UTC (rev 288516)
@@ -63,11 +63,8 @@
         CSS_ATTR = 22,
         CSS_COUNTER = 23,
         CSS_RECT = 24,
-        CSS_RGBCOLOR = 25,
-        CSS_VW = 26,
-        CSS_VH = 27,
-        CSS_VMIN = 28,
-        CSS_VMAX = 29
+        CSS_RGBCOLOR = 25
+        // Do not add new units here; this is deprecated and we shouldn't expose anything not in DOM Level 2 Style.
     };
 
     static Ref<DeprecatedCSSOMPrimitiveValue> create(const CSSPrimitiveValue& value, CSSStyleDeclaration& owner)

Modified: branches/safari-613-branch/Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.idl (288515 => 288516)


--- branches/safari-613-branch/Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.idl	2022-01-25 01:55:53 UTC (rev 288515)
+++ branches/safari-613-branch/Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.idl	2022-01-25 01:55:58 UTC (rev 288516)
@@ -49,10 +49,7 @@
     const unsigned short CSS_COUNTER = 23;
     const unsigned short CSS_RECT = 24;
     const unsigned short CSS_RGBCOLOR = 25;
-    const unsigned short CSS_VW = 26;
-    const unsigned short CSS_VH = 27;
-    const unsigned short CSS_VMIN = 28;
-    const unsigned short CSS_VMAX = 29;
+    // Do not add new units here; this is deprecated and we shouldn't expose anything not in DOM Level 2 Style.
     
     readonly attribute unsigned short primitiveType;
 

Modified: branches/safari-613-branch/Source/WebCore/page/PrintContext.cpp (288515 => 288516)


--- branches/safari-613-branch/Source/WebCore/page/PrintContext.cpp	2022-01-25 01:55:53 UTC (rev 288515)
+++ branches/safari-613-branch/Source/WebCore/page/PrintContext.cpp	2022-01-25 01:55:58 UTC (rev 288516)
@@ -89,7 +89,7 @@
     // FIXME Currently no pseudo class is supported.
     auto style = frame()->document()->styleScope().resolver().styleForPage(0);
 
-    float pixelToPointScaleFactor = 1 / CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(CSSUnitType::CSS_PT);
+    float pixelToPointScaleFactor = 1 / CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(CSSUnitType::CSS_PT).value();
     return { style->marginTop().isAuto() ? printMargin.top() : style->marginTop().value() * pixelToPointScaleFactor,
         style->marginRight().isAuto() ? printMargin.right() : style->marginRight().value() * pixelToPointScaleFactor,
         style->marginBottom().isAuto() ? printMargin.bottom() : style->marginBottom().value() * pixelToPointScaleFactor,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to