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 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 { | 1631 { |
1632 return value->isFontIndependentLength(); | 1632 return value->isFontIndependentLength(); |
1633 } | 1633 } |
1634 | 1634 |
1635 int legacyFontSizeFromCSSValue(Document* document, CSSPrimitiveValue* value, Fix
edPitchFontType fixedPitchFontType, LegacyFontSizeMode mode) | 1635 int legacyFontSizeFromCSSValue(Document* document, CSSPrimitiveValue* value, Fix
edPitchFontType fixedPitchFontType, LegacyFontSizeMode mode) |
1636 { | 1636 { |
1637 if (isCSSValueLength(value)) { | 1637 if (isCSSValueLength(value)) { |
1638 int pixelFontSize = value->getIntValue(CSSPrimitiveValue::CSS_PX); | 1638 int pixelFontSize = value->getIntValue(CSSPrimitiveValue::CSS_PX); |
1639 int legacyFontSize = FontSize::legacyFontSize(document, pixelFontSize, f
ixedPitchFontType); | 1639 int legacyFontSize = FontSize::legacyFontSize(document, pixelFontSize, f
ixedPitchFontType); |
1640 // Use legacy font size only if pixel value matches exactly to that of l
egacy font size. | 1640 // Use legacy font size only if pixel value matches exactly to that of l
egacy font size. |
1641 CSSValueID cssPrimitiveEquivalent = static_cast<CSSValueID>(legacyFontSi
ze - 1 + CSSValueXSmall); | 1641 if (mode == AlwaysUseLegacyFontSize || FontSize::fontSizeForKeyword(docu
ment, legacyFontSize, fixedPitchFontType) == pixelFontSize) |
1642 if (mode == AlwaysUseLegacyFontSize || FontSize::fontSizeForKeyword(docu
ment, cssPrimitiveEquivalent, fixedPitchFontType) == pixelFontSize) | |
1643 return legacyFontSize; | 1642 return legacyFontSize; |
1644 | 1643 |
1645 return 0; | 1644 return 0; |
1646 } | 1645 } |
1647 | 1646 |
1648 if (CSSValueXSmall <= value->getValueID() && value->getValueID() <= CSSValue
WebkitXxxLarge) | 1647 if (CSSValueXSmall <= value->getValueID() && value->getValueID() <= CSSValue
WebkitXxxLarge) |
1649 return value->getValueID() - CSSValueXSmall + 1; | 1648 return value->getValueID() - CSSValueXSmall + 1; |
1650 | 1649 |
1651 return 0; | 1650 return 0; |
1652 } | 1651 } |
(...skipping 26 matching lines...) Expand all Loading... |
1679 { | 1678 { |
1680 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1679 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
1681 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu
tedStyleDeclaration::create(ancestor); | 1680 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu
tedStyleDeclaration::create(ancestor); |
1682 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1681 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
1683 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1682 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
1684 } | 1683 } |
1685 return nullptr; | 1684 return nullptr; |
1686 } | 1685 } |
1687 | 1686 |
1688 } | 1687 } |
OLD | NEW |