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

Side by Side Diff: sky/engine/platform/geometry/LayoutBoxExtent.cpp

Issue 683803006: Remove all writing mode function arguments and remove writing mode from RenderStyle. (Closed) Base URL: git@github.com:domokit/mojo.git@writingmode
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/geometry/LayoutBoxExtent.h ('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 17 matching lines...) Expand all
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "platform/geometry/LayoutBoxExtent.h" 32 #include "platform/geometry/LayoutBoxExtent.h"
33 33
34 #include "wtf/Assertions.h" 34 #include "wtf/Assertions.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 LayoutUnit LayoutBoxExtent::logicalTop(WritingMode writingMode) const 38 LayoutUnit LayoutBoxExtent::logicalTop() const
39 { 39 {
40 return isHorizontalWritingMode(writingMode) ? m_top : m_left; 40 return isHorizontalWritingMode() ? m_top : m_left;
41 } 41 }
42 42
43 LayoutUnit LayoutBoxExtent::logicalBottom(WritingMode writingMode) const 43 LayoutUnit LayoutBoxExtent::logicalBottom() const
44 { 44 {
45 return isHorizontalWritingMode(writingMode) ? m_bottom : m_right; 45 return isHorizontalWritingMode() ? m_bottom : m_right;
46 } 46 }
47 47
48 LayoutUnit LayoutBoxExtent::logicalLeft(WritingMode writingMode) const 48 LayoutUnit LayoutBoxExtent::logicalLeft() const
49 { 49 {
50 return isHorizontalWritingMode(writingMode) ? m_left : m_top; 50 return isHorizontalWritingMode() ? m_left : m_top;
51 } 51 }
52 52
53 LayoutUnit LayoutBoxExtent::logicalRight(WritingMode writingMode) const 53 LayoutUnit LayoutBoxExtent::logicalRight() const
54 { 54 {
55 return isHorizontalWritingMode(writingMode) ? m_right : m_bottom; 55 return isHorizontalWritingMode() ? m_right : m_bottom;
56 } 56 }
57 57
58 LayoutUnit LayoutBoxExtent::before(WritingMode writingMode) const 58 LayoutUnit LayoutBoxExtent::before() const
59 { 59 {
60 // FIXME(sky): Remove 60 // FIXME(sky): Remove
61 return m_top; 61 return m_top;
62 } 62 }
63 63
64 LayoutUnit LayoutBoxExtent::after(WritingMode writingMode) const 64 LayoutUnit LayoutBoxExtent::after() const
65 { 65 {
66 // FIXME(sky): Remove 66 // FIXME(sky): Remove
67 return m_bottom; 67 return m_bottom;
68 } 68 }
69 69
70 LayoutUnit LayoutBoxExtent::start(WritingMode writingMode, TextDirection directi on) const 70 LayoutUnit LayoutBoxExtent::start(TextDirection direction) const
71 { 71 {
72 if (isHorizontalWritingMode(writingMode)) 72 if (isHorizontalWritingMode())
73 return isLeftToRightDirection(direction) ? m_left : m_right; 73 return isLeftToRightDirection(direction) ? m_left : m_right;
74 return isLeftToRightDirection(direction) ? m_top : m_bottom; 74 return isLeftToRightDirection(direction) ? m_top : m_bottom;
75 } 75 }
76 76
77 LayoutUnit LayoutBoxExtent::end(WritingMode writingMode, TextDirection direction ) const 77 LayoutUnit LayoutBoxExtent::end(TextDirection direction) const
78 { 78 {
79 if (isHorizontalWritingMode(writingMode)) 79 if (isHorizontalWritingMode())
80 return isLeftToRightDirection(direction) ? m_right : m_left; 80 return isLeftToRightDirection(direction) ? m_right : m_left;
81 return isLeftToRightDirection(direction) ? m_bottom : m_top; 81 return isLeftToRightDirection(direction) ? m_bottom : m_top;
82 } 82 }
83 83
84 void LayoutBoxExtent::setBefore(WritingMode writingMode, LayoutUnit value) 84 void LayoutBoxExtent::setBefore(LayoutUnit value)
85 { 85 {
86 // FIXME(sky): Remove 86 // FIXME(sky): Remove
87 m_top = value; 87 m_top = value;
88 } 88 }
89 89
90 void LayoutBoxExtent::setAfter(WritingMode writingMode, LayoutUnit value) 90 void LayoutBoxExtent::setAfter(LayoutUnit value)
91 { 91 {
92 // FIXME(sky): Remove 92 // FIXME(sky): Remove
93 m_bottom = value; 93 m_bottom = value;
94 } 94 }
95 95
96 void LayoutBoxExtent::setStart(WritingMode writingMode, TextDirection direction, LayoutUnit value) 96 void LayoutBoxExtent::setStart(TextDirection direction, LayoutUnit value)
97 { 97 {
98 if (isHorizontalWritingMode(writingMode)) { 98 if (isHorizontalWritingMode()) {
99 if (isLeftToRightDirection(direction)) 99 if (isLeftToRightDirection(direction))
100 m_left = value; 100 m_left = value;
101 else 101 else
102 m_right = value; 102 m_right = value;
103 } else { 103 } else {
104 if (isLeftToRightDirection(direction)) 104 if (isLeftToRightDirection(direction))
105 m_top = value; 105 m_top = value;
106 else 106 else
107 m_bottom = value; 107 m_bottom = value;
108 } 108 }
109 } 109 }
110 110
111 void LayoutBoxExtent::setEnd(WritingMode writingMode, TextDirection direction, L ayoutUnit value) 111 void LayoutBoxExtent::setEnd(TextDirection direction, LayoutUnit value)
112 { 112 {
113 if (isHorizontalWritingMode(writingMode)) { 113 if (isHorizontalWritingMode()) {
114 if (isLeftToRightDirection(direction)) 114 if (isLeftToRightDirection(direction))
115 m_right = value; 115 m_right = value;
116 else 116 else
117 m_left = value; 117 m_left = value;
118 } else { 118 } else {
119 if (isLeftToRightDirection(direction)) 119 if (isLeftToRightDirection(direction))
120 m_bottom = value; 120 m_bottom = value;
121 else 121 else
122 m_top = value; 122 m_top = value;
123 } 123 }
124 } 124 }
125 125
126 LayoutUnit& LayoutBoxExtent::mutableLogicalLeft(WritingMode writingMode) 126 LayoutUnit& LayoutBoxExtent::mutableLogicalLeft()
127 { 127 {
128 return isHorizontalWritingMode(writingMode) ? m_left : m_top; 128 return isHorizontalWritingMode() ? m_left : m_top;
129 } 129 }
130 130
131 LayoutUnit& LayoutBoxExtent::mutableLogicalRight(WritingMode writingMode) 131 LayoutUnit& LayoutBoxExtent::mutableLogicalRight()
132 { 132 {
133 return isHorizontalWritingMode(writingMode) ? m_right : m_bottom; 133 return isHorizontalWritingMode() ? m_right : m_bottom;
134 } 134 }
135 135
136 LayoutUnit& LayoutBoxExtent::mutableBefore(WritingMode writingMode) 136 LayoutUnit& LayoutBoxExtent::mutableBefore()
137 { 137 {
138 return isHorizontalWritingMode(writingMode) ? 138 return isHorizontalWritingMode() ?
139 (isFlippedBlocksWritingMode(writingMode) ? m_bottom : m_top) : 139 (isFlippedBlocksWritingMode() ? m_bottom : m_top) :
140 (isFlippedBlocksWritingMode(writingMode) ? m_right: m_left); 140 (isFlippedBlocksWritingMode() ? m_right: m_left);
141 } 141 }
142 142
143 LayoutUnit& LayoutBoxExtent::mutableAfter(WritingMode writingMode) 143 LayoutUnit& LayoutBoxExtent::mutableAfter()
144 { 144 {
145 return isHorizontalWritingMode(writingMode) ? 145 return isHorizontalWritingMode() ?
146 (isFlippedBlocksWritingMode(writingMode) ? m_top : m_bottom) : 146 (isFlippedBlocksWritingMode() ? m_top : m_bottom) :
147 (isFlippedBlocksWritingMode(writingMode) ? m_left: m_right); 147 (isFlippedBlocksWritingMode() ? m_left: m_right);
148 } 148 }
149 149
150 } // namespace blink 150 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/platform/geometry/LayoutBoxExtent.h ('k') | sky/engine/platform/text/WritingMode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698