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

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: Redo LayoutTable/LayoutTableSection 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
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 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2118 } 2118 }
2119 2119
2120 float ComputedStyle::BorderOverWidth() const { 2120 float ComputedStyle::BorderOverWidth() const {
2121 return IsHorizontalWritingMode() ? BorderTopWidth() : BorderRightWidth(); 2121 return IsHorizontalWritingMode() ? BorderTopWidth() : BorderRightWidth();
2122 } 2122 }
2123 2123
2124 float ComputedStyle::BorderUnderWidth() const { 2124 float ComputedStyle::BorderUnderWidth() const {
2125 return IsHorizontalWritingMode() ? BorderBottomWidth() : BorderLeftWidth(); 2125 return IsHorizontalWritingMode() ? BorderBottomWidth() : BorderLeftWidth();
2126 } 2126 }
2127 2127
2128 EBorderStyle ComputedStyle::BorderBeforeStyle() const {
2129 switch (GetWritingMode()) {
2130 case WritingMode::kHorizontalTb:
2131 return BorderTopStyle();
2132 case WritingMode::kVerticalLr:
2133 return BorderLeftStyle();
2134 case WritingMode::kVerticalRl:
2135 return BorderRightStyle();
2136 }
2137 NOTREACHED();
2138 return BorderTopStyle();
2139 }
2140
2141 EBorderStyle ComputedStyle::BorderAfterStyle() const {
2142 switch (GetWritingMode()) {
2143 case WritingMode::kHorizontalTb:
2144 return BorderBottomStyle();
2145 case WritingMode::kVerticalLr:
2146 return BorderRightStyle();
2147 case WritingMode::kVerticalRl:
2148 return BorderLeftStyle();
2149 }
2150 NOTREACHED();
2151 return BorderBottomStyle();
2152 }
2153
2154 EBorderStyle ComputedStyle::BorderStartStyle() const {
2155 if (IsHorizontalWritingMode())
2156 return IsLeftToRightDirection() ? BorderLeftStyle() : BorderRightStyle();
2157 return IsLeftToRightDirection() ? BorderTopStyle() : BorderBottomStyle();
2158 }
2159
2160 EBorderStyle ComputedStyle::BorderEndStyle() const {
2161 if (IsHorizontalWritingMode())
2162 return IsLeftToRightDirection() ? BorderRightStyle() : BorderLeftStyle();
2163 return IsLeftToRightDirection() ? BorderBottomStyle() : BorderTopStyle();
2164 }
2165
2128 void ComputedStyle::SetMarginStart(const Length& margin) { 2166 void ComputedStyle::SetMarginStart(const Length& margin) {
2129 if (IsHorizontalWritingMode()) { 2167 if (IsHorizontalWritingMode()) {
2130 if (IsLeftToRightDirection()) 2168 if (IsLeftToRightDirection())
2131 SetMarginLeft(margin); 2169 SetMarginLeft(margin);
2132 else 2170 else
2133 SetMarginRight(margin); 2171 SetMarginRight(margin);
2134 } else { 2172 } else {
2135 if (IsLeftToRightDirection()) 2173 if (IsLeftToRightDirection())
2136 SetMarginTop(margin); 2174 SetMarginTop(margin);
2137 else 2175 else
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 if (value < 0) 2372 if (value < 0)
2335 fvalue -= 0.5f; 2373 fvalue -= 0.5f;
2336 else 2374 else
2337 fvalue += 0.5f; 2375 fvalue += 0.5f;
2338 } 2376 }
2339 2377
2340 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); 2378 return RoundForImpreciseConversion<int>(fvalue / zoom_factor);
2341 } 2379 }
2342 2380
2343 } // namespace blink 2381 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698