Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1. // Copyright (c) 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4.  
  5. #include "core/ComputedStyleBase.h"
  6. #include "platform/wtf/SizeAssertions.h"
  7.  
  8. namespace blink {
  9.  
  10. struct SameSizeAsComputedStyleBase {
  11. void* dataRefs[4];
  12. unsigned m_bit_fields[4];
  13. };
  14.  
  15. // If this fails, the packing algorithm in make_computed_style_base.py has
  16. // failed to produce the optimal packed size. To fix, update the algorithm to
  17. // ensure that the buckets are placed so that each takes up at most 1 word.
  18. ASSERT_SIZE(ComputedStyleBase, SameSizeAsComputedStyleBase);
  19.  
  20. void ComputedStyleBase::InheritFrom(const ComputedStyleBase& other,
  21. IsAtShadowBoundary isAtShadowBoundary) {
  22. inherited_data_ = other.inherited_data_;
  23. cursor_ = other.cursor_;
  24. list_style_type_ = other.list_style_type_;
  25. pointer_events_ = other.pointer_events_;
  26. text_align_ = other.text_align_;
  27. white_space_ = other.white_space_;
  28. inside_link_ = other.inside_link_;
  29. text_transform_ = other.text_transform_;
  30. visibility_ = other.visibility_;
  31. writing_mode_ = other.writing_mode_;
  32. border_collapse_ = other.border_collapse_;
  33. box_direction_ = other.box_direction_;
  34. caption_side_ = other.caption_side_;
  35. direction_ = other.direction_;
  36. empty_cells_ = other.empty_cells_;
  37. has_simple_underline_ = other.has_simple_underline_;
  38. list_style_position_ = other.list_style_position_;
  39. print_color_adjust_ = other.print_color_adjust_;
  40. rtl_ordering_ = other.rtl_ordering_;
  41. }
  42.  
  43. void ComputedStyleBase::CopyNonInheritedFromCached(
  44. const ComputedStyleBase& other) {
  45. visual_data_ = other.visual_data_;
  46. background_data_ = other.background_data_;
  47. surround_data_ = other.surround_data_;
  48. display_ = other.display_;
  49. break_after_ = other.break_after_;
  50. break_before_ = other.break_before_;
  51. overflow_x_ = other.overflow_x_;
  52. overflow_y_ = other.overflow_y_;
  53. position_ = other.position_;
  54. unicode_bidi_ = other.unicode_bidi_;
  55. break_inside_ = other.break_inside_;
  56. clear_ = other.clear_;
  57. floating_ = other.floating_;
  58. overflow_anchor_ = other.overflow_anchor_;
  59. transform_box_ = other.transform_box_;
  60. border_collapse_is_inherited_ = other.border_collapse_is_inherited_;
  61. box_direction_is_inherited_ = other.box_direction_is_inherited_;
  62. caption_side_is_inherited_ = other.caption_side_is_inherited_;
  63. empty_cells_is_inherited_ = other.empty_cells_is_inherited_;
  64. list_style_position_is_inherited_ = other.list_style_position_is_inherited_;
  65. pointer_events_is_inherited_ = other.pointer_events_is_inherited_;
  66. print_color_adjust_is_inherited_ = other.print_color_adjust_is_inherited_;
  67. rtl_ordering_is_inherited_ = other.rtl_ordering_is_inherited_;
  68. table_layout_ = other.table_layout_;
  69. text_align_is_inherited_ = other.text_align_is_inherited_;
  70. text_transform_is_inherited_ = other.text_transform_is_inherited_;
  71. visibility_is_inherited_ = other.visibility_is_inherited_;
  72. white_space_is_inherited_ = other.white_space_is_inherited_;
  73. }
  74.  
  75. void ComputedStyleBase::PropagateIndependentInheritedProperties(
  76. const ComputedStyleBase& parentStyle) {
  77. if (PointerEventsIsInherited())
  78. pointer_events_ = parentStyle.pointer_events_;
  79. if (TextAlignIsInherited())
  80. text_align_ = parentStyle.text_align_;
  81. if (WhiteSpaceIsInherited())
  82. white_space_ = parentStyle.white_space_;
  83. if (TextTransformIsInherited())
  84. text_transform_ = parentStyle.text_transform_;
  85. if (VisibilityIsInherited())
  86. visibility_ = parentStyle.visibility_;
  87. if (BorderCollapseIsInherited())
  88. border_collapse_ = parentStyle.border_collapse_;
  89. if (BoxDirectionIsInherited())
  90. box_direction_ = parentStyle.box_direction_;
  91. if (CaptionSideIsInherited())
  92. caption_side_ = parentStyle.caption_side_;
  93. if (EmptyCellsIsInherited())
  94. empty_cells_ = parentStyle.empty_cells_;
  95. if (ListStylePositionIsInherited())
  96. list_style_position_ = parentStyle.list_style_position_;
  97. if (PrintColorAdjustIsInherited())
  98. print_color_adjust_ = parentStyle.print_color_adjust_;
  99. if (RtlOrderingIsInherited())
  100. rtl_ordering_ = parentStyle.rtl_ordering_;
  101. }
  102.  
  103. } // namespace blink
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement