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

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

Issue 2901433002: Replace NinePieceImage.setMaskDefault with static method. (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
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, 2013 Apple Inc. All rights 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2013 Apple Inc. All rights
6 * reserved. 6 * reserved.
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 public: 75 public:
76 NinePieceImage(); 76 NinePieceImage();
77 NinePieceImage(StyleImage*, 77 NinePieceImage(StyleImage*,
78 LengthBox image_slices, 78 LengthBox image_slices,
79 bool fill, 79 bool fill,
80 const BorderImageLengthBox& border_slices, 80 const BorderImageLengthBox& border_slices,
81 const BorderImageLengthBox& outset, 81 const BorderImageLengthBox& outset,
82 ENinePieceImageRule horizontal_rule, 82 ENinePieceImageRule horizontal_rule,
83 ENinePieceImageRule vertical_rule); 83 ENinePieceImageRule vertical_rule);
84 84
85 static NinePieceImage MaskDefaults() {
86 NinePieceImage image;
87 image.data_.Access()->image_slices = LengthBox(0);
88 image.data_.Access()->fill = true;
89 image.data_.Access()->border_slices = BorderImageLengthBox(Length(kAuto));
90 return image;
91 }
92
85 bool operator==(const NinePieceImage& other) const { 93 bool operator==(const NinePieceImage& other) const {
86 return data_ == other.data_; 94 return data_ == other.data_;
87 } 95 }
88 bool operator!=(const NinePieceImage& other) const { 96 bool operator!=(const NinePieceImage& other) const {
89 return data_ != other.data_; 97 return data_ != other.data_;
90 } 98 }
91 99
92 bool HasImage() const { return data_->image; } 100 bool HasImage() const { return data_->image; }
93 StyleImage* GetImage() const { return data_->image.Get(); } 101 StyleImage* GetImage() const { return data_->image.Get(); }
94 void SetImage(StyleImage* image) { data_.Access()->image = image; } 102 void SetImage(StyleImage* image) { data_.Access()->image = image; }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 146
139 void CopyOutsetFrom(const NinePieceImage& other) { 147 void CopyOutsetFrom(const NinePieceImage& other) {
140 data_.Access()->outset = other.data_->outset; 148 data_.Access()->outset = other.data_->outset;
141 } 149 }
142 150
143 void CopyRepeatFrom(const NinePieceImage& other) { 151 void CopyRepeatFrom(const NinePieceImage& other) {
144 data_.Access()->horizontal_rule = other.data_->horizontal_rule; 152 data_.Access()->horizontal_rule = other.data_->horizontal_rule;
145 data_.Access()->vertical_rule = other.data_->vertical_rule; 153 data_.Access()->vertical_rule = other.data_->vertical_rule;
146 } 154 }
147 155
148 void SetMaskDefaults() {
149 data_.Access()->image_slices = LengthBox(0);
150 data_.Access()->fill = true;
151 data_.Access()->border_slices = BorderImageLengthBox(Length(kAuto));
152 }
153
154 static LayoutUnit ComputeOutset(const BorderImageLength& outset_side, 156 static LayoutUnit ComputeOutset(const BorderImageLength& outset_side,
155 int border_side) { 157 int border_side) {
156 if (outset_side.IsNumber()) 158 if (outset_side.IsNumber())
157 return LayoutUnit(outset_side.Number() * border_side); 159 return LayoutUnit(outset_side.Number() * border_side);
158 return LayoutUnit(outset_side.length().Value()); 160 return LayoutUnit(outset_side.length().Value());
159 } 161 }
160 162
161 private: 163 private:
162 DataRef<NinePieceImageData> data_; 164 DataRef<NinePieceImageData> data_;
163 }; 165 };
164 166
165 } // namespace blink 167 } // namespace blink
166 168
167 #endif // NinePieceImage_h 169 #endif // NinePieceImage_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698