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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 // border-bottom-style | 553 // border-bottom-style |
554 EBorderStyle BorderBottomStyle() const { | 554 EBorderStyle BorderBottomStyle() const { |
555 return surround_data_->border_.Bottom().Style(); | 555 return surround_data_->border_.Bottom().Style(); |
556 } | 556 } |
557 void SetBorderBottomStyle(EBorderStyle v) { | 557 void SetBorderBottomStyle(EBorderStyle v) { |
558 SET_VAR(surround_data_, border_.bottom_.style_, v); | 558 SET_VAR(surround_data_, border_.bottom_.style_, v); |
559 } | 559 } |
560 | 560 |
561 // Border color properties. | 561 // Border color properties. |
562 // border-left-color | 562 // border-left-color |
563 void SetBorderLeftColor(const StyleColor& v) { | 563 void SetBorderLeftColor(const StyleColor& color) { |
564 SET_BORDERVALUE_COLOR(surround_data_, border_.left_, v); | 564 if (!compareEqual(BorderLeftColor(), color)) { |
| 565 SetBorderLeftColorInternal(color.Resolve(Color())); |
| 566 SetBorderLeftColorIsCurrentColor(color.IsCurrentColor()); |
| 567 } |
565 } | 568 } |
566 | 569 |
567 // border-right-color | 570 // border-right-color |
568 void SetBorderRightColor(const StyleColor& v) { | 571 void SetBorderRightColor(const StyleColor& color) { |
569 SET_BORDERVALUE_COLOR(surround_data_, border_.right_, v); | 572 if (!compareEqual(BorderRightColor(), color)) { |
| 573 SetBorderRightColorInternal(color.Resolve(Color())); |
| 574 SetBorderRightColorIsCurrentColor(color.IsCurrentColor()); |
| 575 } |
570 } | 576 } |
571 | 577 |
572 // border-top-color | 578 // border-top-color |
573 void SetBorderTopColor(const StyleColor& v) { | 579 void SetBorderTopColor(const StyleColor& color) { |
574 SET_BORDERVALUE_COLOR(surround_data_, border_.top_, v); | 580 if (!compareEqual(BorderTopColor(), color)) { |
| 581 SetBorderTopColorInternal(color.Resolve(Color())); |
| 582 SetBorderTopColorIsCurrentColor(color.IsCurrentColor()); |
| 583 } |
575 } | 584 } |
576 | 585 |
577 // border-bottom-color | 586 // border-bottom-color |
578 void SetBorderBottomColor(const StyleColor& v) { | 587 void SetBorderBottomColor(const StyleColor& color) { |
579 SET_BORDERVALUE_COLOR(surround_data_, border_.bottom_, v); | 588 if (!compareEqual(BorderBottomColor(), color)) { |
| 589 SetBorderBottomColorInternal(color.Resolve(Color())); |
| 590 SetBorderBottomColorIsCurrentColor(color.IsCurrentColor()); |
| 591 } |
580 } | 592 } |
581 | 593 |
582 // box-shadow (aka -webkit-box-shadow) | 594 // box-shadow (aka -webkit-box-shadow) |
583 static ShadowList* InitialBoxShadow() { return 0; } | 595 static ShadowList* InitialBoxShadow() { return 0; } |
584 ShadowList* BoxShadow() const { | 596 ShadowList* BoxShadow() const { |
585 return rare_non_inherited_data_->box_shadow_.Get(); | 597 return rare_non_inherited_data_->box_shadow_.Get(); |
586 } | 598 } |
587 void SetBoxShadow(PassRefPtr<ShadowList>); | 599 void SetBoxShadow(PassRefPtr<ShadowList>); |
588 | 600 |
589 // box-sizing (aka -webkit-box-sizing) | 601 // box-sizing (aka -webkit-box-sizing) |
(...skipping 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2838 return BorderImage().HasImage() && BorderImage().Outset().NonZero(); | 2850 return BorderImage().HasImage() && BorderImage().Outset().NonZero(); |
2839 } | 2851 } |
2840 LayoutRectOutsets BorderImageOutsets() const { | 2852 LayoutRectOutsets BorderImageOutsets() const { |
2841 return ImageOutsets(BorderImage()); | 2853 return ImageOutsets(BorderImage()); |
2842 } | 2854 } |
2843 bool BorderImageSlicesFill() const { return Border().GetImage().Fill(); } | 2855 bool BorderImageSlicesFill() const { return Border().GetImage().Fill(); } |
2844 | 2856 |
2845 void SetBorderImageSlicesFill(bool); | 2857 void SetBorderImageSlicesFill(bool); |
2846 const BorderData& Border() const { return surround_data_->border_; } | 2858 const BorderData& Border() const { return surround_data_->border_; } |
2847 const BorderValue BorderLeft() const { | 2859 const BorderValue BorderLeft() const { |
2848 return BorderValue(surround_data_->border_.Left(), BorderLeftWidth()); | 2860 return BorderValue(surround_data_->border_.Left(), BorderLeftColor(), |
| 2861 BorderLeftWidth()); |
2849 } | 2862 } |
2850 const BorderValue BorderRight() const { | 2863 const BorderValue BorderRight() const { |
2851 return BorderValue(surround_data_->border_.Right(), BorderRightWidth()); | 2864 return BorderValue(surround_data_->border_.Right(), BorderRightColor(), |
| 2865 BorderRightWidth()); |
2852 } | 2866 } |
2853 const BorderValue BorderTop() const { | 2867 const BorderValue BorderTop() const { |
2854 return BorderValue(surround_data_->border_.Top(), BorderTopWidth()); | 2868 return BorderValue(surround_data_->border_.Top(), BorderTopColor(), |
| 2869 BorderTopWidth()); |
2855 } | 2870 } |
2856 const BorderValue BorderBottom() const { | 2871 const BorderValue BorderBottom() const { |
2857 return BorderValue(surround_data_->border_.Bottom(), BorderBottomWidth()); | 2872 return BorderValue(surround_data_->border_.Bottom(), BorderBottomColor(), |
| 2873 BorderBottomWidth()); |
2858 } | 2874 } |
2859 bool BorderSizeEquals(const ComputedStyle& o) const { | 2875 bool BorderSizeEquals(const ComputedStyle& o) const { |
2860 return BorderWidthEquals(BorderLeftWidth(), o.BorderLeftWidth()) && | 2876 return BorderWidthEquals(BorderLeftWidth(), o.BorderLeftWidth()) && |
2861 BorderWidthEquals(BorderTopWidth(), o.BorderTopWidth()) && | 2877 BorderWidthEquals(BorderTopWidth(), o.BorderTopWidth()) && |
2862 BorderWidthEquals(BorderRightWidth(), o.BorderRightWidth()) && | 2878 BorderWidthEquals(BorderRightWidth(), o.BorderRightWidth()) && |
2863 BorderWidthEquals(BorderBottomWidth(), o.BorderBottomWidth()); | 2879 BorderWidthEquals(BorderBottomWidth(), o.BorderBottomWidth()); |
2864 } | 2880 } |
2865 const BorderValue BorderBefore() const; | 2881 const BorderValue BorderBefore() const; |
2866 const BorderValue BorderAfter() const; | 2882 const BorderValue BorderAfter() const; |
2867 const BorderValue BorderStart() const; | 2883 const BorderValue BorderStart() const; |
(...skipping 16 matching lines...) Expand all Loading... |
2884 return true; | 2900 return true; |
2885 if (!BorderTopRightRadius().Width().IsZero()) | 2901 if (!BorderTopRightRadius().Width().IsZero()) |
2886 return true; | 2902 return true; |
2887 if (!BorderBottomLeftRadius().Width().IsZero()) | 2903 if (!BorderBottomLeftRadius().Width().IsZero()) |
2888 return true; | 2904 return true; |
2889 if (!BorderBottomRightRadius().Width().IsZero()) | 2905 if (!BorderBottomRightRadius().Width().IsZero()) |
2890 return true; | 2906 return true; |
2891 return false; | 2907 return false; |
2892 } | 2908 } |
2893 bool HasBorderColorReferencingCurrentColor() const { | 2909 bool HasBorderColorReferencingCurrentColor() const { |
2894 return Border().HasBorderColorReferencingCurrentColor(); | 2910 return (BorderLeft().NonZero() && BorderLeftColor().IsCurrentColor()) || |
| 2911 (BorderRight().NonZero() && BorderRightColor().IsCurrentColor()) || |
| 2912 (BorderTop().NonZero() && BorderTopColor().IsCurrentColor()) || |
| 2913 (BorderBottom().NonZero() && BorderBottomColor().IsCurrentColor()); |
2895 } | 2914 } |
2896 | 2915 |
2897 bool RadiiEqual(const ComputedStyle& o) const { | 2916 bool RadiiEqual(const ComputedStyle& o) const { |
2898 return BorderTopLeftRadius() == o.BorderTopLeftRadius() && | 2917 return BorderTopLeftRadius() == o.BorderTopLeftRadius() && |
2899 BorderTopRightRadius() == o.BorderTopRightRadius() && | 2918 BorderTopRightRadius() == o.BorderTopRightRadius() && |
2900 BorderBottomLeftRadius() == o.BorderBottomLeftRadius() && | 2919 BorderBottomLeftRadius() == o.BorderBottomLeftRadius() && |
2901 BorderBottomRightRadius() == o.BorderBottomRightRadius(); | 2920 BorderBottomRightRadius() == o.BorderBottomRightRadius(); |
2902 } | 2921 } |
2903 | 2922 |
| 2923 bool BorderColorEquals(const ComputedStyle& o) const { |
| 2924 return (BorderLeftColorInternal() == o.BorderLeftColorInternal() && |
| 2925 BorderRightColorInternal() == o.BorderRightColorInternal() && |
| 2926 BorderTopColorInternal() == o.BorderTopColorInternal() && |
| 2927 BorderBottomColorInternal() == o.BorderBottomColorInternal()) && |
| 2928 (BorderLeftColorIsCurrentColor() == |
| 2929 o.BorderLeftColorIsCurrentColor() && |
| 2930 BorderRightColorIsCurrentColor() == |
| 2931 o.BorderRightColorIsCurrentColor() && |
| 2932 BorderTopColorIsCurrentColor() == |
| 2933 o.BorderTopColorIsCurrentColor() && |
| 2934 BorderBottomColorIsCurrentColor() == |
| 2935 o.BorderBottomColorIsCurrentColor()); |
| 2936 } |
| 2937 |
| 2938 bool BorderColorVisuallyEquals(const ComputedStyle& o) const { |
| 2939 if ((BorderLeftStyle() == kBorderStyleNone && |
| 2940 o.BorderLeftStyle() == kBorderStyleNone) && |
| 2941 (BorderRightStyle() == kBorderStyleNone && |
| 2942 o.BorderRightStyle() == kBorderStyleNone) && |
| 2943 (BorderTopStyle() == kBorderStyleNone && |
| 2944 o.BorderTopStyle() == kBorderStyleNone) && |
| 2945 (BorderBottomStyle() == kBorderStyleNone && |
| 2946 o.BorderBottomStyle() == kBorderStyleNone)) |
| 2947 return true; |
| 2948 if ((BorderLeftStyle() == kBorderStyleHidden && |
| 2949 o.BorderLeftStyle() == kBorderStyleHidden) && |
| 2950 (BorderRightStyle() == kBorderStyleHidden && |
| 2951 o.BorderRightStyle() == kBorderStyleHidden) && |
| 2952 (BorderTopStyle() == kBorderStyleHidden && |
| 2953 o.BorderTopStyle() == kBorderStyleHidden) && |
| 2954 (BorderBottomStyle() == kBorderStyleHidden && |
| 2955 o.BorderBottomStyle() == kBorderStyleHidden)) |
| 2956 return true; |
| 2957 return BorderColorEquals(o); |
| 2958 } |
| 2959 |
2904 void ResetBorder() { | 2960 void ResetBorder() { |
2905 ResetBorderImage(); | 2961 ResetBorderImage(); |
2906 ResetBorderTop(); | 2962 ResetBorderTop(); |
2907 ResetBorderRight(); | 2963 ResetBorderRight(); |
2908 ResetBorderBottom(); | 2964 ResetBorderBottom(); |
2909 ResetBorderLeft(); | 2965 ResetBorderLeft(); |
2910 ResetBorderTopLeftRadius(); | 2966 ResetBorderTopLeftRadius(); |
2911 ResetBorderTopRightRadius(); | 2967 ResetBorderTopRightRadius(); |
2912 ResetBorderBottomLeftRadius(); | 2968 ResetBorderBottomLeftRadius(); |
2913 ResetBorderBottomRightRadius(); | 2969 ResetBorderBottomRightRadius(); |
2914 } | 2970 } |
| 2971 |
2915 void ResetBorderTop() { | 2972 void ResetBorderTop() { |
2916 SET_VAR(surround_data_, border_.top_, BorderColorAndStyle()); | 2973 SET_VAR(surround_data_, border_.top_, BorderStyle()); |
2917 SetBorderTopWidth(3); | 2974 SetBorderTopWidth(3); |
| 2975 SetBorderTopColorInternal(0); |
| 2976 SetBorderTopColorInternal(true); |
2918 } | 2977 } |
2919 void ResetBorderRight() { | 2978 void ResetBorderRight() { |
2920 SET_VAR(surround_data_, border_.right_, BorderColorAndStyle()); | 2979 SET_VAR(surround_data_, border_.right_, BorderStyle()); |
2921 SetBorderRightWidth(3); | 2980 SetBorderRightWidth(3); |
| 2981 SetBorderRightColorInternal(0); |
| 2982 SetBorderRightColorInternal(true); |
2922 } | 2983 } |
2923 void ResetBorderBottom() { | 2984 void ResetBorderBottom() { |
2924 SET_VAR(surround_data_, border_.bottom_, BorderColorAndStyle()); | 2985 SET_VAR(surround_data_, border_.bottom_, BorderStyle()); |
2925 SetBorderBottomWidth(3); | 2986 SetBorderBottomWidth(3); |
| 2987 SetBorderBottomColorInternal(0); |
| 2988 SetBorderBottomColorInternal(true); |
2926 } | 2989 } |
2927 void ResetBorderLeft() { | 2990 void ResetBorderLeft() { |
2928 SET_VAR(surround_data_, border_.left_, BorderColorAndStyle()); | 2991 SET_VAR(surround_data_, border_.left_, BorderStyle()); |
2929 SetBorderLeftWidth(3); | 2992 SetBorderLeftWidth(3); |
| 2993 SetBorderLeftColorInternal(0); |
| 2994 SetBorderLeftColorInternal(true); |
2930 } | 2995 } |
2931 void ResetBorderImage() { | 2996 void ResetBorderImage() { |
2932 SET_VAR(surround_data_, border_.image_, NinePieceImage()); | 2997 SET_VAR(surround_data_, border_.image_, NinePieceImage()); |
2933 } | 2998 } |
2934 | 2999 |
2935 void SetBorderRadius(const LengthSize& s) { | 3000 void SetBorderRadius(const LengthSize& s) { |
2936 SetBorderTopLeftRadius(s); | 3001 SetBorderTopLeftRadius(s); |
2937 SetBorderTopRightRadius(s); | 3002 SetBorderTopRightRadius(s); |
2938 SetBorderBottomLeftRadius(s); | 3003 SetBorderBottomLeftRadius(s); |
2939 SetBorderBottomRightRadius(s); | 3004 SetBorderBottomRightRadius(s); |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3481 display == EDisplay::kTableRow || | 3546 display == EDisplay::kTableRow || |
3482 display == EDisplay::kTableColumnGroup || | 3547 display == EDisplay::kTableColumnGroup || |
3483 display == EDisplay::kTableColumn || | 3548 display == EDisplay::kTableColumn || |
3484 display == EDisplay::kTableCell || | 3549 display == EDisplay::kTableCell || |
3485 display == EDisplay::kTableCaption; | 3550 display == EDisplay::kTableCaption; |
3486 } | 3551 } |
3487 | 3552 |
3488 // Color accessors are all private to make sure callers use | 3553 // Color accessors are all private to make sure callers use |
3489 // VisitedDependentColor instead to access them. | 3554 // VisitedDependentColor instead to access them. |
3490 StyleColor BorderLeftColor() const { | 3555 StyleColor BorderLeftColor() const { |
3491 return surround_data_->border_.Left().GetColor(); | 3556 return BorderLeftColorIsCurrentColor() |
| 3557 ? StyleColor::CurrentColor() |
| 3558 : StyleColor(BorderLeftColorInternal()); |
3492 } | 3559 } |
3493 StyleColor BorderRightColor() const { | 3560 StyleColor BorderRightColor() const { |
3494 return surround_data_->border_.Right().GetColor(); | 3561 return BorderRightColorIsCurrentColor() |
| 3562 ? StyleColor::CurrentColor() |
| 3563 : StyleColor(BorderRightColorInternal()); |
3495 } | 3564 } |
3496 StyleColor BorderTopColor() const { | 3565 StyleColor BorderTopColor() const { |
3497 return surround_data_->border_.Top().GetColor(); | 3566 return BorderTopColorIsCurrentColor() |
| 3567 ? StyleColor::CurrentColor() |
| 3568 : StyleColor(BorderTopColorInternal()); |
3498 } | 3569 } |
3499 StyleColor BorderBottomColor() const { | 3570 StyleColor BorderBottomColor() const { |
3500 return surround_data_->border_.Bottom().GetColor(); | 3571 return BorderBottomColorIsCurrentColor() |
| 3572 ? StyleColor::CurrentColor() |
| 3573 : StyleColor(BorderBottomColorInternal()); |
3501 } | 3574 } |
| 3575 |
3502 StyleColor BackgroundColor() const { | 3576 StyleColor BackgroundColor() const { |
3503 return background_data_->background_color_; | 3577 return background_data_->background_color_; |
3504 } | 3578 } |
3505 StyleAutoColor CaretColor() const { | 3579 StyleAutoColor CaretColor() const { |
3506 return rare_inherited_data_->CaretColor(); | 3580 return rare_inherited_data_->CaretColor(); |
3507 } | 3581 } |
3508 Color GetColor() const; | 3582 Color GetColor() const; |
3509 StyleColor ColumnRuleColor() const { | 3583 StyleColor ColumnRuleColor() const { |
3510 return rare_non_inherited_data_->multi_col_->rule_.GetColor(); | 3584 return rare_non_inherited_data_->multi_col_->rule_.GetColor(); |
3511 } | 3585 } |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3691 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); | 3765 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); |
3692 } | 3766 } |
3693 | 3767 |
3694 inline bool ComputedStyle::HasPseudoElementStyle() const { | 3768 inline bool ComputedStyle::HasPseudoElementStyle() const { |
3695 return PseudoBitsInternal() & kElementPseudoIdMask; | 3769 return PseudoBitsInternal() & kElementPseudoIdMask; |
3696 } | 3770 } |
3697 | 3771 |
3698 } // namespace blink | 3772 } // namespace blink |
3699 | 3773 |
3700 #endif // ComputedStyle_h | 3774 #endif // ComputedStyle_h |
OLD | NEW |