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

Unified Diff: Source/core/rendering/RenderBox.cpp

Issue 23444082: css rendering bug : fixed-position-element and 'left' (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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
« no previous file with comments | « LayoutTests/platform/linux/fast/css/css-properties-position-relative-as-parent-fixed-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBox.cpp
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp
index f8701312bfd61f38a443479ad7901352007b805a..a7c43665778a45f7fbb1e35fa5dbf0fa0c34c493 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -3084,6 +3084,8 @@ static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRigh
for (RenderObject* curr = child->parent(); curr && curr != containerBlock; curr = curr->container()) {
if (curr->isBox()) {
staticPosition += toRenderBox(curr)->logicalLeft();
+ if (toRenderBox(curr)->isRelPositioned())
+ staticPosition += toRenderBox(curr)->relativePositionOffset().width();
if (region && curr->isRenderBlock()) {
const RenderBlock* cb = toRenderBlock(curr);
region = cb->clampToStartAndEndRegions(region);
@@ -3091,16 +3093,26 @@ static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRigh
if (boxInfo)
staticPosition += boxInfo->logicalLeft();
}
+ } else if (curr->isInline()) {
+ if (curr->isRelPositioned()) {
+ if (!curr->style()->logicalLeft().isAuto())
+ staticPosition += curr->style()->logicalLeft().value();
+ else
+ staticPosition -= curr->style()->logicalRight().value();
+ }
}
}
logicalLeft.setValue(Fixed, staticPosition);
} else {
RenderBox* enclosingBox = child->parent()->enclosingBox();
LayoutUnit staticPosition = child->layer()->staticInlinePosition() + containerLogicalWidth + containerBlock->borderLogicalLeft();
- for (RenderObject* curr = enclosingBox; curr; curr = curr->container()) {
+ for (RenderObject* curr = child->parent(); curr; curr = curr->container()) {
if (curr->isBox()) {
- if (curr != containerBlock)
+ if (curr != containerBlock) {
staticPosition -= toRenderBox(curr)->logicalLeft();
+ if (toRenderBox(curr)->isRelPositioned())
+ staticPosition -= toRenderBox(curr)->relativePositionOffset().width();
+ }
if (curr == enclosingBox)
staticPosition -= enclosingBox->logicalWidth();
if (region && curr->isRenderBlock()) {
@@ -3114,6 +3126,13 @@ static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRigh
staticPosition += enclosingBox->logicalWidth() - boxInfo->logicalWidth();
}
}
+ } else if (curr->isInline()) {
+ if (curr->isRelPositioned()) {
+ if (!curr->style()->logicalLeft().isAuto())
+ staticPosition -= curr->style()->logicalLeft().value();
+ else
+ staticPosition += curr->style()->logicalRight().value();
+ }
}
if (curr == containerBlock)
break;
« no previous file with comments | « LayoutTests/platform/linux/fast/css/css-properties-position-relative-as-parent-fixed-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698