| OLD | NEW |
| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 if (isFlippedLinesWritingMode(writingMode)) | 69 if (isFlippedLinesWritingMode(writingMode)) |
| 70 std::swap(outsets.m_top, outsets.m_bottom); | 70 std::swap(outsets.m_top, outsets.m_bottom); |
| 71 return outsets; | 71 return outsets; |
| 72 } | 72 } |
| 73 | 73 |
| 74 LayoutUnit LayoutRectOutsets::before(WritingMode writingMode) const | 74 LayoutUnit LayoutRectOutsets::before(WritingMode writingMode) const |
| 75 { | 75 { |
| 76 switch (writingMode) { | 76 switch (writingMode) { |
| 77 case TopToBottomWritingMode: | 77 case TopToBottomWritingMode: |
| 78 return m_top; | 78 return m_top; |
| 79 case BottomToTopWritingMode: | |
| 80 return m_bottom; | |
| 81 case LeftToRightWritingMode: | 79 case LeftToRightWritingMode: |
| 82 return m_left; | 80 return m_left; |
| 83 case RightToLeftWritingMode: | 81 case RightToLeftWritingMode: |
| 84 return m_right; | 82 return m_right; |
| 85 } | 83 } |
| 86 ASSERT_NOT_REACHED(); | 84 ASSERT_NOT_REACHED(); |
| 87 return m_top; | 85 return m_top; |
| 88 } | 86 } |
| 89 | 87 |
| 90 LayoutUnit LayoutRectOutsets::after(WritingMode writingMode) const | 88 LayoutUnit LayoutRectOutsets::after(WritingMode writingMode) const |
| 91 { | 89 { |
| 92 switch (writingMode) { | 90 switch (writingMode) { |
| 93 case TopToBottomWritingMode: | 91 case TopToBottomWritingMode: |
| 94 return m_bottom; | 92 return m_bottom; |
| 95 case BottomToTopWritingMode: | |
| 96 return m_top; | |
| 97 case LeftToRightWritingMode: | 93 case LeftToRightWritingMode: |
| 98 return m_right; | 94 return m_right; |
| 99 case RightToLeftWritingMode: | 95 case RightToLeftWritingMode: |
| 100 return m_left; | 96 return m_left; |
| 101 } | 97 } |
| 102 ASSERT_NOT_REACHED(); | 98 ASSERT_NOT_REACHED(); |
| 103 return m_bottom; | 99 return m_bottom; |
| 104 } | 100 } |
| 105 | 101 |
| 106 LayoutUnit LayoutRectOutsets::start(WritingMode writingMode, TextDirection direc
tion) const | 102 LayoutUnit LayoutRectOutsets::start(WritingMode writingMode, TextDirection direc
tion) const |
| 107 { | 103 { |
| 108 if (isHorizontalWritingMode(writingMode)) | 104 if (isHorizontalWritingMode(writingMode)) |
| 109 return isLeftToRightDirection(direction) ? m_left : m_right; | 105 return isLeftToRightDirection(direction) ? m_left : m_right; |
| 110 return isLeftToRightDirection(direction) ? m_top : m_bottom; | 106 return isLeftToRightDirection(direction) ? m_top : m_bottom; |
| 111 } | 107 } |
| 112 | 108 |
| 113 LayoutUnit LayoutRectOutsets::end(WritingMode writingMode, TextDirection directi
on) const | 109 LayoutUnit LayoutRectOutsets::end(WritingMode writingMode, TextDirection directi
on) const |
| 114 { | 110 { |
| 115 if (isHorizontalWritingMode(writingMode)) | 111 if (isHorizontalWritingMode(writingMode)) |
| 116 return isLeftToRightDirection(direction) ? m_right : m_left; | 112 return isLeftToRightDirection(direction) ? m_right : m_left; |
| 117 return isLeftToRightDirection(direction) ? m_bottom : m_top; | 113 return isLeftToRightDirection(direction) ? m_bottom : m_top; |
| 118 } | 114 } |
| 119 | 115 |
| 120 void LayoutRectOutsets::setBefore(WritingMode writingMode, LayoutUnit value) | 116 void LayoutRectOutsets::setBefore(WritingMode writingMode, LayoutUnit value) |
| 121 { | 117 { |
| 122 switch (writingMode) { | 118 switch (writingMode) { |
| 123 case TopToBottomWritingMode: | 119 case TopToBottomWritingMode: |
| 124 m_top = value; | 120 m_top = value; |
| 125 break; | 121 break; |
| 126 case BottomToTopWritingMode: | |
| 127 m_bottom = value; | |
| 128 break; | |
| 129 case LeftToRightWritingMode: | 122 case LeftToRightWritingMode: |
| 130 m_left = value; | 123 m_left = value; |
| 131 break; | 124 break; |
| 132 case RightToLeftWritingMode: | 125 case RightToLeftWritingMode: |
| 133 m_right = value; | 126 m_right = value; |
| 134 break; | 127 break; |
| 135 default: | 128 default: |
| 136 ASSERT_NOT_REACHED(); | 129 ASSERT_NOT_REACHED(); |
| 137 m_top = value; | 130 m_top = value; |
| 138 } | 131 } |
| 139 } | 132 } |
| 140 | 133 |
| 141 void LayoutRectOutsets::setAfter(WritingMode writingMode, LayoutUnit value) | 134 void LayoutRectOutsets::setAfter(WritingMode writingMode, LayoutUnit value) |
| 142 { | 135 { |
| 143 switch (writingMode) { | 136 switch (writingMode) { |
| 144 case TopToBottomWritingMode: | 137 case TopToBottomWritingMode: |
| 145 m_bottom = value; | 138 m_bottom = value; |
| 146 break; | 139 break; |
| 147 case BottomToTopWritingMode: | |
| 148 m_top = value; | |
| 149 break; | |
| 150 case LeftToRightWritingMode: | 140 case LeftToRightWritingMode: |
| 151 m_right = value; | 141 m_right = value; |
| 152 break; | 142 break; |
| 153 case RightToLeftWritingMode: | 143 case RightToLeftWritingMode: |
| 154 m_left = value; | 144 m_left = value; |
| 155 break; | 145 break; |
| 156 default: | 146 default: |
| 157 ASSERT_NOT_REACHED(); | 147 ASSERT_NOT_REACHED(); |
| 158 m_bottom = value; | 148 m_bottom = value; |
| 159 } | 149 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 183 m_left = value; | 173 m_left = value; |
| 184 } else { | 174 } else { |
| 185 if (isLeftToRightDirection(direction)) | 175 if (isLeftToRightDirection(direction)) |
| 186 m_bottom = value; | 176 m_bottom = value; |
| 187 else | 177 else |
| 188 m_top = value; | 178 m_top = value; |
| 189 } | 179 } |
| 190 } | 180 } |
| 191 | 181 |
| 192 } // namespace blink | 182 } // namespace blink |
| OLD | NEW |