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

Side by Side Diff: third_party/WebKit/Source/platform/LengthBox.cpp

Issue 2591373003: Changed WritingMode to an enum class and renamed its members (Closed)
Patch Set: Added comment Created 3 years, 12 months 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
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 24 matching lines...) Expand all
35 const Length& LengthBox::logicalLeft(WritingMode writingMode) const { 35 const Length& LengthBox::logicalLeft(WritingMode writingMode) const {
36 return isHorizontalWritingMode(writingMode) ? m_left : m_top; 36 return isHorizontalWritingMode(writingMode) ? m_left : m_top;
37 } 37 }
38 38
39 const Length& LengthBox::logicalRight(WritingMode writingMode) const { 39 const Length& LengthBox::logicalRight(WritingMode writingMode) const {
40 return isHorizontalWritingMode(writingMode) ? m_right : m_bottom; 40 return isHorizontalWritingMode(writingMode) ? m_right : m_bottom;
41 } 41 }
42 42
43 const Length& LengthBox::before(WritingMode writingMode) const { 43 const Length& LengthBox::before(WritingMode writingMode) const {
44 switch (writingMode) { 44 switch (writingMode) {
45 case TopToBottomWritingMode: 45 case WritingMode::HorizontalTb:
46 return m_top; 46 return m_top;
47 case LeftToRightWritingMode: 47 case WritingMode::VerticalLr:
48 return m_left; 48 return m_left;
49 case RightToLeftWritingMode: 49 case WritingMode::VerticalRl:
50 return m_right; 50 return m_right;
51 } 51 }
52 ASSERT_NOT_REACHED(); 52 ASSERT_NOT_REACHED();
53 return m_top; 53 return m_top;
54 } 54 }
55 55
56 const Length& LengthBox::after(WritingMode writingMode) const { 56 const Length& LengthBox::after(WritingMode writingMode) const {
57 switch (writingMode) { 57 switch (writingMode) {
58 case TopToBottomWritingMode: 58 case WritingMode::HorizontalTb:
59 return m_bottom; 59 return m_bottom;
60 case LeftToRightWritingMode: 60 case WritingMode::VerticalLr:
61 return m_right; 61 return m_right;
62 case RightToLeftWritingMode: 62 case WritingMode::VerticalRl:
63 return m_left; 63 return m_left;
64 } 64 }
65 ASSERT_NOT_REACHED(); 65 ASSERT_NOT_REACHED();
66 return m_bottom; 66 return m_bottom;
67 } 67 }
68 68
69 const Length& LengthBox::start(WritingMode writingMode, 69 const Length& LengthBox::start(WritingMode writingMode,
70 TextDirection direction) const { 70 TextDirection direction) const {
71 if (isHorizontalWritingMode(writingMode)) 71 if (isHorizontalWritingMode(writingMode))
72 return isLeftToRightDirection(direction) ? m_left : m_right; 72 return isLeftToRightDirection(direction) ? m_left : m_right;
73 return isLeftToRightDirection(direction) ? m_top : m_bottom; 73 return isLeftToRightDirection(direction) ? m_top : m_bottom;
74 } 74 }
75 75
76 const Length& LengthBox::end(WritingMode writingMode, 76 const Length& LengthBox::end(WritingMode writingMode,
77 TextDirection direction) const { 77 TextDirection direction) const {
78 if (isHorizontalWritingMode(writingMode)) 78 if (isHorizontalWritingMode(writingMode))
79 return isLeftToRightDirection(direction) ? m_right : m_left; 79 return isLeftToRightDirection(direction) ? m_right : m_left;
80 return isLeftToRightDirection(direction) ? m_bottom : m_top; 80 return isLeftToRightDirection(direction) ? m_bottom : m_top;
81 } 81 }
82 82
83 const Length& LengthBox::over(WritingMode writingMode) const { 83 const Length& LengthBox::over(WritingMode writingMode) const {
84 return isHorizontalWritingMode(writingMode) ? m_top : m_right; 84 return isHorizontalWritingMode(writingMode) ? m_top : m_right;
85 } 85 }
86 86
87 const Length& LengthBox::under(WritingMode writingMode) const { 87 const Length& LengthBox::under(WritingMode writingMode) const {
88 return isHorizontalWritingMode(writingMode) ? m_bottom : m_left; 88 return isHorizontalWritingMode(writingMode) ? m_bottom : m_left;
89 } 89 }
90 90
91 } // namespace blink 91 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698