Skip to content

Commit

Permalink
Revert of getComputedStyle should handle over-constrained properties.…
Browse files Browse the repository at this point in the history
… (patchset #7 id:100001 of https://codereview.chromium.org/1988813002/ )

Reason for revert:
Other vendors didn't implement this yet. And work with the others to either get all to fix or to change the spec.

BUG=614198

Original issue's description:
> getComputedStyle should handle over-constrained properties.
>
> If neither 'left' nor 'right' is 'auto', the position is over-constrained,
> and one of them has to be ignored. If 'direction' property of the
> containing block is 'ltr', the value of 'left' wins and 'right'
> becomes -'left'. If 'direction' of the containing block is 'rtl',
> 'right' wins and 'left' is ignored. Detail is described by
> https://www.w3.org/TR/2011/REC-CSS2-20110607/visuren.html#relative-positioning
>
> BUG=601118
>
> Committed: https://crrev.com/c8291dea8bfa84ab9a3220fb9f57eb059e913a05
> Cr-Commit-Position: refs/heads/master@{#394780}

TBR=mstensho@opera.com,alancutter@chromium.org,rune@opera.com,eae@chromium.org,timloh@chromium.org
BUG=601118

Review-Url: https://codereview.chromium.org/2016913003
Cr-Commit-Position: refs/heads/master@{#396470}
(cherry picked from commit 9835ebf)

Review URL: https://codereview.chromium.org/2025523002 .

Cr-Commit-Position: refs/branch-heads/2743@{#116}
Cr-Branched-From: 2b3ae3b-refs/heads/master@{#394939}
  • Loading branch information
Rune Lillesveen committed May 28, 2016
1 parent aa008be commit 608b46d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 148 deletions.
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
PASS window.getComputedStyle(fixedElement).top is '100px'
PASS window.getComputedStyle(fixedElement).right is '-100px'
PASS window.getComputedStyle(fixedElement).bottom is '-100px'
PASS window.getComputedStyle(fixedElement).right is '100px'
PASS window.getComputedStyle(fixedElement).bottom is '100px'
PASS window.getComputedStyle(fixedElement).left is '100px'
PASS window.getComputedStyle(percentageElement).top is '50px'
PASS window.getComputedStyle(percentageElement).right is '100px'
PASS window.getComputedStyle(percentageElement).bottom is '50px'
PASS window.getComputedStyle(percentageElement).left is '100px'
PASS window.getComputedStyle(viewportElement).top is '60px'
PASS window.getComputedStyle(viewportElement).right is '-80px'
PASS window.getComputedStyle(viewportElement).bottom is '-60px'
PASS window.getComputedStyle(viewportElement).right is '80px'
PASS window.getComputedStyle(viewportElement).bottom is '60px'
PASS window.getComputedStyle(viewportElement).left is '80px'
PASS window.getComputedStyle(fixedElement).top is '100px'
PASS window.getComputedStyle(fixedElement).right is '-100px'
PASS window.getComputedStyle(fixedElement).bottom is '-100px'
PASS window.getComputedStyle(fixedElement).right is '100px'
PASS window.getComputedStyle(fixedElement).bottom is '100px'
PASS window.getComputedStyle(fixedElement).left is '100px'
PASS window.getComputedStyle(percentageElement).top is '50px'
PASS window.getComputedStyle(percentageElement).right is '100px'
PASS window.getComputedStyle(percentageElement).bottom is '50px'
PASS window.getComputedStyle(percentageElement).left is '100px'
PASS window.getComputedStyle(viewportElement).top is '60px'
PASS window.getComputedStyle(viewportElement).right is '-80px'
PASS window.getComputedStyle(viewportElement).bottom is '-60px'
PASS window.getComputedStyle(viewportElement).right is '80px'
PASS window.getComputedStyle(viewportElement).bottom is '60px'
PASS window.getComputedStyle(viewportElement).left is '80px'
PASS window.getComputedStyle(fixedElement).top is '100px'
PASS window.getComputedStyle(fixedElement).right is '-100px'
PASS window.getComputedStyle(fixedElement).bottom is '-100px'
PASS window.getComputedStyle(fixedElement).right is '100px'
PASS window.getComputedStyle(fixedElement).bottom is '100px'
PASS window.getComputedStyle(fixedElement).left is '100px'
PASS window.getComputedStyle(percentageElement).top is '50px'
PASS window.getComputedStyle(percentageElement).right is '100px'
PASS window.getComputedStyle(percentageElement).bottom is '50px'
PASS window.getComputedStyle(percentageElement).left is '100px'
PASS window.getComputedStyle(viewportElement).top is '60px'
PASS window.getComputedStyle(viewportElement).right is '-80px'
PASS window.getComputedStyle(viewportElement).bottom is '-60px'
PASS window.getComputedStyle(viewportElement).right is '80px'
PASS window.getComputedStyle(viewportElement).bottom is '60px'
PASS window.getComputedStyle(viewportElement).left is '80px'
PASS successfullyParsed is true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,10 @@
document.body.style.zoom = zoomLevel;
var windowWidth = "'" + (window.innerWidth / 10) + "px'";
var windowHeight = "'" + (window.innerHeight / 10) + "px'";
var windowMinusWidth = "'-" + (window.innerWidth / 10) + "px'";
var windowMinusHeight = "'-" + (window.innerHeight / 10) + "px'";

shouldBe("window.getComputedStyle(fixedElement).top", "'100px'");
shouldBe("window.getComputedStyle(fixedElement).right", "'-100px'");
shouldBe("window.getComputedStyle(fixedElement).bottom", "'-100px'");
shouldBe("window.getComputedStyle(fixedElement).right", "'100px'");
shouldBe("window.getComputedStyle(fixedElement).bottom", "'100px'");
shouldBe("window.getComputedStyle(fixedElement).left", "'100px'");

shouldBe("window.getComputedStyle(percentageElement).top", "'50px'");
Expand All @@ -67,8 +65,8 @@
shouldBe("window.getComputedStyle(percentageElement).left", "'100px'");

shouldBe("window.getComputedStyle(viewportElement).top", windowHeight);
shouldBe("window.getComputedStyle(viewportElement).right", windowMinusWidth);
shouldBe("window.getComputedStyle(viewportElement).bottom", windowMinusHeight);
shouldBe("window.getComputedStyle(viewportElement).right", windowWidth);
shouldBe("window.getComputedStyle(viewportElement).bottom", windowHeight);
shouldBe("window.getComputedStyle(viewportElement).left", windowWidth);
}
test(0.5);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,6 @@ static CSSValue* valueForPositionOffset(const ComputedStyle& style, CSSPropertyI
if (offset.isAuto())
return cssValuePool().createIdentifierValue(CSSValueAuto);

if (layoutObject) {
if (!opposite.isAuto() && layoutObject->isInFlowPositioned()) {
LayoutBlock* container = layoutObject->containingBlock();
bool ltr = container->style()->isLeftToRightDirection();
if ((propertyID == CSSPropertyLeft && !ltr) || (propertyID == CSSPropertyRight && ltr) || (propertyID == CSSPropertyBottom))
return zoomAdjustedPixelValue(-opposite.pixels(), style);
}
}
return zoomAdjustedPixelValueForLength(offset, style);
}

Expand Down

0 comments on commit 608b46d

Please sign in to comment.