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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 #include "core/layout/LayoutText.h" | 77 #include "core/layout/LayoutText.h" |
78 #include "core/layout/api/LayoutViewItem.h" | 78 #include "core/layout/api/LayoutViewItem.h" |
79 #include "core/layout/line/InlineTextBox.h" | 79 #include "core/layout/line/InlineTextBox.h" |
80 #include "core/loader/DocumentLoader.h" | 80 #include "core/loader/DocumentLoader.h" |
81 #include "core/page/Page.h" | 81 #include "core/page/Page.h" |
82 #include "core/style/StyleGeneratedImage.h" | 82 #include "core/style/StyleGeneratedImage.h" |
83 #include "core/style/StyleImage.h" | 83 #include "core/style/StyleImage.h" |
84 #include "core/svg/SVGElement.h" | 84 #include "core/svg/SVGElement.h" |
85 #include "platform/fonts/Font.h" | 85 #include "platform/fonts/Font.h" |
86 #include "platform/fonts/FontCache.h" | 86 #include "platform/fonts/FontCache.h" |
87 #include "platform/fonts/GlyphBuffer.h" | 87 #include "platform/fonts/shaping/CachingWordShaper.h" |
88 #include "platform/text/TextRun.h" | 88 #include "platform/text/TextRun.h" |
89 #include "wtf/CurrentTime.h" | 89 #include "wtf/CurrentTime.h" |
90 #include "wtf/text/CString.h" | 90 #include "wtf/text/CString.h" |
91 #include "wtf/text/StringConcatenate.h" | 91 #include "wtf/text/StringConcatenate.h" |
92 | 92 |
93 namespace blink { | 93 namespace blink { |
94 | 94 |
95 namespace { | 95 namespace { |
96 | 96 |
97 int s_frontendOperationCounter = 0; | 97 int s_frontendOperationCounter = 0; |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 if (!layoutObject->isText()) | 1129 if (!layoutObject->isText()) |
1130 return; | 1130 return; |
1131 | 1131 |
1132 FontCachePurgePreventer preventer; | 1132 FontCachePurgePreventer preventer; |
1133 LayoutText* layoutText = toLayoutText(layoutObject); | 1133 LayoutText* layoutText = toLayoutText(layoutObject); |
1134 for (InlineTextBox* box = layoutText->firstTextBox(); box; | 1134 for (InlineTextBox* box = layoutText->firstTextBox(); box; |
1135 box = box->nextTextBox()) { | 1135 box = box->nextTextBox()) { |
1136 const ComputedStyle& style = layoutText->styleRef(box->isFirstLineStyle()); | 1136 const ComputedStyle& style = layoutText->styleRef(box->isFirstLineStyle()); |
1137 const Font& font = style.font(); | 1137 const Font& font = style.font(); |
1138 TextRun run = box->constructTextRunForInspector(style); | 1138 TextRun run = box->constructTextRunForInspector(style); |
1139 TextRunPaintInfo paintInfo(run); | 1139 CachingWordShaper shaper(font); |
1140 GlyphBuffer glyphBuffer; | 1140 for (const auto& runFontData : shaper.runFontData(run)) { |
1141 font.buildGlyphBuffer(paintInfo, glyphBuffer); | 1141 const auto* simpleFontData = runFontData.m_fontData; |
1142 for (unsigned i = 0; i < glyphBuffer.size(); ++i) { | |
1143 const SimpleFontData* simpleFontData = glyphBuffer.fontDataAt(i); | |
1144 String familyName = simpleFontData->platformData().fontFamilyName(); | 1142 String familyName = simpleFontData->platformData().fontFamilyName(); |
1145 if (familyName.isNull()) | 1143 if (familyName.isNull()) |
1146 familyName = ""; | 1144 familyName = ""; |
1147 fontStats->add( | 1145 fontStats->add( |
1148 std::make_pair(simpleFontData->isCustomFont() ? 1 : 0, familyName)); | 1146 std::make_pair(simpleFontData->isCustomFont() ? 1 : 0, familyName), |
| 1147 runFontData.m_glyphCount); |
1149 } | 1148 } |
1150 } | 1149 } |
1151 } | 1150 } |
1152 | 1151 |
1153 Response InspectorCSSAgent::getPlatformFontsForNode( | 1152 Response InspectorCSSAgent::getPlatformFontsForNode( |
1154 int nodeId, | 1153 int nodeId, |
1155 std::unique_ptr<protocol::Array<protocol::CSS::PlatformFontUsage>>* | 1154 std::unique_ptr<protocol::Array<protocol::CSS::PlatformFontUsage>>* |
1156 platformFonts) { | 1155 platformFonts) { |
1157 Node* node = nullptr; | 1156 Node* node = nullptr; |
1158 Response response = m_domAgent->assertNode(nodeId, node); | 1157 Response response = m_domAgent->assertNode(nodeId, node); |
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2502 visitor->trace(m_cssStyleSheetToInspectorStyleSheet); | 2501 visitor->trace(m_cssStyleSheetToInspectorStyleSheet); |
2503 visitor->trace(m_documentToCSSStyleSheets); | 2502 visitor->trace(m_documentToCSSStyleSheets); |
2504 visitor->trace(m_invalidatedDocuments); | 2503 visitor->trace(m_invalidatedDocuments); |
2505 visitor->trace(m_nodeToInspectorStyleSheet); | 2504 visitor->trace(m_nodeToInspectorStyleSheet); |
2506 visitor->trace(m_inspectorUserAgentStyleSheet); | 2505 visitor->trace(m_inspectorUserAgentStyleSheet); |
2507 visitor->trace(m_tracker); | 2506 visitor->trace(m_tracker); |
2508 InspectorBaseAgent::trace(visitor); | 2507 InspectorBaseAgent::trace(visitor); |
2509 } | 2508 } |
2510 | 2509 |
2511 } // namespace blink | 2510 } // namespace blink |
OLD | NEW |