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

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

Issue 176763011: Revert "Consider text alignment and direction when computing the left offset for horizontal writing… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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
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 3215 matching lines...) Expand 10 before | Expand all | Expand 10 after
3226 computedValues.m_extent += bordersPlusPadding; 3226 computedValues.m_extent += bordersPlusPadding;
3227 } 3227 }
3228 3228
3229 static void computeLogicalLeftPositionedOffset(LayoutUnit& logicalLeftPos, const RenderBox* child, LayoutUnit logicalWidthValue, const RenderBoxModelObject* con tainerBlock, LayoutUnit containerLogicalWidth) 3229 static void computeLogicalLeftPositionedOffset(LayoutUnit& logicalLeftPos, const RenderBox* child, LayoutUnit logicalWidthValue, const RenderBoxModelObject* con tainerBlock, LayoutUnit containerLogicalWidth)
3230 { 3230 {
3231 // Deal with differing writing modes here. Our offset needs to be in the co ntaining block's coordinate space. If the containing block is flipped 3231 // Deal with differing writing modes here. Our offset needs to be in the co ntaining block's coordinate space. If the containing block is flipped
3232 // along this axis, then we need to flip the coordinate. This can only happ en if the containing block is both a flipped mode and perpendicular to us. 3232 // along this axis, then we need to flip the coordinate. This can only happ en if the containing block is both a flipped mode and perpendicular to us.
3233 if (containerBlock->isHorizontalWritingMode() != child->isHorizontalWritingM ode() && containerBlock->style()->isFlippedBlocksWritingMode()) { 3233 if (containerBlock->isHorizontalWritingMode() != child->isHorizontalWritingM ode() && containerBlock->style()->isFlippedBlocksWritingMode()) {
3234 logicalLeftPos = containerLogicalWidth - logicalWidthValue - logicalLeft Pos; 3234 logicalLeftPos = containerLogicalWidth - logicalWidthValue - logicalLeft Pos;
3235 logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->bo rderRight() : containerBlock->borderBottom()); 3235 logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->bo rderRight() : containerBlock->borderBottom());
3236 } else if (child->isHorizontalWritingMode()) {
3237 RenderStyle* blockStyle = containerBlock->style();
3238 bool containerBlockIsLTR = isLeftToRightDirection(blockStyle->direction( ));
3239 ETextAlign textAlignForContainerBlock = containerBlock->simplifiedTextAl ign(blockStyle->textAlign());
3240 if (containerBlockIsLTR && textAlignForContainerBlock == RIGHT) {
3241 logicalLeftPos = containerLogicalWidth - (logicalWidthValue + child- >borderLogicalWidth() + child->style()->logicalRight().value());
3242 logicalLeftPos += containerBlock->borderLogicalRight();
3243 } else if (!containerBlockIsLTR && textAlignForContainerBlock == LEFT) {
3244 logicalLeftPos += containerBlock->borderAndPaddingLogicalLeft() + lo gicalWidthValue;
3245 } else {
3246 logicalLeftPos += containerBlock->borderLeft();
3247 }
3248 } else { 3236 } else {
3249 logicalLeftPos += containerBlock->borderTop(); 3237 logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->bo rderLeft() : containerBlock->borderTop());
3250 } 3238 }
3251 } 3239 }
3252 3240
3253 void RenderBox::shrinkToFitWidth(const LayoutUnit availableSpace, const LayoutUn it logicalLeftValue, const LayoutUnit bordersPlusPadding, LogicalExtentComputedV alues& computedValues) const 3241 void RenderBox::shrinkToFitWidth(const LayoutUnit availableSpace, const LayoutUn it logicalLeftValue, const LayoutUnit bordersPlusPadding, LogicalExtentComputedV alues& computedValues) const
3254 { 3242 {
3255 // FIXME: would it be better to have shrink-to-fit in one step? 3243 // FIXME: would it be better to have shrink-to-fit in one step?
3256 LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding; 3244 LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding;
3257 LayoutUnit preferredMinWidth = minPreferredLogicalWidth() - bordersPlusPaddi ng; 3245 LayoutUnit preferredMinWidth = minPreferredLogicalWidth() - bordersPlusPaddi ng;
3258 LayoutUnit availableWidth = availableSpace - logicalLeftValue; 3246 LayoutUnit availableWidth = availableSpace - logicalLeftValue;
3259 computedValues.m_extent = min(max(preferredMinWidth, availableWidth), prefer redWidth); 3247 computedValues.m_extent = min(max(preferredMinWidth, availableWidth), prefer redWidth);
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
4692 return 0; 4680 return 0;
4693 4681
4694 if (!layoutState && !flowThreadContainingBlock()) 4682 if (!layoutState && !flowThreadContainingBlock())
4695 return 0; 4683 return 0;
4696 4684
4697 RenderBlock* containerBlock = containingBlock(); 4685 RenderBlock* containerBlock = containingBlock();
4698 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4686 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4699 } 4687 }
4700 4688
4701 } // namespace WebCore 4689 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlockLineLayout.cpp ('k') | Source/core/rendering/RenderBoxModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698