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

Side by Side Diff: third_party/WebKit/Source/core/layout/CollapsedBorderValue.h

Issue 2858143003: Move condition in CollapsedBorderValue::Width() into constructor (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 : color_(0), 49 : color_(0),
50 width_(0), 50 width_(0),
51 style_(kBorderStyleNone), 51 style_(kBorderStyleNone),
52 precedence_(kBorderPrecedenceOff), 52 precedence_(kBorderPrecedenceOff),
53 transparent_(false) {} 53 transparent_(false) {}
54 54
55 CollapsedBorderValue(const BorderValue& border, 55 CollapsedBorderValue(const BorderValue& border,
56 const Color& color, 56 const Color& color,
57 EBorderPrecedence precedence) 57 EBorderPrecedence precedence)
58 : color_(color), 58 : color_(color),
59 width_(border.NonZero() ? border.Width() : 0), 59 width_(border.Style() > kBorderStyleHidden ? border.Width() : 0),
Xianzhu 2017/05/04 20:45:26 BorderValue::NonZero() is: { return Width() && (s
wkorman 2017/05/04 21:13:04 Seems like unit tests for these permutations could
Xianzhu 2017/05/04 22:23:35 Added tests.
60 style_(border.Style()), 60 style_(border.Style()),
61 precedence_(precedence), 61 precedence_(precedence),
62 transparent_(border.IsTransparent()) { 62 transparent_(border.IsTransparent()) {
63 DCHECK(precedence != kBorderPrecedenceOff); 63 DCHECK(precedence != kBorderPrecedenceOff);
64 } 64 }
65 65
66 unsigned Width() const { return style_ > kBorderStyleHidden ? width_ : 0; } 66 unsigned Width() const { return width_; }
67 EBorderStyle Style() const { return static_cast<EBorderStyle>(style_); } 67 EBorderStyle Style() const { return static_cast<EBorderStyle>(style_); }
68 bool Exists() const { return precedence_ != kBorderPrecedenceOff; } 68 bool Exists() const { return precedence_ != kBorderPrecedenceOff; }
69 Color GetColor() const { return color_; } 69 Color GetColor() const { return color_; }
70 bool IsTransparent() const { return transparent_; } 70 bool IsTransparent() const { return transparent_; }
71 EBorderPrecedence Precedence() const { 71 EBorderPrecedence Precedence() const {
72 return static_cast<EBorderPrecedence>(precedence_); 72 return static_cast<EBorderPrecedence>(precedence_);
73 } 73 }
74 74
75 bool IsSameIgnoringColor(const CollapsedBorderValue& o) const { 75 bool IsSameIgnoringColor(const CollapsedBorderValue& o) const {
76 return Width() == o.Width() && Style() == o.Style() && 76 return Width() == o.Width() && Style() == o.Style() &&
(...skipping 18 matching lines...) Expand all
95 Color color_; 95 Color color_;
96 unsigned width_ : 24; 96 unsigned width_ : 24;
97 unsigned style_ : 4; // EBorderStyle 97 unsigned style_ : 4; // EBorderStyle
98 unsigned precedence_ : 3; // EBorderPrecedence 98 unsigned precedence_ : 3; // EBorderPrecedence
99 unsigned transparent_ : 1; 99 unsigned transparent_ : 1;
100 }; 100 };
101 101
102 } // namespace blink 102 } // namespace blink
103 103
104 #endif // CollapsedBorderValue_h 104 #endif // CollapsedBorderValue_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698