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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2591373003: Changed WritingMode to an enum class and renamed its members (Closed)
Patch Set: 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) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
4 * reserved. 4 * reserved.
5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after
2163 return unvisitedColor; 2163 return unvisitedColor;
2164 2164
2165 // Take the alpha from the unvisited color, but get the RGB values from the 2165 // Take the alpha from the unvisited color, but get the RGB values from the
2166 // visited color. 2166 // visited color.
2167 return Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), 2167 return Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(),
2168 unvisitedColor.alpha()); 2168 unvisitedColor.alpha());
2169 } 2169 }
2170 2170
2171 const BorderValue& ComputedStyle::borderBefore() const { 2171 const BorderValue& ComputedStyle::borderBefore() const {
2172 switch (getWritingMode()) { 2172 switch (getWritingMode()) {
2173 case TopToBottomWritingMode: 2173 case WritingMode::HorizontalTb:
2174 return borderTop(); 2174 return borderTop();
2175 case LeftToRightWritingMode: 2175 case WritingMode::VerticalLr:
2176 return borderLeft(); 2176 return borderLeft();
2177 case RightToLeftWritingMode: 2177 case WritingMode::VerticalRl:
2178 return borderRight(); 2178 return borderRight();
2179 } 2179 }
2180 ASSERT_NOT_REACHED(); 2180 ASSERT_NOT_REACHED();
2181 return borderTop(); 2181 return borderTop();
2182 } 2182 }
2183 2183
2184 const BorderValue& ComputedStyle::borderAfter() const { 2184 const BorderValue& ComputedStyle::borderAfter() const {
2185 switch (getWritingMode()) { 2185 switch (getWritingMode()) {
2186 case TopToBottomWritingMode: 2186 case WritingMode::HorizontalTb:
2187 return borderBottom(); 2187 return borderBottom();
2188 case LeftToRightWritingMode: 2188 case WritingMode::VerticalLr:
2189 return borderRight(); 2189 return borderRight();
2190 case RightToLeftWritingMode: 2190 case WritingMode::VerticalRl:
2191 return borderLeft(); 2191 return borderLeft();
2192 } 2192 }
2193 ASSERT_NOT_REACHED(); 2193 ASSERT_NOT_REACHED();
2194 return borderBottom(); 2194 return borderBottom();
2195 } 2195 }
2196 2196
2197 const BorderValue& ComputedStyle::borderStart() const { 2197 const BorderValue& ComputedStyle::borderStart() const {
2198 if (isHorizontalWritingMode()) 2198 if (isHorizontalWritingMode())
2199 return isLeftToRightDirection() ? borderLeft() : borderRight(); 2199 return isLeftToRightDirection() ? borderLeft() : borderRight();
2200 return isLeftToRightDirection() ? borderTop() : borderBottom(); 2200 return isLeftToRightDirection() ? borderTop() : borderBottom();
2201 } 2201 }
2202 2202
2203 const BorderValue& ComputedStyle::borderEnd() const { 2203 const BorderValue& ComputedStyle::borderEnd() const {
2204 if (isHorizontalWritingMode()) 2204 if (isHorizontalWritingMode())
2205 return isLeftToRightDirection() ? borderRight() : borderLeft(); 2205 return isLeftToRightDirection() ? borderRight() : borderLeft();
2206 return isLeftToRightDirection() ? borderBottom() : borderTop(); 2206 return isLeftToRightDirection() ? borderBottom() : borderTop();
2207 } 2207 }
2208 2208
2209 int ComputedStyle::borderBeforeWidth() const { 2209 int ComputedStyle::borderBeforeWidth() const {
2210 switch (getWritingMode()) { 2210 switch (getWritingMode()) {
2211 case TopToBottomWritingMode: 2211 case WritingMode::HorizontalTb:
2212 return borderTopWidth(); 2212 return borderTopWidth();
2213 case LeftToRightWritingMode: 2213 case WritingMode::VerticalLr:
2214 return borderLeftWidth(); 2214 return borderLeftWidth();
2215 case RightToLeftWritingMode: 2215 case WritingMode::VerticalRl:
2216 return borderRightWidth(); 2216 return borderRightWidth();
2217 } 2217 }
2218 ASSERT_NOT_REACHED(); 2218 ASSERT_NOT_REACHED();
2219 return borderTopWidth(); 2219 return borderTopWidth();
2220 } 2220 }
2221 2221
2222 int ComputedStyle::borderAfterWidth() const { 2222 int ComputedStyle::borderAfterWidth() const {
2223 switch (getWritingMode()) { 2223 switch (getWritingMode()) {
2224 case TopToBottomWritingMode: 2224 case WritingMode::HorizontalTb:
2225 return borderBottomWidth(); 2225 return borderBottomWidth();
2226 case LeftToRightWritingMode: 2226 case WritingMode::VerticalLr:
2227 return borderRightWidth(); 2227 return borderRightWidth();
2228 case RightToLeftWritingMode: 2228 case WritingMode::VerticalRl:
2229 return borderLeftWidth(); 2229 return borderLeftWidth();
2230 } 2230 }
2231 ASSERT_NOT_REACHED(); 2231 ASSERT_NOT_REACHED();
2232 return borderBottomWidth(); 2232 return borderBottomWidth();
2233 } 2233 }
2234 2234
2235 int ComputedStyle::borderStartWidth() const { 2235 int ComputedStyle::borderStartWidth() const {
2236 if (isHorizontalWritingMode()) 2236 if (isHorizontalWritingMode())
2237 return isLeftToRightDirection() ? borderLeftWidth() : borderRightWidth(); 2237 return isLeftToRightDirection() ? borderLeftWidth() : borderRightWidth();
2238 return isLeftToRightDirection() ? borderTopWidth() : borderBottomWidth(); 2238 return isLeftToRightDirection() ? borderTopWidth() : borderBottomWidth();
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2464 if (value < 0) 2464 if (value < 0)
2465 fvalue -= 0.5f; 2465 fvalue -= 0.5f;
2466 else 2466 else
2467 fvalue += 0.5f; 2467 fvalue += 0.5f;
2468 } 2468 }
2469 2469
2470 return roundForImpreciseConversion<int>(fvalue / zoomFactor); 2470 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
2471 } 2471 }
2472 2472
2473 } // namespace blink 2473 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698