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

Side by Side Diff: sky/engine/platform/geometry/LayoutBoxExtent.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
« no previous file with comments | « sky/engine/platform/LengthBox.cpp ('k') | sky/engine/platform/text/WritingMode.h » ('j') | 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) 2012, Google Inc. All rights reserved. 2 * Copyright (c) 2012, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return isHorizontalWritingMode(writingMode) ? m_left : m_top; 50 return isHorizontalWritingMode(writingMode) ? m_left : m_top;
51 } 51 }
52 52
53 LayoutUnit LayoutBoxExtent::logicalRight(WritingMode writingMode) const 53 LayoutUnit LayoutBoxExtent::logicalRight(WritingMode writingMode) const
54 { 54 {
55 return isHorizontalWritingMode(writingMode) ? m_right : m_bottom; 55 return isHorizontalWritingMode(writingMode) ? m_right : m_bottom;
56 } 56 }
57 57
58 LayoutUnit LayoutBoxExtent::before(WritingMode writingMode) const 58 LayoutUnit LayoutBoxExtent::before(WritingMode writingMode) const
59 { 59 {
60 switch (writingMode) { 60 // FIXME(sky): Remove
61 case TopToBottomWritingMode:
62 return m_top;
63 case BottomToTopWritingMode:
64 return m_bottom;
65 case LeftToRightWritingMode:
66 return m_left;
67 case RightToLeftWritingMode:
68 return m_right;
69 }
70 ASSERT_NOT_REACHED();
71 return m_top; 61 return m_top;
72 } 62 }
73 63
74 LayoutUnit LayoutBoxExtent::after(WritingMode writingMode) const 64 LayoutUnit LayoutBoxExtent::after(WritingMode writingMode) const
75 { 65 {
76 switch (writingMode) { 66 // FIXME(sky): Remove
77 case TopToBottomWritingMode:
78 return m_bottom;
79 case BottomToTopWritingMode:
80 return m_top;
81 case LeftToRightWritingMode:
82 return m_right;
83 case RightToLeftWritingMode:
84 return m_left;
85 }
86 ASSERT_NOT_REACHED();
87 return m_bottom; 67 return m_bottom;
88 } 68 }
89 69
90 LayoutUnit LayoutBoxExtent::start(WritingMode writingMode, TextDirection directi on) const 70 LayoutUnit LayoutBoxExtent::start(WritingMode writingMode, TextDirection directi on) const
91 { 71 {
92 if (isHorizontalWritingMode(writingMode)) 72 if (isHorizontalWritingMode(writingMode))
93 return isLeftToRightDirection(direction) ? m_left : m_right; 73 return isLeftToRightDirection(direction) ? m_left : m_right;
94 return isLeftToRightDirection(direction) ? m_top : m_bottom; 74 return isLeftToRightDirection(direction) ? m_top : m_bottom;
95 } 75 }
96 76
97 LayoutUnit LayoutBoxExtent::end(WritingMode writingMode, TextDirection direction ) const 77 LayoutUnit LayoutBoxExtent::end(WritingMode writingMode, TextDirection direction ) const
98 { 78 {
99 if (isHorizontalWritingMode(writingMode)) 79 if (isHorizontalWritingMode(writingMode))
100 return isLeftToRightDirection(direction) ? m_right : m_left; 80 return isLeftToRightDirection(direction) ? m_right : m_left;
101 return isLeftToRightDirection(direction) ? m_bottom : m_top; 81 return isLeftToRightDirection(direction) ? m_bottom : m_top;
102 } 82 }
103 83
104 void LayoutBoxExtent::setBefore(WritingMode writingMode, LayoutUnit value) 84 void LayoutBoxExtent::setBefore(WritingMode writingMode, LayoutUnit value)
105 { 85 {
106 switch (writingMode) { 86 // FIXME(sky): Remove
107 case TopToBottomWritingMode: 87 m_top = value;
108 m_top = value;
109 break;
110 case BottomToTopWritingMode:
111 m_bottom = value;
112 break;
113 case LeftToRightWritingMode:
114 m_left = value;
115 break;
116 case RightToLeftWritingMode:
117 m_right = value;
118 break;
119 default:
120 ASSERT_NOT_REACHED();
121 m_top = value;
122 }
123 } 88 }
124 89
125 void LayoutBoxExtent::setAfter(WritingMode writingMode, LayoutUnit value) 90 void LayoutBoxExtent::setAfter(WritingMode writingMode, LayoutUnit value)
126 { 91 {
127 switch (writingMode) { 92 // FIXME(sky): Remove
128 case TopToBottomWritingMode: 93 m_bottom = value;
129 m_bottom = value;
130 break;
131 case BottomToTopWritingMode:
132 m_top = value;
133 break;
134 case LeftToRightWritingMode:
135 m_right = value;
136 break;
137 case RightToLeftWritingMode:
138 m_left = value;
139 break;
140 default:
141 ASSERT_NOT_REACHED();
142 m_bottom = value;
143 }
144 } 94 }
145 95
146 void LayoutBoxExtent::setStart(WritingMode writingMode, TextDirection direction, LayoutUnit value) 96 void LayoutBoxExtent::setStart(WritingMode writingMode, TextDirection direction, LayoutUnit value)
147 { 97 {
148 if (isHorizontalWritingMode(writingMode)) { 98 if (isHorizontalWritingMode(writingMode)) {
149 if (isLeftToRightDirection(direction)) 99 if (isLeftToRightDirection(direction))
150 m_left = value; 100 m_left = value;
151 else 101 else
152 m_right = value; 102 m_right = value;
153 } else { 103 } else {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 141 }
192 142
193 LayoutUnit& LayoutBoxExtent::mutableAfter(WritingMode writingMode) 143 LayoutUnit& LayoutBoxExtent::mutableAfter(WritingMode writingMode)
194 { 144 {
195 return isHorizontalWritingMode(writingMode) ? 145 return isHorizontalWritingMode(writingMode) ?
196 (isFlippedBlocksWritingMode(writingMode) ? m_top : m_bottom) : 146 (isFlippedBlocksWritingMode(writingMode) ? m_top : m_bottom) :
197 (isFlippedBlocksWritingMode(writingMode) ? m_left: m_right); 147 (isFlippedBlocksWritingMode(writingMode) ? m_left: m_right);
198 } 148 }
199 149
200 } // namespace blink 150 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/platform/LengthBox.cpp ('k') | sky/engine/platform/text/WritingMode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698