Title: [292222] trunk
Revision
292222
Author
[email protected]
Date
2022-04-01 08:35:55 -0700 (Fri, 01 Apr 2022)

Log Message

[css-logical] Add support for block/inline CSS values for resize property
https://bugs.webkit.org/show_bug.cgi?id=218088

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Marked relevant WPT as passing.

* web-platform-tests/css/css-logical/logical-values-resize-expected.txt:

Source/WebCore:

Tests:
- Parsing: imported/w3c/web-platform-tests/css/css-logical/logical-values-resize.html
- Functionality: fast/css/resize-single-axis.html

* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator Resize const):
* css/CSSProperties.json:
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::resize):
* rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<):
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleRareNonInheritedData.h:

LayoutTests:

Add tests for functionality.

* fast/css/resize-single-axis-expected.txt:
* fast/css/resize-single-axis.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (292221 => 292222)


--- trunk/LayoutTests/ChangeLog	2022-04-01 14:45:00 UTC (rev 292221)
+++ trunk/LayoutTests/ChangeLog	2022-04-01 15:35:55 UTC (rev 292222)
@@ -1,3 +1,15 @@
+2022-04-01  Tim Nguyen  <[email protected]>
+
+        [css-logical] Add support for block/inline CSS values for resize property
+        https://bugs.webkit.org/show_bug.cgi?id=218088
+
+        Reviewed by Antti Koivisto.
+
+        Add tests for functionality.
+
+        * fast/css/resize-single-axis-expected.txt:
+        * fast/css/resize-single-axis.html:
+
 2022-04-01  Youenn Fablet  <[email protected]>
 
         ServiceWorkerRegistration.getNotifications should list all persistent notifications

Modified: trunk/LayoutTests/fast/css/resize-single-axis-expected.txt (292221 => 292222)


--- trunk/LayoutTests/fast/css/resize-single-axis-expected.txt	2022-04-01 14:45:00 UTC (rev 292221)
+++ trunk/LayoutTests/fast/css/resize-single-axis-expected.txt	2022-04-01 15:35:55 UTC (rev 292222)
@@ -1,4 +1,8 @@
 'both' resized as expected to (100px, 100px).
 'horizontal' resized as expected to (100px, 50px).
 'vertical' resized as expected to (50px, 100px).
+'block-horizontal' resized as expected to (50px, 100px).
+'inline-horizontal' resized as expected to (100px, 50px).
+'block-vertical' resized as expected to (100px, 50px).
+'inline-vertical' resized as expected to (50px, 100px).
 

Modified: trunk/LayoutTests/fast/css/resize-single-axis.html (292221 => 292222)


--- trunk/LayoutTests/fast/css/resize-single-axis.html	2022-04-01 14:45:00 UTC (rev 292221)
+++ trunk/LayoutTests/fast/css/resize-single-axis.html	2022-04-01 15:35:55 UTC (rev 292222)
@@ -19,6 +19,16 @@
     #vertical {
         resize: vertical;
     }
+
+    #block-horizontal,
+    #block-vertical {
+        resize: block;
+    }
+
+    #inline-horizontal,
+    #inline-vertical {
+        resize: inline;
+    }
 </style>
 
 <pre id="console"></pre>
@@ -25,6 +35,12 @@
 <div id="both"></div>
 <div id="horizontal"></div>
 <div id="vertical"></div>
+<div id="block-horizontal"></div>
+<div id="inline-horizontal"></div>
+<section style="writing-mode: vertical-lr;">
+    <div id="block-vertical"></div>
+    <div id="inline-vertical"></div>
+</section>
 
 <script type="text/_javascript_">
     function log(message)
@@ -60,13 +76,25 @@
         var both = document.getElementById("both");
         var horizontal = document.getElementById("horizontal");
         var vertical = document.getElementById("vertical");
+        var blockHorizontal = document.getElementById("block-horizontal");
+        var inlineHorizontal = document.getElementById("inline-horizontal");
+        var blockVertical = document.getElementById("block-vertical");
+        var inlineVertical = document.getElementById("inline-vertical");
 
         resize(both);
         resize(horizontal);
         resize(vertical);
+        resize(blockHorizontal);
+        resize(inlineHorizontal);
+        resize(blockVertical);
+        resize(inlineVertical);
 
         assertSize(both, "100px", "100px");
         assertSize(horizontal, "100px", "50px");
         assertSize(vertical, "50px", "100px");
+        assertSize(blockHorizontal, "50px", "100px");
+        assertSize(inlineHorizontal, "100px", "50px");
+        assertSize(blockVertical, "100px", "50px");
+        assertSize(inlineVertical, "50px", "100px");
     }
 </script>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (292221 => 292222)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-04-01 14:45:00 UTC (rev 292221)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-04-01 15:35:55 UTC (rev 292222)
@@ -1,3 +1,14 @@
+2022-04-01  Tim Nguyen  <[email protected]>
+
+        [css-logical] Add support for block/inline CSS values for resize property
+        https://bugs.webkit.org/show_bug.cgi?id=218088
+
+        Reviewed by Antti Koivisto.
+
+        Marked relevant WPT as passing.
+
+        * web-platform-tests/css/css-logical/logical-values-resize-expected.txt:
+
 2022-04-01  Youenn Fablet  <[email protected]>
 
         Notification should be exposed to ServiceWorker contexts

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-values-resize-expected.txt (292221 => 292222)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-values-resize-expected.txt	2022-04-01 14:45:00 UTC (rev 292221)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-values-resize-expected.txt	2022-04-01 15:35:55 UTC (rev 292222)
@@ -1,4 +1,4 @@
 
-FAIL Test that 'resize: block' is supported. assert_equals: logical values in inline style, resize expected "block" but got ""
-FAIL Test that 'resize: inline' is supported. assert_equals: logical values in inline style, resize expected "inline" but got ""
+PASS Test that 'resize: block' is supported.
+PASS Test that 'resize: inline' is supported.
 

Modified: trunk/Source/WebCore/ChangeLog (292221 => 292222)


--- trunk/Source/WebCore/ChangeLog	2022-04-01 14:45:00 UTC (rev 292221)
+++ trunk/Source/WebCore/ChangeLog	2022-04-01 15:35:55 UTC (rev 292222)
@@ -1,3 +1,27 @@
+2022-04-01  Tim Nguyen  <[email protected]>
+
+        [css-logical] Add support for block/inline CSS values for resize property
+        https://bugs.webkit.org/show_bug.cgi?id=218088
+
+        Reviewed by Antti Koivisto.
+
+        Tests:
+        - Parsing: imported/w3c/web-platform-tests/css/css-logical/logical-values-resize.html
+        - Functionality: fast/css/resize-single-axis.html
+
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator Resize const):
+        * css/CSSProperties.json:
+        * css/parser/CSSParserFastPaths.cpp:
+        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::resize):
+        * rendering/style/RenderStyleConstants.cpp:
+        (WebCore::operator<<):
+        * rendering/style/RenderStyleConstants.h:
+        * rendering/style/StyleRareNonInheritedData.h:
+
 2022-04-01  Rob Buis  <[email protected]>
 
         Add RenderGrid parameter to resolveGridPositionsFromStyle

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (292221 => 292222)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2022-04-01 14:45:00 UTC (rev 292221)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2022-04-01 15:35:55 UTC (rev 292222)
@@ -2202,6 +2202,12 @@
     case Resize::Vertical:
         m_value.valueID = CSSValueVertical;
         break;
+    case Resize::Block:
+        m_value.valueID = CSSValueBlock;
+        break;
+    case Resize::Inline:
+        m_value.valueID = CSSValueInline;
+        break;
     case Resize::None:
         m_value.valueID = CSSValueNone;
         break;
@@ -2219,6 +2225,10 @@
         return Resize::Horizontal;
     case CSSValueVertical:
         return Resize::Vertical;
+    case CSSValueBlock:
+        return Resize::Block;
+    case CSSValueInline:
+        return Resize::Inline;
     case CSSValueAuto:
         ASSERT_NOT_REACHED(); // Depends on settings, thus should be handled by the caller.
         return Resize::None;

Modified: trunk/Source/WebCore/css/CSSProperties.json (292221 => 292222)


--- trunk/Source/WebCore/css/CSSProperties.json	2022-04-01 14:45:00 UTC (rev 292221)
+++ trunk/Source/WebCore/css/CSSProperties.json	2022-04-01 15:35:55 UTC (rev 292222)
@@ -4264,13 +4264,17 @@
             }
         },
         "resize": {
-            "inherited": true,
             "values": [
                 "none",
                 "both",
                 "horizontal",
                 "vertical",
-                "auto"
+                "block",
+                "inline",
+                {
+                    "value": "auto",
+                    "status": "non-standard"
+                }
             ],
             "codegen-properties": {
                 "converter": "Resize"

Modified: trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp (292221 => 292222)


--- trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2022-04-01 14:45:00 UTC (rev 292221)
+++ trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2022-04-01 15:35:55 UTC (rev 292222)
@@ -705,8 +705,8 @@
             || valueID == CSSValueAbsolute
             || valueID == CSSValueFixed
             || valueID == CSSValueSticky || valueID == CSSValueWebkitSticky;
-    case CSSPropertyResize: // none | both | horizontal | vertical | auto
-        return valueID == CSSValueNone || valueID == CSSValueBoth || valueID == CSSValueHorizontal || valueID == CSSValueVertical || valueID == CSSValueAuto;
+    case CSSPropertyResize: // none | both | horizontal | vertical | block | inline | auto
+        return valueID == CSSValueNone || valueID == CSSValueBoth || valueID == CSSValueHorizontal || valueID == CSSValueVertical || valueID == CSSValueBlock || valueID == CSSValueInline || valueID == CSSValueAuto;
     case CSSPropertyShapeRendering:
         return valueID == CSSValueAuto || valueID == CSSValueOptimizeSpeed || valueID == CSSValueCrispedges || valueID == CSSValueGeometricPrecision;
     case CSSPropertyStrokeLinejoin:

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (292221 => 292222)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2022-04-01 14:45:00 UTC (rev 292221)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2022-04-01 15:35:55 UTC (rev 292222)
@@ -2787,7 +2787,9 @@
     bool isBoxSizingBorder = renderer->style().boxSizing() == BoxSizing::BorderBox;
 
     Resize resize = renderer->style().resize();
-    if (resize != Resize::Vertical && difference.width()) {
+    bool canResizeWidth = resize == Resize::Horizontal || resize == Resize::Both
+        || (renderer->isHorizontalWritingMode() ? resize == Resize::Inline : resize == Resize::Block);
+    if (canResizeWidth && difference.width()) {
         if (is<HTMLFormControlElement>(*element)) {
             // Make implicit margins from the theme explicit (see <http://bugs.webkit.org/show_bug.cgi?id=9547>).
             styledElement->setInlineStyleProperty(CSSPropertyMarginLeft, renderer->marginLeft() / zoomFactor, CSSUnitType::CSS_PX);
@@ -2798,7 +2800,9 @@
         styledElement->setInlineStyleProperty(CSSPropertyWidth, roundToInt(baseWidth + difference.width()), CSSUnitType::CSS_PX);
     }
 
-    if (resize != Resize::Horizontal && difference.height()) {
+    bool canResizeHeight = resize == Resize::Vertical || resize == Resize::Both
+        || (renderer->isHorizontalWritingMode() ? resize == Resize::Block : resize == Resize::Inline);
+    if (canResizeHeight && difference.height()) {
         if (is<HTMLFormControlElement>(*element)) {
             // Make implicit margins from the theme explicit (see <http://bugs.webkit.org/show_bug.cgi?id=9547>).
             styledElement->setInlineStyleProperty(CSSPropertyMarginTop, renderer->marginTop() / zoomFactor, CSSUnitType::CSS_PX);

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.cpp (292221 => 292222)


--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.cpp	2022-04-01 14:45:00 UTC (rev 292221)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.cpp	2022-04-01 15:35:55 UTC (rev 292222)
@@ -882,6 +882,8 @@
     case Resize::Both: ts << "both"; break;
     case Resize::Horizontal: ts << "horizontal"; break;
     case Resize::Vertical: ts << "vertical"; break;
+    case Resize::Block: ts << "block"; break;
+    case Resize::Inline: ts << "inline"; break;
     }
     return ts;
 }

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (292221 => 292222)


--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2022-04-01 14:45:00 UTC (rev 292221)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2022-04-01 15:35:55 UTC (rev 292222)
@@ -575,7 +575,9 @@
     None,
     Both,
     Horizontal,
-    Vertical
+    Vertical,
+    Block,
+    Inline,
 };
 
 // The order of this enum must match the order of the list style types in CSSValueKeywords.in.

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (292221 => 292222)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2022-04-01 14:45:00 UTC (rev 292221)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2022-04-01 15:35:55 UTC (rev 292222)
@@ -225,7 +225,7 @@
     unsigned breakBefore : 4; // BreakBetween
     unsigned breakAfter : 4;
     unsigned breakInside : 3; // BreakInside
-    unsigned resize : 2; // Resize
+    unsigned resize : 3; // Resize
 
     unsigned inputSecurity : 1; // InputSecurity
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to