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 collectPlatformFontsForRenderer(toRenderText(previous->slowFirstChild())
, &fontStats); |
802 } | 808 } |
803 | 809 |
804 platformFonts = TypeBuilder::Array<TypeBuilder::CSS::PlatformFontUsage>::cre
ate(); | 810 platformFonts = TypeBuilder::Array<TypeBuilder::CSS::PlatformFontUsage>::cre
ate(); |
805 for (HashCountedSet<String>::iterator it = fontStats.begin(), end = fontStat
s.end(); it != end; ++it) { | 811 for (HashCountedSet<String>::iterator it = fontStats.begin(), end = fontStat
s.end(); it != end; ++it) { |
806 RefPtr<TypeBuilder::CSS::PlatformFontUsage> platformFont = TypeBuilder::
CSS::PlatformFontUsage::create() | 812 RefPtr<TypeBuilder::CSS::PlatformFontUsage> platformFont = TypeBuilder::
CSS::PlatformFontUsage::create() |
807 .setFamilyName(it->key) | 813 .setFamilyName(it->key) |
808 .setGlyphCount(it->value); | 814 .setGlyphCount(it->value); |
809 platformFonts->addItem(platformFont); | 815 platformFonts->addItem(platformFont); |
810 } | 816 } |
811 } | 817 } |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 visitor->trace(m_invalidatedDocuments); | 1478 visitor->trace(m_invalidatedDocuments); |
1473 visitor->trace(m_nodeToInspectorStyleSheet); | 1479 visitor->trace(m_nodeToInspectorStyleSheet); |
1474 visitor->trace(m_documentToViaInspectorStyleSheet); | 1480 visitor->trace(m_documentToViaInspectorStyleSheet); |
1475 #endif | 1481 #endif |
1476 visitor->trace(m_inspectorUserAgentStyleSheet); | 1482 visitor->trace(m_inspectorUserAgentStyleSheet); |
1477 InspectorBaseAgent::trace(visitor); | 1483 InspectorBaseAgent::trace(visitor); |
1478 } | 1484 } |
1479 | 1485 |
1480 } // namespace blink | 1486 } // namespace blink |
1481 | 1487 |
OLD | NEW |