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 30 matching lines...) Expand all Loading... |
41 const Length& LengthBox::logicalRight(WritingMode writingMode) const | 41 const Length& LengthBox::logicalRight(WritingMode writingMode) const |
42 { | 42 { |
43 return isHorizontalWritingMode(writingMode) ? m_right : m_bottom; | 43 return isHorizontalWritingMode(writingMode) ? m_right : m_bottom; |
44 } | 44 } |
45 | 45 |
46 const Length& LengthBox::before(WritingMode writingMode) const | 46 const Length& LengthBox::before(WritingMode writingMode) const |
47 { | 47 { |
48 switch (writingMode) { | 48 switch (writingMode) { |
49 case TopToBottomWritingMode: | 49 case TopToBottomWritingMode: |
50 return m_top; | 50 return m_top; |
51 case BottomToTopWritingMode: | |
52 return m_bottom; | |
53 case LeftToRightWritingMode: | 51 case LeftToRightWritingMode: |
54 return m_left; | 52 return m_left; |
55 case RightToLeftWritingMode: | 53 case RightToLeftWritingMode: |
56 return m_right; | 54 return m_right; |
57 } | 55 } |
58 ASSERT_NOT_REACHED(); | 56 ASSERT_NOT_REACHED(); |
59 return m_top; | 57 return m_top; |
60 } | 58 } |
61 | 59 |
62 const Length& LengthBox::after(WritingMode writingMode) const | 60 const Length& LengthBox::after(WritingMode writingMode) const |
63 { | 61 { |
64 switch (writingMode) { | 62 switch (writingMode) { |
65 case TopToBottomWritingMode: | 63 case TopToBottomWritingMode: |
66 return m_bottom; | 64 return m_bottom; |
67 case BottomToTopWritingMode: | |
68 return m_top; | |
69 case LeftToRightWritingMode: | 65 case LeftToRightWritingMode: |
70 return m_right; | 66 return m_right; |
71 case RightToLeftWritingMode: | 67 case RightToLeftWritingMode: |
72 return m_left; | 68 return m_left; |
73 } | 69 } |
74 ASSERT_NOT_REACHED(); | 70 ASSERT_NOT_REACHED(); |
75 return m_bottom; | 71 return m_bottom; |
76 } | 72 } |
77 | 73 |
78 const Length& LengthBox::start(WritingMode writingMode, TextDirection direction)
const | 74 const Length& LengthBox::start(WritingMode writingMode, TextDirection direction)
const |
79 { | 75 { |
80 if (isHorizontalWritingMode(writingMode)) | 76 if (isHorizontalWritingMode(writingMode)) |
81 return isLeftToRightDirection(direction) ? m_left : m_right; | 77 return isLeftToRightDirection(direction) ? m_left : m_right; |
82 return isLeftToRightDirection(direction) ? m_top : m_bottom; | 78 return isLeftToRightDirection(direction) ? m_top : m_bottom; |
83 } | 79 } |
84 | 80 |
85 const Length& LengthBox::end(WritingMode writingMode, TextDirection direction) c
onst | 81 const Length& LengthBox::end(WritingMode writingMode, TextDirection direction) c
onst |
86 { | 82 { |
87 if (isHorizontalWritingMode(writingMode)) | 83 if (isHorizontalWritingMode(writingMode)) |
88 return isLeftToRightDirection(direction) ? m_right : m_left; | 84 return isLeftToRightDirection(direction) ? m_right : m_left; |
89 return isLeftToRightDirection(direction) ? m_bottom : m_top; | 85 return isLeftToRightDirection(direction) ? m_bottom : m_top; |
90 } | 86 } |
91 | 87 |
92 } // namespace blink | 88 } // namespace blink |
OLD | NEW |