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

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

Issue 940373003: Rename RenderText to LayoutText (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « Source/core/inspector/InspectorCSSAgent.h ('k') | Source/core/layout/BidiRun.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "core/html/HTMLHeadElement.h" 54 #include "core/html/HTMLHeadElement.h"
55 #include "core/html/VoidCallback.h" 55 #include "core/html/VoidCallback.h"
56 #include "core/inspector/InspectorHistory.h" 56 #include "core/inspector/InspectorHistory.h"
57 #include "core/inspector/InspectorPageAgent.h" 57 #include "core/inspector/InspectorPageAgent.h"
58 #include "core/inspector/InspectorResourceAgent.h" 58 #include "core/inspector/InspectorResourceAgent.h"
59 #include "core/inspector/InspectorResourceContentLoader.h" 59 #include "core/inspector/InspectorResourceContentLoader.h"
60 #include "core/inspector/InspectorState.h" 60 #include "core/inspector/InspectorState.h"
61 #include "core/inspector/InstrumentingAgents.h" 61 #include "core/inspector/InstrumentingAgents.h"
62 #include "core/layout/LayoutObject.h" 62 #include "core/layout/LayoutObject.h"
63 #include "core/layout/LayoutObjectInlines.h" 63 #include "core/layout/LayoutObjectInlines.h"
64 #include "core/layout/LayoutText.h"
65 #include "core/layout/LayoutTextFragment.h"
64 #include "core/layout/line/InlineTextBox.h" 66 #include "core/layout/line/InlineTextBox.h"
65 #include "core/loader/DocumentLoader.h" 67 #include "core/loader/DocumentLoader.h"
66 #include "core/page/Page.h" 68 #include "core/page/Page.h"
67 #include "core/rendering/RenderText.h"
68 #include "core/rendering/RenderTextFragment.h"
69 #include "platform/fonts/Font.h" 69 #include "platform/fonts/Font.h"
70 #include "platform/fonts/GlyphBuffer.h" 70 #include "platform/fonts/GlyphBuffer.h"
71 #include "platform/fonts/shaping/SimpleShaper.h" 71 #include "platform/fonts/shaping/SimpleShaper.h"
72 #include "platform/text/TextRun.h" 72 #include "platform/text/TextRun.h"
73 #include "wtf/CurrentTime.h" 73 #include "wtf/CurrentTime.h"
74 #include "wtf/text/CString.h" 74 #include "wtf/text/CString.h"
75 #include "wtf/text/StringConcatenate.h" 75 #include "wtf/text/StringConcatenate.h"
76 76
77 namespace CSSAgentState { 77 namespace CSSAgentState {
78 static const char cssAgentEnabled[] = "cssAgentEnabled"; 78 static const char cssAgentEnabled[] = "cssAgentEnabled";
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 { 790 {
791 Node* node = m_domAgent->assertNode(errorString, nodeId); 791 Node* node = m_domAgent->assertNode(errorString, nodeId);
792 if (!node) 792 if (!node)
793 return; 793 return;
794 794
795 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> computedStyleInfo = CSSCompu tedStyleDeclaration::create(node, true); 795 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> computedStyleInfo = CSSCompu tedStyleDeclaration::create(node, true);
796 RefPtrWillBeRawPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(I nspectorCSSId(), computedStyleInfo, 0); 796 RefPtrWillBeRawPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(I nspectorCSSId(), computedStyleInfo, 0);
797 style = inspectorStyle->buildArrayForComputedStyle(); 797 style = inspectorStyle->buildArrayForComputedStyle();
798 } 798 }
799 799
800 void InspectorCSSAgent::collectPlatformFontsForRenderer(RenderText* renderer, Ha shCountedSet<String>* fontStats) 800 void InspectorCSSAgent::collectPlatformFontsForRenderer(LayoutText* renderer, Ha shCountedSet<String>* fontStats)
801 { 801 {
802 for (InlineTextBox* box = renderer->firstTextBox(); box; box = box->nextText Box()) { 802 for (InlineTextBox* box = renderer->firstTextBox(); box; box = box->nextText Box()) {
803 const LayoutStyle& style = renderer->styleRef(box->isFirstLineStyle()); 803 const LayoutStyle& style = renderer->styleRef(box->isFirstLineStyle());
804 const Font& font = style.font(); 804 const Font& font = style.font();
805 TextRun run = box->constructTextRunForInspector(style, font); 805 TextRun run = box->constructTextRunForInspector(style, font);
806 SimpleShaper shaper(&font, run); 806 SimpleShaper shaper(&font, run);
807 GlyphBuffer glyphBuffer; 807 GlyphBuffer glyphBuffer;
808 shaper.advance(run.length(), &glyphBuffer); 808 shaper.advance(run.length(), &glyphBuffer);
809 for (unsigned i = 0; i < glyphBuffer.size(); ++i) { 809 for (unsigned i = 0; i < glyphBuffer.size(); ++i) {
810 String familyName = glyphBuffer.fontDataAt(i)->platformData().fontFa milyName(); 810 String familyName = glyphBuffer.fontDataAt(i)->platformData().fontFa milyName();
(...skipping 20 matching lines...) Expand all
831 textNodes.append(toText(node)); 831 textNodes.append(toText(node));
832 } else { 832 } else {
833 for (Node* child = node->firstChild(); child; child = child->nextSibling ()) { 833 for (Node* child = node->firstChild(); child; child = child->nextSibling ()) {
834 if (child->nodeType() == Node::TEXT_NODE && child->renderer()) 834 if (child->nodeType() == Node::TEXT_NODE && child->renderer())
835 textNodes.append(toText(child)); 835 textNodes.append(toText(child));
836 } 836 }
837 } 837 }
838 838
839 HashCountedSet<String> fontStats; 839 HashCountedSet<String> fontStats;
840 for (size_t i = 0; i < textNodes.size(); ++i) { 840 for (size_t i = 0; i < textNodes.size(); ++i) {
841 RenderText* renderer = textNodes[i]->renderer(); 841 LayoutText* renderer = textNodes[i]->renderer();
842 collectPlatformFontsForRenderer(renderer, &fontStats); 842 collectPlatformFontsForRenderer(renderer, &fontStats);
843 843
844 if (!renderer->isTextFragment()) 844 if (!renderer->isTextFragment())
845 continue; 845 continue;
846 846
847 // If we're the remaining text from a first-letter then our previous 847 // If we're the remaining text from a first-letter then our previous
848 // sibling has to be the first-letter renderer. 848 // sibling has to be the first-letter renderer.
849 LayoutObject* previous = renderer->previousSibling(); 849 LayoutObject* previous = renderer->previousSibling();
850 if (!previous) 850 if (!previous)
851 continue; 851 continue;
852 852
853 if (!previous->isPseudoElement() || !previous->node()->isFirstLetterPseu doElement()) 853 if (!previous->isPseudoElement() || !previous->node()->isFirstLetterPseu doElement())
854 continue; 854 continue;
855 855
856 // The first-letter pseudoElement only has one child, which is the 856 // The first-letter pseudoElement only has one child, which is the
857 // first-letter renderer. 857 // first-letter renderer.
858 collectPlatformFontsForRenderer(toRenderText(previous->slowFirstChild()) , &fontStats); 858 collectPlatformFontsForRenderer(toLayoutText(previous->slowFirstChild()) , &fontStats);
859 } 859 }
860 860
861 platformFonts = TypeBuilder::Array<TypeBuilder::CSS::PlatformFontUsage>::cre ate(); 861 platformFonts = TypeBuilder::Array<TypeBuilder::CSS::PlatformFontUsage>::cre ate();
862 for (auto& font : fontStats) { 862 for (auto& font : fontStats) {
863 RefPtr<TypeBuilder::CSS::PlatformFontUsage> platformFont = TypeBuilder:: CSS::PlatformFontUsage::create() 863 RefPtr<TypeBuilder::CSS::PlatformFontUsage> platformFont = TypeBuilder:: CSS::PlatformFontUsage::create()
864 .setFamilyName(font.key) 864 .setFamilyName(font.key)
865 .setGlyphCount(font.value); 865 .setGlyphCount(font.value);
866 platformFonts->addItem(platformFont); 866 platformFonts->addItem(platformFont);
867 } 867 }
868 } 868 }
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 visitor->trace(m_invalidatedDocuments); 1561 visitor->trace(m_invalidatedDocuments);
1562 visitor->trace(m_nodeToInspectorStyleSheet); 1562 visitor->trace(m_nodeToInspectorStyleSheet);
1563 visitor->trace(m_documentToViaInspectorStyleSheet); 1563 visitor->trace(m_documentToViaInspectorStyleSheet);
1564 #endif 1564 #endif
1565 visitor->trace(m_inspectorUserAgentStyleSheet); 1565 visitor->trace(m_inspectorUserAgentStyleSheet);
1566 InspectorBaseAgent::trace(visitor); 1566 InspectorBaseAgent::trace(visitor);
1567 } 1567 }
1568 1568
1569 } // namespace blink 1569 } // namespace blink
1570 1570
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorCSSAgent.h ('k') | Source/core/layout/BidiRun.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698