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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp

Issue 2718043003: Refactor InspectorCSSAgent to avoid an intermediate GlyphBuffer (Closed)
Patch Set: review Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
index 53831b7384bdf227a9b69ce0e9906b72954510b3..b9d17694124d388799e1bcbdac9319757b23d283 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
@@ -84,7 +84,7 @@
#include "core/svg/SVGElement.h"
#include "platform/fonts/Font.h"
#include "platform/fonts/FontCache.h"
-#include "platform/fonts/GlyphBuffer.h"
+#include "platform/fonts/shaping/CachingWordShaper.h"
#include "platform/text/TextRun.h"
#include "wtf/CurrentTime.h"
#include "wtf/text/CString.h"
@@ -1136,16 +1136,15 @@ void InspectorCSSAgent::collectPlatformFontsForLayoutObject(
const ComputedStyle& style = layoutText->styleRef(box->isFirstLineStyle());
const Font& font = style.font();
TextRun run = box->constructTextRunForInspector(style);
- TextRunPaintInfo paintInfo(run);
- GlyphBuffer glyphBuffer;
- font.buildGlyphBuffer(paintInfo, glyphBuffer);
- for (unsigned i = 0; i < glyphBuffer.size(); ++i) {
- const SimpleFontData* simpleFontData = glyphBuffer.fontDataAt(i);
+ CachingWordShaper shaper(font);
+ for (const auto& runFontData : shaper.getRunFontData(run)) {
eae 2017/02/27 23:24:59 Please don't use auto here and instead specify the
f(malita) 2017/02/28 03:27:47 Now that we return a struct and access named field
eae 2017/02/28 03:31:19 Agreed, with a struct the use of auto is perfectly
+ const auto* simpleFontData = std::get<0>(runFontData);
String familyName = simpleFontData->platformData().fontFamilyName();
if (familyName.isNull())
familyName = "";
fontStats->add(
- std::make_pair(simpleFontData->isCustomFont() ? 1 : 0, familyName));
+ std::make_pair(simpleFontData->isCustomFont() ? 1 : 0, familyName),
+ std::get<1>(runFontData));
}
}
}

Powered by Google App Engine
This is Rietveld 408576698