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

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

Issue 672953002: Convert first letter into a pseudo element. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « Source/core/editing/TextIterator.cpp ('k') | Source/core/rendering/HitTestResult.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorCSSAgent.cpp
diff --git a/Source/core/inspector/InspectorCSSAgent.cpp b/Source/core/inspector/InspectorCSSAgent.cpp
index 8fd2ce14c699ce2960fe67529d7c1fb83eea5e46..0c520016c2217c53f1a91b116b01945ed33adee8 100644
--- a/Source/core/inspector/InspectorCSSAgent.cpp
+++ b/Source/core/inspector/InspectorCSSAgent.cpp
@@ -793,16 +793,22 @@ void InspectorCSSAgent::getPlatformFontsForNode(ErrorString* errorString, int no
for (size_t i = 0; i < textNodes.size(); ++i) {
RenderText* renderer = textNodes[i]->renderer();
collectPlatformFontsForRenderer(renderer, &fontStats);
- if (renderer->isTextFragment()) {
- RenderTextFragment* textFragment = toRenderTextFragment(renderer);
- if (textFragment->firstLetter()) {
- RenderBoxModelObject* firstLetter = textFragment->firstLetter();
- for (RenderObject* current = firstLetter->slowFirstChild(); current; current = current->nextSibling()) {
- if (current->isText())
- collectPlatformFontsForRenderer(toRenderText(current), &fontStats);
- }
- }
- }
+
+ if (!renderer->isTextFragment())
+ continue;
+
+ // If we're the remaining text from a first-letter then our previous
+ // sibling has to be the first-letter renderer.
+ RenderObject* previous = renderer->previousSibling();
+ if (!previous)
+ continue;
+
+ if (!previous->isPseudoElement() || !previous->node()->isFirstLetterPseudoElement())
+ continue;
+
+ // The first-letter pseudoElement only has one child, which is the
+ // first-letter renderer.
+ collectPlatformFontsForRenderer(toRenderText(previous->slowFirstChild()), &fontStats);
}
platformFonts = TypeBuilder::Array<TypeBuilder::CSS::PlatformFontUsage>::create();
« no previous file with comments | « Source/core/editing/TextIterator.cpp ('k') | Source/core/rendering/HitTestResult.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698