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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
555 // border-bottom-style | 555 // border-bottom-style |
556 EBorderStyle BorderBottomStyle() const { | 556 EBorderStyle BorderBottomStyle() const { |
557 return surround_data_->border_.Bottom().Style(); | 557 return surround_data_->border_.Bottom().Style(); |
558 } | 558 } |
559 void SetBorderBottomStyle(EBorderStyle v) { | 559 void SetBorderBottomStyle(EBorderStyle v) { |
560 SET_VAR(surround_data_, border_.bottom_.style_, v); | 560 SET_VAR(surround_data_, border_.bottom_.style_, v); |
561 } | 561 } |
562 | 562 |
563 // Border color properties. | 563 // Border color properties. |
564 // border-left-color | 564 // border-left-color |
565 void SetBorderLeftColor(const StyleColor& v) { | 565 void SetBorderLeftColor(const StyleColor& color) { |
566 SET_BORDERVALUE_COLOR(surround_data_, border_.left_, v); | 566 SetBorderLeftColorInternal(color.Resolve(Color())); |
567 SetBorderLeftColorIsCurrentColor(color.IsCurrentColor()); | |
567 } | 568 } |
568 | 569 |
569 // border-right-color | 570 // border-right-color |
570 void SetBorderRightColor(const StyleColor& v) { | 571 void SetBorderRightColor(const StyleColor& color) { |
571 SET_BORDERVALUE_COLOR(surround_data_, border_.right_, v); | 572 SetBorderRightColorInternal(color.Resolve(Color())); |
573 SetBorderRightColorIsCurrentColor(color.IsCurrentColor()); | |
572 } | 574 } |
573 | 575 |
574 // border-top-color | 576 // border-top-color |
575 void SetBorderTopColor(const StyleColor& v) { | 577 void SetBorderTopColor(const StyleColor& color) { |
576 SET_BORDERVALUE_COLOR(surround_data_, border_.top_, v); | 578 SetBorderTopColorInternal(color.Resolve(Color())); |
579 SetBorderTopColorIsCurrentColor(color.IsCurrentColor()); | |
577 } | 580 } |
578 | 581 |
579 // border-bottom-color | 582 // border-bottom-color |
580 void SetBorderBottomColor(const StyleColor& v) { | 583 void SetBorderBottomColor(const StyleColor& color) { |
581 SET_BORDERVALUE_COLOR(surround_data_, border_.bottom_, v); | 584 SetBorderBottomColorInternal(color.Resolve(Color())); |
shend
2017/05/09 07:24:41
Can we get rid of this macro now?
nainar
2017/05/09 07:40:39
Nope. Needed by BorderValue.
| |
585 SetBorderBottomColorIsCurrentColor(color.IsCurrentColor()); | |
582 } | 586 } |
583 | 587 |
584 // box-shadow (aka -webkit-box-shadow) | 588 // box-shadow (aka -webkit-box-shadow) |
585 static ShadowList* InitialBoxShadow() { return 0; } | 589 static ShadowList* InitialBoxShadow() { return 0; } |
586 ShadowList* BoxShadow() const { | 590 ShadowList* BoxShadow() const { |
587 return rare_non_inherited_data_->box_shadow_.Get(); | 591 return rare_non_inherited_data_->box_shadow_.Get(); |
588 } | 592 } |
589 void SetBoxShadow(PassRefPtr<ShadowList>); | 593 void SetBoxShadow(PassRefPtr<ShadowList>); |
590 | 594 |
591 // box-sizing (aka -webkit-box-sizing) | 595 // box-sizing (aka -webkit-box-sizing) |
(...skipping 2247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2839 return BorderImage().HasImage() && BorderImage().Outset().NonZero(); | 2843 return BorderImage().HasImage() && BorderImage().Outset().NonZero(); |
2840 } | 2844 } |
2841 LayoutRectOutsets BorderImageOutsets() const { | 2845 LayoutRectOutsets BorderImageOutsets() const { |
2842 return ImageOutsets(BorderImage()); | 2846 return ImageOutsets(BorderImage()); |
2843 } | 2847 } |
2844 bool BorderImageSlicesFill() const { return Border().GetImage().Fill(); } | 2848 bool BorderImageSlicesFill() const { return Border().GetImage().Fill(); } |
2845 | 2849 |
2846 void SetBorderImageSlicesFill(bool); | 2850 void SetBorderImageSlicesFill(bool); |
2847 const BorderData& Border() const { return surround_data_->border_; } | 2851 const BorderData& Border() const { return surround_data_->border_; } |
2848 const BorderValue BorderLeft() const { | 2852 const BorderValue BorderLeft() const { |
2849 return BorderValue(surround_data_->border_.Left(), BorderLeftWidth()); | 2853 return BorderValue(surround_data_->border_.Left(), |
2854 VisitedDependentColor(CSSPropertyBorderLeftColor), | |
2855 BorderLeftWidth()); | |
2850 } | 2856 } |
2851 const BorderValue BorderRight() const { | 2857 const BorderValue BorderRight() const { |
2852 return BorderValue(surround_data_->border_.Right(), BorderRightWidth()); | 2858 return BorderValue(surround_data_->border_.Right(), |
2859 VisitedDependentColor(CSSPropertyBorderRightColor), | |
2860 BorderRightWidth()); | |
2853 } | 2861 } |
2854 const BorderValue BorderTop() const { | 2862 const BorderValue BorderTop() const { |
2855 return BorderValue(surround_data_->border_.Top(), BorderTopWidth()); | 2863 return BorderValue(surround_data_->border_.Top(), |
2864 VisitedDependentColor(CSSPropertyBorderTopColor), | |
2865 BorderTopWidth()); | |
2856 } | 2866 } |
2857 const BorderValue BorderBottom() const { | 2867 const BorderValue BorderBottom() const { |
2858 return BorderValue(surround_data_->border_.Bottom(), BorderBottomWidth()); | 2868 return BorderValue(surround_data_->border_.Bottom(), |
2869 VisitedDependentColor(CSSPropertyBorderBottomColor), | |
2870 BorderBottomWidth()); | |
2859 } | 2871 } |
2860 bool BorderSizeEquals(const ComputedStyle& o) const { | 2872 bool BorderSizeEquals(const ComputedStyle& o) const { |
2861 return BorderWidthEquals(BorderLeftWidth(), o.BorderLeftWidth()) && | 2873 return BorderWidthEquals(BorderLeftWidth(), o.BorderLeftWidth()) && |
2862 BorderWidthEquals(BorderTopWidth(), o.BorderTopWidth()) && | 2874 BorderWidthEquals(BorderTopWidth(), o.BorderTopWidth()) && |
2863 BorderWidthEquals(BorderRightWidth(), o.BorderRightWidth()) && | 2875 BorderWidthEquals(BorderRightWidth(), o.BorderRightWidth()) && |
2864 BorderWidthEquals(BorderBottomWidth(), o.BorderBottomWidth()); | 2876 BorderWidthEquals(BorderBottomWidth(), o.BorderBottomWidth()); |
2865 } | 2877 } |
2866 const BorderValue BorderBefore() const; | 2878 const BorderValue BorderBefore() const; |
2867 const BorderValue BorderAfter() const; | 2879 const BorderValue BorderAfter() const; |
2868 const BorderValue BorderStart() const; | 2880 const BorderValue BorderStart() const; |
(...skipping 16 matching lines...) Expand all Loading... | |
2885 return true; | 2897 return true; |
2886 if (!BorderTopRightRadius().Width().IsZero()) | 2898 if (!BorderTopRightRadius().Width().IsZero()) |
2887 return true; | 2899 return true; |
2888 if (!BorderBottomLeftRadius().Width().IsZero()) | 2900 if (!BorderBottomLeftRadius().Width().IsZero()) |
2889 return true; | 2901 return true; |
2890 if (!BorderBottomRightRadius().Width().IsZero()) | 2902 if (!BorderBottomRightRadius().Width().IsZero()) |
2891 return true; | 2903 return true; |
2892 return false; | 2904 return false; |
2893 } | 2905 } |
2894 bool HasBorderColorReferencingCurrentColor() const { | 2906 bool HasBorderColorReferencingCurrentColor() const { |
2895 return Border().HasBorderColorReferencingCurrentColor(); | 2907 return (BorderLeft().NonZero() && BorderLeftColor().IsCurrentColor()) || |
2908 (BorderRight().NonZero() && BorderRightColor().IsCurrentColor()) || | |
2909 (BorderTop().NonZero() && BorderTopColor().IsCurrentColor()) || | |
2910 (BorderBottom().NonZero() && BorderBottomColor().IsCurrentColor()); | |
2896 } | 2911 } |
2897 | 2912 |
2898 bool RadiiEqual(const ComputedStyle& o) const { | 2913 bool RadiiEqual(const ComputedStyle& o) const { |
2899 return BorderTopLeftRadius() == o.BorderTopLeftRadius() && | 2914 return BorderTopLeftRadius() == o.BorderTopLeftRadius() && |
2900 BorderTopRightRadius() == o.BorderTopRightRadius() && | 2915 BorderTopRightRadius() == o.BorderTopRightRadius() && |
2901 BorderBottomLeftRadius() == o.BorderBottomLeftRadius() && | 2916 BorderBottomLeftRadius() == o.BorderBottomLeftRadius() && |
2902 BorderBottomRightRadius() == o.BorderBottomRightRadius(); | 2917 BorderBottomRightRadius() == o.BorderBottomRightRadius(); |
2903 } | 2918 } |
2904 | 2919 |
2905 void ResetBorder() { | 2920 void ResetBorder() { |
2906 ResetBorderImage(); | 2921 ResetBorderImage(); |
2907 ResetBorderTop(); | 2922 ResetBorderTop(); |
2908 ResetBorderRight(); | 2923 ResetBorderRight(); |
2909 ResetBorderBottom(); | 2924 ResetBorderBottom(); |
2910 ResetBorderLeft(); | 2925 ResetBorderLeft(); |
2911 ResetBorderTopLeftRadius(); | 2926 ResetBorderTopLeftRadius(); |
2912 ResetBorderTopRightRadius(); | 2927 ResetBorderTopRightRadius(); |
2913 ResetBorderBottomLeftRadius(); | 2928 ResetBorderBottomLeftRadius(); |
2914 ResetBorderBottomRightRadius(); | 2929 ResetBorderBottomRightRadius(); |
2915 } | 2930 } |
2916 void ResetBorderTop() { | 2931 void ResetBorderTop() { |
2917 SET_VAR(surround_data_, border_.top_, BorderColorAndStyle()); | 2932 SET_VAR(surround_data_, border_.top_, BorderStyle()); |
2918 SetBorderTopWidth(3); | 2933 SetBorderTopWidth(3); |
2919 } | 2934 } |
2920 void ResetBorderRight() { | 2935 void ResetBorderRight() { |
2921 SET_VAR(surround_data_, border_.right_, BorderColorAndStyle()); | 2936 SET_VAR(surround_data_, border_.right_, BorderStyle()); |
2922 SetBorderRightWidth(3); | 2937 SetBorderRightWidth(3); |
2923 } | 2938 } |
2924 void ResetBorderBottom() { | 2939 void ResetBorderBottom() { |
2925 SET_VAR(surround_data_, border_.bottom_, BorderColorAndStyle()); | 2940 SET_VAR(surround_data_, border_.bottom_, BorderStyle()); |
2926 SetBorderBottomWidth(3); | 2941 SetBorderBottomWidth(3); |
2927 } | 2942 } |
2928 void ResetBorderLeft() { | 2943 void ResetBorderLeft() { |
2929 SET_VAR(surround_data_, border_.left_, BorderColorAndStyle()); | 2944 SET_VAR(surround_data_, border_.left_, BorderStyle()); |
2930 SetBorderLeftWidth(3); | 2945 SetBorderLeftWidth(3); |
2931 } | 2946 } |
2932 void ResetBorderImage() { | 2947 void ResetBorderImage() { |
2933 SET_VAR(surround_data_, border_.image_, NinePieceImage()); | 2948 SET_VAR(surround_data_, border_.image_, NinePieceImage()); |
2934 } | 2949 } |
2935 | 2950 |
2936 void SetBorderRadius(const LengthSize& s) { | 2951 void SetBorderRadius(const LengthSize& s) { |
2937 SetBorderTopLeftRadius(s); | 2952 SetBorderTopLeftRadius(s); |
2938 SetBorderTopRightRadius(s); | 2953 SetBorderTopRightRadius(s); |
2939 SetBorderBottomLeftRadius(s); | 2954 SetBorderBottomLeftRadius(s); |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3482 display == EDisplay::kTableRow || | 3497 display == EDisplay::kTableRow || |
3483 display == EDisplay::kTableColumnGroup || | 3498 display == EDisplay::kTableColumnGroup || |
3484 display == EDisplay::kTableColumn || | 3499 display == EDisplay::kTableColumn || |
3485 display == EDisplay::kTableCell || | 3500 display == EDisplay::kTableCell || |
3486 display == EDisplay::kTableCaption; | 3501 display == EDisplay::kTableCaption; |
3487 } | 3502 } |
3488 | 3503 |
3489 // Color accessors are all private to make sure callers use | 3504 // Color accessors are all private to make sure callers use |
3490 // VisitedDependentColor instead to access them. | 3505 // VisitedDependentColor instead to access them. |
3491 StyleColor BorderLeftColor() const { | 3506 StyleColor BorderLeftColor() const { |
3492 return surround_data_->border_.Left().GetColor(); | 3507 return BorderLeftColorIsCurrentColor() |
3508 ? StyleColor::CurrentColor() | |
3509 : StyleColor(BorderBottomColorInternal()); | |
3493 } | 3510 } |
3494 StyleColor BorderRightColor() const { | 3511 StyleColor BorderRightColor() const { |
3495 return surround_data_->border_.Right().GetColor(); | 3512 return BorderRightColorIsCurrentColor() |
3513 ? StyleColor::CurrentColor() | |
3514 : StyleColor(BorderBottomColorInternal()); | |
3496 } | 3515 } |
3497 StyleColor BorderTopColor() const { | 3516 StyleColor BorderTopColor() const { |
3498 return surround_data_->border_.Top().GetColor(); | 3517 return BorderTopColorIsCurrentColor() |
3518 ? StyleColor::CurrentColor() | |
3519 : StyleColor(BorderBottomColorInternal()); | |
3499 } | 3520 } |
3500 StyleColor BorderBottomColor() const { | 3521 StyleColor BorderBottomColor() const { |
3501 return surround_data_->border_.Bottom().GetColor(); | 3522 return BorderBottomColorIsCurrentColor() |
3523 ? StyleColor::CurrentColor() | |
3524 : StyleColor(BorderBottomColorInternal()); | |
3502 } | 3525 } |
3503 StyleColor BackgroundColor() const { | 3526 StyleColor BackgroundColor() const { |
3504 return background_data_->background_color_; | 3527 return background_data_->background_color_; |
3505 } | 3528 } |
3506 StyleAutoColor CaretColor() const { | 3529 StyleAutoColor CaretColor() const { |
3507 return rare_inherited_data_->CaretColor(); | 3530 return rare_inherited_data_->CaretColor(); |
3508 } | 3531 } |
3509 Color GetColor() const; | 3532 Color GetColor() const; |
3510 StyleColor ColumnRuleColor() const { | 3533 StyleColor ColumnRuleColor() const { |
3511 return rare_non_inherited_data_->multi_col_->rule_.GetColor(); | 3534 return rare_non_inherited_data_->multi_col_->rule_.GetColor(); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3692 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); | 3715 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); |
3693 } | 3716 } |
3694 | 3717 |
3695 inline bool ComputedStyle::HasPseudoElementStyle() const { | 3718 inline bool ComputedStyle::HasPseudoElementStyle() const { |
3696 return PseudoBitsInternal() & kElementPseudoIdMask; | 3719 return PseudoBitsInternal() & kElementPseudoIdMask; |
3697 } | 3720 } |
3698 | 3721 |
3699 } // namespace blink | 3722 } // namespace blink |
3700 | 3723 |
3701 #endif // ComputedStyle_h | 3724 #endif // ComputedStyle_h |
OLD | NEW |