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