[webkit-changes] [295767] trunk/Source/WebCore/rendering

2022-06-22 Thread zalan
Title: [295767] trunk/Source/WebCore/rendering








Revision 295767
Author za...@apple.com
Date 2022-06-22 20:22:03 -0700 (Wed, 22 Jun 2022)


Log Message
RenderElement::addLayers should check for dialog content before inserting layers
https://bugs.webkit.org/show_bug.cgi?id=241874

Reviewed by Simon Fraser.

addLayers stops (recursive) descending in the render tree soon after it finds a root (R) with layer.
It says that if a subtree root (R) has a layer then all layers in this subtree must have already been inserted into the layer tree at an earlier time.
(it simply assumes that any layer in the subtree is a child of (R), or some other layers in the subtree)


  


The insertion is bottom to top; we attach
1, (child) to (R) first
2, followed by (R) to (container)
addLayers assumes that when (R) is being inserted (#2), we don't have to descend into (R)'s subtree since any renderer's layer that was inserted before (at #1) must have already been parented.

However toplayer/backdrop content is an exception where the parent layer may be outside of the subtree but still accessible. In such cases subsequent insertions (and the recursive nature of finding layer parents) could lead to double parenting where we try to insert the same layer into the layer tree multiple times.

* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::addLayers):
(WebCore::RenderElement::insertedIntoTree):
(WebCore::RenderElement::addLayers): Deleted.
* Source/WebCore/rendering/RenderElement.h:

Canonical link: https://commits.webkit.org/251772@main

Modified Paths

trunk/Source/WebCore/rendering/RenderElement.cpp
trunk/Source/WebCore/rendering/RenderElement.h




Diff

Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (295766 => 295767)

--- trunk/Source/WebCore/rendering/RenderElement.cpp	2022-06-23 02:56:36 UTC (rev 295766)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp	2022-06-23 03:22:03 UTC (rev 295767)
@@ -636,28 +636,28 @@
 return findNextLayer(*renderer.parent(), parentLayer, );
 }
 
-static void addLayers(const RenderElement& addedRenderer, RenderElement& currentRenderer, RenderLayer* parentLayer)
+static void addLayers(const RenderElement& insertedRenderer, RenderElement& currentRenderer, RenderLayer& parentLayer)
 {
 if (currentRenderer.hasLayer()) {
-if (isInTopLayerOrBackdrop(currentRenderer.style(), currentRenderer.element()))
-parentLayer = addedRenderer.view().layer();
-RenderLayer* beforeChild = layerNextSiblingRespectingTopLayer(addedRenderer, *parentLayer);
-parentLayer->addChild(*downcast(currentRenderer).layer(), beforeChild);
+auto* layerToUse = 
+if (isInTopLayerOrBackdrop(currentRenderer.style(), currentRenderer.element())) {
+// The special handling of a toplayer/backdrop content may result in trying to insert the associated
+// layer twice as we connect subtrees.
+if (auto* parentLayer = downcast(currentRenderer).layer()->parent()) {
+ASSERT(parentLayer == currentRenderer.view().layer());
+return;
+}
+layerToUse = insertedRenderer.view().layer();
+}
+auto* beforeChild = layerNextSiblingRespectingTopLayer(insertedRenderer, *layerToUse);
+layerToUse->addChild(*downcast(currentRenderer).layer(), beforeChild);
 return;
 }
 
 for (auto& child : childrenOfType(currentRenderer))
-addLayers(addedRenderer, child, parentLayer);
+addLayers(insertedRenderer, child, parentLayer);
 }
 
-void RenderElement::addLayers(RenderLayer* parentLayer)
-{
-if (!parentLayer)
-return;
-
-WebCore::addLayers(*this, *this, parentLayer);
-}
-
 void RenderElement::removeLayers()
 {
 RenderLayer* parentLayer = layerParent();
@@ -937,8 +937,8 @@
 // and don't have a layer attached to ourselves.
 RenderLayer* parentLayer = nullptr;
 if (firstChild() || hasLayer()) {
-auto* parentLayer = layerParent();
-addLayers(parentLayer);
+if (auto* parentLayer = layerParent())
+addLayers(*this, *this, *parentLayer);
 }
 
 // If |this| is visible but this object was not, tell the layer it has some visible content


Modified: trunk/Source/WebCore/rendering/RenderElement.h (295766 => 295767)

--- trunk/Source/WebCore/rendering/RenderElement.h	2022-06-23 02:56:36 UTC (rev 295766)
+++ trunk/Source/WebCore/rendering/RenderElement.h	2022-06-23 03:22:03 UTC (rev 295767)
@@ -119,7 +119,6 @@
 // can contain a mixture of boxes and other object types, these functions need to be in the base class.
 RenderLayer* layerParent() const;
 RenderLayer* layerNextSibling(RenderLayer& parentLayer) const;
-void addLayers(RenderLayer* parentLayer);
 void removeLayers();
 void moveLayers(RenderLayer& newParent);
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org

[webkit-changes] [295765] trunk

2022-06-22 Thread zalan
Title: [295765] trunk








Revision 295765
Author za...@apple.com
Date 2022-06-22 19:54:49 -0700 (Wed, 22 Jun 2022)


Log Message
Adding padding on a horizontal scroller prevents last item from being fully viewable
https://bugs.webkit.org/show_bug.cgi?id=236142


Reviewed by Simon Fraser.

Flex box's padding end should be taken into account when computing scrollable overflow.

* LayoutTests/fast/overflow/flex-box-overflow-with-padding-end-expected.html: Added.
* LayoutTests/fast/overflow/flex-box-overflow-with-padding-end.html: Added.
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeOverflow):

css3/flexbox/overflow-and-padding.html: matching Blink.

Canonical link: https://commits.webkit.org/251770@main

Modified Paths

trunk/LayoutTests/css3/flexbox/overflow-and-padding-expected.txt
trunk/Source/WebCore/rendering/RenderBlock.cpp


Added Paths

trunk/LayoutTests/fast/overflow/flex-box-overflow-with-padding-end-expected.html
trunk/LayoutTests/fast/overflow/flex-box-overflow-with-padding-end.html




Diff

Modified: trunk/LayoutTests/css3/flexbox/overflow-and-padding-expected.txt (295764 => 295765)

--- trunk/LayoutTests/css3/flexbox/overflow-and-padding-expected.txt	2022-06-23 01:48:47 UTC (rev 295764)
+++ trunk/LayoutTests/css3/flexbox/overflow-and-padding-expected.txt	2022-06-23 02:54:49 UTC (rev 295765)
@@ -1,4 +1,8 @@
 
-PASS #scrollable 1
+FAIL #scrollable 1 assert_equals:
+
+
+
+scrollWidth expected 400 but got 500
 Tests that padding bottom on a flexbox works in the face of overflowing content. Padding-right does not work. This matches the Blink/WebKit display:block behavior. Unfortunately, IE and Gecko both lose the padding bottom and the padding right.
 


Added: trunk/LayoutTests/fast/overflow/flex-box-overflow-with-padding-end-expected.html (0 => 295765)

--- trunk/LayoutTests/fast/overflow/flex-box-overflow-with-padding-end-expected.html	(rev 0)
+++ trunk/LayoutTests/fast/overflow/flex-box-overflow-with-padding-end-expected.html	2022-06-23 02:54:49 UTC (rev 295765)
@@ -0,0 +1,9 @@
+
+div {
+  width: 300px;
+  height: 100px;
+  font-size: 20px;
+  font-family: Ahem;
+}
+
+PASS


Added: trunk/LayoutTests/fast/overflow/flex-box-overflow-with-padding-end.html (0 => 295765)

--- trunk/LayoutTests/fast/overflow/flex-box-overflow-with-padding-end.html	(rev 0)
+++ trunk/LayoutTests/fast/overflow/flex-box-overflow-with-padding-end.html	2022-06-23 02:54:49 UTC (rev 295765)
@@ -0,0 +1,36 @@
+
+.container {
+  width: 300px;
+  overflow: hidden;
+  font-size: 20px;
+  font-family: Ahem;
+}
+
+#flexBox {
+  display: flex;
+  overflow: scroll;
+  margin-inline-end: -300px;
+  padding-inline-end: 300px;
+}
+
+.item {
+  flex-shrink: 0;
+  width: 300px;
+  height: 100px;
+}
+
+.hide_scrollbar {
+  position: absolute;
+  background-color: white;
+  width: 500px;
+  height: 50px;
+  left: 0px;
+  top: 100px;
+}
+
+
+PASS
+
+
+flexBox.scrollTo(300, 0);
+


Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (295764 => 295765)

--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2022-06-23 01:48:47 UTC (rev 295764)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2022-06-23 02:54:49 UTC (rev 295765)
@@ -695,8 +695,8 @@
 // As per https://github.com/w3c/csswg-drafts/issues/3653 padding should contribute to the scrollable overflow area.
 if (!paddingEnd())
 return;
-// FIXME: Expand it to non-grid cases when applicable.
-if (!is(*this))
+// FIXME: Expand it to non-grid/flex cases when applicable.
+if (!is(*this) && !is(*this))
 return;
 
 auto layoutOverflowRect = this->layoutOverflowRect();






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295715] trunk

2022-06-21 Thread zalan
Title: [295715] trunk








Revision 295715
Author za...@apple.com
Date 2022-06-21 19:41:14 -0700 (Tue, 21 Jun 2022)


Log Message
RenderBox::hasHorizontalLayoutOverflow/hasVerticalLayoutOverflow use incorrect coordinate space
https://bugs.webkit.org/show_bug.cgi?id=241796

Reviewed by Simon Fraser.

RenderBox::x() and y() are in the coordinate space of the containing block while layoutOverflowRect is relative to the box's border box. These functions would compute overflow true if the box happens to have some offset (through margin or positioning) even without actual overflow.

* LayoutTests/fast/overflow/horizontal-overflow-with-offset-expected.txt: Added.
* LayoutTests/fast/overflow/horizontal-overflow-with-offset.html: Added.
* LayoutTests/fast/overflow/vertical-overflow-with-offset-expected.txt: Added.
* LayoutTests/fast/overflow/vertical-overflow-with-offset.html: Added.
* Source/WebCore/rendering/RenderBox.h:
(WebCore::RenderBox::hasHorizontalLayoutOverflow const):
(WebCore::RenderBox::hasVerticalLayoutOverflow const):

Canonical link: https://commits.webkit.org/251720@main

Modified Paths

trunk/Source/WebCore/rendering/RenderBox.h


Added Paths

trunk/LayoutTests/fast/overflow/horizontal-overflow-with-offset-expected.txt
trunk/LayoutTests/fast/overflow/horizontal-overflow-with-offset.html
trunk/LayoutTests/fast/overflow/vertical-overflow-with-offset-expected.txt
trunk/LayoutTests/fast/overflow/vertical-overflow-with-offset.html




Diff

Added: trunk/LayoutTests/fast/overflow/horizontal-overflow-with-offset-expected.txt (0 => 295715)

--- trunk/LayoutTests/fast/overflow/horizontal-overflow-with-offset-expected.txt	(rev 0)
+++ trunk/LayoutTests/fast/overflow/horizontal-overflow-with-offset-expected.txt	2022-06-22 02:41:14 UTC (rev 295715)
@@ -0,0 +1 @@
+PASS


Added: trunk/LayoutTests/fast/overflow/horizontal-overflow-with-offset.html (0 => 295715)

--- trunk/LayoutTests/fast/overflow/horizontal-overflow-with-offset.html	(rev 0)
+++ trunk/LayoutTests/fast/overflow/horizontal-overflow-with-offset.html	2022-06-22 02:41:14 UTC (rev 295715)
@@ -0,0 +1,38 @@
+
+#container {
+  position: absolute;
+  top: 100px;
+  left: 100px;
+
+  width: 100px;
+  height: 100px;
+  overflow: hidden;
+
+  background-color: green;
+}
+
+#child {
+  width: 10px;
+  height: 10px;
+  background-color: blue;
+}
+
+
+
+
+if (window.testRunner) {
+  testRunner.dumpAsText();
+  testRunner.waitUntilDone();
+}
+
+function overflowChanged(event) {
+  result.innerText = !event.horizontalOverflow ? "PASS" : "FAIL";
+  if (window.testRunner)
+testRunner.notifyDone();
+}
+container.addEventListener('overflowchanged', overflowChanged, false);
+
+document.body.offsetHeight;
+// This should not trigger horizontal overflow change.
+child.style.height = "120px";
+
\ No newline at end of file


Added: trunk/LayoutTests/fast/overflow/vertical-overflow-with-offset-expected.txt (0 => 295715)

--- trunk/LayoutTests/fast/overflow/vertical-overflow-with-offset-expected.txt	(rev 0)
+++ trunk/LayoutTests/fast/overflow/vertical-overflow-with-offset-expected.txt	2022-06-22 02:41:14 UTC (rev 295715)
@@ -0,0 +1 @@
+PASS


Added: trunk/LayoutTests/fast/overflow/vertical-overflow-with-offset.html (0 => 295715)

--- trunk/LayoutTests/fast/overflow/vertical-overflow-with-offset.html	(rev 0)
+++ trunk/LayoutTests/fast/overflow/vertical-overflow-with-offset.html	2022-06-22 02:41:14 UTC (rev 295715)
@@ -0,0 +1,38 @@
+
+#container {
+  position: absolute;
+  top: 100px;
+  left: 100px;
+
+  width: 100px;
+  height: 100px;
+  overflow: hidden;
+
+  background-color: green;
+}
+
+#child {
+  width: 10px;
+  height: 10px;
+  background-color: blue;
+}
+
+
+
+
+if (window.testRunner) {
+  testRunner.dumpAsText();
+  testRunner.waitUntilDone();
+}
+
+function overflowChanged(event) {
+  result.innerText = !event.verticalOverflow ? "PASS" : "FAIL";
+  if (window.testRunner)
+testRunner.notifyDone();
+}
+container.addEventListener('overflowchanged', overflowChanged, false);
+
+document.body.offsetHeight;
+// This should not trigger vertical overflow change.
+child.style.width = "120px";
+
\ No newline at end of file


Modified: trunk/Source/WebCore/rendering/RenderBox.h (295714 => 295715)

--- trunk/Source/WebCore/rendering/RenderBox.h	2022-06-22 02:38:43 UTC (rev 295714)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2022-06-22 02:41:14 UTC (rev 295715)
@@ -625,9 +625,9 @@
 if (!m_overflow)
 return false;
 
-LayoutRect layoutOverflowRect = m_overflow->layoutOverflowRect();
-flipForWritingMode(layoutOverflowRect);
-return layoutOverflowRect.x() < x() || layoutOverflowRect.maxX() > x() + logicalWidth();
+auto layoutOverflowRect = m_overflow->layoutOverflowRect();
+auto paddingBoxRect = flippedClientBoxRect();
+return layoutOverflowRect.x() < paddingBoxRect.x() || layoutOverflowRect.maxX() > 

[webkit-changes] [295665] trunk

2022-06-19 Thread zalan
Title: [295665] trunk








Revision 295665
Author za...@apple.com
Date 2022-06-19 20:57:23 -0700 (Sun, 19 Jun 2022)


Log Message
REGRESSION (r294902): Content with continuation leaves decoration bits behind when removed
https://bugs.webkit.org/show_bug.cgi?id=241734


Reviewed by Simon Fraser.

This patch ensures that when a renderer is removed we always issue a repaint regardless of what the associated layer's repaint bit says.

1. after r294902, repaint is not issued anymore if either the associated or an ancestor layer have the "full repaint" bit set.
2. such layer-driven repaints happen after layout.

In some dynamic content cases, the layer may be removed before layout happens. This patch ensures that we preemptively issue such repaints.

* LayoutTests/fast/repaint/force-repaint-when-layer-is-destroyed-expected.txt: Added.
* LayoutTests/fast/repaint/force-repaint-when-layer-is-destroyed.html: Added.

* Source/WebCore/rendering/RenderLayerModelObject.cpp: Force (full) repaint when the renderer is being destroyed (detached -> non-internal move).
(WebCore::RenderLayerModelObject::willBeRemovedFromTree):
* Source/WebCore/rendering/RenderLayerModelObject.h:
* Source/WebCore/rendering/RenderObject.cpp: move duplicated code from repaint() and repaintRectangle() to issueRepaint().

Canonical link: https://commits.webkit.org/251670@main

Modified Paths

trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp
trunk/Source/WebCore/rendering/RenderLayerModelObject.h
trunk/Source/WebCore/rendering/RenderObject.cpp
trunk/Source/WebCore/rendering/RenderObject.h


Added Paths

trunk/LayoutTests/fast/repaint/force-repaint-when-layer-is-destroyed-expected.txt
trunk/LayoutTests/fast/repaint/force-repaint-when-layer-is-destroyed.html




Diff

Added: trunk/LayoutTests/fast/repaint/force-repaint-when-layer-is-destroyed-expected.txt (0 => 295665)

--- trunk/LayoutTests/fast/repaint/force-repaint-when-layer-is-destroyed-expected.txt	(rev 0)
+++ trunk/LayoutTests/fast/repaint/force-repaint-when-layer-is-destroyed-expected.txt	2022-06-20 03:57:23 UTC (rev 295665)
@@ -0,0 +1 @@
+PASS


Added: trunk/LayoutTests/fast/repaint/force-repaint-when-layer-is-destroyed.html (0 => 295665)

--- trunk/LayoutTests/fast/repaint/force-repaint-when-layer-is-destroyed.html	(rev 0)
+++ trunk/LayoutTests/fast/repaint/force-repaint-when-layer-is-destroyed.html	2022-06-20 03:57:23 UTC (rev 295665)
@@ -0,0 +1,36 @@
+
+.content {
+  transform: translateX(0px);
+  border: 10px solid red;
+  width: 120px;
+}
+
+.continuation {
+  width: 100px;
+  height: 100px;
+  background-color: green;
+  border: solid blue;
+}
+
+
+
+if (window.testRunner) {
+  testRunner.dumpAsText();
+  testRunner.waitUntilDone();
+}
+
+setTimeout(function() {
+  if (window.internals)
+internals.startTrackingRepaints();
+
+  hide_this.style.display = "none";
+
+  if (window.internals) {
+result.innerText = internals.repaintRectsAsText().indexOf("8 8 140 126") != -1 ? "PASS" : "FAIL";
+internals.stopTrackingRepaints();
+  }
+
+  if (window.testRunner)
+testRunner.notifyDone();
+}, 10);
+
\ No newline at end of file


Modified: trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp (295664 => 295665)

--- trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp	2022-06-20 03:28:45 UTC (rev 295664)
+++ trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp	2022-06-20 03:57:23 UTC (rev 295665)
@@ -77,6 +77,14 @@
 RenderElement::willBeDestroyed();
 }
 
+void RenderLayerModelObject::willBeRemovedFromTree(IsInternalMove isInternalMove)
+{
+if (auto* layer = this->layer(); layer && layer->needsFullRepaint() && isInternalMove == IsInternalMove::No)
+issueRepaint(std::nullopt, ClipRepaintToLayer::No, ForceRepaint::Yes);
+
+RenderElement::willBeRemovedFromTree(isInternalMove);
+}
+
 void RenderLayerModelObject::destroyLayer()
 {
 ASSERT(!hasLayer());


Modified: trunk/Source/WebCore/rendering/RenderLayerModelObject.h (295664 => 295665)

--- trunk/Source/WebCore/rendering/RenderLayerModelObject.h	2022-06-20 03:28:45 UTC (rev 295664)
+++ trunk/Source/WebCore/rendering/RenderLayerModelObject.h	2022-06-20 03:57:23 UTC (rev 295665)
@@ -95,6 +95,7 @@
 
 void createLayer();
 void willBeDestroyed() override;
+void willBeRemovedFromTree(IsInternalMove) override;
 
 private:
 std::unique_ptr m_layer;


Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (295664 => 295665)

--- trunk/Source/WebCore/rendering/RenderObject.cpp	2022-06-20 03:28:45 UTC (rev 295664)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2022-06-20 03:57:23 UTC (rev 295665)
@@ -977,45 +977,37 @@
 return false;
 }
 
-void RenderObject::repaint() const
+void RenderObject::issueRepaint(std::optional partialRepaintRect, ClipRepaintToLayer clipRepaintToLayer, ForceRepaint forceRepaint) const
 {
-// Don't repaint if we're unrooted (note that view() still returns the view when unrooted)
-if 

[webkit-changes] [295633] trunk

2022-06-17 Thread zalan
Title: [295633] trunk








Revision 295633
Author za...@apple.com
Date 2022-06-17 06:35:02 -0700 (Fri, 17 Jun 2022)


Log Message
Remove redundant logical right computation for grid items in RenderBlock::computeOverflow
https://bugs.webkit.org/show_bug.cgi?id=241689

Reviewed by Simon Fraser.

If the grid content produces layout overflow, we should not need to re-compute it again by looping through the grid items.

1. Decouple "include padding end" and "include child's margin end" logic
2. Decouple "include padding after" and "include padding end" logic.
3. Restore RenderFlexibleBox and RenderGrid computeOverflow calls to pre-r282463 (when clientLogicalRightAndBottomAfterRepositioning was introduced)

* LayoutTests/fast/overflow/grid-horizontal-overflow-with-padding-end-expected.html: Added.
* LayoutTests/fast/overflow/grid-horizontal-overflow-with-padding-end.html: Added.
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeOverflow):
(WebCore::RenderBlock::layoutOverflowLogicalBottom):
(WebCore::RenderBlock::clientLogicalRightAndBottomAfterRepositioning const): Deleted.
* Source/WebCore/rendering/RenderBlock.h:
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::layoutOverflowRectForPropagation const):
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutBlock):
* Source/WebCore/rendering/RenderGrid.cpp:
(WebCore::RenderGrid::layoutBlock):

Canonical link: https://commits.webkit.org/251638@main

Modified Paths

trunk/Source/WebCore/rendering/RenderBlock.cpp
trunk/Source/WebCore/rendering/RenderBlock.h
trunk/Source/WebCore/rendering/RenderBox.cpp
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
trunk/Source/WebCore/rendering/RenderGrid.cpp


Added Paths

trunk/LayoutTests/fast/overflow/grid-horizontal-overflow-with-padding-end-expected.html
trunk/LayoutTests/fast/overflow/grid-horizontal-overflow-with-padding-end.html




Diff

Added: trunk/LayoutTests/fast/overflow/grid-horizontal-overflow-with-padding-end-expected.html (0 => 295633)

--- trunk/LayoutTests/fast/overflow/grid-horizontal-overflow-with-padding-end-expected.html	(rev 0)
+++ trunk/LayoutTests/fast/overflow/grid-horizontal-overflow-with-padding-end-expected.html	2022-06-17 13:35:02 UTC (rev 295633)
@@ -0,0 +1,30 @@
+
+.container {
+  box-sizing: border-box;
+  width: 320px;
+  height: 188px;
+  overflow-x: scroll;
+  border: 50px solid blue;
+  background-color: cyan;
+}
+
+.container > div {
+  margin-left: 10px;
+  width: 20px;
+  height: 20px;
+  background-color: green;
+}
+
+#overflow {
+  background-color: transparent;
+  width: 211px;
+  height: 10px;
+}
+
+
+
+
+let scrollers = document.body.getElementsByClassName("container");
+for (let scroller of scrollers)
+  scroller.scrollTo(100, 0);
+


Added: trunk/LayoutTests/fast/overflow/grid-horizontal-overflow-with-padding-end.html (0 => 295633)

--- trunk/LayoutTests/fast/overflow/grid-horizontal-overflow-with-padding-end.html	(rev 0)
+++ trunk/LayoutTests/fast/overflow/grid-horizontal-overflow-with-padding-end.html	2022-06-17 13:35:02 UTC (rev 295633)
@@ -0,0 +1,26 @@
+
+.container {
+  box-sizing: border-box;
+  width: 320px;
+  height: 188px;
+  overflow-x: scroll;
+  padding-left: 10px;
+  padding-right: 190px;
+  border: 50px solid blue;
+  background-color: cyan;
+  display: grid;
+}
+
+.container > div {
+  width: 20px;
+  height: 20px;
+  background-color: green;
+}
+
+
+
+
+let scrollers = document.body.getElementsByClassName("container");
+for (let scroller of scrollers)
+  scroller.scrollTo(100, 0);
+


Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (295632 => 295633)

--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2022-06-17 11:57:06 UTC (rev 295632)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2022-06-17 13:35:02 UTC (rev 295633)
@@ -681,23 +681,6 @@
 }
 }
 
-LayoutSize RenderBlock::clientLogicalRightAndBottomAfterRepositioning() const
-{
-LayoutUnit maxChildLogicalRight;
-LayoutUnit maxChildLogicalBottom;
-for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
-if (child->isOutOfFlowPositioned())
-continue;
-LayoutUnit childLogicalRight = logicalLeftForChild(*child) + logicalWidthForChild(*child) + marginEndForChild(*child);
-LayoutUnit childLogicalBottom = logicalTopForChild(*child) + logicalHeightForChild(*child) + marginAfterForChild(*child);
-maxChildLogicalRight = std::max(maxChildLogicalRight, childLogicalRight);
-maxChildLogicalBottom = std::max(maxChildLogicalBottom, childLogicalBottom);
-
-}
-return LayoutSize(maxChildLogicalRight + paddingRight(), std::max(clientLogicalBottom(), maxChildLogicalBottom + paddingAfter()));
-}
-
-
 // Overflow is always relative to the border-box of the element in question.
 // Therefore, if the element has a vertical scrollbar placed on the left, an overflow rect at x=2px would 

[webkit-changes] [295556] trunk

2022-06-15 Thread zalan
Title: [295556] trunk








Revision 295556
Author za...@apple.com
Date 2022-06-15 06:43:53 -0700 (Wed, 15 Jun 2022)


Log Message
REGRESSION (r289443): Page contents disappear after entering a letter in the username field of bmoharris.com
https://bugs.webkit.org/show_bug.cgi?id=241625


Reviewed by Simon Fraser.

overflow: clip forbids scrolling entirely, through any mechanism (https://drafts.csswg.org/css-overflow/#propdef-overflow)

* LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip-expected.html: Added.
* LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip.html: Added.
* LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip-expected.html: Added.
* LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip.html: Added.
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::allowsCurrentScroll const): Make sure the content is not scrollable when overflow: clip is set on the renderer.

Canonical link: https://commits.webkit.org/251561@main

Modified Paths

trunk/Source/WebCore/rendering/RenderLayer.cpp


Added Paths

trunk/LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip-expected.html
trunk/LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip.html
trunk/LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip-expected.html
trunk/LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip.html




Diff

Added: trunk/LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip-expected.html (0 => 295556)

--- trunk/LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip-expected.html	(rev 0)
+++ trunk/LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip-expected.html	2022-06-15 13:43:53 UTC (rev 295556)
@@ -0,0 +1,8 @@
+
+div {
+  width: 100px;;
+  height: 100px;
+  background-color: green;
+}
+
+


Added: trunk/LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip.html (0 => 295556)

--- trunk/LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip.html	(rev 0)
+++ trunk/LayoutTests/fast/scrolling/scrollIntoView-with-overflow-clip.html	2022-06-15 13:43:53 UTC (rev 295556)
@@ -0,0 +1,27 @@
+
+.container {
+  width: 100px;;
+  height: 100px;
+  background-color: green;
+  contain: paint;
+}
+
+.out-of-flow-child {
+  position: absolute;
+  top: -100px;
+  background-color: red;
+  width: 50px;
+  height: 50px;
+}
+.overflow {
+  width: 300px;
+  height: 10px;
+}
+
+
+
+  
+
+
+scrollThis.scrollIntoView();
+


Added: trunk/LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip-expected.html (0 => 295556)

--- trunk/LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip-expected.html	(rev 0)
+++ trunk/LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip-expected.html	2022-06-15 13:43:53 UTC (rev 295556)
@@ -0,0 +1,15 @@
+
+.container {
+  width: 100px;;
+  height: 100px;
+  background-color: green;
+  overflow: hidden;
+}
+
+
+  
+
+
+inputField.focus();
+inputField.value = "text";
+


Added: trunk/LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip.html (0 => 295556)

--- trunk/LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip.html	(rev 0)
+++ trunk/LayoutTests/fast/scrolling/selection-reveal-with-overflow-clip.html	2022-06-15 13:43:53 UTC (rev 295556)
@@ -0,0 +1,26 @@
+
+.container {
+  width: 100px;;
+  height: 100px;
+  background-color: green;
+  overflow: clip;
+  transform: translateX(0px);
+}
+
+.out-of-flow-child {
+  position: absolute;
+  top: -100px;
+  background-color: red;
+  width: 50px;
+  height: 50px;
+}
+
+
+
+
+  
+
+
+inputField.focus();
+document.execCommand('insertText', false, "text");
+


Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (29 => 295556)

--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2022-06-15 11:10:25 UTC (rev 29)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2022-06-15 13:43:53 UTC (rev 295556)
@@ -2515,17 +2515,17 @@
 if (renderer().parent() && !renderer().parent()->style().lineClamp().isNone())
 return false;
 
-RenderBox* box = renderBox();
-ASSERT(box); // Only boxes can have overflowClip set.
+// Only boxes can have overflowClip set.
+auto& box = *renderBox();
 
-if (renderer().frame().eventHandler().autoscrollInProgress()) {
+if (box.frame().eventHandler().autoscrollInProgress()) {
 // The "programmatically" here is misleading; this asks whether the box has scrollable overflow,
 // or is a special case like a form control.
-return box->canBeProgramaticallyScrolled();
+return box.canBeProgramaticallyScrolled();
 }
 
-// Programmatic scrolls can scroll overflow:hidden.
-return box->hasHorizontalOverflow() || box->hasVerticalOverflow();
+// Programmatic scrolls can scroll overflow: hidden but not overflow: clip.
+return box.hasPotentiallyScrollableOverflow() && (box.hasHorizontalOverflow() || 

[webkit-changes] [295478] trunk

2022-06-12 Thread zalan
Title: [295478] trunk








Revision 295478
Author za...@apple.com
Date 2022-06-12 07:45:22 -0700 (Sun, 12 Jun 2022)


Log Message
Incorrect sizing of elements with visually hidden text inside
https://bugs.webkit.org/show_bug.cgi?id=241459

Reviewed by Antti Koivisto.

This patch fixes the incorrect inline width computation when an inline box (e.g. ) with margin-inline-start (e.g. margin-left) is followed by an out-of-flow element.

sometext

In LineBreaker::nextLineBreak, while iterating through the content of [container], the margin-left of the inline box (span) is included twice; first for the out-of-flow box and second for the [text] content. This patch ensures that when we reach the [text] content, we check if we have already reserved the space for the inline box's margin (padding and border).
(While out-of-flow inline level boxes are not supposed to participate in inline layout, (in legacy line layout) in order to compute their static position we include them in line layout. A more involved fix would be to exclude all out-of-flow boxes from line layout and deal with their static positioning after completing the core line layout).

* LayoutTests/fast/block/shrink-to-fit-with-out-of-flow-and-inline-box-margin-expected.html: Added.
* LayoutTests/fast/block/shrink-to-fit-with-out-of-flow-and-inline-box-margin.html: Added.
* Source/WebCore/rendering/line/BreakingContext.h: Make sure when the out-of-flow box takes the margin, we don't add it again for the text content. Also, reset this flag for subsequent content.
(WebCore::inlineLogicalWidth):

Canonical link: https://commits.webkit.org/251483@main

Modified Paths

trunk/Source/WebCore/rendering/line/BreakingContext.h


Added Paths

trunk/LayoutTests/fast/block/shrink-to-fit-with-out-of-flow-and-inline-box-margin-expected.html
trunk/LayoutTests/fast/block/shrink-to-fit-with-out-of-flow-and-inline-box-margin.html




Diff

Added: trunk/LayoutTests/fast/block/shrink-to-fit-with-out-of-flow-and-inline-box-margin-expected.html (0 => 295478)

--- trunk/LayoutTests/fast/block/shrink-to-fit-with-out-of-flow-and-inline-box-margin-expected.html	(rev 0)
+++ trunk/LayoutTests/fast/block/shrink-to-fit-with-out-of-flow-and-inline-box-margin-expected.html	2022-06-12 14:45:22 UTC (rev 295478)
@@ -0,0 +1,12 @@
+
+.container {
+  float: left;
+  font-size: 20px;
+}
+
+.margin_offset {
+  margin-inline-start: 10px;
+}
+
+this contentshould not wrap
+this contentshould not wrap


Added: trunk/LayoutTests/fast/block/shrink-to-fit-with-out-of-flow-and-inline-box-margin.html (0 => 295478)

--- trunk/LayoutTests/fast/block/shrink-to-fit-with-out-of-flow-and-inline-box-margin.html	(rev 0)
+++ trunk/LayoutTests/fast/block/shrink-to-fit-with-out-of-flow-and-inline-box-margin.html	2022-06-12 14:45:22 UTC (rev 295478)
@@ -0,0 +1,16 @@
+
+.container {
+  float: left;
+  font-size: 20px;
+}
+
+.margin_offset {
+  margin-inline-start: 10px;
+}
+
+.out_of_flow {
+  position: absolute;
+}
+
+this contentshould not wrap
+this contentshould not wrap


Modified: trunk/Source/WebCore/rendering/line/BreakingContext.h (295477 => 295478)

--- trunk/Source/WebCore/rendering/line/BreakingContext.h	2022-06-12 03:25:59 UTC (rev 295477)
+++ trunk/Source/WebCore/rendering/line/BreakingContext.h	2022-06-12 14:45:22 UTC (rev 295478)
@@ -352,7 +352,10 @@
 } else
 positionedObjects.append();
 
-m_width.addUncommittedWidth(inlineLogicalWidth(box));
+if (auto inlineBoxStartWidth = inlineLogicalWidth(box)) {
+m_width.addUncommittedWidth(inlineBoxStartWidth);
+m_appliedStartWidth = true;
+}
 // Reset prior line break context characters.
 m_renderTextInfo.lineBreakIterator.resetPriorContext();
 }
@@ -637,9 +640,6 @@
 
 inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool& hyphenated,  unsigned& consecutiveHyphenatedLines)
 {
-if (!m_current.offset())
-m_appliedStartWidth = false;
-
 auto& renderer = downcast(*m_current.renderer());
 bool isSVGText = renderer.isSVGInlineText();
 
@@ -1050,6 +1050,7 @@
 m_atEnd = true;
 }
 }
+m_appliedStartWidth = false;
 return false;
 }
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295477] trunk/Source/WebCore/rendering/LegacyLineLayout.cpp

2022-06-11 Thread zalan
Title: [295477] trunk/Source/WebCore/rendering/LegacyLineLayout.cpp








Revision 295477
Author za...@apple.com
Date 2022-06-11 20:25:59 -0700 (Sat, 11 Jun 2022)


Log Message
Reset the dirty bit on the inline level renderers when counter is present
https://bugs.webkit.org/show_bug.cgi?id=241534

Reviewed by Antti Koivisto.

While the actual line layout happens in layoutRunsAndFloats, we pre-reset the needsLayout flag as we walk the renderers and prepare them for the inline layout.
Normally this simple DOM order walk clears all the layout bits just fine, but counters can re-dirty any "connected" renderer in a seemingly random order.
This patch ensures that all inline level box renders are marked clean before returning from layoutLineBoxes.

* Source/WebCore/rendering/LegacyLineLayout.cpp:
(WebCore::LegacyLineLayout::layoutLineBoxes):

Canonical link: https://commits.webkit.org/251482@main

Modified Paths

trunk/Source/WebCore/rendering/LegacyLineLayout.cpp




Diff

Modified: trunk/Source/WebCore/rendering/LegacyLineLayout.cpp (295476 => 295477)

--- trunk/Source/WebCore/rendering/LegacyLineLayout.cpp	2022-06-11 23:44:42 UTC (rev 295476)
+++ trunk/Source/WebCore/rendering/LegacyLineLayout.cpp	2022-06-12 03:25:59 UTC (rev 295477)
@@ -1746,6 +1746,7 @@
 // deleted and only dirtied. In that case, we can layout the replaced
 // elements at the same time.
 bool hasInlineChild = false;
+auto hasDirtyRenderCounterWithInlineBoxParent = false;
 Vector replacedChildren;
 for (InlineWalker walker(m_flow); !walker.atEnd(); walker.advance()) {
 RenderObject& o = *walker.current();
@@ -1782,8 +1783,10 @@
 box.layoutIfNeeded();
 }
 } else if (o.isTextOrLineBreak() || is(o)) {
-if (layoutState.isFullLayout() || o.selfNeedsLayout())
+if (layoutState.isFullLayout() || o.selfNeedsLayout()) {
 dirtyLineBoxesForRenderer(o, layoutState.isFullLayout());
+hasDirtyRenderCounterWithInlineBoxParent = hasDirtyRenderCounterWithInlineBoxParent || (is(o) && is(o.parent()));
+}
 o.clearNeedsLayout();
 }
 }
@@ -1791,6 +1794,17 @@
 for (size_t i = 0; i < replacedChildren.size(); i++)
 replacedChildren[i]->layoutIfNeeded();
 
+auto clearNeedsLayoutIfNeeded = [&] {
+if (!hasDirtyRenderCounterWithInlineBoxParent)
+return;
+for (InlineWalker walker(m_flow); !walker.atEnd(); walker.advance()) {
+auto& renderer = *walker.current();
+if (is(renderer) || is(renderer))
+renderer.clearNeedsLayout();
+}
+};
+clearNeedsLayoutIfNeeded();
+
 layoutRunsAndFloats(layoutState, hasInlineChild);
 }
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295472] trunk

2022-06-10 Thread zalan
Title: [295472] trunk








Revision 295472
Author za...@apple.com
Date 2022-06-10 22:34:43 -0700 (Fri, 10 Jun 2022)


Log Message
Repaint rect does not take into account text-underline-offset
https://bugs.webkit.org/show_bug.cgi?id=241442

Reviewed by Antti Koivisto.

This patch add support for text decoration ink overflow (IFC).

1. Collect decoration ink overflow (logical)
2. Update display box ink overflow (visual)

* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::build):
(WebCore::Layout::InlineDisplayContentBuilder::collectInkOverflowForInlineBoxes):
(WebCore::Layout::visualBottomForTextDecorationContent):
(WebCore::Layout::InlineDisplayContentBuilder::collectInkOverflowForTextDecorations):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.h:
* Source/WebCore/style/InlineTextBoxStyle.cpp:
(WebCore::visualOverflowForDecorations):
(WebCore::defaultGap):
* Source/WebCore/style/InlineTextBoxStyle.h:

Canonical link: https://commits.webkit.org/251477@main

Modified Paths

trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-position/underline-visual-overflow-with-subpixel-position-expected.txt
trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-position/underline-visual-overflow-with-subpixel-position.html
trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayBox.h
trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp
trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.h
trunk/Source/WebCore/style/InlineTextBoxStyle.cpp
trunk/Source/WebCore/style/InlineTextBoxStyle.h


Added Paths

trunk/LayoutTests/fast/repaint/text-decoration-overflow-repaint-expected.txt
trunk/LayoutTests/fast/repaint/text-decoration-overflow-repaint.html




Diff

Modified: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-position/underline-visual-overflow-with-subpixel-position-expected.txt (295471 => 295472)

--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-position/underline-visual-overflow-with-subpixel-position-expected.txt	2022-06-11 02:44:51 UTC (rev 295471)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-position/underline-visual-overflow-with-subpixel-position-expected.txt	2022-06-11 05:34:43 UTC (rev 295472)
@@ -1,5 +1,5 @@
-PASS window.internals.repaintRectsAsText().indexOf('8 8 784 12') is not -1
-PASS window.internals.repaintRectsAsText().indexOf('8 20 784 12') is not -1
+PASS window.internals.repaintRectsAsText().indexOf('8 8 784 13') is not -1
+PASS window.internals.repaintRectsAsText().indexOf('8 20 784 13') is not -1
 PASS successfullyParsed is true
 
 TEST COMPLETE


Modified: trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-position/underline-visual-overflow-with-subpixel-position.html (295471 => 295472)

--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-position/underline-visual-overflow-with-subpixel-position.html	2022-06-11 02:44:51 UTC (rev 295471)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/text-underline-position/underline-visual-overflow-with-subpixel-position.html	2022-06-11 05:34:43 UTC (rev 295472)
@@ -31,8 +31,8 @@
   elements[i].style.textDecoration = "underline";
 document.body.offsetHeight;
 if (window.internals) {
-shouldNotBe("window.internals.repaintRectsAsText().indexOf('8 8 784 12')", "-1");
-shouldNotBe("window.internals.repaintRectsAsText().indexOf('8 20 784 12')", "-1");
+shouldNotBe("window.internals.repaintRectsAsText().indexOf('8 8 784 13')", "-1");
+shouldNotBe("window.internals.repaintRectsAsText().indexOf('8 20 784 13')", "-1");
 internals.stopTrackingRepaints();
 }
 finishJSTest();


Added: trunk/LayoutTests/fast/repaint/text-decoration-overflow-repaint-expected.txt (0 => 295472)

--- trunk/LayoutTests/fast/repaint/text-decoration-overflow-repaint-expected.txt	(rev 0)
+++ trunk/LayoutTests/fast/repaint/text-decoration-overflow-repaint-expected.txt	2022-06-11 05:34:43 UTC (rev 295472)
@@ -0,0 +1,10 @@
+PASS if the underlines are green.
+content
+content
+content
+(repaint rects
+  (rect 48 46 112 25)
+  (rect 39 82 25 112)
+  (rect 39 214 25 112)
+)
+


Added: trunk/LayoutTests/fast/repaint/text-decoration-overflow-repaint.html (0 => 295472)

--- trunk/LayoutTests/fast/repaint/text-decoration-overflow-repaint.html	(rev 0)
+++ trunk/LayoutTests/fast/repaint/text-decoration-overflow-repaint.html	2022-06-11 05:34:43 UTC (rev 295472)
@@ -0,0 +1,36 @@
+
+div {
+  margin: 20px;
+  font-family: Ahem;
+}
+span {
+  text-decoration: underline;
+  text-underline-offset: 10px;
+  color: blue;
+}
+
+PASS if the underlines are green.
+
+content
+content
+content
+
+
+
+if (window.testRunner) {
+  

[webkit-changes] [295458] trunk/Source/WebCore/style/InlineTextBoxStyle.cpp

2022-06-10 Thread zalan
Title: [295458] trunk/Source/WebCore/style/InlineTextBoxStyle.cpp








Revision 295458
Author za...@apple.com
Date 2022-06-10 11:50:09 -0700 (Fri, 10 Jun 2022)


Log Message
Remove redundant OptionSet in InlineTextBoxStyle functions
https://bugs.webkit.org/show_bug.cgi?id=241499

Reviewed by Antti Koivisto.

* Source/WebCore/style/InlineTextBoxStyle.cpp:
(WebCore::minLogicalTopForTextDecorationLine):
(WebCore::maxLogicalBottomForTextDecorationLine):
(WebCore::enclosingRendererWithTextDecoration):
(WebCore::textRunLogicalOffsetFromLineBottom):

Canonical link: https://commits.webkit.org/251464@main

Modified Paths

trunk/Source/WebCore/style/InlineTextBoxStyle.cpp




Diff

Modified: trunk/Source/WebCore/style/InlineTextBoxStyle.cpp (295457 => 295458)

--- trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2022-06-10 18:19:56 UTC (rev 295457)
+++ trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2022-06-10 18:50:09 UTC (rev 295458)
@@ -48,7 +48,7 @@
 return false;
 }
 
-static float minLogicalTopForTextDecorationLine(const InlineIterator::LineBoxIterator& lineBox, float textRunLogicalTop, const RenderElement* decorationRenderer, OptionSet textDecorationLine)
+static float minLogicalTopForTextDecorationLine(const InlineIterator::LineBoxIterator& lineBox, float textRunLogicalTop, const RenderElement* decorationRenderer)
 {
 auto minLogicalTop = textRunLogicalTop;
 for (auto run = lineBox->firstLeafBox(); run; run.traverseNextOnLine()) {
@@ -55,7 +55,7 @@
 if (run->renderer().isOutOfFlowPositioned())
 continue; // Positioned placeholders don't affect calculations.
 
-if (!(run->style().textDecorationsInEffect() & textDecorationLine))
+if (!run->style().textDecorationsInEffect().contains(TextDecorationLine::Underline))
 continue; // If the text decoration isn't in effect on the child, then it must be outside of |decorationRenderer|'s hierarchy.
 
 if (decorationRenderer && decorationRenderer->isRenderInline() && !isAncestorAndWithinBlock(downcast(*decorationRenderer), >renderer()))
@@ -67,7 +67,7 @@
 return minLogicalTop;
 }
 
-static float maxLogicalBottomForTextDecorationLine(const InlineIterator::LineBoxIterator& lineBox, float textRunLogicalBottom, const RenderElement* decorationRenderer, OptionSet textDecorationLine)
+static float maxLogicalBottomForTextDecorationLine(const InlineIterator::LineBoxIterator& lineBox, float textRunLogicalBottom, const RenderElement* decorationRenderer)
 {
 auto maxLogicalBottom = textRunLogicalBottom;
 for (auto run = lineBox->firstLeafBox(); run; run.traverseNextOnLine()) {
@@ -74,7 +74,7 @@
 if (run->renderer().isOutOfFlowPositioned())
 continue; // Positioned placeholders don't affect calculations.
 
-if (!(run->style().textDecorationsInEffect() & textDecorationLine))
+if (!run->style().textDecorationsInEffect().contains(TextDecorationLine::Underline))
 continue; // If the text decoration isn't in effect on the child, then it must be outside of |decorationRenderer|'s hierarchy.
 
 if (decorationRenderer && decorationRenderer->isRenderInline() && !isAncestorAndWithinBlock(downcast(*decorationRenderer), >renderer()))
@@ -86,7 +86,7 @@
 return maxLogicalBottom;
 }
 
-static const RenderElement* enclosingRendererWithTextDecoration(const RenderText& renderer, OptionSet textDecorationLine, bool firstLine)
+static const RenderElement* enclosingRendererWithTextDecoration(const RenderText& renderer, bool firstLine)
 {
 const RenderElement* current = renderer.parent();
 do {
@@ -96,7 +96,7 @@
 return nullptr;
 
 const RenderStyle& styleToUse = firstLine ? current->firstLineStyle() : current->style();
-if (styleToUse.textDecorationLine() & textDecorationLine)
+if (styleToUse.textDecorationLine().contains(TextDecorationLine::Underline))
 return current;
 current = current->parent();
 } while (current && (!current->element() || (!is(*current->element()) && !current->element()->hasTagName(HTMLNames::fontTag;
@@ -107,12 +107,12 @@
 float textRunLogicalOffsetFromLineBottom(const InlineIterator::TextBoxIterator& textRun)
 {
 float offset = 0.f;
-auto* decorationRenderer = enclosingRendererWithTextDecoration(textRun->renderer(), TextDecorationLine::Underline, textRun->lineBox()->isFirst());
+auto* decorationRenderer = enclosingRendererWithTextDecoration(textRun->renderer(), textRun->lineBox()->isFirst());
 if (textRun->renderer().style().isFlippedLinesWritingMode()) {
-auto minLogicalTop = minLogicalTopForTextDecorationLine(textRun->lineBox(), textRun->logicalTop(), decorationRenderer, TextDecorationLine::Underline);
+auto minLogicalTop = minLogicalTopForTextDecorationLine(textRun->lineBox(), textRun->logicalTop(), decorationRenderer);
 offset = textRun->logicalTop() - minLogicalTop;
 } else {
-offset = 

[webkit-changes] [295455] trunk/Source/WebCore

2022-06-10 Thread zalan
Title: [295455] trunk/Source/WebCore








Revision 295455
Author za...@apple.com
Date 2022-06-10 10:09:37 -0700 (Fri, 10 Jun 2022)


Log Message
Should be able to compute decoration overflow without InlineIterator::TextBoxIterator
https://bugs.webkit.org/show_bug.cgi?id=241490

Reviewed by Antti Koivisto.

This patch enables IFC codebase to compute visual overflow for decoration (even when TextBoxIterator is not available).

* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeAffectsVisualOverflow const):
* Source/WebCore/style/InlineTextBoxStyle.cpp:
(WebCore::visualOverflowForDecorations):
* Source/WebCore/style/InlineTextBoxStyle.h:

Canonical link: https://commits.webkit.org/251461@main

Modified Paths

trunk/Source/WebCore/rendering/style/RenderStyle.cpp
trunk/Source/WebCore/style/InlineTextBoxStyle.cpp
trunk/Source/WebCore/style/InlineTextBoxStyle.h




Diff

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (295454 => 295455)

--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2022-06-10 16:13:17 UTC (rev 295454)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2022-06-10 17:09:37 UTC (rev 295455)
@@ -685,7 +685,7 @@
 // is specified. We can take an early out here.
 if (textUnderlinePosition() == TextUnderlinePosition::Under || other.textUnderlinePosition() == TextUnderlinePosition::Under)
 return true;
-return visualOverflowForDecorations(*this, { }) != visualOverflowForDecorations(other, { });
+return visualOverflowForDecorations(*this) != visualOverflowForDecorations(other);
 }
 
 auto hasOutlineInVisualOverflow = this->hasOutlineInVisualOverflow();


Modified: trunk/Source/WebCore/style/InlineTextBoxStyle.cpp (295454 => 295455)

--- trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2022-06-10 16:13:17 UTC (rev 295454)
+++ trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2022-06-10 17:09:37 UTC (rev 295455)
@@ -172,10 +172,8 @@
 return result;
 }
 
-GlyphOverflow visualOverflowForDecorations(const RenderStyle& lineStyle, const InlineIterator::TextBoxIterator& textRun)
+GlyphOverflow visualOverflowForDecorations(const RenderStyle& lineStyle, std::optional underlineOffset)
 {
-ASSERT(!textRun || textRun->style() == lineStyle);
-
 auto decoration = lineStyle.textDecorationsInEffect();
 if (decoration.isEmpty())
 return GlyphOverflow();
@@ -183,11 +181,11 @@
 float strokeThickness = lineStyle.textDecorationThickness().resolve(lineStyle.computedFontSize(), lineStyle.metricsOfPrimaryFont());
 WavyStrokeParameters wavyStrokeParameters;
 float wavyOffset = 0;
-
+
 TextDecorationStyle decorationStyle = lineStyle.textDecorationStyle();
 float height = lineStyle.fontCascade().metricsOfPrimaryFont().floatHeight();
 GlyphOverflow overflowResult;
-
+
 if (decorationStyle == TextDecorationStyle::Wavy) {
 wavyStrokeParameters = getWavyStrokeParameters(lineStyle.computedFontPixelSize());
 wavyOffset = wavyOffsetFromDecoration();
@@ -198,27 +196,13 @@
 // These metrics must match where underlines get drawn.
 // FIXME: Share the code in TextDecorationPainter::paintBackgroundDecorations() so we can just query it for the painted geometry.
 if (decoration & TextDecorationLine::Underline) {
-// Compensate for the integral ceiling in GraphicsContext::computeLineBoundsAndAntialiasingModeForText()
-int underlineOffset = 1;
-float textDecorationBaseFontSize = 16;
-auto defaultGap = lineStyle.computedFontSize() / textDecorationBaseFontSize;
-// FIXME: RenderStyle calls us with empty textRun but only when TextUnderlinePosition is not Under.
-ASSERT(textRun || lineStyle.textUnderlinePosition() != TextUnderlinePosition::Under);
-if (!textRun)
-underlineOffset += computeUnderlineOffset({ lineStyle, defaultGap });
-else {
-underlineOffset += computeUnderlineOffset({ lineStyle
-, defaultGap
-, UnderlineOffsetArguments::TextUnderlinePositionUnder { textRun->lineBox()->baselineType(), textRun->logicalBottom() - textRun->logicalTop(), textRunLogicalOffsetFromLineBottom(textRun) }
-});
-}
-
+ASSERT(underlineOffset);
 if (decorationStyle == TextDecorationStyle::Wavy) {
-overflowResult.extendBottom(underlineOffset + wavyOffset + wavyStrokeParameters.controlPointDistance + strokeThickness - height);
-overflowResult.extendTop(-(underlineOffset + wavyOffset - wavyStrokeParameters.controlPointDistance - strokeThickness));
+overflowResult.extendBottom(*underlineOffset + wavyOffset + wavyStrokeParameters.controlPointDistance + strokeThickness - height);
+overflowResult.extendTop(-(*underlineOffset + wavyOffset - wavyStrokeParameters.controlPointDistance - strokeThickness));
 } else {
-

[webkit-changes] [295453] trunk/Source/WebCore

2022-06-10 Thread zalan
Title: [295453] trunk/Source/WebCore








Revision 295453
Author za...@apple.com
Date 2022-06-10 08:19:42 -0700 (Fri, 10 Jun 2022)


Log Message
computeUnderlineOffset should not take InlineIterator::LineBoxIterator
https://bugs.webkit.org/show_bug.cgi?id=241488

Reviewed by Antti Koivisto.

Let's precompute the text run's offset value so that we don't have to pass in a LineBoxIterator to computeUnderlineOffset.

* Source/WebCore/rendering/TextDecorationPainter.cpp:
(WebCore::TextDecorationPainter::paintBackgroundDecorations):
* Source/WebCore/style/InlineTextBoxStyle.cpp:
(WebCore::textRunLogicalOffsetFromLineBottom):
(WebCore::computeUnderlineOffset):
(WebCore::visualOverflowForDecorations):
* Source/WebCore/style/InlineTextBoxStyle.h:

Canonical link: https://commits.webkit.org/251459@main

Modified Paths

trunk/Source/WebCore/rendering/TextDecorationPainter.cpp
trunk/Source/WebCore/style/InlineTextBoxStyle.cpp
trunk/Source/WebCore/style/InlineTextBoxStyle.h




Diff

Modified: trunk/Source/WebCore/rendering/TextDecorationPainter.cpp (295452 => 295453)

--- trunk/Source/WebCore/rendering/TextDecorationPainter.cpp	2022-06-10 15:11:58 UTC (rev 295452)
+++ trunk/Source/WebCore/rendering/TextDecorationPainter.cpp	2022-06-10 15:19:42 UTC (rev 295453)
@@ -282,11 +282,10 @@
 auto defaultGap = m_lineStyle.computedFontSize() / textDecorationBaseFontSize;
 float offset = computeUnderlineOffset({ m_lineStyle
 , defaultGap
-, _textBox->renderer()
-, m_textBox->lineBox()->baselineType()
-, m_textBox->logicalTop()
-, m_textBox->logicalBottom()
-, m_textBox->lineBox()
+, UnderlineOffsetArguments::TextUnderlinePositionUnder { m_textBox->lineBox()->baselineType(),
+m_textBox->logicalBottom() - m_textBox->logicalTop(),
+textRunLogicalOffsetFromLineBottom(m_textBox)
+}
 });
 float wavyOffset = m_styles.underlineStyle == TextDecorationStyle::Wavy ? m_wavyOffset : 0;
 FloatRect rect(localOrigin, FloatSize(m_width, textDecorationThickness));


Modified: trunk/Source/WebCore/style/InlineTextBoxStyle.cpp (295452 => 295453)

--- trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2022-06-10 15:11:58 UTC (rev 295452)
+++ trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2022-06-10 15:19:42 UTC (rev 295453)
@@ -103,7 +103,21 @@
 
 return current;
 }
-
+
+float textRunLogicalOffsetFromLineBottom(const InlineIterator::TextBoxIterator& textRun)
+{
+float offset = 0.f;
+auto* decorationRenderer = enclosingRendererWithTextDecoration(textRun->renderer(), TextDecorationLine::Underline, textRun->lineBox()->isFirst());
+if (textRun->renderer().style().isFlippedLinesWritingMode()) {
+auto minLogicalTop = minLogicalTopForTextDecorationLine(textRun->lineBox(), textRun->logicalTop(), decorationRenderer, TextDecorationLine::Underline);
+offset = textRun->logicalTop() - minLogicalTop;
+} else {
+offset = maxLogicalBottomForTextDecorationLine(textRun->lineBox(), textRun->logicalBottom(), decorationRenderer, TextDecorationLine::Underline);
+offset -= textRun->logicalBottom();
+}
+return offset;
+}
+
 float computeUnderlineOffset(const UnderlineOffsetArguments& context)
 {
 // This represents the gap between the baseline and the closest edge of the underline.
@@ -124,12 +138,12 @@
 
 auto resolvedUnderlinePosition = underlinePosition;
 if (resolvedUnderlinePosition == TextUnderlinePosition::Auto && underlineOffset.isAuto()) {
-if (context.renderer)
-resolvedUnderlinePosition = context.baselineType == IdeographicBaseline ? TextUnderlinePosition::Under : TextUnderlinePosition::Auto;
+if (context.textUnderlinePositionUnder)
+resolvedUnderlinePosition = context.textUnderlinePositionUnder->baselineType == IdeographicBaseline ? TextUnderlinePosition::Under : TextUnderlinePosition::Auto;
 else
 resolvedUnderlinePosition = TextUnderlinePosition::Auto;
 }
-
+
 switch (resolvedUnderlinePosition) {
 case TextUnderlinePosition::Auto:
 if (underlineOffset.isAuto())
@@ -138,20 +152,9 @@
 case TextUnderlinePosition::FromFont:
 return fontMetrics.ascent() + fontMetrics.underlinePosition() + underlineOffset.lengthOr(0);
 case TextUnderlinePosition::Under: {
-ASSERT(context.lineBox && context.renderer);
+ASSERT(context.textUnderlinePositionUnder);
 // Position underline relative to the bottom edge of the lowest element's content box.
-auto* decorationRenderer = enclosingRendererWithTextDecoration(*context.renderer, TextDecorationLine::Underline, context.lineBox->isFirst());
-
-float offset;
-if (context.renderer->style().isFlippedLinesWritingMode()) {
-auto minLogicalTop = 

[webkit-changes] [295450] trunk/Source/WebCore/style/InlineTextBoxStyle.cpp

2022-06-10 Thread zalan
Title: [295450] trunk/Source/WebCore/style/InlineTextBoxStyle.cpp








Revision 295450
Author za...@apple.com
Date 2022-06-10 05:26:02 -0700 (Fri, 10 Jun 2022)


Log Message
minLogicalTopForTextDecorationLine/maxLogicalBottomForTextDecorationLine should return the min/max value
https://bugs.webkit.org/show_bug.cgi?id=241474

Reviewed by Antti Koivisto.

This improves readability and also a preparation for making decoration visual overflow work with IFC.

* Source/WebCore/style/InlineTextBoxStyle.cpp:
(WebCore::minLogicalTopForTextDecorationLine):
(WebCore::maxLogicalBottomForTextDecorationLine):
(WebCore::computeUnderlineOffset):

Canonical link: https://commits.webkit.org/251456@main

Modified Paths

trunk/Source/WebCore/style/InlineTextBoxStyle.cpp




Diff

Modified: trunk/Source/WebCore/style/InlineTextBoxStyle.cpp (295449 => 295450)

--- trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2022-06-10 09:37:34 UTC (rev 295449)
+++ trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2022-06-10 12:26:02 UTC (rev 295450)
@@ -48,8 +48,9 @@
 return false;
 }
 
-static void minLogicalTopForTextDecorationLine(const InlineIterator::LineBoxIterator& lineBox, float& minLogicalTop, const RenderElement* decorationRenderer, OptionSet textDecorationLine)
+static float minLogicalTopForTextDecorationLine(const InlineIterator::LineBoxIterator& lineBox, float textRunLogicalTop, const RenderElement* decorationRenderer, OptionSet textDecorationLine)
 {
+auto minLogicalTop = textRunLogicalTop;
 for (auto run = lineBox->firstLeafBox(); run; run.traverseNextOnLine()) {
 if (run->renderer().isOutOfFlowPositioned())
 continue; // Positioned placeholders don't affect calculations.
@@ -63,10 +64,12 @@
 if (run->isText() || run->style().textDecorationSkipInk() == TextDecorationSkipInk::None)
 minLogicalTop = std::min(minLogicalTop, run->logicalTop());
 }
+return minLogicalTop;
 }
 
-static void maxLogicalBottomForTextDecorationLine(const InlineIterator::LineBoxIterator& lineBox, float& maxLogicalBottom, const RenderElement* decorationRenderer, OptionSet textDecorationLine)
+static float maxLogicalBottomForTextDecorationLine(const InlineIterator::LineBoxIterator& lineBox, float textRunLogicalBottom, const RenderElement* decorationRenderer, OptionSet textDecorationLine)
 {
+auto maxLogicalBottom = textRunLogicalBottom;
 for (auto run = lineBox->firstLeafBox(); run; run.traverseNextOnLine()) {
 if (run->renderer().isOutOfFlowPositioned())
 continue; // Positioned placeholders don't affect calculations.
@@ -80,6 +83,7 @@
 if (run->isText() || run->style().textDecorationSkipInk() == TextDecorationSkipInk::None)
 maxLogicalBottom = std::max(maxLogicalBottom, run->logicalBottom());
 }
+return maxLogicalBottom;
 }
 
 static const RenderElement* enclosingRendererWithTextDecoration(const RenderText& renderer, OptionSet textDecorationLine, bool firstLine)
@@ -140,12 +144,10 @@
 
 float offset;
 if (context.renderer->style().isFlippedLinesWritingMode()) {
-offset = context.textRunLogicalTop;
-minLogicalTopForTextDecorationLine(context.lineBox, offset, decorationRenderer, TextDecorationLine::Underline);
-offset = context.textRunLogicalTop - offset;
+auto minLogicalTop = minLogicalTopForTextDecorationLine(context.lineBox, context.textRunLogicalTop, decorationRenderer, TextDecorationLine::Underline);
+offset = context.textRunLogicalTop - minLogicalTop;
 } else {
-offset = context.textRunLogicalBottom;
-maxLogicalBottomForTextDecorationLine(context.lineBox, offset, decorationRenderer, TextDecorationLine::Underline);
+offset = maxLogicalBottomForTextDecorationLine(context.lineBox, context.textRunLogicalBottom, decorationRenderer, TextDecorationLine::Underline);
 offset -= context.textRunLogicalBottom;
 }
 auto textRunLogicalHeight = context.textRunLogicalBottom - context.textRunLogicalTop;






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295444] trunk/Source/WebCore

2022-06-09 Thread zalan
Title: [295444] trunk/Source/WebCore








Revision 295444
Author za...@apple.com
Date 2022-06-09 20:08:10 -0700 (Thu, 09 Jun 2022)


Log Message
computeUnderlineOffset should not take TextRun
https://bugs.webkit.org/show_bug.cgi?id=241471

Reviewed by Antti Koivisto.

This is in preparation for taking visual overflow for decoration into account in IFC.

* Source/WebCore/rendering/TextDecorationPainter.cpp:
(WebCore::TextDecorationPainter::paintBackgroundDecorations):
* Source/WebCore/style/InlineTextBoxStyle.cpp:
(WebCore::computeUnderlineOffset):
(WebCore::visualOverflowForDecorations):
* Source/WebCore/style/InlineTextBoxStyle.h:

Canonical link: https://commits.webkit.org/251450@main

Modified Paths

trunk/Source/WebCore/rendering/TextDecorationPainter.cpp
trunk/Source/WebCore/style/InlineTextBoxStyle.cpp
trunk/Source/WebCore/style/InlineTextBoxStyle.h




Diff

Modified: trunk/Source/WebCore/rendering/TextDecorationPainter.cpp (295443 => 295444)

--- trunk/Source/WebCore/rendering/TextDecorationPainter.cpp	2022-06-10 03:06:22 UTC (rev 295443)
+++ trunk/Source/WebCore/rendering/TextDecorationPainter.cpp	2022-06-10 03:08:10 UTC (rev 295444)
@@ -28,6 +28,7 @@
 #include "GraphicsContext.h"
 #include "HTMLAnchorElement.h"
 #include "HTMLFontElement.h"
+#include "InlineIteratorLineBox.h"
 #include "InlineTextBoxStyle.h"
 #include "RenderBlock.h"
 #include "RenderStyle.h"
@@ -279,7 +280,14 @@
 if (m_decorations.contains(TextDecorationLine::Underline)) {
 float textDecorationBaseFontSize = 16;
 auto defaultGap = m_lineStyle.computedFontSize() / textDecorationBaseFontSize;
-float offset = computeUnderlineOffset(m_lineStyle.textUnderlinePosition(), m_lineStyle.textUnderlineOffset(), m_lineStyle.metricsOfPrimaryFont(), m_textBox, defaultGap);
+float offset = computeUnderlineOffset({ m_lineStyle
+, defaultGap
+, _textBox->renderer()
+, m_textBox->lineBox()->baselineType()
+, m_textBox->logicalTop()
+, m_textBox->logicalBottom()
+, m_textBox->lineBox()
+});
 float wavyOffset = m_styles.underlineStyle == TextDecorationStyle::Wavy ? m_wavyOffset : 0;
 FloatRect rect(localOrigin, FloatSize(m_width, textDecorationThickness));
 rect.move(0, offset + wavyOffset);


Modified: trunk/Source/WebCore/style/InlineTextBoxStyle.cpp (295443 => 295444)

--- trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2022-06-10 03:06:22 UTC (rev 295443)
+++ trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2022-06-10 03:08:10 UTC (rev 295444)
@@ -29,7 +29,6 @@
 #include "FontCascade.h"
 #include "HTMLAnchorElement.h"
 #include "HTMLNames.h"
-#include "InlineIteratorLineBox.h"
 #include "InlineIteratorTextBox.h"
 #include "LegacyInlineTextBox.h"
 #include "LegacyRootInlineBox.h"
@@ -101,10 +100,10 @@
 return current;
 }
 
-float computeUnderlineOffset(TextUnderlinePosition underlinePosition, TextUnderlineOffset underlineOffset, const FontMetrics& fontMetrics, const InlineIterator::TextBoxIterator& textRun, float defaultGap)
+float computeUnderlineOffset(const UnderlineOffsetArguments& context)
 {
 // This represents the gap between the baseline and the closest edge of the underline.
-float gap = std::max(1, std::ceil(defaultGap / 2.0f));
+float gap = std::max(1, std::ceil(context.defaultGap / 2.0f));
 
 // FIXME: The code for visual overflow detection passes in a null inline text box. This means it is now
 // broken for the case where auto needs to behave like "under".
@@ -115,11 +114,14 @@
 // even if it is horizontal, but detecting this has performance implications. For now we only work with
 // vertical text, since we already determined the baseline type to be ideographic in that
 // case.
-
+auto underlinePosition = context.lineStyle.textUnderlinePosition();
+auto underlineOffset = context.lineStyle.textUnderlineOffset();
+auto& fontMetrics = context.lineStyle.metricsOfPrimaryFont();
+
 auto resolvedUnderlinePosition = underlinePosition;
 if (resolvedUnderlinePosition == TextUnderlinePosition::Auto && underlineOffset.isAuto()) {
-if (textRun)
-resolvedUnderlinePosition = textRun->lineBox()->baselineType() == IdeographicBaseline ? TextUnderlinePosition::Under : TextUnderlinePosition::Auto;
+if (context.renderer)
+resolvedUnderlinePosition = context.baselineType == IdeographicBaseline ? TextUnderlinePosition::Under : TextUnderlinePosition::Auto;
 else
 resolvedUnderlinePosition = TextUnderlinePosition::Auto;
 }
@@ -132,22 +134,22 @@
 case TextUnderlinePosition::FromFont:
 return fontMetrics.ascent() + fontMetrics.underlinePosition() + underlineOffset.lengthOr(0);
 case TextUnderlinePosition::Under: {
-ASSERT(textRun);
+ASSERT(context.lineBox && context.renderer);
 // 

[webkit-changes] [295393] trunk/Source/WebCore/rendering/RenderImageResource.cpp

2022-06-08 Thread zalan
Title: [295393] trunk/Source/WebCore/rendering/RenderImageResource.cpp








Revision 295393
Author za...@apple.com
Date 2022-06-08 14:02:15 -0700 (Wed, 08 Jun 2022)


Log Message
RenderImageResource::setCachedImage may produce a null renderer
https://bugs.webkit.org/show_bug.cgi?id=241435


Reviewed by Antti Koivisto.

This is a speculative fix to address null deref on the renderer.

* Source/WebCore/rendering/RenderImageResource.cpp:
(WebCore::RenderImageResource::setCachedImage):

Canonical link: https://commits.webkit.org/251399@main

Modified Paths

trunk/Source/WebCore/rendering/RenderImageResource.cpp




Diff

Modified: trunk/Source/WebCore/rendering/RenderImageResource.cpp (295392 => 295393)

--- trunk/Source/WebCore/rendering/RenderImageResource.cpp	2022-06-08 20:58:30 UTC (rev 295392)
+++ trunk/Source/WebCore/rendering/RenderImageResource.cpp	2022-06-08 21:02:15 UTC (rev 295393)
@@ -63,6 +63,10 @@
 
 if (m_cachedImage && m_renderer && m_cachedImageRemoveClientIsNeeded)
 m_cachedImage->removeClient(*m_renderer);
+if (!m_renderer) {
+// removeClient may have destroyed the renderer.
+return;
+}
 m_cachedImage = newImage;
 m_cachedImageRemoveClientIsNeeded = true;
 if (!m_cachedImage)






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295363] trunk/Source/WebCore/layout/formattingContexts/inline/ InlineLineBuilder.cpp

2022-06-07 Thread zalan
Title: [295363] trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp








Revision 295363
Author za...@apple.com
Date 2022-06-07 13:24:49 -0700 (Tue, 07 Jun 2022)


Log Message
LineBuilder::rebuildLineForTrailingSoftHyphen may end up with no wrapping opportunities
https://bugs.webkit.org/show_bug.cgi?id=241375


Reviewed by Antti Koivisto.

This is a speculative fix to address the overflow issue in rebuildLineForTrailingSoftHyphen, where we assume a non-empty m_wrapOpportunityList vector.

* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::handleInlineContent):
(WebCore::Layout::LineBuilder::rebuildLineForTrailingSoftHyphen):

Canonical link: https://commits.webkit.org/251371@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp (295362 => 295363)

--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2022-06-07 20:15:44 UTC (rev 295362)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2022-06-07 20:24:49 UTC (rev 295363)
@@ -1034,7 +1034,9 @@
 if (result.action == InlineContentBreaker::Result::Action::RevertToLastNonOverflowingWrapOpportunity) {
 ASSERT(result.isEndOfLine == InlineContentBreaker::IsEndOfLine::Yes);
 ASSERT(!m_wrapOpportunityList.isEmpty());
-return { InlineContentBreaker::IsEndOfLine::Yes, { rebuildLineForTrailingSoftHyphen(layoutRange), true } };
+if (auto committedCount = rebuildLineForTrailingSoftHyphen(layoutRange))
+return { InlineContentBreaker::IsEndOfLine::Yes, { committedCount, true } };
+return { InlineContentBreaker::IsEndOfLine::Yes };
 }
 if (result.action == InlineContentBreaker::Result::Action::Break) {
 ASSERT(result.isEndOfLine == InlineContentBreaker::IsEndOfLine::Yes);
@@ -1106,7 +1108,11 @@
 
 size_t LineBuilder::rebuildLineForTrailingSoftHyphen(const InlineItemRange& layoutRange)
 {
-ASSERT(!m_wrapOpportunityList.isEmpty());
+if (m_wrapOpportunityList.isEmpty()) {
+// We are supposed to have a wrapping opportunity on the current line at this point.
+ASSERT_NOT_REACHED();
+return { };
+}
 // Revert all the way back to a wrap opportunity when either a soft hyphen fits or no hyphen is required.
 for (auto i = m_wrapOpportunityList.size(); i-- > 1;) {
 auto& softWrapOpportunityItem = *m_wrapOpportunityList[i];






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295283] trunk/Source/WebCore

2022-06-06 Thread zalan
Title: [295283] trunk/Source/WebCore








Revision 295283
Author za...@apple.com
Date 2022-06-06 06:11:21 -0700 (Mon, 06 Jun 2022)


Log Message
Implement FlexFormattingContext::usedContentHeight
https://bugs.webkit.org/show_bug.cgi?id=241325

Reviewed by Antti Koivisto.

Update the RenderFlexibleBox's content height.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::usedContentHeight const):
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::contentLogicalHeight const):
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutUsingFlexFormattingContext):

Canonical link: https://commits.webkit.org/251329@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (295282 => 295283)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-06-06 13:08:35 UTC (rev 295282)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-06-06 13:11:21 UTC (rev 295283)
@@ -57,8 +57,14 @@
 
 LayoutUnit FlexFormattingContext::usedContentHeight() const
 {
-auto& lines = formattingState().lines();
-return LayoutUnit { lines.last().bottom() - lines.first().top() };
+auto contentTop = LayoutUnit::max();
+auto contentBottom = LayoutUnit::min();
+for (auto& flexItem : childrenOfType(root())) {
+auto marginBox = Layout::BoxGeometry::marginBoxRect(geometryForBox(flexItem));
+contentTop = std::min(contentTop, marginBox.top());
+contentBottom = std::max(contentBottom, marginBox.bottom());
+}
+return std::max(0_lu, contentBottom - contentTop);
 }
 
 IntrinsicWidthConstraints FlexFormattingContext::computedIntrinsicWidthConstraints()


Modified: trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp (295282 => 295283)

--- trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp	2022-06-06 13:08:35 UTC (rev 295282)
+++ trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp	2022-06-06 13:11:21 UTC (rev 295283)
@@ -171,7 +171,7 @@
 
 LayoutUnit FlexLayout::contentLogicalHeight() const
 {
-return { };
+return Layout::FlexFormattingContext { rootLayoutBox(), m_flexFormattingState }.usedContentHeight();
 }
 
 }


Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (295282 => 295283)

--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2022-06-06 13:08:35 UTC (rev 295282)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2022-06-06 13:11:21 UTC (rev 295283)
@@ -2366,6 +2366,8 @@
 m_flexLayout->updateFlexItemDimensions(flexItem, minMaxContentSize.first, minMaxContentSize.second);
 }
 m_flexLayout->layout();
+setLogicalHeight(std::max(logicalHeight(), borderBefore() + paddingBefore() + m_flexLayout->contentLogicalHeight() + borderAfter() + paddingAfter()));
+updateLogicalHeight();
 }
 #endif
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295282] trunk/Source/WebCore/layout/integration/ LayoutIntegrationCoverage.cpp

2022-06-06 Thread zalan
Title: [295282] trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp








Revision 295282
Author za...@apple.com
Date 2022-06-06 06:08:35 -0700 (Mon, 06 Jun 2022)


Log Message
Populate canUseForFlexLayout with unsupported styles and content
https://bugs.webkit.org/show_bug.cgi?id=241323

Reviewed by Tim Nguyen.

This is in preparation for being able to run WPT tests (filter out unsupported content).

* Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForFlexLayout):

Canonical link: https://commits.webkit.org/251328@main

Modified Paths

trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp




Diff

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp (295281 => 295282)

--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2022-06-06 12:10:42 UTC (rev 295281)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2022-06-06 13:08:35 UTC (rev 295282)
@@ -678,8 +678,33 @@
 {
 if (!flexBox.document().settings().flexFormattingContextIntegrationEnabled())
 return false;
-ASSERT_NOT_IMPLEMENTED_YET();
-return false;
+
+auto& flexBoxStyle = flexBox.style();
+if (!flexBoxStyle.isHorizontalWritingMode() || !flexBoxStyle.isLeftToRightDirection())
+return false;
+if (flexBoxStyle.flexWrap() == FlexWrap::Reverse)
+return false;
+if (flexBoxStyle.alignItems().position() == ItemPosition::Baseline)
+return false;
+if (flexBoxStyle.alignContent().position() != ContentPosition::Normal || flexBoxStyle.alignContent().distribution() != ContentDistribution::Default || flexBoxStyle.alignContent().overflow() != OverflowAlignment::Default)
+return false;
+if (!flexBoxStyle.rowGap().isNormal() || !flexBoxStyle.columnGap().isNormal())
+return false;
+
+for (auto& flexItem : childrenOfType(flexBox)) {
+if (!is(flexItem))
+return false;
+if (flexItem.isFloating() || flexItem.isOutOfFlowPositioned())
+return false;
+if (flexItem.isSVGRootOrLegacySVGRoot())
+return false;
+auto& flexItemStyle = flexItem.style();
+if (!flexItemStyle.maxWidth().isUndefined() || !flexItemStyle.maxHeight().isUndefined())
+return false;
+if (flexItem.hasIntrinsicAspectRatio() || flexItemStyle.hasAspectRatio())
+return false;
+}
+return true;
 }
 
 }






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295277] trunk/Source/WebCore/layout/formattingContexts/flex/ FlexLayout.cpp

2022-06-05 Thread zalan
Title: [295277] trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp








Revision 295277
Author za...@apple.com
Date 2022-06-05 22:20:11 -0700 (Sun, 05 Jun 2022)


Log Message
Take align-self into account when computing flex item's logical height.
https://bugs.webkit.org/show_bug.cgi?id=241314

Reviewed by Antti Koivisto.

* Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp:
(WebCore::Layout::FlexLayout::computeLogicalHeightForFlexItems):

Canonical link: https://commits.webkit.org/251323@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp (295276 => 295277)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp	2022-06-06 03:51:24 UTC (rev 295276)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp	2022-06-06 05:20:11 UTC (rev 295277)
@@ -262,7 +262,7 @@
 
 void FlexLayout::computeLogicalHeightForFlexItems(LogicalFlexItems& flexItems, const LineRange& lineRange, LayoutUnit availableSpace)
 {
-auto alignItems = flexBoxStyle().alignItems();
+auto flexBoxAlignItems = flexBoxStyle().alignItems();
 auto lineHeight = LayoutUnit { };
 
 for (size_t index = lineRange.begin(); index < lineRange.end(); ++index) {
@@ -269,7 +269,9 @@
 auto& flexItem = flexItems[index];
 if (!flexItem.isHeightAuto())
 continue;
-switch (alignItems.position()) {
+auto& flexItemAlignSelf = flexItem.style().alignSelf();
+auto alignValue = flexItemAlignSelf.position() != ItemPosition::Auto ? flexItemAlignSelf : flexBoxAlignItems;
+switch (alignValue.position()) {
 case ItemPosition::Normal:
 case ItemPosition::Stretch:
 flexItem.setHeight(availableSpace);






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295276] trunk/Source/WebCore/layout/formattingContexts/flex

2022-06-05 Thread zalan
Title: [295276] trunk/Source/WebCore/layout/formattingContexts/flex








Revision 295276
Author za...@apple.com
Date 2022-06-05 20:51:24 -0700 (Sun, 05 Jun 2022)


Log Message
FlexLayout should only take logical values
https://bugs.webkit.org/show_bug.cgi?id=241310

Reviewed by Antti Koivisto.

Turn ConstraintsForFlexContent into LogicalConstraints.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h:
* Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp:
(WebCore::Layout::FlexLayout::computeAvailableLogicalVerticalSpace const):
(WebCore::Layout::FlexLayout::computeAvailableLogicalHorizontalSpace const):
(WebCore::Layout::FlexLayout::layout):
* Source/WebCore/layout/formattingContexts/flex/FlexLayout.h:

Canonical link: https://commits.webkit.org/251322@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h
trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp
trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.h




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (295275 => 295276)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-06-06 01:24:41 UTC (rev 295275)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-06-06 03:51:24 UTC (rev 295276)
@@ -287,13 +287,21 @@
 }
 }
 
-void FlexFormattingContext::layoutInFlowContentForIntegration(const ConstraintsForInFlowContent& constraints)
+void FlexFormattingContext::layoutInFlowContentForIntegration(const ConstraintsForFlexContent& constraints)
 {
-auto flexConstraints = downcast(constraints);
-auto logicalFlexItems = convertFlexItemsToLogicalSpace(flexConstraints);
+auto logicalFlexItems = convertFlexItemsToLogicalSpace(constraints);
 auto flexLayout = FlexLayout { root().style() };
-flexLayout.layout(flexConstraints, logicalFlexItems);
-setFlexItemsGeometry(logicalFlexItems, flexConstraints);
+
+auto logicalFlexConstraints = [&] {
+auto flexDirection = root().style().flexDirection();
+auto flexDirectionIsInlineAxis = flexDirection == FlexDirection::Row || flexDirection == FlexDirection::RowReverse;
+auto logicalVerticalSapce = flexDirectionIsInlineAxis ? constraints.availableVerticalSpace() : std::make_optional(constraints.horizontal().logicalWidth);
+auto logicalHorizontalSapce = flexDirectionIsInlineAxis ? std::make_optional(constraints.horizontal().logicalWidth) : constraints.availableVerticalSpace();
+return FlexLayout::LogicalConstraints { logicalVerticalSapce, logicalHorizontalSapce };
+};
+
+flexLayout.layout(logicalFlexConstraints(), logicalFlexItems);
+setFlexItemsGeometry(logicalFlexItems, constraints);
 }
 
 IntrinsicWidthConstraints FlexFormattingContext::computedIntrinsicWidthConstraintsForIntegration()


Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h (295275 => 295276)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h	2022-06-06 01:24:41 UTC (rev 295275)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h	2022-06-06 03:51:24 UTC (rev 295276)
@@ -51,7 +51,7 @@
 const FlexFormattingGeometry& formattingGeometry() const final { return m_flexFormattingGeometry; }
 const FormattingQuirks& formattingQuirks() const final { return m_flexFormattingQuirks; }
 
-void layoutInFlowContentForIntegration(const ConstraintsForInFlowContent&);
+void layoutInFlowContentForIntegration(const ConstraintsForFlexContent&);
 IntrinsicWidthConstraints computedIntrinsicWidthConstraintsForIntegration();
 
 private:


Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp (295275 => 295276)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp	2022-06-06 01:24:41 UTC (rev 295275)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp	2022-06-06 03:51:24 UTC (rev 295276)
@@ -39,7 +39,7 @@
 {
 }
 
-FlexLayout::LineHeightList FlexLayout::computeAvailableLogicalVerticalSpace(const LogicalFlexItems& flexItems, const WrappingPositions& wrappingIndexList, const ConstraintsForFlexContent& flexConstraints) const
+FlexLayout::LineHeightList FlexLayout::computeAvailableLogicalVerticalSpace(const LogicalFlexItems& flexItems, const WrappingPositions& wrappingIndexList, const LogicalConstraints& flexConstraints) const
 {
 auto lineHeightList = LineHeightList(wrappingIndexList.size());
 auto lineRange = Range { };
@@ -56,15 +56,8 @@
 accumulatedContentHeight += lineHeightList[index];
 }
 
-auto availableLogicalVerticalSpaceFromConstraint = [&] {
-auto 

[webkit-changes] [295275] trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp

2022-06-05 Thread zalan
Title: [295275] trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp








Revision 295275
Author za...@apple.com
Date 2022-06-05 18:24:41 -0700 (Sun, 05 Jun 2022)


Log Message
Reset the flex item renderers before flex layout
https://bugs.webkit.org/show_bug.cgi?id=241311

Reviewed by Antti Koivisto.

Each layout frame should start with a clean state.

* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutUsingFlexFormattingContext):

Canonical link: https://commits.webkit.org/251321@main

Modified Paths

trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp




Diff

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (295274 => 295275)

--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2022-06-06 01:06:55 UTC (rev 295274)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2022-06-06 01:24:41 UTC (rev 295275)
@@ -2354,8 +2354,14 @@
 
 m_flexLayout->updateFormattingRootGeometryAndInvalidate();
 
+resetHasDefiniteHeight();
 for (auto& flexItem : childrenOfType(*this)) {
+
+// FIXME: This needs a more fine-grained handling.
+flexItem.clearOverridingContentSize();
+flexItem.setChildNeedsLayout(MarkOnlyThis);
 flexItem.layoutIfNeeded();
+
 auto minMaxContentSize = computeFlexItemMinMaxSizes(flexItem);
 m_flexLayout->updateFlexItemDimensions(flexItem, minMaxContentSize.first, minMaxContentSize.second);
 }






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295273] trunk/Source/WebCore/layout/formattingContexts/flex/ FlexFormattingContext.cpp

2022-06-05 Thread zalan
Title: [295273] trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp








Revision 295273
Author za...@apple.com
Date 2022-06-05 17:04:13 -0700 (Sun, 05 Jun 2022)


Log Message
column-reverse content should take resolved flex box height into account when computing visual position
https://bugs.webkit.org/show_bug.cgi?id=241313

Reviewed by Antti Koivisto.

When the flex box has resolvable height, use it as the anchor point to compute the column-reverse content's visual vertical position.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::setFlexItemsGeometry):

Canonical link: https://commits.webkit.org/251319@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (295272 => 295273)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-06-05 21:53:00 UTC (rev 295272)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-06-06 00:04:13 UTC (rev 295273)
@@ -264,12 +264,14 @@
 };
 break;
 }
-case FlexDirection::ColumnReverse:
+case FlexDirection::ColumnReverse: {
+auto visualBottom = constraints.logicalTop() + constraints.availableVerticalSpace().value_or(logicalWidth);
 borderBoxTopLeft = {
 constraints.horizontal().logicalLeft + logicalFlexItem.top(),
-constraints.logicalTop() + logicalWidth - logicalFlexItem.right() + flexItemGeometry.marginBefore()
+visualBottom - logicalFlexItem.right() + flexItemGeometry.marginBefore()
 };
 break;
+}
 default:
 ASSERT_NOT_REACHED();
 break;






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295208] trunk/Source/WebCore/layout

2022-06-03 Thread zalan
Title: [295208] trunk/Source/WebCore/layout








Revision 295208
Author za...@apple.com
Date 2022-06-03 08:03:54 -0700 (Fri, 03 Jun 2022)


Log Message
FlexLayout should not use non-logical intrinsic widths
https://bugs.webkit.org/show_bug.cgi?id=241256

Reviewed by Antti Koivisto.

This is in preparation for using logical-intrinsic widths in flex layout.

* Source/WebCore/layout/FormattingState.h:
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::convertFlexItemsToLogicalSpace):
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
* Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp:
(WebCore::Layout::FlexLayout::FlexLayout):
(WebCore::Layout::FlexLayout::computeLogicalWidthForShrinkingFlexItems):
(WebCore::Layout::FlexLayout::computeLogicalWidthForStretchingFlexItems):
* Source/WebCore/layout/formattingContexts/flex/FlexLayout.h:
(WebCore::Layout::FlexLayout::LogicalFlexItem::minimumContentWidth const):
(WebCore::Layout::FlexLayout::LogicalFlexItem::LogicalFlexItem):
(WebCore::Layout::FlexLayout::formattingState const): Deleted.

Canonical link: https://commits.webkit.org/251265@main

Modified Paths

trunk/Source/WebCore/layout/FormattingState.h
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp
trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.h




Diff

Modified: trunk/Source/WebCore/layout/FormattingState.h (295207 => 295208)

--- trunk/Source/WebCore/layout/FormattingState.h	2022-06-03 14:41:53 UTC (rev 295207)
+++ trunk/Source/WebCore/layout/FormattingState.h	2022-06-03 15:03:54 UTC (rev 295208)
@@ -47,7 +47,7 @@
 void markNeedsLayout(const Box&, StyleDiff);
 bool needsLayout(const Box&);
 
-void setIntrinsicWidthConstraintsForBox(const Box&,  IntrinsicWidthConstraints);
+void setIntrinsicWidthConstraintsForBox(const Box&, IntrinsicWidthConstraints);
 std::optional intrinsicWidthConstraintsForBox(const Box&) const;
 void clearIntrinsicWidthConstraints(const Box&);
 


Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (295207 => 295208)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-06-03 14:41:53 UTC (rev 295207)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-06-03 15:03:54 UTC (rev 295208)
@@ -225,7 +225,12 @@
 auto& style = layoutBox.style();
 auto logicalWidthType = flexDirectionIsInlineAxis ? style.width().type() : style.height().type();
 auto logicalHeightType = flexDirectionIsInlineAxis ? style.height().type() : style.width().type();
-logicalFlexItemList[index] = { flexItemList[index].marginRect, logicalWidthType, logicalHeightType, layoutBox };
+logicalFlexItemList[index] = { flexItemList[index].marginRect
+, logicalWidthType
+, logicalHeightType
+// FIXME: Convert to logical intrinsic width
+, *formattingState.intrinsicWidthConstraintsForBox(layoutBox)
+, layoutBox };
 }
 return logicalFlexItemList;
 }
@@ -285,7 +290,7 @@
 {
 auto flexConstraints = downcast(constraints);
 auto logicalFlexItems = convertFlexItemsToLogicalSpace(flexConstraints);
-auto flexLayout = FlexLayout { formattingState(), root().style() };
+auto flexLayout = FlexLayout { root().style() };
 flexLayout.layout(flexConstraints, logicalFlexItems);
 setFlexItemsGeometry(logicalFlexItems, flexConstraints);
 }


Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp (295207 => 295208)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp	2022-06-03 14:41:53 UTC (rev 295207)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp	2022-06-03 15:03:54 UTC (rev 295208)
@@ -34,9 +34,8 @@
 namespace WebCore {
 namespace Layout {
 
-FlexLayout::FlexLayout(const FlexFormattingState& formattingState, const RenderStyle& flexBoxStyle)
-: m_formattingState(formattingState)
-, m_flexBoxStyle(flexBoxStyle)
+FlexLayout::FlexLayout(const RenderStyle& flexBoxStyle)
+: m_flexBoxStyle(flexBoxStyle)
 {
 }
 
@@ -80,8 +79,6 @@
 
 void FlexLayout::computeLogicalWidthForShrinkingFlexItems(LogicalFlexItems& flexItems, LayoutUnit availableSpace)
 {
-auto& formattingState = this->formattingState();
-
 auto totalShrink = 0.f;
 auto totalFlexibleSpace = LayoutUnit { };
 auto flexShrinkBase = 0.f;
@@ -103,7 +100,7 @@
 auto baseSize = style.flexBasis().isFixed() ? LayoutUnit { style.flexBasis().value() } : flexItem.width();
 if (auto shrinkValue = style.flexShrink()) {
 auto flexShrink = shrinkValue * baseSize;
-shrinkingItems.append({ flexShrink, formattingState.intrinsicWidthConstraintsForBox(flexItem.layoutBox())->minimum, baseSize, 

[webkit-changes] [295155] trunk

2022-06-02 Thread zalan
Title: [295155] trunk








Revision 295155
Author za...@apple.com
Date 2022-06-02 17:08:01 -0700 (Thu, 02 Jun 2022)


Log Message
Regression(r294902) Web Inspector highlight gets stuck when hovering over items.
https://bugs.webkit.org/show_bug.cgi?id=241231

Reviewed by Simon Fraser.

This patch ensures that repaint() goes through for the "about-to-be-destroyed" content.

Staring from r294902, when the RenderLayer says "I am scheduled for a full repaint", any subsequent repaint call on the associated renderer returns early (no repaint) as we are certain that a full repaint is going to be issued still within the current "rendering update" frame as part of the post-layout tasks.
Except this one case when soon after marking the RenderLayer dirty with the "needs full repaint" flag, we destroy both the layer and the associated renderer. In this case the layer has no chance to issue the repaint.

* LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach-expected.txt: Added.
* LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach.html: Added.
* Source/WebCore/rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::detachFromRenderElement):

Canonical link: https://commits.webkit.org/251243@main

Modified Paths

trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp


Added Paths

trunk/LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach-expected.txt
trunk/LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach.html




Diff

Added: trunk/LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach-expected.txt (0 => 295155)

--- trunk/LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach-expected.txt	(rev 0)
+++ trunk/LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach-expected.txt	2022-06-03 00:08:01 UTC (rev 295155)
@@ -0,0 +1 @@
+PASS


Added: trunk/LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach.html (0 => 295155)

--- trunk/LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach.html	(rev 0)
+++ trunk/LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach.html	2022-06-03 00:08:01 UTC (rev 295155)
@@ -0,0 +1,33 @@
+
+#remove_me {
+  transform: translateX(10px);
+  background-color: red;
+  width: 100px;
+  height: 100px;
+}
+
+
+
+
+
+if (window.testRunner) {
+  testRunner.waitUntilDone();
+  testRunner.dumpAsText();
+}
+
+document.body.offsetHeight;
+
+setTimeout(function() {
+  if (window.internals)
+internals.startTrackingRepaints();
+  
+  remove_me.remove();
+
+  if (window.internals) {
+result.innerText = internals.repaintRectsAsText().indexOf("18 8 100 100") != -1 ? "PASS" : "FAIL";
+internals.stopTrackingRepaints();
+  }
+  if (window.testRunner)
+testRunner.notifyDone();
+}, 1);
+
\ No newline at end of file


Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (295154 => 295155)

--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2022-06-03 00:05:46 UTC (rev 295154)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2022-06-03 00:08:01 UTC (rev 295155)
@@ -953,12 +953,11 @@
 // that a positioned child got yanked). We also repaint, so that the area exposed when the child
 // disappears gets repainted properly.
 if (!parent.renderTreeBeingDestroyed() && child.everHadLayout()) {
-child.setNeedsLayoutAndPrefWidthsRecalc();
-// We only repaint |child| if we have a RenderLayer as its visual overflow may not be tracked by its parent.
 if (child.isBody())
 parent.view().repaintRootContents();
 else
 child.repaint();
+child.setNeedsLayoutAndPrefWidthsRecalc();
 }
 
 // If we have a line box wrapper, delete it.






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295124] trunk

2022-06-02 Thread zalan
Title: [295124] trunk








Revision 295124
Author za...@apple.com
Date 2022-06-02 05:52:52 -0700 (Thu, 02 Jun 2022)


Log Message
Do not assume that an absolute positioned block box's height is always resolvable
https://bugs.webkit.org/show_bug.cgi?id=241213

Reviewed by Simon Fraser.

1. While the ICB (RenderView) always has fixed height/width, the RenderStyle values are set to auto.
2. It's incorrect to assume that we can always resolve the height for an absolute positioned box (e.g. it may have a "height: auto" relative positioned containing block)

* LayoutTests/fast/block/fill-available-with-absolute-position-expected.html: Added.
* LayoutTests/fast/block/fill-available-with-absolute-position.html: Added.
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::computeIntrinsicLogicalContentHeightUsing const):
(WebCore::RenderBox::computePositionedLogicalHeightUsing const):

Canonical link: https://commits.webkit.org/251215@main

Modified Paths

trunk/Source/WebCore/rendering/RenderBox.cpp


Added Paths

trunk/LayoutTests/fast/block/fill-available-with-absolute-position-expected.html
trunk/LayoutTests/fast/block/fill-available-with-absolute-position.html




Diff

Added: trunk/LayoutTests/fast/block/fill-available-with-absolute-position-expected.html (0 => 295124)

--- trunk/LayoutTests/fast/block/fill-available-with-absolute-position-expected.html	(rev 0)
+++ trunk/LayoutTests/fast/block/fill-available-with-absolute-position-expected.html	2022-06-02 12:52:52 UTC (rev 295124)
@@ -0,0 +1,9 @@
+
+div { 
+  width: 10px;
+  height: 100%;
+  background-color: green;
+  position: absolute;
+}
+
+


Added: trunk/LayoutTests/fast/block/fill-available-with-absolute-position.html (0 => 295124)

--- trunk/LayoutTests/fast/block/fill-available-with-absolute-position.html	(rev 0)
+++ trunk/LayoutTests/fast/block/fill-available-with-absolute-position.html	2022-06-02 12:52:52 UTC (rev 295124)
@@ -0,0 +1,15 @@
+
+.fill { 
+  width: 10px;
+  background-color: green;
+  height: -webkit-fill-available;
+  position: absolute;
+}
+.relative-containing-block {
+  position: relative;
+}
+
+
+
+  
+


Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (295123 => 295124)

--- trunk/Source/WebCore/rendering/RenderBox.cpp	2022-06-02 08:47:49 UTC (rev 295123)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2022-06-02 12:52:52 UTC (rev 295124)
@@ -3281,6 +3281,8 @@
 // Until then, this is mostly just guesswork.
 if (!containingBlock)
 return false;
+if (is(containingBlock))
+return true;
 auto containingBlockHasSpecifiedSpace = [&] {
 auto isOrthogonal = WebCore::isOrthogonal(*this, *containingBlock);
 auto& style = containingBlock->style();
@@ -4478,7 +4480,7 @@
 logicalHeightIsAuto = false;
 } else {
 if (logicalHeightLength.isIntrinsic())
-resolvedLogicalHeight = adjustContentBoxLogicalHeightForBoxSizing(computeIntrinsicLogicalContentHeightUsing(logicalHeightLength, contentLogicalHeight, bordersPlusPadding).value());
+resolvedLogicalHeight = adjustContentBoxLogicalHeightForBoxSizing(computeIntrinsicLogicalContentHeightUsing(logicalHeightLength, contentLogicalHeight, bordersPlusPadding).value_or(0_lu));
 else if (fromAspectRatio) {
 resolvedLogicalHeight = blockSizeFromAspectRatio(horizontalBorderAndPaddingExtent(), verticalBorderAndPaddingExtent(), style().logicalAspectRatio(), style().boxSizingForAspectRatio(), logicalWidth());
 resolvedLogicalHeight = std::max(LayoutUnit(), resolvedLogicalHeight - bordersPlusPadding);






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295094] trunk

2022-06-01 Thread zalan
Title: [295094] trunk








Revision 295094
Author za...@apple.com
Date 2022-06-01 10:26:14 -0700 (Wed, 01 Jun 2022)


Log Message
Spacing after some posts is too large on Dead by Daylight forums
https://bugs.webkit.org/show_bug.cgi?id=241104


Reviewed by Antti Koivisto.

Do not cross containing block boundary while resolving fill-available. If the containing block does not specify the constraint value for the fill-available descendant, we should just return "can't resolve" instead of climbing the containing block tree and potentially hit the ICB as the first container with fixed height(width).

* LayoutTests/fast/block/fill-available-with-no-specified-containing-block-height-expected.html: Added.
* LayoutTests/fast/block/fill-available-with-no-specified-containing-block-height.html: Added.
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::isOrthogonal):
(WebCore::RenderBox::computeIntrinsicLogicalContentHeightUsing const):

Canonical link: https://commits.webkit.org/251189@main

Modified Paths

trunk/Source/WebCore/rendering/RenderBox.cpp


Added Paths

trunk/LayoutTests/fast/block/fill-available-with-no-specified-containing-block-height-expected.html
trunk/LayoutTests/fast/block/fill-available-with-no-specified-containing-block-height.html




Diff

Added: trunk/LayoutTests/fast/block/fill-available-with-no-specified-containing-block-height-expected.html (0 => 295094)

--- trunk/LayoutTests/fast/block/fill-available-with-no-specified-containing-block-height-expected.html	(rev 0)
+++ trunk/LayoutTests/fast/block/fill-available-with-no-specified-containing-block-height-expected.html	2022-06-01 17:26:14 UTC (rev 295094)
@@ -0,0 +1,8 @@
+
+div {
+  width: 100px;
+  height: 100px;
+  background-color: green;
+}
+
+


Added: trunk/LayoutTests/fast/block/fill-available-with-no-specified-containing-block-height.html (0 => 295094)

--- trunk/LayoutTests/fast/block/fill-available-with-no-specified-containing-block-height.html	(rev 0)
+++ trunk/LayoutTests/fast/block/fill-available-with-no-specified-containing-block-height.html	2022-06-01 17:26:14 UTC (rev 295094)
@@ -0,0 +1,21 @@
+
+.container {
+  width: 100px;
+  background-color: red;
+}
+
+.fill {
+  height: -webkit-fill-available;
+}
+
+.overflow-sibling {
+  width: 100px;
+  height: 100px;
+  background-color: green;
+}
+
+
+
+  
+  
+


Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (295093 => 295094)

--- trunk/Source/WebCore/rendering/RenderBox.cpp	2022-06-01 17:04:02 UTC (rev 295093)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2022-06-01 17:26:14 UTC (rev 295094)
@@ -3259,6 +3259,11 @@
 return std::nullopt;
 }
 
+static inline bool isOrthogonal(const RenderBox& renderer, const RenderElement& ancestor)
+{
+return renderer.isHorizontalWritingMode() != ancestor.isHorizontalWritingMode();
+}
+
 std::optional RenderBox::computeIntrinsicLogicalContentHeightUsing(Length logicalHeightLength, std::optional intrinsicContentHeight, LayoutUnit borderAndPadding) const
 {
 // FIXME: The CSS sizing spec is considering changing what min-content/max-content should resolve to.
@@ -3266,10 +3271,33 @@
 if (logicalHeightLength.isMinContent() || logicalHeightLength.isMaxContent() || logicalHeightLength.isFitContent() || logicalHeightLength.isLegacyIntrinsic()) {
 if (intrinsicContentHeight)
 return adjustIntrinsicLogicalHeightForBoxSizing(intrinsicContentHeight.value());
-return std::nullopt;
+return { };
 }
-if (logicalHeightLength.isFillAvailable())
-return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadding) - borderAndPadding;
+if (logicalHeightLength.isFillAvailable()) {
+auto* containingBlock = this->containingBlock();
+
+auto canResolveAvailableSpace = [&] {
+// FIXME: We need to find a way to say: yes, the constraint value is set and we can resolve height against it.
+// Until then, this is mostly just guesswork.
+if (!containingBlock)
+return false;
+auto containingBlockHasSpecifiedSpace = [&] {
+auto isOrthogonal = WebCore::isOrthogonal(*this, *containingBlock);
+auto& style = containingBlock->style();
+if ((!isOrthogonal && style.height().isSpecified()) || (isOrthogonal && style.width().isSpecified()))
+return true;
+if (containingBlock->isOutOfFlowPositioned()) {
+if ((!isOrthogonal && !style.top().isAuto() && !style.bottom().isAuto()) || (isOrthogonal && !style.left().isAuto() && !style.right().isAuto()))
+return true;
+}
+return false;
+};
+return containingBlockHasSpecifiedSpace() || containingBlock->hasOverridingLogicalHeight();
+};
+if (canResolveAvailableSpace())
+return 

[webkit-changes] [295081] trunk/Source/WebCore/layout/formattingContexts/flex/ FlexFormattingContext.cpp

2022-05-31 Thread zalan
Title: [295081] trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp








Revision 295081
Author za...@apple.com
Date 2022-05-31 22:27:39 -0700 (Tue, 31 May 2022)


Log Message
DOM order may not be sufficient when constructing the LogicalFlexItemList
https://bugs.webkit.org/show_bug.cgi?id=241166

Reviewed by Antti Koivisto.

We need to hold on to a reference to the layout box in case logical order != DOM order.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::convertFlexItemsToLogicalSpace):

Canonical link: https://commits.webkit.org/251176@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (295080 => 295081)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-06-01 05:00:40 UTC (rev 295080)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-06-01 05:27:39 UTC (rev 295081)
@@ -152,6 +152,7 @@
 struct FlexItem {
 FlexRect marginRect;
 int logicalOrder { 0 };
+CheckedPtr layoutBox;
 };
 
 auto& formattingState = this->formattingState();
@@ -201,7 +202,7 @@
 flexItemsNeedReordering = flexItemsNeedReordering || flexItemOrder != previousLogicalOrder.value_or(0);
 previousLogicalOrder = flexItemOrder;
 
-flexItemList.append({ { logicalSize }, flexItemOrder });
+flexItemList.append({ { logicalSize }, flexItemOrder, downcast(flexItem) });
 }
 };
 convertVisualToLogical();
@@ -217,11 +218,8 @@
 reorderFlexItemsIfApplicable();
 
 auto logicalFlexItemList = FlexLayout::LogicalFlexItems(flexItemList.size());
-auto* layoutBox = root().firstInFlowChild();
-for (size_t index = 0; index < flexItemList.size(); ++index) {
-logicalFlexItemList[index] = { flexItemList[index].marginRect, downcast(layoutBox) };
-layoutBox = layoutBox->nextInFlowSibling();
-}
+for (size_t index = 0; index < flexItemList.size(); ++index)
+logicalFlexItemList[index] = { flexItemList[index].marginRect, flexItemList[index].layoutBox };
 return logicalFlexItemList;
 }
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295051] trunk/Source/WebCore/layout

2022-05-31 Thread zalan
Title: [295051] trunk/Source/WebCore/layout








Revision 295051
Author za...@apple.com
Date 2022-05-31 06:41:03 -0700 (Tue, 31 May 2022)


Log Message
Add support for margin: auto
https://bugs.webkit.org/show_bug.cgi?id=24

Reviewed by Antti Koivisto.

Auto margins take up all of the space that they can in their axis.
1. compute the space 'margin: auto' can take
2. distribute it among flex items with 'margin: auto'
3. adjust final top/left with the computed margin

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::computedAutoMarginValueForFlexItems):
(WebCore::Layout::FlexFormattingContext::convertFlexItemsToLogicalSpace):
(WebCore::Layout::FlexFormattingContext::setFlexItemsGeometry):
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h:

Canonical link: https://commits.webkit.org/251146@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (295050 => 295051)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-31 13:39:54 UTC (rev 295050)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-31 13:41:03 UTC (rev 295051)
@@ -119,8 +119,36 @@
 }
 }
 
-FlexLayout::LogicalFlexItems FlexFormattingContext::convertFlexItemsToLogicalSpace()
+std::optional FlexFormattingContext::computedAutoMarginValueForFlexItems(const ConstraintsForFlexContent& constraints)
 {
+auto flexDirection = root().style().flexDirection();
+auto flexDirectionIsInlineAxis = flexDirection == FlexDirection::Row || flexDirection == FlexDirection::RowReverse;
+auto availableSpace = flexDirectionIsInlineAxis ? std::make_optional(constraints.horizontal().logicalWidth) : constraints.availableVerticalSpace();
+if (!availableSpace)
+return { };
+
+size_t autoMarginCount = 0;
+auto logicalWidth = LayoutUnit { };
+
+for (auto* flexItem = root().firstInFlowChild(); flexItem; flexItem = flexItem->nextInFlowSibling()) {
+auto& flexItemStyle = flexItem->style();
+auto hasAutoMarginStart = flexDirectionIsInlineAxis ? flexItemStyle.marginStart().isAuto() : flexItemStyle.marginBefore().isAuto();
+auto hasAutoMarginEnd = flexDirectionIsInlineAxis ? flexItemStyle.marginEnd().isAuto() : flexItemStyle.marginAfter().isAuto();
+if (hasAutoMarginStart)
+++autoMarginCount;
+if (hasAutoMarginEnd)
+++autoMarginCount;
+
+auto& flexItemGeometry = formattingState().boxGeometry(*flexItem);
+logicalWidth += flexDirectionIsInlineAxis ? flexItemGeometry.marginBoxWidth() : flexItemGeometry.marginBoxHeight();
+}
+if (autoMarginCount)
+return std::max(0_lu, *availableSpace - logicalWidth) / autoMarginCount;
+return { };
+}
+
+FlexLayout::LogicalFlexItems FlexFormattingContext::convertFlexItemsToLogicalSpace(const ConstraintsForFlexContent& constraints)
+{
 struct FlexItem {
 FlexRect marginRect;
 int logicalOrder { 0 };
@@ -129,6 +157,7 @@
 auto& formattingState = this->formattingState();
 Vector flexItemList;
 auto flexItemsNeedReordering = false;
+auto autoMarginValue = computedAutoMarginValueForFlexItems(constraints);
 
 auto convertVisualToLogical = [&] {
 auto direction = root().style().flexDirection();
@@ -136,22 +165,39 @@
 
 for (auto* flexItem = root().firstInFlowChild(); flexItem; flexItem = flexItem->nextInFlowSibling()) {
 auto& flexItemGeometry = formattingState.boxGeometry(*flexItem);
+auto& flexItemStyle = flexItem->style();
 auto logicalSize = LayoutSize { };
 
 switch (direction) {
 case FlexDirection::Row:
-case FlexDirection::RowReverse:
+case FlexDirection::RowReverse: {
+auto hasAutoMarginStart = flexItemStyle.marginStart().isAuto();
+auto hasAutoMarginEnd = flexItemStyle.marginEnd().isAuto();
+if (autoMarginValue && (hasAutoMarginStart || hasAutoMarginEnd)) {
+auto horizontalMargin = flexItemGeometry.horizontalMargin();
+horizontalMargin = { hasAutoMarginStart ? *autoMarginValue : horizontalMargin.start, hasAutoMarginEnd ? *autoMarginValue : horizontalMargin.end };
+flexItemGeometry.setHorizontalMargin(horizontalMargin);
+}
 logicalSize = { flexItemGeometry.marginBoxWidth(), flexItemGeometry.marginBoxHeight() };
 break;
+}
 case FlexDirection::Column:
-case 

[webkit-changes] [295039] trunk/Source/WebCore

2022-05-30 Thread zalan
Title: [295039] trunk/Source/WebCore








Revision 295039
Author za...@apple.com
Date 2022-05-30 18:26:39 -0700 (Mon, 30 May 2022)


Log Message
Move core flex layout to FlexLayout
https://bugs.webkit.org/show_bug.cgi?id=241106

Reviewed by Antti Koivisto.

* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::convertFlexItemsToLogicalSpace):
(WebCore::Layout::FlexFormattingContext::setFlexItemsGeometry):
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
(WebCore::Layout::FlexFormattingContext::computeAvailableLogicalVerticalSpace const): Deleted.
(WebCore::Layout::FlexFormattingContext::computeAvailableLogicalHorizontalSpace const): Deleted.
(WebCore::Layout::FlexFormattingContext::computeLogicalWidthForShrinkingFlexItems): Deleted.
(WebCore::Layout::FlexFormattingContext::computeLogicalWidthForStretchingFlexItems): Deleted.
(WebCore::Layout::FlexFormattingContext::computeLogicalWidthForFlexItems): Deleted.
(WebCore::Layout::FlexFormattingContext::computeLogicalHeightForFlexItems): Deleted.
(WebCore::Layout::FlexFormattingContext::alignFlexItems): Deleted.
(WebCore::Layout::FlexFormattingContext::justifyFlexItems): Deleted.
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h:
* Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp: Added.
(WebCore::Layout::FlexLayout::FlexLayout):
(WebCore::Layout::FlexLayout::computeAvailableLogicalVerticalSpace const):
(WebCore::Layout::FlexLayout::computeAvailableLogicalHorizontalSpace const):
(WebCore::Layout::FlexLayout::computeLogicalWidthForShrinkingFlexItems):
(WebCore::Layout::FlexLayout::computeLogicalWidthForStretchingFlexItems):
(WebCore::Layout::FlexLayout::computeLogicalWidthForFlexItems):
(WebCore::Layout::FlexLayout::computeLogicalHeightForFlexItems):
(WebCore::Layout::FlexLayout::alignFlexItems):
(WebCore::Layout::FlexLayout::justifyFlexItems):
(WebCore::Layout::FlexLayout::layout):
* Source/WebCore/layout/formattingContexts/flex/FlexLayout.h: Copied from Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h.
(WebCore::Layout::FlexLayout::formattingState const):
(WebCore::Layout::FlexLayout::flexBoxStyle const):

Canonical link: https://commits.webkit.org/251134@main

Modified Paths

trunk/Source/WebCore/Headers.cmake
trunk/Source/WebCore/Sources.txt
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h


Added Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp
trunk/Source/WebCore/layout/formattingContexts/flex/FlexLayout.h




Diff

Modified: trunk/Source/WebCore/Headers.cmake (295038 => 295039)

--- trunk/Source/WebCore/Headers.cmake	2022-05-30 23:59:45 UTC (rev 295038)
+++ trunk/Source/WebCore/Headers.cmake	2022-05-31 01:26:39 UTC (rev 295039)
@@ -982,6 +982,7 @@
 
 layout/formattingContexts/flex/FlexFormattingConstraints.h
 layout/formattingContexts/flex/FlexFormattingState.h
+layout/formattingContexts/flex/FlexLayout.h
 
 layout/formattingContexts/inline/display/InlineDisplayBox.h
 layout/formattingContexts/inline/InlineRect.h


Modified: trunk/Source/WebCore/Sources.txt (295038 => 295039)

--- trunk/Source/WebCore/Sources.txt	2022-05-30 23:59:45 UTC (rev 295038)
+++ trunk/Source/WebCore/Sources.txt	2022-05-31 01:26:39 UTC (rev 295039)
@@ -1567,6 +1567,7 @@
 layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingQuirks.cpp
 layout/formattingContexts/flex/FlexFormattingContext.cpp
 layout/formattingContexts/flex/FlexFormattingGeometry.cpp
+layout/formattingContexts/flex/FlexLayout.cpp
 layout/formattingContexts/flex/FlexFormattingState.cpp
 layout/floats/FloatAvoider.cpp
 layout/floats/FloatingContext.cpp


Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (295038 => 295039)

--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-05-30 23:59:45 UTC (rev 295038)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-05-31 01:26:39 UTC (rev 295039)
@@ -2220,6 +2220,7 @@
 		6ED878C5147493F4004C3597 /* RenderTableCaption.h in Headers */ = {isa = PBXBuildFile; fileRef = 6ED878C3147493F4004C3597 /* RenderTableCaption.h */; };
 		6ED8C37A183BFF8C009E53BD /* BoxShape.h in Headers */ = {isa = PBXBuildFile; fileRef = 6ED8C378183BFF8C009E53BD /* BoxShape.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6EE8A77310F803F3005A4A24 /* JSWebGLContextAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */; };
+		6F047A9228453EDB00C25EE7 /* FlexLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F047A9128453EDB00C25EE7 /* FlexLayout.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6F0B98B523F268EC00EEC2F2 

[webkit-changes] [295032] trunk/Source/WebCore/layout/formattingContexts/flex/ FlexFormattingContext.cpp

2022-05-30 Thread zalan
Title: [295032] trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp








Revision 295032
Author za...@apple.com
Date 2022-05-30 11:07:24 -0700 (Mon, 30 May 2022)


Log Message
Add support for justify-content: space-evenly
https://bugs.webkit.org/show_bug.cgi?id=241085

Reviewed by Antti Koivisto.

Distribute items evenly. Items have equal space around them.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::justifyFlexItems):

Canonical link: https://commits.webkit.org/251127@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (295031 => 295032)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-30 16:48:03 UTC (rev 295031)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-30 18:07:24 UTC (rev 295032)
@@ -476,6 +476,8 @@
 return LayoutUnit { };
 case ContentDistribution::SpaceAround:
 return (availableSpace - contentLogicalWidth) / logicalFlexItemList.size() / 2; 
+case ContentDistribution::SpaceEvenly:
+return (availableSpace - contentLogicalWidth) / (logicalFlexItemList.size() + 1);
 default:
 ASSERT_NOT_IMPLEMENTED_YET();
 break;
@@ -511,6 +513,8 @@
 return (availableSpace - contentLogicalWidth) / (logicalFlexItemList.size() - 1); 
 case ContentDistribution::SpaceAround:
 return (availableSpace - contentLogicalWidth) / logicalFlexItemList.size(); 
+case ContentDistribution::SpaceEvenly:
+return (availableSpace - contentLogicalWidth) / (logicalFlexItemList.size() + 1);
 default:
 ASSERT_NOT_IMPLEMENTED_YET();
 break;






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295030] trunk/Source/WebCore/layout/formattingContexts/flex/ FlexFormattingContext.cpp

2022-05-30 Thread zalan
Title: [295030] trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp








Revision 295030
Author za...@apple.com
Date 2022-05-30 09:44:45 -0700 (Mon, 30 May 2022)


Log Message
Add support for justify-content: space-around
https://bugs.webkit.org/show_bug.cgi?id=241084

Reviewed by Antti Koivisto.

Distribute items evenly. Items have a half-size space on either end.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::justifyFlexItems):

Canonical link: https://commits.webkit.org/251125@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (295029 => 295030)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-30 15:20:07 UTC (rev 295029)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-30 16:44:45 UTC (rev 295030)
@@ -474,6 +474,8 @@
 break;
 case ContentDistribution::SpaceBetween:
 return LayoutUnit { };
+case ContentDistribution::SpaceAround:
+return (availableSpace - contentLogicalWidth) / logicalFlexItemList.size() / 2; 
 default:
 ASSERT_NOT_IMPLEMENTED_YET();
 break;
@@ -507,6 +509,8 @@
 if (logicalFlexItemList.size() == 1)
 return LayoutUnit { };
 return (availableSpace - contentLogicalWidth) / (logicalFlexItemList.size() - 1); 
+case ContentDistribution::SpaceAround:
+return (availableSpace - contentLogicalWidth) / logicalFlexItemList.size(); 
 default:
 ASSERT_NOT_IMPLEMENTED_YET();
 break;






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295027] trunk/Source/WebCore/layout/formattingContexts/flex/ FlexFormattingContext.cpp

2022-05-30 Thread zalan
Title: [295027] trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp








Revision 295027
Author za...@apple.com
Date 2022-05-30 07:10:13 -0700 (Mon, 30 May 2022)


Log Message
Add support for justify-content: space-between
https://bugs.webkit.org/show_bug.cgi?id=241080

Reviewed by Antti Koivisto.

Distribute items evenly. The first item is flush with the start, the last is flush with the end.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::justifyFlexItems):
* Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForFlexLayout):

Canonical link: https://commits.webkit.org/251122@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (295026 => 295027)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-30 14:05:27 UTC (rev 295026)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-30 14:10:13 UTC (rev 295027)
@@ -459,14 +459,25 @@
 void FlexFormattingContext::justifyFlexItems(LogicalFlexItems& logicalFlexItemList, LayoutUnit availableSpace)
 {
 auto justifyContent = root().style().justifyContent();
+// FIXME: Make this optional.
+auto contentLogicalWidth = [&] {
+auto logicalWidth = LayoutUnit { };
+for (auto& logicalFlexItem : logicalFlexItemList)
+logicalWidth += logicalFlexItem.rect.width();
+return logicalWidth;
+}();
 
 auto initialOffset = [&] {
-auto contentLogicalWidth = [&] {
-auto logicalWidth = LayoutUnit { };
-for (auto& logicalFlexItem : logicalFlexItemList)
-logicalWidth += logicalFlexItem.rect.width();
-return logicalWidth;
-};
+switch (justifyContent.distribution()) {
+case ContentDistribution::Default:
+// Fall back to justifyContent.position() 
+break;
+case ContentDistribution::SpaceBetween:
+return LayoutUnit { };
+default:
+ASSERT_NOT_IMPLEMENTED_YET();
+break;
+}
 
 switch (justifyContent.position()) {
 case ContentPosition::Normal:
@@ -477,20 +488,38 @@
 case ContentPosition::End:
 case ContentPosition::FlexEnd:
 case ContentPosition::Right:
-return availableSpace - contentLogicalWidth();
+return availableSpace - contentLogicalWidth;
 case ContentPosition::Center:
-return availableSpace / 2 - contentLogicalWidth() / 2;
+return availableSpace / 2 - contentLogicalWidth / 2;
 default:
 ASSERT_NOT_IMPLEMENTED_YET();
 break;
 }
+ASSERT_NOT_REACHED();
 return LayoutUnit { };
 };
 
+auto gapBetweenItems = [&] {
+switch (justifyContent.distribution()) {
+case ContentDistribution::Default:
+return LayoutUnit { };
+case ContentDistribution::SpaceBetween:
+if (logicalFlexItemList.size() == 1)
+return LayoutUnit { };
+return (availableSpace - contentLogicalWidth) / (logicalFlexItemList.size() - 1); 
+default:
+ASSERT_NOT_IMPLEMENTED_YET();
+break;
+}
+ASSERT_NOT_REACHED();
+return LayoutUnit { };
+};
+
 auto logicalLeft = initialOffset();
+auto gap = gapBetweenItems();
 for (auto& logicalFlexItem : logicalFlexItemList) {
 logicalFlexItem.rect.setLeft(logicalLeft);
-logicalLeft = logicalFlexItem.rect.right();
+logicalLeft = logicalFlexItem.rect.right() + gap;
 }
 }
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295016] trunk/Source/WebCore/layout/formattingContexts/flex/ FlexFormattingContext.cpp

2022-05-29 Thread zalan
Title: [295016] trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp








Revision 295016
Author za...@apple.com
Date 2022-05-29 08:34:33 -0700 (Sun, 29 May 2022)


Log Message
Add support for align-self
https://bugs.webkit.org/show_bug.cgi?id=241071

Reviewed by Antti Koivisto.

Align-items behavior can be overwritten for individual flex items by applying the align-self property to them.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::alignFlexItems):

Canonical link: https://commits.webkit.org/25@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (295015 => 295016)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-29 14:03:48 UTC (rev 295015)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-29 15:34:33 UTC (rev 295016)
@@ -428,10 +428,12 @@
 void FlexFormattingContext::alignFlexItems(LogicalFlexItems& logicalFlexItemList, LayoutUnit availableSpace)
 {
 // FIXME: Check if height computation and vertical alignment should merge.
-auto alignItems = root().style().alignItems();
+auto flexBoxAlignItems = root().style().alignItems();
 
 for (auto& logicalFlexItem : logicalFlexItemList) {
-switch (alignItems.position()) {
+auto& flexItemAlignSelf = logicalFlexItem.layoutBox->style().alignSelf();
+auto alignValue = flexItemAlignSelf.position() != ItemPosition::Auto ? flexItemAlignSelf : flexBoxAlignItems;
+switch (alignValue.position()) {
 case ItemPosition::Normal:
 case ItemPosition::Stretch:
 logicalFlexItem.rect.setTop({ });






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295014] trunk/Source/WebCore/layout/formattingContexts/flex/ FlexFormattingContext.cpp

2022-05-29 Thread zalan
Title: [295014] trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp








Revision 295014
Author za...@apple.com
Date 2022-05-29 06:44:35 -0700 (Sun, 29 May 2022)


Log Message
Add support for flex-start/flex-end/start/end alignment
https://bugs.webkit.org/show_bug.cgi?id=241067

Reviewed by Antti Koivisto.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::computeLogicalHeightForFlexItems):
(WebCore::Layout::FlexFormattingContext::alignFlexItems):

Canonical link: https://commits.webkit.org/251109@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (295013 => 295014)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-29 13:22:03 UTC (rev 295013)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-29 13:44:35 UTC (rev 295014)
@@ -392,6 +392,10 @@
 logicalFlexItem.rect.setHeight(*availableSpace);
 break;
 case ItemPosition::Center:
+case ItemPosition::Start:
+case ItemPosition::FlexStart:
+case ItemPosition::End:
+case ItemPosition::FlexEnd:
 break;
 default:
 ASSERT_NOT_IMPLEMENTED_YET();
@@ -415,6 +419,14 @@
 case ItemPosition::Center:
 logicalFlexItem.rect.setTop({ *availableSpace / 2 -  logicalFlexItem.rect.height() / 2 });
 break;
+case ItemPosition::Start:
+case ItemPosition::FlexStart:
+logicalFlexItem.rect.setTop({ });
+break;
+case ItemPosition::End:
+case ItemPosition::FlexEnd:
+logicalFlexItem.rect.setTop({ *availableSpace - logicalFlexItem.rect.height() });
+break;
 default:
 ASSERT_NOT_IMPLEMENTED_YET();
 break;






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [295000] trunk/Source/WebCore/layout/formattingContexts/flex/ FlexFormattingContext.cpp

2022-05-28 Thread zalan
Title: [295000] trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp








Revision 295000
Author za...@apple.com
Date 2022-05-28 09:18:55 -0700 (Sat, 28 May 2022)


Log Message
Transition flex-grow computation to flex-basis based
https://bugs.webkit.org/show_bug.cgi?id=241057

Reviewed by Antti Koivisto.

1. Introduce StrechingFlexItem to cache growth related values
2. Use flex-basis as the base for the flex grow computation
3. Compute the final logical width values
(This is very similar to how we compute "shrink values".)

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::computeLogicalWidthForShrinkingFlexItems):
(WebCore::Layout::FlexFormattingContext::computeLogicalWidthForStretchingFlexItems):

Canonical link: https://commits.webkit.org/251098@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (294999 => 295000)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-28 13:26:40 UTC (rev 294999)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-28 16:18:55 UTC (rev 295000)
@@ -224,8 +224,7 @@
 auto computeTotalShrinkAndOverflowingSpace = [&] {
 // Collect flex items with non-zero flex-shrink value. flex-shrink: 0 flex items
 // don't participate in content flexing.
-for (size_t index = 0; index < logicalFlexItemList.size(); ++index) {
-auto& flexItem = logicalFlexItemList[index];
+for (auto& flexItem : logicalFlexItemList) {
 auto& style = flexItem.layoutBox->style();
 auto baseSize = style.flexBasis().isFixed() ? LayoutUnit { style.flexBasis().value() } : flexItem.rect.width();
 if (auto shrinkValue = style.flexShrink()) {
@@ -277,64 +276,68 @@
 {
 auto& formattingState = this->formattingState();
 
+auto totalFlexibleSpace = LayoutUnit { };
 auto totalGrowth = 0.f;
 auto flexGrowBase = 0.f;
-Vector stretchingItems;
+struct StrechingFlexItem {
+float flexGrow { 0 };
+LayoutUnit minimumSize;
+LayoutUnit flexBasis;
+LogicalFlexItem& flexItem;
+bool isFrozen { false };
+};
+Vector stretchingItems;
 
 auto computeTotalGrowthAndFlexibleSpace = [&] {
 // Collect flex items with non-zero flex-grow value. flex-grow: 0 (initial) flex items
 // don't participate in available space distribution.
-for (size_t index = 0; index < logicalFlexItemList.size(); ++index) {
-auto& logicalFlexItem = logicalFlexItemList[index];
-if (auto flexGrow = logicalFlexItem.layoutBox->style().flexGrow()) {
-stretchingItems.append(index);
+for (auto& flexItem : logicalFlexItemList) {
+auto& style = flexItem.layoutBox->style();
+auto baseSize = style.flexBasis().isFixed() ? LayoutUnit { style.flexBasis().value() } : flexItem.rect.width();
+if (auto growValue = style.flexGrow()) {
+auto flexGrow = growValue * baseSize;
+stretchingItems.append({ flexGrow, formattingState.intrinsicWidthConstraintsForBox(*flexItem.layoutBox)->minimum, baseSize, flexItem, { } });
 totalGrowth += flexGrow;
+totalFlexibleSpace += baseSize;
 } else
-availableSpace -= logicalFlexItem.rect.width();
+availableSpace -= baseSize;
 }
 if (totalGrowth)
-flexGrowBase = availableSpace / totalGrowth;
+flexGrowBase = (availableSpace - totalFlexibleSpace) / totalGrowth;
 };
 computeTotalGrowthAndFlexibleSpace();
 if (!totalGrowth)
 return;
 
-auto totalLogicalWidth = [&] {
+auto adjustGrowthBase = [&] {
 // This is where we compute how much space the flexing boxes take up if we just
 // let them flex by their flex-grow value. Note that we can't size them below their minimum content width.
 // Such flex items are removed from the final overflow distribution.
 auto accumulatedWidth = LayoutUnit { };
-for (auto flexItemIndex : stretchingItems) {
-auto& flexItem = logicalFlexItemList[flexItemIndex];
-
-auto flexGrow = flexItem.layoutBox->style().flexGrow();
-auto flexedSize = flexGrow * flexGrowBase;
-auto minimumSize = formattingState.intrinsicWidthConstraintsForBox(*flexItem.layoutBox)->minimum;
-if (minimumSize >= flexedSize) {
-accumulatedWidth += minimumSize;
-totalGrowth -= flexGrow;
-} else
-accumulatedWidth += flexedSize;
+while (true) {
+auto didFreeze = false;
+for (auto& stretchingFlex : stretchingItems) {
+auto 

[webkit-changes] [294996] trunk/Source/WebCore/layout/formattingContexts/flex/ FlexFormattingContext.cpp

2022-05-28 Thread zalan
Title: [294996] trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp








Revision 294996
Author za...@apple.com
Date 2022-05-28 06:21:48 -0700 (Sat, 28 May 2022)


Log Message
Use flex-basis when shrinking flex items
https://bugs.webkit.org/show_bug.cgi?id=241046

Reviewed by Antti Koivisto.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::computeLogicalWidthForShrinkingFlexItems):

Canonical link: https://commits.webkit.org/251096@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (294995 => 294996)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-28 13:06:19 UTC (rev 294995)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-28 13:21:48 UTC (rev 294996)
@@ -226,8 +226,9 @@
 // don't participate in content flexing.
 for (size_t index = 0; index < logicalFlexItemList.size(); ++index) {
 auto& flexItem = logicalFlexItemList[index];
-auto baseSize = flexItem.rect.width();
-if (auto shrinkValue = flexItem.layoutBox->style().flexShrink()) {
+auto& style = flexItem.layoutBox->style();
+auto baseSize = style.flexBasis().isFixed() ? LayoutUnit { style.flexBasis().value() } : flexItem.rect.width();
+if (auto shrinkValue = style.flexShrink()) {
 auto flexShrink = shrinkValue * baseSize;
 shrinkingItems.append({ flexShrink, formattingState.intrinsicWidthConstraintsForBox(*flexItem.layoutBox)->minimum, baseSize, flexItem, { } });
 totalShrink += flexShrink;






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [294995] trunk/Source/WebCore/layout/formattingContexts/flex/ FlexFormattingContext.cpp

2022-05-28 Thread zalan
Title: [294995] trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp








Revision 294995
Author za...@apple.com
Date 2022-05-28 06:06:19 -0700 (Sat, 28 May 2022)


Log Message
Introduce the concept of frozen flex items
https://bugs.webkit.org/show_bug.cgi?id=241034

Reviewed by Antti Koivisto.

When a shrinking flex item gets too small, we exclude it from the shrinking algorithm and recompute the shrink factor. However the new shrink factor could make additional flex items too small.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::computeLogicalWidthForShrinkingFlexItems):

Canonical link: https://commits.webkit.org/251095@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (294994 => 294995)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-28 12:43:31 UTC (rev 294994)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-28 13:06:19 UTC (rev 294995)
@@ -217,6 +217,7 @@
 LayoutUnit minimumSize;
 LayoutUnit flexBasis;
 LogicalFlexItem& flexItem;
+bool isFrozen { false };
 };
 Vector shrinkingItems;
 
@@ -228,7 +229,7 @@
 auto baseSize = flexItem.rect.width();
 if (auto shrinkValue = flexItem.layoutBox->style().flexShrink()) {
 auto flexShrink = shrinkValue * baseSize;
-shrinkingItems.append({ flexShrink, formattingState.intrinsicWidthConstraintsForBox(*flexItem.layoutBox)->minimum, baseSize, flexItem });
+shrinkingItems.append({ flexShrink, formattingState.intrinsicWidthConstraintsForBox(*flexItem.layoutBox)->minimum, baseSize, flexItem, { } });
 totalShrink += flexShrink;
 totalFlexibleSpace += baseSize;
 } else
@@ -242,15 +243,22 @@
 auto adjustShrinkBase = [&] {
 // Now that we know how much each flex item needs to be shrunk, let's check
 // if they hit their minimum content width (i.e. whether they can be sized that small).
-for (auto& shirinkingFlex : shrinkingItems) {
-auto flexedSize = shirinkingFlex.flexBasis - (shirinkingFlex.flexShrink * flexShrinkBase);
-if (shirinkingFlex.minimumSize > flexedSize) {
-totalShrink -= shirinkingFlex.flexShrink;
-totalFlexibleSpace -= shirinkingFlex.flexBasis;
-availableSpace -= shirinkingFlex.minimumSize;
+while (true) {
+auto didFreeze = false;
+for (auto& shirinkingFlex : shrinkingItems) {
+auto flexedSize = shirinkingFlex.flexBasis - (shirinkingFlex.flexShrink * flexShrinkBase);
+if (!shirinkingFlex.isFrozen && shirinkingFlex.minimumSize > flexedSize) {
+shirinkingFlex.isFrozen = true;
+didFreeze = true;
+totalShrink -= shirinkingFlex.flexShrink;
+totalFlexibleSpace -= shirinkingFlex.flexBasis;
+availableSpace -= shirinkingFlex.minimumSize;
+}
 }
+if (!didFreeze)
+break;
+flexShrinkBase = totalShrink ? (totalFlexibleSpace - availableSpace) / totalShrink : 0.f;
 }
-flexShrinkBase = totalShrink ? (totalFlexibleSpace - availableSpace) / totalShrink : 0.f;
 };
 adjustShrinkBase();
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [294994] trunk/Source/WebCore/layout/formattingContexts/flex/ FlexFormattingContext.cpp

2022-05-28 Thread zalan
Title: [294994] trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp








Revision 294994
Author za...@apple.com
Date 2022-05-28 05:43:31 -0700 (Sat, 28 May 2022)


Log Message
Introduce ShrinkingFlexItem structure
https://bugs.webkit.org/show_bug.cgi?id=241033

Reviewed by Antti Koivisto.

This local structure caches some of the shrinking related values.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::computeLogicalWidthForShrinkingFlexItems):

Canonical link: https://commits.webkit.org/251094@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (294993 => 294994)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-28 10:43:58 UTC (rev 294993)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-28 12:43:31 UTC (rev 294994)
@@ -211,8 +211,15 @@
 auto totalShrink = 0.f;
 auto totalFlexibleSpace = LayoutUnit { };
 auto flexShrinkBase = 0.f;
-Vector shrinkingItems;
 
+struct ShrinkingFlexItem {
+float flexShrink { 0 };
+LayoutUnit minimumSize;
+LayoutUnit flexBasis;
+LogicalFlexItem& flexItem;
+};
+Vector shrinkingItems;
+
 auto computeTotalShrinkAndOverflowingSpace = [&] {
 // Collect flex items with non-zero flex-shrink value. flex-shrink: 0 flex items
 // don't participate in content flexing.
@@ -219,9 +226,10 @@
 for (size_t index = 0; index < logicalFlexItemList.size(); ++index) {
 auto& flexItem = logicalFlexItemList[index];
 auto baseSize = flexItem.rect.width();
-if (auto flexShrink = flexItem.layoutBox->style().flexShrink()) {
-shrinkingItems.append(index);
-totalShrink += flexShrink * baseSize;
+if (auto shrinkValue = flexItem.layoutBox->style().flexShrink()) {
+auto flexShrink = shrinkValue * baseSize;
+shrinkingItems.append({ flexShrink, formattingState.intrinsicWidthConstraintsForBox(*flexItem.layoutBox)->minimum, baseSize, flexItem });
+totalShrink += flexShrink;
 totalFlexibleSpace += baseSize;
 } else
 availableSpace -= baseSize;
@@ -234,17 +242,12 @@
 auto adjustShrinkBase = [&] {
 // Now that we know how much each flex item needs to be shrunk, let's check
 // if they hit their minimum content width (i.e. whether they can be sized that small).
-for (auto flexItemIndex : shrinkingItems) {
-auto& flexItem = logicalFlexItemList[flexItemIndex];
-
-auto baseSize = flexItem.rect.width();
-auto flexShrink = flexItem.layoutBox->style().flexShrink() * baseSize;
-auto flexedSize = baseSize - (flexShrink * flexShrinkBase);
-auto minimumSize = formattingState.intrinsicWidthConstraintsForBox(*flexItem.layoutBox)->minimum;
-if (minimumSize >= flexedSize) {
-totalShrink -= flexShrink;
-totalFlexibleSpace -= baseSize;
-availableSpace -= minimumSize;
+for (auto& shirinkingFlex : shrinkingItems) {
+auto flexedSize = shirinkingFlex.flexBasis - (shirinkingFlex.flexShrink * flexShrinkBase);
+if (shirinkingFlex.minimumSize > flexedSize) {
+totalShrink -= shirinkingFlex.flexShrink;
+totalFlexibleSpace -= shirinkingFlex.flexBasis;
+availableSpace -= shirinkingFlex.minimumSize;
 }
 }
 flexShrinkBase = totalShrink ? (totalFlexibleSpace - availableSpace) / totalShrink : 0.f;
@@ -253,14 +256,9 @@
 
 auto computeLogicalWidth = [&] {
 // Adjust the total grow width by the overflow value (shrink) except when min content with disagrees.
-for (auto flexItemIndex : shrinkingItems) {
-auto& flexItem = logicalFlexItemList[flexItemIndex];
-
-auto baseSize = flexItem.rect.width();
-auto flexShrink = flexItem.layoutBox->style().flexShrink() * baseSize;
-auto flexedSize = LayoutUnit { baseSize - (flexShrink * flexShrinkBase) };
-auto minimumSize = formattingState.intrinsicWidthConstraintsForBox(*flexItem.layoutBox)->minimum;
-flexItem.rect.setWidth(std::max(minimumSize, flexedSize));
+for (auto& shirinkingFlex : shrinkingItems) {
+auto flexedSize = LayoutUnit { shirinkingFlex.flexBasis - (shirinkingFlex.flexShrink * flexShrinkBase) };
+shirinkingFlex.flexItem.rect.setWidth(std::max(shirinkingFlex.minimumSize, flexedSize));
 }
 };
 computeLogicalWidth();






___
webkit-changes mailing list
webkit-changes@lists.webkit.org

[webkit-changes] [294983] trunk/Source/WebCore/layout/formattingContexts/flex/ FlexFormattingContext.cpp

2022-05-27 Thread zalan
Title: [294983] trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp








Revision 294983
Author za...@apple.com
Date 2022-05-27 21:10:06 -0700 (Fri, 27 May 2022)


Log Message
Introduce base-size to the flex algorithm
https://bugs.webkit.org/show_bug.cgi?id=241001

Reviewed by Antti Koivisto.

This is in preparation for supporting flex-basis, where the flex-basis value is used as the base for flexing.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::computeLogicalWidthForShrinkingFlexItems):
(WebCore::Layout::FlexFormattingContext::computeLogicalWidthForFlexItems):

Canonical link: https://commits.webkit.org/251087@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (294982 => 294983)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-28 04:05:00 UTC (rev 294982)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-28 04:10:06 UTC (rev 294983)
@@ -217,13 +217,14 @@
 // Collect flex items with non-zero flex-shrink value. flex-shrink: 0 flex items
 // don't participate in content flexing.
 for (size_t index = 0; index < logicalFlexItemList.size(); ++index) {
-auto& logicalFlexItem = logicalFlexItemList[index];
-if (auto flexShrink = logicalFlexItem.layoutBox->style().flexShrink()) {
+auto& flexItem = logicalFlexItemList[index];
+auto baseSize = flexItem.rect.width();
+if (auto flexShrink = flexItem.layoutBox->style().flexShrink()) {
 shrinkingItems.append(index);
-totalShrink += flexShrink;
-totalFlexibleSpace += logicalFlexItem.rect.width();
+totalShrink += flexShrink * baseSize;
+totalFlexibleSpace += baseSize;
 } else
-availableSpace -= logicalFlexItem.rect.width();
+availableSpace -= baseSize;
 }
 if (totalShrink)
 flexShrinkBase = (totalFlexibleSpace - availableSpace) / totalShrink;
@@ -236,12 +237,13 @@
 for (auto flexItemIndex : shrinkingItems) {
 auto& flexItem = logicalFlexItemList[flexItemIndex];
 
-auto flexShrink = flexItem.layoutBox->style().flexShrink();
-auto flexedSize = flexItem.rect.width() - (flexShrink * flexShrinkBase);
+auto baseSize = flexItem.rect.width();
+auto flexShrink = flexItem.layoutBox->style().flexShrink() * baseSize;
+auto flexedSize = baseSize - (flexShrink * flexShrinkBase);
 auto minimumSize = formattingState.intrinsicWidthConstraintsForBox(*flexItem.layoutBox)->minimum;
 if (minimumSize >= flexedSize) {
 totalShrink -= flexShrink;
-totalFlexibleSpace -= flexItem.rect.width();
+totalFlexibleSpace -= baseSize;
 availableSpace -= minimumSize;
 }
 }
@@ -254,8 +256,9 @@
 for (auto flexItemIndex : shrinkingItems) {
 auto& flexItem = logicalFlexItemList[flexItemIndex];
 
-auto flexShrink = flexItem.layoutBox->style().flexShrink();
-auto flexedSize = LayoutUnit { flexItem.rect.width() - (flexShrink * flexShrinkBase) };
+auto baseSize = flexItem.rect.width();
+auto flexShrink = flexItem.layoutBox->style().flexShrink() * baseSize;
+auto flexedSize = LayoutUnit { baseSize - (flexShrink * flexShrinkBase) };
 auto minimumSize = formattingState.intrinsicWidthConstraintsForBox(*flexItem.layoutBox)->minimum;
 flexItem.rect.setWidth(std::max(minimumSize, flexedSize));
 }
@@ -340,13 +343,13 @@
 for (auto& logicalFlexItem : logicalFlexItemList)
 logicalWidth += logicalFlexItem.rect.width();
 return logicalWidth;
-};
+}();
 
 if (!availableSpace)
 ASSERT_NOT_IMPLEMENTED_YET();
-else if (*availableSpace > contentLogicalWidth())
+else if (*availableSpace > contentLogicalWidth)
 computeLogicalWidthForStretchingFlexItems(logicalFlexItemList, *availableSpace);
-else
+else if (*availableSpace < contentLogicalWidth)
 computeLogicalWidthForShrinkingFlexItems(logicalFlexItemList, *availableSpace);
 }
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [294902] trunk/Source/WebCore/rendering

2022-05-26 Thread zalan
Title: [294902] trunk/Source/WebCore/rendering








Revision 294902
Author za...@apple.com
Date 2022-05-26 15:22:08 -0700 (Thu, 26 May 2022)


Log Message
Do not issue repaint when the ancestor layer has already been scheduled for one
https://bugs.webkit.org/show_bug.cgi?id=240728

Reviewed by Simon Fraser.

When a renderer needs repaint, we walk the layer tree to search for the repaint container (root for all the paints).
If we find a layer between the renderer and the repaint container that has already been scheduled for a full repaint
we know that this repaint is redundant and will be covered by the ancestor layer.
Since layers paint their overflow content, this works even when the renderer "sticks out" of the ancestor layer's renderer's border box (i.e. produces ink/scrollable overflow).

* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::enclosingCompositingLayerForRepaint const):
(WebCore::RenderLayer::clipCrossesPaintingBoundary const):
(WebCore::RenderLayer::calculateClipRects const):
* Source/WebCore/rendering/RenderLayer.h:
(WebCore::RenderLayer::needsFullRepaint const):
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::repaintInCompositedAncestor):
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::containerForRepaint const):
(WebCore::fullRepaintIsScheduled): This covers the cases when the content is embedded inside an iframe and the iframe's view is not composited.
(WebCore::RenderObject::repaint const):
(WebCore::RenderObject::repaintRectangle const):
* Source/WebCore/rendering/RenderView.cpp:
(WebCore::RenderView::paintBoxDecorations):

Canonical link: https://commits.webkit.org/251025@main

Modified Paths

trunk/Source/WebCore/rendering/RenderLayer.cpp
trunk/Source/WebCore/rendering/RenderLayer.h
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
trunk/Source/WebCore/rendering/RenderObject.cpp
trunk/Source/WebCore/rendering/RenderView.cpp




Diff

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (294901 => 294902)

--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2022-05-26 22:15:24 UTC (rev 294901)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2022-05-26 22:22:08 UTC (rev 294902)
@@ -2024,7 +2024,7 @@
 return nullptr;
 }
 
-RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(IncludeSelfOrNot includeSelf) const
+RenderLayer::EnclosingCompositingLayerStatus RenderLayer::enclosingCompositingLayerForRepaint(IncludeSelfOrNot includeSelf) const
 {
 auto repaintTargetForLayer = [](const RenderLayer& layer) -> RenderLayer* {
 if (compositedWithOwnBackingStore(layer))
@@ -2035,17 +2035,22 @@
 
 return nullptr;
 };
+auto isEligibleForFullRepaintCheck = [&](const auto& layer) {
+return layer.isSelfPaintingLayer() && !layer.renderer().hasPotentiallyScrollableOverflow() && !is(layer.renderer());
+};
 
+auto fullRepaintAlreadyScheduled = isEligibleForFullRepaintCheck(*this) && needsFullRepaint();
 RenderLayer* repaintTarget = nullptr;
 if (includeSelf == IncludeSelf && (repaintTarget = repaintTargetForLayer(*this)))
-return repaintTarget;
+return { fullRepaintAlreadyScheduled, repaintTarget };
 
 for (const RenderLayer* curr = paintOrderParent(); curr; curr = curr->paintOrderParent()) {
+fullRepaintAlreadyScheduled = fullRepaintAlreadyScheduled || (isEligibleForFullRepaintCheck(*curr) && curr->needsFullRepaint());
 if ((repaintTarget = repaintTargetForLayer(*curr)))
-return repaintTarget;
+return { fullRepaintAlreadyScheduled, repaintTarget };
 }
  
-return nullptr;
+return { };
 }
 
 RenderLayer* RenderLayer::enclosingFilterLayer(IncludeSelfOrNot includeSelf) const
@@ -4612,7 +4617,7 @@
 bool RenderLayer::clipCrossesPaintingBoundary() const
 {
 return parent()->enclosingPaginationLayer(IncludeCompositedPaginatedLayers) != enclosingPaginationLayer(IncludeCompositedPaginatedLayers)
-|| parent()->enclosingCompositingLayerForRepaint() != enclosingCompositingLayerForRepaint();
+|| parent()->enclosingCompositingLayerForRepaint().layer != enclosingCompositingLayerForRepaint().layer;
 }
 
 void RenderLayer::calculateClipRects(const ClipRectsContext& clipRectsContext, ClipRects& clipRects) const
@@ -5811,7 +5816,7 @@
 bool RenderLayer::invalidateEventRegion(EventRegionInvalidationReason reason)
 {
 #if ENABLE(ASYNC_SCROLLING)
-auto* compositingLayer = enclosingCompositingLayerForRepaint();
+auto* compositingLayer = enclosingCompositingLayerForRepaint().layer;
 
 auto shouldInvalidate = [&] {
 if (!compositingLayer)


Modified: trunk/Source/WebCore/rendering/RenderLayer.h (294901 => 294902)

--- trunk/Source/WebCore/rendering/RenderLayer.h	2022-05-26 22:15:24 UTC (rev 294901)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2022-05-26 22:22:08 UTC (rev 294902)
@@ -590,7 +590,11 @@
 
 // Enclosing compositing layer; if 

[webkit-changes] [294804] trunk/Source/WebCore/layout/formattingContexts/flex

2022-05-25 Thread zalan
Title: [294804] trunk/Source/WebCore/layout/formattingContexts/flex








Revision 294804
Author za...@apple.com
Date 2022-05-25 10:29:16 -0700 (Wed, 25 May 2022)


Log Message
Expand flex-grow support
https://bugs.webkit.org/show_bug.cgi?id=240898

Reviewed by Antti Koivisto.

This patch add support for flex-grow. This property defines how flex items take over the available space.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::computeLogicalWidthForFlexItems):
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h:

Canonical link: https://commits.webkit.org/250960@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (294803 => 294804)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-25 17:22:59 UTC (rev 294803)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-25 17:29:16 UTC (rev 294804)
@@ -204,44 +204,89 @@
 }
 }
 
-void FlexFormattingContext::layoutInFlowContentForIntegration(const ConstraintsForInFlowContent& constraints)
+void FlexFormattingContext::computeLogicalWidthForFlexItems(LogicalFlexItems& logicalFlexItemList, const ConstraintsForFlexContent& flexConstraints)
 {
 auto& formattingState = this->formattingState();
-auto logicalFlexItemList = convertFlexItemsToLogicalSpace();
 
+auto flexDirection = root().style().flexDirection();
+auto flexDirectionIsInlineAxis = flexDirection == FlexDirection::Row || flexDirection == FlexDirection::RowReverse;
+auto availableSpace = std::optional { flexDirectionIsInlineAxis ? std::make_optional(flexConstraints.horizontal().logicalWidth) : flexConstraints.availableVerticalSpace() };
+
 auto totalGrowth = 0.f;
-auto totalFixedSpace = LayoutUnit { };
+auto totalFlexibleSpace = *availableSpace;
+auto flexGrowBase = 0.f;
+Vector flexingItems;
 
-for (auto& logicalFlexItem : logicalFlexItemList) {
-totalGrowth += logicalFlexItem.layoutBox->style().flexGrow();
-totalFixedSpace += formattingState.intrinsicWidthConstraintsForBox(*logicalFlexItem.layoutBox)->minimum;
-}
+auto computeTotalGrowthAndFlexibleSpace = [&] {
+// Collect flex items with non-zero flex-grow value. flex-grow: 0 (initial) flex items
+// don't participate in available space distribution.
+for (size_t index = 0; index < logicalFlexItemList.size(); ++index) {
+auto& logicalFlexItem = logicalFlexItemList[index];
+if (auto flexGrow = logicalFlexItem.layoutBox->style().flexGrow()) {
+flexingItems.append(index);
+totalGrowth += flexGrow;
+} else
+totalFlexibleSpace -= logicalFlexItem.rect.width();
+}
+if (totalGrowth)
+flexGrowBase = totalFlexibleSpace / totalGrowth;
+};
+computeTotalGrowthAndFlexibleSpace();
 
+auto totalLogicalWidth = [&] {
+// This is where we compute how much space the flexing boxes take up if we just
+// let them flex by their flex-grow value. Note that we can't size them below their minimum content width.
+// Such flex items are removed from the final overflow distribution.
+auto accumulatedWidth = LayoutUnit { };
+for (auto flexItemIndex : flexingItems) {
+auto& flexItem = logicalFlexItemList[flexItemIndex];
+
+auto flexGrow = flexItem.layoutBox->style().flexGrow();
+auto flexedSize = flexGrow * flexGrowBase;
+auto minimumSize = formattingState.intrinsicWidthConstraintsForBox(*flexItem.layoutBox)->minimum;
+if (minimumSize >= flexedSize) {
+accumulatedWidth += minimumSize;
+totalGrowth -= flexGrow;
+} else
+accumulatedWidth += flexedSize;
+}
+return accumulatedWidth;
+}();
+auto overflowWidth = totalLogicalWidth - totalFlexibleSpace;
+ASSERT(overflowWidth >= 0);
+
+auto computeLogicalWidth = [&] {
+// Adjust the total grow width by the overflow value (shrink) except when min content with disagrees.
+for (auto flexItemIndex : flexingItems) {
+auto& flexItem = logicalFlexItemList[flexItemIndex];
+
+auto flexGrow = flexItem.layoutBox->style().flexGrow();
+auto flexedSize = flexGrow * flexGrowBase;
+auto minimumSize = formattingState.intrinsicWidthConstraintsForBox(*flexItem.layoutBox)->minimum;
+if (minimumSize >= flexedSize)
+flexItem.rect.setWidth(minimumSize);
+else {
+auto distributedOverflow = 

[webkit-changes] [294755] trunk/Source/WebCore

2022-05-24 Thread zalan
Title: [294755] trunk/Source/WebCore








Revision 294755
Author za...@apple.com
Date 2022-05-24 12:12:38 -0700 (Tue, 24 May 2022)


Log Message
Start using min/max content size for flexing
https://bugs.webkit.org/show_bug.cgi?id=240872

Reviewed by Antti Koivisto.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::updateFormattingRootGeometryAndInvalidate):
(WebCore::LayoutIntegration::FlexLayout::updateFlexItemDimensions):
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h:
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutUsingFlexFormattingContext):

Canonical link: https://commits.webkit.org/250923@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (294754 => 294755)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-24 18:48:31 UTC (rev 294754)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-24 19:12:38 UTC (rev 294755)
@@ -206,6 +206,7 @@
 
 void FlexFormattingContext::layoutInFlowContentForIntegration(const ConstraintsForInFlowContent& constraints)
 {
+auto& formattingState = this->formattingState();
 auto logicalFlexItemList = convertFlexItemsToLogicalSpace();
 
 auto totalGrowth = 0.f;
@@ -213,8 +214,7 @@
 
 for (auto& logicalFlexItem : logicalFlexItemList) {
 totalGrowth += logicalFlexItem.layoutBox->style().flexGrow();
-// FIXME: Use min/max here.
-totalFixedSpace += logicalFlexItem.rect.width();
+totalFixedSpace += formattingState.intrinsicWidthConstraintsForBox(*logicalFlexItem.layoutBox)->minimum;
 }
 
 auto flexConstraints = downcast(constraints);
@@ -237,7 +237,8 @@
 // This value specifies the flex grow factor, which determines how much the flex item will grow relative to the
 // rest of the flex items in the flex container when positive free space is distributed.
 ASSERT(availableSpace.has_value());
-logicalFlexItem.rect.setWidth(LayoutUnit { *availableSpace * grow / totalGrowth });
+// FIXME: This is still slighly incorrect.
+logicalFlexItem.rect.setWidth(LayoutUnit { formattingState.intrinsicWidthConstraintsForBox(*logicalFlexItem.layoutBox)->minimum + (flexibleSpace * grow / totalGrowth) });
 // FIXME: constrain logical width on min width.
 };
 growFlexItemIfApplicable();


Modified: trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp (294754 => 294755)

--- trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp	2022-05-24 18:48:31 UTC (rev 294754)
+++ trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp	2022-05-24 19:12:38 UTC (rev 294755)
@@ -34,6 +34,7 @@
 #include "HitTestRequest.h"
 #include "HitTestResult.h"
 #include "LayoutBoxGeometry.h"
+#include "LayoutChildIterator.h"
 #include "RenderFlexibleBox.h"
 
 namespace WebCore {
@@ -75,9 +76,9 @@
 
 void FlexLayout::updateFormattingRootGeometryAndInvalidate()
 {
-auto& flexBoxRenderer = this->flexBoxRenderer();
+auto updateGeometry = [&](auto& root) {
+auto& flexBoxRenderer = this->flexBoxRenderer();
 
-auto updateGeometry = [&](auto& root) {
 auto isLeftToRightInlineDirection = flexBoxRenderer.style().isLeftToRightDirection();
 auto writingMode = flexBoxRenderer.style().writingMode();
 
@@ -87,12 +88,16 @@
 root.setHorizontalMargin({ });
 root.setVerticalMargin({ });
 };
-return updateGeometry(m_layoutState.ensureGeometryForBox(rootLayoutBox()));
+updateGeometry(m_layoutState.ensureGeometryForBox(rootLayoutBox()));
+
+for (auto& flexItem : Layout::childrenOfType(rootLayoutBox()))
+m_flexFormattingState.clearIntrinsicWidthConstraints(flexItem);
 }
 
-void FlexLayout::updateFlexItemDimensions(const RenderBlock& flexItem)
+void FlexLayout::updateFlexItemDimensions(const RenderBlock& flexItem, LayoutUnit minimumContentSize, LayoutUnit maximumContentSize)
 {
-auto& boxGeometry = m_layoutState.ensureGeometryForBox(m_boxTree.layoutBoxForRenderer(flexItem));
+auto& layoutBox = m_boxTree.layoutBoxForRenderer(flexItem);
+auto& boxGeometry = m_layoutState.ensureGeometryForBox(layoutBox);
 
 boxGeometry.setContentBoxWidth(flexItem.contentWidth());
 boxGeometry.setContentBoxHeight(flexItem.contentHeight());
@@ -100,6 +105,9 @@
   

[webkit-changes] [294754] trunk

2022-05-24 Thread zalan
Title: [294754] trunk








Revision 294754
Author za...@apple.com
Date 2022-05-24 11:48:31 -0700 (Tue, 24 May 2022)


Log Message
REGRESSION (r292532): pge.com: Unable to focus on any of the inputs
https://bugs.webkit.org/show_bug.cgi?id=240832


Reviewed by Simon Fraser.

This is a revert of r292532. Blank float avoiders (used width = 0px) do fit even when the available space is zero. We have to find a different way to address the float fitting issue in contain-inline-size-bfc-floats-001.html (though I am not convinced that the expected result is correct anymore).

* LayoutTests/TestExpectations:
* LayoutTests/fast/block/float/zero-size-float-avoider-incorrect-position-expected.html: Added.
* LayoutTests/fast/block/float/zero-size-float-avoider-incorrect-position.html: Added.
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::getClearDelta):

Canonical link: https://commits.webkit.org/250922@main

Modified Paths

trunk/LayoutTests/TestExpectations
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp


Added Paths

trunk/LayoutTests/fast/block/float/zero-size-float-avoider-incorrect-position-expected.html
trunk/LayoutTests/fast/block/float/zero-size-float-avoider-incorrect-position.html


Removed Paths

trunk/LayoutTests/fast/block/float/float-avoider-with-shrinking-content-expected.html
trunk/LayoutTests/fast/block/float/float-avoider-with-shrinking-content.html
trunk/LayoutTests/fast/block/float/float-avoider-with-zero-width-expected.txt
trunk/LayoutTests/fast/block/float/float-avoider-with-zero-width.html




Diff

Modified: trunk/LayoutTests/TestExpectations (294753 => 294754)

--- trunk/LayoutTests/TestExpectations	2022-05-24 17:28:58 UTC (rev 294753)
+++ trunk/LayoutTests/TestExpectations	2022-05-24 18:48:31 UTC (rev 294754)
@@ -4638,6 +4638,7 @@
 webanimations/translate-property-and-translate-animation-with-delay-on-forced-layer.html [ Skip ]
 
 # CSS containment tests that fail
+imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-bfc-floats-001.html [ ImageOnlyFailure ]
 # webkit-ruby-text
 imported/w3c/web-platform-tests/css/css-contain/contain-layout-017.html [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-contain/contain-paint-021.html [ ImageOnlyFailure ]
@@ -4693,7 +4694,6 @@
 # Container queries
 webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/custom-layout-container-001.https.html [ ImageOnlyFailure ]
 webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/svg-foreignobject-no-size-container.html [ Skip ]
-webkit.org/b/229659 imported/w3c/web-platform-tests/css/css-contain/container-queries/inline-size-bfc-floats.html [ ImageOnlyFailure ]
 
 # Flaky css-contain test
 imported/w3c/web-platform-tests/css/css-contain/content-visibility/animation-display-lock.html [ Failure Pass ]


Deleted: trunk/LayoutTests/fast/block/float/float-avoider-with-shrinking-content-expected.html (294753 => 294754)

--- trunk/LayoutTests/fast/block/float/float-avoider-with-shrinking-content-expected.html	2022-05-24 17:28:58 UTC (rev 294753)
+++ trunk/LayoutTests/fast/block/float/float-avoider-with-shrinking-content-expected.html	2022-05-24 18:48:31 UTC (rev 294754)
@@ -1,28 +0,0 @@
-
-.outer {
-  width: 150px;
-}
-
-.float {
-  float: left;
-  background-color: green;
-  width: 100px;
-  height: 100px
-}
-
-.right {
-  float: right;
-  background-color: blue;
-}
-
-.float_avoider {
-  width: 50px;
-  height: 200px;
-  background: yellow;
-}
-
-
-  
-  
-  
-


Deleted: trunk/LayoutTests/fast/block/float/float-avoider-with-shrinking-content.html (294753 => 294754)

--- trunk/LayoutTests/fast/block/float/float-avoider-with-shrinking-content.html	2022-05-24 17:28:58 UTC (rev 294753)
+++ trunk/LayoutTests/fast/block/float/float-avoider-with-shrinking-content.html	2022-05-24 18:48:31 UTC (rev 294754)
@@ -1,33 +0,0 @@
-
-.outer {
-  width: 150px;
-}
-
-.float {
-  float: left;
-  background-color: green;
-  width: 100px;
-  height: 100px
-}
-
-.right {
-  float: right;
-  background-color: blue;
-}
-
-.float_avoider {
-  overflow: hidden;
-}
-
-.content {
-  display: inline-block;
-  width: 100px;
-  height: 200px;
-  background: yellow;
-}
-
-
-  
-  
-  
-


Deleted: trunk/LayoutTests/fast/block/float/float-avoider-with-zero-width-expected.txt (294753 => 294754)

--- trunk/LayoutTests/fast/block/float/float-avoider-with-zero-width-expected.txt	2022-05-24 17:28:58 UTC (rev 294753)
+++ trunk/LayoutTests/fast/block/float/float-avoider-with-zero-width-expected.txt	2022-05-24 18:48:31 UTC (rev 294754)
@@ -1 +0,0 @@
-float avoider top position: 108


Deleted: trunk/LayoutTests/fast/block/float/float-avoider-with-zero-width.html (294753 => 294754)

--- trunk/LayoutTests/fast/block/float/float-avoider-with-zero-width.html	2022-05-24 17:28:58 UTC (rev 294753)
+++ trunk/LayoutTests/fast/block/float/float-avoider-with-zero-width.html	2022-05-24 18:48:31 UTC (rev 294754)
@@ -1,40 +0,0 @@
-
-.outer {
-  width: 

[webkit-changes] [294699] trunk/Source/WebCore

2022-05-23 Thread zalan
Title: [294699] trunk/Source/WebCore








Revision 294699
Author za...@apple.com
Date 2022-05-23 17:00:57 -0700 (Mon, 23 May 2022)


Log Message
RenderObject::containerForRepaint should be able to tell if a full repaint has already been scheduled.
https://bugs.webkit.org/show_bug.cgi?id=240721

Reviewed by Simon Fraser.

This patch is in preparation for reducing redundant repaints when an ancestor layer (between the renderer and the repaint container) has already been scheduled for one.

* Source/WebCore/editing/SelectionGeometryGatherer.cpp:
(WebCore::SelectionGeometryGatherer::addQuad):
(WebCore::SelectionGeometryGatherer::addGapRects):
* Source/WebCore/editing/SelectionGeometryGatherer.h:
* Source/WebCore/page/FrameView.cpp:
(WebCore::FrameView::isEnclosedInCompositingLayer const):
* Source/WebCore/rendering/LayoutRepainter.cpp:
(WebCore::LayoutRepainter::LayoutRepainter):
(WebCore::LayoutRepainter::repaintAfterLayout):
* Source/WebCore/rendering/LayoutRepainter.h:
* Source/WebCore/rendering/LegacyLineLayout.cpp:
(WebCore::LegacyLineLayout::layoutRunsAndFloats):
* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::issueRepaintForOutlineAuto):
* Source/WebCore/rendering/RenderFragmentedFlow.cpp:
(WebCore::RenderFragmentedFlow::mapLocalToContainer const):
* Source/WebCore/rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::layout):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::recursiveUpdateLayerPositions):
(WebCore::RenderLayer::computeRepaintRectsIncludingDescendants):
(WebCore::RenderLayer::recursiveUpdateLayerPositionsAfterScroll):
(WebCore::RenderLayer::setHasVisibleContent):
(WebCore::RenderLayer::calculateClipRects const):
* Source/WebCore/rendering/RenderLayer.h:
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::repaintOnCompositingChange):
* Source/WebCore/rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::styleDidChange):
* Source/WebCore/rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::scrollTo):
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::containerForRepaint const):
(WebCore::RenderObject::repaint const):
(WebCore::RenderObject::repaintRectangle const):
(WebCore::RenderObject::repaintSlowRepaintObject const):
* Source/WebCore/rendering/RenderObject.h:
* Source/WebCore/rendering/RenderSelectionInfo.cpp:
(WebCore::RenderSelectionInfoBase::RenderSelectionInfoBase):
* Source/WebCore/rendering/RenderSelectionInfo.h:
(WebCore::RenderSelectionInfoBase::repaintContainer const):
* Source/WebCore/rendering/RenderView.cpp:
(WebCore::RenderView::repaintRootContents):

Canonical link: https://commits.webkit.org/250898@main

Modified Paths

trunk/Source/WebCore/editing/SelectionGeometryGatherer.cpp
trunk/Source/WebCore/editing/SelectionGeometryGatherer.h
trunk/Source/WebCore/page/FrameView.cpp
trunk/Source/WebCore/rendering/LayoutRepainter.cpp
trunk/Source/WebCore/rendering/LayoutRepainter.h
trunk/Source/WebCore/rendering/LegacyLineLayout.cpp
trunk/Source/WebCore/rendering/RenderElement.cpp
trunk/Source/WebCore/rendering/RenderFragmentedFlow.cpp
trunk/Source/WebCore/rendering/RenderFrameSet.cpp
trunk/Source/WebCore/rendering/RenderLayer.cpp
trunk/Source/WebCore/rendering/RenderLayer.h
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp
trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp
trunk/Source/WebCore/rendering/RenderObject.cpp
trunk/Source/WebCore/rendering/RenderObject.h
trunk/Source/WebCore/rendering/RenderSelectionInfo.cpp
trunk/Source/WebCore/rendering/RenderSelectionInfo.h
trunk/Source/WebCore/rendering/RenderView.cpp




Diff

Modified: trunk/Source/WebCore/editing/SelectionGeometryGatherer.cpp (294698 => 294699)

--- trunk/Source/WebCore/editing/SelectionGeometryGatherer.cpp	2022-05-23 23:58:51 UTC (rev 294698)
+++ trunk/Source/WebCore/editing/SelectionGeometryGatherer.cpp	2022-05-24 00:00:57 UTC (rev 294699)
@@ -43,13 +43,13 @@
 {
 }
 
-void SelectionGeometryGatherer::addQuad(RenderLayerModelObject *repaintContainer, const FloatQuad& quad)
+void SelectionGeometryGatherer::addQuad(const RenderLayerModelObject* repaintContainer, const FloatQuad& quad)
 {
 if (!quad.boundingBoxIsEmpty())
 m_quads.append(repaintContainer ? repaintContainer->localToAbsoluteQuad(quad) : quad);
 }
 
-void SelectionGeometryGatherer::addGapRects(RenderLayerModelObject *repaintContainer, const GapRects& rects)
+void SelectionGeometryGatherer::addGapRects(const RenderLayerModelObject* repaintContainer, const GapRects& rects)
 {
 if (repaintContainer) {
 GapRects absoluteGapRects;


Modified: trunk/Source/WebCore/editing/SelectionGeometryGatherer.h (294698 => 294699)

--- trunk/Source/WebCore/editing/SelectionGeometryGatherer.h	2022-05-23 23:58:51 UTC (rev 294698)
+++ trunk/Source/WebCore/editing/SelectionGeometryGatherer.h	2022-05-24 00:00:57 UTC (rev 294699)
@@ -45,8 

[webkit-changes] [294638] trunk/Source/WebCore/layout

2022-05-23 Thread zalan
Title: [294638] trunk/Source/WebCore/layout








Revision 294638
Author za...@apple.com
Date 2022-05-23 06:49:05 -0700 (Mon, 23 May 2022)


Log Message
Add support for block direction grow
https://bugs.webkit.org/show_bug.cgi?id=240776

Reviewed by Antti Koivisto.

This is a basic block direction grow support (e.g. default block direction (top->bottom) with flex direction of column) when
flex box's height is fixed.

* Source/WebCore/layout/formattingContexts/FormattingConstraints.h:
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::updateRenderers const):

Canonical link: https://commits.webkit.org/250862@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/FormattingConstraints.h
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/FormattingConstraints.h (294637 => 294638)

--- trunk/Source/WebCore/layout/formattingContexts/FormattingConstraints.h	2022-05-23 13:38:06 UTC (rev 294637)
+++ trunk/Source/WebCore/layout/formattingContexts/FormattingConstraints.h	2022-05-23 13:49:05 UTC (rev 294638)
@@ -66,7 +66,7 @@
 private:
 OptionSet baseTypeFlags() const { return OptionSet::fromRaw(m_baseTypeFlags); }
 
-unsigned m_baseTypeFlags : 2; // OptionSet
+unsigned m_baseTypeFlags : 3; // OptionSet
 HorizontalConstraints m_horizontal;
 LayoutUnit m_logicalTop;
 };


Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (294637 => 294638)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-23 13:38:06 UTC (rev 294637)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-23 13:49:05 UTC (rev 294638)
@@ -209,24 +209,27 @@
 auto logicalFlexItemList = convertFlexItemsToLogicalSpace();
 
 auto totalGrowth = 0.f;
-auto totalFixedWidth = LayoutUnit { };
+auto totalFixedSpace = LayoutUnit { };
 
 for (auto& logicalFlexItem : logicalFlexItemList) {
 totalGrowth += logicalFlexItem.layoutBox->style().flexGrow();
 // FIXME: Use min/max here.
-totalFixedWidth += logicalFlexItem.rect.width();
+totalFixedSpace += logicalFlexItem.rect.width();
 }
 
+auto flexConstraints = downcast(constraints);
 auto logicalLeft = LayoutUnit { };
 auto logicalTop = LayoutUnit { };
-auto availableWidth = constraints.horizontal().logicalWidth;
-auto flexibleWidth = availableWidth - totalFixedWidth;
+auto flexDirection = root().style().flexDirection();
+auto flexDirectionIsInlineAxis = flexDirection == FlexDirection::Row || flexDirection == FlexDirection::RowReverse;
+auto availableSpace = std::optional { flexDirectionIsInlineAxis ? std::make_optional(flexConstraints.horizontal().logicalWidth) : flexConstraints.availableVerticalSpace() };
+auto flexibleSpace = availableSpace.value_or(0_lu) - totalFixedSpace;
 
 for (auto& logicalFlexItem : logicalFlexItemList) {
 logicalFlexItem.rect.setTopLeft({ logicalLeft, logicalTop });
 logicalLeft = logicalFlexItem.rect.right();
 auto growFlexItemIfApplicable = [&] {
-if (flexibleWidth <= 0)
+if (flexibleSpace <= 0)
 return;
 auto grow = logicalFlexItem.layoutBox->style().flexGrow();
 if (!grow)
@@ -233,12 +236,13 @@
 return;
 // This value specifies the flex grow factor, which determines how much the flex item will grow relative to the
 // rest of the flex items in the flex container when positive free space is distributed.
-logicalFlexItem.rect.setWidth(LayoutUnit { availableWidth * grow / totalGrowth });
+ASSERT(availableSpace.has_value());
+logicalFlexItem.rect.setWidth(LayoutUnit { *availableSpace * grow / totalGrowth });
 // FIXME: constrain logical width on min width.
 };
 growFlexItemIfApplicable();
 }
-setFlexItemsGeometry(logicalFlexItemList, downcast(constraints));
+setFlexItemsGeometry(logicalFlexItemList, flexConstraints);
 }
 
 IntrinsicWidthConstraints FlexFormattingContext::computedIntrinsicWidthConstraintsForIntegration()


Modified: trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp (294637 => 294638)

--- trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp	2022-05-23 13:38:06 UTC (rev 294637)
+++ trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp	2022-05-23 13:49:05 UTC (rev 294638)
@@ -139,6 +139,7 @@
 auto borderBox = Layout::BoxGeometry::borderBoxRect(flexItemGeometry);
 

[webkit-changes] [294623] trunk/Source/WebCore

2022-05-22 Thread zalan
Title: [294623] trunk/Source/WebCore








Revision 294623
Author za...@apple.com
Date 2022-05-22 13:50:37 -0700 (Sun, 22 May 2022)


Log Message
Flex layout may use flex box's height to stretch flex items
https://bugs.webkit.org/show_bug.cgi?id=240774

Reviewed by Antti Koivisto.

This is in preparation for being able to stretch the flex items vertically (e.g. when the flex box has fixed height)

* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/layout/formattingContexts/FormattingConstraints.h:
(WebCore::Layout::ConstraintsForInFlowContent::isConstraintsForFlexContent const):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingConstraints.h: Added.
(WebCore::Layout::ConstraintsForFlexContent::availableVerticalSpace const):
(WebCore::Layout::ConstraintsForFlexContent::ConstraintsForFlexContent):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::layoutInFlowContent):
(WebCore::Layout::FlexFormattingContext::sizeAndPlaceFlexItems):
(WebCore::Layout::FlexFormattingContext::setFlexItemsGeometry):
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h:
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::layout):

Canonical link: https://commits.webkit.org/250849@main

Modified Paths

trunk/Source/WebCore/Headers.cmake
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
trunk/Source/WebCore/layout/formattingContexts/FormattingConstraints.h
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp


Added Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingConstraints.h




Diff

Modified: trunk/Source/WebCore/Headers.cmake (294622 => 294623)

--- trunk/Source/WebCore/Headers.cmake	2022-05-22 19:43:38 UTC (rev 294622)
+++ trunk/Source/WebCore/Headers.cmake	2022-05-22 20:50:37 UTC (rev 294623)
@@ -978,6 +978,7 @@
 layout/formattingContexts/FormattingConstraints.h
 layout/formattingContexts/FormattingContext.h
 
+layout/formattingContexts/flex/FlexFormattingConstraints.h
 layout/formattingContexts/flex/FlexFormattingState.h
 
 layout/formattingContexts/inline/display/InlineDisplayBox.h


Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (294622 => 294623)

--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-05-22 19:43:38 UTC (rev 294622)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-05-22 20:50:37 UTC (rev 294623)
@@ -2253,6 +2253,7 @@
 		6FAAE71326A2814B00E07502 /* InlineLevelBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FAAE71126A2814A00E07502 /* InlineLevelBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6FAC251F281326580045683F /* LayoutIntegrationFlexLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FAC251E281326570045683F /* LayoutIntegrationFlexLayout.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6FB11B5C21783FD000E2A574 /* TextUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB11B5921783FCF00E2A574 /* TextUtil.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		6FB17476283A8FF40067D8CA /* FlexFormattingConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB17475283A8FF40067D8CA /* FlexFormattingConstraints.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6FB2400523DFF12800796458 /* InlineLineBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB2400323DFF12700796458 /* InlineLineBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6FB47E632277425A00C7BCB0 /* LayoutIntegrationLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB47E612277425A00C7BCB0 /* LayoutIntegrationLine.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6FB5E214221F2453003989CF /* ContentChangeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB5E212221F2447003989CF /* ContentChangeObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -11088,6 +11089,7 @@
 		6FB0ED112427B6C6002737E6 /* LayoutInitialContainingBlock.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutInitialContainingBlock.cpp; sourceTree = ""; };
 		6FB11B5921783FCF00E2A574 /* TextUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextUtil.h; sourceTree = ""; };
 		6FB11B5B21783FCF00E2A574 /* TextUtil.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextUtil.cpp; sourceTree = ""; };
+		6FB17475283A8FF40067D8CA /* FlexFormattingConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlexFormattingConstraints.h; sourceTree = ""; };
 		6FB22E30230097E300C20866 /* TableGrid.h */ = 

[webkit-changes] [294618] trunk

2022-05-21 Thread zalan
Title: [294618] trunk








Revision 294618
Author za...@apple.com
Date 2022-05-21 19:34:32 -0700 (Sat, 21 May 2022)


Log Message
Invisible border should not trigger Repaint diff when currentColor changes
https://bugs.webkit.org/show_bug.cgi?id=240763

Reviewed by Simon Fraser.

Let's check if the border is visible to decide if the currentColor should trigger Repaint diff.

Test: fast/repaint/currentColorChange-with-non-visible-border.html
* Source/WebCore/rendering/style/BorderData.cpp:
(WebCore::BorderData::isEquivalentForPainting const):
* LayoutTests/fast/repaint/currentColorChange-with-non-visible-border-expected.txt: Added.
* LayoutTests/fast/repaint/currentColorChange-with-non-visible-border.html: Added.

Canonical link: https://commits.webkit.org/250844@main

Modified Paths

trunk/Source/WebCore/rendering/style/BorderData.cpp


Added Paths

trunk/LayoutTests/fast/repaint/currentColorChange-with-non-visible-border-expected.txt
trunk/LayoutTests/fast/repaint/currentColorChange-with-non-visible-border.html




Diff

Added: trunk/LayoutTests/fast/repaint/currentColorChange-with-non-visible-border-expected.txt (0 => 294618)

--- trunk/LayoutTests/fast/repaint/currentColorChange-with-non-visible-border-expected.txt	(rev 0)
+++ trunk/LayoutTests/fast/repaint/currentColorChange-with-non-visible-border-expected.txt	2022-05-22 02:34:32 UTC (rev 294618)
@@ -0,0 +1 @@
+


Added: trunk/LayoutTests/fast/repaint/currentColorChange-with-non-visible-border.html (0 => 294618)

--- trunk/LayoutTests/fast/repaint/currentColorChange-with-non-visible-border.html	(rev 0)
+++ trunk/LayoutTests/fast/repaint/currentColorChange-with-non-visible-border.html	2022-05-22 02:34:32 UTC (rev 294618)
@@ -0,0 +1,26 @@
+
+#color_change {
+  border-style: none;
+  border-width: 10px;
+  background-color: green;
+  width: 100px;
+  height: 100px;
+}
+
+
+
+
+
+if (window.testRunner)
+  testRunner.dumpAsText();
+document.body.offsetHeight;
+if (window.internals)
+  internals.startTrackingRepaints();
+color_change.style.color = "red";
+document.body.offsetHeight;
+
+if (window.internals) {
+  result.innerText = internals.repaintRectsAsText();
+  internals.stopTrackingRepaints();
+}
+


Modified: trunk/Source/WebCore/rendering/style/BorderData.cpp (294617 => 294618)

--- trunk/Source/WebCore/rendering/style/BorderData.cpp	2022-05-21 23:40:13 UTC (rev 294617)
+++ trunk/Source/WebCore/rendering/style/BorderData.cpp	2022-05-22 02:34:32 UTC (rev 294618)
@@ -40,8 +40,11 @@
 if (!currentColorDiffers)
 return true;
 
-auto borderHasCurrentColor = RenderStyle::isCurrentColor(m_top.color()) || RenderStyle::isCurrentColor(m_right.color()) || RenderStyle::isCurrentColor(m_bottom.color()) || RenderStyle::isCurrentColor(m_left.color());
-return !borderHasCurrentColor;
+auto visibleBorderHasCurrentColor = (m_top.isVisible() && RenderStyle::isCurrentColor(m_top.color()))
+|| (m_right.isVisible() && RenderStyle::isCurrentColor(m_right.color()))
+|| (m_bottom.isVisible() && RenderStyle::isCurrentColor(m_bottom.color()))
+|| (m_left.isVisible() && RenderStyle::isCurrentColor(m_left.color()));
+return !visibleBorderHasCurrentColor;
 }
 
 TextStream& operator<<(TextStream& ts, const BorderValue& borderValue)






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [294612] trunk

2022-05-21 Thread zalan
Title: [294612] trunk








Revision 294612
Author za...@apple.com
Date 2022-05-21 05:38:30 -0700 (Sat, 21 May 2022)


Log Message
Text selection does not show continuous selection when dragging across pages with widows
https://bugs.webkit.org/show_bug.cgi?id=240753


Reviewed by Antti Koivisto.

Use the correct variable to mark the line.

Test: fast/multicol/incorrect-is-first-line-after-page-break-with-widow.html
* Source/WebCore/layout/integration/inline/InlineIteratorLineBox.cpp:
(WebCore::InlineIterator::LineBoxIterator::operator bool const):
* Source/WebCore/layout/integration/inline/InlineIteratorLineBox.h:
(WebCore::InlineIterator::LineBoxIterator::operator bool const): Deleted.
* Source/WebCore/layout/integration/inline/LayoutIntegrationPagination.cpp:
(WebCore::LayoutIntegration::adjustLinePositionsForPagination):
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::lineIndexAfterPageBreak):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:
* LayoutTests/fast/multicol/incorrect-is-first-line-after-page-break-with-widow-expected.txt: Added.
* LayoutTests/fast/multicol/incorrect-is-first-line-after-page-break-with-widow.html: Added.

Canonical link: https://commits.webkit.org/250838@main

Modified Paths

trunk/Source/WebCore/layout/integration/inline/InlineIteratorLineBox.cpp
trunk/Source/WebCore/layout/integration/inline/InlineIteratorLineBox.h
trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationPagination.cpp
trunk/Source/WebCore/testing/Internals.cpp
trunk/Source/WebCore/testing/Internals.h
trunk/Source/WebCore/testing/Internals.idl


Added Paths

trunk/LayoutTests/fast/multicol/incorrect-is-first-line-after-page-break-with-widow-expected.txt
trunk/LayoutTests/fast/multicol/incorrect-is-first-line-after-page-break-with-widow.html




Diff

Added: trunk/LayoutTests/fast/multicol/incorrect-is-first-line-after-page-break-with-widow-expected.txt (0 => 294612)

--- trunk/LayoutTests/fast/multicol/incorrect-is-first-line-after-page-break-with-widow-expected.txt	(rev 0)
+++ trunk/LayoutTests/fast/multicol/incorrect-is-first-line-after-page-break-with-widow-expected.txt	2022-05-21 12:38:30 UTC (rev 294612)
@@ -0,0 +1 @@
+5 lines left on the previous page.


Added: trunk/LayoutTests/fast/multicol/incorrect-is-first-line-after-page-break-with-widow.html (0 => 294612)

--- trunk/LayoutTests/fast/multicol/incorrect-is-first-line-after-page-break-with-widow.html	(rev 0)
+++ trunk/LayoutTests/fast/multicol/incorrect-is-first-line-after-page-break-with-widow.html	2022-05-21 12:38:30 UTC (rev 294612)
@@ -0,0 +1,61 @@
+
+div {
+  widows: 15;
+  font-family: Ahem;
+}
+
+
+
+1 some text
+2 some text
+3 some text
+4 some text
+5 some text
+6 some text
+7 some text
+8 some text
+9 some text
+10 some text
+11 some text
+12 some text
+13 some text
+14 some text
+15 some text
+16 some text
+17 some text
+18 some text
+19 some text
+20 some text
+
+
+
+1 some text
+2 some text
+3 some text
+4 some text
+5 some text
+6 some text
+7 some text
+8 some text
+9 some text
+10 some text
+11 some text
+12 some text
+13 some text
+14 some text
+15 some text
+16 some text
+17 some text
+18 some text
+19 some text
+20 some text
+
+
+
+if (window.testRunner)
+  testRunner.dumpAsText();
+if (window.internals) {
+  internals.setPagination("LeftToRightPaginated", 0);
+  document.body.innerText = internals.lineIndexAfterPageBreak(document.getElementById("page_overflow")) + " lines left on the previous page.";
+}
+


Modified: trunk/Source/WebCore/layout/integration/inline/InlineIteratorLineBox.cpp (294611 => 294612)

--- trunk/Source/WebCore/layout/integration/inline/InlineIteratorLineBox.cpp	2022-05-21 06:19:29 UTC (rev 294611)
+++ trunk/Source/WebCore/layout/integration/inline/InlineIteratorLineBox.cpp	2022-05-21 12:38:30 UTC (rev 294612)
@@ -66,6 +66,11 @@
 return *this;
 }
 
+LineBoxIterator::operator bool() const
+{
+return !atEnd();
+}
+
 bool LineBoxIterator::operator==(const LineBoxIterator& other) const
 {
 return m_lineBox.m_pathVariant == other.m_lineBox.m_pathVariant;


Modified: trunk/Source/WebCore/layout/integration/inline/InlineIteratorLineBox.h (294611 => 294612)

--- trunk/Source/WebCore/layout/integration/inline/InlineIteratorLineBox.h	2022-05-21 06:19:29 UTC (rev 294611)
+++ trunk/Source/WebCore/layout/integration/inline/InlineIteratorLineBox.h	2022-05-21 12:38:30 UTC (rev 294612)
@@ -99,10 +99,10 @@
 LineBoxIterator(const LineBox&);
 
 LineBoxIterator& operator++() { return traverseNext(); }
-LineBoxIterator& traverseNext();
+WEBCORE_EXPORT LineBoxIterator& traverseNext();
 LineBoxIterator& traversePrevious();
 
-explicit operator bool() const { return !atEnd(); }
+WEBCORE_EXPORT explicit operator bool() const;
 
 bool operator==(const LineBoxIterator&) const;
 bool operator!=(const LineBoxIterator& other) const { return !(*this == other); }
@@ -119,7 +119,7 @@
 

[webkit-changes] [294503] trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp

2022-05-19 Thread zalan
Title: [294503] trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp








Revision 294503
Author za...@apple.com
Date 2022-05-19 12:57:08 -0700 (Thu, 19 May 2022)


Log Message
Changing text color and removing line-clamp on hover causes text to disappear permanently
https://bugs.webkit.org/show_bug.cgi?id=240410

Reviewed by Darin Adler.

Address post-landing review comment.
* Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::styleWillChange):

Canonical link: https://commits.webkit.org/250760@main

Modified Paths

trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp




Diff

Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (294502 => 294503)

--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2022-05-19 19:54:13 UTC (rev 294502)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2022-05-19 19:57:08 UTC (rev 294503)
@@ -186,7 +186,7 @@
 for (auto& child : childrenOfType(*this))
 child.invalidateLineLayoutPath();
 
-if (hadLineClamp && !hasLineClamp)
+if (hadLineClamp)
 clearLineClamp();
 }
 }






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [294463] trunk/Source/WebCore/layout

2022-05-18 Thread zalan
Title: [294463] trunk/Source/WebCore/layout








Revision 294463
Author za...@apple.com
Date 2022-05-18 20:05:09 -0700 (Wed, 18 May 2022)


Log Message
Add support for simple 'flex-grow'
https://bugs.webkit.org/show_bug.cgi?id=240561

Reviewed by Antti Koivisto.

This is a basic "flex grow" implementation ignoring min/max values.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::setFlexItemsGeometry):
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::updateRenderers const):

Canonical link: https://commits.webkit.org/250725@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (294462 => 294463)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-19 02:29:12 UTC (rev 294462)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-19 03:05:09 UTC (rev 294463)
@@ -197,6 +197,10 @@
 break;
 }
 flexItemGeometry.setLogicalTopLeft(topLeft);
+if (direction == FlexDirection::Row || direction == FlexDirection::RowReverse)
+flexItemGeometry.setContentBoxWidth(logicalFlexItem.rect.width() - flexItemGeometry.horizontalMarginBorderAndPadding());
+else
+flexItemGeometry.setContentBoxHeight(logicalFlexItem.rect.width() - flexItemGeometry.verticalMarginBorderAndPadding());
 }
 }
 
@@ -204,12 +208,35 @@
 {
 auto logicalFlexItemList = convertFlexItemsToLogicalSpace();
 
+auto totalGrowth = 0.f;
+auto totalFixedWidth = LayoutUnit { };
+
+for (auto& logicalFlexItem : logicalFlexItemList) {
+totalGrowth += logicalFlexItem.layoutBox->style().flexGrow();
+// FIXME: Use min/max here.
+totalFixedWidth += logicalFlexItem.rect.width();
+}
+
 auto logicalLeft = LayoutUnit { };
 auto logicalTop = LayoutUnit { };
+auto availableWidth = constraints.horizontal().logicalWidth;
+auto flexibleWidth = availableWidth - totalFixedWidth;
 
 for (auto& logicalFlexItem : logicalFlexItemList) {
 logicalFlexItem.rect.setTopLeft({ logicalLeft, logicalTop });
 logicalLeft = logicalFlexItem.rect.right();
+auto growFlexItemIfApplicable = [&] {
+if (flexibleWidth <= 0)
+return;
+auto grow = logicalFlexItem.layoutBox->style().flexGrow();
+if (!grow)
+return;
+// This value specifies the flex grow factor, which determines how much the flex item will grow relative to the
+// rest of the flex items in the flex container when positive free space is distributed.
+logicalFlexItem.rect.setWidth(LayoutUnit { availableWidth * grow / totalGrowth });
+// FIXME: constrain logical width on min width.
+};
+growFlexItemIfApplicable();
 }
 setFlexItemsGeometry(logicalFlexItemList, constraints);
 }


Modified: trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp (294462 => 294463)

--- trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp	2022-05-19 02:29:12 UTC (rev 294462)
+++ trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp	2022-05-19 03:05:09 UTC (rev 294463)
@@ -131,7 +131,10 @@
 auto& layoutBox = boxAndRenderer.box.get();
 
 auto& renderer = downcast(*boxAndRenderer.renderer);
-renderer.setLocation(Layout::BoxGeometry::borderBoxTopLeft(m_flexFormattingState.boxGeometry(layoutBox)));
+auto& flexItemGeometry = m_flexFormattingState.boxGeometry(layoutBox);
+auto borderBox = Layout::BoxGeometry::borderBoxRect(flexItemGeometry);
+renderer.setLocation(borderBox.topLeft());
+renderer.setWidth(borderBox.width());
 }
 }
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [294412] trunk/Source/WebCore/layout/formattingContexts/flex

2022-05-18 Thread zalan
Title: [294412] trunk/Source/WebCore/layout/formattingContexts/flex








Revision 294412
Author za...@apple.com
Date 2022-05-18 11:37:30 -0700 (Wed, 18 May 2022)


Log Message
Move visual/logical code to dedicated functions
https://bugs.webkit.org/show_bug.cgi?id=240560

Reviewed by Antti Koivisto.

This is in preparation for adding more pre/post core layout logic.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::convertFlexItemsToLogicalSpace):
(WebCore::Layout::FlexFormattingContext::setFlexItemsGeometry):
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
(): Deleted.
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h:

Canonical link: https://commits.webkit.org/250704@main

Modified Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h




Diff

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (294411 => 294412)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-18 18:33:44 UTC (rev 294411)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-18 18:37:30 UTC (rev 294412)
@@ -119,20 +119,13 @@
 }
 }
 
-struct FlexItemLogicalBox {
-FlexRect rect;
-int logicalOrder { 0 };
-CheckedPtr flexItem;
-};
-
-void FlexFormattingContext::layoutInFlowContentForIntegration(const ConstraintsForInFlowContent& constraints)
+FlexFormattingContext::LogicalFlexItems FlexFormattingContext::convertFlexItemsToLogicalSpace()
 {
 auto& formattingState = this->formattingState();
-Vector logicalFlexItemList;
+LogicalFlexItems logicalFlexItemList;
 auto flexItemsNeedReordering = false;
 
 auto convertVisualToLogical = [&] {
-// FIXME: Convert visual (row/column) direction to logical.
 auto direction = root().style().flexDirection();
 auto previousLogicalOrder = std::optional { };
 
@@ -158,7 +151,6 @@
 previousLogicalOrder = flexItemOrder;
 
 logicalFlexItemList.append({ { logicalSize }, flexItemOrder,  });
-
 }
 };
 convertVisualToLogical();
@@ -173,6 +165,45 @@
 };
 reorderFlexItemsIfApplicable();
 
+return logicalFlexItemList;
+}
+
+void FlexFormattingContext::setFlexItemsGeometry(const LogicalFlexItems& logicalFlexItemList, const ConstraintsForInFlowContent& constraints)
+{
+auto& formattingState = this->formattingState();
+auto logicalWidth = logicalFlexItemList.last().rect.right() - logicalFlexItemList.first().rect.left();
+auto direction = root().style().flexDirection();
+for (auto& logicalFlexItem : logicalFlexItemList) {
+auto& flexItemGeometry = formattingState.boxGeometry(*logicalFlexItem.layoutBox);
+auto topLeft = LayoutPoint { };
+
+switch (direction) {
+case FlexDirection::Row:
+topLeft = { constraints.horizontal().logicalLeft + logicalFlexItem.rect.left(), constraints.logicalTop() + logicalFlexItem.rect.top() };
+break;
+case FlexDirection::RowReverse:
+topLeft = { constraints.horizontal().logicalRight() - logicalFlexItem.rect.right(), constraints.logicalTop() + logicalFlexItem.rect.top() };
+break;
+case FlexDirection::Column: {
+auto flippedTopLeft = logicalFlexItem.rect.topLeft().transposedPoint();
+topLeft = { constraints.horizontal().logicalLeft + flippedTopLeft.x(), constraints.logicalTop() + flippedTopLeft.y() };
+break;
+}
+case FlexDirection::ColumnReverse:
+topLeft = { constraints.horizontal().logicalLeft + logicalFlexItem.rect.top(), constraints.logicalTop() + logicalWidth - logicalFlexItem.rect.right() };
+break;
+default:
+ASSERT_NOT_REACHED();
+break;
+}
+flexItemGeometry.setLogicalTopLeft(topLeft);
+}
+}
+
+void FlexFormattingContext::layoutInFlowContentForIntegration(const ConstraintsForInFlowContent& constraints)
+{
+auto logicalFlexItemList = convertFlexItemsToLogicalSpace();
+
 auto logicalLeft = LayoutUnit { };
 auto logicalTop = LayoutUnit { };
 
@@ -180,38 +211,7 @@
 logicalFlexItem.rect.setTopLeft({ logicalLeft, logicalTop });
 logicalLeft = logicalFlexItem.rect.right();
 }
-
-auto convertLogicalToVisual = [&] {
-// FIXME: Convert logical coordinates to visual.
-auto logicalWidth = logicalFlexItemList.last().rect.right() - logicalFlexItemList.first().rect.left();
-auto direction = root().style().flexDirection();
-for (auto& logicalFlexItem : logicalFlexItemList) {
-auto& flexItemGeometry = formattingState.boxGeometry(*logicalFlexItem.flexItem);
-auto topLeft = LayoutPoint { };
-
-switch (direction) {
- 

[webkit-changes] [294404] trunk/metadata/contributors.json

2022-05-18 Thread zalan
Title: [294404] trunk/metadata/contributors.json








Revision 294404
Author za...@apple.com
Date 2022-05-18 10:28:13 -0700 (Wed, 18 May 2022)


Log Message
Add github account to contributors.json
https://bugs.webkit.org/show_bug.cgi?id=240583

Reviewed by Antti Koivisto.

* metadata/contributors.json:

Canonical link: https://commits.webkit.org/250698@main

Modified Paths

trunk/metadata/contributors.json




Diff

Modified: trunk/metadata/contributors.json (294403 => 294404)

--- trunk/metadata/contributors.json	2022-05-18 17:26:42 UTC (rev 294403)
+++ trunk/metadata/contributors.json	2022-05-18 17:28:13 UTC (rev 294404)
@@ -222,7 +222,8 @@
  "zbuj...@gmail.com",
  "zalan.buj...@nokia.com"
   ],
-  "expertise" : "Layout and Rendering, subpixel positioning, frame flattening",
+  "expertise" : "Layout",
+  "github" : "alanbujtas",
   "name" : "Alan Bujtas",
   "nicks" : [
  "zalan"






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [294240] trunk/Source/WebCore

2022-05-16 Thread zalan
Title: [294240] trunk/Source/WebCore








Revision 294240
Author za...@apple.com
Date 2022-05-16 10:35:40 -0700 (Mon, 16 May 2022)


Log Message
[LFC][FFC] Add support for logical ordering
https://bugs.webkit.org/show_bug.cgi?id=240442

Reviewed by Antti Koivisto.

Let's reorder the logicalFlexItemList when the 'order' property has a non-initial value.

* layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (294239 => 294240)

--- trunk/Source/WebCore/ChangeLog	2022-05-16 17:30:34 UTC (rev 294239)
+++ trunk/Source/WebCore/ChangeLog	2022-05-16 17:35:40 UTC (rev 294240)
@@ -1,5 +1,17 @@
 2022-05-16  Alan Bujtas  
 
+[LFC][FFC] Add support for logical ordering
+https://bugs.webkit.org/show_bug.cgi?id=240442
+
+Reviewed by Antti Koivisto.
+
+Let's reorder the logicalFlexItemList when the 'order' property has a non-initial value.
+
+* layout/formattingContexts/flex/FlexFormattingContext.cpp:
+(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
+
+2022-05-16  Alan Bujtas  
+
 [LFC][FFC] Add "flex-direction: column-reverse" basic visual/logical conversion
 https://bugs.webkit.org/show_bug.cgi?id=240434
 


Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (294239 => 294240)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-16 17:30:34 UTC (rev 294239)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-16 17:35:40 UTC (rev 294240)
@@ -121,7 +121,8 @@
 
 struct FlexItemLogicalBox {
 FlexRect rect;
-const ContainerBox& flexItem;
+int logicalOrder { 0 };
+CheckedPtr flexItem;
 };
 
 void FlexFormattingContext::layoutInFlowContentForIntegration(const ConstraintsForInFlowContent& constraints)
@@ -128,11 +129,12 @@
 {
 auto& formattingState = this->formattingState();
 Vector logicalFlexItemList;
+auto flexItemsNeedReordering = false;
 
-
 auto convertVisualToLogical = [&] {
 // FIXME: Convert visual (row/column) direction to logical.
 auto direction = root().style().flexDirection();
+auto previousLogicalOrder = std::optional { };
 
 for (auto& flexItem : childrenOfType(root())) {
 auto& flexItemGeometry = formattingState.boxGeometry(flexItem);
@@ -151,11 +153,26 @@
 ASSERT_NOT_REACHED();
 break;
 }
-logicalFlexItemList.append({ { logicalSize }, flexItem });
+auto flexItemOrder = flexItem.style().order();
+flexItemsNeedReordering = flexItemsNeedReordering || flexItemOrder != previousLogicalOrder.value_or(0);
+previousLogicalOrder = flexItemOrder;
+
+logicalFlexItemList.append({ { logicalSize }, flexItemOrder,  });
+
 }
 };
 convertVisualToLogical();
 
+auto reorderFlexItemsIfApplicable = [&] {
+if (!flexItemsNeedReordering)
+return;
+
+std::stable_sort(logicalFlexItemList.begin(), logicalFlexItemList.end(), [&] (auto& a, auto& b) {
+return a.logicalOrder < b.logicalOrder;
+});
+};
+reorderFlexItemsIfApplicable();
+
 auto logicalLeft = LayoutUnit { };
 auto logicalTop = LayoutUnit { };
 
@@ -169,7 +186,7 @@
 auto logicalWidth = logicalFlexItemList.last().rect.right() - logicalFlexItemList.first().rect.left();
 auto direction = root().style().flexDirection();
 for (auto& logicalFlexItem : logicalFlexItemList) {
-auto& flexItemGeometry = formattingState.boxGeometry(logicalFlexItem.flexItem);
+auto& flexItemGeometry = formattingState.boxGeometry(*logicalFlexItem.flexItem);
 auto topLeft = LayoutPoint { };
 
 switch (direction) {






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [294237] trunk/Source/WebCore

2022-05-16 Thread zalan
Title: [294237] trunk/Source/WebCore








Revision 294237
Author za...@apple.com
Date 2022-05-16 09:33:38 -0700 (Mon, 16 May 2022)


Log Message
[LFC][FFC] Add "flex-direction: column-reverse" basic visual/logical conversion
https://bugs.webkit.org/show_bug.cgi?id=240434

Reviewed by Antti Koivisto.

With "flex-direction: column-reverse" the main axis progression is from visual bottom to top (with default writing mode and all that).

* layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (294236 => 294237)

--- trunk/Source/WebCore/ChangeLog	2022-05-16 16:18:10 UTC (rev 294236)
+++ trunk/Source/WebCore/ChangeLog	2022-05-16 16:33:38 UTC (rev 294237)
@@ -1,3 +1,15 @@
+2022-05-16  Alan Bujtas  
+
+[LFC][FFC] Add "flex-direction: column-reverse" basic visual/logical conversion
+https://bugs.webkit.org/show_bug.cgi?id=240434
+
+Reviewed by Antti Koivisto.
+
+With "flex-direction: column-reverse" the main axis progression is from visual bottom to top (with default writing mode and all that).
+
+* layout/formattingContexts/flex/FlexFormattingContext.cpp:
+(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
+
 2022-05-16  Patrick Angle  
 
 Web Inspector: Regression(r266885) Crash sometimes when rehydrating imported audit results


Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (294236 => 294237)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-16 16:18:10 UTC (rev 294236)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-16 16:33:38 UTC (rev 294237)
@@ -144,11 +144,9 @@
 logicalSize = { flexItemGeometry.marginBoxWidth(), flexItemGeometry.marginBoxHeight() };
 break;
 case FlexDirection::Column:
+case FlexDirection::ColumnReverse:
 logicalSize = { flexItemGeometry.marginBoxHeight(), flexItemGeometry.marginBoxWidth() };
 break;
-case FlexDirection::ColumnReverse:
-ASSERT_NOT_IMPLEMENTED_YET();
-break;
 default:
 ASSERT_NOT_REACHED();
 break;
@@ -168,6 +166,7 @@
 
 auto convertLogicalToVisual = [&] {
 // FIXME: Convert logical coordinates to visual.
+auto logicalWidth = logicalFlexItemList.last().rect.right() - logicalFlexItemList.first().rect.left();
 auto direction = root().style().flexDirection();
 for (auto& logicalFlexItem : logicalFlexItemList) {
 auto& flexItemGeometry = formattingState.boxGeometry(logicalFlexItem.flexItem);
@@ -186,7 +185,7 @@
 break;
 }
 case FlexDirection::ColumnReverse:
-ASSERT_NOT_IMPLEMENTED_YET();
+topLeft = { constraints.horizontal().logicalLeft + logicalFlexItem.rect.top(), constraints.logicalTop() + logicalWidth - logicalFlexItem.rect.right() };
 break;
 default:
 ASSERT_NOT_REACHED();






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [294233] trunk/Source/WebCore

2022-05-16 Thread zalan
Title: [294233] trunk/Source/WebCore








Revision 294233
Author za...@apple.com
Date 2022-05-16 08:08:11 -0700 (Mon, 16 May 2022)


Log Message
[LFC][FFC] Add "flex-direction: row-reverse" basic visual/logical conversion
https://bugs.webkit.org/show_bug.cgi?id=240432

Reviewed by Antti Koivisto.

With "flex-direction: row-reverse" the main axis progression is from visual right to left (with default writing mode and all that).

* layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (294232 => 294233)

--- trunk/Source/WebCore/ChangeLog	2022-05-16 13:55:35 UTC (rev 294232)
+++ trunk/Source/WebCore/ChangeLog	2022-05-16 15:08:11 UTC (rev 294233)
@@ -1,5 +1,17 @@
 2022-05-16  Alan Bujtas  
 
+[LFC][FFC] Add "flex-direction: row-reverse" basic visual/logical conversion
+https://bugs.webkit.org/show_bug.cgi?id=240432
+
+Reviewed by Antti Koivisto.
+
+With "flex-direction: row-reverse" the main axis progression is from visual right to left (with default writing mode and all that).
+
+* layout/formattingContexts/flex/FlexFormattingContext.cpp:
+(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
+
+2022-05-16  Alan Bujtas  
+
 [LFC][FFC] Add "flex-direction: column" basic visual/logical conversion
 https://bugs.webkit.org/show_bug.cgi?id=240430
 


Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (294232 => 294233)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-16 13:55:35 UTC (rev 294232)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-16 15:08:11 UTC (rev 294233)
@@ -129,16 +129,11 @@
 auto& formattingState = this->formattingState();
 Vector logicalFlexItemList;
 
-auto logicalLeft = LayoutUnit { };
-auto logicalTop = LayoutUnit { };
 
 auto convertVisualToLogical = [&] {
 // FIXME: Convert visual (row/column) direction to logical.
 auto direction = root().style().flexDirection();
 
-logicalLeft = constraints.horizontal().logicalLeft;
-logicalTop = constraints.logicalTop();
-
 for (auto& flexItem : childrenOfType(root())) {
 auto& flexItemGeometry = formattingState.boxGeometry(flexItem);
 auto logicalSize = LayoutSize { };
@@ -145,12 +140,12 @@
 
 switch (direction) {
 case FlexDirection::Row:
+case FlexDirection::RowReverse:
 logicalSize = { flexItemGeometry.marginBoxWidth(), flexItemGeometry.marginBoxHeight() };
 break;
 case FlexDirection::Column:
 logicalSize = { flexItemGeometry.marginBoxHeight(), flexItemGeometry.marginBoxWidth() };
 break;
-case FlexDirection::RowReverse:
 case FlexDirection::ColumnReverse:
 ASSERT_NOT_IMPLEMENTED_YET();
 break;
@@ -163,6 +158,9 @@
 };
 convertVisualToLogical();
 
+auto logicalLeft = LayoutUnit { };
+auto logicalTop = LayoutUnit { };
+
 for (auto& logicalFlexItem : logicalFlexItemList) {
 logicalFlexItem.rect.setTopLeft({ logicalLeft, logicalTop });
 logicalLeft = logicalFlexItem.rect.right();
@@ -177,12 +175,16 @@
 
 switch (direction) {
 case FlexDirection::Row:
-topLeft = logicalFlexItem.rect.topLeft();
+topLeft = { constraints.horizontal().logicalLeft + logicalFlexItem.rect.left(), constraints.logicalTop() + logicalFlexItem.rect.top() };
 break;
-case FlexDirection::Column:
-topLeft = logicalFlexItem.rect.topLeft().transposedPoint();
+case FlexDirection::RowReverse:
+topLeft = { constraints.horizontal().logicalRight() - logicalFlexItem.rect.right(), constraints.logicalTop() + logicalFlexItem.rect.top() };
 break;
-case FlexDirection::RowReverse:
+case FlexDirection::Column: {
+auto flippedTopLeft = logicalFlexItem.rect.topLeft().transposedPoint();
+topLeft = { constraints.horizontal().logicalLeft + flippedTopLeft.x(), constraints.logicalTop() + flippedTopLeft.y() };
+break;
+}
 case FlexDirection::ColumnReverse:
 ASSERT_NOT_IMPLEMENTED_YET();
 break;






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [294231] trunk/Source/WebCore

2022-05-16 Thread zalan
Title: [294231] trunk/Source/WebCore








Revision 294231
Author za...@apple.com
Date 2022-05-16 06:16:41 -0700 (Mon, 16 May 2022)


Log Message
[LFC][FFC] Add "flex-direction: column" basic visual/logical conversion
https://bugs.webkit.org/show_bug.cgi?id=240430

Reviewed by Antti Koivisto.

With "flex-direction: column" the main axis progression is based on the margin box height.

* layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (294230 => 294231)

--- trunk/Source/WebCore/ChangeLog	2022-05-16 12:54:14 UTC (rev 294230)
+++ trunk/Source/WebCore/ChangeLog	2022-05-16 13:16:41 UTC (rev 294231)
@@ -1,3 +1,15 @@
+2022-05-16  Alan Bujtas  
+
+[LFC][FFC] Add "flex-direction: column" basic visual/logical conversion
+https://bugs.webkit.org/show_bug.cgi?id=240430
+
+Reviewed by Antti Koivisto.
+
+With "flex-direction: column" the main axis progression is based on the margin box height.
+
+* layout/formattingContexts/flex/FlexFormattingContext.cpp:
+(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
+
 2022-05-15  Philippe Normand  
 
 REGRESSION(r294104): [GStreamer] getUserMedia broken


Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (294230 => 294231)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-16 12:54:14 UTC (rev 294230)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-16 13:16:41 UTC (rev 294231)
@@ -134,12 +134,31 @@
 
 auto convertVisualToLogical = [&] {
 // FIXME: Convert visual (row/column) direction to logical.
+auto direction = root().style().flexDirection();
+
 logicalLeft = constraints.horizontal().logicalLeft;
 logicalTop = constraints.logicalTop();
-
+
 for (auto& flexItem : childrenOfType(root())) {
 auto& flexItemGeometry = formattingState.boxGeometry(flexItem);
-logicalFlexItemList.append({ { LayoutSize { flexItemGeometry.marginBoxWidth(), flexItemGeometry.marginBoxHeight() } }, flexItem });
+auto logicalSize = LayoutSize { };
+
+switch (direction) {
+case FlexDirection::Row:
+logicalSize = { flexItemGeometry.marginBoxWidth(), flexItemGeometry.marginBoxHeight() };
+break;
+case FlexDirection::Column:
+logicalSize = { flexItemGeometry.marginBoxHeight(), flexItemGeometry.marginBoxWidth() };
+break;
+case FlexDirection::RowReverse:
+case FlexDirection::ColumnReverse:
+ASSERT_NOT_IMPLEMENTED_YET();
+break;
+default:
+ASSERT_NOT_REACHED();
+break;
+}
+logicalFlexItemList.append({ { logicalSize }, flexItem });
 }
 };
 convertVisualToLogical();
@@ -151,9 +170,27 @@
 
 auto convertLogicalToVisual = [&] {
 // FIXME: Convert logical coordinates to visual.
+auto direction = root().style().flexDirection();
 for (auto& logicalFlexItem : logicalFlexItemList) {
 auto& flexItemGeometry = formattingState.boxGeometry(logicalFlexItem.flexItem);
-flexItemGeometry.setLogicalTopLeft(logicalFlexItem.rect.topLeft());
+auto topLeft = LayoutPoint { };
+
+switch (direction) {
+case FlexDirection::Row:
+topLeft = logicalFlexItem.rect.topLeft();
+break;
+case FlexDirection::Column:
+topLeft = logicalFlexItem.rect.topLeft().transposedPoint();
+break;
+case FlexDirection::RowReverse:
+case FlexDirection::ColumnReverse:
+ASSERT_NOT_IMPLEMENTED_YET();
+break;
+default:
+ASSERT_NOT_REACHED();
+break;
+}
+flexItemGeometry.setLogicalTopLeft(topLeft);
 }
 };
 convertLogicalToVisual();






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [294217] trunk/Source/WebCore

2022-05-15 Thread zalan
Title: [294217] trunk/Source/WebCore








Revision 294217
Author za...@apple.com
Date 2022-05-15 09:53:19 -0700 (Sun, 15 May 2022)


Log Message
[LFC][FFC] Introduce logical direction based flex layout
https://bugs.webkit.org/show_bug.cgi?id=240424

Reviewed by Antti Koivisto.

This is in preparation for ensuring that core flex layout only needs to deal with
one direction for flex content progression (row vs. column vs. reversed etc).

* WebCore.xcodeproj/project.pbxproj:
* layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForFlexLayout):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp


Added Paths

trunk/Source/WebCore/layout/formattingContexts/flex/FlexRect.h




Diff

Modified: trunk/Source/WebCore/ChangeLog (294216 => 294217)

--- trunk/Source/WebCore/ChangeLog	2022-05-15 15:49:21 UTC (rev 294216)
+++ trunk/Source/WebCore/ChangeLog	2022-05-15 16:53:19 UTC (rev 294217)
@@ -1,3 +1,19 @@
+2022-05-15  Alan Bujtas  
+
+[LFC][FFC] Introduce logical direction based flex layout
+https://bugs.webkit.org/show_bug.cgi?id=240424
+
+Reviewed by Antti Koivisto.
+
+This is in preparation for ensuring that core flex layout only needs to deal with
+one direction for flex content progression (row vs. column vs. reversed etc).
+
+* WebCore.xcodeproj/project.pbxproj:
+* layout/formattingContexts/flex/FlexFormattingContext.cpp:
+(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
+* layout/integration/LayoutIntegrationCoverage.cpp:
+(WebCore::LayoutIntegration::canUseForFlexLayout):
+
 2022-05-15  Kimmo Kinnunen  
 
 WebCore::IOSurface has WebCore::GraphicsContext as its property, it should be the other way around


Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (294216 => 294217)

--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-05-15 15:49:21 UTC (rev 294216)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-05-15 16:53:19 UTC (rev 294217)
@@ -2257,6 +2257,7 @@
 		6FB5E214221F2453003989CF /* ContentChangeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB5E212221F2447003989CF /* ContentChangeObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6FB7D2DD250FD828000207AA /* FlexFormattingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB7D2D9250FD7FC000207AA /* FlexFormattingContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6FB7D2DE250FD82E000207AA /* FlexFormattingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB7D2DA250FD7FC000207AA /* FlexFormattingState.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		6FB9105C2830BC8A4929 /* FlexRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB9105B2830BC8A4929 /* FlexRect.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6FC3F9472516756700A49BEA /* InlineDisplayBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FC3F9452516756600A49BEA /* InlineDisplayBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6FCBDB97265DF2C80021EA7B /* LayoutContainingBlockChainIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FCBDB95265DF2C70021EA7B /* LayoutContainingBlockChainIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6FD09543251115220098877D /* LayoutGeometryRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FD09541251115220098877D /* LayoutGeometryRect.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -11092,6 +11093,7 @@
 		6FB7D2D8250FD7EF000207AA /* FlexFormattingState.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FlexFormattingState.cpp; sourceTree = ""; };
 		6FB7D2D9250FD7FC000207AA /* FlexFormattingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlexFormattingContext.h; sourceTree = ""; };
 		6FB7D2DA250FD7FC000207AA /* FlexFormattingState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlexFormattingState.h; sourceTree = ""; };
+		6FB9105B2830BC8A4929 /* FlexRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlexRect.h; sourceTree = ""; };
 		6FBB860520B464B600DAD938 /* FormattingGeometry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FormattingGeometry.cpp; sourceTree = ""; };
 		6FC3F9452516756600A49BEA /* InlineDisplayBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineDisplayBox.h; sourceTree = ""; };
 		6FC53AEB24AF7A8E006059FE /* TableFormattingQuirks.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = 

[webkit-changes] [294211] trunk

2022-05-14 Thread zalan
Title: [294211] trunk








Revision 294211
Author za...@apple.com
Date 2022-05-14 15:39:40 -0700 (Sat, 14 May 2022)


Log Message
Changing text color and removing line-clamp on hover causes text to disappear permanently
https://bugs.webkit.org/show_bug.cgi?id=240410

Reviewed by Simon Fraser.

Source/WebCore:

Invalidate the flex items' line layout path when line-clamp property value changes.

While the line clamp property is set on the flex box, it is "forced on" the flex items' inline content.
(i.e. the property is not inherited, it is propagated to the flex children)
It means dynamic value change only runs on the flex box renderer.

Test: fast/block/dynamic-line-clamp-empty-content.html

* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::styleWillChange):

LayoutTests:

* fast/block/dynamic-line-clamp-empty-content-expected.html: Added.
* fast/block/dynamic-line-clamp-empty-content.html: Added.

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp


Added Paths

trunk/LayoutTests/fast/block/dynamic-line-clamp-empty-content-expected.html
trunk/LayoutTests/fast/block/dynamic-line-clamp-empty-content.html




Diff

Modified: trunk/LayoutTests/ChangeLog (294210 => 294211)

--- trunk/LayoutTests/ChangeLog	2022-05-14 21:35:41 UTC (rev 294210)
+++ trunk/LayoutTests/ChangeLog	2022-05-14 22:39:40 UTC (rev 294211)
@@ -1,5 +1,15 @@
 2022-05-14  Alan Bujtas  
 
+Changing text color and removing line-clamp on hover causes text to disappear permanently
+https://bugs.webkit.org/show_bug.cgi?id=240410
+
+Reviewed by Simon Fraser.
+
+* fast/block/dynamic-line-clamp-empty-content-expected.html: Added.
+* fast/block/dynamic-line-clamp-empty-content.html: Added.
+
+2022-05-14  Alan Bujtas  
+
 [Repaint] Border ignores currentColor change when hovering
 https://bugs.webkit.org/show_bug.cgi?id=240401
 


Added: trunk/LayoutTests/fast/block/dynamic-line-clamp-empty-content-expected.html (0 => 294211)

--- trunk/LayoutTests/fast/block/dynamic-line-clamp-empty-content-expected.html	(rev 0)
+++ trunk/LayoutTests/fast/block/dynamic-line-clamp-empty-content-expected.html	2022-05-14 22:39:40 UTC (rev 294211)
@@ -0,0 +1,10 @@
+
+#clamp {
+  width: 100px;
+  overflow: hidden;
+  display: -webkit-box;
+  -webkit-box-orient: block-axis;
+  -webkit-line-clamp: 2;
+}
+
+This text should stay visible after setting line clamp on it.


Added: trunk/LayoutTests/fast/block/dynamic-line-clamp-empty-content.html (0 => 294211)

--- trunk/LayoutTests/fast/block/dynamic-line-clamp-empty-content.html	(rev 0)
+++ trunk/LayoutTests/fast/block/dynamic-line-clamp-empty-content.html	2022-05-14 22:39:40 UTC (rev 294211)
@@ -0,0 +1,13 @@
+
+#clamp {
+  width: 100px;
+  overflow: hidden;
+  display: -webkit-box;
+  -webkit-box-orient: block-axis;
+}
+
+This text should stay visible after setting line clamp on it.
+
+document.body.offsetHeight;
+clamp.style.webkitLineClamp = '2';
+


Modified: trunk/Source/WebCore/ChangeLog (294210 => 294211)

--- trunk/Source/WebCore/ChangeLog	2022-05-14 21:35:41 UTC (rev 294210)
+++ trunk/Source/WebCore/ChangeLog	2022-05-14 22:39:40 UTC (rev 294211)
@@ -1,5 +1,23 @@
 2022-05-14  Alan Bujtas  
 
+Changing text color and removing line-clamp on hover causes text to disappear permanently
+https://bugs.webkit.org/show_bug.cgi?id=240410
+
+Reviewed by Simon Fraser.
+
+Invalidate the flex items' line layout path when line-clamp property value changes.
+
+While the line clamp property is set on the flex box, it is "forced on" the flex items' inline content.
+(i.e. the property is not inherited, it is propagated to the flex children)
+It means dynamic value change only runs on the flex box renderer.
+
+Test: fast/block/dynamic-line-clamp-empty-content.html
+
+* rendering/RenderDeprecatedFlexibleBox.cpp:
+(WebCore::RenderDeprecatedFlexibleBox::styleWillChange):
+
+2022-05-14  Alan Bujtas  
+
 Unreviewed win build fix.
 
 * layout/integration/flex/LayoutIntegrationFlexLayout.cpp:


Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (294210 => 294211)

--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2022-05-14 21:35:41 UTC (rev 294210)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2022-05-14 22:39:40 UTC (rev 294211)
@@ -179,9 +179,17 @@
 void RenderDeprecatedFlexibleBox::styleWillChange(StyleDifference diff, const RenderStyle& newStyle)
 {
 auto* oldStyle = hasInitializedStyle() ? () : nullptr;
-if (oldStyle && !oldStyle->lineClamp().isNone() && newStyle.lineClamp().isNone())
-clearLineClamp();
+if (oldStyle) {
+auto hadLineClamp = !oldStyle->lineClamp().isNone();
+auto hasLineClamp = !newStyle.lineClamp().isNone(); 
+   

[webkit-changes] [294210] trunk/Source/WebCore

2022-05-14 Thread zalan
Title: [294210] trunk/Source/WebCore








Revision 294210
Author za...@apple.com
Date 2022-05-14 14:35:41 -0700 (Sat, 14 May 2022)


Log Message
Unreviewed win build fix.


* layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::flexBoxLogicalBorder):
(WebCore::LayoutIntegration::flexBoxLogicalPadding):
(WebCore::LayoutIntegration::FlexLayout::updateFormattingRootGeometryAndInvalidate):
(WebCore::LayoutIntegration::logicalBorder): Deleted.
(WebCore::LayoutIntegration::logicalPadding): Deleted.

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (294209 => 294210)

--- trunk/Source/WebCore/ChangeLog	2022-05-14 20:08:58 UTC (rev 294209)
+++ trunk/Source/WebCore/ChangeLog	2022-05-14 21:35:41 UTC (rev 294210)
@@ -1,3 +1,14 @@
+2022-05-14  Alan Bujtas  
+
+Unreviewed win build fix.
+
+* layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
+(WebCore::LayoutIntegration::flexBoxLogicalBorder):
+(WebCore::LayoutIntegration::flexBoxLogicalPadding):
+(WebCore::LayoutIntegration::FlexLayout::updateFormattingRootGeometryAndInvalidate):
+(WebCore::LayoutIntegration::logicalBorder): Deleted.
+(WebCore::LayoutIntegration::logicalPadding): Deleted.
+
 2022-05-10  Yusuke Suzuki  
 
 Rename EventTrackingRegions::Event to EventTrackingRegions::EventType


Modified: trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp (294209 => 294210)

--- trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp	2022-05-14 20:08:58 UTC (rev 294209)
+++ trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp	2022-05-14 21:35:41 UTC (rev 294210)
@@ -46,7 +46,7 @@
 }
 
 // FIXME: Merge these with the other integration layout functions.
-static inline Layout::Edges logicalBorder(const RenderBoxModelObject& renderer, bool isLeftToRightInlineDirection, WritingMode writingMode)
+static inline Layout::Edges flexBoxLogicalBorder(const RenderBoxModelObject& renderer, bool isLeftToRightInlineDirection, WritingMode writingMode)
 {
 UNUSED_PARAM(isLeftToRightInlineDirection);
 UNUSED_PARAM(writingMode);
@@ -59,7 +59,7 @@
 return { { borderLeft, borderRight }, { borderTop, borderBottom } };
 }
 
-static inline Layout::Edges logicalPadding(const RenderBoxModelObject& renderer, bool isLeftToRightInlineDirection, WritingMode writingMode)
+static inline Layout::Edges flexBoxLogicalPadding(const RenderBoxModelObject& renderer, bool isLeftToRightInlineDirection, WritingMode writingMode)
 {
 UNUSED_PARAM(isLeftToRightInlineDirection);
 UNUSED_PARAM(writingMode);
@@ -81,8 +81,8 @@
 auto writingMode = flexBoxRenderer.style().writingMode();
 
 root.setContentBoxWidth(writingMode == WritingMode::TopToBottom ? flexBoxRenderer.contentWidth() : flexBoxRenderer.contentHeight());
-root.setPadding(logicalPadding(flexBoxRenderer, isLeftToRightInlineDirection, writingMode));
-root.setBorder(logicalBorder(flexBoxRenderer, isLeftToRightInlineDirection, writingMode));
+root.setPadding(flexBoxLogicalPadding(flexBoxRenderer, isLeftToRightInlineDirection, writingMode));
+root.setBorder(flexBoxLogicalBorder(flexBoxRenderer, isLeftToRightInlineDirection, writingMode));
 root.setHorizontalMargin({ });
 root.setVerticalMargin({ });
 };






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [294198] trunk/Source/WebCore

2022-05-14 Thread zalan
Title: [294198] trunk/Source/WebCore








Revision 294198
Author za...@apple.com
Date 2022-05-14 09:56:07 -0700 (Sat, 14 May 2022)


Log Message
[FFC][Integration] Add "fixed sized/all default value" flex layout
https://bugs.webkit.org/show_bug.cgi?id=240414

Reviewed by Antti Koivisto.

This patch adds support for the simplest possible flex layout (fixed size, no-wrap, no-reversed etc).

* layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (294197 => 294198)

--- trunk/Source/WebCore/ChangeLog	2022-05-14 16:26:54 UTC (rev 294197)
+++ trunk/Source/WebCore/ChangeLog	2022-05-14 16:56:07 UTC (rev 294198)
@@ -1,3 +1,15 @@
+2022-05-14  Alan Bujtas  
+
+[FFC][Integration] Add "fixed sized/all default value" flex layout
+https://bugs.webkit.org/show_bug.cgi?id=240414
+
+Reviewed by Antti Koivisto.
+
+This patch adds support for the simplest possible flex layout (fixed size, no-wrap, no-reversed etc).
+
+* layout/formattingContexts/flex/FlexFormattingContext.cpp:
+(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
+
 2022-05-14  Kimmo Kinnunen  
 
 WebCore::IOSurface refers to unused context size


Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (294197 => 294198)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-14 16:26:54 UTC (rev 294197)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-05-14 16:56:07 UTC (rev 294198)
@@ -118,8 +118,17 @@
 }
 }
 
-void FlexFormattingContext::layoutInFlowContentForIntegration(const ConstraintsForInFlowContent&)
+void FlexFormattingContext::layoutInFlowContentForIntegration(const ConstraintsForInFlowContent& constraints)
 {
+auto& formattingState = this->formattingState();
+auto mainAxisPosition = constraints.horizontal().logicalLeft;
+auto crossAxisPosition = constraints.logicalTop();
+for (auto& flexItem : childrenOfType(root())) {
+auto& flexItemGeometry = formattingState.boxGeometry(flexItem);
+
+flexItemGeometry.setLogicalTopLeft({ mainAxisPosition, crossAxisPosition });
+mainAxisPosition = BoxGeometry::borderBoxRect(flexItemGeometry).right();
+}
 }
 
 IntrinsicWidthConstraints FlexFormattingContext::computedIntrinsicWidthConstraintsForIntegration()






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [294195] trunk

2022-05-14 Thread zalan
Title: [294195] trunk








Revision 294195
Author za...@apple.com
Date 2022-05-14 08:24:29 -0700 (Sat, 14 May 2022)


Log Message
[Repaint] Border ignores currentColor change when hovering
https://bugs.webkit.org/show_bug.cgi?id=240401

Reviewed by Antti Koivisto.

Source/WebCore:

This patch triggers repaint when currentColor is applied on border.

It most likely got broken at r150259 (9 years ago!) when StyleDifferenceRepaintIfText was introduced.
StyleDifferenceRepaintIfText is a "conditional repaint" diff value which only triggers repaint if the renderer has some text content.

Later, r156619 addressed some of the "content with border/outline is not painting" fallout by extending
StyleDifferenceRepaintIfText to RepaintIfTextOrBorderOrOutline.
RepaintIfTextOrBorderOrOutline turns "conditional repaints" to real repaints if, in addition to text, the content has outline/border.
However the fix was neither complete nor proper (it patched the repaint logic by changing hasImmediateNonWhitespaceTextChildOrBorderOrOutline
instead of computing the correct diff value -unconditional Repaint).

Fast-forward to 2020, r267528 ensured that content with outline is no longer a "conditional repaint".
It also made some of the code introduced in r156619 redundant (see hasImmediateNonWhitespaceTextChildOrBorderOrOutline).

This patch expands on r267528 by introducing isEquivalentForPainting for the border data. It ensures that we
compute (unconditional) Repaint diff value, if the border uses currentColor.

Tests: fast/repaint/repaint-current-color-border-on-hover.html
   fast/repaint/repaint-pseudo-border-on-hover.html

* rendering/RenderElement.cpp:
(WebCore::RenderElement::hasImmediateNonWhitespaceTextChildOrBorderOrOutline const):
* rendering/style/BorderData.h:
(WebCore::BorderData::isEquivalentForPainting const):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeRequiresRepaint const):

LayoutTests:

* fast/repaint/repaint-current-color-border-on-hover-expected.txt: Added.
* fast/repaint/repaint-current-color-border-on-hover.html: Added.
* fast/repaint/repaint-pseudo-border-on-hover-expected.txt: Added.
* fast/repaint/repaint-pseudo-border-on-hover.html: Added.

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp
trunk/Source/WebCore/rendering/RenderElement.cpp
trunk/Source/WebCore/rendering/RenderElement.h
trunk/Source/WebCore/rendering/RenderTextControl.cpp
trunk/Source/WebCore/rendering/style/BorderData.cpp
trunk/Source/WebCore/rendering/style/BorderData.h
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
trunk/Source/WebCore/rendering/style/RenderStyle.h
trunk/Source/WebCore/rendering/style/RenderStyleConstants.cpp
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
trunk/Source/WebCore/rendering/svg/SVGResourcesCache.cpp


Added Paths

trunk/LayoutTests/fast/repaint/repaint-current-color-border-on-hover-expected.txt
trunk/LayoutTests/fast/repaint/repaint-current-color-border-on-hover.html
trunk/LayoutTests/fast/repaint/repaint-pseudo-border-on-hover-expected.txt
trunk/LayoutTests/fast/repaint/repaint-pseudo-border-on-hover.html




Diff

Modified: trunk/LayoutTests/ChangeLog (294194 => 294195)

--- trunk/LayoutTests/ChangeLog	2022-05-14 14:40:27 UTC (rev 294194)
+++ trunk/LayoutTests/ChangeLog	2022-05-14 15:24:29 UTC (rev 294195)
@@ -1,3 +1,15 @@
+2022-05-14  Alan Bujtas  
+
+[Repaint] Border ignores currentColor change when hovering
+https://bugs.webkit.org/show_bug.cgi?id=240401
+
+Reviewed by Antti Koivisto.
+
+* fast/repaint/repaint-current-color-border-on-hover-expected.txt: Added.
+* fast/repaint/repaint-current-color-border-on-hover.html: Added.
+* fast/repaint/repaint-pseudo-border-on-hover-expected.txt: Added.
+* fast/repaint/repaint-pseudo-border-on-hover.html: Added.
+
 2022-05-13  Tim Nguyen  
 
 [css-ui] Unexpose appearance property values already handled by appearance: auto


Added: trunk/LayoutTests/fast/repaint/repaint-current-color-border-on-hover-expected.txt (0 => 294195)

--- trunk/LayoutTests/fast/repaint/repaint-current-color-border-on-hover-expected.txt	(rev 0)
+++ trunk/LayoutTests/fast/repaint/repaint-current-color-border-on-hover-expected.txt	2022-05-14 15:24:29 UTC (rev 294195)
@@ -0,0 +1,4 @@
+(repaint rects
+(rect 8 8 120 120)
+)
+


Added: trunk/LayoutTests/fast/repaint/repaint-current-color-border-on-hover.html (0 => 294195)

--- trunk/LayoutTests/fast/repaint/repaint-current-color-border-on-hover.html	(rev 0)
+++ trunk/LayoutTests/fast/repaint/repaint-current-color-border-on-hover.html	2022-05-14 15:24:29 UTC (rev 294195)
@@ -0,0 +1,31 @@
+
+
+div {
+  width: 100px;
+  height: 100px;
+  background-color: green;
+  border: solid 10px currentColor;
+}
+div:hover {
+  color: green;
+}
+
+
+
+if (window.eventSender) {
+  testRunner.dumpAsText();
+
+  

[webkit-changes] [294193] trunk/Source/WebCore

2022-05-14 Thread zalan
Title: [294193] trunk/Source/WebCore








Revision 294193
Author za...@apple.com
Date 2022-05-14 06:59:52 -0700 (Sat, 14 May 2022)


Log Message
[FFC][Integration] Add updateFormattingRootGeometryAndInvalidate/updateRenderers
https://bugs.webkit.org/show_bug.cgi?id=240413

Reviewed by Antti Koivisto.

Make sure that the layout box/renderer geometries are all up-to-date.

* layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::logicalBorder):
(WebCore::LayoutIntegration::logicalPadding):
(WebCore::LayoutIntegration::FlexLayout::updateFormattingRootGeometryAndInvalidate):
(WebCore::LayoutIntegration::FlexLayout::layout):
(WebCore::LayoutIntegration::FlexLayout::updateRenderers const):
* layout/integration/flex/LayoutIntegrationFlexLayout.h:
(WebCore::LayoutIntegration::FlexLayout::flexBoxRenderer const):
(WebCore::LayoutIntegration::FlexLayout::flexBoxRenderer):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutUsingFlexFormattingContext):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (294192 => 294193)

--- trunk/Source/WebCore/ChangeLog	2022-05-14 13:30:56 UTC (rev 294192)
+++ trunk/Source/WebCore/ChangeLog	2022-05-14 13:59:52 UTC (rev 294193)
@@ -1,5 +1,26 @@
 2022-05-14  Alan Bujtas  
 
+[FFC][Integration] Add updateFormattingRootGeometryAndInvalidate/updateRenderers
+https://bugs.webkit.org/show_bug.cgi?id=240413
+
+Reviewed by Antti Koivisto.
+
+Make sure that the layout box/renderer geometries are all up-to-date.
+
+* layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
+(WebCore::LayoutIntegration::logicalBorder):
+(WebCore::LayoutIntegration::logicalPadding):
+(WebCore::LayoutIntegration::FlexLayout::updateFormattingRootGeometryAndInvalidate):
+(WebCore::LayoutIntegration::FlexLayout::layout):
+(WebCore::LayoutIntegration::FlexLayout::updateRenderers const):
+* layout/integration/flex/LayoutIntegrationFlexLayout.h:
+(WebCore::LayoutIntegration::FlexLayout::flexBoxRenderer const):
+(WebCore::LayoutIntegration::FlexLayout::flexBoxRenderer):
+* rendering/RenderFlexibleBox.cpp:
+(WebCore::RenderFlexibleBox::layoutUsingFlexFormattingContext):
+
+2022-05-14  Alan Bujtas  
+
 [FFC][Integration] Do not reset the effective display value for flex root
 https://bugs.webkit.org/show_bug.cgi?id=240412
 


Modified: trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp (294192 => 294193)

--- trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp	2022-05-14 13:30:56 UTC (rev 294192)
+++ trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp	2022-05-14 13:59:52 UTC (rev 294193)
@@ -45,8 +45,48 @@
 {
 }
 
+// FIXME: Merge these with the other integration layout functions.
+static inline Layout::Edges logicalBorder(const RenderBoxModelObject& renderer, bool isLeftToRightInlineDirection, WritingMode writingMode)
+{
+UNUSED_PARAM(isLeftToRightInlineDirection);
+UNUSED_PARAM(writingMode);
+
+auto borderLeft = renderer.borderLeft();
+auto borderRight = renderer.borderRight();
+auto borderTop = renderer.borderTop();
+auto borderBottom = renderer.borderBottom();
+
+return { { borderLeft, borderRight }, { borderTop, borderBottom } };
+}
+
+static inline Layout::Edges logicalPadding(const RenderBoxModelObject& renderer, bool isLeftToRightInlineDirection, WritingMode writingMode)
+{
+UNUSED_PARAM(isLeftToRightInlineDirection);
+UNUSED_PARAM(writingMode);
+
+auto paddingLeft = renderer.paddingLeft();
+auto paddingRight = renderer.paddingRight();
+auto paddingTop = renderer.paddingTop();
+auto paddingBottom = renderer.paddingBottom();
+
+return { { paddingLeft, paddingRight }, { paddingTop, paddingBottom } };
+}
+
 void FlexLayout::updateFormattingRootGeometryAndInvalidate()
 {
+auto& flexBoxRenderer = this->flexBoxRenderer();
+
+auto updateGeometry = [&](auto& root) {
+auto isLeftToRightInlineDirection = flexBoxRenderer.style().isLeftToRightDirection();
+auto writingMode = flexBoxRenderer.style().writingMode();
+
+root.setContentBoxWidth(writingMode == WritingMode::TopToBottom ? flexBoxRenderer.contentWidth() : flexBoxRenderer.contentHeight());
+root.setPadding(logicalPadding(flexBoxRenderer, isLeftToRightInlineDirection, writingMode));
+root.setBorder(logicalBorder(flexBoxRenderer, isLeftToRightInlineDirection, writingMode));
+root.setHorizontalMargin({ });
+root.setVerticalMargin({ });
+};
+return updateGeometry(m_layoutState.ensureGeometryForBox(rootLayoutBox()));
 }
 
 void 

[webkit-changes] [294192] trunk/Source/WebCore

2022-05-14 Thread zalan
Title: [294192] trunk/Source/WebCore








Revision 294192
Author za...@apple.com
Date 2022-05-14 06:30:56 -0700 (Sat, 14 May 2022)


Log Message
[FFC][Integration] Do not reset the effective display value for flex root
https://bugs.webkit.org/show_bug.cgi?id=240412

Reviewed by Antti Koivisto.

Non-inline formatting roots (e.g. flex) should not need display type adjustment.

* layout/integration/LayoutIntegrationBoxTree.cpp:
(WebCore::LayoutIntegration::rootBoxStyle):
(WebCore::LayoutIntegration::rootBoxFirstLineStyle):
(WebCore::LayoutIntegration::BoxTree::BoxTree):
(WebCore::LayoutIntegration::BoxTree::updateStyle):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (294191 => 294192)

--- trunk/Source/WebCore/ChangeLog	2022-05-14 13:19:52 UTC (rev 294191)
+++ trunk/Source/WebCore/ChangeLog	2022-05-14 13:30:56 UTC (rev 294192)
@@ -1,5 +1,20 @@
 2022-05-14  Alan Bujtas  
 
+[FFC][Integration] Do not reset the effective display value for flex root
+https://bugs.webkit.org/show_bug.cgi?id=240412
+
+Reviewed by Antti Koivisto.
+
+Non-inline formatting roots (e.g. flex) should not need display type adjustment.
+
+* layout/integration/LayoutIntegrationBoxTree.cpp:
+(WebCore::LayoutIntegration::rootBoxStyle):
+(WebCore::LayoutIntegration::rootBoxFirstLineStyle):
+(WebCore::LayoutIntegration::BoxTree::BoxTree):
+(WebCore::LayoutIntegration::BoxTree::updateStyle):
+
+2022-05-14  Alan Bujtas  
+
 [LFC] LayoutState should track the integration formatting context type
 https://bugs.webkit.org/show_bug.cgi?id=240411
 


Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp (294191 => 294192)

--- trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp	2022-05-14 13:19:52 UTC (rev 294191)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp	2022-05-14 13:30:56 UTC (rev 294192)
@@ -57,10 +57,11 @@
 // FIXME: see webkit.org/b/230964
 #define CAN_USE_FIRST_LINE_STYLE_RESOLVE 1
 
-static RenderStyle rootBoxStyle(const RenderStyle& style)
+static RenderStyle rootBoxStyle(const RenderBlock& rootRenderer)
 {
-auto clonedStyle = RenderStyle::clone(style);
-clonedStyle.setEffectiveDisplay(DisplayType::Block);
+auto clonedStyle = RenderStyle::clone(rootRenderer.style());
+if (is(rootRenderer))
+clonedStyle.setEffectiveDisplay(DisplayType::Block);
 return clonedStyle;
 }
 
@@ -71,7 +72,8 @@
 if (rootRenderer.style() == firstLineStyle)
 return { };
 auto clonedStyle = RenderStyle::clonePtr(firstLineStyle);
-clonedStyle->setEffectiveDisplay(DisplayType::Block);
+if (is(rootRenderer))
+clonedStyle->setEffectiveDisplay(DisplayType::Block);
 return clonedStyle;
 #else
 UNUSED_PARAM(rootRenderer);
@@ -81,7 +83,7 @@
 
 BoxTree::BoxTree(RenderBlock& rootRenderer)
 : m_rootRenderer(rootRenderer)
-, m_root(Layout::Box::ElementAttributes { Layout::Box::ElementType::IntegrationBlockContainer }, rootBoxStyle(rootRenderer.style()), rootBoxFirstLineStyle(rootRenderer))
+, m_root(Layout::Box::ElementAttributes { Layout::Box::ElementType::IntegrationBlockContainer }, rootBoxStyle(rootRenderer), rootBoxFirstLineStyle(rootRenderer))
 {
 if (rootRenderer.isAnonymous())
 m_root.setIsAnonymous();
@@ -217,7 +219,7 @@
 };
 
 if ( == ())
-layoutBox.updateStyle(rootBoxStyle(style), rootBoxFirstLineStyle(downcast(renderer)));
+layoutBox.updateStyle(rootBoxStyle(downcast(renderer)), rootBoxFirstLineStyle(downcast(renderer)));
 else
 layoutBox.updateStyle(style, firstLineStyle());
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [294191] trunk/Source/WebCore

2022-05-14 Thread zalan
Title: [294191] trunk/Source/WebCore








Revision 294191
Author za...@apple.com
Date 2022-05-14 06:19:52 -0700 (Sat, 14 May 2022)


Log Message
[LFC] LayoutState should track the integration formatting context type
https://bugs.webkit.org/show_bug.cgi?id=240411

Reviewed by Antti Koivisto.

Let's not use RuntimeEnabledFeatures to check wheter the integration codepath is enabled as
the new FCs (e.g. flex) don't even have such flags.

* layout/LayoutContext.cpp:
* layout/LayoutState.cpp:
(WebCore::Layout::LayoutState::LayoutState):
(WebCore::Layout::LayoutState::formattingStateForFormattingContext const):
(WebCore::Layout::LayoutState::formattingStateForInlineFormattingContext const):
(WebCore::Layout::LayoutState::formattingStateForFlexFormattingContext const):
(WebCore::Layout::LayoutState::ensureInlineFormattingState):
(WebCore::Layout::LayoutState::ensureFlexFormattingState):
(WebCore::Layout::LayoutState::setViewportSize):
(WebCore::Layout::LayoutState::viewportSize const):
(WebCore::Layout::LayoutState::setIsIntegratedRootBoxFirstChild):
(WebCore::Layout::LayoutState::shouldIgnoreTrailingLetterSpacing const):
(WebCore::Layout::LayoutState::shouldNotSynthesizeInlineBlockBaseline const):
* layout/LayoutState.h:
(WebCore::Layout::LayoutState::isInlineFormattingContextIntegration const):
(WebCore::Layout::LayoutState::isFlexFormattingContextIntegration const):
* layout/floats/FloatingState.cpp:
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
* layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::close):
* layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::appendTextDisplayBox):
* layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::FlexLayout):
* layout/integration/inline/LayoutIntegrationInlineContent.cpp:
* layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::LineLayout):
(WebCore::LayoutIntegration::LineLayout::releaseCaches):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/LayoutContext.cpp
trunk/Source/WebCore/layout/LayoutState.cpp
trunk/Source/WebCore/layout/LayoutState.h
trunk/Source/WebCore/layout/floats/FloatingState.cpp
trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp
trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationInlineContent.cpp
trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (294190 => 294191)

--- trunk/Source/WebCore/ChangeLog	2022-05-14 12:41:00 UTC (rev 294190)
+++ trunk/Source/WebCore/ChangeLog	2022-05-14 13:19:52 UTC (rev 294191)
@@ -1,3 +1,42 @@
+2022-05-14  Alan Bujtas  
+
+[LFC] LayoutState should track the integration formatting context type
+https://bugs.webkit.org/show_bug.cgi?id=240411
+
+Reviewed by Antti Koivisto.
+
+Let's not use RuntimeEnabledFeatures to check wheter the integration codepath is enabled as
+the new FCs (e.g. flex) don't even have such flags.
+
+* layout/LayoutContext.cpp:
+* layout/LayoutState.cpp:
+(WebCore::Layout::LayoutState::LayoutState):
+(WebCore::Layout::LayoutState::formattingStateForFormattingContext const):
+(WebCore::Layout::LayoutState::formattingStateForInlineFormattingContext const):
+(WebCore::Layout::LayoutState::formattingStateForFlexFormattingContext const):
+(WebCore::Layout::LayoutState::ensureInlineFormattingState):
+(WebCore::Layout::LayoutState::ensureFlexFormattingState):
+(WebCore::Layout::LayoutState::setViewportSize):
+(WebCore::Layout::LayoutState::viewportSize const):
+(WebCore::Layout::LayoutState::setIsIntegratedRootBoxFirstChild):
+(WebCore::Layout::LayoutState::shouldIgnoreTrailingLetterSpacing const):
+(WebCore::Layout::LayoutState::shouldNotSynthesizeInlineBlockBaseline const):
+* layout/LayoutState.h:
+(WebCore::Layout::LayoutState::isInlineFormattingContextIntegration const):
+(WebCore::Layout::LayoutState::isFlexFormattingContextIntegration const):
+* layout/floats/FloatingState.cpp:
+* layout/formattingContexts/inline/InlineFormattingContext.cpp:
+* layout/formattingContexts/inline/InlineLineBuilder.cpp:
+(WebCore::Layout::LineBuilder::close):
+* layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
+(WebCore::Layout::InlineDisplayContentBuilder::appendTextDisplayBox):
+* layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
+

[webkit-changes] [294128] trunk/Source/WebCore

2022-05-12 Thread zalan
Title: [294128] trunk/Source/WebCore








Revision 294128
Author za...@apple.com
Date 2022-05-12 17:31:33 -0700 (Thu, 12 May 2022)


Log Message
TextBoxPainter::paintForeground: painting text with no marking/decoration should be simple
https://bugs.webkit.org/show_bug.cgi?id=240319

Reviewed by Simon Fraser.

Let's have a fast codepath for regular, simple text painting.

* rendering/StyledMarkedText.cpp:
(WebCore::StyledMarkedText::computeStyleForUnmarkedMarkedText):
(WebCore::computeStyleForUnmarkedMarkedText): Deleted.
* rendering/StyledMarkedText.h:
(WebCore::StyledMarkedText::StyledMarkedText):
(WebCore::StyledMarkedText::style):
* rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter::paintBackground):
(WebCore::TextBoxPainter::paintForegroundAndDecorations):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/rendering/StyledMarkedText.cpp
trunk/Source/WebCore/rendering/StyledMarkedText.h
trunk/Source/WebCore/rendering/TextBoxPainter.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (294127 => 294128)

--- trunk/Source/WebCore/ChangeLog	2022-05-13 00:05:53 UTC (rev 294127)
+++ trunk/Source/WebCore/ChangeLog	2022-05-13 00:31:33 UTC (rev 294128)
@@ -1,3 +1,22 @@
+2022-05-12  Alan Bujtas  
+
+TextBoxPainter::paintForeground: painting text with no marking/decoration should be simple
+https://bugs.webkit.org/show_bug.cgi?id=240319
+
+Reviewed by Simon Fraser.
+
+Let's have a fast codepath for regular, simple text painting.
+
+* rendering/StyledMarkedText.cpp:
+(WebCore::StyledMarkedText::computeStyleForUnmarkedMarkedText):
+(WebCore::computeStyleForUnmarkedMarkedText): Deleted.
+* rendering/StyledMarkedText.h:
+(WebCore::StyledMarkedText::StyledMarkedText):
+(WebCore::StyledMarkedText::style):
+* rendering/TextBoxPainter.cpp:
+(WebCore::TextBoxPainter::paintBackground):
+(WebCore::TextBoxPainter::paintForegroundAndDecorations):
+
 2022-05-12  Sihui Liu  
 
 StorageMap::removeItem may fail to remove item from map


Modified: trunk/Source/WebCore/rendering/StyledMarkedText.cpp (294127 => 294128)

--- trunk/Source/WebCore/rendering/StyledMarkedText.cpp	2022-05-13 00:05:53 UTC (rev 294127)
+++ trunk/Source/WebCore/rendering/StyledMarkedText.cpp	2022-05-13 00:31:33 UTC (rev 294128)
@@ -110,7 +110,7 @@
 return styledMarkedText;
 }
 
-static StyledMarkedText::Style computeStyleForUnmarkedMarkedText(const RenderText& renderer, const RenderStyle& lineStyle, bool isFirstLine, const PaintInfo& paintInfo)
+StyledMarkedText::Style StyledMarkedText::computeStyleForUnmarkedMarkedText(const RenderText& renderer, const RenderStyle& lineStyle, bool isFirstLine, const PaintInfo& paintInfo)
 {
 StyledMarkedText::Style style;
 style.textDecorationStyles = TextDecorationPainter::stylesForRenderer(renderer, lineStyle.textDecorationsInEffect(), isFirstLine);


Modified: trunk/Source/WebCore/rendering/StyledMarkedText.h (294127 => 294128)

--- trunk/Source/WebCore/rendering/StyledMarkedText.h	2022-05-13 00:05:53 UTC (rev 294127)
+++ trunk/Source/WebCore/rendering/StyledMarkedText.h	2022-05-13 00:31:33 UTC (rev 294128)
@@ -36,11 +36,6 @@
 class RenderedDocumentMarker;
 
 struct StyledMarkedText : MarkedText {
-StyledMarkedText(const MarkedText& marker)
-: MarkedText { marker }
-{
-}
-
 struct Style {
 Color backgroundColor;
 TextPaintStyle textStyles;
@@ -49,6 +44,17 @@
 float alpha { 1 };
 };
 
+StyledMarkedText(const MarkedText& marker)
+: MarkedText { marker }
+{
+}
+
+StyledMarkedText(const MarkedText& marker, Style style)
+: MarkedText { marker }
+, style(style)
+{
+}
+
 Style style;
 
 static Vector subdivideAndResolve(const Vector&, const RenderText&, bool isFirstLine, const PaintInfo&);
@@ -55,6 +61,7 @@
 static Vector coalesceAdjacentWithEqualBackground(const Vector&);
 static Vector coalesceAdjacentWithEqualForeground(const Vector&);
 static Vector coalesceAdjacentWithEqualDecorations(const Vector&);
+static Style computeStyleForUnmarkedMarkedText(const RenderText&, const RenderStyle&, bool isFirstLine, const PaintInfo&);
 };
 
 }


Modified: trunk/Source/WebCore/rendering/TextBoxPainter.cpp (294127 => 294128)

--- trunk/Source/WebCore/rendering/TextBoxPainter.cpp	2022-05-13 00:05:53 UTC (rev 294127)
+++ trunk/Source/WebCore/rendering/TextBoxPainter.cpp	2022-05-13 00:31:33 UTC (rev 294128)
@@ -171,7 +171,29 @@
 
 void TextBoxPainter::paintForegroundAndDecorations()
 {
-bool shouldPaintSelectionForeground = m_haveSelection && !m_useCustomUnderlines;
+auto shouldPaintSelectionForeground = m_haveSelection && !m_useCustomUnderlines;
+auto hasTextDecoration = !m_style.textDecorationsInEffect().isEmpty();
+auto hasHighlightDecoration = m_document.hasHighlight() && !MarkedText::collectForHighlights(m_renderer, m_selectableRange, 

[webkit-changes] [294099] trunk/Source/WebCore

2022-05-12 Thread zalan
Title: [294099] trunk/Source/WebCore








Revision 294099
Author za...@apple.com
Date 2022-05-12 06:12:22 -0700 (Thu, 12 May 2022)


Log Message
TextBoxPainter::paintBackground should bail out early when nothing to paint
https://bugs.webkit.org/show_bug.cgi?id=240317

Reviewed by Simon Fraser.

Collecting markers and highlights is a somewhat expensive operation while most
of the time the text has neither markers nor highlights. Let's just bail out early when applicable.

* dom/Document.h:
(WebCore::Document::hasHighlightRegister const):
* rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter::paintBackground):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Modules/highlight/HighlightRegister.h
trunk/Source/WebCore/dom/Document.cpp
trunk/Source/WebCore/dom/Document.h
trunk/Source/WebCore/rendering/TextBoxPainter.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (294098 => 294099)

--- trunk/Source/WebCore/ChangeLog	2022-05-12 12:40:27 UTC (rev 294098)
+++ trunk/Source/WebCore/ChangeLog	2022-05-12 13:12:22 UTC (rev 294099)
@@ -1,3 +1,18 @@
+2022-05-12  Alan Bujtas  
+
+TextBoxPainter::paintBackground should bail out early when nothing to paint
+https://bugs.webkit.org/show_bug.cgi?id=240317
+
+Reviewed by Simon Fraser.
+
+Collecting markers and highlights is a somewhat expensive operation while most
+of the time the text has neither markers nor highlights. Let's just bail out early when applicable.
+
+* dom/Document.h:
+(WebCore::Document::hasHighlightRegister const):
+* rendering/TextBoxPainter.cpp:
+(WebCore::TextBoxPainter::paintBackground):
+
 2022-05-12  Tim Nguyen  
 
 [:has() pseudo-class] Support invalidation for :target pseudo-class


Modified: trunk/Source/WebCore/Modules/highlight/HighlightRegister.h (294098 => 294099)

--- trunk/Source/WebCore/Modules/highlight/HighlightRegister.h	2022-05-12 12:40:27 UTC (rev 294098)
+++ trunk/Source/WebCore/Modules/highlight/HighlightRegister.h	2022-05-12 13:12:22 UTC (rev 294099)
@@ -45,7 +45,7 @@
 void setFromMapLike(AtomString&&, Ref&&);
 void clear();
 bool remove(const AtomString&);
-
+bool isEmpty() const { return map().isEmpty(); }
 
 HighlightVisibility highlightsVisibility() const { return m_highlightVisibility; }
 #if ENABLE(APP_HIGHLIGHTS)


Modified: trunk/Source/WebCore/dom/Document.cpp (294098 => 294099)

--- trunk/Source/WebCore/dom/Document.cpp	2022-05-12 12:40:27 UTC (rev 294098)
+++ trunk/Source/WebCore/dom/Document.cpp	2022-05-12 13:12:22 UTC (rev 294099)
@@ -2886,6 +2886,16 @@
 return XMLDocumentParser::create(*this, view());
 }
 
+bool Document::hasHighlight() const
+{
+return (m_highlightRegister && !m_highlightRegister->isEmpty())
+|| (m_fragmentHighlightRegister && !m_fragmentHighlightRegister->isEmpty()) 
+#if ENABLE(APP_HIGHLIGHTS)
+|| (m_appHighlightRegister && !m_appHighlightRegister->isEmpty())
+#endif
+;
+}
+
 HighlightRegister& Document::highlightRegister()
 {
 if (!m_highlightRegister)


Modified: trunk/Source/WebCore/dom/Document.h (294098 => 294099)

--- trunk/Source/WebCore/dom/Document.h	2022-05-12 12:40:27 UTC (rev 294098)
+++ trunk/Source/WebCore/dom/Document.h	2022-05-12 13:12:22 UTC (rev 294099)
@@ -1630,6 +1630,7 @@
 WEBCORE_EXPORT TextManipulationController& textManipulationController();
 TextManipulationController* textManipulationControllerIfExists() { return m_textManipulationController.get(); }
 
+bool hasHighlight() const;
 HighlightRegister* highlightRegisterIfExists() { return m_highlightRegister.get(); }
 HighlightRegister& highlightRegister();
 void updateHighlightPositions();


Modified: trunk/Source/WebCore/rendering/TextBoxPainter.cpp (294098 => 294099)

--- trunk/Source/WebCore/rendering/TextBoxPainter.cpp	2022-05-12 12:40:27 UTC (rev 294098)
+++ trunk/Source/WebCore/rendering/TextBoxPainter.cpp	2022-05-12 13:12:22 UTC (rev 294099)
@@ -26,6 +26,7 @@
 #include "TextBoxPainter.h"
 
 #include "CompositionHighlight.h"
+#include "DocumentMarkerController.h"
 #include "Editor.h"
 #include "EventRegion.h"
 #include "GraphicsContext.h"
@@ -124,7 +125,28 @@
 
 void TextBoxPainter::paintBackground()
 {
-if (m_containsComposition && !m_useCustomUnderlines)
+auto shouldPaintCompositionBackground = m_containsComposition && !m_useCustomUnderlines;
+#if ENABLE(TEXT_SELECTION)
+auto hasSelectionWithNonCustomUnderline = m_haveSelection && !m_useCustomUnderlines;
+#endif
+
+auto shouldPaintBackground = [&] {
+#if ENABLE(TEXT_SELECTION)
+if (hasSelectionWithNonCustomUnderline)
+return true;
+#endif
+if (shouldPaintCompositionBackground)
+return true;
+if (m_document.markers().hasMarkers())
+return true;
+if (m_document.hasHighlight())
+return true;
+return false;
+};
+if (!shouldPaintBackground())
+return;
+
+if 

[webkit-changes] [293998] trunk/Source/WebCore

2022-05-09 Thread zalan
Title: [293998] trunk/Source/WebCore








Revision 293998
Author za...@apple.com
Date 2022-05-09 21:41:10 -0700 (Mon, 09 May 2022)


Log Message
Do not use the cached renderer's parent in handleFragmentedFlowStateChange lambda
https://bugs.webkit.org/show_bug.cgi?id=240266

Reviewed by Simon Fraser.

* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::normalizeTreeAfterStyleChange):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (293997 => 293998)

--- trunk/Source/WebCore/ChangeLog	2022-05-10 03:49:35 UTC (rev 293997)
+++ trunk/Source/WebCore/ChangeLog	2022-05-10 04:41:10 UTC (rev 293998)
@@ -1,3 +1,13 @@
+2022-05-09  Alan Bujtas  
+
+Do not use the cached renderer's parent in handleFragmentedFlowStateChange lambda
+https://bugs.webkit.org/show_bug.cgi?id=240266
+
+Reviewed by Simon Fraser.
+
+* rendering/updating/RenderTreeBuilder.cpp:
+(WebCore::RenderTreeBuilder::normalizeTreeAfterStyleChange):
+
 2022-05-07  Wenson Hsieh  
 
 [iOS] Adjust some viewport behaviors when multitasking mode is enabled


Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (293997 => 293998)

--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2022-05-10 03:49:35 UTC (rev 293997)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2022-05-10 04:41:10 UTC (rev 293998)
@@ -591,8 +591,6 @@
 if (!renderer.parent())
 return;
 
-auto& parent = *renderer.parent();
-
 bool wasFloating = oldStyle.isFloating();
 bool wasOutOfFlowPositioned = oldStyle.hasOutOfFlowPosition();
 bool isFloating = renderer.style().isFloating();
@@ -604,7 +602,7 @@
 return;
 // Out of flow children of RenderMultiColumnFlow are not really part of the multicolumn flow. We need to ensure that changes in positioning like this
 // trigger insertions into the multicolumn flow.
-if (auto* enclosingFragmentedFlow = parent.enclosingFragmentedFlow(); is(enclosingFragmentedFlow)) {
+if (auto* enclosingFragmentedFlow = renderer.parent()->enclosingFragmentedFlow(); is(enclosingFragmentedFlow)) {
 auto movingIntoMulticolumn = [&] {
 if (wasOutOfFlowPositioned && !isOutOfFlowPositioned)
 return true;
@@ -643,6 +641,7 @@
 }
 };
 
+auto& parent = *renderer.parent();
 if (is(parent))
 noLongerAffectsParent = (!wasFloating && isFloating) || (!wasOutOfFlowPositioned && isOutOfFlowPositioned);
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [293700] trunk/Source/WebCore

2022-05-02 Thread zalan
Title: [293700] trunk/Source/WebCore








Revision 293700
Author za...@apple.com
Date 2022-05-02 16:33:04 -0700 (Mon, 02 May 2022)


Log Message
[Quirks] REGRESSION (r286874): Menu is Cut Off After Pressing Search Icon on Hotels.com
https://bugs.webkit.org/show_bug.cgi?id=239980


Reviewed by Simon Fraser.

Disable resolution media query on www.hotels.com.

* css/MediaQueryEvaluator.cpp:
(WebCore::resolutionEvaluate):
* page/Quirks.cpp:
(WebCore::Quirks::shouldUseResolutionMedia const):
* page/Quirks.h:

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/css/MediaQueryEvaluator.cpp
trunk/Source/WebCore/page/Quirks.cpp
trunk/Source/WebCore/page/Quirks.h




Diff

Modified: trunk/Source/WebCore/ChangeLog (293699 => 293700)

--- trunk/Source/WebCore/ChangeLog	2022-05-02 23:25:25 UTC (rev 293699)
+++ trunk/Source/WebCore/ChangeLog	2022-05-02 23:33:04 UTC (rev 293700)
@@ -1,3 +1,19 @@
+2022-05-02  Alan Bujtas  
+
+[Quirks] REGRESSION (r286874): Menu is Cut Off After Pressing Search Icon on Hotels.com
+https://bugs.webkit.org/show_bug.cgi?id=239980
+
+
+Reviewed by Simon Fraser.
+
+Disable resolution media query on www.hotels.com.
+
+* css/MediaQueryEvaluator.cpp:
+(WebCore::resolutionEvaluate):
+* page/Quirks.cpp:
+(WebCore::Quirks::shouldUseResolutionMedia const):
+* page/Quirks.h:
+
 2022-05-02  Oriol Brufau  
 
 [cssom] Don't index 'all' shorthand in computed styles


Modified: trunk/Source/WebCore/css/MediaQueryEvaluator.cpp (293699 => 293700)

--- trunk/Source/WebCore/css/MediaQueryEvaluator.cpp	2022-05-02 23:25:25 UTC (rev 293699)
+++ trunk/Source/WebCore/css/MediaQueryEvaluator.cpp	2022-05-02 23:33:04 UTC (rev 293700)
@@ -448,7 +448,7 @@
 
 static bool resolutionEvaluate(CSSValue* value, const CSSToLengthConversionData&, Frame& frame, MediaFeaturePrefix op)
 {
-if (!frame.settings().resolutionMediaFeatureEnabled())
+if (!frame.settings().resolutionMediaFeatureEnabled() || frame.document()->quirks().shouldDisableResolutionMediaQuery())
 return false;
 
 return (!value || (is(*value) && downcast(*value).isResolution())) && evaluateResolution(value, frame, op);


Modified: trunk/Source/WebCore/page/Quirks.cpp (293699 => 293700)

--- trunk/Source/WebCore/page/Quirks.cpp	2022-05-02 23:25:25 UTC (rev 293699)
+++ trunk/Source/WebCore/page/Quirks.cpp	2022-05-02 23:33:04 UTC (rev 293700)
@@ -231,6 +231,14 @@
 return false;
 }
 
+bool Quirks::shouldDisableResolutionMediaQuery() const
+{
+if (!needsQuirks())
+return false;
+auto host = m_document->url().host();
+return equalLettersIgnoringASCIICase(host, "www.hotels.com"_s);
+}
+
 bool Quirks::needsMillisecondResolutionForHighResTimeStamp() const
 {
 if (!needsQuirks())


Modified: trunk/Source/WebCore/page/Quirks.h (293699 => 293700)

--- trunk/Source/WebCore/page/Quirks.h	2022-05-02 23:25:25 UTC (rev 293699)
+++ trunk/Source/WebCore/page/Quirks.h	2022-05-02 23:33:04 UTC (rev 293700)
@@ -81,6 +81,7 @@
 bool shouldDisableContentChangeObserverTouchEventAdjustment() const;
 bool shouldTooltipPreventFromProceedingWithClick(const Element&) const;
 bool shouldHideSearchFieldResultsButton() const;
+bool shouldDisableResolutionMediaQuery() const;
 
 bool needsMillisecondResolutionForHighResTimeStamp() const;
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [293647] trunk/Source/WebCore

2022-04-30 Thread zalan
Title: [293647] trunk/Source/WebCore








Revision 293647
Author za...@apple.com
Date 2022-04-30 09:30:46 -0700 (Sat, 30 Apr 2022)


Log Message
Only stretch the percent height  when it is the document element's child
https://bugs.webkit.org/show_bug.cgi?id=239932


Reviewed by Antti Koivisto.

This IE quirk should only be applied to when the body is actually the document element's child (stretching case).

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalHeight const):
* rendering/RenderBox.h:
(WebCore::RenderBox::parentBox const):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/rendering/RenderBox.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (293646 => 293647)

--- trunk/Source/WebCore/ChangeLog	2022-04-30 15:30:19 UTC (rev 293646)
+++ trunk/Source/WebCore/ChangeLog	2022-04-30 16:30:46 UTC (rev 293647)
@@ -1,5 +1,20 @@
 2022-04-30  Alan Bujtas  
 
+Only stretch the percent height  when it is the document element's child
+https://bugs.webkit.org/show_bug.cgi?id=239932
+
+
+Reviewed by Antti Koivisto.
+
+This IE quirk should only be applied to when the body is actually the document element's child (stretching case).
+
+* rendering/RenderBox.cpp:
+(WebCore::RenderBox::computeLogicalHeight const):
+* rendering/RenderBox.h:
+(WebCore::RenderBox::parentBox const):
+
+2022-04-30  Alan Bujtas  
+
 ASSERTION FAILED: *trailingRunIndex >= overflowingRunIndex in WebCore::Layout::InlineContentBreaker::tryBreakingNextOverflowingRuns
 https://bugs.webkit.org/show_bug.cgi?id=239838
 


Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (293646 => 293647)

--- trunk/Source/WebCore/rendering/RenderBox.cpp	2022-04-30 15:30:19 UTC (rev 293646)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2022-04-30 16:30:46 UTC (rev 293647)
@@ -3203,14 +3203,20 @@
 }
 }
 
-// WinIE quirk: The  block always fills the entire canvas in quirks mode.  The  always fills the
-//  block in quirks mode.  Only apply this quirk if the block is normal flow and no height
+// WinIE quirk: The  block always fills the entire canvas in quirks mode. The  always fills the
+//  block in quirks mode. Only apply this quirk if the block is normal flow and no height
 // is specified. When we're printing, we also need this quirk if the body or root has a percentage 
 // height since we don't set a height in RenderView when we're printing. So without this quirk, the 
 // height has nothing to be a percentage of, and it ends up being 0. That is bad.
-bool paginatedContentNeedsBaseHeight = document().printing() && h.isPercentOrCalculated()
-&& (isDocumentElementRenderer() || (isBody() && document().documentElement()->renderer()->style().logicalHeight().isPercentOrCalculated())) && !isInline();
-if (stretchesToViewport() || paginatedContentNeedsBaseHeight) {
+auto paginatedContentNeedsBaseHeight = [&] {
+if (!document().printing() || !h.isPercentOrCalculated() || isInline())
+return false;
+if (isDocumentElementRenderer())
+return true;
+auto* documentElementRenderer = document().documentElement()->renderer();
+return isBody() && parent() == documentElementRenderer && documentElementRenderer->style().logicalHeight().isPercentOrCalculated();
+};
+if (stretchesToViewport() || paginatedContentNeedsBaseHeight()) {
 LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter();
 LayoutUnit visibleHeight = view().pageOrViewLogicalHeight();
 if (isDocumentElementRenderer())






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [293646] trunk

2022-04-30 Thread zalan
Title: [293646] trunk








Revision 293646
Author za...@apple.com
Date 2022-04-30 08:30:19 -0700 (Sat, 30 Apr 2022)


Log Message
ASSERTION FAILED: *trailingRunIndex >= overflowingRunIndex in WebCore::Layout::InlineContentBreaker::tryBreakingNextOverflowingRuns
https://bugs.webkit.org/show_bug.cgi?id=239838


Reviewed by Antti Koivisto.

Source/WebCore:

Take partial text overflow into account when computing intrinsic width.

Test: fast/inline/overflowing-content-inside-inline-box-crash.html

* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthForConstraint const):
* layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::computedIntrinsicWidth):
* layout/formattingContexts/inline/InlineLineBuilder.h:

LayoutTests:

* fast/inline/overflowing-content-inside-inline-box-crash-expected.txt: Added.
* fast/inline/overflowing-content-inside-inline-box-crash.html: Added.

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp
trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h


Added Paths

trunk/LayoutTests/fast/inline/overflowing-content-inside-inline-box-crash-expected.txt
trunk/LayoutTests/fast/inline/overflowing-content-inside-inline-box-crash.html




Diff

Modified: trunk/LayoutTests/ChangeLog (293645 => 293646)

--- trunk/LayoutTests/ChangeLog	2022-04-30 13:11:23 UTC (rev 293645)
+++ trunk/LayoutTests/ChangeLog	2022-04-30 15:30:19 UTC (rev 293646)
@@ -1,5 +1,16 @@
 2022-04-30  Alan Bujtas  
 
+ASSERTION FAILED: *trailingRunIndex >= overflowingRunIndex in WebCore::Layout::InlineContentBreaker::tryBreakingNextOverflowingRuns
+https://bugs.webkit.org/show_bug.cgi?id=239838
+
+
+Reviewed by Antti Koivisto.
+
+* fast/inline/overflowing-content-inside-inline-box-crash-expected.txt: Added.
+* fast/inline/overflowing-content-inside-inline-box-crash.html: Added.
+
+2022-04-30  Alan Bujtas  
+
 [LFC][IFC] Do not wrap  to the next line when it is preceded by overflowing text
 https://bugs.webkit.org/show_bug.cgi?id=239879
 


Added: trunk/LayoutTests/fast/inline/overflowing-content-inside-inline-box-crash-expected.txt (0 => 293646)

--- trunk/LayoutTests/fast/inline/overflowing-content-inside-inline-box-crash-expected.txt	(rev 0)
+++ trunk/LayoutTests/fast/inline/overflowing-content-inside-inline-box-crash-expected.txt	2022-04-30 15:30:19 UTC (rev 293646)
@@ -0,0 +1 @@
+PASSif no crash or ASSERT.


Added: trunk/LayoutTests/fast/inline/overflowing-content-inside-inline-box-crash.html (0 => 293646)

--- trunk/LayoutTests/fast/inline/overflowing-content-inside-inline-box-crash.html	(rev 0)
+++ trunk/LayoutTests/fast/inline/overflowing-content-inside-inline-box-crash.html	2022-04-30 15:30:19 UTC (rev 293646)
@@ -0,0 +1,15 @@
+
+div {
+  position: absolute;
+  word-break: break-word;
+}
+
+.second_inline_box {
+  margin-left: 1px;
+}
+
+PASSif no crash or ASSERT.
+
+if (window.testRunner)
+  testRunner.dumpAsText();
+
\ No newline at end of file


Modified: trunk/Source/WebCore/ChangeLog (293645 => 293646)

--- trunk/Source/WebCore/ChangeLog	2022-04-30 13:11:23 UTC (rev 293645)
+++ trunk/Source/WebCore/ChangeLog	2022-04-30 15:30:19 UTC (rev 293646)
@@ -1,5 +1,23 @@
 2022-04-30  Alan Bujtas  
 
+ASSERTION FAILED: *trailingRunIndex >= overflowingRunIndex in WebCore::Layout::InlineContentBreaker::tryBreakingNextOverflowingRuns
+https://bugs.webkit.org/show_bug.cgi?id=239838
+
+
+Reviewed by Antti Koivisto.
+
+Take partial text overflow into account when computing intrinsic width.
+
+Test: fast/inline/overflowing-content-inside-inline-box-crash.html
+
+* layout/formattingContexts/inline/InlineFormattingContext.cpp:
+(WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthForConstraint const):
+* layout/formattingContexts/inline/InlineLineBuilder.cpp:
+(WebCore::Layout::LineBuilder::computedIntrinsicWidth):
+* layout/formattingContexts/inline/InlineLineBuilder.h:
+
+2022-04-30  Alan Bujtas  
+
 [LFC][IFC] Introduce LineBuilder::PartialContent
 https://bugs.webkit.org/show_bug.cgi?id=239886
 


Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp (293645 => 293646)

--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp	2022-04-30 13:11:23 UTC (rev 293645)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp	2022-04-30 15:30:19 UTC (rev 293646)
@@ -432,9 +432,10 @@
 auto previousLine = std::optional { };
 while (!layoutRange.isEmpty()) {
 auto intrinsicContent = 

[webkit-changes] [293645] trunk/Source/WebCore

2022-04-30 Thread zalan
Title: [293645] trunk/Source/WebCore








Revision 293645
Author za...@apple.com
Date 2022-04-30 06:11:23 -0700 (Sat, 30 Apr 2022)


Log Message
[LFC][IFC] Introduce LineBuilder::PartialContent
https://bugs.webkit.org/show_bug.cgi?id=239886

Reviewed by Antti Koivisto.

This patch is in preparation for adding partial content support for intrinsic width computation.

1. Use a dedicated PartialContent structure to store partial overflowing information (output of current line breaking, input to next line).
2. Decouple partial overflowing width (see above) and the "let's not measure the wrapped content again on the next line as leading content" cached value.

* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::lineLayout):
* layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::layoutInlineContent):
(WebCore::Layout::LineBuilder::initialize):
* layout/formattingContexts/inline/InlineLineBuilder.h:
(WebCore::Layout::LineBuilder::PartialContent::PartialContent):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp
trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h




Diff

Modified: trunk/Source/WebCore/ChangeLog (293644 => 293645)

--- trunk/Source/WebCore/ChangeLog	2022-04-30 13:01:57 UTC (rev 293644)
+++ trunk/Source/WebCore/ChangeLog	2022-04-30 13:11:23 UTC (rev 293645)
@@ -1,5 +1,25 @@
 2022-04-30  Alan Bujtas  
 
+[LFC][IFC] Introduce LineBuilder::PartialContent
+https://bugs.webkit.org/show_bug.cgi?id=239886
+
+Reviewed by Antti Koivisto.
+
+This patch is in preparation for adding partial content support for intrinsic width computation.
+
+1. Use a dedicated PartialContent structure to store partial overflowing information (output of current line breaking, input to next line).
+2. Decouple partial overflowing width (see above) and the "let's not measure the wrapped content again on the next line as leading content" cached value.
+
+* layout/formattingContexts/inline/InlineFormattingContext.cpp:
+(WebCore::Layout::InlineFormattingContext::lineLayout):
+* layout/formattingContexts/inline/InlineLineBuilder.cpp:
+(WebCore::Layout::LineBuilder::layoutInlineContent):
+(WebCore::Layout::LineBuilder::initialize):
+* layout/formattingContexts/inline/InlineLineBuilder.h:
+(WebCore::Layout::LineBuilder::PartialContent::PartialContent):
+
+2022-04-30  Alan Bujtas  
+
 [LFC][IFC] Do not wrap  to the next line when it is preceded by overflowing text
 https://bugs.webkit.org/show_bug.cgi?id=239879
 


Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp (293644 => 293645)

--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp	2022-04-30 13:01:57 UTC (rev 293644)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp	2022-04-30 13:11:23 UTC (rev 293645)
@@ -227,11 +227,11 @@
 formattingState.setClearGapAfterLastLine(lineLogicalTop - lineLogicalRect.bottom());
 }
 // When the trailing content is partial, we need to reuse the last InlineTextItem.
-auto lastInlineItemNeedsPartialLayout = lineContent.partialTrailingContentLength;
+auto lastInlineItemNeedsPartialLayout = lineContent.partialOverflowingContent.has_value();
 if (lastInlineItemNeedsPartialLayout) {
 auto lineLayoutHasAdvanced = !previousLine
 || lineContentRange.end > previousLine->range.end
-|| (previousLine->overflowContent && previousLine->overflowContent->partialContentLength > lineContent.partialTrailingContentLength);
+|| (previousLine->partialOverflowingContent && previousLine->partialOverflowingContent->length > lineContent.partialOverflowingContent->length);
 if (!lineLayoutHasAdvanced) {
 ASSERT_NOT_REACHED();
 // Move over to the next run if we are stuck on this partial content (when the overflow content length remains the same).
@@ -240,12 +240,7 @@
 }
 }
 needsLayoutRange.start = lastInlineItemNeedsPartialLayout ? lineContentRange.end - 1 : lineContentRange.end;
-auto overflowContent = std::optional { };
-if (lineContent.partialTrailingContentLength)
-overflowContent = { lineContent.partialTrailingContentLength, lineContent.overflowLogicalWidth };
-else if (lineContent.overflowLogicalWidth)
-overflowContent = { { }, *lineContent.overflowLogicalWidth };
-previousLine = LineBuilder::PreviousLine { lineContentRange, 

[webkit-changes] [293644] trunk

2022-04-30 Thread zalan
Title: [293644] trunk








Revision 293644
Author za...@apple.com
Date 2022-04-30 06:01:57 -0700 (Sat, 30 Apr 2022)


Log Message
[LFC][IFC] Do not wrap  to the next line when it is preceded by overflowing text
https://bugs.webkit.org/show_bug.cgi?id=239879


Reviewed by Antti Koivisto.

Source/WebCore:

This patch makes sure that inline content run(s) ("X") followed by inline box end run(s) ()
don't get separated when they overflow the line (e.g. width: 0px).

Test: fast/inline/overflowing-content-inside-inline-box.html

* layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::processOverflowingContent const):

LayoutTests:

* fast/inline/overflowing-content-inside-inline-box-expected.html: Added.
* fast/inline/overflowing-content-inside-inline-box.html: Added.

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp


Added Paths

trunk/LayoutTests/fast/inline/overflowing-content-inside-inline-box-expected.html
trunk/LayoutTests/fast/inline/overflowing-content-inside-inline-box.html




Diff

Modified: trunk/LayoutTests/ChangeLog (293643 => 293644)

--- trunk/LayoutTests/ChangeLog	2022-04-30 07:26:02 UTC (rev 293643)
+++ trunk/LayoutTests/ChangeLog	2022-04-30 13:01:57 UTC (rev 293644)
@@ -1,3 +1,14 @@
+2022-04-30  Alan Bujtas  
+
+[LFC][IFC] Do not wrap  to the next line when it is preceded by overflowing text
+https://bugs.webkit.org/show_bug.cgi?id=239879
+
+
+Reviewed by Antti Koivisto.
+
+* fast/inline/overflowing-content-inside-inline-box-expected.html: Added.
+* fast/inline/overflowing-content-inside-inline-box.html: Added.
+
 2022-04-27  Jean-Yves Avenard  
 
 [ Monterey WK2 ] media/media-source/media-source-webm-vorbis-partial.html is a constant failure


Added: trunk/LayoutTests/fast/inline/overflowing-content-inside-inline-box-expected.html (0 => 293644)

--- trunk/LayoutTests/fast/inline/overflowing-content-inside-inline-box-expected.html	(rev 0)
+++ trunk/LayoutTests/fast/inline/overflowing-content-inside-inline-box-expected.html	2022-04-30 13:01:57 UTC (rev 293644)
@@ -0,0 +1,12 @@
+
+div {
+  width: 1em;
+  word-break: break-word;
+  font-family: Ahem;
+}
+
+span {
+  border: 1px solid green;
+}
+
+XXX


Added: trunk/LayoutTests/fast/inline/overflowing-content-inside-inline-box.html (0 => 293644)

--- trunk/LayoutTests/fast/inline/overflowing-content-inside-inline-box.html	(rev 0)
+++ trunk/LayoutTests/fast/inline/overflowing-content-inside-inline-box.html	2022-04-30 13:01:57 UTC (rev 293644)
@@ -0,0 +1,12 @@
+
+div {
+  width: 0px;
+  word-break: break-word;
+  font-family: Ahem;
+}
+
+span {
+  border: 1px solid green;
+}
+
+XXX


Modified: trunk/Source/WebCore/ChangeLog (293643 => 293644)

--- trunk/Source/WebCore/ChangeLog	2022-04-30 07:26:02 UTC (rev 293643)
+++ trunk/Source/WebCore/ChangeLog	2022-04-30 13:01:57 UTC (rev 293644)
@@ -1,3 +1,19 @@
+2022-04-30  Alan Bujtas  
+
+[LFC][IFC] Do not wrap  to the next line when it is preceded by overflowing text
+https://bugs.webkit.org/show_bug.cgi?id=239879
+
+
+Reviewed by Antti Koivisto.
+
+This patch makes sure that inline content run(s) ("X") followed by inline box end run(s) ()
+don't get separated when they overflow the line (e.g. width: 0px).
+
+Test: fast/inline/overflowing-content-inside-inline-box.html
+
+* layout/formattingContexts/inline/InlineContentBreaker.cpp:
+(WebCore::Layout::InlineContentBreaker::processOverflowingContent const):
+
 2022-04-29  Rob Buis  
 
 REGRESSION(r290770): element.scrollIntoViewIfNeeded() scrolls to top even when element is already in viewport


Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp (293643 => 293644)

--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp	2022-04-30 07:26:02 UTC (rev 293643)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp	2022-04-30 13:01:57 UTC (rev 293644)
@@ -201,7 +201,8 @@
 if (!trailingContent) {
 // We tried to break the content but the available space can't even accommodate the first glyph.
 // 1. Wrap the content over to the next line when we've got content on the line already.
-// 2. Keep the first glyph on the empty line (or keep the whole run if it has only one glyph/completely empty).
+// 2. Keep the first glyph on the empty line (or keep the whole run if it has only one glyph/completely empty)
+// including closing inline boxes e.g. X where "X" is the overflowing glyph).
 if (lineStatus.hasContent)
 return Result { Result::Action::Wrap, IsEndOfLine::Yes };
 
@@ -212,9 +213,23 @@
 

[webkit-changes] [293303] trunk/Source/WebCore

2022-04-24 Thread zalan
Title: [293303] trunk/Source/WebCore








Revision 293303
Author za...@apple.com
Date 2022-04-24 08:21:24 -0700 (Sun, 24 Apr 2022)


Log Message
Fix a typo (r293297)
https://bugs.webkit.org/show_bug.cgi?id=239704

Unreviewed.


* layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntergration): Deleted.
* layout/formattingContexts/flex/FlexFormattingContext.h:
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::layoutInFlowContentForIntegration):
(WebCore::Layout::InlineFormattingContext::layoutInFlowContentForIntergration): Deleted.
* layout/formattingContexts/inline/InlineFormattingContext.h:
* layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::layout):
* layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::layout):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h
trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp
trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (293302 => 293303)

--- trunk/Source/WebCore/ChangeLog	2022-04-24 05:49:49 UTC (rev 293302)
+++ trunk/Source/WebCore/ChangeLog	2022-04-24 15:21:24 UTC (rev 293303)
@@ -1,3 +1,23 @@
+2022-04-24  Alan Bujtas  
+
+Fix a typo (r293297)
+https://bugs.webkit.org/show_bug.cgi?id=239704
+
+Unreviewed.
+
+* layout/formattingContexts/flex/FlexFormattingContext.cpp:
+(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
+(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntergration): Deleted.
+* layout/formattingContexts/flex/FlexFormattingContext.h:
+* layout/formattingContexts/inline/InlineFormattingContext.cpp:
+(WebCore::Layout::InlineFormattingContext::layoutInFlowContentForIntegration):
+(WebCore::Layout::InlineFormattingContext::layoutInFlowContentForIntergration): Deleted.
+* layout/formattingContexts/inline/InlineFormattingContext.h:
+* layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
+(WebCore::LayoutIntegration::FlexLayout::layout):
+* layout/integration/inline/LayoutIntegrationLineLayout.cpp:
+(WebCore::LayoutIntegration::LineLayout::layout):
+
 2022-04-23  Chris Dumez  
 
 Unreviewed build fix after r293301.


Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (293302 => 293303)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-04-24 05:49:49 UTC (rev 293302)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-04-24 15:21:24 UTC (rev 293303)
@@ -118,7 +118,7 @@
 }
 }
 
-void FlexFormattingContext::layoutInFlowContentForIntergration(const ConstraintsForInFlowContent&)
+void FlexFormattingContext::layoutInFlowContentForIntegration(const ConstraintsForInFlowContent&)
 {
 }
 


Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h (293302 => 293303)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h	2022-04-24 05:49:49 UTC (rev 293302)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h	2022-04-24 15:21:24 UTC (rev 293303)
@@ -48,7 +48,7 @@
 const FlexFormattingGeometry& formattingGeometry() const final { return m_flexFormattingGeometry; }
 const FormattingQuirks& formattingQuirks() const final { return m_flexFormattingQuirks; }
 
-void layoutInFlowContentForIntergration(const ConstraintsForInFlowContent&);
+void layoutInFlowContentForIntegration(const ConstraintsForInFlowContent&);
 IntrinsicWidthConstraints computedIntrinsicWidthConstraintsForIntegration();
 
 private:


Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp (293302 => 293303)

--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp	2022-04-24 05:49:49 UTC (rev 293302)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp	2022-04-24 15:21:24 UTC (rev 293303)
@@ -150,7 +150,7 @@
 LOG_WITH_STREAM(FormattingContextLayout, stream << "[End] -> inline formatting context -> formatting root(" << () << ")");
 }
 
-void InlineFormattingContext::layoutInFlowContentForIntergration(const ConstraintsForInFlowContent& constraints)
+void 

[webkit-changes] [293300] trunk/Source/WebCore

2022-04-23 Thread zalan
Title: [293300] trunk/Source/WebCore








Revision 293300
Author za...@apple.com
Date 2022-04-23 20:54:39 -0700 (Sat, 23 Apr 2022)


Log Message
[Win] Unreviewed build fix.

* Headers.cmake:

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Headers.cmake




Diff

Modified: trunk/Source/WebCore/ChangeLog (293299 => 293300)

--- trunk/Source/WebCore/ChangeLog	2022-04-24 03:45:52 UTC (rev 293299)
+++ trunk/Source/WebCore/ChangeLog	2022-04-24 03:54:39 UTC (rev 293300)
@@ -1,3 +1,9 @@
+2022-04-23  Alan Bujtas  
+
+[Win] Unreviewed build fix.
+
+* Headers.cmake:
+
 2022-04-23  Wenson Hsieh  
 
 Remove the `PreferInlineTextSelectionInImages` internal feature flag


Modified: trunk/Source/WebCore/Headers.cmake (293299 => 293300)

--- trunk/Source/WebCore/Headers.cmake	2022-04-24 03:45:52 UTC (rev 293299)
+++ trunk/Source/WebCore/Headers.cmake	2022-04-24 03:54:39 UTC (rev 293300)
@@ -974,6 +974,8 @@
 layout/LayoutUnits.h
 layout/MarginTypes.h
 
+layout/formattingContexts/flex/FlexFormattingState.h
+
 layout/formattingContexts/inline/display/InlineDisplayBox.h
 layout/formattingContexts/inline/InlineRect.h
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [293297] trunk/Source/WebCore

2022-04-23 Thread zalan
Title: [293297] trunk/Source/WebCore








Revision 293297
Author za...@apple.com
Date 2022-04-23 16:03:32 -0700 (Sat, 23 Apr 2022)


Log Message
[FFC][Integration] Add integration API to FlexFormattingContext
https://bugs.webkit.org/show_bug.cgi?id=239692

Reviewed by Antti Koivisto.

The integration codepath needs dedicated (and temporary)APIs on the formatting contexts.
(This is exactly how inline layout has been integrated.)

* layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntergration):
(WebCore::Layout::FlexFormattingContext::computedIntrinsicWidthConstraintsForIntegration):
* layout/formattingContexts/flex/FlexFormattingContext.h:
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::layoutInFlowContentForIntergration):
(WebCore::Layout::InlineFormattingContext::lineLayoutForIntergration): Deleted.
* layout/formattingContexts/inline/InlineFormattingContext.h:
* layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::FlexLayout):
(WebCore::LayoutIntegration::FlexLayout::computeIntrinsicWidthConstraints):
(WebCore::LayoutIntegration::FlexLayout::layout):
* layout/integration/flex/LayoutIntegrationFlexLayout.h:
(WebCore::LayoutIntegration::FlexLayout::rootLayoutBox const):
(WebCore::LayoutIntegration::FlexLayout::rootLayoutBox):
* layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::layout):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h
trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp
trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h
trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (293296 => 293297)

--- trunk/Source/WebCore/ChangeLog	2022-04-23 22:26:57 UTC (rev 293296)
+++ trunk/Source/WebCore/ChangeLog	2022-04-23 23:03:32 UTC (rev 293297)
@@ -1,3 +1,31 @@
+2022-04-23  Alan Bujtas  
+
+[FFC][Integration] Add integration API to FlexFormattingContext
+https://bugs.webkit.org/show_bug.cgi?id=239692
+
+Reviewed by Antti Koivisto.
+
+The integration codepath needs dedicated (and temporary)APIs on the formatting contexts.
+(This is exactly how inline layout has been integrated.)
+
+* layout/formattingContexts/flex/FlexFormattingContext.cpp:
+(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntergration):
+(WebCore::Layout::FlexFormattingContext::computedIntrinsicWidthConstraintsForIntegration):
+* layout/formattingContexts/flex/FlexFormattingContext.h:
+* layout/formattingContexts/inline/InlineFormattingContext.cpp:
+(WebCore::Layout::InlineFormattingContext::layoutInFlowContentForIntergration):
+(WebCore::Layout::InlineFormattingContext::lineLayoutForIntergration): Deleted.
+* layout/formattingContexts/inline/InlineFormattingContext.h:
+* layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
+(WebCore::LayoutIntegration::FlexLayout::FlexLayout):
+(WebCore::LayoutIntegration::FlexLayout::computeIntrinsicWidthConstraints):
+(WebCore::LayoutIntegration::FlexLayout::layout):
+* layout/integration/flex/LayoutIntegrationFlexLayout.h:
+(WebCore::LayoutIntegration::FlexLayout::rootLayoutBox const):
+(WebCore::LayoutIntegration::FlexLayout::rootLayoutBox):
+* layout/integration/inline/LayoutIntegrationLineLayout.cpp:
+(WebCore::LayoutIntegration::LineLayout::layout):
+
 2022-04-23  Brady Eidson  
 
 Add WKNotification and WKWebsiteDataStore SPI for handling click/close of persistent notifications


Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (293296 => 293297)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-04-23 22:26:57 UTC (rev 293296)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-04-23 23:03:32 UTC (rev 293297)
@@ -118,7 +118,16 @@
 }
 }
 
+void FlexFormattingContext::layoutInFlowContentForIntergration(const ConstraintsForInFlowContent&)
+{
 }
+
+IntrinsicWidthConstraints FlexFormattingContext::computedIntrinsicWidthConstraintsForIntegration()
+{
+return { };
 }
 
+}
+}
+
 #endif


Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h (293296 => 293297)

--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h	2022-04-23 22:26:57 UTC (rev 293296)
+++ 

[webkit-changes] [293293] trunk/Source/WebCore

2022-04-23 Thread zalan
Title: [293293] trunk/Source/WebCore








Revision 293293
Author za...@apple.com
Date 2022-04-23 13:25:12 -0700 (Sat, 23 Apr 2022)


Log Message
[FFC][Integration] Construct and update the layout tree for the flex items
https://bugs.webkit.org/show_bug.cgi?id=239684

Reviewed by Antti Koivisto.

This patch implements the usual flow of preparing a subtree for integration layout.

1. Take the direct children of a RenderFlexibleBox (flex items) and construct Layout::ContainerBox objects.
2. Run layout on the direct children (RenderBlocks) first and update the associated Layout::ContainerBoxes' geometries.
3. Call LayoutIntegration::FlexLayout::layout (not yet implemented) to run flex layout on the flex items.

* layout/integration/LayoutIntegrationBoxTree.cpp:
(WebCore::LayoutIntegration::BoxTree::buildTreeForFlexContent):
* layout/integration/LayoutIntegrationBoxTree.h:
* layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::FlexLayout):
(WebCore::LayoutIntegration::FlexLayout::updateFlexItemDimensions):
* layout/integration/flex/LayoutIntegrationFlexLayout.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutUsingFlexFormattingContext):
* rendering/RenderFlexibleBox.h:

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Headers.cmake
trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp
trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.h
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
trunk/Source/WebCore/rendering/RenderFlexibleBox.h




Diff

Modified: trunk/Source/WebCore/ChangeLog (293292 => 293293)

--- trunk/Source/WebCore/ChangeLog	2022-04-23 17:36:17 UTC (rev 293292)
+++ trunk/Source/WebCore/ChangeLog	2022-04-23 20:25:12 UTC (rev 293293)
@@ -1,3 +1,27 @@
+2022-04-23  Alan Bujtas  
+
+[FFC][Integration] Construct and update the layout tree for the flex items
+https://bugs.webkit.org/show_bug.cgi?id=239684
+
+Reviewed by Antti Koivisto.
+
+This patch implements the usual flow of preparing a subtree for integration layout.
+
+1. Take the direct children of a RenderFlexibleBox (flex items) and construct Layout::ContainerBox objects.
+2. Run layout on the direct children (RenderBlocks) first and update the associated Layout::ContainerBoxes' geometries.
+3. Call LayoutIntegration::FlexLayout::layout (not yet implemented) to run flex layout on the flex items.
+
+* layout/integration/LayoutIntegrationBoxTree.cpp:
+(WebCore::LayoutIntegration::BoxTree::buildTreeForFlexContent):
+* layout/integration/LayoutIntegrationBoxTree.h:
+* layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
+(WebCore::LayoutIntegration::FlexLayout::FlexLayout):
+(WebCore::LayoutIntegration::FlexLayout::updateFlexItemDimensions):
+* layout/integration/flex/LayoutIntegrationFlexLayout.h:
+* rendering/RenderFlexibleBox.cpp:
+(WebCore::RenderFlexibleBox::layoutUsingFlexFormattingContext):
+* rendering/RenderFlexibleBox.h:
+
 2022-04-23  Andres Gonzalez  
 
 AX ITM: Table row objects should return a non-null unignored parent even when a table object is not found in its ancestry.


Modified: trunk/Source/WebCore/Headers.cmake (293292 => 293293)

--- trunk/Source/WebCore/Headers.cmake	2022-04-23 17:36:17 UTC (rev 293292)
+++ trunk/Source/WebCore/Headers.cmake	2022-04-23 20:25:12 UTC (rev 293293)
@@ -970,6 +970,7 @@
 
 inspector/agents/InspectorPageAgent.h
 
+layout/LayoutState.h
 layout/LayoutUnits.h
 layout/MarginTypes.h
 
@@ -976,6 +977,8 @@
 layout/formattingContexts/inline/display/InlineDisplayBox.h
 layout/formattingContexts/inline/InlineRect.h
 
+layout/integration/LayoutIntegrationBoxTree.h
+
 layout/integration/flex/LayoutIntegrationFlexLayout.h
 
 layout/integration/inline/InlineIteratorBox.h
@@ -991,6 +994,7 @@
 
 layout/layouttree/LayoutContainerBox.h
 layout/layouttree/LayoutBox.h
+layout/layouttree/LayoutInitialContainingBlock.h
 
 loader/CanvasActivityRecord.h
 loader/ContentFilterClient.h


Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp (293292 => 293293)

--- trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp	2022-04-23 17:36:17 UTC (rev 293292)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp	2022-04-23 20:25:12 UTC (rev 293293)
@@ -37,6 +37,7 @@
 #include "RenderBlockFlow.h"
 #include "RenderChildIterator.h"
 #include "RenderDetailsMarker.h"
+#include "RenderFlexibleBox.h"
 #include "RenderImage.h"
 #include "RenderLineBreak.h"
 #include "RenderListItem.h"
@@ -87,6 +88,8 @@
 
 if (is(rootRenderer))
 buildTreeForInlineContent();
+else if (is(rootRenderer))
+

[webkit-changes] [293251] trunk/Source/WebCore

2022-04-22 Thread zalan
Title: [293251] trunk/Source/WebCore








Revision 293251
Author za...@apple.com
Date 2022-04-22 13:48:29 -0700 (Fri, 22 Apr 2022)


Log Message
[LFC][Integration] Add blank LayoutIntegration::FlexLayout
https://bugs.webkit.org/show_bug.cgi?id=239663

Reviewed by Antti Koivisto.

This is in preparation for adding flex formatting context integration.

* CMakeLists.txt:
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/integration/flex/LayoutIntegrationFlexLayout.cpp: Added.
(WebCore::LayoutIntegration::FlexLayout::FlexLayout):
(WebCore::LayoutIntegration::FlexLayout::updateFormattingRootGeometryAndInvalidate):
(WebCore::LayoutIntegration::FlexLayout::updateFlexItemDimensions):
(WebCore::LayoutIntegration::FlexLayout::updateStyle):
(WebCore::LayoutIntegration::FlexLayout::computeIntrinsicWidthConstraints):
(WebCore::LayoutIntegration::FlexLayout::layout):
(WebCore::LayoutIntegration::FlexLayout::paint):
(WebCore::LayoutIntegration::FlexLayout::hitTest):
(WebCore::LayoutIntegration::FlexLayout::collectOverflow):
(WebCore::LayoutIntegration::FlexLayout::contentLogicalHeight const):
* layout/integration/flex/LayoutIntegrationFlexLayout.h: Added.

Modified Paths

trunk/Source/WebCore/CMakeLists.txt
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/Headers.cmake
trunk/Source/WebCore/Sources.txt
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj


Added Paths

trunk/Source/WebCore/layout/integration/flex/
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h




Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (293250 => 293251)

--- trunk/Source/WebCore/CMakeLists.txt	2022-04-22 20:43:43 UTC (rev 293250)
+++ trunk/Source/WebCore/CMakeLists.txt	2022-04-22 20:48:29 UTC (rev 293251)
@@ -121,6 +121,7 @@
 "${WEBCORE_DIR}/layout/formattingContexts/inline/invalidation"
 "${WEBCORE_DIR}/layout/formattingContexts/inline/text"
 "${WEBCORE_DIR}/layout/integration"
+"${WEBCORE_DIR}/layout/integration/flex"
 "${WEBCORE_DIR}/layout/integration/inline"
 "${WEBCORE_DIR}/layout/layouttree"
 "${WEBCORE_DIR}/layout/formattingContexts/table"


Modified: trunk/Source/WebCore/ChangeLog (293250 => 293251)

--- trunk/Source/WebCore/ChangeLog	2022-04-22 20:43:43 UTC (rev 293250)
+++ trunk/Source/WebCore/ChangeLog	2022-04-22 20:48:29 UTC (rev 293251)
@@ -1,5 +1,31 @@
 2022-04-22  Alan Bujtas  
 
+[LFC][Integration] Add blank LayoutIntegration::FlexLayout
+https://bugs.webkit.org/show_bug.cgi?id=239663
+
+Reviewed by Antti Koivisto.
+
+This is in preparation for adding flex formatting context integration.
+
+* CMakeLists.txt:
+* Headers.cmake:
+* Sources.txt:
+* WebCore.xcodeproj/project.pbxproj:
+* layout/integration/flex/LayoutIntegrationFlexLayout.cpp: Added.
+(WebCore::LayoutIntegration::FlexLayout::FlexLayout):
+(WebCore::LayoutIntegration::FlexLayout::updateFormattingRootGeometryAndInvalidate):
+(WebCore::LayoutIntegration::FlexLayout::updateFlexItemDimensions):
+(WebCore::LayoutIntegration::FlexLayout::updateStyle):
+(WebCore::LayoutIntegration::FlexLayout::computeIntrinsicWidthConstraints):
+(WebCore::LayoutIntegration::FlexLayout::layout):
+(WebCore::LayoutIntegration::FlexLayout::paint):
+(WebCore::LayoutIntegration::FlexLayout::hitTest):
+(WebCore::LayoutIntegration::FlexLayout::collectOverflow):
+(WebCore::LayoutIntegration::FlexLayout::contentLogicalHeight const):
+* layout/integration/flex/LayoutIntegrationFlexLayout.h: Added.
+
+2022-04-22  Alan Bujtas  
+
 [LFC][Integration] Add FlexFormattingContextIntegrationEnabled setting
 https://bugs.webkit.org/show_bug.cgi?id=239654
 


Modified: trunk/Source/WebCore/Headers.cmake (293250 => 293251)

--- trunk/Source/WebCore/Headers.cmake	2022-04-22 20:43:43 UTC (rev 293250)
+++ trunk/Source/WebCore/Headers.cmake	2022-04-22 20:48:29 UTC (rev 293251)
@@ -976,6 +976,8 @@
 layout/formattingContexts/inline/display/InlineDisplayBox.h
 layout/formattingContexts/inline/InlineRect.h
 
+layout/integration/flex/LayoutIntegrationFlexLayout.h
+
 layout/integration/inline/InlineIteratorBox.h
 layout/integration/inline/InlineIteratorBoxLegacyPath.h
 layout/integration/inline/InlineIteratorBoxModernPath.h


Modified: trunk/Source/WebCore/Sources.txt (293250 => 293251)

--- trunk/Source/WebCore/Sources.txt	2022-04-22 20:43:43 UTC (rev 293250)
+++ trunk/Source/WebCore/Sources.txt	2022-04-22 20:48:29 UTC (rev 293251)
@@ -1586,6 +1586,7 @@
 layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp
 layout/formattingContexts/inline/invalidation/InlineInvalidation.cpp
 layout/formattingContexts/inline/text/TextUtil.cpp
+layout/integration/flex/LayoutIntegrationFlexLayout.cpp
 layout/integration/inline/InlineIteratorBox.cpp
 

[webkit-changes] [293233] trunk/Source

2022-04-22 Thread zalan
Title: [293233] trunk/Source








Revision 293233
Author za...@apple.com
Date 2022-04-22 11:25:20 -0700 (Fri, 22 Apr 2022)


Log Message
[LFC][Integration] Add FlexFormattingContextIntegrationEnabled setting
https://bugs.webkit.org/show_bug.cgi?id=239654

Reviewed by Antti Koivisto.

Source/WebCore:

This is in preparation for supporting flex formatting context through integration.

* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForFlexLayout):
* layout/integration/LayoutIntegrationCoverage.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutFlexItems):
(WebCore::RenderFlexibleBox::layoutUsingFlexFormattingContext):
* rendering/RenderFlexibleBox.h:

Source/WTF:

* Scripts/Preferences/WebPreferencesInternal.yaml:

Modified Paths

trunk/Source/WTF/ChangeLog
trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp
trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
trunk/Source/WebCore/rendering/RenderFlexibleBox.h




Diff

Modified: trunk/Source/WTF/ChangeLog (293232 => 293233)

--- trunk/Source/WTF/ChangeLog	2022-04-22 18:02:38 UTC (rev 293232)
+++ trunk/Source/WTF/ChangeLog	2022-04-22 18:25:20 UTC (rev 293233)
@@ -1,3 +1,12 @@
+2022-04-22  Alan Bujtas  
+
+[LFC][Integration] Add FlexFormattingContextIntegrationEnabled setting
+https://bugs.webkit.org/show_bug.cgi?id=239654
+
+Reviewed by Antti Koivisto.
+
+* Scripts/Preferences/WebPreferencesInternal.yaml:
+
 2022-04-20  Yusuke Suzuki  
 
 [WTF] Add string concatenate adapter for UUID


Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml (293232 => 293233)

--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml	2022-04-22 18:02:38 UTC (rev 293232)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml	2022-04-22 18:25:20 UTC (rev 293233)
@@ -303,6 +303,19 @@
 WebKit:
   default: true
 
+FlexFormattingContextIntegrationEnabled:
+  type: bool
+  humanReadableName: "Next-generation flex layout integration (FFC)"
+  humanReadableDescription: "Enable next-generation flex layout integration (FFC)"
+  condition: ENABLE(LAYOUT_FORMATTING_CONTEXT)
+  defaultValue:
+WebKitLegacy:
+  default: false
+WebKit:
+  default: false
+WebCore:
+  default: false
+
 # FIXME: This should be reconciled with 'FrameFlattening' in WebPreferences.yaml .
 FrameFlatteningEnabled:
   type: bool


Modified: trunk/Source/WebCore/ChangeLog (293232 => 293233)

--- trunk/Source/WebCore/ChangeLog	2022-04-22 18:02:38 UTC (rev 293232)
+++ trunk/Source/WebCore/ChangeLog	2022-04-22 18:25:20 UTC (rev 293233)
@@ -1,3 +1,20 @@
+2022-04-22  Alan Bujtas  
+
+[LFC][Integration] Add FlexFormattingContextIntegrationEnabled setting
+https://bugs.webkit.org/show_bug.cgi?id=239654
+
+Reviewed by Antti Koivisto.
+
+This is in preparation for supporting flex formatting context through integration.
+
+* layout/integration/LayoutIntegrationCoverage.cpp:
+(WebCore::LayoutIntegration::canUseForFlexLayout):
+* layout/integration/LayoutIntegrationCoverage.h:
+* rendering/RenderFlexibleBox.cpp:
+(WebCore::RenderFlexibleBox::layoutFlexItems):
+(WebCore::RenderFlexibleBox::layoutUsingFlexFormattingContext):
+* rendering/RenderFlexibleBox.h:
+
 2022-04-22  Brandon Stewart  
 
 Store StyleScope during CSSStyleSheet Creation


Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp (293232 => 293233)

--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2022-04-22 18:02:38 UTC (rev 293232)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2022-04-22 18:25:20 UTC (rev 293233)
@@ -674,7 +674,15 @@
 return canUseForRenderInlineChild(renderer, IncludeReasons::First).isEmpty();
 }
 
+bool canUseForFlexLayout(const RenderFlexibleBox& flexBox)
+{
+if (!flexBox.document().settings().flexFormattingContextIntegrationEnabled())
+return false;
+ASSERT_NOT_IMPLEMENTED_YET();
+return false;
 }
+
 }
+}
 
 #endif


Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h (293232 => 293233)

--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h	2022-04-22 18:02:38 UTC (rev 293232)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h	2022-04-22 18:25:20 UTC (rev 293233)
@@ -33,6 +33,7 @@
 namespace WebCore {
 
 class RenderBlockFlow;
+class RenderFlexibleBox;
 class RenderInline;
 
 namespace LayoutIntegration {
@@ -107,6 +108,8 @@
 bool canUseForLineLayoutAfterStyleChange(const RenderBlockFlow&, StyleDifference);
 bool canUseForLineLayoutAfterInlineBoxStyleChange(const RenderInline&, StyleDifference);
 
+bool canUseForFlexLayout(const 

[webkit-changes] [293222] trunk/Source/WebCore

2022-04-22 Thread zalan
Title: [293222] trunk/Source/WebCore








Revision 293222
Author za...@apple.com
Date 2022-04-22 08:57:52 -0700 (Fri, 22 Apr 2022)


Log Message
[LFC][Integration] BoxTree should be able to build non-inline content tree
https://bugs.webkit.org/show_bug.cgi?id=239653

Reviewed by Antti Koivisto.

This is in preparation for supporting non-IFC content (e.g. flex).

* layout/integration/LayoutIntegrationBoxTree.cpp:
(WebCore::LayoutIntegration::rootBoxFirstLineStyle):
(WebCore::LayoutIntegration::BoxTree::BoxTree):
(WebCore::LayoutIntegration::BoxTree::buildTreeForInlineContent):
(WebCore::LayoutIntegration::BoxTree::layoutBoxForRenderer):
(WebCore::LayoutIntegration::BoxTree::rendererForLayoutBox):
(WebCore::LayoutIntegration::BoxTree::buildTree): Deleted.
* layout/integration/LayoutIntegrationBoxTree.h:
(WebCore::LayoutIntegration::BoxTree::rootRenderer const):
(WebCore::LayoutIntegration::BoxTree::rootRenderer):
(WebCore::LayoutIntegration::BoxTree::flow const): Deleted.
(WebCore::LayoutIntegration::BoxTree::flow): Deleted.
* layout/integration/inline/LayoutIntegrationLineLayout.h:
(WebCore::LayoutIntegration::LineLayout::flow const):
(WebCore::LayoutIntegration::LineLayout::flow):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp
trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.h
trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.h




Diff

Modified: trunk/Source/WebCore/ChangeLog (293221 => 293222)

--- trunk/Source/WebCore/ChangeLog	2022-04-22 15:13:42 UTC (rev 293221)
+++ trunk/Source/WebCore/ChangeLog	2022-04-22 15:57:52 UTC (rev 293222)
@@ -1,3 +1,28 @@
+2022-04-22  Alan Bujtas  
+
+[LFC][Integration] BoxTree should be able to build non-inline content tree
+https://bugs.webkit.org/show_bug.cgi?id=239653
+
+Reviewed by Antti Koivisto.
+
+This is in preparation for supporting non-IFC content (e.g. flex).
+
+* layout/integration/LayoutIntegrationBoxTree.cpp:
+(WebCore::LayoutIntegration::rootBoxFirstLineStyle):
+(WebCore::LayoutIntegration::BoxTree::BoxTree):
+(WebCore::LayoutIntegration::BoxTree::buildTreeForInlineContent):
+(WebCore::LayoutIntegration::BoxTree::layoutBoxForRenderer):
+(WebCore::LayoutIntegration::BoxTree::rendererForLayoutBox):
+(WebCore::LayoutIntegration::BoxTree::buildTree): Deleted.
+* layout/integration/LayoutIntegrationBoxTree.h:
+(WebCore::LayoutIntegration::BoxTree::rootRenderer const):
+(WebCore::LayoutIntegration::BoxTree::rootRenderer):
+(WebCore::LayoutIntegration::BoxTree::flow const): Deleted.
+(WebCore::LayoutIntegration::BoxTree::flow): Deleted.
+* layout/integration/inline/LayoutIntegrationLineLayout.h:
+(WebCore::LayoutIntegration::LineLayout::flow const):
+(WebCore::LayoutIntegration::LineLayout::flow):
+
 2022-04-22  Mark Lam  
 
 Apply purifyNaN in more places.


Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp (293221 => 293222)

--- trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp	2022-04-22 15:13:42 UTC (rev 293221)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp	2022-04-22 15:57:52 UTC (rev 293222)
@@ -33,6 +33,7 @@
 #include "LayoutInlineTextBox.h"
 #include "LayoutLineBreakBox.h"
 #include "LayoutReplacedBox.h"
+#include "RenderBlock.h"
 #include "RenderBlockFlow.h"
 #include "RenderChildIterator.h"
 #include "RenderDetailsMarker.h"
@@ -62,32 +63,35 @@
 return clonedStyle;
 }
 
-static std::unique_ptr rootBoxFirstLineStyle(const RenderBlockFlow& root)
+static std::unique_ptr rootBoxFirstLineStyle(const RenderBlock& rootRenderer)
 {
 #if CAN_USE_FIRST_LINE_STYLE_RESOLVE
-auto& firstLineStyle = root.firstLineStyle();
-if (root.style() == firstLineStyle)
+auto& firstLineStyle = rootRenderer.firstLineStyle();
+if (rootRenderer.style() == firstLineStyle)
 return { };
 auto clonedStyle = RenderStyle::clonePtr(firstLineStyle);
 clonedStyle->setEffectiveDisplay(DisplayType::Block);
 return clonedStyle;
 #else
-UNUSED_PARAM(root);
+UNUSED_PARAM(rootRenderer);
 return { };
 #endif
 }
 
-BoxTree::BoxTree(RenderBlockFlow& flow)
-: m_flow(flow)
-, m_root(Layout::Box::ElementAttributes { Layout::Box::ElementType::IntegrationBlockContainer }, rootBoxStyle(flow.style()), rootBoxFirstLineStyle(flow))
+BoxTree::BoxTree(RenderBlock& rootRenderer)
+: m_rootRenderer(rootRenderer)
+, m_root(Layout::Box::ElementAttributes { Layout::Box::ElementType::IntegrationBlockContainer }, rootBoxStyle(rootRenderer.style()), rootBoxFirstLineStyle(rootRenderer))
 {
-if (flow.isAnonymous())
+if (rootRenderer.isAnonymous())
 m_root.setIsAnonymous();
 
-buildTree();
+if (is(rootRenderer))
+buildTreeForInlineContent();
+else
+

[webkit-changes] [293218] trunk

2022-04-22 Thread zalan
Title: [293218] trunk








Revision 293218
Author za...@apple.com
Date 2022-04-22 06:27:43 -0700 (Fri, 22 Apr 2022)


Log Message
Book content is clipped at page boundary when displaying list with bullet points
https://bugs.webkit.org/show_bug.cgi?id=239638


Reviewed by Antti Koivisto.

Source/WebCore:

Table cell content needs special handling when does not fit the page.

When a table cell's first line does not fit the page, instead of the normal, "let's add a flow level pagination strut"
we have to handle it as a line level strut (not sure why it is implemted this way but this is the expected behavior).
-also implment LineBoxIteratorModernPath::isFirstAfterPageBreak.

Test: fast/multicol/pagination/table-cell-one-line-pagination.html

* layout/integration/inline/InlineIteratorLineBoxModernPath.h:
(WebCore::InlineIterator::LineBoxIteratorModernPath::isFirstAfterPageBreak const):
* layout/integration/inline/LayoutIntegrationLine.h:
(WebCore::LayoutIntegration::Line::Line):
(WebCore::LayoutIntegration::Line::isFirstAfterPageBreak const):
* layout/integration/inline/LayoutIntegrationPagination.cpp:
(WebCore::LayoutIntegration::setPageBreakForLine): According to RenderBlockFlow::adjustLinePositionForPagination, we
have to call setPageBreak, even when the first line does not fit.
(WebCore::LayoutIntegration::makeAdjustedContent):
(WebCore::LayoutIntegration::adjustLinePositionsForPagination):

LayoutTests:

* fast/multicol/pagination/table-cell-one-line-pagination-expected.html: Added.
* fast/multicol/pagination/table-cell-one-line-pagination.html: Added.

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/integration/inline/InlineIteratorLineBoxModernPath.h
trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationLine.h
trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationPagination.cpp


Added Paths

trunk/LayoutTests/fast/multicol/pagination/table-cell-one-line-pagination-expected.html
trunk/LayoutTests/fast/multicol/pagination/table-cell-one-line-pagination.html




Diff

Modified: trunk/LayoutTests/ChangeLog (293217 => 293218)

--- trunk/LayoutTests/ChangeLog	2022-04-22 12:02:18 UTC (rev 293217)
+++ trunk/LayoutTests/ChangeLog	2022-04-22 13:27:43 UTC (rev 293218)
@@ -1,3 +1,14 @@
+2022-04-22  Alan Bujtas  
+
+Book content is clipped at page boundary when displaying list with bullet points
+https://bugs.webkit.org/show_bug.cgi?id=239638
+
+
+Reviewed by Antti Koivisto.
+
+* fast/multicol/pagination/table-cell-one-line-pagination-expected.html: Added.
+* fast/multicol/pagination/table-cell-one-line-pagination.html: Added.
+
 2022-04-22  Tyler Wilcock  
 
 AX: The isolated tree is not updated after role changes in AccessibilityRenderObject::updateRoleAfterChildrenCreation()


Added: trunk/LayoutTests/fast/multicol/pagination/table-cell-one-line-pagination-expected.html (0 => 293218)

--- trunk/LayoutTests/fast/multicol/pagination/table-cell-one-line-pagination-expected.html	(rev 0)
+++ trunk/LayoutTests/fast/multicol/pagination/table-cell-one-line-pagination-expected.html	2022-04-22 13:27:43 UTC (rev 293218)
@@ -0,0 +1,18 @@
+
+div {
+  font-size: 90px;
+}
+
+
+  if (window.internals)
+internals.setPagination("LeftToRightPaginated", 0);
+
+
+
+
+
+
+
+
+
+


Added: trunk/LayoutTests/fast/multicol/pagination/table-cell-one-line-pagination.html (0 => 293218)

--- trunk/LayoutTests/fast/multicol/pagination/table-cell-one-line-pagination.html	(rev 0)
+++ trunk/LayoutTests/fast/multicol/pagination/table-cell-one-line-pagination.html	2022-04-22 13:27:43 UTC (rev 293218)
@@ -0,0 +1,19 @@
+
+div {
+  font-size: 90px;
+  display: table;
+}
+
+
+  if (window.internals)
+internals.setPagination("LeftToRightPaginated", 0);
+
+
+
+
+
+
+
+
+
+


Modified: trunk/Source/WebCore/ChangeLog (293217 => 293218)

--- trunk/Source/WebCore/ChangeLog	2022-04-22 12:02:18 UTC (rev 293217)
+++ trunk/Source/WebCore/ChangeLog	2022-04-22 13:27:43 UTC (rev 293218)
@@ -1,3 +1,30 @@
+2022-04-22  Alan Bujtas  
+
+Book content is clipped at page boundary when displaying list with bullet points
+https://bugs.webkit.org/show_bug.cgi?id=239638
+
+
+Reviewed by Antti Koivisto.
+
+Table cell content needs special handling when does not fit the page.
+
+When a table cell's first line does not fit the page, instead of the normal, "let's add a flow level pagination strut"
+we have to handle it as a line level strut (not sure why it is implemted this way but this is the expected behavior).
+-also implment LineBoxIteratorModernPath::isFirstAfterPageBreak.
+
+Test: fast/multicol/pagination/table-cell-one-line-pagination.html
+
+* 

[webkit-changes] [292948] trunk/Source/WebCore

2022-04-17 Thread zalan
Title: [292948] trunk/Source/WebCore








Revision 292948
Author za...@apple.com
Date 2022-04-17 06:32:42 -0700 (Sun, 17 Apr 2022)


Log Message
RenderDeprecatedFlexibleBox::applyLineClamp should use size_t
https://bugs.webkit.org/show_bug.cgi?id=239389

Reviewed by Darin Adler.

Use size_t consistently in applyLineClamp.
While LineClampValue is int based, it can also be a percent type which expands the clamping range to size_t.

getHeightForLineCount -> use size_t and drop the magic -1.
heightForLineCount -> return LayoutUnit instead of int.

* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::getHeightForLineCount):
(WebCore::heightForLineCount):
(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (292947 => 292948)

--- trunk/Source/WebCore/ChangeLog	2022-04-17 08:08:00 UTC (rev 292947)
+++ trunk/Source/WebCore/ChangeLog	2022-04-17 13:32:42 UTC (rev 292948)
@@ -1,3 +1,21 @@
+2022-04-17  Alan Bujtas  
+
+RenderDeprecatedFlexibleBox::applyLineClamp should use size_t
+https://bugs.webkit.org/show_bug.cgi?id=239389
+
+Reviewed by Darin Adler.
+
+Use size_t consistently in applyLineClamp.
+While LineClampValue is int based, it can also be a percent type which expands the clamping range to size_t.
+
+getHeightForLineCount -> use size_t and drop the magic -1.
+heightForLineCount -> return LayoutUnit instead of int.
+
+* rendering/RenderDeprecatedFlexibleBox.cpp:
+(WebCore::getHeightForLineCount):
+(WebCore::heightForLineCount):
+(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
+
 2022-04-16  Ryosuke Niwa  
 
 Make release assertion in Document::updateLayout more precise for FrameSelection::setSelection


Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (292947 => 292948)

--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2022-04-17 08:08:00 UTC (rev 292947)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2022-04-17 13:32:42 UTC (rev 292948)
@@ -985,10 +985,10 @@
 return nullptr;
 }
 
-static int getHeightForLineCount(const RenderBlockFlow& block, int lineCount, bool includeBottom, int& count)
+static std::optional getHeightForLineCount(const RenderBlockFlow& block, size_t lineCount, bool includeBottom, size_t& count)
 {
 if (block.style().visibility() != Visibility::Visible)
-return -1;
+return { };
 
 if (block.childrenInline()) {
 for (auto* box = block.firstRootBox(); box; box = box->nextRootBox()) {
@@ -999,9 +999,8 @@
 RenderBox* normalFlowChildWithoutLines = nullptr;
 for (auto* obj = block.firstChildBox(); obj; obj = obj->nextSiblingBox()) {
 if (is(*obj) && shouldIncludeLinesForParentLineCount(downcast(*obj))) {
-int result = getHeightForLineCount(downcast(*obj), lineCount, false, count);
-if (result != -1)
-return result + obj->y() + (includeBottom ? (block.borderBottom() + block.paddingBottom()) : 0_lu);
+if (auto height = getHeightForLineCount(downcast(*obj), lineCount, false, count))
+return *height + obj->y() + (includeBottom ? (block.borderBottom() + block.paddingBottom()) : 0_lu);
 } else if (!obj->isFloatingOrOutOfFlowPositioned())
 normalFlowChildWithoutLines = obj;
 }
@@ -1009,13 +1008,15 @@
 return normalFlowChildWithoutLines->y() + normalFlowChildWithoutLines->height();
 }
 
-return -1;
+return { };
 }
 
-static int heightForLineCount(const RenderBlockFlow& flow, int lineCount)
+static LayoutUnit heightForLineCount(const RenderBlockFlow& flow, size_t lineCount)
 {
-int count = 0;
-return getHeightForLineCount(flow, lineCount, true, count);
+size_t count = 0;
+if (auto height = getHeightForLineCount(flow, lineCount, true, count))
+return *height;
+return { };
 }
 
 static size_t lineCountFor(const RenderBlockFlow& blockFlow)
@@ -1037,7 +1038,7 @@
 
 void RenderDeprecatedFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutChildren)
 {
-int maxLineCount = 0;
+size_t maxLineCount = 0;
 for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
 if (childDoesNotAffectWidthOrFlexing(child))
 continue;
@@ -1055,13 +1056,19 @@
 }
 child->layoutIfNeeded();
 if (child->style().height().isAuto() && is(*child))
-maxLineCount = std::max(maxLineCount, lineCountFor(downcast(*child)));
+maxLineCount = std::max(maxLineCount, lineCountFor(downcast(*child)));
 }
 
 // Get the number of lines and then alter all block flow children with auto height to use the
 // specified height. We always try to leave room for at least 

[webkit-changes] [292855] trunk

2022-04-13 Thread zalan
Title: [292855] trunk








Revision 292855
Author za...@apple.com
Date 2022-04-13 20:56:58 -0700 (Wed, 13 Apr 2022)


Log Message
REGRESSION (r292043): [ Mac ] fast/block/positioning/fixed-container-with-relative-parent.html is a flaky image failure
https://bugs.webkit.org/show_bug.cgi?id=239101


Reviewed by Antti Koivisto.

Source/WebCore:

1. Out of flow boxes are laid out independently from each other as the last step of their containing block layout.
2. However their static positions are computed during regular in-flow layout (as if their positions were static).

In order to do #1, we maintain a ListHashSet for the out-of-flow boxes and insert them at #2 (and we also have
a corresponding HashMap).

Normally this is a very simple list of descendant positioned boxes and since out-of-flow boxes don't interact with each
other, their position in the list is not important.
  e.g.

  


  


At in-flow layout (#2), we insert B and C to "ListHashSet of A" as we come across them in DOM order and compute their static positions.
Later in the layout flow when we get to the "let's layout the out-of-flow boxes" phase (#1) we simply walk
the ListHashSet and lay out B and C (but "C and B" order would also work just fine).

However the ICB (RenderView) is a special containing block as it can hold different types of out-of-flow boxes (absolute and fixed)
and those out-of-flow boxes may have layout dependencies.
e.g.


ICB's ListHasSet has both A and B, but in this case there's (static)layout dependency between these boxes.
In order to figure out the static position of B, we have to have A laid out first. In order to lay out A before B,
B has to be preceded by A in ICB's ListHasSet.

Now full layout always guarantees the correct order.
However in case of partial layout since we don't run a full #2, the ListHasSet may end up having an unexpected order.
  e.g.
   

 1. The initial (full) layout produces the following (correct) order for the ICB's ListHasSet -> AC.
 2. A subsequent partial layout (e.g. triggered by A's position change) runs an in-flow layout on the  which
 (re-)appends A to the ListHasSet (CA <- incorrect order). Now at this point we assume that the in-flow layout picks up B
 which eventually (re-)appends C to the ListHashSet (AC <- correct order). However since B does not need layout, we just
 stop at  which leaves us with an unexpected ListHashSet.
 3. As part of the ICB's out-of-flow layout, we pick C as the first box to lay out followed by A. However since C's static
 position depends on A's position, we end up using stale geometry when computing C's static position.

This patch fixes this issue by ensuring the absolute positioned boxes always come first in the ICB's ListHasSet (note
that their order is not really important -see above. What's important is that a potential (as-if-static) containing block always
comes before the fixed boxes).

Test: fast/block/fixed-inside-absolute-positioned.html

* rendering/RenderBlock.cpp:
(WebCore::PositionedDescendantsMap::addDescendant):
(WebCore::RenderBlock::insertPositionedObject):

LayoutTests:

* fast/block/fixed-inside-absolute-positioned-expected.html: Added.
* fast/block/fixed-inside-absolute-positioned.html: Added.
* platform/mac-wk1/TestExpectations:

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/platform/mac/TestExpectations
trunk/LayoutTests/platform/mac-wk1/TestExpectations
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/rendering/RenderBlock.cpp


Added Paths

trunk/LayoutTests/fast/block/fixed-inside-absolute-positioned-expected.html
trunk/LayoutTests/fast/block/fixed-inside-absolute-positioned.html




Diff

Modified: trunk/LayoutTests/ChangeLog (292854 => 292855)

--- trunk/LayoutTests/ChangeLog	2022-04-14 03:55:10 UTC (rev 292854)
+++ trunk/LayoutTests/ChangeLog	2022-04-14 03:56:58 UTC (rev 292855)
@@ -1,3 +1,15 @@
+2022-04-13  Alan Bujtas  
+
+REGRESSION (r292043): [ Mac ] fast/block/positioning/fixed-container-with-relative-parent.html is a flaky image failure
+https://bugs.webkit.org/show_bug.cgi?id=239101
+
+
+Reviewed by Antti Koivisto.
+
+* fast/block/fixed-inside-absolute-positioned-expected.html: Added.
+* fast/block/fixed-inside-absolute-positioned.html: Added.
+* platform/mac-wk1/TestExpectations:
+
 2022-04-13  Truitt Savell  
 
 [ Monterey WK2 ] media/media-source/media-source-webm-vorbis-partial.html is a constant failure


Added: trunk/LayoutTests/fast/block/fixed-inside-absolute-positioned-expected.html (0 => 292855)

--- trunk/LayoutTests/fast/block/fixed-inside-absolute-positioned-expected.html	(rev 0)
+++ trunk/LayoutTests/fast/block/fixed-inside-absolute-positioned-expected.html	2022-04-14 03:56:58 UTC (rev 292855)
@@ -0,0 +1,13 @@
+
+body {
+  margin: 0px;
+}
+div {
+  width: 100px;
+  height: 100px;
+  background-color: green;
+  margin-top: 8px;
+  margin-left: 100px;
+}
+
+
\ No 

[webkit-changes] [292817] trunk

2022-04-13 Thread zalan
Title: [292817] trunk








Revision 292817
Author za...@apple.com
Date 2022-04-13 11:50:18 -0700 (Wed, 13 Apr 2022)


Log Message
REGRESSION (r292043): [ Mac ] fast/block/positioning/fixed-container-with-relative-parent.html is a flaky image failure
https://bugs.webkit.org/show_bug.cgi?id=239101


Reviewed by Antti Koivisto.

Source/WebCore:

1. Out of flow boxes are laid out independently from each other as the last step of their containing block layout.
2. However their static positions are computed during regular in-flow layout (as if their positions were static).

In order to do #1, we maintain a ListHashSet for the out-of-flow boxes and insert them at #2 (and we also have
a corresponding HashMap).

Normally this is a very simple list of descendant positioned boxes and since out-of-flow boxes don't interact with each
other, their position in the list is not important.
  e.g.

  


  


At in-flow layout (#2), we insert B and C to "ListHashSet of A" as we come across them in DOM order and compute their static positions.
Later in the layout flow when we get to the "let's layout the out-of-flow boxes" phase (#1) we simply walk
the ListHashSet and lay out B and C (but "C and B" order would also work just fine).

However the ICB (RenderView) is a special containing block as it can hold different types of out-of-flow boxes (absolute and fixed)
and those out-of-flow boxes may have layout dependencies.
e.g.


ICB's ListHasSet has both A and B, but in this case there's (static)layout dependency between these boxes.
In order to figure out the static position of B, we have to have A laid out first. In order to lay out A before B,
B has to be preceded by A in ICB's ListHasSet.

Now full layout always guarantees the correct order.
However in case of partial layout since we don't run a full #2, the ListHasSet may end up having an unexpected order.
  e.g.
   

 1. The initial (full) layout produces the following (correct) order for the ICB's ListHasSet -> AC.
 2. A subsequent partial layout (e.g. triggered by A's position change) runs an in-flow layout on the  which
 (re-)appends A to the ListHasSet (CA <- incorrect order). Now at this point we assume that the in-flow layout picks up B
 which eventually (re-)appends C to the ListHashSet (AC <- correct order). However since B does not need layout, we just
 stop at  which leaves us with an unexpected ListHashSet.
 3. As part of the ICB's out-of-flow layout, we pick C as the first box to lay out followed by A. However since C's static
 position depends on A's position, we end up using stale geometry when computing C's static position.

This patch fixes this issue by ensuring the absolute positioned boxes always come first in the ICB's ListHasSet (note
that their order is not really important -see above. What's important is that a potential (as-if-static) containing block always
comes before the fixed boxes).

Test: fast/block/fixed-inside-absolute-positioned.html

* rendering/RenderBlock.cpp:
(WebCore::PositionedDescendantsMap::addDescendant):
(WebCore::RenderBlock::insertPositionedObject):

LayoutTests:

* fast/block/fixed-inside-absolute-positioned-expected.html: Added.
* fast/block/fixed-inside-absolute-positioned.html: Added.
* platform/mac-wk1/TestExpectations:

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/platform/mac/TestExpectations
trunk/LayoutTests/platform/mac-wk1/TestExpectations
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/rendering/RenderBlock.cpp


Added Paths

trunk/LayoutTests/fast/block/fixed-inside-absolute-positioned-expected.html
trunk/LayoutTests/fast/block/fixed-inside-absolute-positioned.html




Diff

Modified: trunk/LayoutTests/ChangeLog (292816 => 292817)

--- trunk/LayoutTests/ChangeLog	2022-04-13 18:48:19 UTC (rev 292816)
+++ trunk/LayoutTests/ChangeLog	2022-04-13 18:50:18 UTC (rev 292817)
@@ -1,3 +1,15 @@
+2022-04-13  Alan Bujtas  
+
+REGRESSION (r292043): [ Mac ] fast/block/positioning/fixed-container-with-relative-parent.html is a flaky image failure
+https://bugs.webkit.org/show_bug.cgi?id=239101
+
+
+Reviewed by Antti Koivisto.
+
+* fast/block/fixed-inside-absolute-positioned-expected.html: Added.
+* fast/block/fixed-inside-absolute-positioned.html: Added.
+* platform/mac-wk1/TestExpectations:
+
 2022-04-13  Simon Fraser  
 
 [css-scroll-snap] scrollIntoView fails with scroll-snap-type on :root


Added: trunk/LayoutTests/fast/block/fixed-inside-absolute-positioned-expected.html (0 => 292817)

--- trunk/LayoutTests/fast/block/fixed-inside-absolute-positioned-expected.html	(rev 0)
+++ trunk/LayoutTests/fast/block/fixed-inside-absolute-positioned-expected.html	2022-04-13 18:50:18 UTC (rev 292817)
@@ -0,0 +1,13 @@
+
+body {
+  margin: 0px;
+}
+div {
+  width: 100px;
+  height: 100px;
+  background-color: green;
+  margin-top: 8px;
+  margin-left: 100px;
+}
+
+
\ No newline at end of file



[webkit-changes] [292752] trunk/Source/WebCore

2022-04-11 Thread zalan
Title: [292752] trunk/Source/WebCore








Revision 292752
Author za...@apple.com
Date 2022-04-11 18:30:11 -0700 (Mon, 11 Apr 2022)


Log Message
[IFC][Integration] LayoutIntegration::LineLayout should not expose InlineContent
https://bugs.webkit.org/show_bug.cgi?id=239059

Reviewed by Antti Koivisto.

Implement inkOverflowTop/inkOverflowBottom for inline iterator (LineBox) so that we can
keep InlineContent internal to LayoutIntegration::LineLayout.

* layout/integration/InlineIteratorLineBox.h:
(WebCore::InlineIterator::LineBox::inkOverflowTop const):
(WebCore::InlineIterator::LineBox::inkOverflowBottom const):
* layout/integration/InlineIteratorLineBoxLegacyPath.h:
(WebCore::InlineIterator::LineBoxIteratorLegacyPath::inkOverflowTop const):
(WebCore::InlineIterator::LineBoxIteratorLegacyPath::inkOverflowBottom const):
* layout/integration/InlineIteratorLineBoxModernPath.h:
(WebCore::InlineIterator::LineBoxIteratorModernPath::inkOverflowTop const):
(WebCore::InlineIterator::LineBoxIteratorModernPath::inkOverflowBottom const):
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::hasVisualOverflow const):
* layout/integration/LayoutIntegrationLineLayout.h:
(WebCore::LayoutIntegration::LineLayout::isPaginated const):
(WebCore::LayoutIntegration::LineLayout::inlineContent const): Deleted.
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutModernLines):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/integration/InlineIteratorLineBox.h
trunk/Source/WebCore/layout/integration/InlineIteratorLineBoxLegacyPath.h
trunk/Source/WebCore/layout/integration/InlineIteratorLineBoxModernPath.h
trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp
trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (292751 => 292752)

--- trunk/Source/WebCore/ChangeLog	2022-04-12 01:16:08 UTC (rev 292751)
+++ trunk/Source/WebCore/ChangeLog	2022-04-12 01:30:11 UTC (rev 292752)
@@ -1,3 +1,30 @@
+2022-04-11  Alan Bujtas  
+
+[IFC][Integration] LayoutIntegration::LineLayout should not expose InlineContent
+https://bugs.webkit.org/show_bug.cgi?id=239059
+
+Reviewed by Antti Koivisto.
+
+Implement inkOverflowTop/inkOverflowBottom for inline iterator (LineBox) so that we can
+keep InlineContent internal to LayoutIntegration::LineLayout.
+
+* layout/integration/InlineIteratorLineBox.h:
+(WebCore::InlineIterator::LineBox::inkOverflowTop const):
+(WebCore::InlineIterator::LineBox::inkOverflowBottom const):
+* layout/integration/InlineIteratorLineBoxLegacyPath.h:
+(WebCore::InlineIterator::LineBoxIteratorLegacyPath::inkOverflowTop const):
+(WebCore::InlineIterator::LineBoxIteratorLegacyPath::inkOverflowBottom const):
+* layout/integration/InlineIteratorLineBoxModernPath.h:
+(WebCore::InlineIterator::LineBoxIteratorModernPath::inkOverflowTop const):
+(WebCore::InlineIterator::LineBoxIteratorModernPath::inkOverflowBottom const):
+* layout/integration/LayoutIntegrationLineLayout.cpp:
+(WebCore::LayoutIntegration::LineLayout::hasVisualOverflow const):
+* layout/integration/LayoutIntegrationLineLayout.h:
+(WebCore::LayoutIntegration::LineLayout::isPaginated const):
+(WebCore::LayoutIntegration::LineLayout::inlineContent const): Deleted.
+* rendering/RenderBlockFlow.cpp:
+(WebCore::RenderBlockFlow::layoutModernLines):
+
 2022-04-11  Myles C. Maxfield  
 
 [WebGPU] Hook up device.queue to the IDL


Modified: trunk/Source/WebCore/layout/integration/InlineIteratorLineBox.h (292751 => 292752)

--- trunk/Source/WebCore/layout/integration/InlineIteratorLineBox.h	2022-04-12 01:16:08 UTC (rev 292751)
+++ trunk/Source/WebCore/layout/integration/InlineIteratorLineBox.h	2022-04-12 01:30:11 UTC (rev 292752)
@@ -67,6 +67,9 @@
 float contentLogicalTopAdjustedForPrecedingLineBox() const;
 float contentLogicalBottomAdjustedForFollowingLineBox() const;
 
+float inkOverflowTop() const;
+float inkOverflowBottom() const;
+
 const RenderBlockFlow& containingBlock() const;
 RenderFragmentContainer* containingFragment() const;
 
@@ -180,6 +183,20 @@
 });
 }
 
+inline float LineBox::inkOverflowTop() const
+{
+return WTF::switchOn(m_pathVariant, [](const auto& path) {
+return path.inkOverflowTop();
+});
+}
+
+inline float LineBox::inkOverflowBottom() const
+{
+return WTF::switchOn(m_pathVariant, [](const auto& path) {
+return path.inkOverflowBottom();
+});
+}
+
 inline float LineBox::contentLogicalLeft() const
 {
 return WTF::switchOn(m_pathVariant, [](const auto& path) {


Modified: trunk/Source/WebCore/layout/integration/InlineIteratorLineBoxLegacyPath.h (292751 => 292752)

--- 

[webkit-changes] [292749] trunk

2022-04-11 Thread zalan
Title: [292749] trunk








Revision 292749
Author za...@apple.com
Date 2022-04-11 17:43:49 -0700 (Mon, 11 Apr 2022)


Log Message
[ iOS iPhone 12 ] fast/hidpi & fast/layers/hidpi tests are flaky text/image failing
https://bugs.webkit.org/show_bug.cgi?id=232384


Reviewed by Wenson Hsieh.

Tools:

Rotation (initiated by UiController::simulateRotationLikeSafari) may confuse UIScreen and produce unexpected scale value.
This patch ensures that we set the scale value back to the default (2) in between test runs.
(Currently we only set this value in TestController::platformInitialize/dumpRenderTree.)

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebViewToConsistentState):
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):

LayoutTests:

* platform/ios/TestExpectations:

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/platform/ios/TestExpectations
trunk/Tools/ChangeLog
trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm




Diff

Modified: trunk/LayoutTests/ChangeLog (292748 => 292749)

--- trunk/LayoutTests/ChangeLog	2022-04-12 00:40:29 UTC (rev 292748)
+++ trunk/LayoutTests/ChangeLog	2022-04-12 00:43:49 UTC (rev 292749)
@@ -1,3 +1,13 @@
+2022-04-11  Alan Bujtas  
+
+[ iOS iPhone 12 ] fast/hidpi & fast/layers/hidpi tests are flaky text/image failing
+https://bugs.webkit.org/show_bug.cgi?id=232384
+
+
+Reviewed by Wenson Hsieh.
+
+* platform/ios/TestExpectations:
+
 2022-04-11  Truitt Savell  
 
 REGRESSION (249023-249029@main): [ Monterey ] http/wpt/cache-storage/cache-storage-networkprocess-crash.html is a flaky CRASH with ASSERTION FAILED: m_pageMap.isEmpty()


Modified: trunk/LayoutTests/platform/ios/TestExpectations (292748 => 292749)

--- trunk/LayoutTests/platform/ios/TestExpectations	2022-04-12 00:40:29 UTC (rev 292748)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2022-04-12 00:43:49 UTC (rev 292749)
@@ -3426,11 +3426,6 @@
 model-element/model-element-camera.html [ Skip ]
 model-element/model-element-interactive-dragging.html [ Skip ]
 
-# webkit.org/b/232384 these are flaky failures on iOS
-fast/hidpi/image-srcset-simple-1x.html [ Pass Failure ]
-fast/hidpi/image-srcset-simple-in-variable-1x.html [ Pass Failure ]
-fast/hidpi/pdf-image-scaled.html [ Pass Failure ]
-
 # webkit.org/b/201982 These are flaky failures on iOS
 fast/images/exif-orientation-svg-feimage.html [ Pass Failure ]
 fast/images/exif-orientation-background-image-repeat.html [ Pass Failure ]


Modified: trunk/Tools/ChangeLog (292748 => 292749)

--- trunk/Tools/ChangeLog	2022-04-12 00:40:29 UTC (rev 292748)
+++ trunk/Tools/ChangeLog	2022-04-12 00:43:49 UTC (rev 292749)
@@ -1,3 +1,20 @@
+2022-04-11  Alan Bujtas  
+
+[ iOS iPhone 12 ] fast/hidpi & fast/layers/hidpi tests are flaky text/image failing
+https://bugs.webkit.org/show_bug.cgi?id=232384
+
+
+Reviewed by Wenson Hsieh.
+
+Rotation (initiated by UiController::simulateRotationLikeSafari) may confuse UIScreen and produce unexpected scale value.
+This patch ensures that we set the scale value back to the default (2) in between test runs.
+(Currently we only set this value in TestController::platformInitialize/dumpRenderTree.)
+
+* DumpRenderTree/mac/DumpRenderTree.mm:
+(resetWebViewToConsistentState):
+* WebKitTestRunner/ios/TestControllerIOS.mm:
+(WTR::TestController::platformResetStateToConsistentValues):
+
 2022-04-11  Sam Sneddon  
 
 webkitpy.w3c.test_exporter assumes all exceptions are HTTPError


Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (292748 => 292749)

--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2022-04-12 00:40:29 UTC (rev 292748)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2022-04-12 00:43:49 UTC (rev 292749)
@@ -1732,6 +1732,7 @@
 #if PLATFORM(IOS_FAMILY)
 adjustWebDocumentForStandardViewport(gWebBrowserView.get(), gWebScrollView.get());
 [webView _setAllowsMessaging:YES];
+[[UIScreen mainScreen] _setScale:2.0];
 #endif
 [webView setEditable:NO];
 [(EditingDelegate *)[webView editingDelegate] setAcceptsEditing:YES];


Modified: trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (292748 => 292749)

--- trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm	2022-04-12 00:40:29 UTC (rev 292748)
+++ trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm	2022-04-12 00:43:49 UTC (rev 292749)
@@ -158,6 +158,7 @@
 [pasteboardConsistencyEnforcer() clearPasteboard];
 [[UIApplication sharedApplication] _cancelAllTouches];
 [[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait animated:NO];
+[[UIScreen mainScreen] _setScale:2.0];
 
 // Ensures that only the UCB is on-screen when showing the keyboard, if the hardware keyboard is attached.
 TIPreferencesController *textInputPreferences = [getTIPreferencesControllerClass() 

[webkit-changes] [292691] trunk/Source/WebCore

2022-04-10 Thread zalan
Title: [292691] trunk/Source/WebCore








Revision 292691
Author za...@apple.com
Date 2022-04-10 16:52:37 -0700 (Sun, 10 Apr 2022)


Log Message
[Line clamp] Move line clamp only code from RenderBlockFlow to RenderDeprecatedFlexibleBox
https://bugs.webkit.org/show_bug.cgi?id=239041

Reviewed by Antti Koivisto.

* rendering/RenderBlockFlow.cpp:
(WebCore::shouldIncludeLinesForParentLineCount): Deleted.
(WebCore::RenderBlockFlow::clearTruncation): Deleted.
* rendering/RenderBlockFlow.h:
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::shouldIncludeLinesForParentLineCount):
(WebCore::clearTruncation):
(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
(WebCore::RenderDeprecatedFlexibleBox::clearLineClamp):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
trunk/Source/WebCore/rendering/RenderBlockFlow.h
trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (292690 => 292691)

--- trunk/Source/WebCore/ChangeLog	2022-04-10 22:51:52 UTC (rev 292690)
+++ trunk/Source/WebCore/ChangeLog	2022-04-10 23:52:37 UTC (rev 292691)
@@ -1,3 +1,20 @@
+2022-04-10  Alan Bujtas  
+
+[Line clamp] Move line clamp only code from RenderBlockFlow to RenderDeprecatedFlexibleBox
+https://bugs.webkit.org/show_bug.cgi?id=239041
+
+Reviewed by Antti Koivisto.
+
+* rendering/RenderBlockFlow.cpp:
+(WebCore::shouldIncludeLinesForParentLineCount): Deleted.
+(WebCore::RenderBlockFlow::clearTruncation): Deleted.
+* rendering/RenderBlockFlow.h:
+* rendering/RenderDeprecatedFlexibleBox.cpp:
+(WebCore::shouldIncludeLinesForParentLineCount):
+(WebCore::clearTruncation):
+(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
+(WebCore::RenderDeprecatedFlexibleBox::clearLineClamp):
+
 2022-04-10  Nikolas Zimmermann  
 
 [LBSE] Activate SVG transform support through layers


Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (292690 => 292691)

--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2022-04-10 22:51:52 UTC (rev 292690)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2022-04-10 23:52:37 UTC (rev 292691)
@@ -3224,12 +3224,6 @@
 rareBlockFlowData()->m_multiColumnFlow.clear();
 }
 
-bool shouldIncludeLinesForParentLineCount(const RenderBlockFlow& blockFlow)
-{
-// FIXME: This test does not make much sense.
-return !blockFlow.isFloatingOrOutOfFlowPositioned() && blockFlow.style().height().isAuto();
-}
-
 int RenderBlockFlow::lineCount() const
 {
 if (!childrenInline()) {
@@ -3246,24 +3240,6 @@
 return 0;
 }
 
-void RenderBlockFlow::clearTruncation()
-{
-if (style().visibility() != Visibility::Visible)
-return;
-
-if (childrenInline() && hasMarkupTruncation()) {
-setHasMarkupTruncation(false);
-for (auto* box = firstRootBox(); box; box = box->nextRootBox())
-box->clearTruncation();
-return;
-}
-
-for (auto& blockFlow : childrenOfType(*this)) {
-if (shouldIncludeLinesForParentLineCount(blockFlow))
-blockFlow.clearTruncation();
-}
-}
-
 bool RenderBlockFlow::containsNonZeroBidiLevel() const
 {
 for (auto lineBox = InlineIterator::firstLineBoxFor(*this); lineBox; lineBox.traverseNext()) {


Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (292690 => 292691)

--- trunk/Source/WebCore/rendering/RenderBlockFlow.h	2022-04-10 22:51:52 UTC (rev 292690)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h	2022-04-10 23:52:37 UTC (rev 292691)
@@ -342,7 +342,6 @@
 void setLineLayoutPath(LineLayoutPath path) { setRenderBlockFlowLineLayoutPath(path); }
 
 int lineCount() const;
-void clearTruncation();
 
 void setHasMarkupTruncation(bool b) { setRenderBlockFlowHasMarkupTruncation(b); }
 bool hasMarkupTruncation() const { return renderBlockFlowHasMarkupTruncation(); }
@@ -616,8 +615,6 @@
 return { };
 }
 
-bool shouldIncludeLinesForParentLineCount(const RenderBlockFlow&);
-
 } // namespace WebCore
 
 SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderBlockFlow, isRenderBlockFlow())


Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (292690 => 292691)

--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2022-04-10 22:51:52 UTC (rev 292690)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2022-04-10 23:52:37 UTC (rev 292691)
@@ -937,6 +937,29 @@
 setHeight(oldHeight);
 }
 
+static bool shouldIncludeLinesForParentLineCount(const RenderBlockFlow& blockFlow)
+{
+return !blockFlow.isFloatingOrOutOfFlowPositioned() && blockFlow.style().height().isAuto();
+}
+
+static void clearTruncation(RenderBlockFlow& blockFlow)
+{
+if (blockFlow.style().visibility() != Visibility::Visible)
+return;
+
+if (blockFlow.childrenInline() && blockFlow.hasMarkupTruncation()) {
+blockFlow.setHasMarkupTruncation(false);
+ 

[webkit-changes] [292689] trunk/Source/WebCore

2022-04-10 Thread zalan
Title: [292689] trunk/Source/WebCore








Revision 292689
Author za...@apple.com
Date 2022-04-10 14:56:21 -0700 (Sun, 10 Apr 2022)


Log Message
Line clamp specific line-count code should be in RenderDeprecatedFlexibleBox
https://bugs.webkit.org/show_bug.cgi?id=239029

Reviewed by Antti Koivisto.

Moving the line-clamp specific code to RenderDeprecatedFlexibleBox enables us to
make RenderBlockFlow::lineCount "children inline" only.

* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::lineCountFor):
(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (292688 => 292689)

--- trunk/Source/WebCore/ChangeLog	2022-04-10 16:50:36 UTC (rev 292688)
+++ trunk/Source/WebCore/ChangeLog	2022-04-10 21:56:21 UTC (rev 292689)
@@ -1,3 +1,17 @@
+2022-04-10  Alan Bujtas  
+
+Line clamp specific line-count code should be in RenderDeprecatedFlexibleBox
+https://bugs.webkit.org/show_bug.cgi?id=239029
+
+Reviewed by Antti Koivisto.
+
+Moving the line-clamp specific code to RenderDeprecatedFlexibleBox enables us to
+make RenderBlockFlow::lineCount "children inline" only.
+
+* rendering/RenderDeprecatedFlexibleBox.cpp:
+(WebCore::lineCountFor):
+(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
+
 2022-04-10  Tyler Wilcock  
 
 Fix accessibility/aria-invalid.html in isolated tree mode


Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (292688 => 292689)

--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2022-04-10 16:50:36 UTC (rev 292688)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2022-04-10 21:56:21 UTC (rev 292689)
@@ -3232,29 +3232,18 @@
 
 int RenderBlockFlow::lineCount() const
 {
-// FIXME: This should be tested by clients.
-if (style().visibility() != Visibility::Visible)
+if (!childrenInline()) {
+ASSERT_NOT_REACHED();
 return 0;
-
-if (childrenInline()) {
+}
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-if (modernLineLayout())
-return modernLineLayout()->lineCount();
+if (modernLineLayout())
+return modernLineLayout()->lineCount();
 #endif
-if (legacyLineLayout())
-return legacyLineLayout()->lineCount();
+if (legacyLineLayout())
+return legacyLineLayout()->lineCount();
 
-return 0;
-}
-
-int count = 0;
-for (auto& blockFlow : childrenOfType(*this)) {
-if (!shouldIncludeLinesForParentLineCount(blockFlow))
-continue;
-count += blockFlow.lineCount();
-}
-
-return count;
+return 0;
 }
 
 void RenderBlockFlow::clearTruncation()
@@ -3550,15 +3539,7 @@
 
 bool RenderBlockFlow::hasLines() const
 {
-if (!childrenInline())
-return false;
-
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-if (modernLineLayout())
-return modernLineLayout()->lineCount();
-#endif
-
-return legacyLineLayout() && legacyLineLayout()->lineBoxes().firstLineBox();
+return childrenInline() ? lineCount() : false;
 }
 
 void RenderBlockFlow::invalidateLineLayoutPath()
@@ -3812,6 +3793,8 @@
 lineCountInBlock = this->lineCount();
 else {
 for (auto& listItem : childrenOfType(*this)) {
+if (!listItem.childrenInline() || listItem.style().visibility() != Visibility::Visible)
+continue;
 lineCountInBlock += listItem.lineCount();
 if (lineCountInBlock > 1)
 break;


Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (292688 => 292689)

--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2022-04-10 16:50:36 UTC (rev 292688)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2022-04-10 21:56:21 UTC (rev 292689)
@@ -995,6 +995,23 @@
 return getHeightForLineCount(flow, lineCount, true, count);
 }
 
+static size_t lineCountFor(const RenderBlockFlow& blockFlow)
+{
+if (blockFlow.style().visibility() != Visibility::Visible)
+return 0;
+
+if (blockFlow.childrenInline())
+return blockFlow.lineCount();
+
+size_t count = 0;
+for (auto& child : childrenOfType(blockFlow)) {
+if (blockFlow.isFloatingOrOutOfFlowPositioned() || !blockFlow.style().height().isAuto())
+continue;
+count += lineCountFor(child);
+}
+return count;
+}
+
 void RenderDeprecatedFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutChildren)
 {
 int maxLineCount = 0;
@@ -1015,7 +1032,7 @@
 }
 child->layoutIfNeeded();
 if (child->style().height().isAuto() && is(*child))
-maxLineCount = std::max(maxLineCount, downcast(*child).lineCount());
+maxLineCount = std::max(maxLineCount, 

[webkit-changes] [292685] trunk/Source/WebCore

2022-04-09 Thread zalan
Title: [292685] trunk/Source/WebCore








Revision 292685
Author za...@apple.com
Date 2022-04-09 19:59:35 -0700 (Sat, 09 Apr 2022)


Log Message
[Text autosizing] Remove redundant lineCountForTextAutosizing member function
https://bugs.webkit.org/show_bug.cgi?id=239034

Reviewed by Antti Koivisto.

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::adjustComputedFontSizes): stop walking the list item children when we see multiple lines.
(WebCore::RenderBlockFlow::lineCountForTextAutosizing): Deleted.
* rendering/RenderBlockFlow.h:

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
trunk/Source/WebCore/rendering/RenderBlockFlow.h




Diff

Modified: trunk/Source/WebCore/ChangeLog (292684 => 292685)

--- trunk/Source/WebCore/ChangeLog	2022-04-10 02:14:13 UTC (rev 292684)
+++ trunk/Source/WebCore/ChangeLog	2022-04-10 02:59:35 UTC (rev 292685)
@@ -1,3 +1,15 @@
+2022-04-09  Alan Bujtas  
+
+[Text autosizing] Remove redundant lineCountForTextAutosizing member function
+https://bugs.webkit.org/show_bug.cgi?id=239034
+
+Reviewed by Antti Koivisto.
+
+* rendering/RenderBlockFlow.cpp:
+(WebCore::RenderBlockFlow::adjustComputedFontSizes): stop walking the list item children when we see multiple lines.
+(WebCore::RenderBlockFlow::lineCountForTextAutosizing): Deleted.
+* rendering/RenderBlockFlow.h:
+
 2022-04-09  Khem Raj  
 
 Include locale.h for LC_MESSAGES definition.


Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (292684 => 292685)

--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2022-04-10 02:14:13 UTC (rev 292684)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2022-04-10 02:59:35 UTC (rev 292685)
@@ -3771,19 +3771,6 @@
 return true;
 }
 
-int RenderBlockFlow::lineCountForTextAutosizing()
-{
-if (style().visibility() != Visibility::Visible)
-return 0;
-if (childrenInline())
-return lineCount();
-// Only descend into list items.
-int count = 0;
-for (auto& listItem : childrenOfType(*this))
-count += listItem.lineCount();
-return count;
-}
-
 static bool isNonBlocksOrNonFixedHeightListItems(const RenderObject& renderer)
 {
 if (!renderer.isRenderBlock())
@@ -3815,18 +3802,25 @@
 if (visibleWidth >= width())
 return;
 
-unsigned lineCount;
-if (m_lineCountForTextAutosizing == NOT_SET) {
-int count = lineCountForTextAutosizing();
-if (!count)
+unsigned lineCount = m_lineCountForTextAutosizing;
+if (lineCount == NOT_SET) {
+if (style().visibility() != Visibility::Visible)
 lineCount = NO_LINE;
-else if (count == 1)
-lineCount = ONE_LINE;
-else
-lineCount = MULTI_LINE;
-} else
-lineCount = m_lineCountForTextAutosizing;
-
+else {
+size_t lineCountInBlock = 0;
+if (childrenInline())
+lineCountInBlock = this->lineCount();
+else {
+for (auto& listItem : childrenOfType(*this)) {
+lineCountInBlock += listItem.lineCount();
+if (lineCountInBlock > 1)
+break;
+}
+}
+lineCount = !lineCountInBlock ? NO_LINE : lineCountInBlock == 1 ? ONE_LINE : MULTI_LINE;
+}
+}
+
 ASSERT(lineCount != NOT_SET);
 if (lineCount == NO_LINE)
 return;


Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (292684 => 292685)

--- trunk/Source/WebCore/rendering/RenderBlockFlow.h	2022-04-10 02:14:13 UTC (rev 292684)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h	2022-04-10 02:59:35 UTC (rev 292685)
@@ -546,7 +546,6 @@
 void materializeRareBlockFlowData();
 
 #if ENABLE(TEXT_AUTOSIZING)
-int lineCountForTextAutosizing();
 void adjustComputedFontSizes(float size, float visibleWidth);
 void resetComputedFontSize()
 {






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [292679] trunk

2022-04-09 Thread zalan
Title: [292679] trunk








Revision 292679
Author za...@apple.com
Date 2022-04-09 10:55:18 -0700 (Sat, 09 Apr 2022)


Log Message
REGRESSION (Safari 15.4): Focused element doesn't render outline when it has an underline
https://bugs.webkit.org/show_bug.cgi?id=238998


Reviewed by Antti Koivisto.

Source/WebCore:

While outline is supposed to be part of the ink overflow(1), WebKit historically has been
treating it as a special "non ink overflow" type of overflow.

This patch is in preparation for transitioning the outline to regular ink overflow.

First we start treating outline as part of ink overflow within IFC and
handle it as special repaint content only at the block (RenderBlockFlow) level.

Test: fast/repaint/incorrect-outline-repaint.html

(1) https://www.w3.org/TR/css-overflow-3/#ink

* layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::computeInkOverflowForInlineLevelBox):
(WebCore::Layout::InlineDisplayContentBuilder::appendAtomicInlineLevelDisplayBox):
(WebCore::Layout::InlineDisplayContentBuilder::appendInlineBoxDisplayBox):
(WebCore::Layout::InlineDisplayContentBuilder::appendSpanningInlineBoxDisplayBox):
(WebCore::Layout::InlineDisplayContentBuilder::adjustVisualGeometryForDisplayBox):
(WebCore::Layout::computeBoxShadowInkOverflow): Deleted.
* layout/integration/LayoutIntegrationInlineContent.cpp:
(WebCore::LayoutIntegration::InlineContent::hasContent const):
* layout/integration/LayoutIntegrationInlineContent.h:
(WebCore::LayoutIntegration::InlineContent::hasVisualOverflow const):
(WebCore::LayoutIntegration::InlineContent::setHasVisualOverflow):
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutModernLines): This may cause overly inflated repaintTop/Bottom when
the ink overflow is not outline based (text stroke only atm) but we will anyway trigger
similar repaint rect on that part later when we process ink overflow.

LayoutTests:

* fast/repaint/incorrect-outline-repaint-expected.txt: Added.
* fast/repaint/incorrect-outline-repaint.html: Added.
* fast/text/simple-line-layout-text-stroke-width.html: now we produce a slightly different (more accurate)
vertical repaint range. However this test is about moving the content horizontally, so let's make this
test more robust by focusing on the horizontal part.

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/fast/text/simple-line-layout-text-stroke-width-expected.txt
trunk/LayoutTests/fast/text/simple-line-layout-text-stroke-width.html
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp
trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.cpp
trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.h
trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp


Added Paths

trunk/LayoutTests/fast/repaint/incorrect-outline-repaint-expected.txt
trunk/LayoutTests/fast/repaint/incorrect-outline-repaint.html




Diff

Modified: trunk/LayoutTests/ChangeLog (292678 => 292679)

--- trunk/LayoutTests/ChangeLog	2022-04-09 08:35:06 UTC (rev 292678)
+++ trunk/LayoutTests/ChangeLog	2022-04-09 17:55:18 UTC (rev 292679)
@@ -1,3 +1,17 @@
+2022-04-09  Alan Bujtas  
+
+REGRESSION (Safari 15.4): Focused element doesn't render outline when it has an underline
+https://bugs.webkit.org/show_bug.cgi?id=238998
+
+
+Reviewed by Antti Koivisto.
+
+* fast/repaint/incorrect-outline-repaint-expected.txt: Added.
+* fast/repaint/incorrect-outline-repaint.html: Added.
+* fast/text/simple-line-layout-text-stroke-width.html: now we produce a slightly different (more accurate)
+vertical repaint range. However this test is about moving the content horizontally, so let's make this
+test more robust by focusing on the horizontal part. 
+
 2022-04-08  Matteo Flores  
 
 REBASLINE: [ Monterey wk2 ] 4 http/tests/inspector/paymentrequest/* tests are constant text failures


Added: trunk/LayoutTests/fast/repaint/incorrect-outline-repaint-expected.txt (0 => 292679)

--- trunk/LayoutTests/fast/repaint/incorrect-outline-repaint-expected.txt	(rev 0)
+++ trunk/LayoutTests/fast/repaint/incorrect-outline-repaint-expected.txt	2022-04-09 17:55:18 UTC (rev 292679)
@@ -0,0 +1,2 @@
+outline
+PASS


Added: trunk/LayoutTests/fast/repaint/incorrect-outline-repaint.html (0 => 292679)

--- trunk/LayoutTests/fast/repaint/incorrect-outline-repaint.html	(rev 0)
+++ trunk/LayoutTests/fast/repaint/incorrect-outline-repaint.html	2022-04-09 17:55:18 UTC (rev 292679)
@@ -0,0 +1,27 @@
+
+span {
+  font-size: 10px;
+  font-family: Ahem;
+}
+
+
+outline
+
+
+if (window.testRunner) {
+  

[webkit-changes] [292608] trunk/LayoutTests

2022-04-08 Thread zalan
Title: [292608] trunk/LayoutTests








Revision 292608
Author za...@apple.com
Date 2022-04-08 08:16:59 -0700 (Fri, 08 Apr 2022)


Log Message
imported/blink/fast/multicol/vertical-lr/float-content-break.html is a constant failure
https://bugs.webkit.org/show_bug.cgi?id=239002

Unreviewed.


* platform/mac/TestExpectations:

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/platform/mac/TestExpectations




Diff

Modified: trunk/LayoutTests/ChangeLog (292607 => 292608)

--- trunk/LayoutTests/ChangeLog	2022-04-08 15:10:51 UTC (rev 292607)
+++ trunk/LayoutTests/ChangeLog	2022-04-08 15:16:59 UTC (rev 292608)
@@ -1,5 +1,14 @@
 2022-04-08  Alan Bujtas  
 
+imported/blink/fast/multicol/vertical-lr/float-content-break.html is a constant failure
+https://bugs.webkit.org/show_bug.cgi?id=239002
+
+Unreviewed.
+
+* platform/mac/TestExpectations:
+
+2022-04-08  Alan Bujtas  
+
 Do not use std::numeric_limits::min() as the initial value to collect max values for glyph overflow
 https://bugs.webkit.org/show_bug.cgi?id=238334
 


Modified: trunk/LayoutTests/platform/mac/TestExpectations (292607 => 292608)

--- trunk/LayoutTests/platform/mac/TestExpectations	2022-04-08 15:10:51 UTC (rev 292607)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2022-04-08 15:16:59 UTC (rev 292608)
@@ -2287,3 +2287,6 @@
 
 # macOS has a WebGPU implementation.
 http/tests/webgpu [ Pass ]
+
+# fractional pixel diff between modern and legacy line layout.
+imported/blink/fast/multicol/vertical-lr/float-content-break.html [ ImageOnlyFailure ]






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [292606] trunk

2022-04-08 Thread zalan
Title: [292606] trunk








Revision 292606
Author za...@apple.com
Date 2022-04-08 08:00:44 -0700 (Fri, 08 Apr 2022)


Log Message
Do not use std::numeric_limits::min() as the initial value to collect max values for glyph overflow
https://bugs.webkit.org/show_bug.cgi?id=238334

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* web-platform-tests/mathml/presentation-markup/operators/operator-dictionary-stretchy-001-expected.txt:
* web-platform-tests/mathml/presentation-markup/operators/operator-dictionary-stretchy-002-expected.txt:

Source/WebCore:

With zero height glpyhs, glyph (vertical)overflow may still back as 1px due to ceilf(std::max(0.f, std::numeric_limits::min())).
(see WidthIterator::advanceInternal() -> m_maxGlyphBoundingBoxY = std::max(m_maxGlyphBoundingBoxY, bounds.maxY())
and FontCascade::floatWidthForSimpleText() -> std::max(glyphOverflow->bottom, ceilf(it.maxGlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0 : metricsOfPrimaryFont().descent(

* platform/graphics/ComplexTextController.h:
* platform/graphics/WidthIterator.h:

LayoutTests:

* platform/ios/fast/block/lineboxcontain/glyphs-expected.txt:
* platform/ios/fast/css-generated-content/initial-letter-basic-expected.txt:
* platform/ios/fast/css-generated-content/initial-letter-border-padding-expected.txt:
* platform/ios/fast/css-generated-content/initial-letter-raised-expected.txt:
* platform/ios/fast/css-generated-content/initial-letter-sunken-expected.txt:
* platform/ios/mathml/opentype/opentype-stretchy-expected.txt:
* platform/ios/mathml/presentation/roots-expected.txt:
* platform/mac/fast/block/lineboxcontain/glyphs-expected.txt:
* platform/mac/fast/css-generated-content/initial-letter-basic-expected.txt:
* platform/mac/fast/css-generated-content/initial-letter-border-padding-expected.txt:
* platform/mac/fast/css-generated-content/initial-letter-raised-expected.txt:
* platform/mac/fast/css-generated-content/initial-letter-sunken-expected.txt:
* platform/mac/mathml/opentype/opentype-stretchy-expected.txt:
* platform/mac/mathml/presentation/roots-expected.txt:

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/imported/w3c/ChangeLog
trunk/LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/operators/operator-dictionary-stretchy-001-expected.txt
trunk/LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/operators/operator-dictionary-stretchy-002-expected.txt
trunk/LayoutTests/mathml/presentation/bug95015-expected.html
trunk/LayoutTests/mathml/presentation/bug95015.html
trunk/LayoutTests/platform/ios/fast/block/lineboxcontain/glyphs-expected.txt
trunk/LayoutTests/platform/ios/fast/css-generated-content/initial-letter-basic-expected.txt
trunk/LayoutTests/platform/ios/fast/css-generated-content/initial-letter-border-padding-expected.txt
trunk/LayoutTests/platform/ios/fast/css-generated-content/initial-letter-raised-expected.txt
trunk/LayoutTests/platform/ios/fast/css-generated-content/initial-letter-sunken-expected.txt
trunk/LayoutTests/platform/ios/mathml/opentype/opentype-stretchy-expected.txt
trunk/LayoutTests/platform/ios/mathml/presentation/roots-expected.txt
trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/mathml/presentation-markup/operators/mo-stretch-properties-dynamic-001-expected.txt
trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/mathml/presentation-markup/operators/operator-dictionary-stretchy-001-expected.txt
trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/mathml/presentation-markup/operators/operator-dictionary-stretchy-002-expected.txt
trunk/LayoutTests/platform/mac/fast/block/lineboxcontain/glyphs-expected.txt
trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-basic-expected.txt
trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-border-padding-expected.txt
trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-raised-expected.txt
trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-sunken-expected.txt
trunk/LayoutTests/platform/mac/mathml/opentype/opentype-stretchy-expected.txt
trunk/LayoutTests/platform/mac/mathml/presentation/roots-expected.txt
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/platform/graphics/ComplexTextController.h
trunk/Source/WebCore/platform/graphics/WidthIterator.h




Diff

Modified: trunk/LayoutTests/ChangeLog (292605 => 292606)

--- trunk/LayoutTests/ChangeLog	2022-04-08 14:52:17 UTC (rev 292605)
+++ trunk/LayoutTests/ChangeLog	2022-04-08 15:00:44 UTC (rev 292606)
@@ -1,5 +1,27 @@
 2022-04-08  Alan Bujtas  
 
+Do not use std::numeric_limits::min() as the initial value to collect max values for glyph overflow
+https://bugs.webkit.org/show_bug.cgi?id=238334
+
+Reviewed by Simon Fraser.
+
+* platform/ios/fast/block/lineboxcontain/glyphs-expected.txt:
+* platform/ios/fast/css-generated-content/initial-letter-basic-expected.txt:
+* 

[webkit-changes] [292604] trunk/LayoutTests

2022-04-08 Thread zalan
Title: [292604] trunk/LayoutTests








Revision 292604
Author za...@apple.com
Date 2022-04-08 07:32:34 -0700 (Fri, 08 Apr 2022)


Log Message
[ iOS EWS ] fast/layers/parent-clipping-overflow-is-overwritten-by-child-clipping.html is a flaky image failure.
https://bugs.webkit.org/show_bug.cgi?id=237218


Unreviewed.


* fast/layers/parent-clipping-overflow-is-overwritten-by-child-clipping-expected.html:
* fast/layers/parent-clipping-overflow-is-overwritten-by-child-clipping.html: Change font family to Ahem.

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/fast/layers/parent-clipping-overflow-is-overwritten-by-child-clipping-expected.html
trunk/LayoutTests/fast/layers/parent-clipping-overflow-is-overwritten-by-child-clipping.html




Diff

Modified: trunk/LayoutTests/ChangeLog (292603 => 292604)

--- trunk/LayoutTests/ChangeLog	2022-04-08 14:22:19 UTC (rev 292603)
+++ trunk/LayoutTests/ChangeLog	2022-04-08 14:32:34 UTC (rev 292604)
@@ -1,3 +1,14 @@
+2022-04-08  Alan Bujtas  
+
+[ iOS EWS ] fast/layers/parent-clipping-overflow-is-overwritten-by-child-clipping.html is a flaky image failure.
+https://bugs.webkit.org/show_bug.cgi?id=237218
+
+
+Unreviewed.
+
+* fast/layers/parent-clipping-overflow-is-overwritten-by-child-clipping-expected.html:
+* fast/layers/parent-clipping-overflow-is-overwritten-by-child-clipping.html: Change font family to Ahem.
+
 2022-04-08  Andres Gonzalez  
 
 Fix for accessibility/table-sections.html in isolated tree mode.


Modified: trunk/LayoutTests/fast/layers/parent-clipping-overflow-is-overwritten-by-child-clipping-expected.html (292603 => 292604)

--- trunk/LayoutTests/fast/layers/parent-clipping-overflow-is-overwritten-by-child-clipping-expected.html	2022-04-08 14:22:19 UTC (rev 292603)
+++ trunk/LayoutTests/fast/layers/parent-clipping-overflow-is-overwritten-by-child-clipping-expected.html	2022-04-08 14:32:34 UTC (rev 292604)
@@ -4,8 +4,9 @@
 This tests that parent clipping is applied properly when border-radius is present.
 
   div {
+font-family: Ahem;
 overflow: hidden;
-border: 1px solid blue;
+border: 1px solid transparent;
 border-radius: 50px;
 height: 50px;
   }