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

Side by Side Diff: sky/engine/core/rendering/RenderBox.cpp

Issue 689743002: First past at removing writing mode. (Closed) Base URL: git@github.com:domokit/mojo.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 3844 matching lines...) Expand 10 before | Expand all | Expand 10 after
3855 LayoutRect RenderBox::logicalVisualOverflowRectForPropagation(RenderStyle* paren tStyle) const 3855 LayoutRect RenderBox::logicalVisualOverflowRectForPropagation(RenderStyle* paren tStyle) const
3856 { 3856 {
3857 LayoutRect rect = visualOverflowRectForPropagation(parentStyle); 3857 LayoutRect rect = visualOverflowRectForPropagation(parentStyle);
3858 if (!parentStyle->isHorizontalWritingMode()) 3858 if (!parentStyle->isHorizontalWritingMode())
3859 return rect.transposedRect(); 3859 return rect.transposedRect();
3860 return rect; 3860 return rect;
3861 } 3861 }
3862 3862
3863 LayoutRect RenderBox::visualOverflowRectForPropagation(RenderStyle* parentStyle) const 3863 LayoutRect RenderBox::visualOverflowRectForPropagation(RenderStyle* parentStyle) const
3864 { 3864 {
3865 // If the writing modes of the child and parent match, then we don't have to 3865 // FIXME(sky): Remove
3866 // do anything fancy. Just return the result. 3866 return visualOverflowRect();
3867 LayoutRect rect = visualOverflowRect();
3868 if (parentStyle->writingMode() == style()->writingMode())
3869 return rect;
3870
3871 // We are putting ourselves into our parent's coordinate space. If there is a flipped block mismatch
3872 // in a particular axis, then we have to flip the rect along that axis.
3873 if (style()->writingMode() == RightToLeftWritingMode || parentStyle->writing Mode() == RightToLeftWritingMode)
3874 rect.setX(width() - rect.maxX());
3875 else if (style()->writingMode() == BottomToTopWritingMode || parentStyle->wr itingMode() == BottomToTopWritingMode)
3876 rect.setY(height() - rect.maxY());
3877
3878 return rect;
3879 } 3867 }
3880 3868
3881 LayoutRect RenderBox::logicalLayoutOverflowRectForPropagation(RenderStyle* paren tStyle) const 3869 LayoutRect RenderBox::logicalLayoutOverflowRectForPropagation(RenderStyle* paren tStyle) const
3882 { 3870 {
3883 LayoutRect rect = layoutOverflowRectForPropagation(parentStyle); 3871 LayoutRect rect = layoutOverflowRectForPropagation(parentStyle);
3884 if (!parentStyle->isHorizontalWritingMode()) 3872 if (!parentStyle->isHorizontalWritingMode())
3885 return rect.transposedRect(); 3873 return rect.transposedRect();
3886 return rect; 3874 return rect;
3887 } 3875 }
3888 3876
(...skipping 19 matching lines...) Expand all
3908 if (hasTransform) 3896 if (hasTransform)
3909 rect = layer()->currentTransform().mapRect(rect); 3897 rect = layer()->currentTransform().mapRect(rect);
3910 3898
3911 if (isRelPositioned()) 3899 if (isRelPositioned())
3912 rect.move(offsetForInFlowPosition()); 3900 rect.move(offsetForInFlowPosition());
3913 3901
3914 // Now we need to flip back. 3902 // Now we need to flip back.
3915 flipForWritingMode(rect); 3903 flipForWritingMode(rect);
3916 } 3904 }
3917 3905
3918 // If the writing modes of the child and parent match, then we don't have to
3919 // do anything fancy. Just return the result.
3920 if (parentStyle->writingMode() == style()->writingMode())
3921 return rect;
3922
3923 // We are putting ourselves into our parent's coordinate space. If there is a flipped block mismatch
3924 // in a particular axis, then we have to flip the rect along that axis.
3925 if (style()->writingMode() == RightToLeftWritingMode || parentStyle->writing Mode() == RightToLeftWritingMode)
3926 rect.setX(width() - rect.maxX());
3927 else if (style()->writingMode() == BottomToTopWritingMode || parentStyle->wr itingMode() == BottomToTopWritingMode)
3928 rect.setY(height() - rect.maxY());
3929
3930 return rect; 3906 return rect;
3931 } 3907 }
3932 3908
3933 LayoutRect RenderBox::noOverflowRect() const 3909 LayoutRect RenderBox::noOverflowRect() const
3934 { 3910 {
3935 // Because of the special coordinate system used for overflow rectangles and many other 3911 // Because of the special coordinate system used for overflow rectangles and many other
3936 // rectangles (not quite logical, not quite physical), we need to flip the b lock progression 3912 // rectangles (not quite logical, not quite physical), we need to flip the b lock progression
3937 // coordinate in vertical-rl and horizontal-bt writing modes. In other words , the rectangle 3913 // coordinate in vertical-rl and horizontal-bt writing modes. In other words , the rectangle
3938 // returned is physical, except for the block direction progression coordina te (y in horizontal 3914 // returned is physical, except for the block direction progression coordina te (y in horizontal
3939 // writing modes, x in vertical writing modes), which is always "logical top ". Apart from the 3915 // writing modes, x in vertical writing modes), which is always "logical top ". Apart from the
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
4156 4132
4157 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) 4133 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style)
4158 { 4134 {
4159 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); 4135 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor);
4160 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); 4136 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage();
4161 ASSERT(hasBackground == style.hasBackground()); 4137 ASSERT(hasBackground == style.hasBackground());
4162 hasBorder = style.hasBorder(); 4138 hasBorder = style.hasBorder();
4163 } 4139 }
4164 4140
4165 } // namespace blink 4141 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/resolver/StyleResolver.cpp ('k') | sky/engine/core/rendering/RenderFlexibleBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698