Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1121)

Unified Diff: third_party/WebKit/Source/core/layout/line/InlineBox.h

Issue 2536453002: Rename some functions about layout locations (Closed)
Patch Set: Rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/line/InlineBox.h
diff --git a/third_party/WebKit/Source/core/layout/line/InlineBox.h b/third_party/WebKit/Source/core/layout/line/InlineBox.h
index 5d9c61c8b38afe9cd0b57a326d33b487077b3c26..c09f6501128e2086b309888b55f026d234add36c 100644
--- a/third_party/WebKit/Source/core/layout/line/InlineBox.h
+++ b/third_party/WebKit/Source/core/layout/line/InlineBox.h
@@ -73,7 +73,7 @@ class CORE_EXPORT InlineBox : public DisplayItemClient {
m_prev(prev),
m_parent(parent),
m_lineLayoutItem(item),
- m_topLeft(topLeft),
+ m_location(topLeft),
m_logicalWidth(logicalWidth)
#if ENABLE(ASSERT)
,
@@ -223,18 +223,22 @@ class CORE_EXPORT InlineBox : public DisplayItemClient {
const RootInlineBox& root() const;
RootInlineBox& root();
- // x() is the left side of the box in the containing block's coordinate
- // system.
- void setX(LayoutUnit x) { m_topLeft.setX(x); }
- LayoutUnit x() const { return m_topLeft.x(); }
- LayoutUnit left() const { return m_topLeft.x(); }
+ // x() is the location of the box in the containing block's "physical
+ // coordinates with flipped block-flow direction".
+ // See../README.md#Coordinate-Spaces for the definition.
+ void setX(LayoutUnit x) { m_location.setX(x); }
+ LayoutUnit x() const { return m_location.x(); }
- // y() is the top side of the box in the containing block's coordinate system.
- void setY(LayoutUnit y) { m_topLeft.setY(y); }
- LayoutUnit y() const { return m_topLeft.y(); }
- LayoutUnit top() const { return m_topLeft.y(); }
+ // y() is the top side of the box in the containing block's physical
+ // coordinates. It's actually in the same coordinate space as x() but for y()
+ // physical coordinates and "physical coordinates with flipped block-flow
+ // direction" are the same.
+ void setY(LayoutUnit y) { m_location.setY(y); }
+ LayoutUnit y() const { return m_location.y(); }
- const LayoutPoint& topLeft() const { return m_topLeft; }
+ // x() and y() in one LayoutPoint, in the containing block's "physical
+ // coordinates with flipped block-flow direction".
+ const LayoutPoint& location() const { return m_location; }
LayoutUnit width() const {
return isHorizontal() ? logicalWidth() : logicalHeight();
@@ -243,13 +247,11 @@ class CORE_EXPORT InlineBox : public DisplayItemClient {
return isHorizontal() ? logicalHeight() : logicalWidth();
}
LayoutSize size() const { return LayoutSize(width(), height()); }
- LayoutUnit right() const { return left() + width(); }
- LayoutUnit bottom() const { return top() + height(); }
// The logicalLeft position is the left edge of the line box in a horizontal
// line and the top edge in a vertical line.
LayoutUnit logicalLeft() const {
- return isHorizontal() ? m_topLeft.x() : m_topLeft.y();
+ return isHorizontal() ? m_location.x() : m_location.y();
}
LayoutUnit logicalRight() const { return logicalLeft() + logicalWidth(); }
void setLogicalLeft(LayoutUnit left) {
@@ -266,7 +268,7 @@ class CORE_EXPORT InlineBox : public DisplayItemClient {
// The logicalTop[ position is the top edge of the line box in a horizontal
// line and the left edge in a vertical line.
LayoutUnit logicalTop() const {
- return isHorizontal() ? m_topLeft.y() : m_topLeft.x();
+ return isHorizontal() ? m_location.y() : m_location.x();
}
LayoutUnit logicalBottom() const { return logicalTop() + logicalHeight(); }
void setLogicalTop(LayoutUnit top) {
@@ -286,9 +288,9 @@ class CORE_EXPORT InlineBox : public DisplayItemClient {
LayoutUnit logicalHeight() const;
LayoutRect logicalFrameRect() const {
- return isHorizontal() ? LayoutRect(m_topLeft.x(), m_topLeft.y(),
+ return isHorizontal() ? LayoutRect(m_location.x(), m_location.y(),
m_logicalWidth, logicalHeight())
- : LayoutRect(m_topLeft.y(), m_topLeft.x(),
+ : LayoutRect(m_location.y(), m_location.x(),
m_logicalWidth, logicalHeight());
}
@@ -360,7 +362,9 @@ class CORE_EXPORT InlineBox : public DisplayItemClient {
return LineLayoutBoxModel(nullptr);
}
- LayoutPoint locationIncludingFlipping() const;
+ // Physical location of the top-left corner of the box in the containing
+ // block.
+ LayoutPoint physicalLocation() const;
// Converts from a rect in the logical space of the InlineBox to one in the
// physical space of the containing block. The logical space of an InlineBox
@@ -495,12 +499,6 @@ class CORE_EXPORT InlineBox : public DisplayItemClient {
#undef ADD_BOOLEAN_BITFIELD
private:
- // Converts the given (top-left) position from the logical space of the
- // InlineBox to the physical space of the containing block. The size indicates
- // the size of the box whose point is being flipped.
- LayoutPoint logicalPositionToPhysicalPoint(const LayoutPoint&,
- const LayoutSize&) const;
-
void setLineLayoutItemShouldDoFullPaintInvalidationIfNeeded();
InlineBoxBitfields m_bitfields;
@@ -547,7 +545,7 @@ class CORE_EXPORT InlineBox : public DisplayItemClient {
// For InlineFlowBox and InlineTextBox
bool extracted() const { return m_bitfields.extracted(); }
- LayoutPoint m_topLeft;
+ LayoutPoint m_location;
LayoutUnit m_logicalWidth;
private:
« no previous file with comments | « third_party/WebKit/Source/core/layout/line/EllipsisBox.cpp ('k') | third_party/WebKit/Source/core/layout/line/InlineBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698