| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 for (Node* child = node->firstChild(); child; child = child->nextSibling
()) { | 782 for (Node* child = node->firstChild(); child; child = child->nextSibling
()) { |
| 783 if (child->nodeType() == Node::TEXT_NODE && child->renderer()) | 783 if (child->nodeType() == Node::TEXT_NODE && child->renderer()) |
| 784 textNodes.append(toText(child)); | 784 textNodes.append(toText(child)); |
| 785 } | 785 } |
| 786 } | 786 } |
| 787 | 787 |
| 788 HashCountedSet<String> fontStats; | 788 HashCountedSet<String> fontStats; |
| 789 for (size_t i = 0; i < textNodes.size(); ++i) { | 789 for (size_t i = 0; i < textNodes.size(); ++i) { |
| 790 RenderText* renderer = textNodes[i]->renderer(); | 790 RenderText* renderer = textNodes[i]->renderer(); |
| 791 collectPlatformFontsForRenderer(renderer, &fontStats); | 791 collectPlatformFontsForRenderer(renderer, &fontStats); |
| 792 if (renderer->isTextFragment()) { | 792 |
| 793 RenderTextFragment* textFragment = toRenderTextFragment(renderer); | 793 if (!renderer->isTextFragment()) |
| 794 if (textFragment->firstLetter()) { | 794 continue; |
| 795 RenderBoxModelObject* firstLetter = textFragment->firstLetter(); | 795 |
| 796 for (RenderObject* current = firstLetter->slowFirstChild(); curr
ent; current = current->nextSibling()) { | 796 // If we're the remaining text from a first-letter then our previous |
| 797 if (current->isText()) | 797 // sibling has to be the first-letter renderer. |
| 798 collectPlatformFontsForRenderer(toRenderText(current), &
fontStats); | 798 RenderObject* previous = renderer->previousSibling(); |
| 799 } | 799 if (!previous) |
| 800 } | 800 continue; |
| 801 } | 801 |
| 802 if (!previous->isPseudoElement() || !previous->node()->isFirstLetterPseu
doElement()) |
| 803 continue; |
| 804 |
| 805 // The first-letter pseudoElement only has one child, which is the |
| 806 // first-letter renderer. |
| 807 RenderObject* firstLetterRenderer = previous->slowFirstChild(); |
| 808 ASSERT(firstLetterRenderer && firstLetterRenderer->isText()); |
| 809 collectPlatformFontsForRenderer(toRenderText(firstLetterRenderer), &font
Stats); |
| 802 } | 810 } |
| 803 | 811 |
| 804 platformFonts = TypeBuilder::Array<TypeBuilder::CSS::PlatformFontUsage>::cre
ate(); | 812 platformFonts = TypeBuilder::Array<TypeBuilder::CSS::PlatformFontUsage>::cre
ate(); |
| 805 for (HashCountedSet<String>::iterator it = fontStats.begin(), end = fontStat
s.end(); it != end; ++it) { | 813 for (HashCountedSet<String>::iterator it = fontStats.begin(), end = fontStat
s.end(); it != end; ++it) { |
| 806 RefPtr<TypeBuilder::CSS::PlatformFontUsage> platformFont = TypeBuilder::
CSS::PlatformFontUsage::create() | 814 RefPtr<TypeBuilder::CSS::PlatformFontUsage> platformFont = TypeBuilder::
CSS::PlatformFontUsage::create() |
| 807 .setFamilyName(it->key) | 815 .setFamilyName(it->key) |
| 808 .setGlyphCount(it->value); | 816 .setGlyphCount(it->value); |
| 809 platformFonts->addItem(platformFont); | 817 platformFonts->addItem(platformFont); |
| 810 } | 818 } |
| 811 } | 819 } |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 visitor->trace(m_invalidatedDocuments); | 1475 visitor->trace(m_invalidatedDocuments); |
| 1468 visitor->trace(m_nodeToInspectorStyleSheet); | 1476 visitor->trace(m_nodeToInspectorStyleSheet); |
| 1469 visitor->trace(m_documentToViaInspectorStyleSheet); | 1477 visitor->trace(m_documentToViaInspectorStyleSheet); |
| 1470 #endif | 1478 #endif |
| 1471 visitor->trace(m_inspectorUserAgentStyleSheet); | 1479 visitor->trace(m_inspectorUserAgentStyleSheet); |
| 1472 InspectorBaseAgent::trace(visitor); | 1480 InspectorBaseAgent::trace(visitor); |
| 1473 } | 1481 } |
| 1474 | 1482 |
| 1475 } // namespace blink | 1483 } // namespace blink |
| 1476 | 1484 |
| OLD | NEW |