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

Side by Side Diff: Source/core/rendering/style/RenderStyle.cpp

Issue 815933006: Change all uses of the RoundedRect class to use FloatRoundedRect instead. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 12 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/style/RenderStyle.h ('k') | Source/platform/blink_platform.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 void RenderStyle::setTextShadow(PassRefPtr<ShadowList> s) 880 void RenderStyle::setTextShadow(PassRefPtr<ShadowList> s)
881 { 881 {
882 rareInheritedData.access()->textShadow = s; 882 rareInheritedData.access()->textShadow = s;
883 } 883 }
884 884
885 void RenderStyle::setBoxShadow(PassRefPtr<ShadowList> s) 885 void RenderStyle::setBoxShadow(PassRefPtr<ShadowList> s)
886 { 886 {
887 rareNonInheritedData.access()->m_boxShadow = s; 887 rareNonInheritedData.access()->m_boxShadow = s;
888 } 888 }
889 889
890 static RoundedRect::Radii calcRadiiFor(const BorderData& border, IntSize size) 890 static FloatRoundedRect::Radii calcRadiiFor(const BorderData& border, LayoutSize size)
891 { 891 {
892 return RoundedRect::Radii( 892 return FloatRoundedRect::Radii(
893 IntSize(valueForLength(border.topLeft().width(), size.width()), 893 IntSize(valueForLength(border.topLeft().width(), size.width()),
894 valueForLength(border.topLeft().height(), size.height())), 894 valueForLength(border.topLeft().height(), size.height())),
895 IntSize(valueForLength(border.topRight().width(), size.width()), 895 IntSize(valueForLength(border.topRight().width(), size.width()),
896 valueForLength(border.topRight().height(), size.height())), 896 valueForLength(border.topRight().height(), size.height())),
897 IntSize(valueForLength(border.bottomLeft().width(), size.width()), 897 IntSize(valueForLength(border.bottomLeft().width(), size.width()),
898 valueForLength(border.bottomLeft().height(), size.height())), 898 valueForLength(border.bottomLeft().height(), size.height())),
899 IntSize(valueForLength(border.bottomRight().width(), size.width()), 899 IntSize(valueForLength(border.bottomRight().width(), size.width()),
900 valueForLength(border.bottomRight().height(), size.height()))); 900 valueForLength(border.bottomRight().height(), size.height())));
901 } 901 }
902 902
903 StyleImage* RenderStyle::listStyleImage() const { return rareInheritedData->list StyleImage.get(); } 903 StyleImage* RenderStyle::listStyleImage() const { return rareInheritedData->list StyleImage.get(); }
904 void RenderStyle::setListStyleImage(PassRefPtr<StyleImage> v) 904 void RenderStyle::setListStyleImage(PassRefPtr<StyleImage> v)
905 { 905 {
906 if (rareInheritedData->listStyleImage != v) 906 if (rareInheritedData->listStyleImage != v)
907 rareInheritedData.access()->listStyleImage = v; 907 rareInheritedData.access()->listStyleImage = v;
908 } 908 }
909 909
910 Color RenderStyle::color() const { return inherited->color; } 910 Color RenderStyle::color() const { return inherited->color; }
911 Color RenderStyle::visitedLinkColor() const { return inherited->visitedLinkColor ; } 911 Color RenderStyle::visitedLinkColor() const { return inherited->visitedLinkColor ; }
912 void RenderStyle::setColor(const Color& v) { SET_VAR(inherited, color, v); } 912 void RenderStyle::setColor(const Color& v) { SET_VAR(inherited, color, v); }
913 void RenderStyle::setVisitedLinkColor(const Color& v) { SET_VAR(inherited, visit edLinkColor, v); } 913 void RenderStyle::setVisitedLinkColor(const Color& v) { SET_VAR(inherited, visit edLinkColor, v); }
914 914
915 short RenderStyle::horizontalBorderSpacing() const { return inherited->horizonta l_border_spacing; } 915 short RenderStyle::horizontalBorderSpacing() const { return inherited->horizonta l_border_spacing; }
916 short RenderStyle::verticalBorderSpacing() const { return inherited->vertical_bo rder_spacing; } 916 short RenderStyle::verticalBorderSpacing() const { return inherited->vertical_bo rder_spacing; }
917 void RenderStyle::setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horiz ontal_border_spacing, v); } 917 void RenderStyle::setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horiz ontal_border_spacing, v); }
918 void RenderStyle::setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertica l_border_spacing, v); } 918 void RenderStyle::setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertica l_border_spacing, v); }
919 919
920 RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const 920 FloatRoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
921 { 921 {
922 IntRect snappedBorderRect(pixelSnappedIntRect(borderRect)); 922 FloatRoundedRect roundedRect(pixelSnappedIntRect(borderRect));
923 RoundedRect roundedRect(snappedBorderRect);
924 if (hasBorderRadius()) { 923 if (hasBorderRadius()) {
925 RoundedRect::Radii radii = calcRadiiFor(surround->border, snappedBorderR ect.size()); 924 FloatRoundedRect::Radii radii = calcRadiiFor(surround->border, borderRec t.size());
926 radii.scale(calcBorderRadiiConstraintScaleFor(borderRect, radii)); 925 radii.scale(calcBorderRadiiConstraintScaleFor(borderRect, radii));
927 roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includ eLogicalLeftEdge, includeLogicalRightEdge); 926 roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includ eLogicalLeftEdge, includeLogicalRightEdge);
928 } 927 }
929 return roundedRect; 928 return roundedRect;
930 } 929 }
931 930
932 RoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const 931 FloatRoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderR ect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
933 { 932 {
934 bool horizontal = isHorizontalWritingMode(); 933 bool horizontal = isHorizontalWritingMode();
935 934
936 int leftWidth = (!horizontal || includeLogicalLeftEdge) ? borderLeftWidth() : 0; 935 int leftWidth = (!horizontal || includeLogicalLeftEdge) ? borderLeftWidth() : 0;
937 int rightWidth = (!horizontal || includeLogicalRightEdge) ? borderRightWidth () : 0; 936 int rightWidth = (!horizontal || includeLogicalRightEdge) ? borderRightWidth () : 0;
938 int topWidth = (horizontal || includeLogicalLeftEdge) ? borderTopWidth() : 0 ; 937 int topWidth = (horizontal || includeLogicalLeftEdge) ? borderTopWidth() : 0 ;
939 int bottomWidth = (horizontal || includeLogicalRightEdge) ? borderBottomWidt h() : 0; 938 int bottomWidth = (horizontal || includeLogicalRightEdge) ? borderBottomWidt h() : 0;
940 939
941 return getRoundedInnerBorderFor(borderRect, topWidth, bottomWidth, leftWidth , rightWidth, includeLogicalLeftEdge, includeLogicalRightEdge); 940 return getRoundedInnerBorderFor(borderRect, topWidth, bottomWidth, leftWidth , rightWidth, includeLogicalLeftEdge, includeLogicalRightEdge);
942 } 941 }
943 942
944 RoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderRect, 943 FloatRoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderR ect,
945 int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool includeLo gicalLeftEdge, bool includeLogicalRightEdge) const 944 int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool includeLo gicalLeftEdge, bool includeLogicalRightEdge) const
946 { 945 {
947 LayoutRect innerRect(borderRect.x() + leftWidth, 946 LayoutRect innerRect(borderRect.x() + leftWidth,
948 borderRect.y() + topWidth, 947 borderRect.y() + topWidth,
949 borderRect.width() - leftWidth - rightWidth, 948 borderRect.width() - leftWidth - rightWidth,
950 borderRect.height() - topWidth - bottomWidth); 949 borderRect.height() - topWidth - bottomWidth);
951 950
952 RoundedRect roundedRect(pixelSnappedIntRect(innerRect)); 951 FloatRoundedRect roundedRect(pixelSnappedIntRect(innerRect));
953 952
954 if (hasBorderRadius()) { 953 if (hasBorderRadius()) {
955 RoundedRect::Radii radii = getRoundedBorderFor(borderRect).radii(); 954 FloatRoundedRect::Radii radii = getRoundedBorderFor(borderRect).radii();
956 radii.shrink(topWidth, bottomWidth, leftWidth, rightWidth); 955 radii.shrink(topWidth, bottomWidth, leftWidth, rightWidth);
957 roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includ eLogicalLeftEdge, includeLogicalRightEdge); 956 roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includ eLogicalLeftEdge, includeLogicalRightEdge);
958 } 957 }
959 return roundedRect; 958 return roundedRect;
960 } 959 }
961 960
962 static bool allLayersAreFixed(const FillLayer& layer) 961 static bool allLayersAreFixed(const FillLayer& layer)
963 { 962 {
964 for (const FillLayer* currLayer = &layer; currLayer; currLayer = currLayer-> next()) { 963 for (const FillLayer* currLayer = &layer; currLayer; currLayer = currLayer-> next()) {
965 if (!currLayer->image() || currLayer->attachment() != FixedBackgroundAtt achment) 964 if (!currLayer->image() || currLayer->attachment() != FixedBackgroundAtt achment)
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 horizontal || includeLogicalRightEdge); 1673 horizontal || includeLogicalRightEdge);
1675 1674
1676 edges[BSLeft] = BorderEdge(borderLeftWidth(), 1675 edges[BSLeft] = BorderEdge(borderLeftWidth(),
1677 visitedDependentColor(CSSPropertyBorderLeftColor), 1676 visitedDependentColor(CSSPropertyBorderLeftColor),
1678 borderLeftStyle(), 1677 borderLeftStyle(),
1679 borderLeftIsTransparent(), 1678 borderLeftIsTransparent(),
1680 !horizontal || includeLogicalLeftEdge); 1679 !horizontal || includeLogicalLeftEdge);
1681 } 1680 }
1682 1681
1683 } // namespace blink 1682 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/style/RenderStyle.h ('k') | Source/platform/blink_platform.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698