| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
| 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 | 1309 |
| 1310 if (!styleToUse.autoWrap()) | 1310 if (!styleToUse.autoWrap()) |
| 1311 m_minWidth = m_maxWidth; | 1311 m_minWidth = m_maxWidth; |
| 1312 | 1312 |
| 1313 if (styleToUse.whiteSpace() == PRE) { | 1313 if (styleToUse.whiteSpace() == PRE) { |
| 1314 if (firstLine) | 1314 if (firstLine) |
| 1315 m_firstLineMinWidth = m_maxWidth; | 1315 m_firstLineMinWidth = m_maxWidth; |
| 1316 m_lastLineLineMinWidth = currMaxWidth; | 1316 m_lastLineLineMinWidth = currMaxWidth; |
| 1317 } | 1317 } |
| 1318 | 1318 |
| 1319 const SimpleFontData* fontData = f.primaryFont(); |
| 1320 DCHECK(fontData); |
| 1321 |
| 1319 GlyphOverflow glyphOverflow; | 1322 GlyphOverflow glyphOverflow; |
| 1320 glyphOverflow.setFromBounds(glyphBounds, f.getFontMetrics().floatAscent(), | 1323 if (fontData) { |
| 1321 f.getFontMetrics().floatDescent(), m_maxWidth); | 1324 glyphOverflow.setFromBounds( |
| 1325 glyphBounds, fontData->getFontMetrics().floatAscent(), |
| 1326 fontData->getFontMetrics().floatDescent(), m_maxWidth); |
| 1327 } |
| 1322 // We shouldn't change our mind once we "know". | 1328 // We shouldn't change our mind once we "know". |
| 1323 ASSERT(!m_knownToHaveNoOverflowAndNoFallbackFonts || | 1329 ASSERT(!m_knownToHaveNoOverflowAndNoFallbackFonts || |
| 1324 (fallbackFonts.isEmpty() && glyphOverflow.isApproximatelyZero())); | 1330 (fallbackFonts.isEmpty() && glyphOverflow.isApproximatelyZero())); |
| 1325 m_knownToHaveNoOverflowAndNoFallbackFonts = | 1331 m_knownToHaveNoOverflowAndNoFallbackFonts = |
| 1326 fallbackFonts.isEmpty() && glyphOverflow.isApproximatelyZero(); | 1332 fallbackFonts.isEmpty() && glyphOverflow.isApproximatelyZero(); |
| 1327 | 1333 |
| 1328 clearPreferredLogicalWidthsDirty(); | 1334 clearPreferredLogicalWidthsDirty(); |
| 1329 } | 1335 } |
| 1330 | 1336 |
| 1331 bool LayoutText::isAllCollapsibleWhitespace() const { | 1337 bool LayoutText::isAllCollapsibleWhitespace() const { |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 unsigned len, | 1714 unsigned len, |
| 1709 const Font& f, | 1715 const Font& f, |
| 1710 LayoutUnit xPos, | 1716 LayoutUnit xPos, |
| 1711 TextDirection textDirection, | 1717 TextDirection textDirection, |
| 1712 HashSet<const SimpleFontData*>* fallbackFonts, | 1718 HashSet<const SimpleFontData*>* fallbackFonts, |
| 1713 FloatRect* glyphBounds) const { | 1719 FloatRect* glyphBounds) const { |
| 1714 ASSERT(from + len <= textLength()); | 1720 ASSERT(from + len <= textLength()); |
| 1715 if (!textLength()) | 1721 if (!textLength()) |
| 1716 return 0; | 1722 return 0; |
| 1717 | 1723 |
| 1724 const SimpleFontData* fontData = f.primaryFont(); |
| 1725 DCHECK(fontData); |
| 1726 if (!fontData) |
| 1727 return 0; |
| 1728 |
| 1718 float w; | 1729 float w; |
| 1719 if (&f == &style()->font()) { | 1730 if (&f == &style()->font()) { |
| 1720 if (!style()->preserveNewline() && !from && len == textLength()) { | 1731 if (!style()->preserveNewline() && !from && len == textLength()) { |
| 1721 if (fallbackFonts) { | 1732 if (fallbackFonts) { |
| 1722 ASSERT(glyphBounds); | 1733 ASSERT(glyphBounds); |
| 1723 if (preferredLogicalWidthsDirty() || | 1734 if (preferredLogicalWidthsDirty() || |
| 1724 !m_knownToHaveNoOverflowAndNoFallbackFonts) | 1735 !m_knownToHaveNoOverflowAndNoFallbackFonts) |
| 1725 const_cast<LayoutText*>(this)->computePreferredLogicalWidths( | 1736 const_cast<LayoutText*>(this)->computePreferredLogicalWidths( |
| 1726 0, *fallbackFonts, *glyphBounds); | 1737 0, *fallbackFonts, *glyphBounds); |
| 1727 else | 1738 else |
| 1728 *glyphBounds = | 1739 *glyphBounds = |
| 1729 FloatRect(0, -f.getFontMetrics().floatAscent(), m_maxWidth, | 1740 FloatRect(0, -fontData->getFontMetrics().floatAscent(), |
| 1730 f.getFontMetrics().floatHeight()); | 1741 m_maxWidth, fontData->getFontMetrics().floatHeight()); |
| 1731 w = m_maxWidth; | 1742 w = m_maxWidth; |
| 1732 } else { | 1743 } else { |
| 1733 w = maxLogicalWidth(); | 1744 w = maxLogicalWidth(); |
| 1734 } | 1745 } |
| 1735 } else { | 1746 } else { |
| 1736 w = widthFromFont(f, from, len, xPos.toFloat(), 0, textDirection, | 1747 w = widthFromFont(f, from, len, xPos.toFloat(), 0, textDirection, |
| 1737 fallbackFonts, glyphBounds); | 1748 fallbackFonts, glyphBounds); |
| 1738 } | 1749 } |
| 1739 } else { | 1750 } else { |
| 1740 TextRun run = | 1751 TextRun run = |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1941 LayoutRect rect = LayoutRect( | 1952 LayoutRect rect = LayoutRect( |
| 1942 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height())); | 1953 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height())); |
| 1943 LayoutBlock* block = containingBlock(); | 1954 LayoutBlock* block = containingBlock(); |
| 1944 if (block && hasTextBoxes()) | 1955 if (block && hasTextBoxes()) |
| 1945 block->adjustChildDebugRect(rect); | 1956 block->adjustChildDebugRect(rect); |
| 1946 | 1957 |
| 1947 return rect; | 1958 return rect; |
| 1948 } | 1959 } |
| 1949 | 1960 |
| 1950 } // namespace blink | 1961 } // namespace blink |
| OLD | NEW |