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

Side by Side Diff: third_party/WebKit/Source/core/style/StyleInheritedData.h

Issue 2882123002: Move StyleInheritedData.h to a nested class in ComputedStyle. (Closed)
Patch Set: Rebase 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 | « third_party/WebKit/Source/core/style/ComputedStyle.cpp ('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
(Empty)
1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 *
23 */
24
25 #ifndef StyleInheritedData_h
26 #define StyleInheritedData_h
27
28 #include "core/CoreExport.h"
29 #include "platform/Length.h"
30 #include "platform/fonts/Font.h"
31 #include "platform/graphics/Color.h"
32 #include "platform/wtf/PassRefPtr.h"
33 #include "platform/wtf/RefCounted.h"
34
35 namespace blink {
36
37 // TODO(sashab): Move this into a private class on ComputedStyle, and remove
38 // all methods on it, merging them into copy/creation methods on ComputedStyle
39 // instead. Keep the allocation logic, only allocating a new object if needed.
40 class CORE_EXPORT StyleInheritedData
41 : public RefCountedCopyable<StyleInheritedData> {
42 public:
43 static PassRefPtr<StyleInheritedData> Create() {
44 return AdoptRef(new StyleInheritedData);
45 }
46 PassRefPtr<StyleInheritedData> Copy() const {
47 return AdoptRef(new StyleInheritedData(*this));
48 }
49
50 bool operator==(const StyleInheritedData& other) const {
51 return line_height_ == other.line_height_ && font_ == other.font_ &&
52 color_ == other.color_ &&
53 visited_link_color_ == other.visited_link_color_ &&
54 horizontal_border_spacing_ == other.horizontal_border_spacing_ &&
55 text_autosizing_multiplier_ == other.text_autosizing_multiplier_ &&
56 vertical_border_spacing_ == other.vertical_border_spacing_;
57 }
58 bool operator!=(const StyleInheritedData& o) const { return !(*this == o); }
59
60 short horizontal_border_spacing_;
61 short vertical_border_spacing_;
62
63 // could be packed in a short but doesn't
64 // make a difference currently because of padding
65 Length line_height_;
66
67 Font font_;
68 Color color_;
69 Color visited_link_color_;
70 float text_autosizing_multiplier_;
71
72 private:
73 StyleInheritedData()
74 : horizontal_border_spacing_(0),
75 vertical_border_spacing_(0),
76 line_height_(Length(-100.0, kPercent)),
77 color_(Color::kBlack),
78 visited_link_color_(Color::kBlack),
79 text_autosizing_multiplier_(1) {}
80
81 StyleInheritedData(const StyleInheritedData&) = default;
82 };
83
84 } // namespace blink
85
86 #endif // StyleInheritedData_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698