Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.h

Issue 2891003002: Store border-image-* on SurroundData in ComputedStyle (Closed)
Patch Set: Ready for review Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 bool HasEntirelyFixedBackground() const; 470 bool HasEntirelyFixedBackground() const;
472 471
473 // background-clip 472 // background-clip
474 EFillBox BackgroundClip() const { 473 EFillBox BackgroundClip() const {
475 return static_cast<EFillBox>(BackgroundInternal().Clip()); 474 return static_cast<EFillBox>(BackgroundInternal().Clip());
476 } 475 }
477 476
478 // Border properties. 477 // Border properties.
479 // -webkit-border-image 478 // -webkit-border-image
480 static NinePieceImage InitialNinePieceImage() { return NinePieceImage(); } 479 static NinePieceImage InitialNinePieceImage() { return NinePieceImage(); }
481 const NinePieceImage& BorderImage() const { 480 const NinePieceImage& BorderImage() const { return BorderImageInternal(); }
482 return surround_data_->border_.GetImage(); 481 void SetBorderImage(const NinePieceImage& b) { SetBorderImageInternal(b); }
shend 2017/05/18 05:40:33 In a future patch, could BorderImage actually be a
nainar 2017/05/18 06:00:50 Got it.
483 }
484 void SetBorderImage(const NinePieceImage& b) {
485 SET_VAR(surround_data_, border_.image_, b);
486 }
487 482
488 // border-image-slice 483 // border-image-slice
489 const LengthBox& BorderImageSlices() const { 484 const LengthBox& BorderImageSlices() const {
490 return surround_data_->border_.GetImage().ImageSlices(); 485 return BorderImage().ImageSlices();
491 } 486 }
492 void SetBorderImageSlices(const LengthBox&); 487 void SetBorderImageSlices(const LengthBox&);
493 488
494 // border-image-source 489 // border-image-source
495 static StyleImage* InitialBorderImageSource() { return 0; } 490 static StyleImage* InitialBorderImageSource() { return 0; }
496 StyleImage* BorderImageSource() const { 491 StyleImage* BorderImageSource() const { return BorderImage().GetImage(); }
497 return surround_data_->border_.GetImage().GetImage();
498 }
499 void SetBorderImageSource(StyleImage*); 492 void SetBorderImageSource(StyleImage*);
500 493
501 // border-image-width 494 // border-image-width
502 const BorderImageLengthBox& BorderImageWidth() const { 495 const BorderImageLengthBox& BorderImageWidth() const {
503 return surround_data_->border_.GetImage().BorderSlices(); 496 return BorderImage().BorderSlices();
504 } 497 }
505 void SetBorderImageWidth(const BorderImageLengthBox&); 498 void SetBorderImageWidth(const BorderImageLengthBox&);
506 499
507 // border-image-outset 500 // border-image-outset
508 const BorderImageLengthBox& BorderImageOutset() const { 501 const BorderImageLengthBox& BorderImageOutset() const {
509 return surround_data_->border_.GetImage().Outset(); 502 return BorderImage().Outset();
510 } 503 }
511 void SetBorderImageOutset(const BorderImageLengthBox&); 504 void SetBorderImageOutset(const BorderImageLengthBox&);
512 505
513 // Border width properties. 506 // Border width properties.
514 static float InitialBorderWidth() { return 3; } 507 static float InitialBorderWidth() { return 3; }
515 508
516 // TODO(nainar): Move all fixed point logic to a separate class. 509 // TODO(nainar): Move all fixed point logic to a separate class.
517 // border-top-width 510 // border-top-width
518 float BorderTopWidth() const { 511 float BorderTopWidth() const {
519 if (BorderTopStyle() == EBorderStyle::kNone || 512 if (BorderTopStyle() == EBorderStyle::kNone ||
(...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after
2827 } 2820 }
2828 2821
2829 // Border utility functions 2822 // Border utility functions
2830 LayoutRectOutsets ImageOutsets(const NinePieceImage&) const; 2823 LayoutRectOutsets ImageOutsets(const NinePieceImage&) const;
2831 bool HasBorderImageOutsets() const { 2824 bool HasBorderImageOutsets() const {
2832 return BorderImage().HasImage() && BorderImage().Outset().NonZero(); 2825 return BorderImage().HasImage() && BorderImage().Outset().NonZero();
2833 } 2826 }
2834 LayoutRectOutsets BorderImageOutsets() const { 2827 LayoutRectOutsets BorderImageOutsets() const {
2835 return ImageOutsets(BorderImage()); 2828 return ImageOutsets(BorderImage());
2836 } 2829 }
2837 bool BorderImageSlicesFill() const { return Border().GetImage().Fill(); } 2830 bool BorderImageSlicesFill() const { return BorderImage().Fill(); }
2838 2831
2839 void SetBorderImageSlicesFill(bool); 2832 void SetBorderImageSlicesFill(bool);
2840 const BorderData& Border() const { return surround_data_->border_; }
2841 const BorderValue BorderLeft() const { 2833 const BorderValue BorderLeft() const {
2842 return BorderValue(BorderLeftStyle(), BorderLeftColor(), BorderLeftWidth(), 2834 return BorderValue(BorderLeftStyle(), BorderLeftColor(), BorderLeftWidth(),
2843 OutlineStyleIsAuto()); 2835 OutlineStyleIsAuto());
2844 } 2836 }
2845 const BorderValue BorderRight() const { 2837 const BorderValue BorderRight() const {
2846 return BorderValue(BorderRightStyle(), BorderRightColor(), 2838 return BorderValue(BorderRightStyle(), BorderRightColor(),
2847 BorderRightWidth(), OutlineStyleIsAuto()); 2839 BorderRightWidth(), OutlineStyleIsAuto());
2848 } 2840 }
2849 const BorderValue BorderTop() const { 2841 const BorderValue BorderTop() const {
2850 return BorderValue(BorderTopStyle(), BorderTopColor(), BorderTopWidth(), 2842 return BorderValue(BorderTopStyle(), BorderTopColor(), BorderTopWidth(),
(...skipping 15 matching lines...) Expand all
2866 BorderValue BorderAfter() const; 2858 BorderValue BorderAfter() const;
2867 BorderValue BorderStart() const; 2859 BorderValue BorderStart() const;
2868 BorderValue BorderEnd() const; 2860 BorderValue BorderEnd() const;
2869 float BorderAfterWidth() const; 2861 float BorderAfterWidth() const;
2870 float BorderBeforeWidth() const; 2862 float BorderBeforeWidth() const;
2871 float BorderEndWidth() const; 2863 float BorderEndWidth() const;
2872 float BorderStartWidth() const; 2864 float BorderStartWidth() const;
2873 float BorderOverWidth() const; 2865 float BorderOverWidth() const;
2874 float BorderUnderWidth() const; 2866 float BorderUnderWidth() const;
2875 2867
2876 bool HasBorderFill() const { return Border().HasBorderFill(); } 2868 bool HasBorderFill() const {
2869 return BorderImage().HasImage() && BorderImage().Fill();
2870 }
2877 bool HasBorder() const { 2871 bool HasBorder() const {
2878 return BorderLeftNonZero() || BorderRightNonZero() || BorderTopNonZero() || 2872 return BorderLeftNonZero() || BorderRightNonZero() || BorderTopNonZero() ||
2879 BorderBottomNonZero(); 2873 BorderBottomNonZero();
2880 } 2874 }
2881 bool HasBorderDecoration() const { return HasBorder() || HasBorderFill(); } 2875 bool HasBorderDecoration() const { return HasBorder() || HasBorderFill(); }
2882 bool HasBorderRadius() const { 2876 bool HasBorderRadius() const {
2883 if (!BorderTopLeftRadius().Width().IsZero()) 2877 if (!BorderTopLeftRadius().Width().IsZero())
2884 return true; 2878 return true;
2885 if (!BorderTopRightRadius().Width().IsZero()) 2879 if (!BorderTopRightRadius().Width().IsZero())
2886 return true; 2880 return true;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
2978 return BorderLeftEquals(o) && BorderRightEquals(o) && BorderTopEquals(o) && 2972 return BorderLeftEquals(o) && BorderRightEquals(o) && BorderTopEquals(o) &&
2979 BorderBottomEquals(o) && BorderImage() == o.BorderImage(); 2973 BorderBottomEquals(o) && BorderImage() == o.BorderImage();
2980 } 2974 }
2981 2975
2982 bool BorderVisuallyEqual(const ComputedStyle& o) const { 2976 bool BorderVisuallyEqual(const ComputedStyle& o) const {
2983 return BorderLeftVisuallyEqual(o) && BorderRightVisuallyEqual(o) && 2977 return BorderLeftVisuallyEqual(o) && BorderRightVisuallyEqual(o) &&
2984 BorderTopVisuallyEqual(o) && BorderBottomVisuallyEqual(o) && 2978 BorderTopVisuallyEqual(o) && BorderBottomVisuallyEqual(o) &&
2985 BorderImage() == o.BorderImage(); 2979 BorderImage() == o.BorderImage();
2986 } 2980 }
2987 2981
2982 bool BorderVisualOverflowEqual(const ComputedStyle& o) const {
2983 return BorderImage().Outset() == o.BorderImage().Outset();
2984 }
2985
2988 void ResetBorder() { 2986 void ResetBorder() {
2989 ResetBorderImage(); 2987 ResetBorderImage();
2990 ResetBorderTop(); 2988 ResetBorderTop();
2991 ResetBorderRight(); 2989 ResetBorderRight();
2992 ResetBorderBottom(); 2990 ResetBorderBottom();
2993 ResetBorderLeft(); 2991 ResetBorderLeft();
2994 ResetBorderTopLeftRadius(); 2992 ResetBorderTopLeftRadius();
2995 ResetBorderTopRightRadius(); 2993 ResetBorderTopRightRadius();
2996 ResetBorderBottomLeftRadius(); 2994 ResetBorderBottomLeftRadius();
2997 ResetBorderBottomRightRadius(); 2995 ResetBorderBottomRightRadius();
2998 } 2996 }
2999 2997
3000 void ResetBorderTop() { 2998 void ResetBorderTop() {
3001 SetBorderTopStyle(EBorderStyle::kNone); 2999 SetBorderTopStyle(EBorderStyle::kNone);
3002 SetBorderTopWidth(3); 3000 SetBorderTopWidth(3);
3003 SetBorderTopColorInternal(0); 3001 SetBorderTopColorInternal(0);
3004 SetBorderTopColorInternal(true); 3002 SetBorderTopColorInternal(true);
3005 SetBorderTopStyle(EBorderStyle::kNone);
nainar 2017/05/18 05:27:34 These are remenants from a previous CL - clearing
shend 2017/05/18 05:40:33 :/
3006 } 3003 }
3007 void ResetBorderRight() { 3004 void ResetBorderRight() {
3008 SetBorderRightStyle(EBorderStyle::kNone); 3005 SetBorderRightStyle(EBorderStyle::kNone);
3009 SetBorderRightWidth(3); 3006 SetBorderRightWidth(3);
3010 SetBorderRightColorInternal(0); 3007 SetBorderRightColorInternal(0);
3011 SetBorderRightColorInternal(true); 3008 SetBorderRightColorInternal(true);
3012 SetBorderRightStyle(EBorderStyle::kNone);
3013 } 3009 }
3014 void ResetBorderBottom() { 3010 void ResetBorderBottom() {
3015 SetBorderBottomStyle(EBorderStyle::kNone); 3011 SetBorderBottomStyle(EBorderStyle::kNone);
3016 SetBorderBottomWidth(3); 3012 SetBorderBottomWidth(3);
3017 SetBorderBottomColorInternal(0); 3013 SetBorderBottomColorInternal(0);
3018 SetBorderBottomColorInternal(true); 3014 SetBorderBottomColorInternal(true);
3019 SetBorderBottomStyle(EBorderStyle::kNone);
3020 } 3015 }
3021 void ResetBorderLeft() { 3016 void ResetBorderLeft() {
3022 SetBorderLeftStyle(EBorderStyle::kNone); 3017 SetBorderLeftStyle(EBorderStyle::kNone);
3023 SetBorderLeftWidth(3); 3018 SetBorderLeftWidth(3);
3024 SetBorderLeftColorInternal(0); 3019 SetBorderLeftColorInternal(0);
3025 SetBorderLeftColorInternal(true); 3020 SetBorderLeftColorInternal(true);
3026 SetBorderLeftStyle(EBorderStyle::kNone);
3027 } 3021 }
3028 void ResetBorderImage() { 3022 void ResetBorderImage() { SetBorderImageInternal(NinePieceImage()); }
shend 2017/05/18 05:40:33 When we generate border-image as external, we get
nainar 2017/05/18 06:00:50 Got it.
3029 SET_VAR(surround_data_, border_.image_, NinePieceImage());
3030 }
3031 3023
3032 void SetBorderRadius(const LengthSize& s) { 3024 void SetBorderRadius(const LengthSize& s) {
3033 SetBorderTopLeftRadius(s); 3025 SetBorderTopLeftRadius(s);
3034 SetBorderTopRightRadius(s); 3026 SetBorderTopRightRadius(s);
3035 SetBorderBottomLeftRadius(s); 3027 SetBorderBottomLeftRadius(s);
3036 SetBorderBottomRightRadius(s); 3028 SetBorderBottomRightRadius(s);
3037 } 3029 }
3038 void SetBorderRadius(const IntSize& s) { 3030 void SetBorderRadius(const IntSize& s) {
3039 SetBorderRadius( 3031 SetBorderRadius(
3040 LengthSize(Length(s.Width(), kFixed), Length(s.Height(), kFixed))); 3032 LengthSize(Length(s.Width(), kFixed), Length(s.Height(), kFixed)));
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
3829 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); 3821 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId)));
3830 } 3822 }
3831 3823
3832 inline bool ComputedStyle::HasPseudoElementStyle() const { 3824 inline bool ComputedStyle::HasPseudoElementStyle() const {
3833 return PseudoBitsInternal() & kElementPseudoIdMask; 3825 return PseudoBitsInternal() & kElementPseudoIdMask;
3834 } 3826 }
3835 3827
3836 } // namespace blink 3828 } // namespace blink
3837 3829
3838 #endif // ComputedStyle_h 3830 #endif // ComputedStyle_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/CachedUAStyle.h ('k') | third_party/WebKit/Source/core/style/ComputedStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698