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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3066 matching lines...) Expand 10 before | Expand all | Expand 10 after
3077 { 3077 {
3078 if (!logicalLeft.isAuto() || !logicalRight.isAuto()) 3078 if (!logicalLeft.isAuto() || !logicalRight.isAuto())
3079 return; 3079 return;
3080 3080
3081 // FIXME: The static distance computation has not been patched for mixed wri ting modes yet. 3081 // FIXME: The static distance computation has not been patched for mixed wri ting modes yet.
3082 if (child->parent()->style()->direction() == LTR) { 3082 if (child->parent()->style()->direction() == LTR) {
3083 LayoutUnit staticPosition = child->layer()->staticInlinePosition() - con tainerBlock->borderLogicalLeft(); 3083 LayoutUnit staticPosition = child->layer()->staticInlinePosition() - con tainerBlock->borderLogicalLeft();
3084 for (RenderObject* curr = child->parent(); curr && curr != containerBloc k; curr = curr->container()) { 3084 for (RenderObject* curr = child->parent(); curr && curr != containerBloc k; curr = curr->container()) {
3085 if (curr->isBox()) { 3085 if (curr->isBox()) {
3086 staticPosition += toRenderBox(curr)->logicalLeft(); 3086 staticPosition += toRenderBox(curr)->logicalLeft();
3087 if (toRenderBox(curr)->isRelPositioned())
3088 staticPosition += toRenderBox(curr)->relativePositionOffset( ).width();
3087 if (region && curr->isRenderBlock()) { 3089 if (region && curr->isRenderBlock()) {
3088 const RenderBlock* cb = toRenderBlock(curr); 3090 const RenderBlock* cb = toRenderBlock(curr);
3089 region = cb->clampToStartAndEndRegions(region); 3091 region = cb->clampToStartAndEndRegions(region);
3090 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(regio n); 3092 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(regio n);
3091 if (boxInfo) 3093 if (boxInfo)
3092 staticPosition += boxInfo->logicalLeft(); 3094 staticPosition += boxInfo->logicalLeft();
3093 } 3095 }
3096 } else if (curr->isInline()) {
3097 if (curr->isRelPositioned()) {
3098 if (!curr->style()->logicalLeft().isAuto())
3099 staticPosition += curr->style()->logicalLeft().value();
3100 else
3101 staticPosition -= curr->style()->logicalRight().value();
3102 }
3094 } 3103 }
3095 } 3104 }
3096 logicalLeft.setValue(Fixed, staticPosition); 3105 logicalLeft.setValue(Fixed, staticPosition);
3097 } else { 3106 } else {
3098 RenderBox* enclosingBox = child->parent()->enclosingBox(); 3107 RenderBox* enclosingBox = child->parent()->enclosingBox();
3099 LayoutUnit staticPosition = child->layer()->staticInlinePosition() + con tainerLogicalWidth + containerBlock->borderLogicalLeft(); 3108 LayoutUnit staticPosition = child->layer()->staticInlinePosition() + con tainerLogicalWidth + containerBlock->borderLogicalLeft();
3100 for (RenderObject* curr = enclosingBox; curr; curr = curr->container()) { 3109 for (RenderObject* curr = child->parent(); curr; curr = curr->container( )) {
3101 if (curr->isBox()) { 3110 if (curr->isBox()) {
3102 if (curr != containerBlock) 3111 if (curr != containerBlock) {
3103 staticPosition -= toRenderBox(curr)->logicalLeft(); 3112 staticPosition -= toRenderBox(curr)->logicalLeft();
3113 if (toRenderBox(curr)->isRelPositioned())
3114 staticPosition -= toRenderBox(curr)->relativePositionOff set().width();
3115 }
3104 if (curr == enclosingBox) 3116 if (curr == enclosingBox)
3105 staticPosition -= enclosingBox->logicalWidth(); 3117 staticPosition -= enclosingBox->logicalWidth();
3106 if (region && curr->isRenderBlock()) { 3118 if (region && curr->isRenderBlock()) {
3107 const RenderBlock* cb = toRenderBlock(curr); 3119 const RenderBlock* cb = toRenderBlock(curr);
3108 region = cb->clampToStartAndEndRegions(region); 3120 region = cb->clampToStartAndEndRegions(region);
3109 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(regio n); 3121 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(regio n);
3110 if (boxInfo) { 3122 if (boxInfo) {
3111 if (curr != containerBlock) 3123 if (curr != containerBlock)
3112 staticPosition -= cb->logicalWidth() - (boxInfo->log icalLeft() + boxInfo->logicalWidth()); 3124 staticPosition -= cb->logicalWidth() - (boxInfo->log icalLeft() + boxInfo->logicalWidth());
3113 if (curr == enclosingBox) 3125 if (curr == enclosingBox)
3114 staticPosition += enclosingBox->logicalWidth() - box Info->logicalWidth(); 3126 staticPosition += enclosingBox->logicalWidth() - box Info->logicalWidth();
3115 } 3127 }
3116 } 3128 }
3129 } else if (curr->isInline()) {
3130 if (curr->isRelPositioned()) {
3131 if (!curr->style()->logicalLeft().isAuto())
3132 staticPosition -= curr->style()->logicalLeft().value();
3133 else
3134 staticPosition += curr->style()->logicalRight().value();
3135 }
3117 } 3136 }
3118 if (curr == containerBlock) 3137 if (curr == containerBlock)
3119 break; 3138 break;
3120 } 3139 }
3121 logicalRight.setValue(Fixed, staticPosition); 3140 logicalRight.setValue(Fixed, staticPosition);
3122 } 3141 }
3123 } 3142 }
3124 3143
3125 void RenderBox::computePositionedLogicalWidth(LogicalExtentComputedValues& compu tedValues, RenderRegion* region) const 3144 void RenderBox::computePositionedLogicalWidth(LogicalExtentComputedValues& compu tedValues, RenderRegion* region) const
3126 { 3145 {
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
4722 return 0; 4741 return 0;
4723 4742
4724 if (!layoutState && !flowThreadContainingBlock()) 4743 if (!layoutState && !flowThreadContainingBlock())
4725 return 0; 4744 return 0;
4726 4745
4727 RenderBlock* containerBlock = containingBlock(); 4746 RenderBlock* containerBlock = containingBlock();
4728 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4747 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4729 } 4748 }
4730 4749
4731 } // namespace WebCore 4750 } // namespace WebCore
OLDNEW
« 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