| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009 Apple Computer, Inc. | 2 * Copyright (C) 2007, 2008, 2009 Apple Computer, Inc. |
| 3 * Copyright (C) 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2010, 2011 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1630 { | 1630 { |
| 1631 return value->isFontIndependentLength(); | 1631 return value->isFontIndependentLength(); |
| 1632 } | 1632 } |
| 1633 | 1633 |
| 1634 int legacyFontSizeFromCSSValue(Document* document, CSSPrimitiveValue* value, Fix
edPitchFontType fixedPitchFontType, LegacyFontSizeMode mode) | 1634 int legacyFontSizeFromCSSValue(Document* document, CSSPrimitiveValue* value, Fix
edPitchFontType fixedPitchFontType, LegacyFontSizeMode mode) |
| 1635 { | 1635 { |
| 1636 if (isCSSValueLength(value)) { | 1636 if (isCSSValueLength(value)) { |
| 1637 int pixelFontSize = value->getIntValue(CSSPrimitiveValue::CSS_PX); | 1637 int pixelFontSize = value->getIntValue(CSSPrimitiveValue::CSS_PX); |
| 1638 int legacyFontSize = FontSize::legacyFontSize(document, pixelFontSize, f
ixedPitchFontType); | 1638 int legacyFontSize = FontSize::legacyFontSize(document, pixelFontSize, f
ixedPitchFontType); |
| 1639 // Use legacy font size only if pixel value matches exactly to that of l
egacy font size. | 1639 // Use legacy font size only if pixel value matches exactly to that of l
egacy font size. |
| 1640 CSSValueID cssPrimitiveEquivalent = static_cast<CSSValueID>(legacyFontSi
ze - 1 + CSSValueXSmall); | 1640 if (mode == AlwaysUseLegacyFontSize || FontSize::fontSizeForKeyword(docu
ment, legacyFontSize, fixedPitchFontType) == pixelFontSize) |
| 1641 if (mode == AlwaysUseLegacyFontSize || FontSize::fontSizeForKeyword(docu
ment, cssPrimitiveEquivalent, fixedPitchFontType) == pixelFontSize) | |
| 1642 return legacyFontSize; | 1641 return legacyFontSize; |
| 1643 | 1642 |
| 1644 return 0; | 1643 return 0; |
| 1645 } | 1644 } |
| 1646 | 1645 |
| 1647 if (CSSValueXSmall <= value->getValueID() && value->getValueID() <= CSSValue
WebkitXxxLarge) | 1646 if (CSSValueXSmall <= value->getValueID() && value->getValueID() <= CSSValue
WebkitXxxLarge) |
| 1648 return value->getValueID() - CSSValueXSmall + 1; | 1647 return value->getValueID() - CSSValueXSmall + 1; |
| 1649 | 1648 |
| 1650 return 0; | 1649 return 0; |
| 1651 } | 1650 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1678 { | 1677 { |
| 1679 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1678 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 1680 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu
tedStyleDeclaration::create(ancestor); | 1679 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu
tedStyleDeclaration::create(ancestor); |
| 1681 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1680 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
| 1682 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1681 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
| 1683 } | 1682 } |
| 1684 return nullptr; | 1683 return nullptr; |
| 1685 } | 1684 } |
| 1686 | 1685 |
| 1687 } | 1686 } |
| OLD | NEW |