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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 return surround_data_->border_.GetImage().Outset(); | 469 return surround_data_->border_.GetImage().Outset(); |
470 } | 470 } |
471 void SetBorderImageOutset(const BorderImageLengthBox&); | 471 void SetBorderImageOutset(const BorderImageLengthBox&); |
472 | 472 |
473 // Border width properties. | 473 // Border width properties. |
474 static float InitialBorderWidth() { return 3; } | 474 static float InitialBorderWidth() { return 3; } |
475 | 475 |
476 // TODO(nainar): Move all fixed point logic to a separate class. | 476 // TODO(nainar): Move all fixed point logic to a separate class. |
477 // border-top-width | 477 // border-top-width |
478 float BorderTopWidth() const { | 478 float BorderTopWidth() const { |
479 if (surround_data_->border_.top_.Style() == kBorderStyleNone || | 479 if (BorderTopStyle() == EBorderStyle::kNone || |
480 surround_data_->border_.top_.Style() == kBorderStyleHidden) | 480 BorderTopStyle() == EBorderStyle::kHidden) |
481 return 0; | 481 return 0; |
482 return static_cast<float>(BorderTopWidthInternal()) / | 482 return static_cast<float>(BorderTopWidthInternal()) / |
483 kBorderWidthDenominator; | 483 kBorderWidthDenominator; |
484 } | 484 } |
485 void SetBorderTopWidth(float v) { | 485 void SetBorderTopWidth(float v) { |
486 surround_data_.Access()->border_top_width_ = WidthToFixedPoint(v); | 486 surround_data_.Access()->border_top_width_ = WidthToFixedPoint(v); |
487 } | 487 } |
| 488 bool BorderTopNonZero() const { |
| 489 return BorderTopWidth() && (BorderTopStyle() != EBorderStyle::kNone); |
| 490 } |
488 | 491 |
489 // border-bottom-width | 492 // border-bottom-width |
490 float BorderBottomWidth() const { | 493 float BorderBottomWidth() const { |
491 if (surround_data_->border_.bottom_.Style() == kBorderStyleNone || | 494 if (BorderBottomStyle() == EBorderStyle::kNone || |
492 surround_data_->border_.bottom_.Style() == kBorderStyleHidden) | 495 BorderBottomStyle() == EBorderStyle::kHidden) |
493 return 0; | 496 return 0; |
494 return static_cast<float>(BorderBottomWidthInternal()) / | 497 return static_cast<float>(BorderBottomWidthInternal()) / |
495 kBorderWidthDenominator; | 498 kBorderWidthDenominator; |
496 } | 499 } |
497 void SetBorderBottomWidth(float v) { | 500 void SetBorderBottomWidth(float v) { |
498 surround_data_.Access()->border_bottom_width_ = WidthToFixedPoint(v); | 501 surround_data_.Access()->border_bottom_width_ = WidthToFixedPoint(v); |
499 } | 502 } |
| 503 bool BorderBottomNonZero() const { |
| 504 return BorderBottomWidth() && (BorderBottomStyle() != EBorderStyle::kNone); |
| 505 } |
500 | 506 |
501 // border-left-width | 507 // border-left-width |
502 float BorderLeftWidth() const { | 508 float BorderLeftWidth() const { |
503 if (surround_data_->border_.left_.Style() == kBorderStyleNone || | 509 if (BorderLeftStyle() == EBorderStyle::kNone || |
504 surround_data_->border_.left_.Style() == kBorderStyleHidden) | 510 BorderLeftStyle() == EBorderStyle::kHidden) |
505 return 0; | 511 return 0; |
506 return static_cast<float>(BorderLeftWidthInternal()) / | 512 return static_cast<float>(BorderLeftWidthInternal()) / |
507 kBorderWidthDenominator; | 513 kBorderWidthDenominator; |
508 } | 514 } |
509 void SetBorderLeftWidth(float v) { | 515 void SetBorderLeftWidth(float v) { |
510 surround_data_.Access()->border_left_width_ = WidthToFixedPoint(v); | 516 surround_data_.Access()->border_left_width_ = WidthToFixedPoint(v); |
511 } | 517 } |
| 518 bool BorderLeftNonZero() const { |
| 519 return BorderLeftWidth() && (BorderLeftStyle() != EBorderStyle::kNone); |
| 520 } |
512 | 521 |
513 // border-right-width | 522 // border-right-width |
514 float BorderRightWidth() const { | 523 float BorderRightWidth() const { |
515 if (surround_data_->border_.right_.Style() == kBorderStyleNone || | 524 if (BorderRightStyle() == EBorderStyle::kNone || |
516 surround_data_->border_.right_.Style() == kBorderStyleHidden) | 525 BorderRightStyle() == EBorderStyle::kHidden) |
517 return 0; | 526 return 0; |
518 return static_cast<float>(BorderRightWidthInternal()) / | 527 return static_cast<float>(BorderRightWidthInternal()) / |
519 kBorderWidthDenominator; | 528 kBorderWidthDenominator; |
520 } | 529 } |
521 void SetBorderRightWidth(float v) { | 530 void SetBorderRightWidth(float v) { |
522 surround_data_.Access()->border_right_width_ = WidthToFixedPoint(v); | 531 surround_data_.Access()->border_right_width_ = WidthToFixedPoint(v); |
523 } | 532 } |
524 | 533 bool BorderRightNonZero() const { |
525 // Border style properties. | 534 return BorderRightWidth() && (BorderRightStyle() != EBorderStyle::kNone); |
526 static EBorderStyle InitialBorderStyle() { return kBorderStyleNone; } | |
527 | |
528 // border-top-style | |
529 EBorderStyle BorderTopStyle() const { | |
530 return surround_data_->border_.Top().Style(); | |
531 } | |
532 void SetBorderTopStyle(EBorderStyle v) { | |
533 SET_VAR(surround_data_, border_.top_.style_, v); | |
534 } | 535 } |
535 | 536 |
536 // border-right-style | 537 static EBorderStyle InitialColumnRuleStyle() { return EBorderStyle::kNone; } |
537 EBorderStyle BorderRightStyle() const { | |
538 return surround_data_->border_.Right().Style(); | |
539 } | |
540 void SetBorderRightStyle(EBorderStyle v) { | |
541 SET_VAR(surround_data_, border_.right_.style_, v); | |
542 } | |
543 | |
544 // border-left-style | |
545 EBorderStyle BorderLeftStyle() const { | |
546 return surround_data_->border_.Left().Style(); | |
547 } | |
548 void SetBorderLeftStyle(EBorderStyle v) { | |
549 SET_VAR(surround_data_, border_.left_.style_, v); | |
550 } | |
551 | |
552 // border-bottom-style | |
553 EBorderStyle BorderBottomStyle() const { | |
554 return surround_data_->border_.Bottom().Style(); | |
555 } | |
556 void SetBorderBottomStyle(EBorderStyle v) { | |
557 SET_VAR(surround_data_, border_.bottom_.style_, v); | |
558 } | |
559 | 538 |
560 // Border color properties. | 539 // Border color properties. |
561 // border-left-color | 540 // border-left-color |
562 void SetBorderLeftColor(const StyleColor& color) { | 541 void SetBorderLeftColor(const StyleColor& color) { |
563 if (!compareEqual(BorderLeftColor(), color)) { | 542 if (!compareEqual(BorderLeftColor(), color)) { |
564 SetBorderLeftColorInternal(color.Resolve(Color())); | 543 SetBorderLeftColorInternal(color.Resolve(Color())); |
565 SetBorderLeftColorIsCurrentColor(color.IsCurrentColor()); | 544 SetBorderLeftColorIsCurrentColor(color.IsCurrentColor()); |
566 } | 545 } |
567 } | 546 } |
568 | 547 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 void SetColumnRuleColor(const StyleColor& c) { | 635 void SetColumnRuleColor(const StyleColor& c) { |
657 SET_BORDERVALUE_COLOR(rare_non_inherited_data_.Access()->multi_col_, rule_, | 636 SET_BORDERVALUE_COLOR(rare_non_inherited_data_.Access()->multi_col_, rule_, |
658 c); | 637 c); |
659 } | 638 } |
660 | 639 |
661 // column-rule-style (aka -webkit-column-rule-style) | 640 // column-rule-style (aka -webkit-column-rule-style) |
662 EBorderStyle ColumnRuleStyle() const { | 641 EBorderStyle ColumnRuleStyle() const { |
663 return rare_non_inherited_data_->multi_col_->rule_.Style(); | 642 return rare_non_inherited_data_->multi_col_->rule_.Style(); |
664 } | 643 } |
665 void SetColumnRuleStyle(EBorderStyle b) { | 644 void SetColumnRuleStyle(EBorderStyle b) { |
666 SET_NESTED_VAR(rare_non_inherited_data_, multi_col_, rule_.style_, b); | 645 SET_NESTED_VAR(rare_non_inherited_data_, multi_col_, rule_.style_, |
| 646 static_cast<unsigned>(b)); |
667 } | 647 } |
668 | 648 |
669 // column-rule-width (aka -webkit-column-rule-width) | 649 // column-rule-width (aka -webkit-column-rule-width) |
670 static unsigned short InitialColumnRuleWidth() { return 3; } | 650 static unsigned short InitialColumnRuleWidth() { return 3; } |
671 unsigned short ColumnRuleWidth() const { | 651 unsigned short ColumnRuleWidth() const { |
672 return rare_non_inherited_data_->multi_col_->RuleWidth(); | 652 return rare_non_inherited_data_->multi_col_->RuleWidth(); |
673 } | 653 } |
674 void SetColumnRuleWidth(unsigned short w) { | 654 void SetColumnRuleWidth(unsigned short w) { |
675 SET_NESTED_BORDER_WIDTH(rare_non_inherited_data_, multi_col_, rule_, w); | 655 SET_NESTED_BORDER_WIDTH(rare_non_inherited_data_, multi_col_, rule_, w); |
676 } | 656 } |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 // outline-color | 1126 // outline-color |
1147 void SetOutlineColor(const StyleColor& v) { | 1127 void SetOutlineColor(const StyleColor& v) { |
1148 SET_BORDERVALUE_COLOR(rare_non_inherited_data_, outline_, v); | 1128 SET_BORDERVALUE_COLOR(rare_non_inherited_data_, outline_, v); |
1149 } | 1129 } |
1150 | 1130 |
1151 // outline-style | 1131 // outline-style |
1152 EBorderStyle OutlineStyle() const { | 1132 EBorderStyle OutlineStyle() const { |
1153 return rare_non_inherited_data_->outline_.Style(); | 1133 return rare_non_inherited_data_->outline_.Style(); |
1154 } | 1134 } |
1155 void SetOutlineStyle(EBorderStyle v) { | 1135 void SetOutlineStyle(EBorderStyle v) { |
1156 SET_VAR(rare_non_inherited_data_, outline_.style_, v); | 1136 SET_VAR(rare_non_inherited_data_, outline_.style_, |
| 1137 static_cast<unsigned>(v)); |
1157 } | 1138 } |
1158 static OutlineIsAuto InitialOutlineStyleIsAuto() { return kOutlineIsAutoOff; } | 1139 static OutlineIsAuto InitialOutlineStyleIsAuto() { return kOutlineIsAutoOff; } |
1159 OutlineIsAuto OutlineStyleIsAuto() const { | 1140 OutlineIsAuto OutlineStyleIsAuto() const { |
1160 return static_cast<OutlineIsAuto>( | 1141 return static_cast<OutlineIsAuto>( |
1161 rare_non_inherited_data_->outline_.IsAuto()); | 1142 rare_non_inherited_data_->outline_.IsAuto()); |
1162 } | 1143 } |
1163 void SetOutlineStyleIsAuto(OutlineIsAuto is_auto) { | 1144 void SetOutlineStyleIsAuto(OutlineIsAuto is_auto) { |
1164 SET_VAR(rare_non_inherited_data_, outline_.is_auto_, is_auto); | 1145 SET_VAR(rare_non_inherited_data_, outline_.is_auto_, is_auto); |
1165 } | 1146 } |
1166 | 1147 |
1167 // outline-width | 1148 // outline-width |
1168 static unsigned short InitialOutlineWidth() { return 3; } | 1149 static unsigned short InitialOutlineWidth() { return 3; } |
1169 unsigned short OutlineWidth() const { | 1150 unsigned short OutlineWidth() const { |
1170 if (rare_non_inherited_data_->outline_.Style() == kBorderStyleNone) | 1151 if (rare_non_inherited_data_->outline_.Style() == EBorderStyle::kNone) |
1171 return 0; | 1152 return 0; |
1172 return rare_non_inherited_data_->outline_.Width(); | 1153 return rare_non_inherited_data_->outline_.Width(); |
1173 } | 1154 } |
1174 void SetOutlineWidth(unsigned short v) { | 1155 void SetOutlineWidth(unsigned short v) { |
1175 SET_BORDER_WIDTH(rare_non_inherited_data_, outline_, v); | 1156 SET_BORDER_WIDTH(rare_non_inherited_data_, outline_, v); |
1176 } | 1157 } |
1177 | 1158 |
1178 // outline-offset | 1159 // outline-offset |
1179 static int InitialOutlineOffset() { return 0; } | 1160 static int InitialOutlineOffset() { return 0; } |
1180 int OutlineOffset() const { | 1161 int OutlineOffset() const { |
1181 if (rare_non_inherited_data_->outline_.Style() == kBorderStyleNone) | 1162 if (rare_non_inherited_data_->outline_.Style() == EBorderStyle::kNone) |
1182 return 0; | 1163 return 0; |
1183 return rare_non_inherited_data_->outline_.Offset(); | 1164 return rare_non_inherited_data_->outline_.Offset(); |
1184 } | 1165 } |
1185 void SetOutlineOffset(int v) { | 1166 void SetOutlineOffset(int v) { |
1186 SET_VAR(rare_non_inherited_data_, outline_.offset_, v); | 1167 SET_VAR(rare_non_inherited_data_, outline_.offset_, v); |
1187 } | 1168 } |
1188 | 1169 |
1189 // perspective (aka -webkit-perspective) | 1170 // perspective (aka -webkit-perspective) |
1190 static float InitialPerspective() { return 0; } | 1171 static float InitialPerspective() { return 0; } |
1191 float Perspective() const { return rare_non_inherited_data_->perspective_; } | 1172 float Perspective() const { return rare_non_inherited_data_->perspective_; } |
(...skipping 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2817 bool HasBorderImageOutsets() const { | 2798 bool HasBorderImageOutsets() const { |
2818 return BorderImage().HasImage() && BorderImage().Outset().NonZero(); | 2799 return BorderImage().HasImage() && BorderImage().Outset().NonZero(); |
2819 } | 2800 } |
2820 LayoutRectOutsets BorderImageOutsets() const { | 2801 LayoutRectOutsets BorderImageOutsets() const { |
2821 return ImageOutsets(BorderImage()); | 2802 return ImageOutsets(BorderImage()); |
2822 } | 2803 } |
2823 bool BorderImageSlicesFill() const { return Border().GetImage().Fill(); } | 2804 bool BorderImageSlicesFill() const { return Border().GetImage().Fill(); } |
2824 | 2805 |
2825 void SetBorderImageSlicesFill(bool); | 2806 void SetBorderImageSlicesFill(bool); |
2826 const BorderData& Border() const { return surround_data_->border_; } | 2807 const BorderData& Border() const { return surround_data_->border_; } |
2827 BorderValue BorderLeft() const { | 2808 const BorderValue BorderLeft() const { |
2828 return BorderValue(surround_data_->border_.Left(), BorderLeftColor(), | 2809 return BorderValue(BorderLeftStyle(), BorderLeftColor(), BorderLeftWidth()); |
2829 BorderLeftWidth()); | |
2830 } | 2810 } |
2831 BorderValue BorderRight() const { | 2811 const BorderValue BorderRight() const { |
2832 return BorderValue(surround_data_->border_.Right(), BorderRightColor(), | 2812 return BorderValue(BorderRightStyle(), BorderRightColor(), |
2833 BorderRightWidth()); | 2813 BorderRightWidth()); |
2834 } | 2814 } |
2835 BorderValue BorderTop() const { | 2815 const BorderValue BorderTop() const { |
2836 return BorderValue(surround_data_->border_.Top(), BorderTopColor(), | 2816 return BorderValue(BorderTopStyle(), BorderTopColor(), BorderTopWidth()); |
2837 BorderTopWidth()); | |
2838 } | 2817 } |
2839 BorderValue BorderBottom() const { | 2818 const BorderValue BorderBottom() const { |
2840 return BorderValue(surround_data_->border_.Bottom(), BorderBottomColor(), | 2819 return BorderValue(BorderBottomStyle(), BorderBottomColor(), |
2841 BorderBottomWidth()); | 2820 BorderBottomWidth()); |
2842 } | 2821 } |
| 2822 |
2843 bool BorderSizeEquals(const ComputedStyle& o) const { | 2823 bool BorderSizeEquals(const ComputedStyle& o) const { |
2844 return BorderWidthEquals(BorderLeftWidth(), o.BorderLeftWidth()) && | 2824 return BorderWidthEquals(BorderLeftWidth(), o.BorderLeftWidth()) && |
2845 BorderWidthEquals(BorderTopWidth(), o.BorderTopWidth()) && | 2825 BorderWidthEquals(BorderTopWidth(), o.BorderTopWidth()) && |
2846 BorderWidthEquals(BorderRightWidth(), o.BorderRightWidth()) && | 2826 BorderWidthEquals(BorderRightWidth(), o.BorderRightWidth()) && |
2847 BorderWidthEquals(BorderBottomWidth(), o.BorderBottomWidth()); | 2827 BorderWidthEquals(BorderBottomWidth(), o.BorderBottomWidth()); |
2848 } | 2828 } |
| 2829 |
2849 BorderValue BorderBefore() const; | 2830 BorderValue BorderBefore() const; |
2850 BorderValue BorderAfter() const; | 2831 BorderValue BorderAfter() const; |
2851 BorderValue BorderStart() const; | 2832 BorderValue BorderStart() const; |
2852 BorderValue BorderEnd() const; | 2833 BorderValue BorderEnd() const; |
2853 float BorderAfterWidth() const; | 2834 float BorderAfterWidth() const; |
2854 float BorderBeforeWidth() const; | 2835 float BorderBeforeWidth() const; |
2855 float BorderEndWidth() const; | 2836 float BorderEndWidth() const; |
2856 float BorderStartWidth() const; | 2837 float BorderStartWidth() const; |
2857 float BorderOverWidth() const; | 2838 float BorderOverWidth() const; |
2858 float BorderUnderWidth() const; | 2839 float BorderUnderWidth() const; |
2859 | 2840 |
2860 bool HasBorderFill() const { return Border().HasBorderFill(); } | 2841 bool HasBorderFill() const { return Border().HasBorderFill(); } |
2861 bool HasBorder() const { | 2842 bool HasBorder() const { |
2862 return Border().HasBorder() || BorderLeftWidth() || BorderRightWidth() || | 2843 return BorderLeftNonZero() || BorderRightNonZero() || BorderTopNonZero() || |
2863 BorderTopWidth() || BorderBottomWidth(); | 2844 BorderBottomNonZero(); |
2864 } | 2845 } |
2865 bool HasBorderDecoration() const { return HasBorder() || HasBorderFill(); } | 2846 bool HasBorderDecoration() const { return HasBorder() || HasBorderFill(); } |
2866 bool HasBorderRadius() const { | 2847 bool HasBorderRadius() const { |
2867 if (!BorderTopLeftRadius().Width().IsZero()) | 2848 if (!BorderTopLeftRadius().Width().IsZero()) |
2868 return true; | 2849 return true; |
2869 if (!BorderTopRightRadius().Width().IsZero()) | 2850 if (!BorderTopRightRadius().Width().IsZero()) |
2870 return true; | 2851 return true; |
2871 if (!BorderBottomLeftRadius().Width().IsZero()) | 2852 if (!BorderBottomLeftRadius().Width().IsZero()) |
2872 return true; | 2853 return true; |
2873 if (!BorderBottomRightRadius().Width().IsZero()) | 2854 if (!BorderBottomRightRadius().Width().IsZero()) |
2874 return true; | 2855 return true; |
2875 return false; | 2856 return false; |
2876 } | 2857 } |
2877 bool HasBorderColorReferencingCurrentColor() const { | 2858 bool HasBorderColorReferencingCurrentColor() const { |
2878 return (BorderLeft().NonZero() && BorderLeftColor().IsCurrentColor()) || | 2859 return (BorderLeft().NonZero() && BorderLeftColor().IsCurrentColor()) || |
2879 (BorderRight().NonZero() && BorderRightColor().IsCurrentColor()) || | 2860 (BorderRight().NonZero() && BorderRightColor().IsCurrentColor()) || |
2880 (BorderTop().NonZero() && BorderTopColor().IsCurrentColor()) || | 2861 (BorderTop().NonZero() && BorderTopColor().IsCurrentColor()) || |
2881 (BorderBottom().NonZero() && BorderBottomColor().IsCurrentColor()); | 2862 (BorderBottom().NonZero() && BorderBottomColor().IsCurrentColor()); |
2882 } | 2863 } |
2883 | 2864 |
2884 bool RadiiEqual(const ComputedStyle& o) const { | 2865 bool RadiiEqual(const ComputedStyle& o) const { |
2885 return BorderTopLeftRadius() == o.BorderTopLeftRadius() && | 2866 return BorderTopLeftRadius() == o.BorderTopLeftRadius() && |
2886 BorderTopRightRadius() == o.BorderTopRightRadius() && | 2867 BorderTopRightRadius() == o.BorderTopRightRadius() && |
2887 BorderBottomLeftRadius() == o.BorderBottomLeftRadius() && | 2868 BorderBottomLeftRadius() == o.BorderBottomLeftRadius() && |
2888 BorderBottomRightRadius() == o.BorderBottomRightRadius(); | 2869 BorderBottomRightRadius() == o.BorderBottomRightRadius(); |
2889 } | 2870 } |
2890 | 2871 |
2891 bool BorderColorEquals(const ComputedStyle& o) const { | 2872 bool BorderLeftEquals(const ComputedStyle& o) const { |
2892 return (BorderLeftColorInternal() == o.BorderLeftColorInternal() && | 2873 return BorderLeftWidthInternal() == o.BorderLeftWidthInternal() && |
2893 BorderRightColorInternal() == o.BorderRightColorInternal() && | 2874 BorderLeftStyle() == o.BorderLeftStyle() && |
2894 BorderTopColorInternal() == o.BorderTopColorInternal() && | 2875 BorderLeftColor() == o.BorderLeftColor() && |
2895 BorderBottomColorInternal() == o.BorderBottomColorInternal()) && | 2876 BorderLeftColorIsCurrentColor() == o.BorderLeftColorIsCurrentColor(); |
2896 (BorderLeftColorIsCurrentColor() == | |
2897 o.BorderLeftColorIsCurrentColor() && | |
2898 BorderRightColorIsCurrentColor() == | |
2899 o.BorderRightColorIsCurrentColor() && | |
2900 BorderTopColorIsCurrentColor() == | |
2901 o.BorderTopColorIsCurrentColor() && | |
2902 BorderBottomColorIsCurrentColor() == | |
2903 o.BorderBottomColorIsCurrentColor()); | |
2904 } | 2877 } |
2905 | 2878 |
2906 bool BorderColorVisuallyEquals(const ComputedStyle& o) const { | 2879 bool BorderLeftVisuallyEqual(const ComputedStyle& o) const { |
2907 if ((BorderLeftStyle() == kBorderStyleNone && | 2880 if (BorderLeftStyle() == EBorderStyle::kNone && |
2908 o.BorderLeftStyle() == kBorderStyleNone) && | 2881 o.BorderLeftStyle() == EBorderStyle::kNone) |
2909 (BorderRightStyle() == kBorderStyleNone && | |
2910 o.BorderRightStyle() == kBorderStyleNone) && | |
2911 (BorderTopStyle() == kBorderStyleNone && | |
2912 o.BorderTopStyle() == kBorderStyleNone) && | |
2913 (BorderBottomStyle() == kBorderStyleNone && | |
2914 o.BorderBottomStyle() == kBorderStyleNone)) | |
2915 return true; | 2882 return true; |
2916 if ((BorderLeftStyle() == kBorderStyleHidden && | 2883 if (BorderLeftStyle() == EBorderStyle::kHidden && |
2917 o.BorderLeftStyle() == kBorderStyleHidden) && | 2884 o.BorderLeftStyle() == EBorderStyle::kHidden) |
2918 (BorderRightStyle() == kBorderStyleHidden && | |
2919 o.BorderRightStyle() == kBorderStyleHidden) && | |
2920 (BorderTopStyle() == kBorderStyleHidden && | |
2921 o.BorderTopStyle() == kBorderStyleHidden) && | |
2922 (BorderBottomStyle() == kBorderStyleHidden && | |
2923 o.BorderBottomStyle() == kBorderStyleHidden)) | |
2924 return true; | 2885 return true; |
2925 return BorderColorEquals(o); | 2886 return BorderLeftEquals(o); |
| 2887 } |
| 2888 |
| 2889 bool BorderRightEquals(const ComputedStyle& o) const { |
| 2890 return BorderRightWidthInternal() == o.BorderRightWidthInternal() && |
| 2891 BorderRightStyle() == o.BorderRightStyle() && |
| 2892 BorderRightColor() == o.BorderRightColor() && |
| 2893 BorderRightColorIsCurrentColor() == |
| 2894 o.BorderRightColorIsCurrentColor(); |
| 2895 } |
| 2896 |
| 2897 bool BorderRightVisuallyEqual(const ComputedStyle& o) const { |
| 2898 if (BorderRightStyle() == EBorderStyle::kNone && |
| 2899 o.BorderRightStyle() == EBorderStyle::kNone) |
| 2900 return true; |
| 2901 if (BorderRightStyle() == EBorderStyle::kHidden && |
| 2902 o.BorderRightStyle() == EBorderStyle::kHidden) |
| 2903 return true; |
| 2904 return BorderRightEquals(o); |
| 2905 } |
| 2906 |
| 2907 bool BorderTopVisuallyEqual(const ComputedStyle& o) const { |
| 2908 if (BorderTopStyle() == EBorderStyle::kNone && |
| 2909 o.BorderTopStyle() == EBorderStyle::kNone) |
| 2910 return true; |
| 2911 if (BorderTopStyle() == EBorderStyle::kHidden && |
| 2912 o.BorderTopStyle() == EBorderStyle::kHidden) |
| 2913 return true; |
| 2914 return BorderTopEquals(o); |
| 2915 } |
| 2916 |
| 2917 bool BorderTopEquals(const ComputedStyle& o) const { |
| 2918 return BorderTopWidthInternal() == o.BorderTopWidthInternal() && |
| 2919 BorderTopStyle() == o.BorderTopStyle() && |
| 2920 BorderTopColor() == o.BorderTopColor() && |
| 2921 BorderTopColorIsCurrentColor() == o.BorderTopColorIsCurrentColor(); |
| 2922 } |
| 2923 |
| 2924 bool BorderBottomVisuallyEqual(const ComputedStyle& o) const { |
| 2925 if (BorderBottomStyle() == EBorderStyle::kNone && |
| 2926 o.BorderBottomStyle() == EBorderStyle::kNone) |
| 2927 return true; |
| 2928 if (BorderBottomStyle() == EBorderStyle::kHidden && |
| 2929 o.BorderBottomStyle() == EBorderStyle::kHidden) |
| 2930 return true; |
| 2931 return BorderBottomEquals(o); |
| 2932 } |
| 2933 |
| 2934 bool BorderBottomEquals(const ComputedStyle& o) const { |
| 2935 return BorderBottomWidthInternal() == o.BorderBottomWidthInternal() && |
| 2936 BorderBottomStyle() == o.BorderBottomStyle() && |
| 2937 BorderBottomColor() == o.BorderBottomColor() && |
| 2938 BorderBottomColorIsCurrentColor() == |
| 2939 o.BorderBottomColorIsCurrentColor(); |
| 2940 } |
| 2941 |
| 2942 bool BorderEquals(const ComputedStyle& o) const { |
| 2943 return BorderLeftEquals(o) && BorderRightEquals(o) && BorderTopEquals(o) && |
| 2944 BorderBottomEquals(o) && BorderImage() != o.BorderImage(); |
| 2945 } |
| 2946 |
| 2947 bool BorderVisuallyEqual(const ComputedStyle& o) const { |
| 2948 return BorderLeftVisuallyEqual(o) && BorderRightVisuallyEqual(o) && |
| 2949 BorderTopVisuallyEqual(o) && BorderBottomVisuallyEqual(o); |
2926 } | 2950 } |
2927 | 2951 |
2928 void ResetBorder() { | 2952 void ResetBorder() { |
2929 ResetBorderImage(); | 2953 ResetBorderImage(); |
2930 ResetBorderTop(); | 2954 ResetBorderTop(); |
2931 ResetBorderRight(); | 2955 ResetBorderRight(); |
2932 ResetBorderBottom(); | 2956 ResetBorderBottom(); |
2933 ResetBorderLeft(); | 2957 ResetBorderLeft(); |
2934 ResetBorderTopLeftRadius(); | 2958 ResetBorderTopLeftRadius(); |
2935 ResetBorderTopRightRadius(); | 2959 ResetBorderTopRightRadius(); |
2936 ResetBorderBottomLeftRadius(); | 2960 ResetBorderBottomLeftRadius(); |
2937 ResetBorderBottomRightRadius(); | 2961 ResetBorderBottomRightRadius(); |
2938 } | 2962 } |
2939 | 2963 |
2940 void ResetBorderTop() { | 2964 void ResetBorderTop() { |
2941 SET_VAR(surround_data_, border_.top_, BorderStyle()); | 2965 SetBorderTopStyle(EBorderStyle::kNone); |
2942 SetBorderTopWidth(3); | 2966 SetBorderTopWidth(3); |
2943 SetBorderTopColorInternal(0); | 2967 SetBorderTopColorInternal(0); |
2944 SetBorderTopColorInternal(true); | 2968 SetBorderTopColorInternal(true); |
| 2969 SetBorderTopStyle(EBorderStyle::kNone); |
2945 } | 2970 } |
2946 void ResetBorderRight() { | 2971 void ResetBorderRight() { |
2947 SET_VAR(surround_data_, border_.right_, BorderStyle()); | 2972 SetBorderRightStyle(EBorderStyle::kNone); |
2948 SetBorderRightWidth(3); | 2973 SetBorderRightWidth(3); |
2949 SetBorderRightColorInternal(0); | 2974 SetBorderRightColorInternal(0); |
2950 SetBorderRightColorInternal(true); | 2975 SetBorderRightColorInternal(true); |
| 2976 SetBorderRightStyle(EBorderStyle::kNone); |
2951 } | 2977 } |
2952 void ResetBorderBottom() { | 2978 void ResetBorderBottom() { |
2953 SET_VAR(surround_data_, border_.bottom_, BorderStyle()); | 2979 SetBorderBottomStyle(EBorderStyle::kNone); |
2954 SetBorderBottomWidth(3); | 2980 SetBorderBottomWidth(3); |
2955 SetBorderBottomColorInternal(0); | 2981 SetBorderBottomColorInternal(0); |
2956 SetBorderBottomColorInternal(true); | 2982 SetBorderBottomColorInternal(true); |
| 2983 SetBorderBottomStyle(EBorderStyle::kNone); |
2957 } | 2984 } |
2958 void ResetBorderLeft() { | 2985 void ResetBorderLeft() { |
2959 SET_VAR(surround_data_, border_.left_, BorderStyle()); | 2986 SetBorderLeftStyle(EBorderStyle::kNone); |
2960 SetBorderLeftWidth(3); | 2987 SetBorderLeftWidth(3); |
2961 SetBorderLeftColorInternal(0); | 2988 SetBorderLeftColorInternal(0); |
2962 SetBorderLeftColorInternal(true); | 2989 SetBorderLeftColorInternal(true); |
| 2990 SetBorderLeftStyle(EBorderStyle::kNone); |
2963 } | 2991 } |
2964 void ResetBorderImage() { | 2992 void ResetBorderImage() { |
2965 SET_VAR(surround_data_, border_.image_, NinePieceImage()); | 2993 SET_VAR(surround_data_, border_.image_, NinePieceImage()); |
2966 } | 2994 } |
2967 | 2995 |
2968 void SetBorderRadius(const LengthSize& s) { | 2996 void SetBorderRadius(const LengthSize& s) { |
2969 SetBorderTopLeftRadius(s); | 2997 SetBorderTopLeftRadius(s); |
2970 SetBorderTopRightRadius(s); | 2998 SetBorderTopRightRadius(s); |
2971 SetBorderBottomLeftRadius(s); | 2999 SetBorderBottomLeftRadius(s); |
2972 SetBorderBottomRightRadius(s); | 3000 SetBorderBottomRightRadius(s); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3011 return rare_non_inherited_data_->perspective_ > 0; | 3039 return rare_non_inherited_data_->perspective_ > 0; |
3012 } | 3040 } |
3013 | 3041 |
3014 // Page size utility functions. | 3042 // Page size utility functions. |
3015 void ResetPageSizeType() { | 3043 void ResetPageSizeType() { |
3016 SET_VAR(rare_non_inherited_data_, page_size_type_, PAGE_SIZE_AUTO); | 3044 SET_VAR(rare_non_inherited_data_, page_size_type_, PAGE_SIZE_AUTO); |
3017 } | 3045 } |
3018 | 3046 |
3019 // Outline utility functions. | 3047 // Outline utility functions. |
3020 bool HasOutline() const { | 3048 bool HasOutline() const { |
3021 return OutlineWidth() > 0 && OutlineStyle() > kBorderStyleHidden; | 3049 return OutlineWidth() > 0 && OutlineStyle() > EBorderStyle::kHidden; |
3022 } | 3050 } |
3023 int OutlineOutsetExtent() const; | 3051 int OutlineOutsetExtent() const; |
3024 float GetOutlineStrokeWidthForFocusRing() const; | 3052 float GetOutlineStrokeWidthForFocusRing() const; |
3025 bool HasOutlineWithCurrentColor() const { | 3053 bool HasOutlineWithCurrentColor() const { |
3026 return HasOutline() && OutlineColor().IsCurrentColor(); | 3054 return HasOutline() && OutlineColor().IsCurrentColor(); |
3027 } | 3055 } |
3028 | 3056 |
3029 // Position utility functions. | 3057 // Position utility functions. |
3030 bool HasOutOfFlowPosition() const { | 3058 bool HasOutOfFlowPosition() const { |
3031 return GetPosition() == EPosition::kAbsolute || | 3059 return GetPosition() == EPosition::kAbsolute || |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3771 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); | 3799 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); |
3772 } | 3800 } |
3773 | 3801 |
3774 inline bool ComputedStyle::HasPseudoElementStyle() const { | 3802 inline bool ComputedStyle::HasPseudoElementStyle() const { |
3775 return PseudoBitsInternal() & kElementPseudoIdMask; | 3803 return PseudoBitsInternal() & kElementPseudoIdMask; |
3776 } | 3804 } |
3777 | 3805 |
3778 } // namespace blink | 3806 } // namespace blink |
3779 | 3807 |
3780 #endif // ComputedStyle_h | 3808 #endif // ComputedStyle_h |
OLD | NEW |