Diff
Modified: trunk/Source/WebCore/ChangeLog (255142 => 255143)
--- trunk/Source/WebCore/ChangeLog 2020-01-27 14:14:09 UTC (rev 255142)
+++ trunk/Source/WebCore/ChangeLog 2020-01-27 15:25:34 UTC (rev 255143)
@@ -1,3 +1,63 @@
+2020-01-27 Zalan Bujtas <[email protected]>
+
+ [LFC][IFC] Display::Run has physical geometry only.
+ https://bugs.webkit.org/show_bug.cgi?id=206810
+ <rdar://problem/58905455>
+
+ Reviewed by Antti Koivisto.
+
+ Since in LFC the Display::Runs are used for painting and hittesting but never for layout,
+ the geometry is always physical.
+
+ * layout/Verification.cpp:
+ (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
+ (WebCore::Layout::checkForMatchingNonTextRuns):
+ (WebCore::Layout::checkForMatchingTextRuns):
+ (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
+ * layout/displaytree/DisplayPainter.cpp:
+ (WebCore::Display::paintInlineContent):
+ * layout/displaytree/DisplayRun.h:
+ (WebCore::Display::Run::rect const):
+ (WebCore::Display::Run::topLeft const):
+ (WebCore::Display::Run::left const):
+ (WebCore::Display::Run::right const):
+ (WebCore::Display::Run::top const):
+ (WebCore::Display::Run::bottom const):
+ (WebCore::Display::Run::width const):
+ (WebCore::Display::Run::height const):
+ (WebCore::Display::Run::setWidth):
+ (WebCore::Display::Run::setTop):
+ (WebCore::Display::Run::setlLeft):
+ (WebCore::Display::Run::moveVertically):
+ (WebCore::Display::Run::moveHorizontally):
+ (WebCore::Display::Run::expandVertically):
+ (WebCore::Display::Run::expandHorizontally):
+ (WebCore::Display::Run::Run):
+ (WebCore::Display::Run::logicalRect const): Deleted.
+ (WebCore::Display::Run::logicalTopLeft const): Deleted.
+ (WebCore::Display::Run::logicalLeft const): Deleted.
+ (WebCore::Display::Run::logicalRight const): Deleted.
+ (WebCore::Display::Run::logicalTop const): Deleted.
+ (WebCore::Display::Run::logicalBottom const): Deleted.
+ (WebCore::Display::Run::logicalWidth const): Deleted.
+ (WebCore::Display::Run::logicalHeight const): Deleted.
+ (WebCore::Display::Run::setLogicalWidth): Deleted.
+ (WebCore::Display::Run::setLogicalTop): Deleted.
+ (WebCore::Display::Run::setLogicalLeft): Deleted.
+ * layout/integration/LayoutIntegrationLineLayout.cpp:
+ (WebCore::LayoutIntegration::LineLayout::paint):
+ (WebCore::LayoutIntegration::LineLayout::hitTest):
+ * layout/layouttree/LayoutTreeBuilder.cpp:
+ (WebCore::Layout::outputInlineRuns):
+ * rendering/RenderTreeAsText.cpp:
+ (WebCore::writeTextBox):
+ * rendering/line/LineLayoutTraversal.h:
+ (WebCore::LineLayoutTraversal::Box::logicalRect const): Deleted.
+ * rendering/line/LineLayoutTraversalDisplayRunPath.h:
+ (WebCore::LineLayoutTraversal::linePosition):
+ (WebCore::LineLayoutTraversal::DisplayRunPath::rect const):
+ (WebCore::LineLayoutTraversal::DisplayRunPath::logicalRect const): Deleted.
+
2020-01-26 Antoine Quint <[email protected]>
[Web Animations] Update all DocumentTimeline objects when updating animations
Modified: trunk/Source/WebCore/layout/Verification.cpp (255142 => 255143)
--- trunk/Source/WebCore/layout/Verification.cpp 2020-01-27 14:14:09 UTC (rev 255142)
+++ trunk/Source/WebCore/layout/Verification.cpp 2020-01-27 15:25:34 UTC (rev 255143)
@@ -95,7 +95,7 @@
auto& simpleRun = lineLayoutData->runAt(i);
auto& displayRun = displayRuns[i];
- auto matchingRuns = areEssentiallyEqual(simpleRun.logicalLeft, displayRun.logicalLeft()) && areEssentiallyEqual(simpleRun.logicalRight, displayRun.logicalRight());
+ auto matchingRuns = areEssentiallyEqual(simpleRun.logicalLeft, displayRun.left()) && areEssentiallyEqual(simpleRun.logicalRight, displayRun.right());
if (matchingRuns && displayRun.textContext()) {
matchingRuns = simpleRun.start == displayRun.textContext()->start() && simpleRun.end == displayRun.textContext()->end();
// SLL handles strings in a more concatenated format <div>foo<br>bar</div> -> foo -> 0,3 bar -> 3,6 vs. 0,3 and 0,3
@@ -109,7 +109,7 @@
stream << " inline run";
if (displayRun.textContext())
stream << " (" << displayRun.textContext()->start() << ", " << displayRun.textContext()->end() << ")";
- stream << " (" << displayRun.logicalLeft() << ", " << displayRun.logicalTop() << ") (" << displayRun.logicalWidth() << "x" << displayRun.logicalHeight() << ")";
+ stream << " (" << displayRun.left() << ", " << displayRun.top() << ") (" << displayRun.width() << "x" << displayRun.height() << ")";
stream.nextLine();
mismatched = true;
}
@@ -118,19 +118,19 @@
static bool checkForMatchingNonTextRuns(const Display::Run& inlineRun, const WebCore::InlineBox& inlineBox)
{
- return areEssentiallyEqual(inlineBox.logicalLeft(), inlineRun.logicalLeft())
- && areEssentiallyEqual(inlineBox.logicalRight(), inlineRun.logicalRight())
- && areEssentiallyEqual(inlineBox.logicalTop(), inlineRun.logicalTop())
- && areEssentiallyEqual(inlineBox.logicalBottom(), inlineRun.logicalBottom());
+ return areEssentiallyEqual(inlineBox.left(), inlineRun.left())
+ && areEssentiallyEqual(inlineBox.right(), inlineRun.right())
+ && areEssentiallyEqual(inlineBox.top(), inlineRun.top())
+ && areEssentiallyEqual(inlineBox.bottom(), inlineRun.bottom());
}
static bool checkForMatchingTextRuns(const Display::Run& inlineRun, const InlineTextBox& inlineTextBox)
{
- return areEssentiallyEqual(inlineTextBox.logicalLeft(), inlineRun.logicalLeft())
- && areEssentiallyEqual(inlineTextBox.logicalRight(), inlineRun.logicalRight())
- && areEssentiallyEqual(inlineTextBox.logicalTop(), inlineRun.logicalTop())
- && areEssentiallyEqual(inlineTextBox.logicalBottom(), inlineRun.logicalBottom())
+ return areEssentiallyEqual(inlineTextBox.left(), inlineRun.left())
+ && areEssentiallyEqual(inlineTextBox.right(), inlineRun.right())
+ && areEssentiallyEqual(inlineTextBox.top(), inlineRun.top())
+ && areEssentiallyEqual(inlineTextBox.bottom(), inlineRun.bottom())
&& (inlineTextBox.isLineBreak() || (inlineTextBox.start() == inlineRun.textContext()->start() && inlineTextBox.end() == inlineRun.textContext()->end()));
}
@@ -206,7 +206,7 @@
stream << " inline run";
if (displayRun.textContext())
stream << " (" << displayRun.textContext()->start() << ", " << displayRun.textContext()->end() << ")";
- stream << " (" << displayRun.logicalLeft() << ", " << displayRun.logicalTop() << ") (" << displayRun.logicalWidth() << "x" << displayRun.logicalHeight() << ")";
+ stream << " (" << displayRun.left() << ", " << displayRun.top() << ") (" << displayRun.width() << "x" << displayRun.height() << ")";
stream.nextLine();
mismatched = true;
}
Modified: trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp (255142 => 255143)
--- trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp 2020-01-27 14:14:09 UTC (rev 255142)
+++ trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp 2020-01-27 15:25:34 UTC (rev 255143)
@@ -126,18 +126,18 @@
context.setStrokeColor(style.color());
context.setFillColor(style.color());
- auto absoluteLogicalLeft = absoluteOffset.x() + run.logicalLeft();
+ auto absoluteLeft = absoluteOffset.x() + run.left();
// FIXME: Add non-baseline align painting
auto& lineBox = displayInlineContent->lineBoxForRun(run);
auto baselineOffset = absoluteOffset.y() + lineBox.logicalTop() + lineBox.baselineOffset();
auto expansionContext = textContext->expansion();
- auto textRun = TextRun { textContext->content(), run.logicalLeft() - lineBox.logicalLeft(),
+ auto textRun = TextRun { textContext->content(), run.left() - lineBox.logicalLeft(),
expansionContext ? expansionContext->horizontalExpansion : 0,
expansionContext ? expansionContext->behavior : DefaultExpansion };
textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
- context.drawText(style.fontCascade(), textRun, { absoluteLogicalLeft, baselineOffset });
+ context.drawText(style.fontCascade(), textRun, { absoluteLeft, baselineOffset });
} else if (auto* cachedImage = run.image()) {
- auto runAbsoluteRect = FloatRect { absoluteOffset.x() + run.logicalLeft(), absoluteOffset.y() + run.logicalTop(), run.logicalWidth(), run.logicalHeight() };
+ auto runAbsoluteRect = FloatRect { absoluteOffset.x() + run.left(), absoluteOffset.y() + run.top(), run.width(), run.height() };
context.drawImage(*cachedImage->image(), runAbsoluteRect);
}
}
Modified: trunk/Source/WebCore/layout/displaytree/DisplayRun.h (255142 => 255143)
--- trunk/Source/WebCore/layout/displaytree/DisplayRun.h 2020-01-27 14:14:09 UTC (rev 255142)
+++ trunk/Source/WebCore/layout/displaytree/DisplayRun.h 2020-01-27 15:25:34 UTC (rev 255143)
@@ -71,29 +71,29 @@
Optional<ExpansionContext> m_expansionContext;
};
- Run(size_t lineIndex, const Layout::Box&, const InlineRect& logicalRect, const InlineRect& inkOverflow, Optional<TextContext> = WTF::nullopt);
+ Run(size_t lineIndex, const Layout::Box&, const InlineRect&, const InlineRect& inkOverflow, Optional<TextContext> = WTF::nullopt);
size_t lineIndex() const { return m_lineIndex; }
- const InlineRect& logicalRect() const { return m_logicalRect; }
+ const InlineRect& rect() const { return m_rect; }
const InlineRect& inkOverflow() const { return m_inkOverflow; }
- InlineLayoutPoint logicalTopLeft() const { return m_logicalRect.topLeft(); }
- InlineLayoutUnit logicalLeft() const { return m_logicalRect.left(); }
- InlineLayoutUnit logicalRight() const { return m_logicalRect.right(); }
- InlineLayoutUnit logicalTop() const { return m_logicalRect.top(); }
- InlineLayoutUnit logicalBottom() const { return m_logicalRect.bottom(); }
+ InlineLayoutPoint topLeft() const { return m_rect.topLeft(); }
+ InlineLayoutUnit left() const { return m_rect.left(); }
+ InlineLayoutUnit right() const { return m_rect.right(); }
+ InlineLayoutUnit top() const { return m_rect.top(); }
+ InlineLayoutUnit bottom() const { return m_rect.bottom(); }
- InlineLayoutUnit logicalWidth() const { return m_logicalRect.width(); }
- InlineLayoutUnit logicalHeight() const { return m_logicalRect.height(); }
+ InlineLayoutUnit width() const { return m_rect.width(); }
+ InlineLayoutUnit height() const { return m_rect.height(); }
- void setLogicalWidth(InlineLayoutUnit width) { m_logicalRect.setWidth(width); }
- void setLogicalTop(InlineLayoutUnit logicalTop) { m_logicalRect.setTop(logicalTop); }
- void setLogicalLeft(InlineLayoutUnit logicalLeft) { m_logicalRect.setLeft(logicalLeft); }
- void moveVertically(InlineLayoutUnit delta) { m_logicalRect.moveVertically(delta); }
- void moveHorizontally(InlineLayoutUnit delta) { m_logicalRect.moveHorizontally(delta); }
- void expandVertically(InlineLayoutUnit delta) { m_logicalRect.expandVertically(delta); }
- void expandHorizontally(InlineLayoutUnit delta) { m_logicalRect.expandHorizontally(delta); }
+ void setWidth(InlineLayoutUnit width) { m_rect.setWidth(width); }
+ void setTop(InlineLayoutUnit top) { m_rect.setTop(top); }
+ void setlLeft(InlineLayoutUnit left) { m_rect.setLeft(left); }
+ void moveVertically(InlineLayoutUnit delta) { m_rect.moveVertically(delta); }
+ void moveHorizontally(InlineLayoutUnit delta) { m_rect.moveHorizontally(delta); }
+ void expandVertically(InlineLayoutUnit delta) { m_rect.expandVertically(delta); }
+ void expandHorizontally(InlineLayoutUnit delta) { m_rect.expandHorizontally(delta); }
void setTextContext(const TextContext&& textContext) { m_textContext.emplace(textContext); }
const Optional<TextContext>& textContext() const { return m_textContext; }
@@ -112,15 +112,15 @@
const size_t m_lineIndex;
WeakPtr<const Layout::Box> m_layoutBox;
CachedImage* m_cachedImage { nullptr };
- InlineRect m_logicalRect;
+ InlineRect m_rect;
InlineRect m_inkOverflow;
Optional<TextContext> m_textContext;
};
-inline Run::Run(size_t lineIndex, const Layout::Box& layoutBox, const InlineRect& logicalRect, const InlineRect& inkOverflow, Optional<TextContext> textContext)
+inline Run::Run(size_t lineIndex, const Layout::Box& layoutBox, const InlineRect& rect, const InlineRect& inkOverflow, Optional<TextContext> textContext)
: m_lineIndex(lineIndex)
, m_layoutBox(makeWeakPtr(layoutBox))
- , m_logicalRect(logicalRect)
+ , m_rect(rect)
, m_inkOverflow(inkOverflow)
, m_textContext(textContext)
{
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (255142 => 255143)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2020-01-27 14:14:09 UTC (rev 255142)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2020-01-27 15:25:34 UTC (rev 255143)
@@ -246,7 +246,7 @@
if (style.visibility() != Visibility::Visible)
continue;
- auto rect = FloatRect { run.logicalRect() };
+ auto rect = FloatRect { run.rect() };
auto visualOverflowRect = FloatRect { run.inkOverflow() };
if (paintRect.y() > visualOverflowRect.maxY() || paintRect.maxY() < visualOverflowRect.y())
continue;
@@ -266,7 +266,7 @@
String textWithHyphen;
if (textContext.needsHyphen())
textWithHyphen = makeString(textContext.content(), style.hyphenString());
- TextRun textRun { !textWithHyphen.isEmpty() ? textWithHyphen : textContext.content(), run.logicalLeft() - lineBox.logicalLeft(), horizontalExpansion, behavior };
+ TextRun textRun { !textWithHyphen.isEmpty() ? textWithHyphen : textContext.content(), run.left() - lineBox.logicalLeft(), horizontalExpansion, behavior };
textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
FloatPoint textOrigin { rect.x() + paintOffset.x(), roundToDevicePixel(baselineOffset, deviceScaleFactor) };
@@ -302,7 +302,7 @@
// FIXME: This should do something efficient to find the run range.
for (auto& run : inlineContent.runs) {
- auto runRect = Layout::toLayoutRect(run.logicalRect());
+ auto runRect = Layout::toLayoutRect(run.rect());
runRect.moveBy(accumulatedOffset);
if (!locationInContainer.intersects(runRect))
Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (255142 => 255143)
--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2020-01-27 14:14:09 UTC (rev 255142)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2020-01-27 15:25:34 UTC (rev 255143)
@@ -342,7 +342,7 @@
stream << "inline text box";
else
stream << "inline box";
- stream << " at (" << displayRun.logicalLeft() << "," << displayRun.logicalTop() << ") size " << displayRun.logicalWidth() << "x" << displayRun.logicalHeight();
+ stream << " at (" << displayRun.left() << "," << displayRun.top() << ") size " << displayRun.width() << "x" << displayRun.height();
if (displayRun.textContext())
stream << " run(" << displayRun.textContext()->start() << ", " << displayRun.textContext()->end() << ")";
stream.nextLine();
Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (255142 => 255143)
--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2020-01-27 14:14:09 UTC (rev 255142)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2020-01-27 15:25:34 UTC (rev 255143)
@@ -480,14 +480,10 @@
static void writeTextBox(TextStream& ts, const RenderText& o, const LineLayoutTraversal::TextBox& textBox)
{
auto rect = textBox.rect();
- auto logicalRect = textBox.logicalRect();
-
int x = rect.x();
int y = rect.y();
-
- // FIXME: Mixing logical and physical here doesn't make sense.
- int logicalWidth = ceilf(rect.x() + logicalRect.width()) - x;
-
+ // FIXME: Use non-logical width. webkit.org/b/206809.
+ int logicalWidth = ceilf(rect.x() + (textBox.isHorizontal() ? rect.width() : rect.height())) - x;
// FIXME: Table cell adjustment is temporary until results can be updated.
if (is<RenderTableCell>(*o.containingBlock()))
y -= floorToInt(downcast<RenderTableCell>(*o.containingBlock()).intrinsicPaddingBefore());
Modified: trunk/Source/WebCore/rendering/line/LineLayoutTraversal.h (255142 => 255143)
--- trunk/Source/WebCore/rendering/line/LineLayoutTraversal.h 2020-01-27 14:14:09 UTC (rev 255142)
+++ trunk/Source/WebCore/rendering/line/LineLayoutTraversal.h 2020-01-27 15:25:34 UTC (rev 255143)
@@ -59,7 +59,6 @@
Box(PathVariant&&);
FloatRect rect() const;
- FloatRect logicalRect() const;
float baselineOffset() const;
@@ -167,13 +166,6 @@
});
}
-inline FloatRect Box::logicalRect() const
-{
- return WTF::switchOn(m_pathVariant, [](auto& path) {
- return path.logicalRect();
- });
-}
-
inline float Box::baselineOffset() const
{
return WTF::switchOn(m_pathVariant, [](auto& path) {
Modified: trunk/Source/WebCore/rendering/line/LineLayoutTraversalComplexPath.h (255142 => 255143)
--- trunk/Source/WebCore/rendering/line/LineLayoutTraversalComplexPath.h 2020-01-27 14:14:09 UTC (rev 255142)
+++ trunk/Source/WebCore/rendering/line/LineLayoutTraversalComplexPath.h 2020-01-27 15:25:34 UTC (rev 255143)
@@ -41,7 +41,6 @@
{ }
FloatRect rect() const { return m_inlineBox->frameRect(); }
- FloatRect logicalRect() const { return m_inlineBox->logicalFrameRect(); }
bool isLeftToRightDirection() const { return m_inlineBox->isLeftToRightDirection(); }
bool isHorizontal() const { return m_inlineBox->isHorizontal(); }
Modified: trunk/Source/WebCore/rendering/line/LineLayoutTraversalDisplayRunPath.h (255142 => 255143)
--- trunk/Source/WebCore/rendering/line/LineLayoutTraversalDisplayRunPath.h 2020-01-27 14:14:09 UTC (rev 255142)
+++ trunk/Source/WebCore/rendering/line/LineLayoutTraversalDisplayRunPath.h 2020-01-27 15:25:34 UTC (rev 255143)
@@ -33,9 +33,9 @@
namespace LineLayoutTraversal {
-static FloatPoint linePosition(float logicalLeft, float logicalTop)
+static FloatPoint linePosition(float left, float top)
{
- return FloatPoint(logicalLeft, roundf(logicalTop));
+ return FloatPoint(left, roundf(top));
}
class DisplayRunPath {
@@ -50,13 +50,7 @@
DisplayRunPath& operator=(const DisplayRunPath&) = default;
DisplayRunPath& operator=(DisplayRunPath&&) = default;
- FloatRect rect() const { return logicalRect(); }
- FloatRect logicalRect() const
- {
- auto logicalRect = run().logicalRect();
- FloatPoint position = linePosition(logicalRect.left(), logicalRect.top());
- return { position, logicalRect.size() };
- }
+ FloatRect rect() const;
float baselineOffset() const { return lineBox().baselineOffset(); }
@@ -111,7 +105,14 @@
size_t m_runIndex { 0 };
};
+inline FloatRect DisplayRunPath::rect() const
+{
+ auto rect = run().rect();
+ auto position = linePosition(rect.left(), rect.top());
+ return { position, rect.size() };
}
+
}
+}
#endif
Modified: trunk/Source/WebCore/rendering/line/LineLayoutTraversalSimplePath.h (255142 => 255143)
--- trunk/Source/WebCore/rendering/line/LineLayoutTraversalSimplePath.h 2020-01-27 14:14:09 UTC (rev 255142)
+++ trunk/Source/WebCore/rendering/line/LineLayoutTraversalSimplePath.h 2020-01-27 15:25:34 UTC (rev 255143)
@@ -39,7 +39,6 @@
{ }
FloatRect rect() const { return (*m_iterator).rect(); }
- FloatRect logicalRect() const { return rect(); }
float baselineOffset() const { return (*m_iterator).baselineOffset(); }