blob: ad9de43a655c9e560a90147e3acf69e08248c39b [file] [log] [blame]
// Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "core/ComputedStyleBase.h"
#include "platform/wtf/SizeAssertions.h"
namespace blink {
struct SameSizeAsComputedStyleBase {
void* dataRefs[2];
unsigned m_bit_fields[4];
};
// If this fails, the packing algorithm in make_computed_style_base.py has
// failed to produce the optimal packed size. To fix, update the algorithm to
// ensure that the buckets are placed so that each takes up at most 1 word.
ASSERT_SIZE(ComputedStyleBase, SameSizeAsComputedStyleBase);
void ComputedStyleBase::InheritFrom(const ComputedStyleBase& other,
IsAtShadowBoundary isAtShadowBoundary) {
cursor_ = other.cursor_;
list_style_type_ = other.list_style_type_;
pointer_events_ = other.pointer_events_;
text_align_ = other.text_align_;
white_space_ = other.white_space_;
inside_link_ = other.inside_link_;
text_transform_ = other.text_transform_;
visibility_ = other.visibility_;
writing_mode_ = other.writing_mode_;
border_collapse_ = other.border_collapse_;
box_direction_ = other.box_direction_;
caption_side_ = other.caption_side_;
direction_ = other.direction_;
empty_cells_ = other.empty_cells_;
has_simple_underline_ = other.has_simple_underline_;
list_style_position_ = other.list_style_position_;
print_color_adjust_ = other.print_color_adjust_;
rtl_ordering_ = other.rtl_ordering_;
}
void ComputedStyleBase::CopyNonInheritedFromCached(
const ComputedStyleBase& other) {
background_data_ = other.background_data_;
surround_data_ = other.surround_data_;
display_ = other.display_;
original_display_ = other.original_display_;
break_after_ = other.break_after_;
break_before_ = other.break_before_;
vertical_align_ = other.vertical_align_;
overflow_x_ = other.overflow_x_;
overflow_y_ = other.overflow_y_;
position_ = other.position_;
unicode_bidi_ = other.unicode_bidi_;
break_inside_ = other.break_inside_;
clear_ = other.clear_;
floating_ = other.floating_;
overflow_anchor_ = other.overflow_anchor_;
transform_box_ = other.transform_box_;
border_collapse_is_inherited_ = other.border_collapse_is_inherited_;
box_direction_is_inherited_ = other.box_direction_is_inherited_;
caption_side_is_inherited_ = other.caption_side_is_inherited_;
empty_cells_is_inherited_ = other.empty_cells_is_inherited_;
list_style_position_is_inherited_ = other.list_style_position_is_inherited_;
pointer_events_is_inherited_ = other.pointer_events_is_inherited_;
print_color_adjust_is_inherited_ = other.print_color_adjust_is_inherited_;
rtl_ordering_is_inherited_ = other.rtl_ordering_is_inherited_;
table_layout_ = other.table_layout_;
text_align_is_inherited_ = other.text_align_is_inherited_;
text_transform_is_inherited_ = other.text_transform_is_inherited_;
visibility_is_inherited_ = other.visibility_is_inherited_;
white_space_is_inherited_ = other.white_space_is_inherited_;
}
void ComputedStyleBase::PropagateIndependentInheritedProperties(
const ComputedStyleBase& parentStyle) {
if (PointerEventsIsInherited())
pointer_events_ = parentStyle.pointer_events_;
if (TextAlignIsInherited())
text_align_ = parentStyle.text_align_;
if (WhiteSpaceIsInherited())
white_space_ = parentStyle.white_space_;
if (TextTransformIsInherited())
text_transform_ = parentStyle.text_transform_;
if (VisibilityIsInherited())
visibility_ = parentStyle.visibility_;
if (BorderCollapseIsInherited())
border_collapse_ = parentStyle.border_collapse_;
if (BoxDirectionIsInherited())
box_direction_ = parentStyle.box_direction_;
if (CaptionSideIsInherited())
caption_side_ = parentStyle.caption_side_;
if (EmptyCellsIsInherited())
empty_cells_ = parentStyle.empty_cells_;
if (ListStylePositionIsInherited())
list_style_position_ = parentStyle.list_style_position_;
if (PrintColorAdjustIsInherited())
print_color_adjust_ = parentStyle.print_color_adjust_;
if (RtlOrderingIsInherited())
rtl_ordering_ = parentStyle.rtl_ordering_;
}
} // namespace blink