Diff
Modified: trunk/LayoutTests/ChangeLog (292558 => 292559)
--- trunk/LayoutTests/ChangeLog 2022-04-07 20:22:58 UTC (rev 292558)
+++ trunk/LayoutTests/ChangeLog 2022-04-07 20:26:01 UTC (rev 292559)
@@ -1,3 +1,29 @@
+2022-04-07 Tim Nguyen <[email protected]>
+
+ [CSS resize property] Correct minimum size computation to allow resizing below initial size
+ https://bugs.webkit.org/show_bug.cgi?id=135335
+
+ Reviewed by Simon Fraser.
+
+ Tests ported from the Chromium changeset: https://chromium-review.googlesource.com/c/chromium/src/+/545395/
+ They've been tweaked to:
+ - not rely on <textarea>
+ - use WPT harness instead of Chrome specific methods
+ - use async functions instead of callbacks
+
+ * fast/css/resize-above-min-size-and-below-initial-size-expected.txt: Added.
+ * fast/css/resize-above-min-size-and-below-initial-size.html: Added.
+ * fast/css/resize-below-min-intrinsic-size-large-scrollbars-expected.txt: Added.
+ * fast/css/resize-below-min-intrinsic-size-large-scrollbars.html: Added.
+ * fast/css/resize-below-min-intrinsic-size-expected.txt: Added.
+ * fast/css/resize-below-min-intrinsic-size.html: Added.
+ * fast/css/resize-below-min-size-expected.txt: Added.
+ * fast/css/resize-below-min-size-zoomed-expected.txt: Added.
+ * fast/css/resize-below-min-size-zoomed.html: Added.
+ * fast/css/resize-below-min-size.html: Added.
+ * fast/css/resize-orthogonal-containing-block-expected.txt: Added.
+ * fast/css/resize-orthogonal-containing-block.html: Added.
+
2022-04-07 Matteo Flores <[email protected]>
REGRESSION(r292419): [ iOS EWS ] imported/w3c/web-platform-tests/css/selectors/invalidation/user-action-pseudo-classes-in-has.html is a flaky text failure
Added: trunk/LayoutTests/fast/css/resize-above-min-size-and-below-initial-size-expected.txt (0 => 292559)
--- trunk/LayoutTests/fast/css/resize-above-min-size-and-below-initial-size-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/resize-above-min-size-and-below-initial-size-expected.txt 2022-04-07 20:26:01 UTC (rev 292559)
@@ -0,0 +1,3 @@
+
+PASS Test for resizing box above minimum size set and below its initial size.
+
Added: trunk/LayoutTests/fast/css/resize-above-min-size-and-below-initial-size.html (0 => 292559)
--- trunk/LayoutTests/fast/css/resize-above-min-size-and-below-initial-size.html (rev 0)
+++ trunk/LayoutTests/fast/css/resize-above-min-size-and-below-initial-size.html 2022-04-07 20:26:01 UTC (rev 292559)
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ body { margin: 0; padding: 0;}
+ #resizable {
+ background: yellow;
+ box-sizing: border-box;
+ resize: both;
+ overflow: auto;
+ }
+ </style>
+</head>
+<body>
+
+<div style="width:800px; height:800px">
+ <div id="resizable"></div>
+</div>
+
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+function drag(startX, startY, destX, destY) {
+ const actions = new test_driver.Actions()
+ .pointerMove(startX - 1, startY - 1)
+ .pointerDown()
+ .pointerMove(destX - 1, destY - 1)
+ .pointerUp();
+ return actions.send();
+}
+
+async function testDragAndMove(box) {
+ const startX = box.getBoundingClientRect().right;
+ const startY = box.getBoundingClientRect().bottom;
+ await drag(startX, startY, startX - 150, startY - 150);
+ assert_equals(box.style.width, "250px");
+ assert_equals(box.style.height, "250px");
+}
+
+promise_test(async () => {
+ const box = document.getElementById("resizable");
+ box.style.width = "400px";
+ box.style.height = "400px";
+ box.style.minWidth = "200px";
+ box.style.minHeight = "200px";
+ await testDragAndMove(box);
+ box.style.width = "400px";
+ box.style.height = "400px";
+ box.style.minWidth = "15vw";
+ box.style.minHeight = "15vh";
+ testDragAndMove(box);
+ box.style.width = "400px";
+ box.style.height = "400px";
+ box.style.minWidth = "10%";
+ box.style.minHeight = "10%";
+ testDragAndMove(box);
+}, "Test for resizing box above minimum size set and below its initial size.");
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/resize-below-min-intrinsic-size-expected.txt (0 => 292559)
--- trunk/LayoutTests/fast/css/resize-below-min-intrinsic-size-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/resize-below-min-intrinsic-size-expected.txt 2022-04-07 20:26:01 UTC (rev 292559)
@@ -0,0 +1,3 @@
+
+PASS Test for resizing the box below its min intrinsic size.
+
Added: trunk/LayoutTests/fast/css/resize-below-min-intrinsic-size-large-scrollbars-expected.txt (0 => 292559)
--- trunk/LayoutTests/fast/css/resize-below-min-intrinsic-size-large-scrollbars-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/resize-below-min-intrinsic-size-large-scrollbars-expected.txt 2022-04-07 20:26:01 UTC (rev 292559)
@@ -0,0 +1,3 @@
+
+PASS Test for resizing the box with large scrollbars below its min intrinsic size.
+
Added: trunk/LayoutTests/fast/css/resize-below-min-intrinsic-size-large-scrollbars.html (0 => 292559)
--- trunk/LayoutTests/fast/css/resize-below-min-intrinsic-size-large-scrollbars.html (rev 0)
+++ trunk/LayoutTests/fast/css/resize-below-min-intrinsic-size-large-scrollbars.html 2022-04-07 20:26:01 UTC (rev 292559)
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ body { margin: 0; padding: 0;}
+ #resizable {
+ background: yellow;
+ box-sizing: border-box;
+ resize: both;
+ overflow: auto;
+ }
+ ::-webkit-scrollbar {
+ width: 100px;
+ height: 150px;
+ }
+ ::-webkit-scrollbar-button {
+ display: none;
+ height: 0;
+ width: 0;
+ }
+ </style>
+</head>
+<body>
+<div id="resizable" style="width: 400px; height: 400px;">
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+</div>
+
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+function drag(startX, startY, destX, destY) {
+ const actions = new test_driver.Actions()
+ .pointerMove(startX - 1, startY - 1)
+ .pointerDown()
+ .pointerMove(destX - 1, destY - 1)
+ .pointerUp();
+ return actions.send();
+}
+
+promise_test(async () => {
+ const box = document.getElementById("resizable");
+ const startX = box.getBoundingClientRect().right;
+ const startY = box.getBoundingClientRect().bottom;
+ await drag(startX, startY, startX - 395, startY - 395);
+ assert_equals(box.style.width, "100px", "Should resize to scrollcorner size");
+ assert_equals(box.style.height, "100px", "Should resize to scrollcorner size");
+}, "Test for resizing the box with large scrollbars below its min intrinsic size.");
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/resize-below-min-intrinsic-size.html (0 => 292559)
--- trunk/LayoutTests/fast/css/resize-below-min-intrinsic-size.html (rev 0)
+++ trunk/LayoutTests/fast/css/resize-below-min-intrinsic-size.html 2022-04-07 20:26:01 UTC (rev 292559)
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ body { margin: 0; padding: 0;}
+ #resizable {
+ background: yellow;
+ box-sizing: border-box;
+ resize: both;
+ overflow: auto;
+ }
+ </style>
+</head>
+<body>
+<div id="resizable" style="width: 400px; height: 400px;"></div>
+
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+function drag(startX, startY, destX, destY) {
+ const actions = new test_driver.Actions()
+ .pointerMove(startX - 1, startY - 1)
+ .pointerDown()
+ .pointerMove(destX - 1, destY - 1)
+ .pointerUp();
+ return actions.send();
+}
+
+promise_test(async () => {
+ const box = document.getElementById("resizable");
+ const startX = box.getBoundingClientRect().right;
+ const startY = box.getBoundingClientRect().bottom;
+ await drag(startX, startY, startX - 395, startY - 395);
+ assert_equals(box.style.width, "15px");
+ assert_equals(box.style.height, "15px");
+}, "Test for resizing the box below its min intrinsic size.");
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/resize-below-min-size-expected.txt (0 => 292559)
--- trunk/LayoutTests/fast/css/resize-below-min-size-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/resize-below-min-size-expected.txt 2022-04-07 20:26:01 UTC (rev 292559)
@@ -0,0 +1,3 @@
+
+PASS Test for resizing the box below the minimum size set.
+
Added: trunk/LayoutTests/fast/css/resize-below-min-size-zoomed-expected.txt (0 => 292559)
--- trunk/LayoutTests/fast/css/resize-below-min-size-zoomed-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/resize-below-min-size-zoomed-expected.txt 2022-04-07 20:26:01 UTC (rev 292559)
@@ -0,0 +1,3 @@
+
+PASS Test for resizing the box below the minimum size set in zoomed environment.
+
Added: trunk/LayoutTests/fast/css/resize-below-min-size-zoomed.html (0 => 292559)
--- trunk/LayoutTests/fast/css/resize-below-min-size-zoomed.html (rev 0)
+++ trunk/LayoutTests/fast/css/resize-below-min-size-zoomed.html 2022-04-07 20:26:01 UTC (rev 292559)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ body {
+ margin: 0;
+ padding: 0;
+ zoom: 2;
+ }
+
+ #resizable {
+ background: yellow;
+ box-sizing: border-box;
+ resize: both;
+ overflow: auto;
+ width: 200px;
+ height: 200px;
+ min-width: 100px;
+ min-height: 100px;
+ }
+</style>
+</head>
+<body>
+
+<div id="resizable"></div>
+
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const zoomFactor = 2;
+
+function drag(startX, startY, destX, destY) {
+ const actions = new test_driver.Actions()
+ .pointerMove((startX - 1) * 2, (startY - 1) * 2)
+ .pointerDown()
+ .pointerMove((destX - 1) * 2, (destY - 1) * 2)
+ .pointerUp();
+ return actions.send();
+}
+
+promise_test(async () => {
+ const box = document.getElementById("resizable");
+ const startX = box.getBoundingClientRect().right;
+ const startY = box.getBoundingClientRect().bottom;
+ await drag(startX, startY, startX - 150, startY - 150);
+ assert_equals(box.style.width, "100px");
+ assert_equals(box.style.height, "100px");
+}, "Test for resizing the box below the minimum size set in zoomed environment.");
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/resize-below-min-size.html (0 => 292559)
--- trunk/LayoutTests/fast/css/resize-below-min-size.html (rev 0)
+++ trunk/LayoutTests/fast/css/resize-below-min-size.html 2022-04-07 20:26:01 UTC (rev 292559)
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ body { margin: 0; padding: 0;}
+ #resizable {
+ background: yellow;
+ box-sizing: border-box;
+ resize: both;
+ overflow: auto;
+ }
+ </style>
+</head>
+<body>
+<div style="width:800px; height:800px">
+ <div id="resizable"></div>
+</div>
+
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+function drag(startX, startY, destX, destY) {
+ const actions = new test_driver.Actions()
+ .pointerMove(startX - 1, startY - 1)
+ .pointerDown()
+ .pointerMove(destX - 1, destY - 1)
+ .pointerUp();
+ return actions.send();
+}
+
+async function testDragAndMove(box) {
+ const startX = box.getBoundingClientRect().right;
+ const startY = box.getBoundingClientRect().bottom;
+ await drag(startX, startY, startX - 350, startY - 350);
+}
+
+promise_test(async () => {
+ const box = document.getElementById("resizable");
+ box.style.width = "400px";
+ box.style.height = "400px";
+ box.style.minWidth = "200px";
+ box.style.minHeight = "200px";
+ await testDragAndMove(box);
+ assert_equals(box.style.width, "200px");
+ assert_equals(box.style.height, "200px");
+ box.style.width = "400px";
+ box.style.height = "400px";
+ box.style.minWidth = "15vw";
+ box.style.minHeight = "15vh";
+ await testDragAndMove(box);
+ assert_equals(box.style.width, (0.15 * window.innerWidth) + "px");
+ assert_equals(box.style.height, (0.15 * window.innerHeight) + "px");
+ box.style.width = "400px";
+ box.style.height = "400px";
+ box.style.minWidth = "10%";
+ box.style.minHeight = "10%";
+ await testDragAndMove(box);
+ assert_equals(box.style.width, "80px"); // 10% of container
+ assert_equals(box.style.height, "80px"); // 10% of container
+}, "Test for resizing the box below the minimum size set.");
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/resize-orthogonal-containing-block-expected.txt (0 => 292559)
--- trunk/LayoutTests/fast/css/resize-orthogonal-containing-block-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/resize-orthogonal-containing-block-expected.txt 2022-04-07 20:26:01 UTC (rev 292559)
@@ -0,0 +1,3 @@
+
+PASS Test for resizing the box below its initial size and with orthogonal containing block.
+
Added: trunk/LayoutTests/fast/css/resize-orthogonal-containing-block.html (0 => 292559)
--- trunk/LayoutTests/fast/css/resize-orthogonal-containing-block.html (rev 0)
+++ trunk/LayoutTests/fast/css/resize-orthogonal-containing-block.html 2022-04-07 20:26:01 UTC (rev 292559)
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ body { margin: 0; padding: 0;}
+ #resizable {
+ background: yellow;
+ box-sizing: border-box;
+ resize: both;
+ overflow: auto;
+ }
+ </style>
+</head>
+<body>
+
+<div style="writing-mode: vertical-lr; width:800px; height:700px">
+ <div style="writing-mode: horizontal-tb; width:400px; height:400px; min-width:10%; min-height:10%" id="resizable"></div>
+</div>
+
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+function drag(startX, startY, destX, destY) {
+ const actions = new test_driver.Actions()
+ .pointerMove(startX - 1, startY - 1)
+ .pointerDown()
+ .pointerMove(destX - 1, destY - 1)
+ .pointerUp();
+ return actions.send();
+}
+
+promise_test(async () => {
+ const box = document.getElementById("resizable");
+ const startX = box.getBoundingClientRect().right;
+ const startY = box.getBoundingClientRect().bottom;
+ await drag(startX, startY, startX - 395, startY - 395);
+ // The containing block is orthogonal to the textarea so min-width will
+ // be 10% of height of containing block and min-height is 10% of width of
+ // containing block.
+ assert_equals(box.style.width, "80px");
+ assert_equals(box.style.height, "70px");
+}, "Test for resizing the box below its initial size and with orthogonal containing block.");
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (292558 => 292559)
--- trunk/Source/WebCore/ChangeLog 2022-04-07 20:22:58 UTC (rev 292558)
+++ trunk/Source/WebCore/ChangeLog 2022-04-07 20:26:01 UTC (rev 292559)
@@ -1,3 +1,43 @@
+2022-04-07 Tim Nguyen <[email protected]>
+
+ [CSS resize property] Correct minimum size computation to allow resizing below initial size
+ https://bugs.webkit.org/show_bug.cgi?id=135335
+
+ Reviewed by Simon Fraser.
+
+ Tests:
+ - LayoutTests/fast/css/resize-above-min-size-and-below-initial-size.html
+ - LayoutTests/fast/css/resize-below-min-intrinsic-size.html
+ - LayoutTests/fast/css/resize-below-min-intrinsic-size-large-scrollbars.html
+ - LayoutTests/fast/css/resize-below-min-size-zoomed.html
+ - LayoutTests/fast/css/resize-below-min-size.html
+ - LayoutTests/fast/css/resize-orthogonal-containing-block.html
+
+ Ports the relevant Chromium changeset with a few tweaks: https://chromium-review.googlesource.com/c/chromium/src/+/545395/
+
+ The previous minimum size used to be whatever size was there before the first resize, which is wrong, and does not allow
+ resizing below the initial size. It is now based on the min-width/height properties and the scroll corner size.
+
+ It is no longer stored in ElementRareData since it is no longer fixed to the initial element size, but depends on the container
+ on the element style.
+
+ * dom/Element.cpp:
+ (WebCore::Element::minimumSizeForResizing const): Deleted.
+ (WebCore::Element::setMinimumSizeForResizing): Deleted.
+ * dom/Element.h:
+ * dom/ElementRareData.cpp:
+ * dom/ElementRareData.h:
+ (WebCore::ElementRareData::useTypes const):
+ (WebCore::ElementRareData::ElementRareData):
+ (WebCore::defaultMinimumSizeForResizing): Deleted.
+ (WebCore::ElementRareData::minimumSizeForResizing const): Deleted.
+ (WebCore::ElementRareData::setMinimumSizeForResizing): Deleted.
+ * dom/NodeRareData.h:
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::minimumSizeForResizing const):
+ (WebCore::RenderLayer::resize):
+ * rendering/RenderLayer.h:
+
2022-04-07 Simon Fraser <[email protected]>
Have ImageBuffer store the RenderingPurpose, and send it to the GPU process
Modified: trunk/Source/WebCore/dom/Element.cpp (292558 => 292559)
--- trunk/Source/WebCore/dom/Element.cpp 2022-04-07 20:22:58 UTC (rev 292558)
+++ trunk/Source/WebCore/dom/Element.cpp 2022-04-07 20:26:01 UTC (rev 292559)
@@ -3375,18 +3375,6 @@
setAttributeWithoutSynchronization(pseudoAttr, value);
}
-LayoutSize Element::minimumSizeForResizing() const
-{
- return hasRareData() ? elementRareData()->minimumSizeForResizing() : defaultMinimumSizeForResizing();
-}
-
-void Element::setMinimumSizeForResizing(const LayoutSize& size)
-{
- if (!hasRareData() && size == defaultMinimumSizeForResizing())
- return;
- ensureElementRareData().setMinimumSizeForResizing(size);
-}
-
void Element::willBecomeFullscreenElement()
{
for (auto& child : descendantsOfType<Element>(*this))
Modified: trunk/Source/WebCore/dom/Element.h (292558 => 292559)
--- trunk/Source/WebCore/dom/Element.h 2022-04-07 20:22:58 UTC (rev 292558)
+++ trunk/Source/WebCore/dom/Element.h 2022-04-07 20:26:01 UTC (rev 292559)
@@ -447,9 +447,6 @@
const AtomString& pseudo() const;
WEBCORE_EXPORT void setPseudo(const AtomString&);
- LayoutSize minimumSizeForResizing() const;
- void setMinimumSizeForResizing(const LayoutSize&);
-
// Use Document::registerForDocumentActivationCallbacks() to subscribe to these
virtual void prepareForDocumentSuspension() { }
virtual void resumeFromDocumentSuspension() { }
Modified: trunk/Source/WebCore/dom/ElementRareData.cpp (292558 => 292559)
--- trunk/Source/WebCore/dom/ElementRareData.cpp 2022-04-07 20:22:58 UTC (rev 292558)
+++ trunk/Source/WebCore/dom/ElementRareData.cpp 2022-04-07 20:26:01 UTC (rev 292559)
@@ -34,7 +34,6 @@
namespace WebCore {
struct SameSizeAsElementRareData : NodeRareData {
- LayoutSize sizeForResizing;
IntPoint savedLayerScrollPosition;
Vector<std::unique_ptr<ElementAnimationRareData>> animationRareData;
void* pointers[11];
Modified: trunk/Source/WebCore/dom/ElementRareData.h (292558 => 292559)
--- trunk/Source/WebCore/dom/ElementRareData.h 2022-04-07 20:22:58 UTC (rev 292558)
+++ trunk/Source/WebCore/dom/ElementRareData.h 2022-04-07 20:26:01 UTC (rev 292559)
@@ -39,11 +39,6 @@
namespace WebCore {
-inline IntSize defaultMinimumSizeForResizing()
-{
- return IntSize(LayoutUnit::max(), LayoutUnit::max());
-}
-
class ElementRareData : public NodeRareData {
public:
explicit ElementRareData();
@@ -83,9 +78,6 @@
DatasetDOMStringMap* dataset() const { return m_dataset.get(); }
void setDataset(std::unique_ptr<DatasetDOMStringMap> dataset) { m_dataset = WTFMove(dataset); }
- LayoutSize minimumSizeForResizing() const { return m_minimumSizeForResizing; }
- void setMinimumSizeForResizing(LayoutSize size) { m_minimumSizeForResizing = size; }
-
IntPoint savedLayerScrollPosition() const { return m_savedLayerScrollPosition; }
void setSavedLayerScrollPosition(IntPoint position) { m_savedLayerScrollPosition = position; }
@@ -121,8 +113,6 @@
auto result = NodeRareData::useTypes();
if (m_unusualTabIndex)
result.add(UseType::TabIndex);
- if (m_minimumSizeForResizing != defaultMinimumSizeForResizing())
- result.add(UseType::MinimumSize);
if (!m_savedLayerScrollPosition.isZero())
result.add(UseType::ScrollingPosition);
if (m_computedStyle)
@@ -162,7 +152,6 @@
#endif
private:
- LayoutSize m_minimumSizeForResizing;
IntPoint m_savedLayerScrollPosition;
std::unique_ptr<RenderStyle> m_computedStyle;
@@ -196,7 +185,6 @@
inline ElementRareData::ElementRareData()
: NodeRareData(Type::Element)
- , m_minimumSizeForResizing(defaultMinimumSizeForResizing())
{
}
Modified: trunk/Source/WebCore/dom/NodeRareData.h (292558 => 292559)
--- trunk/Source/WebCore/dom/NodeRareData.h 2022-04-07 20:22:58 UTC (rev 292558)
+++ trunk/Source/WebCore/dom/NodeRareData.h 2022-04-07 20:26:01 UTC (rev 292559)
@@ -248,23 +248,22 @@
NodeList = 1 << 0,
MutationObserver = 1 << 1,
TabIndex = 1 << 2,
- MinimumSize = 1 << 3,
- ScrollingPosition = 1 << 4,
- ComputedStyle = 1 << 5,
- Dataset = 1 << 6,
- ClassList = 1 << 7,
- ShadowRoot = 1 << 8,
- CustomElementQueue = 1 << 9,
- AttributeMap = 1 << 10,
- InteractionObserver = 1 << 11,
- ResizeObserver = 1 << 12,
- Animations = 1 << 13,
- PseudoElements = 1 << 14,
- StyleMap = 1 << 15,
- PartList = 1 << 16,
- PartNames = 1 << 17,
- Nonce = 1 << 18,
- ComputedStyleMap = 1 << 19,
+ ScrollingPosition = 1 << 3,
+ ComputedStyle = 1 << 4,
+ Dataset = 1 << 5,
+ ClassList = 1 << 6,
+ ShadowRoot = 1 << 7,
+ CustomElementQueue = 1 << 8,
+ AttributeMap = 1 << 9,
+ InteractionObserver = 1 << 10,
+ ResizeObserver = 1 << 11,
+ Animations = 1 << 12,
+ PseudoElements = 1 << 13,
+ StyleMap = 1 << 14,
+ PartList = 1 << 15,
+ PartNames = 1 << 16,
+ Nonce = 1 << 17,
+ ComputedStyleMap = 1 << 18,
};
#endif
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (292558 => 292559)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2022-04-07 20:22:58 UTC (rev 292558)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2022-04-07 20:26:01 UTC (rev 292559)
@@ -2744,6 +2744,17 @@
return (renderer().hasNonVisibleOverflow() || renderer().isRenderIFrame()) && renderer().style().resize() != Resize::None;
}
+LayoutSize RenderLayer::minimumSizeForResizing(float zoomFactor) const
+{
+ // Use the resizer size as the strict minimum size
+ auto resizerRect = overflowControlsRects().resizer;
+ LayoutUnit minWidth = minimumValueForLength(renderer().style().minWidth(), renderer().containingBlock()->width());
+ LayoutUnit minHeight = minimumValueForLength(renderer().style().minHeight(), renderer().containingBlock()->height());
+ minWidth = std::max(LayoutUnit(minWidth / zoomFactor), LayoutUnit(resizerRect.width()));
+ minHeight = std::max(LayoutUnit(minHeight / zoomFactor), LayoutUnit(resizerRect.height()));
+ return LayoutSize(minWidth, minHeight);
+}
+
void RenderLayer::resize(const PlatformMouseEvent& evt, const LayoutSize& oldOffset)
{
// FIXME: This should be possible on generated content but is not right now.
@@ -2767,19 +2778,17 @@
LayoutSize newOffset = offsetFromResizeCorner(localPoint);
newOffset.setWidth(newOffset.width() / zoomFactor);
newOffset.setHeight(newOffset.height() / zoomFactor);
-
+
LayoutSize currentSize = LayoutSize(renderer->width() / zoomFactor, renderer->height() / zoomFactor);
- LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentSize);
- element->setMinimumSizeForResizing(minimumSize);
-
+
LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, oldOffset.height() / zoomFactor);
if (renderer->shouldPlaceVerticalScrollbarOnLeft()) {
newOffset.setWidth(-newOffset.width());
adjustedOldOffset.setWidth(-adjustedOldOffset.width());
}
-
- LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSize) - currentSize;
+ LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSizeForResizing(zoomFactor)) - currentSize;
+
StyledElement* styledElement = downcast<StyledElement>(element);
bool isBoxSizingBorder = renderer->style().boxSizing() == BoxSizing::BorderBox;
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (292558 => 292559)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2022-04-07 20:22:58 UTC (rev 292558)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2022-04-07 20:26:01 UTC (rev 292559)
@@ -478,6 +478,7 @@
void autoscroll(const IntPoint&);
bool canResize() const;
+ LayoutSize minimumSizeForResizing(float zoomFactor) const;
void resize(const PlatformMouseEvent&, const LayoutSize&);
bool inResizeMode() const { return m_inResizeMode; }
void setInResizeMode(bool b) { m_inResizeMode = b; }