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

Side by Side Diff: Source/core/rendering/RenderBox.cpp

Issue 720003002: Fixed positioned element with relative percentage positioned parent is wrongly placed (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 2681 matching lines...) Expand 10 before | Expand all | Expand 10 after
2692 if (child->parent()->style()->direction() == LTR) { 2692 if (child->parent()->style()->direction() == LTR) {
2693 LayoutUnit staticPosition = child->layer()->staticInlinePosition() - con tainerBlock->borderLogicalLeft(); 2693 LayoutUnit staticPosition = child->layer()->staticInlinePosition() - con tainerBlock->borderLogicalLeft();
2694 for (RenderObject* curr = child->parent(); curr && curr != containerBloc k; curr = curr->container()) { 2694 for (RenderObject* curr = child->parent(); curr && curr != containerBloc k; curr = curr->container()) {
2695 if (curr->isBox()) { 2695 if (curr->isBox()) {
2696 staticPosition += toRenderBox(curr)->logicalLeft(); 2696 staticPosition += toRenderBox(curr)->logicalLeft();
2697 if (toRenderBox(curr)->isRelPositioned()) 2697 if (toRenderBox(curr)->isRelPositioned())
2698 staticPosition += toRenderBox(curr)->relativePositionOffset( ).width(); 2698 staticPosition += toRenderBox(curr)->relativePositionOffset( ).width();
2699 } else if (curr->isInline()) { 2699 } else if (curr->isInline()) {
2700 if (curr->isRelPositioned()) { 2700 if (curr->isRelPositioned()) {
2701 if (!curr->style()->logicalLeft().isAuto()) 2701 if (!curr->style()->logicalLeft().isAuto())
2702 staticPosition += curr->style()->logicalLeft().value(); 2702 staticPosition += valueForLength(curr->style()->logicalL eft(), curr->containingBlock()->availableWidth());
2703 else 2703 else
2704 staticPosition -= curr->style()->logicalRight().value(); 2704 staticPosition -= valueForLength(curr->style()->logicalR ight(), curr->containingBlock()->availableWidth());
2705 } 2705 }
2706 } 2706 }
2707 } 2707 }
2708 logicalLeft.setValue(Fixed, staticPosition); 2708 logicalLeft.setValue(Fixed, staticPosition);
2709 } else { 2709 } else {
2710 RenderBox* enclosingBox = child->parent()->enclosingBox(); 2710 RenderBox* enclosingBox = child->parent()->enclosingBox();
2711 LayoutUnit staticPosition = child->layer()->staticInlinePosition() + con tainerLogicalWidth + containerBlock->borderLogicalLeft(); 2711 LayoutUnit staticPosition = child->layer()->staticInlinePosition() + con tainerLogicalWidth + containerBlock->borderLogicalLeft();
2712 for (RenderObject* curr = child->parent(); curr; curr = curr->container( )) { 2712 for (RenderObject* curr = child->parent(); curr; curr = curr->container( )) {
2713 if (curr->isBox()) { 2713 if (curr->isBox()) {
2714 if (curr != containerBlock) { 2714 if (curr != containerBlock) {
2715 staticPosition -= toRenderBox(curr)->logicalLeft(); 2715 staticPosition -= toRenderBox(curr)->logicalLeft();
2716 if (toRenderBox(curr)->isRelPositioned()) 2716 if (toRenderBox(curr)->isRelPositioned())
2717 staticPosition -= toRenderBox(curr)->relativePositionOff set().width(); 2717 staticPosition -= toRenderBox(curr)->relativePositionOff set().width();
2718 } 2718 }
2719 if (curr == enclosingBox) 2719 if (curr == enclosingBox)
2720 staticPosition -= enclosingBox->logicalWidth(); 2720 staticPosition -= enclosingBox->logicalWidth();
2721 } else if (curr->isInline()) { 2721 } else if (curr->isInline()) {
2722 if (curr->isRelPositioned()) { 2722 if (curr->isRelPositioned()) {
2723 if (!curr->style()->logicalLeft().isAuto()) 2723 if (!curr->style()->logicalLeft().isAuto())
2724 staticPosition -= curr->style()->logicalLeft().value(); 2724 staticPosition -= valueForLength(curr->style()->logicalL eft(), curr->containingBlock()->availableWidth());
2725 else 2725 else
2726 staticPosition += curr->style()->logicalRight().value(); 2726 staticPosition += valueForLength(curr->style()->logicalR ight(), curr->containingBlock()->availableWidth());
2727 } 2727 }
2728 } 2728 }
2729 if (curr == containerBlock) 2729 if (curr == containerBlock)
2730 break; 2730 break;
2731 } 2731 }
2732 logicalRight.setValue(Fixed, staticPosition); 2732 logicalRight.setValue(Fixed, staticPosition);
2733 } 2733 }
2734 } 2734 }
2735 2735
2736 void RenderBox::computePositionedLogicalWidth(LogicalExtentComputedValues& compu tedValues) const 2736 void RenderBox::computePositionedLogicalWidth(LogicalExtentComputedValues& compu tedValues) const
(...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after
4439 4439
4440 setLogicalTop(oldLogicalTop); 4440 setLogicalTop(oldLogicalTop);
4441 setLogicalWidth(oldLogicalWidth); 4441 setLogicalWidth(oldLogicalWidth);
4442 setMarginLeft(oldMarginLeft); 4442 setMarginLeft(oldMarginLeft);
4443 setMarginRight(oldMarginRight); 4443 setMarginRight(oldMarginRight);
4444 4444
4445 return borderBox; 4445 return borderBox;
4446 } 4446 }
4447 4447
4448 } // namespace blink 4448 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/css/css-properties-position-relative-as-parent-fixed-expected.html ('k') | Source/platform/Length.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698