| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 LayoutRectOutsets LayoutRectOutsets::logicalOutsetsWithFlippedLines( | 61 LayoutRectOutsets LayoutRectOutsets::logicalOutsetsWithFlippedLines( |
| 62 WritingMode writingMode) const { | 62 WritingMode writingMode) const { |
| 63 LayoutRectOutsets outsets = logicalOutsets(writingMode); | 63 LayoutRectOutsets outsets = logicalOutsets(writingMode); |
| 64 if (isFlippedLinesWritingMode(writingMode)) | 64 if (isFlippedLinesWritingMode(writingMode)) |
| 65 std::swap(outsets.m_top, outsets.m_bottom); | 65 std::swap(outsets.m_top, outsets.m_bottom); |
| 66 return outsets; | 66 return outsets; |
| 67 } | 67 } |
| 68 | 68 |
| 69 LayoutUnit LayoutRectOutsets::before(WritingMode writingMode) const { | 69 LayoutUnit LayoutRectOutsets::before(WritingMode writingMode) const { |
| 70 switch (writingMode) { | 70 switch (writingMode) { |
| 71 case WritingMode::HorizontalTb: | 71 case WritingMode::kHorizontalTb: |
| 72 return m_top; | 72 return m_top; |
| 73 case WritingMode::VerticalLr: | 73 case WritingMode::kVerticalLr: |
| 74 return m_left; | 74 return m_left; |
| 75 case WritingMode::VerticalRl: | 75 case WritingMode::kVerticalRl: |
| 76 return m_right; | 76 return m_right; |
| 77 } | 77 } |
| 78 ASSERT_NOT_REACHED(); | 78 ASSERT_NOT_REACHED(); |
| 79 return m_top; | 79 return m_top; |
| 80 } | 80 } |
| 81 | 81 |
| 82 LayoutUnit LayoutRectOutsets::after(WritingMode writingMode) const { | 82 LayoutUnit LayoutRectOutsets::after(WritingMode writingMode) const { |
| 83 switch (writingMode) { | 83 switch (writingMode) { |
| 84 case WritingMode::HorizontalTb: | 84 case WritingMode::kHorizontalTb: |
| 85 return m_bottom; | 85 return m_bottom; |
| 86 case WritingMode::VerticalLr: | 86 case WritingMode::kVerticalLr: |
| 87 return m_right; | 87 return m_right; |
| 88 case WritingMode::VerticalRl: | 88 case WritingMode::kVerticalRl: |
| 89 return m_left; | 89 return m_left; |
| 90 } | 90 } |
| 91 ASSERT_NOT_REACHED(); | 91 ASSERT_NOT_REACHED(); |
| 92 return m_bottom; | 92 return m_bottom; |
| 93 } | 93 } |
| 94 | 94 |
| 95 LayoutUnit LayoutRectOutsets::start(WritingMode writingMode, | 95 LayoutUnit LayoutRectOutsets::start(WritingMode writingMode, |
| 96 TextDirection direction) const { | 96 TextDirection direction) const { |
| 97 if (isHorizontalWritingMode(writingMode)) | 97 if (isHorizontalWritingMode(writingMode)) |
| 98 return isLeftToRightDirection(direction) ? m_left : m_right; | 98 return isLeftToRightDirection(direction) ? m_left : m_right; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 109 LayoutUnit LayoutRectOutsets::over(WritingMode writingMode) const { | 109 LayoutUnit LayoutRectOutsets::over(WritingMode writingMode) const { |
| 110 return isHorizontalWritingMode(writingMode) ? m_top : m_right; | 110 return isHorizontalWritingMode(writingMode) ? m_top : m_right; |
| 111 } | 111 } |
| 112 | 112 |
| 113 LayoutUnit LayoutRectOutsets::under(WritingMode writingMode) const { | 113 LayoutUnit LayoutRectOutsets::under(WritingMode writingMode) const { |
| 114 return isHorizontalWritingMode(writingMode) ? m_bottom : m_left; | 114 return isHorizontalWritingMode(writingMode) ? m_bottom : m_left; |
| 115 } | 115 } |
| 116 | 116 |
| 117 void LayoutRectOutsets::setBefore(WritingMode writingMode, LayoutUnit value) { | 117 void LayoutRectOutsets::setBefore(WritingMode writingMode, LayoutUnit value) { |
| 118 switch (writingMode) { | 118 switch (writingMode) { |
| 119 case WritingMode::HorizontalTb: | 119 case WritingMode::kHorizontalTb: |
| 120 m_top = value; | 120 m_top = value; |
| 121 break; | 121 break; |
| 122 case WritingMode::VerticalLr: | 122 case WritingMode::kVerticalLr: |
| 123 m_left = value; | 123 m_left = value; |
| 124 break; | 124 break; |
| 125 case WritingMode::VerticalRl: | 125 case WritingMode::kVerticalRl: |
| 126 m_right = value; | 126 m_right = value; |
| 127 break; | 127 break; |
| 128 default: | 128 default: |
| 129 ASSERT_NOT_REACHED(); | 129 ASSERT_NOT_REACHED(); |
| 130 m_top = value; | 130 m_top = value; |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 void LayoutRectOutsets::setAfter(WritingMode writingMode, LayoutUnit value) { | 134 void LayoutRectOutsets::setAfter(WritingMode writingMode, LayoutUnit value) { |
| 135 switch (writingMode) { | 135 switch (writingMode) { |
| 136 case WritingMode::HorizontalTb: | 136 case WritingMode::kHorizontalTb: |
| 137 m_bottom = value; | 137 m_bottom = value; |
| 138 break; | 138 break; |
| 139 case WritingMode::VerticalLr: | 139 case WritingMode::kVerticalLr: |
| 140 m_right = value; | 140 m_right = value; |
| 141 break; | 141 break; |
| 142 case WritingMode::VerticalRl: | 142 case WritingMode::kVerticalRl: |
| 143 m_left = value; | 143 m_left = value; |
| 144 break; | 144 break; |
| 145 default: | 145 default: |
| 146 ASSERT_NOT_REACHED(); | 146 ASSERT_NOT_REACHED(); |
| 147 m_bottom = value; | 147 m_bottom = value; |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 | 150 |
| 151 void LayoutRectOutsets::setStart(WritingMode writingMode, | 151 void LayoutRectOutsets::setStart(WritingMode writingMode, |
| 152 TextDirection direction, | 152 TextDirection direction, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 174 m_left = value; | 174 m_left = value; |
| 175 } else { | 175 } else { |
| 176 if (isLeftToRightDirection(direction)) | 176 if (isLeftToRightDirection(direction)) |
| 177 m_bottom = value; | 177 m_bottom = value; |
| 178 else | 178 else |
| 179 m_top = value; | 179 m_top = value; |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace blink | 183 } // namespace blink |
| OLD | NEW |