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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2392503003: Fix LayoutBox::topLeftLocation for table rows and table cells (Closed)
Patch Set: Add LayoutBoxTest.LocationContainer Created 4 years, 2 months 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/LayoutBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index b59cf4626abb3a6e4380f5724f7e55c2d0214412..5813e4adae31820718f030f783e9f548ee62a8bb 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -2282,11 +2282,10 @@ bool LayoutBox::mapToVisualRectInAncestorSpace(
LayoutObject* container =
this->container(ancestor, &ancestorSkipped, &filterSkipped);
LayoutBox* tableRowContainer = nullptr;
- // Skip table row because cells and rows are in the same coordinate space
- // (see below, however for more comments about when |ancestor| is the table row).
- // The second and third conditionals below are to skip cases where content has display: table-row or display: table-cell but is not
- // parented like a cell/row combo.
- if (container->isTableRow() && isTableCell() && parentBox() == container) {
+ // Skip table row because cells and rows are in the same coordinate space (see
+ // below, however for more comments about when |ancestor| is the table row).
+ if (isTableCell()) {
+ DCHECK(container->isTableRow() && parentBox() == container);
if (container != ancestor)
container = container->parent();
else
@@ -5047,11 +5046,24 @@ LayoutPoint LayoutBox::flipForWritingModeForChild(
point.y());
}
+LayoutBox* LayoutBox::locationContainer() const {
+ // Normally the box's location is relative to its containing box.
+ LayoutObject* container = this->container();
+ while (container && !container->isBox())
+ container = container->container();
+ return toLayoutBox(container);
+}
+
LayoutPoint LayoutBox::topLeftLocation(
const LayoutBox* flippedBlocksContainer) const {
- const LayoutBox* containerBox =
- flippedBlocksContainer ? flippedBlocksContainer : containingBlock();
- if (!containerBox || containerBox == this)
+ const LayoutBox* containerBox;
+ if (flippedBlocksContainer) {
+ DCHECK(flippedBlocksContainer == locationContainer());
+ containerBox = flippedBlocksContainer;
+ } else {
+ containerBox = locationContainer();
+ }
+ if (!containerBox)
return location();
return containerBox->flipForWritingModeForChild(this, location());
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | third_party/WebKit/Source/core/layout/LayoutBoxTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698