OLD | NEW |
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 noninherited_flags._vertical_align = other->noninherited_flags._vertical_ali
gn; | 179 noninherited_flags._vertical_align = other->noninherited_flags._vertical_ali
gn; |
180 noninherited_flags._clear = other->noninherited_flags._clear; | 180 noninherited_flags._clear = other->noninherited_flags._clear; |
181 noninherited_flags._position = other->noninherited_flags._position; | 181 noninherited_flags._position = other->noninherited_flags._position; |
182 noninherited_flags._floating = other->noninherited_flags._floating; | 182 noninherited_flags._floating = other->noninherited_flags._floating; |
183 noninherited_flags._table_layout = other->noninherited_flags._table_layout; | 183 noninherited_flags._table_layout = other->noninherited_flags._table_layout; |
184 noninherited_flags._unicodeBidi = other->noninherited_flags._unicodeBidi; | 184 noninherited_flags._unicodeBidi = other->noninherited_flags._unicodeBidi; |
185 noninherited_flags._page_break_before = other->noninherited_flags._page_brea
k_before; | 185 noninherited_flags._page_break_before = other->noninherited_flags._page_brea
k_before; |
186 noninherited_flags._page_break_after = other->noninherited_flags._page_break
_after; | 186 noninherited_flags._page_break_after = other->noninherited_flags._page_break
_after; |
187 noninherited_flags._page_break_inside = other->noninherited_flags._page_brea
k_inside; | 187 noninherited_flags._page_break_inside = other->noninherited_flags._page_brea
k_inside; |
188 noninherited_flags.explicitInheritance = other->noninherited_flags.explicitI
nheritance; | 188 noninherited_flags.explicitInheritance = other->noninherited_flags.explicitI
nheritance; |
189 noninherited_flags.currentColor = other->noninherited_flags.currentColor; | |
190 if (m_svgStyle != other->m_svgStyle) | 189 if (m_svgStyle != other->m_svgStyle) |
191 m_svgStyle.access()->copyNonInheritedFrom(other->m_svgStyle.get()); | 190 m_svgStyle.access()->copyNonInheritedFrom(other->m_svgStyle.get()); |
192 ASSERT(zoom() == initialZoom()); | 191 ASSERT(zoom() == initialZoom()); |
193 } | 192 } |
194 | 193 |
195 bool RenderStyle::operator==(const RenderStyle& o) const | 194 bool RenderStyle::operator==(const RenderStyle& o) const |
196 { | 195 { |
197 // compare everything except the pseudoStyle pointer | 196 // compare everything except the pseudoStyle pointer |
198 return inherited_flags == o.inherited_flags | 197 return inherited_flags == o.inherited_flags |
199 && noninherited_flags == o.noninherited_flags | 198 && noninherited_flags == o.noninherited_flags |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 return factor; | 910 return factor; |
912 } | 911 } |
913 | 912 |
914 StyleImage* RenderStyle::listStyleImage() const { return rareInheritedData->list
StyleImage.get(); } | 913 StyleImage* RenderStyle::listStyleImage() const { return rareInheritedData->list
StyleImage.get(); } |
915 void RenderStyle::setListStyleImage(PassRefPtr<StyleImage> v) | 914 void RenderStyle::setListStyleImage(PassRefPtr<StyleImage> v) |
916 { | 915 { |
917 if (rareInheritedData->listStyleImage != v) | 916 if (rareInheritedData->listStyleImage != v) |
918 rareInheritedData.access()->listStyleImage = v; | 917 rareInheritedData.access()->listStyleImage = v; |
919 } | 918 } |
920 | 919 |
921 Color RenderStyle::color() const { return inherited->color; } | 920 StyleColor RenderStyle::color() const { return inherited->color; } |
922 Color RenderStyle::visitedLinkColor() const { return inherited->visitedLinkColor
; } | 921 StyleColor RenderStyle::visitedLinkColor() const { return inherited->visitedLink
Color; } |
923 void RenderStyle::setColor(const Color& v) { SET_VAR(inherited, color, v); } | 922 void RenderStyle::setColor(const StyleColor& v) { SET_VAR(inherited, color, v);
} |
924 void RenderStyle::setVisitedLinkColor(const Color& v) { SET_VAR(inherited, visit
edLinkColor, v); } | 923 void RenderStyle::setVisitedLinkColor(const StyleColor& v) { SET_VAR(inherited,
visitedLinkColor, v); } |
925 | 924 |
926 short RenderStyle::horizontalBorderSpacing() const { return inherited->horizonta
l_border_spacing; } | 925 short RenderStyle::horizontalBorderSpacing() const { return inherited->horizonta
l_border_spacing; } |
927 short RenderStyle::verticalBorderSpacing() const { return inherited->vertical_bo
rder_spacing; } | 926 short RenderStyle::verticalBorderSpacing() const { return inherited->vertical_bo
rder_spacing; } |
928 void RenderStyle::setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horiz
ontal_border_spacing, v); } | 927 void RenderStyle::setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horiz
ontal_border_spacing, v); } |
929 void RenderStyle::setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertica
l_border_spacing, v); } | 928 void RenderStyle::setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertica
l_border_spacing, v); } |
930 | 929 |
931 RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, Rende
rView* renderView, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) co
nst | 930 RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, Rende
rView* renderView, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) co
nst |
932 { | 931 { |
933 IntRect snappedBorderRect(pixelSnappedIntRect(borderRect)); | 932 IntRect snappedBorderRect(pixelSnappedIntRect(borderRect)); |
934 RoundedRect roundedRect(snappedBorderRect); | 933 RoundedRect roundedRect(snappedBorderRect); |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 for ( ; shadow; shadow = shadow->next()) { | 1287 for ( ; shadow; shadow = shadow->next()) { |
1289 if (shadow->style() == Inset) | 1288 if (shadow->style() == Inset) |
1290 continue; | 1289 continue; |
1291 int blurAndSpread = shadow->blur() + shadow->spread(); | 1290 int blurAndSpread = shadow->blur() + shadow->spread(); |
1292 | 1291 |
1293 top = min<LayoutUnit>(top, shadow->y() - blurAndSpread); | 1292 top = min<LayoutUnit>(top, shadow->y() - blurAndSpread); |
1294 bottom = max<LayoutUnit>(bottom, shadow->y() + blurAndSpread); | 1293 bottom = max<LayoutUnit>(bottom, shadow->y() + blurAndSpread); |
1295 } | 1294 } |
1296 } | 1295 } |
1297 | 1296 |
1298 Color RenderStyle::colorIncludingFallback(int colorProperty, bool visitedLink) c
onst | 1297 StyleColor RenderStyle::colorIncludingFallback(int colorProperty, bool visitedLi
nk) const |
1299 { | 1298 { |
1300 Color result; | 1299 StyleColor result; |
1301 EBorderStyle borderStyle = BNONE; | 1300 EBorderStyle borderStyle = BNONE; |
1302 switch (colorProperty) { | 1301 switch (colorProperty) { |
1303 case CSSPropertyBackgroundColor: | 1302 case CSSPropertyBackgroundColor: |
1304 return visitedLink ? visitedLinkBackgroundColor() : backgroundColor(); /
/ Background color doesn't fall back. | 1303 return visitedLink ? visitedLinkBackgroundColor() : backgroundColor(); /
/ Background color doesn't fall back. |
1305 case CSSPropertyBorderLeftColor: | 1304 case CSSPropertyBorderLeftColor: |
1306 result = visitedLink ? visitedLinkBorderLeftColor() : borderLeftColor(); | 1305 result = visitedLink ? visitedLinkBorderLeftColor() : borderLeftColor(); |
1307 borderStyle = borderLeftStyle(); | 1306 borderStyle = borderLeftStyle(); |
1308 break; | 1307 break; |
1309 case CSSPropertyBorderRightColor: | 1308 case CSSPropertyBorderRightColor: |
1310 result = visitedLink ? visitedLinkBorderRightColor() : borderRightColor(
); | 1309 result = visitedLink ? visitedLinkBorderRightColor() : borderRightColor(
); |
(...skipping 21 matching lines...) Expand all Loading... |
1332 return visitedLink ? visitedLinkTextDecorationColor() : textDecorationCo
lor(); | 1331 return visitedLink ? visitedLinkTextDecorationColor() : textDecorationCo
lor(); |
1333 case CSSPropertyWebkitTextEmphasisColor: | 1332 case CSSPropertyWebkitTextEmphasisColor: |
1334 result = visitedLink ? visitedLinkTextEmphasisColor() : textEmphasisColo
r(); | 1333 result = visitedLink ? visitedLinkTextEmphasisColor() : textEmphasisColo
r(); |
1335 break; | 1334 break; |
1336 case CSSPropertyWebkitTextFillColor: | 1335 case CSSPropertyWebkitTextFillColor: |
1337 result = visitedLink ? visitedLinkTextFillColor() : textFillColor(); | 1336 result = visitedLink ? visitedLinkTextFillColor() : textFillColor(); |
1338 break; | 1337 break; |
1339 case CSSPropertyWebkitTextStrokeColor: | 1338 case CSSPropertyWebkitTextStrokeColor: |
1340 result = visitedLink ? visitedLinkTextStrokeColor() : textStrokeColor(); | 1339 result = visitedLink ? visitedLinkTextStrokeColor() : textStrokeColor(); |
1341 break; | 1340 break; |
| 1341 case CSSPropertyFloodColor: |
| 1342 result = floodColor(); |
| 1343 break; |
| 1344 case CSSPropertyLightingColor: |
| 1345 result = lightingColor(); |
| 1346 break; |
| 1347 case CSSPropertyStopColor: |
| 1348 result = stopColor(); |
| 1349 break; |
| 1350 case CSSPropertyWebkitTapHighlightColor: |
| 1351 result = tapHighlightColor(); |
| 1352 break; |
1342 default: | 1353 default: |
1343 ASSERT_NOT_REACHED(); | 1354 ASSERT_NOT_REACHED(); |
1344 break; | 1355 break; |
1345 } | 1356 } |
1346 | 1357 |
1347 if (!result.isValid()) { | 1358 if (!result.isValid() && !result.isCurrentColor()) { |
1348 if (!visitedLink && (borderStyle == INSET || borderStyle == OUTSET || bo
rderStyle == RIDGE || borderStyle == GROOVE)) | 1359 if (!visitedLink && (borderStyle == INSET || borderStyle == OUTSET || bo
rderStyle == RIDGE || borderStyle == GROOVE)) |
1349 result.setRGB(238, 238, 238); | 1360 result.setRGB(238, 238, 238); |
1350 else | 1361 else |
1351 result = visitedLink ? visitedLinkColor() : color(); | 1362 result = visitedLink ? visitedLinkColor() : color(); |
1352 } | 1363 } |
1353 return result; | 1364 return result; |
1354 } | 1365 } |
1355 | 1366 |
1356 Color RenderStyle::visitedDependentColor(int colorProperty) const | 1367 StyleColor RenderStyle::visitedDependentColor(int colorProperty) const |
1357 { | 1368 { |
1358 Color unvisitedColor = colorIncludingFallback(colorProperty, false); | 1369 StyleColor unvisitedColor = colorIncludingFallback(colorProperty, false); |
1359 if (insideLink() != InsideVisitedLink) | 1370 if (insideLink() != InsideVisitedLink) |
1360 return unvisitedColor; | 1371 return unvisitedColor; |
1361 | 1372 |
1362 Color visitedColor = colorIncludingFallback(colorProperty, true); | 1373 StyleColor visitedColor = colorIncludingFallback(colorProperty, true); |
1363 | 1374 |
1364 // Text decoration color validity is preserved (checked in RenderObject::dec
orationColor). | 1375 // Text decoration color validity is preserved (checked in RenderObject::dec
orationColor). |
1365 if (colorProperty == CSSPropertyTextDecorationColor) | 1376 if (colorProperty == CSSPropertyTextDecorationColor) |
1366 return visitedColor; | 1377 return visitedColor; |
1367 | 1378 |
1368 // FIXME: Technically someone could explicitly specify the color transparent
, but for now we'll just | 1379 // FIXME: Technically someone could explicitly specify the color transparent
, but for now we'll just |
1369 // assume that if the background color is transparent that it wasn't set. No
te that it's weird that | 1380 // assume that if the background color is transparent that it wasn't set. No
te that it's weird that |
1370 // we're returning unvisited info for a visited link, but given our restrict
ion that the alpha values | 1381 // we're returning unvisited info for a visited link, but given our restrict
ion that the alpha values |
1371 // have to match, it makes more sense to return the unvisited background col
or if specified than it | 1382 // have to match, it makes more sense to return the unvisited background col
or if specified than it |
1372 // does to return black. This behavior matches what Firefox 4 does as well. | 1383 // does to return black. This behavior matches what Firefox 4 does as well. |
1373 if (colorProperty == CSSPropertyBackgroundColor && visitedColor == Color::tr
ansparent) | 1384 if (colorProperty == CSSPropertyBackgroundColor && visitedColor == Color::tr
ansparent) |
1374 return unvisitedColor; | 1385 return unvisitedColor; |
1375 | 1386 |
1376 // Take the alpha from the unvisited color, but get the RGB values from the
visited color. | 1387 // Unless the visitied color is 'currentColor'; take the alpha from the unvi
sited color, |
1377 return Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(),
unvisitedColor.alpha()); | 1388 // but get the RGB values from the visited color. |
| 1389 if (visitedColor.isCurrentColor()) |
| 1390 return visitedColor; |
| 1391 |
| 1392 return StyleColor(visitedColor.red(), visitedColor.green(), visitedColor.blu
e(), unvisitedColor.alpha()); |
1378 } | 1393 } |
1379 | 1394 |
1380 const BorderValue& RenderStyle::borderBefore() const | 1395 const BorderValue& RenderStyle::borderBefore() const |
1381 { | 1396 { |
1382 switch (writingMode()) { | 1397 switch (writingMode()) { |
1383 case TopToBottomWritingMode: | 1398 case TopToBottomWritingMode: |
1384 return borderTop(); | 1399 return borderTop(); |
1385 case BottomToTopWritingMode: | 1400 case BottomToTopWritingMode: |
1386 return borderBottom(); | 1401 return borderBottom(); |
1387 case LeftToRightWritingMode: | 1402 case LeftToRightWritingMode: |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1552 surround.access()->border.m_image.setOutset(outset); | 1567 surround.access()->border.m_image.setOutset(outset); |
1553 } | 1568 } |
1554 | 1569 |
1555 ShapeValue* RenderStyle::initialShapeInside() | 1570 ShapeValue* RenderStyle::initialShapeInside() |
1556 { | 1571 { |
1557 DEFINE_STATIC_LOCAL(RefPtr<ShapeValue>, sOutsideValue, (ShapeValue::createOu
tsideValue())); | 1572 DEFINE_STATIC_LOCAL(RefPtr<ShapeValue>, sOutsideValue, (ShapeValue::createOu
tsideValue())); |
1558 return sOutsideValue.get(); | 1573 return sOutsideValue.get(); |
1559 } | 1574 } |
1560 | 1575 |
1561 } // namespace WebCore | 1576 } // namespace WebCore |
OLD | NEW |