Modified: trunk/Source/WebCore/ChangeLog (253333 => 253334)
--- trunk/Source/WebCore/ChangeLog 2019-12-10 19:23:43 UTC (rev 253333)
+++ trunk/Source/WebCore/ChangeLog 2019-12-10 19:38:42 UTC (rev 253334)
@@ -1,3 +1,21 @@
+2019-12-10 Zalan Bujtas <[email protected]>
+
+ [LFC][IFC][Painting] TextRuns always have 0 left offset
+ https://bugs.webkit.org/show_bug.cgi?id=205071
+ <rdar://problem/57801254>
+
+ Reviewed by Antti Koivisto.
+
+ As the comment indicates TextRun start with the left offset of 0.
+ This patch also removes some FloatRect -> LayoutRect conversions (to match SLL's painting coordinates).
+
+ * layout/displaytree/DisplayInlineContent.cpp:
+ (WebCore::Display:: const):
+ * layout/integration/LayoutIntegrationLineLayout.cpp:
+ (WebCore::LayoutIntegration::computeVisualOverflow):
+ (WebCore::LayoutIntegration::LineLayout::collectOverflow):
+ (WebCore::LayoutIntegration::LineLayout::paint):
+
2019-12-10 Antti Koivisto <[email protected]>
Remove behavior that makes <br> boxes 0-height in quirks mode
Modified: trunk/Source/WebCore/layout/displaytree/DisplayInlineContent.cpp (253333 => 253334)
--- trunk/Source/WebCore/layout/displaytree/DisplayInlineContent.cpp 2019-12-10 19:23:43 UTC (rev 253333)
+++ trunk/Source/WebCore/layout/displaytree/DisplayInlineContent.cpp 2019-12-10 19:38:42 UTC (rev 253334)
@@ -36,7 +36,7 @@
// FIXME: Do something efficient.
const Run* first = nullptr;
for (auto& run : runs) {
- auto runRect = Layout::toLayoutRect(run.logicalRect());
+ auto runRect = FloatRect { run.logicalRect() };
if (runRect.intersects(rect)) {
first = &run;
break;
@@ -47,7 +47,7 @@
const Run* last = nullptr;
for (auto& run : WTF::makeReversedRange(runs)) {
- auto runRect = Layout::toLayoutRect(run.logicalRect());
+ auto runRect = FloatRect { run.logicalRect() };
if (runRect.intersects(rect)) {
last = &run;
break;
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (253333 => 253334)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2019-12-10 19:23:43 UTC (rev 253333)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2019-12-10 19:38:42 UTC (rev 253334)
@@ -136,7 +136,7 @@
}
// FIXME: LFC should handle overflow computations.
-static LayoutRect computeVisualOverflow(const RenderStyle& style, const LayoutRect& boxRect, IntSize& viewportSize)
+static FloatRect computeVisualOverflow(const RenderStyle& style, const FloatRect& boxRect, IntSize& viewportSize)
{
auto overflowRect = boxRect;
auto strokeOverflow = std::ceil(style.computedStrokeWidth(viewportSize));
@@ -159,7 +159,7 @@
for (auto& lineBox : displayInlineContent()->lineBoxes) {
auto lineRect = Layout::toLayoutRect(lineBox.logicalRect());
- auto visualOverflowRect = computeVisualOverflow(flow.style(), lineRect, viewportSize);
+ auto visualOverflowRect = LayoutRect { computeVisualOverflow(flow.style(), lineRect, viewportSize) };
flow.addLayoutOverflow(lineRect);
flow.addVisualOverflow(visualOverflowRect);
}
@@ -245,7 +245,7 @@
if (style.visibility() != Visibility::Visible)
continue;
- auto rect = Layout::toLayoutRect(run.logicalRect());
+ auto rect = FloatRect { run.logicalRect() };
auto visualOverflowRect = computeVisualOverflow(style, rect, viewportSize);
if (paintRect.y() > visualOverflowRect.maxY() || paintRect.maxY() < visualOverflowRect.y())
continue;
@@ -261,12 +261,12 @@
auto behavior = textContext.expansion() ? textContext.expansion()->behavior : DefaultExpansion;
auto horizontalExpansion = textContext.expansion() ? Layout::toLayoutUnit(textContext.expansion()->horizontalExpansion) : 0_lu;
- auto logicalLeft = paintOffset.x() + run.logicalLeft();
String textWithHyphen;
if (textContext.needsHyphen())
textWithHyphen = makeString(textContext.content(), style.hyphenString());
- TextRun textRun { !textWithHyphen.isEmpty() ? textWithHyphen : textContext.content(), logicalLeft, horizontalExpansion, behavior };
+ // x position indicates the line offset from the rootbox. It's always 0 in case of integrated line layout setup.
+ TextRun textRun { !textWithHyphen.isEmpty() ? textWithHyphen : textContext.content(), 0, horizontalExpansion, behavior };
textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
FloatPoint textOrigin { rect.x() + paintOffset.x(), roundToDevicePixel(baselineOffset, deviceScaleFactor) };