Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp

Issue 1379473005: Determine used fonts based on the correct font code path (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #include "core/inspector/InspectorState.h" 62 #include "core/inspector/InspectorState.h"
63 #include "core/inspector/InstrumentingAgents.h" 63 #include "core/inspector/InstrumentingAgents.h"
64 #include "core/layout/LayoutObject.h" 64 #include "core/layout/LayoutObject.h"
65 #include "core/layout/LayoutObjectInlines.h" 65 #include "core/layout/LayoutObjectInlines.h"
66 #include "core/layout/LayoutText.h" 66 #include "core/layout/LayoutText.h"
67 #include "core/layout/LayoutTextFragment.h" 67 #include "core/layout/LayoutTextFragment.h"
68 #include "core/layout/line/InlineTextBox.h" 68 #include "core/layout/line/InlineTextBox.h"
69 #include "core/loader/DocumentLoader.h" 69 #include "core/loader/DocumentLoader.h"
70 #include "core/page/Page.h" 70 #include "core/page/Page.h"
71 #include "platform/fonts/Font.h" 71 #include "platform/fonts/Font.h"
72 #include "platform/fonts/FontCache.h"
72 #include "platform/fonts/GlyphBuffer.h" 73 #include "platform/fonts/GlyphBuffer.h"
73 #include "platform/fonts/shaping/SimpleShaper.h" 74 #include "platform/fonts/shaping/SimpleShaper.h"
74 #include "platform/text/TextRun.h" 75 #include "platform/text/TextRun.h"
75 #include "wtf/CurrentTime.h" 76 #include "wtf/CurrentTime.h"
76 #include "wtf/text/CString.h" 77 #include "wtf/text/CString.h"
77 #include "wtf/text/StringConcatenate.h" 78 #include "wtf/text/StringConcatenate.h"
78 79
79 namespace { 80 namespace {
80 81
81 int s_frontendOperationCounter = 0; 82 int s_frontendOperationCounter = 0;
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 811
811 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> computedStyleInfo = CSSCompu tedStyleDeclaration::create(node, true); 812 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> computedStyleInfo = CSSCompu tedStyleDeclaration::create(node, true);
812 RefPtrWillBeRawPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(c omputedStyleInfo, nullptr, nullptr); 813 RefPtrWillBeRawPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(c omputedStyleInfo, nullptr, nullptr);
813 style = inspectorStyle->buildArrayForComputedStyle(); 814 style = inspectorStyle->buildArrayForComputedStyle();
814 } 815 }
815 816
816 void InspectorCSSAgent::collectPlatformFontsForLayoutObject(LayoutObject* layout Object, HashCountedSet<String>* fontStats) 817 void InspectorCSSAgent::collectPlatformFontsForLayoutObject(LayoutObject* layout Object, HashCountedSet<String>* fontStats)
817 { 818 {
818 if (!layoutObject->isText()) 819 if (!layoutObject->isText())
819 return; 820 return;
821
822 FontCachePurgePreventer preventer;
820 LayoutText* layoutText = toLayoutText(layoutObject); 823 LayoutText* layoutText = toLayoutText(layoutObject);
821 for (InlineTextBox* box = layoutText->firstTextBox(); box; box = box->nextTe xtBox()) { 824 for (InlineTextBox* box = layoutText->firstTextBox(); box; box = box->nextTe xtBox()) {
822 const ComputedStyle& style = layoutText->styleRef(box->isFirstLineStyle( )); 825 const ComputedStyle& style = layoutText->styleRef(box->isFirstLineStyle( ));
823 const Font& font = style.font(); 826 const Font& font = style.font();
824 TextRun run = box->constructTextRunForInspector(style, font); 827 TextRun run = box->constructTextRunForInspector(style, font);
825 SimpleShaper shaper(&font, run); 828 TextRunPaintInfo paintInfo(run);
826 GlyphBuffer glyphBuffer; 829 GlyphBuffer glyphBuffer;
827 shaper.advance(run.length(), &glyphBuffer); 830 font.buildGlyphBuffer(paintInfo, glyphBuffer);
828 for (unsigned i = 0; i < glyphBuffer.size(); ++i) { 831 for (unsigned i = 0; i < glyphBuffer.size(); ++i) {
829 String familyName = glyphBuffer.fontDataAt(i)->platformData().fontFa milyName(); 832 String familyName = glyphBuffer.fontDataAt(i)->platformData().fontFa milyName();
830 if (familyName.isNull()) 833 if (familyName.isNull())
831 familyName = ""; 834 familyName = "";
832 fontStats->add(familyName); 835 fontStats->add(familyName);
833 } 836 }
834 } 837 }
835 } 838 }
836 839
837 void InspectorCSSAgent::getPlatformFontsForNode(ErrorString* errorString, int no deId, 840 void InspectorCSSAgent::getPlatformFontsForNode(ErrorString* errorString, int no deId,
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 visitor->trace(m_documentToCSSStyleSheets); 1752 visitor->trace(m_documentToCSSStyleSheets);
1750 visitor->trace(m_invalidatedDocuments); 1753 visitor->trace(m_invalidatedDocuments);
1751 visitor->trace(m_nodeToInspectorStyleSheet); 1754 visitor->trace(m_nodeToInspectorStyleSheet);
1752 visitor->trace(m_documentToViaInspectorStyleSheet); 1755 visitor->trace(m_documentToViaInspectorStyleSheet);
1753 #endif 1756 #endif
1754 visitor->trace(m_inspectorUserAgentStyleSheet); 1757 visitor->trace(m_inspectorUserAgentStyleSheet);
1755 InspectorBaseAgent::trace(visitor); 1758 InspectorBaseAgent::trace(visitor);
1756 } 1759 }
1757 1760
1758 } // namespace blink 1761 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698