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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 return false; | 679 return false; |
680 | 680 |
681 // Unsupported standard property. | 681 // Unsupported standard property. |
682 if (content.equalIgnoringCase("font-size-adjust")) | 682 if (content.equalIgnoringCase("font-size-adjust")) |
683 return false; | 683 return false; |
684 break; | 684 break; |
685 } | 685 } |
686 return true; | 686 return true; |
687 } | 687 } |
688 | 688 |
689 InspectorCSSAgent::InspectorCSSAgent(InstrumentingAgents* instrumentingAgents, I
nspectorCompositeState* state, InspectorDOMAgent* domAgent, InspectorPageAgent*
pageAgent) | 689 InspectorCSSAgent::InspectorCSSAgent(InstrumentingAgents* instrumentingAgents, I
nspectorState* state, PassRefPtr<InspectorDOMAgent> domAgent, PassRefPtr<Inspect
orPageAgent> pageAgent) |
690 : InspectorBaseAgent<InspectorCSSAgent>("CSS", instrumentingAgents, state) | 690 : InspectorBaseAgent(instrumentingAgents, state) |
691 , m_frontend(0) | 691 , m_frontend(0) |
692 , m_domAgent(domAgent) | 692 , m_domAgent(domAgent) |
693 , m_pageAgent(pageAgent) | 693 , m_pageAgent(pageAgent) |
694 , m_lastStyleSheetId(1) | 694 , m_lastStyleSheetId(1) |
695 , m_creatingViaInspectorStyleSheet(false) | 695 , m_creatingViaInspectorStyleSheet(false) |
696 { | 696 { |
697 m_domAgent->setDOMListener(this); | 697 m_domAgent->setDOMListener(this); |
698 } | 698 } |
699 | 699 |
700 InspectorCSSAgent::~InspectorCSSAgent() | 700 InspectorCSSAgent::~InspectorCSSAgent() |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 | 1343 |
1344 InspectorStyleSheetForInlineStyle* InspectorCSSAgent::asInspectorStyleSheet(Elem
ent* element) | 1344 InspectorStyleSheetForInlineStyle* InspectorCSSAgent::asInspectorStyleSheet(Elem
ent* element) |
1345 { | 1345 { |
1346 NodeToInspectorStyleSheet::iterator it = m_nodeToInspectorStyleSheet.find(el
ement); | 1346 NodeToInspectorStyleSheet::iterator it = m_nodeToInspectorStyleSheet.find(el
ement); |
1347 if (it == m_nodeToInspectorStyleSheet.end()) { | 1347 if (it == m_nodeToInspectorStyleSheet.end()) { |
1348 CSSStyleDeclaration* style = element->isStyledElement() ? element->style
() : 0; | 1348 CSSStyleDeclaration* style = element->isStyledElement() ? element->style
() : 0; |
1349 if (!style) | 1349 if (!style) |
1350 return 0; | 1350 return 0; |
1351 | 1351 |
1352 String newStyleSheetId = String::number(m_lastStyleSheetId++); | 1352 String newStyleSheetId = String::number(m_lastStyleSheetId++); |
1353 RefPtr<InspectorStyleSheetForInlineStyle> inspectorStyleSheet = Inspecto
rStyleSheetForInlineStyle::create(m_pageAgent, newStyleSheetId, element, TypeBui
lder::CSS::StyleSheetOrigin::Regular, this); | 1353 RefPtr<InspectorStyleSheetForInlineStyle> inspectorStyleSheet = Inspecto
rStyleSheetForInlineStyle::create(m_pageAgent.get(), newStyleSheetId, element, T
ypeBuilder::CSS::StyleSheetOrigin::Regular, this); |
1354 m_idToInspectorStyleSheet.set(newStyleSheetId, inspectorStyleSheet); | 1354 m_idToInspectorStyleSheet.set(newStyleSheetId, inspectorStyleSheet); |
1355 m_nodeToInspectorStyleSheet.set(element, inspectorStyleSheet); | 1355 m_nodeToInspectorStyleSheet.set(element, inspectorStyleSheet); |
1356 return inspectorStyleSheet.get(); | 1356 return inspectorStyleSheet.get(); |
1357 } | 1357 } |
1358 | 1358 |
1359 return it->value.get(); | 1359 return it->value.get(); |
1360 } | 1360 } |
1361 | 1361 |
1362 Element* InspectorCSSAgent::elementForId(ErrorString* errorString, int nodeId) | 1362 Element* InspectorCSSAgent::elementForId(ErrorString* errorString, int nodeId) |
1363 { | 1363 { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 } | 1408 } |
1409 } | 1409 } |
1410 } | 1410 } |
1411 | 1411 |
1412 InspectorStyleSheet* InspectorCSSAgent::bindStyleSheet(CSSStyleSheet* styleSheet
) | 1412 InspectorStyleSheet* InspectorCSSAgent::bindStyleSheet(CSSStyleSheet* styleSheet
) |
1413 { | 1413 { |
1414 RefPtr<InspectorStyleSheet> inspectorStyleSheet = m_cssStyleSheetToInspector
StyleSheet.get(styleSheet); | 1414 RefPtr<InspectorStyleSheet> inspectorStyleSheet = m_cssStyleSheetToInspector
StyleSheet.get(styleSheet); |
1415 if (!inspectorStyleSheet) { | 1415 if (!inspectorStyleSheet) { |
1416 String id = String::number(m_lastStyleSheetId++); | 1416 String id = String::number(m_lastStyleSheetId++); |
1417 Document* document = styleSheet->ownerDocument(); | 1417 Document* document = styleSheet->ownerDocument(); |
1418 inspectorStyleSheet = InspectorStyleSheet::create(m_pageAgent, id, style
Sheet, detectOrigin(styleSheet, document), InspectorDOMAgent::documentURLString(
document), this); | 1418 inspectorStyleSheet = InspectorStyleSheet::create(m_pageAgent.get(), id,
styleSheet, detectOrigin(styleSheet, document), InspectorDOMAgent::documentURLS
tring(document), this); |
1419 m_idToInspectorStyleSheet.set(id, inspectorStyleSheet); | 1419 m_idToInspectorStyleSheet.set(id, inspectorStyleSheet); |
1420 m_cssStyleSheetToInspectorStyleSheet.set(styleSheet, inspectorStyleSheet
); | 1420 m_cssStyleSheetToInspectorStyleSheet.set(styleSheet, inspectorStyleSheet
); |
1421 if (m_creatingViaInspectorStyleSheet) | 1421 if (m_creatingViaInspectorStyleSheet) |
1422 m_documentToInspectorStyleSheet.add(document, inspectorStyleSheet); | 1422 m_documentToInspectorStyleSheet.add(document, inspectorStyleSheet); |
1423 } | 1423 } |
1424 return inspectorStyleSheet.get(); | 1424 return inspectorStyleSheet.get(); |
1425 } | 1425 } |
1426 | 1426 |
1427 String InspectorCSSAgent::unbindStyleSheet(InspectorStyleSheet* inspectorStyleSh
eet) | 1427 String InspectorCSSAgent::unbindStyleSheet(InspectorStyleSheet* inspectorStyleSh
eet) |
1428 { | 1428 { |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1687 Element* element = toElement(m_domAgent->nodeForId(it->key)); | 1687 Element* element = toElement(m_domAgent->nodeForId(it->key)); |
1688 if (element && element->ownerDocument()) | 1688 if (element && element->ownerDocument()) |
1689 documentsToChange.add(element->ownerDocument()); | 1689 documentsToChange.add(element->ownerDocument()); |
1690 } | 1690 } |
1691 | 1691 |
1692 m_nodeIdToForcedPseudoState.clear(); | 1692 m_nodeIdToForcedPseudoState.clear(); |
1693 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu
mentsToChange.end(); it != end; ++it) | 1693 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu
mentsToChange.end(); it != end; ++it) |
1694 (*it)->styleResolverChanged(RecalcStyleImmediately); | 1694 (*it)->styleResolverChanged(RecalcStyleImmediately); |
1695 } | 1695 } |
1696 | 1696 |
| 1697 InspectorCSSFactory::InspectorCSSFactory(InstrumentingAgents* instrumentingAgent
s, InspectorCompositeState* compositeState, InspectorDOMFactory* domFactory, Ins
pectorPageFactory* pageFactory) |
| 1698 : InspectorBaseFactory<InspectorCSSFactory, InspectorCSSAgent>("CSS", instru
mentingAgents, compositeState) |
| 1699 { |
| 1700 setAgent(InspectorCSSAgent::create(m_instrumentingAgents, m_state, domFactor
y->agent(), pageFactory->agent())); |
| 1701 } |
| 1702 |
1697 } // namespace WebCore | 1703 } // namespace WebCore |
1698 | 1704 |
OLD | NEW |