OLD | NEW |
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, 2009, 2010, 2011 Apple Inc. All | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
6 * rights reserved. | 6 * rights reserved. |
7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 friend class ColorPropertyFunctions; | 188 friend class ColorPropertyFunctions; |
189 | 189 |
190 // FIXME: When we stop resolving currentColor at style time, these can be | 190 // FIXME: When we stop resolving currentColor at style time, these can be |
191 // removed. | 191 // removed. |
192 friend class CSSToStyleMap; | 192 friend class CSSToStyleMap; |
193 friend class FilterOperationResolver; | 193 friend class FilterOperationResolver; |
194 friend class StyleBuilderConverter; | 194 friend class StyleBuilderConverter; |
195 friend class StyleResolverState; | 195 friend class StyleResolverState; |
196 friend class StyleResolver; | 196 friend class StyleResolver; |
197 | 197 |
198 private: | |
199 // This struct is for rarely used inherited CSS3, CSS2, and WebKit-specific | |
200 // properties. By grouping them together, we save space, and only allocate | |
201 // this object when someone actually uses one of these properties. | |
202 class StyleRareInheritedData | |
203 : public RefCountedCopyable<StyleRareInheritedData> { | |
204 public: | |
205 static PassRefPtr<StyleRareInheritedData> Create() { | |
206 return AdoptRef(new StyleRareInheritedData); | |
207 } | |
208 PassRefPtr<StyleRareInheritedData> Copy() const { | |
209 return AdoptRef(new StyleRareInheritedData(*this)); | |
210 } | |
211 | |
212 bool operator==(const StyleRareInheritedData& other) const { | |
213 return text_stroke_color_ == other.text_stroke_color_ && | |
214 text_stroke_width_ == other.text_stroke_width_ && | |
215 text_fill_color_ == other.text_fill_color_ && | |
216 text_emphasis_color_ == other.text_emphasis_color_ && | |
217 caret_color_ == other.caret_color_ && | |
218 visited_link_text_stroke_color_ == | |
219 other.visited_link_text_stroke_color_ && | |
220 visited_link_text_fill_color_ == | |
221 other.visited_link_text_fill_color_ && | |
222 visited_link_text_emphasis_color_ == | |
223 other.visited_link_text_emphasis_color_ && | |
224 visited_link_caret_color_ == other.visited_link_caret_color_ && | |
225 tap_highlight_color_ == other.tap_highlight_color_ && | |
226 DataEquivalent(text_shadow_, other.text_shadow_) && | |
227 highlight_ == other.highlight_ && | |
228 DataEquivalent(cursor_data_, other.cursor_data_) && | |
229 text_indent_ == other.text_indent_ && | |
230 effective_zoom_ == other.effective_zoom_ && | |
231 widows_ == other.widows_ && orphans_ == other.orphans_ && | |
232 text_stroke_color_is_current_color_ == | |
233 other.text_stroke_color_is_current_color_ && | |
234 text_fill_color_is_current_color_ == | |
235 other.text_fill_color_is_current_color_ && | |
236 text_emphasis_color_is_current_color_ == | |
237 other.text_emphasis_color_is_current_color_ && | |
238 caret_color_is_current_color_ == | |
239 other.caret_color_is_current_color_ && | |
240 caret_color_is_auto_ == other.caret_color_is_auto_ && | |
241 visited_link_text_stroke_color_is_current_color_ == | |
242 other.visited_link_text_stroke_color_is_current_color_ && | |
243 visited_link_text_fill_color_is_current_color_ == | |
244 other.visited_link_text_fill_color_is_current_color_ && | |
245 visited_link_text_emphasis_color_is_current_color_ == | |
246 other.visited_link_text_emphasis_color_is_current_color_ && | |
247 visited_link_caret_color_is_current_color_ == | |
248 other.visited_link_caret_color_is_current_color_ && | |
249 visited_link_caret_color_is_auto_ == | |
250 other.visited_link_caret_color_is_auto_ && | |
251 text_security_ == other.text_security_ && | |
252 user_modify_ == other.user_modify_ && | |
253 word_break_ == other.word_break_ && | |
254 overflow_wrap_ == other.overflow_wrap_ && | |
255 line_break_ == other.line_break_ && | |
256 user_select_ == other.user_select_ && speak_ == other.speak_ && | |
257 hyphens_ == other.hyphens_ && | |
258 hyphenation_limit_before_ == other.hyphenation_limit_before_ && | |
259 hyphenation_limit_after_ == other.hyphenation_limit_after_ && | |
260 hyphenation_limit_lines_ == other.hyphenation_limit_lines_ && | |
261 text_emphasis_fill_ == other.text_emphasis_fill_ && | |
262 text_emphasis_mark_ == other.text_emphasis_mark_ && | |
263 text_emphasis_position_ == other.text_emphasis_position_ && | |
264 text_align_last_ == other.text_align_last_ && | |
265 text_justify_ == other.text_justify_ && | |
266 text_orientation_ == other.text_orientation_ && | |
267 text_combine_ == other.text_combine_ && | |
268 text_indent_line_ == other.text_indent_line_ && | |
269 text_indent_type_ == other.text_indent_type_ && | |
270 subtree_will_change_contents_ == | |
271 other.subtree_will_change_contents_ && | |
272 self_or_ancestor_has_dir_auto_attribute_ == | |
273 other.self_or_ancestor_has_dir_auto_attribute_ && | |
274 respect_image_orientation_ == other.respect_image_orientation_ && | |
275 subtree_is_sticky_ == other.subtree_is_sticky_ && | |
276 hyphenation_string_ == other.hyphenation_string_ && | |
277 line_height_step_ == other.line_height_step_ && | |
278 text_emphasis_custom_mark_ == other.text_emphasis_custom_mark_ && | |
279 DataEquivalent(quotes_, other.quotes_) && | |
280 tab_size_ == other.tab_size_ && | |
281 image_rendering_ == other.image_rendering_ && | |
282 text_underline_position_ == other.text_underline_position_ && | |
283 text_decoration_skip_ == other.text_decoration_skip_ && | |
284 ruby_position_ == other.ruby_position_ && | |
285 DataEquivalent(list_style_image_, other.list_style_image_) && | |
286 DataEquivalent(applied_text_decorations_, | |
287 other.applied_text_decorations_) && | |
288 DataEquivalent(variables_, other.variables_) && | |
289 text_size_adjust_ == other.text_size_adjust_; | |
290 } | |
291 bool operator!=(const StyleRareInheritedData& o) const { | |
292 return !(*this == o); | |
293 } | |
294 | |
295 Persistent<StyleImage> list_style_image_; | |
296 | |
297 Color text_stroke_color_; | |
298 float text_stroke_width_; | |
299 Color text_fill_color_; | |
300 Color text_emphasis_color_; | |
301 Color caret_color_; | |
302 | |
303 Color visited_link_text_stroke_color_; | |
304 Color visited_link_text_fill_color_; | |
305 Color visited_link_text_emphasis_color_; | |
306 Color visited_link_caret_color_; | |
307 | |
308 RefPtr<ShadowList> | |
309 text_shadow_; // Our text shadow information for shadowed text drawing. | |
310 AtomicString | |
311 highlight_; // Apple-specific extension for custom highlight rendering. | |
312 | |
313 Persistent<CursorList> cursor_data_; | |
314 | |
315 Length text_indent_; | |
316 float effective_zoom_; | |
317 | |
318 // Paged media properties. | |
319 short widows_; | |
320 short orphans_; | |
321 | |
322 unsigned text_stroke_color_is_current_color_ : 1; | |
323 unsigned text_fill_color_is_current_color_ : 1; | |
324 unsigned text_emphasis_color_is_current_color_ : 1; | |
325 unsigned caret_color_is_current_color_ : 1; | |
326 unsigned caret_color_is_auto_ : 1; | |
327 unsigned visited_link_text_stroke_color_is_current_color_ : 1; | |
328 unsigned visited_link_text_fill_color_is_current_color_ : 1; | |
329 unsigned visited_link_text_emphasis_color_is_current_color_ : 1; | |
330 unsigned visited_link_caret_color_is_current_color_ : 1; | |
331 unsigned visited_link_caret_color_is_auto_ : 1; | |
332 | |
333 unsigned text_security_ : 2; // ETextSecurity | |
334 unsigned user_modify_ : 2; // EUserModify (editing) | |
335 unsigned word_break_ : 2; // EWordBreak | |
336 unsigned overflow_wrap_ : 1; // EOverflowWrap | |
337 unsigned line_break_ : 3; // LineBreak | |
338 unsigned user_select_ : 2; // EUserSelect | |
339 unsigned speak_ : 3; // ESpeak | |
340 unsigned hyphens_ : 2; // Hyphens | |
341 unsigned text_emphasis_fill_ : 1; // TextEmphasisFill | |
342 unsigned text_emphasis_mark_ : 3; // TextEmphasisMark | |
343 unsigned text_emphasis_position_ : 1; // TextEmphasisPosition | |
344 unsigned text_align_last_ : 3; // TextAlignLast | |
345 unsigned text_justify_ : 2; // TextJustify | |
346 unsigned text_orientation_ : 2; // TextOrientation | |
347 unsigned text_combine_ : 1; // CSS3 text-combine-upright properties | |
348 unsigned text_indent_line_ : 1; // TextIndentEachLine | |
349 unsigned text_indent_type_ : 1; // TextIndentHanging | |
350 // CSS Image Values Level 3 | |
351 unsigned image_rendering_ : 3; // EImageRendering | |
352 unsigned text_underline_position_ : 1; // TextUnderlinePosition | |
353 unsigned text_decoration_skip_ : 3; // TextDecorationSkip | |
354 unsigned ruby_position_ : 1; // RubyPosition | |
355 | |
356 // Though will-change is not itself an inherited property, the intent | |
357 // expressed by 'will-change: contents' includes descendants. | |
358 unsigned subtree_will_change_contents_ : 1; | |
359 | |
360 unsigned self_or_ancestor_has_dir_auto_attribute_ : 1; | |
361 | |
362 unsigned respect_image_orientation_ : 1; | |
363 | |
364 // Though position: sticky is not itself an inherited property, being a | |
365 // descendent of a sticky element changes some document lifecycle logic. | |
366 unsigned subtree_is_sticky_ : 1; | |
367 | |
368 AtomicString hyphenation_string_; | |
369 short hyphenation_limit_before_; | |
370 short hyphenation_limit_after_; | |
371 short hyphenation_limit_lines_; | |
372 | |
373 uint8_t line_height_step_; | |
374 | |
375 AtomicString text_emphasis_custom_mark_; | |
376 RefPtr<QuotesData> quotes_; | |
377 | |
378 Color tap_highlight_color_; | |
379 | |
380 RefPtr<AppliedTextDecorationList> applied_text_decorations_; | |
381 TabSize tab_size_; | |
382 | |
383 RefPtr<StyleInheritedVariables> variables_; | |
384 TextSizeAdjust text_size_adjust_; | |
385 | |
386 private: | |
387 StyleRareInheritedData() | |
388 : list_style_image_(nullptr), | |
389 text_stroke_width_(0), | |
390 text_indent_(Length(kFixed)), | |
391 effective_zoom_(1.0), | |
392 widows_(2), | |
393 orphans_(2), | |
394 text_stroke_color_is_current_color_(true), | |
395 text_fill_color_is_current_color_(true), | |
396 text_emphasis_color_is_current_color_(true), | |
397 caret_color_is_current_color_(false), | |
398 caret_color_is_auto_(true), | |
399 visited_link_text_stroke_color_is_current_color_(true), | |
400 visited_link_text_fill_color_is_current_color_(true), | |
401 visited_link_text_emphasis_color_is_current_color_(true), | |
402 visited_link_caret_color_is_current_color_(false), | |
403 visited_link_caret_color_is_auto_(true), | |
404 text_security_(static_cast<unsigned>(ETextSecurity::kNone)), | |
405 user_modify_(static_cast<unsigned>(EUserModify::kReadOnly)), | |
406 word_break_(static_cast<unsigned>(EWordBreak::kNormal)), | |
407 overflow_wrap_(static_cast<unsigned>(EOverflowWrap::kNormal)), | |
408 line_break_(static_cast<unsigned>(LineBreak::kAuto)), | |
409 user_select_(static_cast<unsigned>(EUserSelect::kText)), | |
410 speak_(static_cast<unsigned>(ESpeak::kNormal)), | |
411 hyphens_(static_cast<unsigned>(Hyphens::kManual)), | |
412 text_emphasis_fill_(kTextEmphasisFillFilled), | |
413 text_emphasis_mark_(kTextEmphasisMarkNone), | |
414 text_emphasis_position_(kTextEmphasisPositionOver), | |
415 text_align_last_(kTextAlignLastAuto), | |
416 text_justify_(kTextJustifyAuto), | |
417 text_orientation_(kTextOrientationMixed), | |
418 text_combine_(kTextCombineNone), | |
419 text_indent_line_(kTextIndentFirstLine), | |
420 text_indent_type_(kTextIndentNormal), | |
421 image_rendering_(kImageRenderingAuto), | |
422 text_underline_position_(kTextUnderlinePositionAuto), | |
423 text_decoration_skip_(kTextDecorationSkipObjects), | |
424 ruby_position_(kRubyPositionBefore), | |
425 subtree_will_change_contents_(false), | |
426 self_or_ancestor_has_dir_auto_attribute_(false), | |
427 respect_image_orientation_(false), | |
428 subtree_is_sticky_(false), | |
429 hyphenation_limit_before_(-1), | |
430 hyphenation_limit_after_(-1), | |
431 hyphenation_limit_lines_(-1), | |
432 line_height_step_(0), | |
433 tap_highlight_color_(LayoutTheme::TapHighlightColor()), | |
434 tab_size_(TabSize(8)), | |
435 text_size_adjust_(TextSizeAdjust::AdjustAuto()) {} | |
436 | |
437 StyleRareInheritedData(const StyleRareInheritedData&) = default; | |
438 }; | |
439 | |
440 protected: | 198 protected: |
441 // non-inherited attributes | 199 // non-inherited attributes |
442 DataRef<StyleRareNonInheritedData> rare_non_inherited_data_; | 200 DataRef<StyleRareNonInheritedData> rare_non_inherited_data_; |
443 | 201 |
444 // inherited attributes | |
445 DataRef<StyleRareInheritedData> rare_inherited_data_; | |
446 | |
447 // list of associated pseudo styles | 202 // list of associated pseudo styles |
448 std::unique_ptr<PseudoStyleCache> cached_pseudo_styles_; | 203 std::unique_ptr<PseudoStyleCache> cached_pseudo_styles_; |
449 | 204 |
450 DataRef<SVGComputedStyle> svg_style_; | 205 DataRef<SVGComputedStyle> svg_style_; |
451 | 206 |
452 private: | 207 private: |
453 // TODO(sashab): Move these private members to the bottom of ComputedStyle. | 208 // TODO(sashab): Move these private members to the bottom of ComputedStyle. |
454 ALWAYS_INLINE ComputedStyle(); | 209 ALWAYS_INLINE ComputedStyle(); |
455 ALWAYS_INLINE ComputedStyle(const ComputedStyle&); | 210 ALWAYS_INLINE ComputedStyle(const ComputedStyle&); |
456 | 211 |
(...skipping 3566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4023 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); | 3778 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); |
4024 } | 3779 } |
4025 | 3780 |
4026 inline bool ComputedStyle::HasPseudoElementStyle() const { | 3781 inline bool ComputedStyle::HasPseudoElementStyle() const { |
4027 return PseudoBitsInternal() & kElementPseudoIdMask; | 3782 return PseudoBitsInternal() & kElementPseudoIdMask; |
4028 } | 3783 } |
4029 | 3784 |
4030 } // namespace blink | 3785 } // namespace blink |
4031 | 3786 |
4032 #endif // ComputedStyle_h | 3787 #endif // ComputedStyle_h |
OLD | NEW |