| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
| 4 * reserved. | 4 * reserved. |
| 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 // correctly on LayoutInlines (we will need to add a | 671 // correctly on LayoutInlines (we will need to add a |
| 672 // selfNeedsSimplifiedLayout bit in order to not get confused and taint | 672 // selfNeedsSimplifiedLayout bit in order to not get confused and taint |
| 673 // every line). In addition we need to solve the floating object issue | 673 // every line). In addition we need to solve the floating object issue |
| 674 // when layers come and go. Right now a full layout is necessary to keep | 674 // when layers come and go. Right now a full layout is necessary to keep |
| 675 // floating object lists sane. | 675 // floating object lists sane. |
| 676 return true; | 676 return true; |
| 677 } | 677 } |
| 678 } | 678 } |
| 679 | 679 |
| 680 if (rare_inherited_data_.Get() != other.rare_inherited_data_.Get()) { | 680 if (rare_inherited_data_.Get() != other.rare_inherited_data_.Get()) { |
| 681 if (rare_inherited_data_->highlight != | 681 if (rare_inherited_data_->highlight_ != |
| 682 other.rare_inherited_data_->highlight || | 682 other.rare_inherited_data_->highlight_ || |
| 683 rare_inherited_data_->indent != other.rare_inherited_data_->indent || | 683 rare_inherited_data_->indent_ != other.rare_inherited_data_->indent_ || |
| 684 rare_inherited_data_->text_align_last_ != | 684 rare_inherited_data_->text_align_last_ != |
| 685 other.rare_inherited_data_->text_align_last_ || | 685 other.rare_inherited_data_->text_align_last_ || |
| 686 rare_inherited_data_->text_indent_line_ != | 686 rare_inherited_data_->text_indent_line_ != |
| 687 other.rare_inherited_data_->text_indent_line_ || | 687 other.rare_inherited_data_->text_indent_line_ || |
| 688 rare_inherited_data_->effective_zoom_ != | 688 rare_inherited_data_->effective_zoom_ != |
| 689 other.rare_inherited_data_->effective_zoom_ || | 689 other.rare_inherited_data_->effective_zoom_ || |
| 690 rare_inherited_data_->word_break != | 690 rare_inherited_data_->word_break_ != |
| 691 other.rare_inherited_data_->word_break || | 691 other.rare_inherited_data_->word_break_ || |
| 692 rare_inherited_data_->overflow_wrap != | 692 rare_inherited_data_->overflow_wrap_ != |
| 693 other.rare_inherited_data_->overflow_wrap || | 693 other.rare_inherited_data_->overflow_wrap_ || |
| 694 rare_inherited_data_->line_break != | 694 rare_inherited_data_->line_break_ != |
| 695 other.rare_inherited_data_->line_break || | 695 other.rare_inherited_data_->line_break_ || |
| 696 rare_inherited_data_->text_security != | 696 rare_inherited_data_->text_security_ != |
| 697 other.rare_inherited_data_->text_security || | 697 other.rare_inherited_data_->text_security_ || |
| 698 rare_inherited_data_->hyphens != other.rare_inherited_data_->hyphens || | 698 rare_inherited_data_->hyphens_ != |
| 699 rare_inherited_data_->hyphenation_limit_before != | 699 other.rare_inherited_data_->hyphens_ || |
| 700 other.rare_inherited_data_->hyphenation_limit_before || | 700 rare_inherited_data_->hyphenation_limit_before_ != |
| 701 rare_inherited_data_->hyphenation_limit_after != | 701 other.rare_inherited_data_->hyphenation_limit_before_ || |
| 702 other.rare_inherited_data_->hyphenation_limit_after || | 702 rare_inherited_data_->hyphenation_limit_after_ != |
| 703 rare_inherited_data_->hyphenation_string != | 703 other.rare_inherited_data_->hyphenation_limit_after_ || |
| 704 other.rare_inherited_data_->hyphenation_string || | 704 rare_inherited_data_->hyphenation_string_ != |
| 705 other.rare_inherited_data_->hyphenation_string_ || |
| 705 rare_inherited_data_->respect_image_orientation_ != | 706 rare_inherited_data_->respect_image_orientation_ != |
| 706 other.rare_inherited_data_->respect_image_orientation_ || | 707 other.rare_inherited_data_->respect_image_orientation_ || |
| 707 rare_inherited_data_->ruby_position_ != | 708 rare_inherited_data_->ruby_position_ != |
| 708 other.rare_inherited_data_->ruby_position_ || | 709 other.rare_inherited_data_->ruby_position_ || |
| 709 rare_inherited_data_->text_emphasis_mark != | 710 rare_inherited_data_->text_emphasis_mark_ != |
| 710 other.rare_inherited_data_->text_emphasis_mark || | 711 other.rare_inherited_data_->text_emphasis_mark_ || |
| 711 rare_inherited_data_->text_emphasis_position != | 712 rare_inherited_data_->text_emphasis_position_ != |
| 712 other.rare_inherited_data_->text_emphasis_position || | 713 other.rare_inherited_data_->text_emphasis_position_ || |
| 713 rare_inherited_data_->text_emphasis_custom_mark != | 714 rare_inherited_data_->text_emphasis_custom_mark_ != |
| 714 other.rare_inherited_data_->text_emphasis_custom_mark || | 715 other.rare_inherited_data_->text_emphasis_custom_mark_ || |
| 715 rare_inherited_data_->text_justify_ != | 716 rare_inherited_data_->text_justify_ != |
| 716 other.rare_inherited_data_->text_justify_ || | 717 other.rare_inherited_data_->text_justify_ || |
| 717 rare_inherited_data_->text_orientation_ != | 718 rare_inherited_data_->text_orientation_ != |
| 718 other.rare_inherited_data_->text_orientation_ || | 719 other.rare_inherited_data_->text_orientation_ || |
| 719 rare_inherited_data_->text_combine_ != | 720 rare_inherited_data_->text_combine_ != |
| 720 other.rare_inherited_data_->text_combine_ || | 721 other.rare_inherited_data_->text_combine_ || |
| 721 rare_inherited_data_->tab_size_ != | 722 rare_inherited_data_->tab_size_ != |
| 722 other.rare_inherited_data_->tab_size_ || | 723 other.rare_inherited_data_->tab_size_ || |
| 723 rare_inherited_data_->text_size_adjust_ != | 724 rare_inherited_data_->text_size_adjust_ != |
| 724 other.rare_inherited_data_->text_size_adjust_ || | 725 other.rare_inherited_data_->text_size_adjust_ || |
| 725 rare_inherited_data_->list_style_image != | 726 rare_inherited_data_->list_style_image_ != |
| 726 other.rare_inherited_data_->list_style_image || | 727 other.rare_inherited_data_->list_style_image_ || |
| 727 rare_inherited_data_->line_height_step_ != | 728 rare_inherited_data_->line_height_step_ != |
| 728 other.rare_inherited_data_->line_height_step_ || | 729 other.rare_inherited_data_->line_height_step_ || |
| 729 rare_inherited_data_->text_stroke_width != | 730 rare_inherited_data_->text_stroke_width_ != |
| 730 other.rare_inherited_data_->text_stroke_width) | 731 other.rare_inherited_data_->text_stroke_width_) |
| 731 return true; | 732 return true; |
| 732 | 733 |
| 733 if (!rare_inherited_data_->ShadowDataEquivalent( | 734 if (!rare_inherited_data_->ShadowDataEquivalent( |
| 734 *other.rare_inherited_data_.Get())) | 735 *other.rare_inherited_data_.Get())) |
| 735 return true; | 736 return true; |
| 736 | 737 |
| 737 if (!rare_inherited_data_->QuotesDataEquivalent( | 738 if (!rare_inherited_data_->QuotesDataEquivalent( |
| 738 *other.rare_inherited_data_.Get())) | 739 *other.rare_inherited_data_.Get())) |
| 739 return true; | 740 return true; |
| 740 } | 741 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 bool ComputedStyle::DiffNeedsPaintInvalidationObject( | 884 bool ComputedStyle::DiffNeedsPaintInvalidationObject( |
| 884 const ComputedStyle& other) const { | 885 const ComputedStyle& other) const { |
| 885 if (Visibility() != other.Visibility() || | 886 if (Visibility() != other.Visibility() || |
| 886 PrintColorAdjust() != other.PrintColorAdjust() || | 887 PrintColorAdjust() != other.PrintColorAdjust() || |
| 887 InsideLink() != other.InsideLink() || | 888 InsideLink() != other.InsideLink() || |
| 888 !Border().VisuallyEqual(other.Border()) || !RadiiEqual(other) || | 889 !Border().VisuallyEqual(other.Border()) || !RadiiEqual(other) || |
| 889 !BorderSizeEquals(other) || *background_data_ != *other.background_data_) | 890 !BorderSizeEquals(other) || *background_data_ != *other.background_data_) |
| 890 return true; | 891 return true; |
| 891 | 892 |
| 892 if (rare_inherited_data_.Get() != other.rare_inherited_data_.Get()) { | 893 if (rare_inherited_data_.Get() != other.rare_inherited_data_.Get()) { |
| 893 if (rare_inherited_data_->user_modify != | 894 if (rare_inherited_data_->user_modify_ != |
| 894 other.rare_inherited_data_->user_modify || | 895 other.rare_inherited_data_->user_modify_ || |
| 895 rare_inherited_data_->user_select != | 896 rare_inherited_data_->user_select_ != |
| 896 other.rare_inherited_data_->user_select || | 897 other.rare_inherited_data_->user_select_ || |
| 897 rare_inherited_data_->image_rendering_ != | 898 rare_inherited_data_->image_rendering_ != |
| 898 other.rare_inherited_data_->image_rendering_) | 899 other.rare_inherited_data_->image_rendering_) |
| 899 return true; | 900 return true; |
| 900 } | 901 } |
| 901 | 902 |
| 902 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 903 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { |
| 903 if (rare_non_inherited_data_->user_drag != | 904 if (rare_non_inherited_data_->user_drag != |
| 904 other.rare_non_inherited_data_->user_drag || | 905 other.rare_non_inherited_data_->user_drag || |
| 905 rare_non_inherited_data_->object_fit_ != | 906 rare_non_inherited_data_->object_fit_ != |
| 906 other.rare_non_inherited_data_->object_fit_ || | 907 other.rare_non_inherited_data_->object_fit_ || |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 rare_inherited_data_->TextStrokeColor() != | 1075 rare_inherited_data_->TextStrokeColor() != |
| 1075 other.rare_inherited_data_->TextStrokeColor() || | 1076 other.rare_inherited_data_->TextStrokeColor() || |
| 1076 rare_inherited_data_->TextEmphasisColor() != | 1077 rare_inherited_data_->TextEmphasisColor() != |
| 1077 other.rare_inherited_data_->TextEmphasisColor() || | 1078 other.rare_inherited_data_->TextEmphasisColor() || |
| 1078 rare_inherited_data_->VisitedLinkTextFillColor() != | 1079 rare_inherited_data_->VisitedLinkTextFillColor() != |
| 1079 other.rare_inherited_data_->VisitedLinkTextFillColor() || | 1080 other.rare_inherited_data_->VisitedLinkTextFillColor() || |
| 1080 rare_inherited_data_->VisitedLinkTextStrokeColor() != | 1081 rare_inherited_data_->VisitedLinkTextStrokeColor() != |
| 1081 other.rare_inherited_data_->VisitedLinkTextStrokeColor() || | 1082 other.rare_inherited_data_->VisitedLinkTextStrokeColor() || |
| 1082 rare_inherited_data_->VisitedLinkTextEmphasisColor() != | 1083 rare_inherited_data_->VisitedLinkTextEmphasisColor() != |
| 1083 other.rare_inherited_data_->VisitedLinkTextEmphasisColor() || | 1084 other.rare_inherited_data_->VisitedLinkTextEmphasisColor() || |
| 1084 rare_inherited_data_->text_emphasis_fill != | 1085 rare_inherited_data_->text_emphasis_fill_ != |
| 1085 other.rare_inherited_data_->text_emphasis_fill || | 1086 other.rare_inherited_data_->text_emphasis_fill_ || |
| 1086 rare_inherited_data_->text_underline_position_ != | 1087 rare_inherited_data_->text_underline_position_ != |
| 1087 other.rare_inherited_data_->text_underline_position_ || | 1088 other.rare_inherited_data_->text_underline_position_ || |
| 1088 rare_inherited_data_->text_decoration_skip_ != | 1089 rare_inherited_data_->text_decoration_skip_ != |
| 1089 other.rare_inherited_data_->text_decoration_skip_ || | 1090 other.rare_inherited_data_->text_decoration_skip_ || |
| 1090 rare_inherited_data_->applied_text_decorations != | 1091 rare_inherited_data_->applied_text_decorations_ != |
| 1091 other.rare_inherited_data_->applied_text_decorations || | 1092 other.rare_inherited_data_->applied_text_decorations_ || |
| 1092 rare_inherited_data_->CaretColor() != | 1093 rare_inherited_data_->CaretColor() != |
| 1093 other.rare_inherited_data_->CaretColor() || | 1094 other.rare_inherited_data_->CaretColor() || |
| 1094 rare_inherited_data_->VisitedLinkCaretColor() != | 1095 rare_inherited_data_->VisitedLinkCaretColor() != |
| 1095 other.rare_inherited_data_->VisitedLinkCaretColor())) { | 1096 other.rare_inherited_data_->VisitedLinkCaretColor())) { |
| 1096 diff.SetTextDecorationOrColorChanged(); | 1097 diff.SetTextDecorationOrColorChanged(); |
| 1097 } | 1098 } |
| 1098 } | 1099 } |
| 1099 } | 1100 } |
| 1100 } | 1101 } |
| 1101 | 1102 |
| 1102 bool has_clip = HasOutOfFlowPosition() && !visual_data_->has_auto_clip_; | 1103 bool has_clip = HasOutOfFlowPosition() && !visual_data_->has_auto_clip_; |
| 1103 bool other_has_clip = | 1104 bool other_has_clip = |
| 1104 other.HasOutOfFlowPosition() && !other.visual_data_->has_auto_clip_; | 1105 other.HasOutOfFlowPosition() && !other.visual_data_->has_auto_clip_; |
| 1105 if (has_clip != other_has_clip || | 1106 if (has_clip != other_has_clip || |
| 1106 (has_clip && visual_data_->clip_ != other.visual_data_->clip_)) | 1107 (has_clip && visual_data_->clip_ != other.visual_data_->clip_)) |
| 1107 diff.SetCSSClipChanged(); | 1108 diff.SetCSSClipChanged(); |
| 1108 } | 1109 } |
| 1109 | 1110 |
| 1110 void ComputedStyle::AddPaintImage(StyleImage* image) { | 1111 void ComputedStyle::AddPaintImage(StyleImage* image) { |
| 1111 if (!rare_non_inherited_data_.Access()->paint_images_) { | 1112 if (!rare_non_inherited_data_.Access()->paint_images_) { |
| 1112 rare_non_inherited_data_.Access()->paint_images_ = | 1113 rare_non_inherited_data_.Access()->paint_images_ = |
| 1113 WTF::MakeUnique<Vector<Persistent<StyleImage>>>(); | 1114 WTF::MakeUnique<Vector<Persistent<StyleImage>>>(); |
| 1114 } | 1115 } |
| 1115 rare_non_inherited_data_.Access()->paint_images_->push_back(image); | 1116 rare_non_inherited_data_.Access()->paint_images_->push_back(image); |
| 1116 } | 1117 } |
| 1117 | 1118 |
| 1118 void ComputedStyle::AddCursor(StyleImage* image, | 1119 void ComputedStyle::AddCursor(StyleImage* image, |
| 1119 bool hot_spot_specified, | 1120 bool hot_spot_specified, |
| 1120 const IntPoint& hot_spot) { | 1121 const IntPoint& hot_spot) { |
| 1121 if (!rare_inherited_data_.Access()->cursor_data) | 1122 if (!rare_inherited_data_.Access()->cursor_data_) |
| 1122 rare_inherited_data_.Access()->cursor_data = new CursorList; | 1123 rare_inherited_data_.Access()->cursor_data_ = new CursorList; |
| 1123 rare_inherited_data_.Access()->cursor_data->push_back( | 1124 rare_inherited_data_.Access()->cursor_data_->push_back( |
| 1124 CursorData(image, hot_spot_specified, hot_spot)); | 1125 CursorData(image, hot_spot_specified, hot_spot)); |
| 1125 } | 1126 } |
| 1126 | 1127 |
| 1127 void ComputedStyle::SetCursorList(CursorList* other) { | 1128 void ComputedStyle::SetCursorList(CursorList* other) { |
| 1128 rare_inherited_data_.Access()->cursor_data = other; | 1129 rare_inherited_data_.Access()->cursor_data_ = other; |
| 1129 } | 1130 } |
| 1130 | 1131 |
| 1131 void ComputedStyle::SetQuotes(PassRefPtr<QuotesData> q) { | 1132 void ComputedStyle::SetQuotes(PassRefPtr<QuotesData> q) { |
| 1132 rare_inherited_data_.Access()->quotes = std::move(q); | 1133 rare_inherited_data_.Access()->quotes_ = std::move(q); |
| 1133 } | 1134 } |
| 1134 | 1135 |
| 1135 void ComputedStyle::ClearCursorList() { | 1136 void ComputedStyle::ClearCursorList() { |
| 1136 if (rare_inherited_data_->cursor_data) | 1137 if (rare_inherited_data_->cursor_data_) |
| 1137 rare_inherited_data_.Access()->cursor_data = nullptr; | 1138 rare_inherited_data_.Access()->cursor_data_ = nullptr; |
| 1138 } | 1139 } |
| 1139 | 1140 |
| 1140 static bool HasPropertyThatCreatesStackingContext( | 1141 static bool HasPropertyThatCreatesStackingContext( |
| 1141 const Vector<CSSPropertyID>& properties) { | 1142 const Vector<CSSPropertyID>& properties) { |
| 1142 for (CSSPropertyID property : properties) { | 1143 for (CSSPropertyID property : properties) { |
| 1143 switch (property) { | 1144 switch (property) { |
| 1144 case CSSPropertyOpacity: | 1145 case CSSPropertyOpacity: |
| 1145 case CSSPropertyTransform: | 1146 case CSSPropertyTransform: |
| 1146 case CSSPropertyAliasWebkitTransform: | 1147 case CSSPropertyAliasWebkitTransform: |
| 1147 case CSSPropertyTransformStyle: | 1148 case CSSPropertyTransformStyle: |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1387 transform.Translate(point.X() - origin_x + origin_shift_x, | 1388 transform.Translate(point.X() - origin_x + origin_shift_x, |
| 1388 point.Y() - origin_y + origin_shift_y); | 1389 point.Y() - origin_y + origin_shift_y); |
| 1389 transform.Rotate(angle + motion_data.rotation_.angle); | 1390 transform.Rotate(angle + motion_data.rotation_.angle); |
| 1390 | 1391 |
| 1391 if (position.X() != Length(kAuto) || anchor.X() != Length(kAuto)) | 1392 if (position.X() != Length(kAuto) || anchor.X() != Length(kAuto)) |
| 1392 // Shift the origin back to transform-origin. | 1393 // Shift the origin back to transform-origin. |
| 1393 transform.Translate(-origin_shift_x, -origin_shift_y); | 1394 transform.Translate(-origin_shift_x, -origin_shift_y); |
| 1394 } | 1395 } |
| 1395 | 1396 |
| 1396 void ComputedStyle::SetTextShadow(PassRefPtr<ShadowList> s) { | 1397 void ComputedStyle::SetTextShadow(PassRefPtr<ShadowList> s) { |
| 1397 rare_inherited_data_.Access()->text_shadow = std::move(s); | 1398 rare_inherited_data_.Access()->text_shadow_ = std::move(s); |
| 1398 } | 1399 } |
| 1399 | 1400 |
| 1400 void ComputedStyle::SetBoxShadow(PassRefPtr<ShadowList> s) { | 1401 void ComputedStyle::SetBoxShadow(PassRefPtr<ShadowList> s) { |
| 1401 rare_non_inherited_data_.Access()->box_shadow_ = std::move(s); | 1402 rare_non_inherited_data_.Access()->box_shadow_ = std::move(s); |
| 1402 } | 1403 } |
| 1403 | 1404 |
| 1404 static FloatRoundedRect::Radii CalcRadiiFor(const BorderData& border, | 1405 static FloatRoundedRect::Radii CalcRadiiFor(const BorderData& border, |
| 1405 const LengthSize& top_left, | 1406 const LengthSize& top_left, |
| 1406 const LengthSize& top_right, | 1407 const LengthSize& top_right, |
| 1407 const LengthSize& bottom_left, | 1408 const LengthSize& bottom_left, |
| 1408 const LengthSize& bottom_right, | 1409 const LengthSize& bottom_right, |
| 1409 LayoutSize size) { | 1410 LayoutSize size) { |
| 1410 return FloatRoundedRect::Radii( | 1411 return FloatRoundedRect::Radii( |
| 1411 FloatSize( | 1412 FloatSize( |
| 1412 FloatValueForLength(top_left.Width(), size.Width().ToFloat()), | 1413 FloatValueForLength(top_left.Width(), size.Width().ToFloat()), |
| 1413 FloatValueForLength(top_left.Height(), size.Height().ToFloat())), | 1414 FloatValueForLength(top_left.Height(), size.Height().ToFloat())), |
| 1414 FloatSize( | 1415 FloatSize( |
| 1415 FloatValueForLength(top_right.Width(), size.Width().ToFloat()), | 1416 FloatValueForLength(top_right.Width(), size.Width().ToFloat()), |
| 1416 FloatValueForLength(top_right.Height(), size.Height().ToFloat())), | 1417 FloatValueForLength(top_right.Height(), size.Height().ToFloat())), |
| 1417 FloatSize( | 1418 FloatSize( |
| 1418 FloatValueForLength(bottom_left.Width(), size.Width().ToFloat()), | 1419 FloatValueForLength(bottom_left.Width(), size.Width().ToFloat()), |
| 1419 FloatValueForLength(bottom_left.Height(), size.Height().ToFloat())), | 1420 FloatValueForLength(bottom_left.Height(), size.Height().ToFloat())), |
| 1420 FloatSize( | 1421 FloatSize( |
| 1421 FloatValueForLength(bottom_right.Width(), size.Width().ToFloat()), | 1422 FloatValueForLength(bottom_right.Width(), size.Width().ToFloat()), |
| 1422 FloatValueForLength(bottom_right.Height(), size.Height().ToFloat()))); | 1423 FloatValueForLength(bottom_right.Height(), size.Height().ToFloat()))); |
| 1423 } | 1424 } |
| 1424 | 1425 |
| 1425 StyleImage* ComputedStyle::ListStyleImage() const { | 1426 StyleImage* ComputedStyle::ListStyleImage() const { |
| 1426 return rare_inherited_data_->list_style_image.Get(); | 1427 return rare_inherited_data_->list_style_image_.Get(); |
| 1427 } | 1428 } |
| 1428 void ComputedStyle::SetListStyleImage(StyleImage* v) { | 1429 void ComputedStyle::SetListStyleImage(StyleImage* v) { |
| 1429 if (rare_inherited_data_->list_style_image != v) | 1430 if (rare_inherited_data_->list_style_image_ != v) |
| 1430 rare_inherited_data_.Access()->list_style_image = v; | 1431 rare_inherited_data_.Access()->list_style_image_ = v; |
| 1431 } | 1432 } |
| 1432 | 1433 |
| 1433 Color ComputedStyle::GetColor() const { | 1434 Color ComputedStyle::GetColor() const { |
| 1434 return inherited_data_->color_; | 1435 return inherited_data_->color_; |
| 1435 } | 1436 } |
| 1436 Color ComputedStyle::VisitedLinkColor() const { | 1437 Color ComputedStyle::VisitedLinkColor() const { |
| 1437 return inherited_data_->visited_link_color_; | 1438 return inherited_data_->visited_link_color_; |
| 1438 } | 1439 } |
| 1439 void ComputedStyle::SetColor(const Color& v) { | 1440 void ComputedStyle::SetColor(const Color& v) { |
| 1440 SET_VAR(inherited_data_, color_, v); | 1441 SET_VAR(inherited_data_, color_, v); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 } | 1606 } |
| 1606 | 1607 |
| 1607 Hyphenation* ComputedStyle::GetHyphenation() const { | 1608 Hyphenation* ComputedStyle::GetHyphenation() const { |
| 1608 return GetHyphens() == kHyphensAuto | 1609 return GetHyphens() == kHyphensAuto |
| 1609 ? GetFontDescription().LocaleOrDefault().GetHyphenation() | 1610 ? GetFontDescription().LocaleOrDefault().GetHyphenation() |
| 1610 : nullptr; | 1611 : nullptr; |
| 1611 } | 1612 } |
| 1612 | 1613 |
| 1613 const AtomicString& ComputedStyle::HyphenString() const { | 1614 const AtomicString& ComputedStyle::HyphenString() const { |
| 1614 const AtomicString& hyphenation_string = | 1615 const AtomicString& hyphenation_string = |
| 1615 rare_inherited_data_.Get()->hyphenation_string; | 1616 rare_inherited_data_.Get()->hyphenation_string_; |
| 1616 if (!hyphenation_string.IsNull()) | 1617 if (!hyphenation_string.IsNull()) |
| 1617 return hyphenation_string; | 1618 return hyphenation_string; |
| 1618 | 1619 |
| 1619 // FIXME: This should depend on locale. | 1620 // FIXME: This should depend on locale. |
| 1620 DEFINE_STATIC_LOCAL(AtomicString, hyphen_minus_string, | 1621 DEFINE_STATIC_LOCAL(AtomicString, hyphen_minus_string, |
| 1621 (&kHyphenMinusCharacter, 1)); | 1622 (&kHyphenMinusCharacter, 1)); |
| 1622 DEFINE_STATIC_LOCAL(AtomicString, hyphen_string, (&kHyphenCharacter, 1)); | 1623 DEFINE_STATIC_LOCAL(AtomicString, hyphen_string, (&kHyphenCharacter, 1)); |
| 1623 const SimpleFontData* primary_font = GetFont().PrimaryFont(); | 1624 const SimpleFontData* primary_font = GetFont().PrimaryFont(); |
| 1624 DCHECK(primary_font); | 1625 DCHECK(primary_font); |
| 1625 return primary_font && primary_font->GlyphForCharacter(kHyphenCharacter) | 1626 return primary_font && primary_font->GlyphForCharacter(kHyphenCharacter) |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1727 FontWeight ComputedStyle::GetFontWeight() const { | 1728 FontWeight ComputedStyle::GetFontWeight() const { |
| 1728 return GetFontDescription().Weight(); | 1729 return GetFontDescription().Weight(); |
| 1729 } | 1730 } |
| 1730 FontStretch ComputedStyle::GetFontStretch() const { | 1731 FontStretch ComputedStyle::GetFontStretch() const { |
| 1731 return GetFontDescription().Stretch(); | 1732 return GetFontDescription().Stretch(); |
| 1732 } | 1733 } |
| 1733 | 1734 |
| 1734 TextDecoration ComputedStyle::TextDecorationsInEffect() const { | 1735 TextDecoration ComputedStyle::TextDecorationsInEffect() const { |
| 1735 if (HasSimpleUnderlineInternal()) | 1736 if (HasSimpleUnderlineInternal()) |
| 1736 return kTextDecorationUnderline; | 1737 return kTextDecorationUnderline; |
| 1737 if (!rare_inherited_data_->applied_text_decorations) | 1738 if (!rare_inherited_data_->applied_text_decorations_) |
| 1738 return kTextDecorationNone; | 1739 return kTextDecorationNone; |
| 1739 | 1740 |
| 1740 int decorations = 0; | 1741 int decorations = 0; |
| 1741 | 1742 |
| 1742 const Vector<AppliedTextDecoration>& applied = AppliedTextDecorations(); | 1743 const Vector<AppliedTextDecoration>& applied = AppliedTextDecorations(); |
| 1743 | 1744 |
| 1744 for (size_t i = 0; i < applied.size(); ++i) | 1745 for (size_t i = 0; i < applied.size(); ++i) |
| 1745 decorations |= applied[i].Lines(); | 1746 decorations |= applied[i].Lines(); |
| 1746 | 1747 |
| 1747 return static_cast<TextDecoration>(decorations); | 1748 return static_cast<TextDecoration>(decorations); |
| 1748 } | 1749 } |
| 1749 | 1750 |
| 1750 const Vector<AppliedTextDecoration>& ComputedStyle::AppliedTextDecorations() | 1751 const Vector<AppliedTextDecoration>& ComputedStyle::AppliedTextDecorations() |
| 1751 const { | 1752 const { |
| 1752 if (HasSimpleUnderlineInternal()) { | 1753 if (HasSimpleUnderlineInternal()) { |
| 1753 DEFINE_STATIC_LOCAL( | 1754 DEFINE_STATIC_LOCAL( |
| 1754 Vector<AppliedTextDecoration>, underline, | 1755 Vector<AppliedTextDecoration>, underline, |
| 1755 (1, AppliedTextDecoration( | 1756 (1, AppliedTextDecoration( |
| 1756 kTextDecorationUnderline, kTextDecorationStyleSolid, | 1757 kTextDecorationUnderline, kTextDecorationStyleSolid, |
| 1757 VisitedDependentColor(CSSPropertyTextDecorationColor)))); | 1758 VisitedDependentColor(CSSPropertyTextDecorationColor)))); |
| 1758 // Since we only have one of these in memory, just update the color before | 1759 // Since we only have one of these in memory, just update the color before |
| 1759 // returning. | 1760 // returning. |
| 1760 underline.at(0).SetColor( | 1761 underline.at(0).SetColor( |
| 1761 VisitedDependentColor(CSSPropertyTextDecorationColor)); | 1762 VisitedDependentColor(CSSPropertyTextDecorationColor)); |
| 1762 return underline; | 1763 return underline; |
| 1763 } | 1764 } |
| 1764 if (!rare_inherited_data_->applied_text_decorations) { | 1765 if (!rare_inherited_data_->applied_text_decorations_) { |
| 1765 DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, empty, ()); | 1766 DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, empty, ()); |
| 1766 return empty; | 1767 return empty; |
| 1767 } | 1768 } |
| 1768 | 1769 |
| 1769 return rare_inherited_data_->applied_text_decorations->GetVector(); | 1770 return rare_inherited_data_->applied_text_decorations_->GetVector(); |
| 1770 } | 1771 } |
| 1771 | 1772 |
| 1772 StyleInheritedVariables* ComputedStyle::InheritedVariables() const { | 1773 StyleInheritedVariables* ComputedStyle::InheritedVariables() const { |
| 1773 return rare_inherited_data_->variables.Get(); | 1774 return rare_inherited_data_->variables_.Get(); |
| 1774 } | 1775 } |
| 1775 | 1776 |
| 1776 StyleNonInheritedVariables* ComputedStyle::NonInheritedVariables() const { | 1777 StyleNonInheritedVariables* ComputedStyle::NonInheritedVariables() const { |
| 1777 return rare_non_inherited_data_->variables_.get(); | 1778 return rare_non_inherited_data_->variables_.get(); |
| 1778 } | 1779 } |
| 1779 | 1780 |
| 1780 StyleInheritedVariables& ComputedStyle::MutableInheritedVariables() { | 1781 StyleInheritedVariables& ComputedStyle::MutableInheritedVariables() { |
| 1781 RefPtr<StyleInheritedVariables>& variables = | 1782 RefPtr<StyleInheritedVariables>& variables = |
| 1782 rare_inherited_data_.Access()->variables; | 1783 rare_inherited_data_.Access()->variables_; |
| 1783 if (!variables) | 1784 if (!variables) |
| 1784 variables = StyleInheritedVariables::Create(); | 1785 variables = StyleInheritedVariables::Create(); |
| 1785 else if (!variables->HasOneRef()) | 1786 else if (!variables->HasOneRef()) |
| 1786 variables = variables->Copy(); | 1787 variables = variables->Copy(); |
| 1787 return *variables; | 1788 return *variables; |
| 1788 } | 1789 } |
| 1789 | 1790 |
| 1790 StyleNonInheritedVariables& ComputedStyle::MutableNonInheritedVariables() { | 1791 StyleNonInheritedVariables& ComputedStyle::MutableNonInheritedVariables() { |
| 1791 std::unique_ptr<StyleNonInheritedVariables>& variables = | 1792 std::unique_ptr<StyleNonInheritedVariables>& variables = |
| 1792 rare_non_inherited_data_.Access()->variables_; | 1793 rare_non_inherited_data_.Access()->variables_; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2005 TextAutosizer::ComputeAutosizedFontSize(size, multiplier); | 2006 TextAutosizer::ComputeAutosizedFontSize(size, multiplier); |
| 2006 desc.SetComputedSize(std::min(kMaximumAllowedFontSize, autosized_font_size)); | 2007 desc.SetComputedSize(std::min(kMaximumAllowedFontSize, autosized_font_size)); |
| 2007 | 2008 |
| 2008 SetFontDescription(desc); | 2009 SetFontDescription(desc); |
| 2009 GetFont().Update(current_font_selector); | 2010 GetFont().Update(current_font_selector); |
| 2010 } | 2011 } |
| 2011 | 2012 |
| 2012 void ComputedStyle::AddAppliedTextDecoration( | 2013 void ComputedStyle::AddAppliedTextDecoration( |
| 2013 const AppliedTextDecoration& decoration) { | 2014 const AppliedTextDecoration& decoration) { |
| 2014 RefPtr<AppliedTextDecorationList>& list = | 2015 RefPtr<AppliedTextDecorationList>& list = |
| 2015 rare_inherited_data_.Access()->applied_text_decorations; | 2016 rare_inherited_data_.Access()->applied_text_decorations_; |
| 2016 | 2017 |
| 2017 if (!list) | 2018 if (!list) |
| 2018 list = AppliedTextDecorationList::Create(); | 2019 list = AppliedTextDecorationList::Create(); |
| 2019 else if (!list->HasOneRef()) | 2020 else if (!list->HasOneRef()) |
| 2020 list = list->Copy(); | 2021 list = list->Copy(); |
| 2021 | 2022 |
| 2022 list->push_back(decoration); | 2023 list->push_back(decoration); |
| 2023 } | 2024 } |
| 2024 | 2025 |
| 2025 void ComputedStyle::OverrideTextDecorationColors(Color override_color) { | 2026 void ComputedStyle::OverrideTextDecorationColors(Color override_color) { |
| 2026 RefPtr<AppliedTextDecorationList>& list = | 2027 RefPtr<AppliedTextDecorationList>& list = |
| 2027 rare_inherited_data_.Access()->applied_text_decorations; | 2028 rare_inherited_data_.Access()->applied_text_decorations_; |
| 2028 DCHECK(list); | 2029 DCHECK(list); |
| 2029 if (!list->HasOneRef()) | 2030 if (!list->HasOneRef()) |
| 2030 list = list->Copy(); | 2031 list = list->Copy(); |
| 2031 | 2032 |
| 2032 for (size_t i = 0; i < list->size(); ++i) | 2033 for (size_t i = 0; i < list->size(); ++i) |
| 2033 list->at(i).SetColor(override_color); | 2034 list->at(i).SetColor(override_color); |
| 2034 } | 2035 } |
| 2035 | 2036 |
| 2036 void ComputedStyle::ApplyTextDecorations( | 2037 void ComputedStyle::ApplyTextDecorations( |
| 2037 const Color& parent_text_decoration_color, | 2038 const Color& parent_text_decoration_color, |
| 2038 bool override_existing_colors) { | 2039 bool override_existing_colors) { |
| 2039 if (GetTextDecoration() == kTextDecorationNone && | 2040 if (GetTextDecoration() == kTextDecorationNone && |
| 2040 !HasSimpleUnderlineInternal() && | 2041 !HasSimpleUnderlineInternal() && |
| 2041 !rare_inherited_data_->applied_text_decorations) | 2042 !rare_inherited_data_->applied_text_decorations_) |
| 2042 return; | 2043 return; |
| 2043 | 2044 |
| 2044 // If there are any color changes or decorations set by this element, stop | 2045 // If there are any color changes or decorations set by this element, stop |
| 2045 // using m_hasSimpleUnderline. | 2046 // using m_hasSimpleUnderline. |
| 2046 Color current_text_decoration_color = | 2047 Color current_text_decoration_color = |
| 2047 VisitedDependentColor(CSSPropertyTextDecorationColor); | 2048 VisitedDependentColor(CSSPropertyTextDecorationColor); |
| 2048 if (HasSimpleUnderlineInternal() && | 2049 if (HasSimpleUnderlineInternal() && |
| 2049 (GetTextDecoration() != kTextDecorationNone || | 2050 (GetTextDecoration() != kTextDecorationNone || |
| 2050 current_text_decoration_color != parent_text_decoration_color)) { | 2051 current_text_decoration_color != parent_text_decoration_color)) { |
| 2051 SetHasSimpleUnderlineInternal(false); | 2052 SetHasSimpleUnderlineInternal(false); |
| 2052 AddAppliedTextDecoration(AppliedTextDecoration( | 2053 AddAppliedTextDecoration(AppliedTextDecoration( |
| 2053 kTextDecorationUnderline, kTextDecorationStyleSolid, | 2054 kTextDecorationUnderline, kTextDecorationStyleSolid, |
| 2054 parent_text_decoration_color)); | 2055 parent_text_decoration_color)); |
| 2055 } | 2056 } |
| 2056 if (override_existing_colors && | 2057 if (override_existing_colors && |
| 2057 rare_inherited_data_->applied_text_decorations) | 2058 rare_inherited_data_->applied_text_decorations_) |
| 2058 OverrideTextDecorationColors(current_text_decoration_color); | 2059 OverrideTextDecorationColors(current_text_decoration_color); |
| 2059 if (GetTextDecoration() == kTextDecorationNone) | 2060 if (GetTextDecoration() == kTextDecorationNone) |
| 2060 return; | 2061 return; |
| 2061 DCHECK(!HasSimpleUnderlineInternal()); | 2062 DCHECK(!HasSimpleUnderlineInternal()); |
| 2062 // To save memory, we don't use AppliedTextDecoration objects in the common | 2063 // To save memory, we don't use AppliedTextDecoration objects in the common |
| 2063 // case of a single simple underline of currentColor. | 2064 // case of a single simple underline of currentColor. |
| 2064 TextDecoration decoration_lines = GetTextDecoration(); | 2065 TextDecoration decoration_lines = GetTextDecoration(); |
| 2065 TextDecorationStyle decoration_style = GetTextDecorationStyle(); | 2066 TextDecorationStyle decoration_style = GetTextDecorationStyle(); |
| 2066 bool is_simple_underline = decoration_lines == kTextDecorationUnderline && | 2067 bool is_simple_underline = decoration_lines == kTextDecorationUnderline && |
| 2067 decoration_style == kTextDecorationStyleSolid && | 2068 decoration_style == kTextDecorationStyleSolid && |
| 2068 TextDecorationColor().IsCurrentColor(); | 2069 TextDecorationColor().IsCurrentColor(); |
| 2069 if (is_simple_underline && !rare_inherited_data_->applied_text_decorations) { | 2070 if (is_simple_underline && !rare_inherited_data_->applied_text_decorations_) { |
| 2070 SetHasSimpleUnderlineInternal(true); | 2071 SetHasSimpleUnderlineInternal(true); |
| 2071 return; | 2072 return; |
| 2072 } | 2073 } |
| 2073 | 2074 |
| 2074 AddAppliedTextDecoration(AppliedTextDecoration( | 2075 AddAppliedTextDecoration(AppliedTextDecoration( |
| 2075 decoration_lines, decoration_style, current_text_decoration_color)); | 2076 decoration_lines, decoration_style, current_text_decoration_color)); |
| 2076 } | 2077 } |
| 2077 | 2078 |
| 2078 void ComputedStyle::ClearAppliedTextDecorations() { | 2079 void ComputedStyle::ClearAppliedTextDecorations() { |
| 2079 SetHasSimpleUnderlineInternal(false); | 2080 SetHasSimpleUnderlineInternal(false); |
| 2080 | 2081 |
| 2081 if (rare_inherited_data_->applied_text_decorations) | 2082 if (rare_inherited_data_->applied_text_decorations_) |
| 2082 rare_inherited_data_.Access()->applied_text_decorations = nullptr; | 2083 rare_inherited_data_.Access()->applied_text_decorations_ = nullptr; |
| 2083 } | 2084 } |
| 2084 | 2085 |
| 2085 void ComputedStyle::RestoreParentTextDecorations( | 2086 void ComputedStyle::RestoreParentTextDecorations( |
| 2086 const ComputedStyle& parent_style) { | 2087 const ComputedStyle& parent_style) { |
| 2087 SetHasSimpleUnderlineInternal(parent_style.HasSimpleUnderlineInternal()); | 2088 SetHasSimpleUnderlineInternal(parent_style.HasSimpleUnderlineInternal()); |
| 2088 if (rare_inherited_data_->applied_text_decorations != | 2089 if (rare_inherited_data_->applied_text_decorations_ != |
| 2089 parent_style.rare_inherited_data_->applied_text_decorations) | 2090 parent_style.rare_inherited_data_->applied_text_decorations_) { |
| 2090 rare_inherited_data_.Access()->applied_text_decorations = | 2091 rare_inherited_data_.Access()->applied_text_decorations_ = |
| 2091 parent_style.rare_inherited_data_->applied_text_decorations; | 2092 parent_style.rare_inherited_data_->applied_text_decorations_; |
| 2093 } |
| 2092 } | 2094 } |
| 2093 | 2095 |
| 2094 void ComputedStyle::ClearMultiCol() { | 2096 void ComputedStyle::ClearMultiCol() { |
| 2095 rare_non_inherited_data_.Access()->multi_col_ = nullptr; | 2097 rare_non_inherited_data_.Access()->multi_col_ = nullptr; |
| 2096 rare_non_inherited_data_.Access()->multi_col_.Init(); | 2098 rare_non_inherited_data_.Access()->multi_col_.Init(); |
| 2097 } | 2099 } |
| 2098 | 2100 |
| 2099 StyleColor ComputedStyle::DecorationColorIncludingFallback( | 2101 StyleColor ComputedStyle::DecorationColorIncludingFallback( |
| 2100 bool visited_link) const { | 2102 bool visited_link) const { |
| 2101 StyleColor style_color = | 2103 StyleColor style_color = |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2367 bool ComputedStyle::ColumnRuleEquivalent( | 2369 bool ComputedStyle::ColumnRuleEquivalent( |
| 2368 const ComputedStyle* other_style) const { | 2370 const ComputedStyle* other_style) const { |
| 2369 return ColumnRuleStyle() == other_style->ColumnRuleStyle() && | 2371 return ColumnRuleStyle() == other_style->ColumnRuleStyle() && |
| 2370 ColumnRuleWidth() == other_style->ColumnRuleWidth() && | 2372 ColumnRuleWidth() == other_style->ColumnRuleWidth() && |
| 2371 VisitedDependentColor(CSSPropertyColumnRuleColor) == | 2373 VisitedDependentColor(CSSPropertyColumnRuleColor) == |
| 2372 other_style->VisitedDependentColor(CSSPropertyColumnRuleColor); | 2374 other_style->VisitedDependentColor(CSSPropertyColumnRuleColor); |
| 2373 } | 2375 } |
| 2374 | 2376 |
| 2375 TextEmphasisMark ComputedStyle::GetTextEmphasisMark() const { | 2377 TextEmphasisMark ComputedStyle::GetTextEmphasisMark() const { |
| 2376 TextEmphasisMark mark = | 2378 TextEmphasisMark mark = |
| 2377 static_cast<TextEmphasisMark>(rare_inherited_data_->text_emphasis_mark); | 2379 static_cast<TextEmphasisMark>(rare_inherited_data_->text_emphasis_mark_); |
| 2378 if (mark != kTextEmphasisMarkAuto) | 2380 if (mark != kTextEmphasisMarkAuto) |
| 2379 return mark; | 2381 return mark; |
| 2380 | 2382 |
| 2381 if (IsHorizontalWritingMode()) | 2383 if (IsHorizontalWritingMode()) |
| 2382 return kTextEmphasisMarkDot; | 2384 return kTextEmphasisMarkDot; |
| 2383 | 2385 |
| 2384 return kTextEmphasisMarkSesame; | 2386 return kTextEmphasisMarkSesame; |
| 2385 } | 2387 } |
| 2386 | 2388 |
| 2387 Color ComputedStyle::InitialTapHighlightColor() { | 2389 Color ComputedStyle::InitialTapHighlightColor() { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2524 if (value < 0) | 2526 if (value < 0) |
| 2525 fvalue -= 0.5f; | 2527 fvalue -= 0.5f; |
| 2526 else | 2528 else |
| 2527 fvalue += 0.5f; | 2529 fvalue += 0.5f; |
| 2528 } | 2530 } |
| 2529 | 2531 |
| 2530 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); | 2532 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); |
| 2531 } | 2533 } |
| 2532 | 2534 |
| 2533 } // namespace blink | 2535 } // namespace blink |
| OLD | NEW |