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

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

Issue 2906253003: Replace call sites to BorderValue functions to save the BorderValue construction cost (Closed)
Patch Set: rune@ renames Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2117 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 } 2128 }
2129 2129
2130 float ComputedStyle::BorderOverWidth() const { 2130 float ComputedStyle::BorderOverWidth() const {
2131 return IsHorizontalWritingMode() ? BorderTopWidth() : BorderRightWidth(); 2131 return IsHorizontalWritingMode() ? BorderTopWidth() : BorderRightWidth();
2132 } 2132 }
2133 2133
2134 float ComputedStyle::BorderUnderWidth() const { 2134 float ComputedStyle::BorderUnderWidth() const {
2135 return IsHorizontalWritingMode() ? BorderBottomWidth() : BorderLeftWidth(); 2135 return IsHorizontalWritingMode() ? BorderBottomWidth() : BorderLeftWidth();
2136 } 2136 }
2137 2137
2138 EBorderStyle ComputedStyle::BorderBeforeStyle() const {
2139 switch (GetWritingMode()) {
2140 case WritingMode::kHorizontalTb:
2141 return BorderTopStyle();
2142 case WritingMode::kVerticalLr:
2143 return BorderLeftStyle();
2144 case WritingMode::kVerticalRl:
2145 return BorderRightStyle();
2146 }
2147 NOTREACHED();
2148 return BorderTopStyle();
2149 }
2150
2151 EBorderStyle ComputedStyle::BorderAfterStyle() const {
2152 switch (GetWritingMode()) {
2153 case WritingMode::kHorizontalTb:
2154 return BorderBottomStyle();
2155 case WritingMode::kVerticalLr:
2156 return BorderRightStyle();
2157 case WritingMode::kVerticalRl:
2158 return BorderLeftStyle();
2159 }
2160 NOTREACHED();
2161 return BorderBottomStyle();
2162 }
2163
2164 EBorderStyle ComputedStyle::BorderStartStyle() const {
2165 if (IsHorizontalWritingMode())
2166 return IsLeftToRightDirection() ? BorderLeftStyle() : BorderRightStyle();
2167 return IsLeftToRightDirection() ? BorderTopStyle() : BorderBottomStyle();
2168 }
2169
2170 EBorderStyle ComputedStyle::BorderEndStyle() const {
2171 if (IsHorizontalWritingMode())
2172 return IsLeftToRightDirection() ? BorderRightStyle() : BorderLeftStyle();
2173 return IsLeftToRightDirection() ? BorderBottomStyle() : BorderTopStyle();
2174 }
2175
2138 void ComputedStyle::SetMarginStart(const Length& margin) { 2176 void ComputedStyle::SetMarginStart(const Length& margin) {
2139 if (IsHorizontalWritingMode()) { 2177 if (IsHorizontalWritingMode()) {
2140 if (IsLeftToRightDirection()) 2178 if (IsLeftToRightDirection())
2141 SetMarginLeft(margin); 2179 SetMarginLeft(margin);
2142 else 2180 else
2143 SetMarginRight(margin); 2181 SetMarginRight(margin);
2144 } else { 2182 } else {
2145 if (IsLeftToRightDirection()) 2183 if (IsLeftToRightDirection())
2146 SetMarginTop(margin); 2184 SetMarginTop(margin);
2147 else 2185 else
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2344 if (value < 0) 2382 if (value < 0)
2345 fvalue -= 0.5f; 2383 fvalue -= 0.5f;
2346 else 2384 else
2347 fvalue += 0.5f; 2385 fvalue += 0.5f;
2348 } 2386 }
2349 2387
2350 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); 2388 return RoundForImpreciseConversion<int>(fvalue / zoom_factor);
2351 } 2389 }
2352 2390
2353 } // namespace blink 2391 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698