Reviewers: eae, lushnikov,
Description:
Determine used fonts based on the correct font path
InspectorCSSAgent previously always instantiated a SimpleShaper,
leading to incorrect results when the run was shaped using complex
path.
BUG=538180
R=eae,lushnikov
Please review this at
https://codereview.chromium.org/1379473005/
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Affected files (+10, -2 lines):
M third_party/WebKit/LayoutTests/TestExpectations
M third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
M third_party/WebKit/Source/platform/fonts/Font.h
Index: third_party/WebKit/LayoutTests/TestExpectations
diff --git a/third_party/WebKit/LayoutTests/TestExpectations
b/third_party/WebKit/LayoutTests/TestExpectations
index
b4b67556412a5de1e7dd9a2e9404e4c18dfa0f9d..abd34d1ec86db36e18e901eeee8f698ebf5e19c9
100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1448,6 +1448,8 @@
crbug.com/464736
http/tests/xmlhttprequest/ontimeout-event-override-after-failur
# Unclear semantics of ToString (actually ToPrimitive) across iframes.
crbug.com/532469 http/tests/security/cross-frame-access-custom.html [
NeedsManualRebaseline ]
+
crbug.com/538180 [ Win7 XP Linux Mac Android ]
inspector-protocol/layout-fonts/languages-emoji-rare-glyphs.html [
NeedsRebaseline ]
+
# Win10 specific failures that still need triaging.
crbug.com/521730 [ Win10 ]
fast/dom/Window/property-access-on-cached-properties-after-frame-navigated.html
[ Failure ]
crbug.com/521730 [ Win10 ]
fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced.html
[ Failure ]
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
ae0346ac52cb820480b22e85061f3bb905b9bd67..ccabca73f8025629b7aead76fc05749f2ed7e002
100644
--- a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
@@ -69,6 +69,7 @@
#include "core/loader/DocumentLoader.h"
#include "core/page/Page.h"
#include "platform/fonts/Font.h"
+#include "platform/fonts/FontCache.h"
#include "platform/fonts/GlyphBuffer.h"
#include "platform/fonts/shaping/SimpleShaper.h"
#include "platform/text/TextRun.h"
@@ -817,14 +818,16 @@ void
InspectorCSSAgent::collectPlatformFontsForLayoutObject(LayoutObject* layout
{
if (!layoutObject->isText())
return;
+
+ FontCachePurgePreventer preventer;
LayoutText* layoutText = toLayoutText(layoutObject);
for (InlineTextBox* box = layoutText->firstTextBox(); box; box =
box->nextTextBox()) {
const ComputedStyle& style =
layoutText->styleRef(box->isFirstLineStyle());
const Font& font = style.font();
TextRun run = box->constructTextRunForInspector(style, font);
- SimpleShaper shaper(&font, run);
+ TextRunPaintInfo paintInfo(run);
GlyphBuffer glyphBuffer;
- shaper.advance(run.length(), &glyphBuffer);
+ font.buildGlyphBuffer(paintInfo, glyphBuffer);
for (unsigned i = 0; i < glyphBuffer.size(); ++i) {
String familyName =
glyphBuffer.fontDataAt(i)->platformData().fontFamilyName();
if (familyName.isNull())
Index: third_party/WebKit/Source/platform/fonts/Font.h
diff --git a/third_party/WebKit/Source/platform/fonts/Font.h
b/third_party/WebKit/Source/platform/fonts/Font.h
index
3054f03887baebba5a6dce7cbe526df9fc129258..1ccaf525b07fcd3b7883d16e039997515dc09d04
100644
--- a/third_party/WebKit/Source/platform/fonts/Font.h
+++ b/third_party/WebKit/Source/platform/fonts/Font.h
@@ -162,6 +162,9 @@ private:
mutable RefPtr<FontFallbackList> m_fontFallbackList;
mutable unsigned m_canShapeWordByWord : 1;
mutable unsigned m_shapeWordByWordComputed : 1;
+
+ // For accessing buildGlyphbuffer and retrieving fonts used in
rendering a node.
+ friend class InspectorCSSAgent;
};
inline Font::~Font()