Title: [271091] trunk/Source/WebCore
- Revision
- 271091
- Author
- [email protected]
- Date
- 2020-12-26 11:42:26 -0800 (Sat, 26 Dec 2020)
Log Message
[LFC] Rect::expandToContain should call LayoutRect::uniteEvenIfEmpty
https://bugs.webkit.org/show_bug.cgi?id=220153
Reviewed by Antti Koivisto.
Multiline inline boxes should expand even when they start at the end of the line and are empty.
e.g.
<pre>this is the first line<span>
and this is the second</span></pre>
The <span>'s height = first line height (even though the <span> is empty on this line) + second line height.
* layout/layouttree/LayoutGeometryRect.h:
(WebCore::Layout::Rect::expandToContain):
* platform/graphics/LayoutRect.cpp:
(WebCore::LayoutRect::unite):
(WebCore::LayoutRect::uniteEvenIfEmpty): copy from FloatRect.
* platform/graphics/LayoutRect.h:
(WebCore::LayoutRect::setLocationAndSizeFromEdges): copy from FloatRect.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (271090 => 271091)
--- trunk/Source/WebCore/ChangeLog 2020-12-26 18:28:39 UTC (rev 271090)
+++ trunk/Source/WebCore/ChangeLog 2020-12-26 19:42:26 UTC (rev 271091)
@@ -1,3 +1,24 @@
+2020-12-26 Zalan Bujtas <[email protected]>
+
+ [LFC] Rect::expandToContain should call LayoutRect::uniteEvenIfEmpty
+ https://bugs.webkit.org/show_bug.cgi?id=220153
+
+ Reviewed by Antti Koivisto.
+
+ Multiline inline boxes should expand even when they start at the end of the line and are empty.
+ e.g.
+ <pre>this is the first line<span>
+ and this is the second</span></pre>
+ The <span>'s height = first line height (even though the <span> is empty on this line) + second line height.
+
+ * layout/layouttree/LayoutGeometryRect.h:
+ (WebCore::Layout::Rect::expandToContain):
+ * platform/graphics/LayoutRect.cpp:
+ (WebCore::LayoutRect::unite):
+ (WebCore::LayoutRect::uniteEvenIfEmpty): copy from FloatRect.
+ * platform/graphics/LayoutRect.h:
+ (WebCore::LayoutRect::setLocationAndSizeFromEdges): copy from FloatRect.
+
2020-12-26 Simon Fraser <[email protected]>
Fix scrolling issues when scrolling on only one axis is enabled
Modified: trunk/Source/WebCore/layout/layouttree/LayoutGeometryRect.h (271090 => 271091)
--- trunk/Source/WebCore/layout/layouttree/LayoutGeometryRect.h 2020-12-26 18:28:39 UTC (rev 271090)
+++ trunk/Source/WebCore/layout/layouttree/LayoutGeometryRect.h 2020-12-26 19:42:26 UTC (rev 271091)
@@ -297,7 +297,7 @@
{
ASSERT(m_hasValidWidth);
ASSERT(m_hasValidHeight);
- m_rect.unite(rect);
+ m_rect.uniteEvenIfEmpty(rect);
}
inline Rect Rect::clone() const
Modified: trunk/Source/WebCore/platform/graphics/LayoutRect.cpp (271090 => 271091)
--- trunk/Source/WebCore/platform/graphics/LayoutRect.cpp 2020-12-26 18:28:39 UTC (rev 271090)
+++ trunk/Source/WebCore/platform/graphics/LayoutRect.cpp 2020-12-26 19:42:26 UTC (rev 271091)
@@ -100,11 +100,17 @@
return;
}
- LayoutPoint newLocation(std::min(x(), other.x()), std::min(y(), other.y()));
- LayoutPoint newMaxPoint(std::max(maxX(), other.maxX()), std::max(maxY(), other.maxY()));
+ uniteEvenIfEmpty(other);
+}
- m_location = newLocation;
- m_size = newMaxPoint - newLocation;
+void LayoutRect::uniteEvenIfEmpty(const LayoutRect& other)
+{
+ auto minX = std::min(x(), other.x());
+ auto minY = std::min(y(), other.y());
+ auto maxX = std::max(this->maxX(), other.maxX());
+ auto maxY = std::max(this->maxY(), other.maxY());
+
+ setLocationAndSizeFromEdges(minX, minY, maxX, maxY);
}
bool LayoutRect::checkedUnite(const LayoutRect& other)
Modified: trunk/Source/WebCore/platform/graphics/LayoutRect.h (271090 => 271091)
--- trunk/Source/WebCore/platform/graphics/LayoutRect.h 2020-12-26 18:28:39 UTC (rev 271090)
+++ trunk/Source/WebCore/platform/graphics/LayoutRect.h 2020-12-26 19:42:26 UTC (rev 271091)
@@ -190,6 +190,7 @@
void intersect(const LayoutRect&);
bool edgeInclusiveIntersect(const LayoutRect&);
WEBCORE_EXPORT void unite(const LayoutRect&);
+ void uniteEvenIfEmpty(const LayoutRect&);
void uniteIfNonZero(const LayoutRect&);
bool checkedUnite(const LayoutRect&);
@@ -223,6 +224,8 @@
operator FloatRect() const { return FloatRect(m_location, m_size); }
private:
+ void setLocationAndSizeFromEdges(LayoutUnit left, LayoutUnit top, LayoutUnit right, LayoutUnit bottom);
+
LayoutPoint m_location;
LayoutSize m_size;
};
@@ -258,6 +261,13 @@
return *this == LayoutRect::infiniteRect();
}
+inline void LayoutRect::setLocationAndSizeFromEdges(LayoutUnit left, LayoutUnit top, LayoutUnit right, LayoutUnit bottom)
+{
+ m_location = { left, top };
+ m_size.setWidth(right - left);
+ m_size.setHeight(bottom - top);
+}
+
// Integral snapping functions.
inline IntRect snappedIntRect(const LayoutRect& rect)
{
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes