| OLD | NEW |
| 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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 RefPtr<TypeBuilder::CSS::CSSStyle> attributes = buildObjectForAttributesStyl
e(element); | 738 RefPtr<TypeBuilder::CSS::CSSStyle> attributes = buildObjectForAttributesStyl
e(element); |
| 739 attributesStyle = attributes ? attributes.release() : nullptr; | 739 attributesStyle = attributes ? attributes.release() : nullptr; |
| 740 } | 740 } |
| 741 | 741 |
| 742 void InspectorCSSAgent::getComputedStyleForNode(ErrorString* errorString, int no
deId, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >& s
tyle) | 742 void InspectorCSSAgent::getComputedStyleForNode(ErrorString* errorString, int no
deId, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >& s
tyle) |
| 743 { | 743 { |
| 744 Node* node = m_domAgent->assertNode(errorString, nodeId); | 744 Node* node = m_domAgent->assertNode(errorString, nodeId); |
| 745 if (!node) | 745 if (!node) |
| 746 return; | 746 return; |
| 747 | 747 |
| 748 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> computedStyleInfo = CSSCompu
tedStyleDeclaration::create(node, true); | 748 RefPtr<CSSComputedStyleDeclaration> computedStyleInfo = CSSComputedStyleDecl
aration::create(node, true); |
| 749 RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSI
d(), computedStyleInfo, 0); | 749 RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSI
d(), computedStyleInfo, 0); |
| 750 style = inspectorStyle->buildArrayForComputedStyle(); | 750 style = inspectorStyle->buildArrayForComputedStyle(); |
| 751 } | 751 } |
| 752 | 752 |
| 753 void InspectorCSSAgent::collectPlatformFontsForRenderer(RenderText* renderer, Ha
shCountedSet<String>* fontStats) | 753 void InspectorCSSAgent::collectPlatformFontsForRenderer(RenderText* renderer, Ha
shCountedSet<String>* fontStats) |
| 754 { | 754 { |
| 755 for (InlineTextBox* box = renderer->firstTextBox(); box; box = box->nextText
Box()) { | 755 for (InlineTextBox* box = renderer->firstTextBox(); box; box = box->nextText
Box()) { |
| 756 RenderStyle* style = renderer->style(box->isFirstLineStyle()); | 756 RenderStyle* style = renderer->style(box->isFirstLineStyle()); |
| 757 const Font& font = style->font(); | 757 const Font& font = style->font(); |
| 758 TextRun run = box->constructTextRunForInspector(style, font); | 758 TextRun run = box->constructTextRunForInspector(style, font); |
| 759 WidthIterator it(&font, run, 0, false); | 759 WidthIterator it(&font, run, 0, false); |
| 760 GlyphBuffer glyphBuffer; | 760 GlyphBuffer glyphBuffer; |
| 761 it.advance(run.length(), &glyphBuffer); | 761 it.advance(run.length(), &glyphBuffer); |
| 762 for (unsigned i = 0; i < glyphBuffer.size(); ++i) { | 762 for (unsigned i = 0; i < glyphBuffer.size(); ++i) { |
| 763 String familyName = glyphBuffer.fontDataAt(i)->platformData().fontFa
milyName(); | 763 String familyName = glyphBuffer.fontDataAt(i)->platformData().fontFa
milyName(); |
| 764 if (familyName.isNull()) | 764 if (familyName.isNull()) |
| 765 familyName = ""; | 765 familyName = ""; |
| 766 fontStats->add(familyName); | 766 fontStats->add(familyName); |
| 767 } | 767 } |
| 768 } | 768 } |
| 769 } | 769 } |
| 770 | 770 |
| 771 void InspectorCSSAgent::getPlatformFontsForNode(ErrorString* errorString, int no
deId, | 771 void InspectorCSSAgent::getPlatformFontsForNode(ErrorString* errorString, int no
deId, |
| 772 String* cssFamilyName, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::PlatformF
ontUsage> >& platformFonts) | 772 String* cssFamilyName, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::PlatformF
ontUsage> >& platformFonts) |
| 773 { | 773 { |
| 774 Node* node = m_domAgent->assertNode(errorString, nodeId); | 774 Node* node = m_domAgent->assertNode(errorString, nodeId); |
| 775 if (!node) | 775 if (!node) |
| 776 return; | 776 return; |
| 777 | 777 |
| 778 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> computedStyleInfo = CSSCompu
tedStyleDeclaration::create(node, true); | 778 RefPtr<CSSComputedStyleDeclaration> computedStyleInfo = CSSComputedStyleDecl
aration::create(node, true); |
| 779 *cssFamilyName = computedStyleInfo->getPropertyValue(CSSPropertyFontFamily); | 779 *cssFamilyName = computedStyleInfo->getPropertyValue(CSSPropertyFontFamily); |
| 780 | 780 |
| 781 Vector<Node*> textNodes; | 781 Vector<Node*> textNodes; |
| 782 if (node->nodeType() == Node::TEXT_NODE) { | 782 if (node->nodeType() == Node::TEXT_NODE) { |
| 783 if (node->renderer()) | 783 if (node->renderer()) |
| 784 textNodes.append(node); | 784 textNodes.append(node); |
| 785 } else { | 785 } else { |
| 786 for (Node* child = node->firstChild(); child; child = child->nextSibling
()) { | 786 for (Node* child = node->firstChild(); child; child = child->nextSibling
()) { |
| 787 if (child->nodeType() == Node::TEXT_NODE && child->renderer()) | 787 if (child->nodeType() == Node::TEXT_NODE && child->renderer()) |
| 788 textNodes.append(child); | 788 textNodes.append(child); |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1352 documentsToChange.add(element->ownerDocument()); | 1352 documentsToChange.add(element->ownerDocument()); |
| 1353 } | 1353 } |
| 1354 | 1354 |
| 1355 m_nodeIdToForcedPseudoState.clear(); | 1355 m_nodeIdToForcedPseudoState.clear(); |
| 1356 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu
mentsToChange.end(); it != end; ++it) | 1356 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu
mentsToChange.end(); it != end; ++it) |
| 1357 (*it)->setNeedsStyleRecalc(SubtreeStyleChange); | 1357 (*it)->setNeedsStyleRecalc(SubtreeStyleChange); |
| 1358 } | 1358 } |
| 1359 | 1359 |
| 1360 } // namespace WebCore | 1360 } // namespace WebCore |
| 1361 | 1361 |
| OLD | NEW |