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

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

Issue 2861773004: Move border-*-width out of BorderValue and store on SurroundData in ComputedStyle instead (Closed)
Patch Set: 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 493
494 // border-image-outset 494 // border-image-outset
495 const BorderImageLengthBox& BorderImageOutset() const { 495 const BorderImageLengthBox& BorderImageOutset() const {
496 return surround_data_->border_.GetImage().Outset(); 496 return surround_data_->border_.GetImage().Outset();
497 } 497 }
498 void SetBorderImageOutset(const BorderImageLengthBox&); 498 void SetBorderImageOutset(const BorderImageLengthBox&);
499 499
500 // Border width properties. 500 // Border width properties.
501 static float InitialBorderWidth() { return 3; } 501 static float InitialBorderWidth() { return 3; }
502 502
503 // border-top-width
504 float BorderTopWidth() const {
505 return surround_data_->border_.BorderTopWidth();
506 }
507 void SetBorderTopWidth(float v) {
508 SET_BORDER_WIDTH(surround_data_, border_.top_, v);
509 }
510
511 // border-bottom-width
512 float BorderBottomWidth() const {
513 return surround_data_->border_.BorderBottomWidth();
514 }
515 void SetBorderBottomWidth(float v) {
516 SET_BORDER_WIDTH(surround_data_, border_.bottom_, v);
517 }
518
519 // border-left-width
520 float BorderLeftWidth() const {
521 return surround_data_->border_.BorderLeftWidth();
522 }
523 void SetBorderLeftWidth(float v) {
524 SET_BORDER_WIDTH(surround_data_, border_.left_, v);
525 }
526
527 // border-right-width
528 float BorderRightWidth() const {
529 return surround_data_->border_.BorderRightWidth();
530 }
531 void SetBorderRightWidth(float v) {
532 SET_BORDER_WIDTH(surround_data_, border_.right_, v);
533 }
534
535 // Border style properties. 503 // Border style properties.
536 static EBorderStyle InitialBorderStyle() { return kBorderStyleNone; } 504 static EBorderStyle InitialBorderStyle() { return kBorderStyleNone; }
537 505
538 // border-top-style 506 // border-top-style
539 EBorderStyle BorderTopStyle() const { 507 EBorderStyle BorderTopStyle() const {
540 return surround_data_->border_.Top().Style(); 508 return surround_data_->border_.Top().Style();
541 } 509 }
542 void SetBorderTopStyle(EBorderStyle v) { 510 void SetBorderTopStyle(EBorderStyle v) {
543 SET_VAR(surround_data_, border_.top_.style_, v); 511 SET_VAR(surround_data_, border_.top_.style_, v);
544 } 512 }
(...skipping 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after
2846 return BorderImage().HasImage() && BorderImage().Outset().NonZero(); 2814 return BorderImage().HasImage() && BorderImage().Outset().NonZero();
2847 } 2815 }
2848 LayoutRectOutsets BorderImageOutsets() const { 2816 LayoutRectOutsets BorderImageOutsets() const {
2849 return ImageOutsets(BorderImage()); 2817 return ImageOutsets(BorderImage());
2850 } 2818 }
2851 bool BorderImageSlicesFill() const { return Border().GetImage().Fill(); } 2819 bool BorderImageSlicesFill() const { return Border().GetImage().Fill(); }
2852 2820
2853 void SetBorderImageSlicesFill(bool); 2821 void SetBorderImageSlicesFill(bool);
2854 const BorderData& Border() const { return surround_data_->border_; } 2822 const BorderData& Border() const { return surround_data_->border_; }
2855 const BorderValue& BorderLeft() const { 2823 const BorderValue& BorderLeft() const {
2856 return surround_data_->border_.Left(); 2824 BorderValue* border_value =
2825 new BorderValue(surround_data_->border_.Left(), BorderLeftWidth());
2826 return *border_value;
2857 } 2827 }
2858 const BorderValue& BorderRight() const { 2828 const BorderValue& BorderRight() const {
2859 return surround_data_->border_.Right(); 2829 BorderValue* border_value =
2830 new BorderValue(surround_data_->border_.Right(), BorderRightWidth());
2831 return *border_value;
2860 } 2832 }
2861 const BorderValue& BorderTop() const { return surround_data_->border_.Top(); } 2833 const BorderValue& BorderTop() const {
2834 BorderValue* border_value =
2835 new BorderValue(surround_data_->border_.Top(), BorderTopWidth());
2836 return *border_value;
2837 }
2862 const BorderValue& BorderBottom() const { 2838 const BorderValue& BorderBottom() const {
2863 return surround_data_->border_.Bottom(); 2839 BorderValue* border_value =
2840 new BorderValue(surround_data_->border_.Bottom(), BorderBottomWidth());
2841 return *border_value;
2842 }
2843 bool BorderSizeEquals(const ComputedStyle& o) const {
2844 return BorderLeftWidth() == o.BorderLeftWidth() &&
2845 BorderTopWidth() == o.BorderTopWidth() &&
2846 BorderRightWidth() == o.BorderRightWidth() &&
2847 BorderBottomWidth() == o.BorderBottomWidth();
2864 } 2848 }
2865 const BorderValue& BorderBefore() const; 2849 const BorderValue& BorderBefore() const;
2866 const BorderValue& BorderAfter() const; 2850 const BorderValue& BorderAfter() const;
2867 const BorderValue& BorderStart() const; 2851 const BorderValue& BorderStart() const;
2868 const BorderValue& BorderEnd() const; 2852 const BorderValue& BorderEnd() const;
2869 float BorderAfterWidth() const; 2853 float BorderAfterWidth() const;
2870 float BorderBeforeWidth() const; 2854 float BorderBeforeWidth() const;
2871 float BorderEndWidth() const; 2855 float BorderEndWidth() const;
2872 float BorderStartWidth() const; 2856 float BorderStartWidth() const;
2873 float BorderOverWidth() const; 2857 float BorderOverWidth() const;
2874 float BorderUnderWidth() const; 2858 float BorderUnderWidth() const;
2875 2859
2876 bool HasBorderFill() const { return Border().HasBorderFill(); } 2860 bool HasBorderFill() const { return Border().HasBorderFill(); }
2877 bool HasBorder() const { return Border().HasBorder(); } 2861 bool HasBorder() const {
2862 return Border().HasBorder() || BorderLeftWidth() || BorderRightWidth() ||
2863 BorderTopWidth() || BorderBottomWidth();
2864 }
2878 bool HasBorderDecoration() const { return HasBorder() || HasBorderFill(); } 2865 bool HasBorderDecoration() const { return HasBorder() || HasBorderFill(); }
2879 bool HasBorderRadius() const { 2866 bool HasBorderRadius() const {
2880 if (!BorderTopLeftRadius().Width().IsZero()) 2867 if (!BorderTopLeftRadius().Width().IsZero())
2881 return true; 2868 return true;
2882 if (!BorderTopRightRadius().Width().IsZero()) 2869 if (!BorderTopRightRadius().Width().IsZero())
2883 return true; 2870 return true;
2884 if (!BorderBottomLeftRadius().Width().IsZero()) 2871 if (!BorderBottomLeftRadius().Width().IsZero())
2885 return true; 2872 return true;
2886 if (!BorderBottomRightRadius().Width().IsZero()) 2873 if (!BorderBottomRightRadius().Width().IsZero())
2887 return true; 2874 return true;
(...skipping 15 matching lines...) Expand all
2903 ResetBorderTop(); 2890 ResetBorderTop();
2904 ResetBorderRight(); 2891 ResetBorderRight();
2905 ResetBorderBottom(); 2892 ResetBorderBottom();
2906 ResetBorderLeft(); 2893 ResetBorderLeft();
2907 ResetBorderTopLeftRadius(); 2894 ResetBorderTopLeftRadius();
2908 ResetBorderTopRightRadius(); 2895 ResetBorderTopRightRadius();
2909 ResetBorderBottomLeftRadius(); 2896 ResetBorderBottomLeftRadius();
2910 ResetBorderBottomRightRadius(); 2897 ResetBorderBottomRightRadius();
2911 } 2898 }
2912 void ResetBorderTop() { 2899 void ResetBorderTop() {
2913 SET_VAR(surround_data_, border_.top_, BorderValue()); 2900 SET_VAR(surround_data_, border_.top_, BorderColorAndStyle());
2914 } 2901 }
2915 void ResetBorderRight() { 2902 void ResetBorderRight() {
2916 SET_VAR(surround_data_, border_.right_, BorderValue()); 2903 SET_VAR(surround_data_, border_.right_, BorderColorAndStyle());
2917 } 2904 }
2918 void ResetBorderBottom() { 2905 void ResetBorderBottom() {
2919 SET_VAR(surround_data_, border_.bottom_, BorderValue()); 2906 SET_VAR(surround_data_, border_.bottom_, BorderColorAndStyle());
2920 } 2907 }
2921 void ResetBorderLeft() { 2908 void ResetBorderLeft() {
2922 SET_VAR(surround_data_, border_.left_, BorderValue()); 2909 SET_VAR(surround_data_, border_.left_, BorderColorAndStyle());
2923 } 2910 }
2924 void ResetBorderImage() { 2911 void ResetBorderImage() {
2925 SET_VAR(surround_data_, border_.image_, NinePieceImage()); 2912 SET_VAR(surround_data_, border_.image_, NinePieceImage());
2926 } 2913 }
2927 2914
2928 void SetBorderRadius(const LengthSize& s) { 2915 void SetBorderRadius(const LengthSize& s) {
2929 SetBorderTopLeftRadius(s); 2916 SetBorderTopLeftRadius(s);
2930 SetBorderTopRightRadius(s); 2917 SetBorderTopRightRadius(s);
2931 SetBorderBottomLeftRadius(s); 2918 SetBorderBottomLeftRadius(s);
2932 SetBorderBottomRightRadius(s); 2919 SetBorderBottomRightRadius(s);
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
3684 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); 3671 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId)));
3685 } 3672 }
3686 3673
3687 inline bool ComputedStyle::HasPseudoElementStyle() const { 3674 inline bool ComputedStyle::HasPseudoElementStyle() const {
3688 return PseudoBitsInternal() & kElementPseudoIdMask; 3675 return PseudoBitsInternal() & kElementPseudoIdMask;
3689 } 3676 }
3690 3677
3691 } // namespace blink 3678 } // namespace blink
3692 3679
3693 #endif // ComputedStyle_h 3680 #endif // ComputedStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698