OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. 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 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 * | 20 * |
21 */ | 21 */ |
22 | 22 |
23 #include "config.h" | 23 #include "config.h" |
24 #include "core/css/resolver/FontBuilder.h" | 24 #include "core/css/resolver/FontBuilder.h" |
25 | 25 |
26 #include "core/css/CSSCalculationValue.h" | 26 #include "core/css/CSSCalculationValue.h" |
27 #include "core/css/CSSFontFeatureValue.h" | 27 #include "core/css/CSSFontFeatureValue.h" |
| 28 #include "core/css/CSSToLengthConversionData.h" |
28 #include "core/css/FontSize.h" | 29 #include "core/css/FontSize.h" |
29 #include "core/frame/Frame.h" | 30 #include "core/frame/Frame.h" |
30 #include "core/page/Settings.h" | 31 #include "core/page/Settings.h" |
31 #include "core/rendering/RenderTheme.h" | 32 #include "core/rendering/RenderTheme.h" |
32 #include "core/rendering/RenderView.h" | 33 #include "core/rendering/RenderView.h" |
33 #include "platform/text/LocaleToScriptMapping.h" | 34 #include "platform/text/LocaleToScriptMapping.h" |
34 | 35 |
35 namespace WebCore { | 36 namespace WebCore { |
36 | 37 |
37 // FIXME: This scoping class is a short-term fix to minimize the changes in | 38 // FIXME: This scoping class is a short-term fix to minimize the changes in |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 size = smallerFontSize(parentSize); | 318 size = smallerFontSize(parentSize); |
318 break; | 319 break; |
319 default: | 320 default: |
320 return; | 321 return; |
321 } | 322 } |
322 | 323 |
323 scope.fontDescription().setIsAbsoluteSize(parentIsAbsoluteSize && (value
ID == CSSValueLarger || valueID == CSSValueSmaller)); | 324 scope.fontDescription().setIsAbsoluteSize(parentIsAbsoluteSize && (value
ID == CSSValueLarger || valueID == CSSValueSmaller)); |
324 } else { | 325 } else { |
325 scope.fontDescription().setIsAbsoluteSize(parentIsAbsoluteSize || !(prim
itiveValue->isPercentage() || primitiveValue->isFontRelativeLength())); | 326 scope.fontDescription().setIsAbsoluteSize(parentIsAbsoluteSize || !(prim
itiveValue->isPercentage() || primitiveValue->isFontRelativeLength())); |
326 if (primitiveValue->isLength()) | 327 if (primitiveValue->isLength()) |
327 size = primitiveValue->computeLength<float>(parentStyle, rootElement
Style, 1.0, true); | 328 size = primitiveValue->computeLength<float>(CSSToLengthConversionDat
a(parentStyle, rootElementStyle, 1.0, true)); |
328 else if (primitiveValue->isPercentage()) | 329 else if (primitiveValue->isPercentage()) |
329 size = (primitiveValue->getFloatValue() * parentSize) / 100.0f; | 330 size = (primitiveValue->getFloatValue() * parentSize) / 100.0f; |
330 else if (primitiveValue->isCalculatedPercentageWithLength()) | 331 else if (primitiveValue->isCalculatedPercentageWithLength()) |
331 size = primitiveValue->cssCalcValue()->toCalcValue(parentStyle, root
ElementStyle)->evaluate(parentSize); | 332 size = primitiveValue->cssCalcValue()->toCalcValue(CSSToLengthConver
sionData(parentStyle, rootElementStyle, 1.0))->evaluate(parentSize); |
332 else if (primitiveValue->isViewportPercentageLength()) | 333 else if (primitiveValue->isViewportPercentageLength()) |
333 size = valueForLength(primitiveValue->viewportPercentageLength(), 0,
m_document->renderView()); | 334 size = valueForLength(primitiveValue->viewportPercentageLength(), 0,
m_document->renderView()); |
334 else | 335 else |
335 return; | 336 return; |
336 } | 337 } |
337 | 338 |
338 if (size < 0) | 339 if (size < 0) |
339 return; | 340 return; |
340 | 341 |
341 // Overly large font sizes will cause crashes on some platforms (such as Win
dows). | 342 // Overly large font sizes will cause crashes on some platforms (such as Win
dows). |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 FontOrientation fontOrientation; | 660 FontOrientation fontOrientation; |
660 NonCJKGlyphOrientation glyphOrientation; | 661 NonCJKGlyphOrientation glyphOrientation; |
661 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation)
; | 662 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation)
; |
662 fontDescription.setOrientation(fontOrientation); | 663 fontDescription.setOrientation(fontOrientation); |
663 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); | 664 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); |
664 documentStyle->setFontDescription(fontDescription); | 665 documentStyle->setFontDescription(fontDescription); |
665 documentStyle->font().update(fontSelector); | 666 documentStyle->font().update(fontSelector); |
666 } | 667 } |
667 | 668 |
668 } | 669 } |
OLD | NEW |