| OLD | NEW |
| (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 StyleRareInheritedData_h | |
| 26 #define StyleRareInheritedData_h | |
| 27 | |
| 28 #include "core/CoreExport.h" | |
| 29 #include "core/css/StyleAutoColor.h" | |
| 30 #include "core/css/StyleColor.h" | |
| 31 #include "core/layout/LayoutTheme.h" | |
| 32 #include "core/style/AppliedTextDecoration.h" | |
| 33 #include "core/style/AppliedTextDecorationList.h" | |
| 34 #include "core/style/CursorData.h" | |
| 35 #include "core/style/CursorList.h" | |
| 36 #include "core/style/QuotesData.h" | |
| 37 #include "core/style/ShadowData.h" | |
| 38 #include "core/style/ShadowList.h" | |
| 39 #include "core/style/StyleImage.h" | |
| 40 #include "core/style/StyleInheritedVariables.h" | |
| 41 #include "core/style/TextSizeAdjust.h" | |
| 42 #include "platform/Length.h" | |
| 43 #include "platform/graphics/Color.h" | |
| 44 #include "platform/heap/Handle.h" | |
| 45 #include "platform/text/TabSize.h" | |
| 46 #include "platform/wtf/PassRefPtr.h" | |
| 47 #include "platform/wtf/RefCounted.h" | |
| 48 #include "platform/wtf/RefVector.h" | |
| 49 #include "platform/wtf/text/AtomicString.h" | |
| 50 | |
| 51 namespace blink { | |
| 52 | |
| 53 // This struct is for rarely used inherited CSS3, CSS2, and WebKit-specific | |
| 54 // properties. By grouping them together, we save space, and only allocate this | |
| 55 // object when someone actually uses one of these properties. | |
| 56 // TODO(sashab): Move this into a private class on ComputedStyle, and remove | |
| 57 // all methods on it, merging them into copy/creation methods on ComputedStyle | |
| 58 // instead. Keep the allocation logic, only allocating a new object if needed. | |
| 59 class CORE_EXPORT StyleRareInheritedData | |
| 60 : public RefCountedCopyable<StyleRareInheritedData> { | |
| 61 public: | |
| 62 static PassRefPtr<StyleRareInheritedData> Create() { | |
| 63 return AdoptRef(new StyleRareInheritedData); | |
| 64 } | |
| 65 PassRefPtr<StyleRareInheritedData> Copy() const { | |
| 66 return AdoptRef(new StyleRareInheritedData(*this)); | |
| 67 } | |
| 68 | |
| 69 bool operator==(const StyleRareInheritedData& other) const { | |
| 70 return text_stroke_color_ == other.text_stroke_color_ && | |
| 71 text_stroke_width_ == other.text_stroke_width_ && | |
| 72 text_fill_color_ == other.text_fill_color_ && | |
| 73 text_emphasis_color_ == other.text_emphasis_color_ && | |
| 74 caret_color_ == other.caret_color_ && | |
| 75 visited_link_text_stroke_color_ == | |
| 76 other.visited_link_text_stroke_color_ && | |
| 77 visited_link_text_fill_color_ == | |
| 78 other.visited_link_text_fill_color_ && | |
| 79 visited_link_text_emphasis_color_ == | |
| 80 other.visited_link_text_emphasis_color_ && | |
| 81 visited_link_caret_color_ == other.visited_link_caret_color_ && | |
| 82 tap_highlight_color_ == other.tap_highlight_color_ && | |
| 83 DataEquivalent(text_shadow_, other.text_shadow_) && | |
| 84 highlight_ == other.highlight_ && | |
| 85 DataEquivalent(cursor_data_, other.cursor_data_) && | |
| 86 text_indent_ == other.text_indent_ && | |
| 87 effective_zoom_ == other.effective_zoom_ && | |
| 88 widows_ == other.widows_ && orphans_ == other.orphans_ && | |
| 89 text_stroke_color_is_current_color_ == | |
| 90 other.text_stroke_color_is_current_color_ && | |
| 91 text_fill_color_is_current_color_ == | |
| 92 other.text_fill_color_is_current_color_ && | |
| 93 text_emphasis_color_is_current_color_ == | |
| 94 other.text_emphasis_color_is_current_color_ && | |
| 95 caret_color_is_current_color_ == | |
| 96 other.caret_color_is_current_color_ && | |
| 97 caret_color_is_auto_ == other.caret_color_is_auto_ && | |
| 98 visited_link_text_stroke_color_is_current_color_ == | |
| 99 other.visited_link_text_stroke_color_is_current_color_ && | |
| 100 visited_link_text_fill_color_is_current_color_ == | |
| 101 other.visited_link_text_fill_color_is_current_color_ && | |
| 102 visited_link_text_emphasis_color_is_current_color_ == | |
| 103 other.visited_link_text_emphasis_color_is_current_color_ && | |
| 104 visited_link_caret_color_is_current_color_ == | |
| 105 other.visited_link_caret_color_is_current_color_ && | |
| 106 visited_link_caret_color_is_auto_ == | |
| 107 other.visited_link_caret_color_is_auto_ && | |
| 108 text_security_ == other.text_security_ && | |
| 109 user_modify_ == other.user_modify_ && | |
| 110 word_break_ == other.word_break_ && | |
| 111 overflow_wrap_ == other.overflow_wrap_ && | |
| 112 line_break_ == other.line_break_ && | |
| 113 user_select_ == other.user_select_ && speak_ == other.speak_ && | |
| 114 hyphens_ == other.hyphens_ && | |
| 115 hyphenation_limit_before_ == other.hyphenation_limit_before_ && | |
| 116 hyphenation_limit_after_ == other.hyphenation_limit_after_ && | |
| 117 hyphenation_limit_lines_ == other.hyphenation_limit_lines_ && | |
| 118 text_emphasis_fill_ == other.text_emphasis_fill_ && | |
| 119 text_emphasis_mark_ == other.text_emphasis_mark_ && | |
| 120 text_emphasis_position_ == other.text_emphasis_position_ && | |
| 121 text_align_last_ == other.text_align_last_ && | |
| 122 text_justify_ == other.text_justify_ && | |
| 123 text_orientation_ == other.text_orientation_ && | |
| 124 text_combine_ == other.text_combine_ && | |
| 125 text_indent_line_ == other.text_indent_line_ && | |
| 126 text_indent_type_ == other.text_indent_type_ && | |
| 127 subtree_will_change_contents_ == | |
| 128 other.subtree_will_change_contents_ && | |
| 129 self_or_ancestor_has_dir_auto_attribute_ == | |
| 130 other.self_or_ancestor_has_dir_auto_attribute_ && | |
| 131 respect_image_orientation_ == other.respect_image_orientation_ && | |
| 132 subtree_is_sticky_ == other.subtree_is_sticky_ && | |
| 133 hyphenation_string_ == other.hyphenation_string_ && | |
| 134 line_height_step_ == other.line_height_step_ && | |
| 135 text_emphasis_custom_mark_ == other.text_emphasis_custom_mark_ && | |
| 136 DataEquivalent(quotes_, other.quotes_) && | |
| 137 tab_size_ == other.tab_size_ && | |
| 138 image_rendering_ == other.image_rendering_ && | |
| 139 text_underline_position_ == other.text_underline_position_ && | |
| 140 text_decoration_skip_ == other.text_decoration_skip_ && | |
| 141 ruby_position_ == other.ruby_position_ && | |
| 142 DataEquivalent(list_style_image_, other.list_style_image_) && | |
| 143 DataEquivalent(applied_text_decorations_, | |
| 144 other.applied_text_decorations_) && | |
| 145 DataEquivalent(variables_, other.variables_) && | |
| 146 text_size_adjust_ == other.text_size_adjust_; | |
| 147 } | |
| 148 bool operator!=(const StyleRareInheritedData& o) const { | |
| 149 return !(*this == o); | |
| 150 } | |
| 151 | |
| 152 Persistent<StyleImage> list_style_image_; | |
| 153 | |
| 154 Color text_stroke_color_; | |
| 155 float text_stroke_width_; | |
| 156 Color text_fill_color_; | |
| 157 Color text_emphasis_color_; | |
| 158 Color caret_color_; | |
| 159 | |
| 160 Color visited_link_text_stroke_color_; | |
| 161 Color visited_link_text_fill_color_; | |
| 162 Color visited_link_text_emphasis_color_; | |
| 163 Color visited_link_caret_color_; | |
| 164 | |
| 165 RefPtr<ShadowList> | |
| 166 text_shadow_; // Our text shadow information for shadowed text drawing. | |
| 167 AtomicString | |
| 168 highlight_; // Apple-specific extension for custom highlight rendering. | |
| 169 | |
| 170 Persistent<CursorList> cursor_data_; | |
| 171 | |
| 172 Length text_indent_; | |
| 173 float effective_zoom_; | |
| 174 | |
| 175 // Paged media properties. | |
| 176 short widows_; | |
| 177 short orphans_; | |
| 178 | |
| 179 unsigned text_stroke_color_is_current_color_ : 1; | |
| 180 unsigned text_fill_color_is_current_color_ : 1; | |
| 181 unsigned text_emphasis_color_is_current_color_ : 1; | |
| 182 unsigned caret_color_is_current_color_ : 1; | |
| 183 unsigned caret_color_is_auto_ : 1; | |
| 184 unsigned visited_link_text_stroke_color_is_current_color_ : 1; | |
| 185 unsigned visited_link_text_fill_color_is_current_color_ : 1; | |
| 186 unsigned visited_link_text_emphasis_color_is_current_color_ : 1; | |
| 187 unsigned visited_link_caret_color_is_current_color_ : 1; | |
| 188 unsigned visited_link_caret_color_is_auto_ : 1; | |
| 189 | |
| 190 unsigned text_security_ : 2; // ETextSecurity | |
| 191 unsigned user_modify_ : 2; // EUserModify (editing) | |
| 192 unsigned word_break_ : 2; // EWordBreak | |
| 193 unsigned overflow_wrap_ : 1; // EOverflowWrap | |
| 194 unsigned line_break_ : 3; // LineBreak | |
| 195 unsigned user_select_ : 2; // EUserSelect | |
| 196 unsigned speak_ : 3; // ESpeak | |
| 197 unsigned hyphens_ : 2; // Hyphens | |
| 198 unsigned text_emphasis_fill_ : 1; // TextEmphasisFill | |
| 199 unsigned text_emphasis_mark_ : 3; // TextEmphasisMark | |
| 200 unsigned text_emphasis_position_ : 1; // TextEmphasisPosition | |
| 201 unsigned text_align_last_ : 3; // TextAlignLast | |
| 202 unsigned text_justify_ : 2; // TextJustify | |
| 203 unsigned text_orientation_ : 2; // TextOrientation | |
| 204 unsigned text_combine_ : 1; // CSS3 text-combine-upright properties | |
| 205 unsigned text_indent_line_ : 1; // TextIndentEachLine | |
| 206 unsigned text_indent_type_ : 1; // TextIndentHanging | |
| 207 // CSS Image Values Level 3 | |
| 208 unsigned image_rendering_ : 3; // EImageRendering | |
| 209 unsigned text_underline_position_ : 1; // TextUnderlinePosition | |
| 210 unsigned text_decoration_skip_ : 3; // TextDecorationSkip | |
| 211 unsigned ruby_position_ : 1; // RubyPosition | |
| 212 | |
| 213 // Though will-change is not itself an inherited property, the intent | |
| 214 // expressed by 'will-change: contents' includes descendants. | |
| 215 unsigned subtree_will_change_contents_ : 1; | |
| 216 | |
| 217 unsigned self_or_ancestor_has_dir_auto_attribute_ : 1; | |
| 218 | |
| 219 unsigned respect_image_orientation_ : 1; | |
| 220 | |
| 221 // Though position: sticky is not itself an inherited property, being a | |
| 222 // descendent of a sticky element changes some document lifecycle logic. | |
| 223 unsigned subtree_is_sticky_ : 1; | |
| 224 | |
| 225 AtomicString hyphenation_string_; | |
| 226 short hyphenation_limit_before_; | |
| 227 short hyphenation_limit_after_; | |
| 228 short hyphenation_limit_lines_; | |
| 229 | |
| 230 uint8_t line_height_step_; | |
| 231 | |
| 232 AtomicString text_emphasis_custom_mark_; | |
| 233 RefPtr<QuotesData> quotes_; | |
| 234 | |
| 235 Color tap_highlight_color_; | |
| 236 | |
| 237 RefPtr<AppliedTextDecorationList> applied_text_decorations_; | |
| 238 TabSize tab_size_; | |
| 239 | |
| 240 RefPtr<StyleInheritedVariables> variables_; | |
| 241 TextSizeAdjust text_size_adjust_; | |
| 242 | |
| 243 private: | |
| 244 StyleRareInheritedData() | |
| 245 : list_style_image_(nullptr), | |
| 246 text_stroke_width_(0), | |
| 247 text_indent_(Length(kFixed)), | |
| 248 effective_zoom_(1.0), | |
| 249 widows_(2), | |
| 250 orphans_(2), | |
| 251 text_stroke_color_is_current_color_(true), | |
| 252 text_fill_color_is_current_color_(true), | |
| 253 text_emphasis_color_is_current_color_(true), | |
| 254 caret_color_is_current_color_(false), | |
| 255 caret_color_is_auto_(true), | |
| 256 visited_link_text_stroke_color_is_current_color_(true), | |
| 257 visited_link_text_fill_color_is_current_color_(true), | |
| 258 visited_link_text_emphasis_color_is_current_color_(true), | |
| 259 visited_link_caret_color_is_current_color_(false), | |
| 260 visited_link_caret_color_is_auto_(true), | |
| 261 text_security_(static_cast<unsigned>(ETextSecurity::kNone)), | |
| 262 user_modify_(static_cast<unsigned>(EUserModify::kReadOnly)), | |
| 263 word_break_(static_cast<unsigned>(EWordBreak::kNormal)), | |
| 264 overflow_wrap_(static_cast<unsigned>(EOverflowWrap::kNormal)), | |
| 265 line_break_(static_cast<unsigned>(LineBreak::kAuto)), | |
| 266 user_select_(static_cast<unsigned>(EUserSelect::kText)), | |
| 267 speak_(static_cast<unsigned>(ESpeak::kNormal)), | |
| 268 hyphens_(static_cast<unsigned>(Hyphens::kManual)), | |
| 269 text_emphasis_fill_(kTextEmphasisFillFilled), | |
| 270 text_emphasis_mark_(kTextEmphasisMarkNone), | |
| 271 text_emphasis_position_(kTextEmphasisPositionOver), | |
| 272 text_align_last_(kTextAlignLastAuto), | |
| 273 text_justify_(kTextJustifyAuto), | |
| 274 text_orientation_(kTextOrientationMixed), | |
| 275 text_combine_(kTextCombineNone), | |
| 276 text_indent_line_(kTextIndentFirstLine), | |
| 277 text_indent_type_(kTextIndentNormal), | |
| 278 image_rendering_(kImageRenderingAuto), | |
| 279 text_underline_position_(kTextUnderlinePositionAuto), | |
| 280 text_decoration_skip_(kTextDecorationSkipObjects), | |
| 281 ruby_position_(kRubyPositionBefore), | |
| 282 subtree_will_change_contents_(false), | |
| 283 self_or_ancestor_has_dir_auto_attribute_(false), | |
| 284 respect_image_orientation_(false), | |
| 285 subtree_is_sticky_(false), | |
| 286 hyphenation_limit_before_(-1), | |
| 287 hyphenation_limit_after_(-1), | |
| 288 hyphenation_limit_lines_(-1), | |
| 289 line_height_step_(0), | |
| 290 tap_highlight_color_(LayoutTheme::TapHighlightColor()), | |
| 291 tab_size_(TabSize(8)), | |
| 292 text_size_adjust_(TextSizeAdjust::AdjustAuto()) {} | |
| 293 | |
| 294 StyleRareInheritedData(const StyleRareInheritedData&) = default; | |
| 295 }; | |
| 296 | |
| 297 } // namespace blink | |
| 298 | |
| 299 #endif // StyleRareInheritedData_h | |
| OLD | NEW |