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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 if (!group->base->variable.WidthEquals(value)) \ | 108 if (!group->base->variable.WidthEquals(value)) \ |
109 group.Access()->base.Access()->variable.SetWidth(value) | 109 group.Access()->base.Access()->variable.SetWidth(value) |
110 | 110 |
111 namespace blink { | 111 namespace blink { |
112 | 112 |
113 using std::max; | 113 using std::max; |
114 | 114 |
115 class FilterOperations; | 115 class FilterOperations; |
116 | 116 |
117 class AppliedTextDecoration; | 117 class AppliedTextDecoration; |
118 class BorderData; | |
119 struct BorderEdge; | 118 struct BorderEdge; |
120 class CSSAnimationData; | 119 class CSSAnimationData; |
121 class CSSTransitionData; | 120 class CSSTransitionData; |
122 class CSSVariableData; | 121 class CSSVariableData; |
123 class Font; | 122 class Font; |
124 class Hyphenation; | 123 class Hyphenation; |
125 class RotateTransformOperation; | 124 class RotateTransformOperation; |
126 class ScaleTransformOperation; | 125 class ScaleTransformOperation; |
127 class ShadowList; | 126 class ShadowList; |
128 class ShapeValue; | 127 class ShapeValue; |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 bool HasEntirelyFixedBackground() const; | 421 bool HasEntirelyFixedBackground() const; |
423 | 422 |
424 // background-clip | 423 // background-clip |
425 EFillBox BackgroundClip() const { | 424 EFillBox BackgroundClip() const { |
426 return static_cast<EFillBox>(BackgroundInternal().Clip()); | 425 return static_cast<EFillBox>(BackgroundInternal().Clip()); |
427 } | 426 } |
428 | 427 |
429 // Border properties. | 428 // Border properties. |
430 // -webkit-border-image | 429 // -webkit-border-image |
431 static NinePieceImage InitialNinePieceImage() { return NinePieceImage(); } | 430 static NinePieceImage InitialNinePieceImage() { return NinePieceImage(); } |
432 const NinePieceImage& BorderImage() const { | 431 const NinePieceImage& BorderImage() const { return BorderImageInternal(); } |
433 return surround_data_->border_.GetImage(); | 432 void SetBorderImage(const NinePieceImage& b) { SetBorderImageInternal(b); } |
434 } | |
435 void SetBorderImage(const NinePieceImage& b) { | |
436 SET_VAR(surround_data_, border_.image_, b); | |
437 } | |
438 | 433 |
439 // border-image-slice | 434 // border-image-slice |
440 const LengthBox& BorderImageSlices() const { | 435 const LengthBox& BorderImageSlices() const { |
441 return surround_data_->border_.GetImage().ImageSlices(); | 436 return BorderImage().ImageSlices(); |
442 } | 437 } |
443 void SetBorderImageSlices(const LengthBox&); | 438 void SetBorderImageSlices(const LengthBox&); |
444 | 439 |
445 // border-image-source | 440 // border-image-source |
446 static StyleImage* InitialBorderImageSource() { return 0; } | 441 static StyleImage* InitialBorderImageSource() { return 0; } |
447 StyleImage* BorderImageSource() const { | 442 StyleImage* BorderImageSource() const { return BorderImage().GetImage(); } |
448 return surround_data_->border_.GetImage().GetImage(); | |
449 } | |
450 void SetBorderImageSource(StyleImage*); | 443 void SetBorderImageSource(StyleImage*); |
451 | 444 |
452 // border-image-width | 445 // border-image-width |
453 const BorderImageLengthBox& BorderImageWidth() const { | 446 const BorderImageLengthBox& BorderImageWidth() const { |
454 return surround_data_->border_.GetImage().BorderSlices(); | 447 return BorderImage().BorderSlices(); |
455 } | 448 } |
456 void SetBorderImageWidth(const BorderImageLengthBox&); | 449 void SetBorderImageWidth(const BorderImageLengthBox&); |
457 | 450 |
458 // border-image-outset | 451 // border-image-outset |
459 const BorderImageLengthBox& BorderImageOutset() const { | 452 const BorderImageLengthBox& BorderImageOutset() const { |
460 return surround_data_->border_.GetImage().Outset(); | 453 return BorderImage().Outset(); |
461 } | 454 } |
462 void SetBorderImageOutset(const BorderImageLengthBox&); | 455 void SetBorderImageOutset(const BorderImageLengthBox&); |
463 | 456 |
464 // Border width properties. | 457 // Border width properties. |
465 static float InitialBorderWidth() { return 3; } | 458 static float InitialBorderWidth() { return 3; } |
466 | 459 |
467 // TODO(nainar): Move all fixed point logic to a separate class. | 460 // TODO(nainar): Move all fixed point logic to a separate class. |
468 // border-top-width | 461 // border-top-width |
469 float BorderTopWidth() const { | 462 float BorderTopWidth() const { |
470 if (BorderTopStyle() == EBorderStyle::kNone || | 463 if (BorderTopStyle() == EBorderStyle::kNone || |
(...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2778 } | 2771 } |
2779 | 2772 |
2780 // Border utility functions | 2773 // Border utility functions |
2781 LayoutRectOutsets ImageOutsets(const NinePieceImage&) const; | 2774 LayoutRectOutsets ImageOutsets(const NinePieceImage&) const; |
2782 bool HasBorderImageOutsets() const { | 2775 bool HasBorderImageOutsets() const { |
2783 return BorderImage().HasImage() && BorderImage().Outset().NonZero(); | 2776 return BorderImage().HasImage() && BorderImage().Outset().NonZero(); |
2784 } | 2777 } |
2785 LayoutRectOutsets BorderImageOutsets() const { | 2778 LayoutRectOutsets BorderImageOutsets() const { |
2786 return ImageOutsets(BorderImage()); | 2779 return ImageOutsets(BorderImage()); |
2787 } | 2780 } |
2788 bool BorderImageSlicesFill() const { return Border().GetImage().Fill(); } | 2781 bool BorderImageSlicesFill() const { return BorderImage().Fill(); } |
2789 | 2782 |
2790 void SetBorderImageSlicesFill(bool); | 2783 void SetBorderImageSlicesFill(bool); |
2791 const BorderData& Border() const { return surround_data_->border_; } | |
2792 const BorderValue BorderLeft() const { | 2784 const BorderValue BorderLeft() const { |
2793 return BorderValue(BorderLeftStyle(), BorderLeftColor(), BorderLeftWidth(), | 2785 return BorderValue(BorderLeftStyle(), BorderLeftColor(), BorderLeftWidth(), |
2794 OutlineStyleIsAuto()); | 2786 OutlineStyleIsAuto()); |
2795 } | 2787 } |
2796 const BorderValue BorderRight() const { | 2788 const BorderValue BorderRight() const { |
2797 return BorderValue(BorderRightStyle(), BorderRightColor(), | 2789 return BorderValue(BorderRightStyle(), BorderRightColor(), |
2798 BorderRightWidth(), OutlineStyleIsAuto()); | 2790 BorderRightWidth(), OutlineStyleIsAuto()); |
2799 } | 2791 } |
2800 const BorderValue BorderTop() const { | 2792 const BorderValue BorderTop() const { |
2801 return BorderValue(BorderTopStyle(), BorderTopColor(), BorderTopWidth(), | 2793 return BorderValue(BorderTopStyle(), BorderTopColor(), BorderTopWidth(), |
(...skipping 15 matching lines...) Expand all Loading... |
2817 BorderValue BorderAfter() const; | 2809 BorderValue BorderAfter() const; |
2818 BorderValue BorderStart() const; | 2810 BorderValue BorderStart() const; |
2819 BorderValue BorderEnd() const; | 2811 BorderValue BorderEnd() const; |
2820 float BorderAfterWidth() const; | 2812 float BorderAfterWidth() const; |
2821 float BorderBeforeWidth() const; | 2813 float BorderBeforeWidth() const; |
2822 float BorderEndWidth() const; | 2814 float BorderEndWidth() const; |
2823 float BorderStartWidth() const; | 2815 float BorderStartWidth() const; |
2824 float BorderOverWidth() const; | 2816 float BorderOverWidth() const; |
2825 float BorderUnderWidth() const; | 2817 float BorderUnderWidth() const; |
2826 | 2818 |
2827 bool HasBorderFill() const { return Border().HasBorderFill(); } | 2819 bool HasBorderFill() const { |
| 2820 return BorderImage().HasImage() && BorderImage().Fill(); |
| 2821 } |
2828 bool HasBorder() const { | 2822 bool HasBorder() const { |
2829 return BorderLeftNonZero() || BorderRightNonZero() || BorderTopNonZero() || | 2823 return BorderLeftNonZero() || BorderRightNonZero() || BorderTopNonZero() || |
2830 BorderBottomNonZero(); | 2824 BorderBottomNonZero(); |
2831 } | 2825 } |
2832 bool HasBorderDecoration() const { return HasBorder() || HasBorderFill(); } | 2826 bool HasBorderDecoration() const { return HasBorder() || HasBorderFill(); } |
2833 bool HasBorderRadius() const { | 2827 bool HasBorderRadius() const { |
2834 if (!BorderTopLeftRadius().Width().IsZero()) | 2828 if (!BorderTopLeftRadius().Width().IsZero()) |
2835 return true; | 2829 return true; |
2836 if (!BorderTopRightRadius().Width().IsZero()) | 2830 if (!BorderTopRightRadius().Width().IsZero()) |
2837 return true; | 2831 return true; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2929 return BorderLeftEquals(o) && BorderRightEquals(o) && BorderTopEquals(o) && | 2923 return BorderLeftEquals(o) && BorderRightEquals(o) && BorderTopEquals(o) && |
2930 BorderBottomEquals(o) && BorderImage() == o.BorderImage(); | 2924 BorderBottomEquals(o) && BorderImage() == o.BorderImage(); |
2931 } | 2925 } |
2932 | 2926 |
2933 bool BorderVisuallyEqual(const ComputedStyle& o) const { | 2927 bool BorderVisuallyEqual(const ComputedStyle& o) const { |
2934 return BorderLeftVisuallyEqual(o) && BorderRightVisuallyEqual(o) && | 2928 return BorderLeftVisuallyEqual(o) && BorderRightVisuallyEqual(o) && |
2935 BorderTopVisuallyEqual(o) && BorderBottomVisuallyEqual(o) && | 2929 BorderTopVisuallyEqual(o) && BorderBottomVisuallyEqual(o) && |
2936 BorderImage() == o.BorderImage(); | 2930 BorderImage() == o.BorderImage(); |
2937 } | 2931 } |
2938 | 2932 |
| 2933 bool BorderVisualOverflowEqual(const ComputedStyle& o) const { |
| 2934 return BorderImage().Outset() == o.BorderImage().Outset(); |
| 2935 } |
| 2936 |
2939 void ResetBorder() { | 2937 void ResetBorder() { |
2940 ResetBorderImage(); | 2938 ResetBorderImage(); |
2941 ResetBorderTop(); | 2939 ResetBorderTop(); |
2942 ResetBorderRight(); | 2940 ResetBorderRight(); |
2943 ResetBorderBottom(); | 2941 ResetBorderBottom(); |
2944 ResetBorderLeft(); | 2942 ResetBorderLeft(); |
2945 ResetBorderTopLeftRadius(); | 2943 ResetBorderTopLeftRadius(); |
2946 ResetBorderTopRightRadius(); | 2944 ResetBorderTopRightRadius(); |
2947 ResetBorderBottomLeftRadius(); | 2945 ResetBorderBottomLeftRadius(); |
2948 ResetBorderBottomRightRadius(); | 2946 ResetBorderBottomRightRadius(); |
2949 } | 2947 } |
2950 | 2948 |
2951 void ResetBorderTop() { | 2949 void ResetBorderTop() { |
2952 SetBorderTopStyle(EBorderStyle::kNone); | 2950 SetBorderTopStyle(EBorderStyle::kNone); |
2953 SetBorderTopWidth(3); | 2951 SetBorderTopWidth(3); |
2954 SetBorderTopColorInternal(0); | 2952 SetBorderTopColorInternal(0); |
2955 SetBorderTopColorInternal(true); | 2953 SetBorderTopColorInternal(true); |
2956 SetBorderTopStyle(EBorderStyle::kNone); | |
2957 } | 2954 } |
2958 void ResetBorderRight() { | 2955 void ResetBorderRight() { |
2959 SetBorderRightStyle(EBorderStyle::kNone); | 2956 SetBorderRightStyle(EBorderStyle::kNone); |
2960 SetBorderRightWidth(3); | 2957 SetBorderRightWidth(3); |
2961 SetBorderRightColorInternal(0); | 2958 SetBorderRightColorInternal(0); |
2962 SetBorderRightColorInternal(true); | 2959 SetBorderRightColorInternal(true); |
2963 SetBorderRightStyle(EBorderStyle::kNone); | |
2964 } | 2960 } |
2965 void ResetBorderBottom() { | 2961 void ResetBorderBottom() { |
2966 SetBorderBottomStyle(EBorderStyle::kNone); | 2962 SetBorderBottomStyle(EBorderStyle::kNone); |
2967 SetBorderBottomWidth(3); | 2963 SetBorderBottomWidth(3); |
2968 SetBorderBottomColorInternal(0); | 2964 SetBorderBottomColorInternal(0); |
2969 SetBorderBottomColorInternal(true); | 2965 SetBorderBottomColorInternal(true); |
2970 SetBorderBottomStyle(EBorderStyle::kNone); | |
2971 } | 2966 } |
2972 void ResetBorderLeft() { | 2967 void ResetBorderLeft() { |
2973 SetBorderLeftStyle(EBorderStyle::kNone); | 2968 SetBorderLeftStyle(EBorderStyle::kNone); |
2974 SetBorderLeftWidth(3); | 2969 SetBorderLeftWidth(3); |
2975 SetBorderLeftColorInternal(0); | 2970 SetBorderLeftColorInternal(0); |
2976 SetBorderLeftColorInternal(true); | 2971 SetBorderLeftColorInternal(true); |
2977 SetBorderLeftStyle(EBorderStyle::kNone); | |
2978 } | 2972 } |
2979 void ResetBorderImage() { | 2973 void ResetBorderImage() { SetBorderImageInternal(NinePieceImage()); } |
2980 SET_VAR(surround_data_, border_.image_, NinePieceImage()); | |
2981 } | |
2982 | 2974 |
2983 void SetBorderRadius(const LengthSize& s) { | 2975 void SetBorderRadius(const LengthSize& s) { |
2984 SetBorderTopLeftRadius(s); | 2976 SetBorderTopLeftRadius(s); |
2985 SetBorderTopRightRadius(s); | 2977 SetBorderTopRightRadius(s); |
2986 SetBorderBottomLeftRadius(s); | 2978 SetBorderBottomLeftRadius(s); |
2987 SetBorderBottomRightRadius(s); | 2979 SetBorderBottomRightRadius(s); |
2988 } | 2980 } |
2989 void SetBorderRadius(const IntSize& s) { | 2981 void SetBorderRadius(const IntSize& s) { |
2990 SetBorderRadius( | 2982 SetBorderRadius( |
2991 LengthSize(Length(s.Width(), kFixed), Length(s.Height(), kFixed))); | 2983 LengthSize(Length(s.Width(), kFixed), Length(s.Height(), kFixed))); |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3778 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); | 3770 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); |
3779 } | 3771 } |
3780 | 3772 |
3781 inline bool ComputedStyle::HasPseudoElementStyle() const { | 3773 inline bool ComputedStyle::HasPseudoElementStyle() const { |
3782 return PseudoBitsInternal() & kElementPseudoIdMask; | 3774 return PseudoBitsInternal() & kElementPseudoIdMask; |
3783 } | 3775 } |
3784 | 3776 |
3785 } // namespace blink | 3777 } // namespace blink |
3786 | 3778 |
3787 #endif // ComputedStyle_h | 3779 #endif // ComputedStyle_h |
OLD | NEW |