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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 for (Node* child = node->firstChild(); child; child = child->nextSibling
()) { | 786 for (Node* child = node->firstChild(); child; child = child->nextSibling
()) { |
787 if (child->nodeType() == Node::TEXT_NODE && child->renderer()) | 787 if (child->nodeType() == Node::TEXT_NODE && child->renderer()) |
788 textNodes.append(toText(child)); | 788 textNodes.append(toText(child)); |
789 } | 789 } |
790 } | 790 } |
791 | 791 |
792 HashCountedSet<String> fontStats; | 792 HashCountedSet<String> fontStats; |
793 for (size_t i = 0; i < textNodes.size(); ++i) { | 793 for (size_t i = 0; i < textNodes.size(); ++i) { |
794 RenderText* renderer = textNodes[i]->renderer(); | 794 RenderText* renderer = textNodes[i]->renderer(); |
795 collectPlatformFontsForRenderer(renderer, &fontStats); | 795 collectPlatformFontsForRenderer(renderer, &fontStats); |
796 | 796 if (renderer->isTextFragment()) { |
797 if (!renderer->isTextFragment()) | 797 RenderTextFragment* textFragment = toRenderTextFragment(renderer); |
798 continue; | 798 if (textFragment->firstLetter()) { |
799 | 799 RenderBoxModelObject* firstLetter = textFragment->firstLetter(); |
800 // If we're the remaining text from a first-letter then our previous | 800 for (RenderObject* current = firstLetter->slowFirstChild(); curr
ent; current = current->nextSibling()) { |
801 // sibling has to be the first-letter renderer. | 801 if (current->isText()) |
802 RenderObject* previous = renderer->previousSibling(); | 802 collectPlatformFontsForRenderer(toRenderText(current), &
fontStats); |
803 if (!previous) | 803 } |
804 continue; | 804 } |
805 | 805 } |
806 if (!previous->isPseudoElement() || !previous->node()->isFirstLetterPseu
doElement()) | |
807 continue; | |
808 | |
809 // The first-letter pseudoElement only has one child, which is the | |
810 // first-letter renderer. | |
811 collectPlatformFontsForRenderer(toRenderText(previous->slowFirstChild())
, &fontStats); | |
812 } | 806 } |
813 | 807 |
814 platformFonts = TypeBuilder::Array<TypeBuilder::CSS::PlatformFontUsage>::cre
ate(); | 808 platformFonts = TypeBuilder::Array<TypeBuilder::CSS::PlatformFontUsage>::cre
ate(); |
815 for (HashCountedSet<String>::iterator it = fontStats.begin(), end = fontStat
s.end(); it != end; ++it) { | 809 for (HashCountedSet<String>::iterator it = fontStats.begin(), end = fontStat
s.end(); it != end; ++it) { |
816 RefPtr<TypeBuilder::CSS::PlatformFontUsage> platformFont = TypeBuilder::
CSS::PlatformFontUsage::create() | 810 RefPtr<TypeBuilder::CSS::PlatformFontUsage> platformFont = TypeBuilder::
CSS::PlatformFontUsage::create() |
817 .setFamilyName(it->key) | 811 .setFamilyName(it->key) |
818 .setGlyphCount(it->value); | 812 .setGlyphCount(it->value); |
819 platformFonts->addItem(platformFont); | 813 platformFonts->addItem(platformFont); |
820 } | 814 } |
821 } | 815 } |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 visitor->trace(m_invalidatedDocuments); | 1476 visitor->trace(m_invalidatedDocuments); |
1483 visitor->trace(m_nodeToInspectorStyleSheet); | 1477 visitor->trace(m_nodeToInspectorStyleSheet); |
1484 visitor->trace(m_documentToViaInspectorStyleSheet); | 1478 visitor->trace(m_documentToViaInspectorStyleSheet); |
1485 #endif | 1479 #endif |
1486 visitor->trace(m_inspectorUserAgentStyleSheet); | 1480 visitor->trace(m_inspectorUserAgentStyleSheet); |
1487 InspectorBaseAgent::trace(visitor); | 1481 InspectorBaseAgent::trace(visitor); |
1488 } | 1482 } |
1489 | 1483 |
1490 } // namespace blink | 1484 } // namespace blink |
1491 | 1485 |
OLD | NEW |