| 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 29 matching lines...) Expand all Loading... |
| 40 #include "core/css/StyleSheetContents.h" | 40 #include "core/css/StyleSheetContents.h" |
| 41 #include "core/css/parser/CSSParser.h" | 41 #include "core/css/parser/CSSParser.h" |
| 42 #include "core/css/parser/CSSParserObserver.h" | 42 #include "core/css/parser/CSSParserObserver.h" |
| 43 #include "core/dom/DOMNodeIds.h" | 43 #include "core/dom/DOMNodeIds.h" |
| 44 #include "core/dom/Document.h" | 44 #include "core/dom/Document.h" |
| 45 #include "core/dom/Element.h" | 45 #include "core/dom/Element.h" |
| 46 #include "core/html/HTMLStyleElement.h" | 46 #include "core/html/HTMLStyleElement.h" |
| 47 #include "core/html/parser/HTMLParserIdioms.h" | 47 #include "core/html/parser/HTMLParserIdioms.h" |
| 48 #include "core/inspector/ContentSearchUtils.h" | 48 #include "core/inspector/ContentSearchUtils.h" |
| 49 #include "core/inspector/InspectorCSSAgent.h" | 49 #include "core/inspector/InspectorCSSAgent.h" |
| 50 #include "core/inspector/InspectorPageAgent.h" | 50 #include "core/inspector/InspectorIdentifiers.h" |
| 51 #include "core/inspector/InspectorResourceAgent.h" | 51 #include "core/inspector/InspectorResourceAgent.h" |
| 52 #include "core/svg/SVGStyleElement.h" | 52 #include "core/svg/SVGStyleElement.h" |
| 53 #include "wtf/OwnPtr.h" | 53 #include "wtf/OwnPtr.h" |
| 54 #include "wtf/PassOwnPtr.h" | 54 #include "wtf/PassOwnPtr.h" |
| 55 #include "wtf/text/StringBuilder.h" | 55 #include "wtf/text/StringBuilder.h" |
| 56 #include "wtf/text/TextPosition.h" | 56 #include "wtf/text/TextPosition.h" |
| 57 | 57 |
| 58 using blink::TypeBuilder::Array; | 58 using blink::TypeBuilder::Array; |
| 59 using blink::RuleSourceDataList; | 59 using blink::RuleSourceDataList; |
| 60 using blink::CSSRuleSourceData; | 60 using blink::CSSRuleSourceData; |
| (...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 if (!sourceRange.length() && ruleSourceData->ruleBodyRange.start <= sour
ceRange.start && sourceRange.start <= ruleSourceData->ruleBodyRange.end) { | 972 if (!sourceRange.length() && ruleSourceData->ruleBodyRange.start <= sour
ceRange.start && sourceRange.start <= ruleSourceData->ruleBodyRange.end) { |
| 973 *ruleId = InspectorCSSId(id(), i); | 973 *ruleId = InspectorCSSId(id(), i); |
| 974 *propertyIndex = propertyData.size(); | 974 *propertyIndex = propertyData.size(); |
| 975 *overwrite = false; | 975 *overwrite = false; |
| 976 return true; | 976 return true; |
| 977 } | 977 } |
| 978 } | 978 } |
| 979 return false; | 979 return false; |
| 980 } | 980 } |
| 981 | 981 |
| 982 PassRefPtrWillBeRawPtr<InspectorStyleSheet> InspectorStyleSheet::create(Inspecto
rPageAgent* pageAgent, InspectorResourceAgent* resourceAgent, const String& id,
PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleShe
etOrigin::Enum origin, const String& documentURL, InspectorCSSAgent* cssAgent) | 982 PassRefPtrWillBeRawPtr<InspectorStyleSheet> InspectorStyleSheet::create(Inspecto
rResourceAgent* resourceAgent, const String& id, PassRefPtrWillBeRawPtr<CSSStyle
Sheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum origin, const St
ring& documentURL, InspectorCSSAgent* cssAgent) |
| 983 { | 983 { |
| 984 return adoptRefWillBeNoop(new InspectorStyleSheet(pageAgent, resourceAgent,
id, pageStyleSheet, origin, documentURL, cssAgent)); | 984 return adoptRefWillBeNoop(new InspectorStyleSheet(resourceAgent, id, pageSty
leSheet, origin, documentURL, cssAgent)); |
| 985 } | 985 } |
| 986 | 986 |
| 987 InspectorStyleSheet::InspectorStyleSheet(InspectorPageAgent* pageAgent, Inspecto
rResourceAgent* resourceAgent, const String& id, PassRefPtrWillBeRawPtr<CSSStyle
Sheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum origin, const St
ring& documentURL, InspectorCSSAgent* cssAgent) | 987 InspectorStyleSheet::InspectorStyleSheet(InspectorResourceAgent* resourceAgent,
const String& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuil
der::CSS::StyleSheetOrigin::Enum origin, const String& documentURL, InspectorCSS
Agent* cssAgent) |
| 988 : InspectorStyleSheetBase(id, cssAgent) | 988 : InspectorStyleSheetBase(id, cssAgent) |
| 989 , m_cssAgent(cssAgent) | 989 , m_cssAgent(cssAgent) |
| 990 , m_pageAgent(pageAgent) | |
| 991 , m_resourceAgent(resourceAgent) | 990 , m_resourceAgent(resourceAgent) |
| 992 , m_pageStyleSheet(pageStyleSheet) | 991 , m_pageStyleSheet(pageStyleSheet) |
| 993 , m_origin(origin) | 992 , m_origin(origin) |
| 994 , m_documentURL(documentURL) | 993 , m_documentURL(documentURL) |
| 995 { | 994 { |
| 996 m_parsedStyleSheet = adoptPtr(new ParsedStyleSheet(m_pageStyleSheet.get())); | 995 m_parsedStyleSheet = adoptPtr(new ParsedStyleSheet(m_pageStyleSheet.get())); |
| 997 } | 996 } |
| 998 | 997 |
| 999 InspectorStyleSheet::~InspectorStyleSheet() | 998 InspectorStyleSheet::~InspectorStyleSheet() |
| 1000 { | 999 { |
| 1001 } | 1000 } |
| 1002 | 1001 |
| 1003 DEFINE_TRACE(InspectorStyleSheet) | 1002 DEFINE_TRACE(InspectorStyleSheet) |
| 1004 { | 1003 { |
| 1005 visitor->trace(m_cssAgent); | 1004 visitor->trace(m_cssAgent); |
| 1006 visitor->trace(m_pageAgent); | |
| 1007 visitor->trace(m_resourceAgent); | 1005 visitor->trace(m_resourceAgent); |
| 1008 visitor->trace(m_pageStyleSheet); | 1006 visitor->trace(m_pageStyleSheet); |
| 1009 visitor->trace(m_flatRules); | 1007 visitor->trace(m_flatRules); |
| 1010 InspectorStyleSheetBase::trace(visitor); | 1008 InspectorStyleSheetBase::trace(visitor); |
| 1011 } | 1009 } |
| 1012 | 1010 |
| 1013 static String styleSheetURL(CSSStyleSheet* pageStyleSheet) | 1011 static String styleSheetURL(CSSStyleSheet* pageStyleSheet) |
| 1014 { | 1012 { |
| 1015 if (pageStyleSheet && !pageStyleSheet->contents()->baseURL().isEmpty()) | 1013 if (pageStyleSheet && !pageStyleSheet->contents()->baseURL().isEmpty()) |
| 1016 return pageStyleSheet->contents()->baseURL().string(); | 1014 return pageStyleSheet->contents()->baseURL().string(); |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 | 1404 |
| 1407 Document* document = styleSheet->ownerDocument(); | 1405 Document* document = styleSheet->ownerDocument(); |
| 1408 LocalFrame* frame = document ? document->frame() : nullptr; | 1406 LocalFrame* frame = document ? document->frame() : nullptr; |
| 1409 | 1407 |
| 1410 RefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> result = TypeBuilder::CSS::CSS
StyleSheetHeader::create() | 1408 RefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> result = TypeBuilder::CSS::CSS
StyleSheetHeader::create() |
| 1411 .setStyleSheetId(id()) | 1409 .setStyleSheetId(id()) |
| 1412 .setOrigin(m_origin) | 1410 .setOrigin(m_origin) |
| 1413 .setDisabled(styleSheet->disabled()) | 1411 .setDisabled(styleSheet->disabled()) |
| 1414 .setSourceURL(url()) | 1412 .setSourceURL(url()) |
| 1415 .setTitle(styleSheet->title()) | 1413 .setTitle(styleSheet->title()) |
| 1416 .setFrameId(m_pageAgent->frameId(frame)) | 1414 .setFrameId(frame ? InspectorIdentifiers<LocalFrame>::identifier(frame)
: "") |
| 1417 .setIsInline(styleSheet->isInline() && !startsAtZero()) | 1415 .setIsInline(styleSheet->isInline() && !startsAtZero()) |
| 1418 .setStartLine(styleSheet->startPositionInSource().m_line.zeroBasedInt()) | 1416 .setStartLine(styleSheet->startPositionInSource().m_line.zeroBasedInt()) |
| 1419 .setStartColumn(styleSheet->startPositionInSource().m_column.zeroBasedIn
t()); | 1417 .setStartColumn(styleSheet->startPositionInSource().m_column.zeroBasedIn
t()); |
| 1420 | 1418 |
| 1421 if (hasSourceURL()) | 1419 if (hasSourceURL()) |
| 1422 result->setHasSourceURL(true); | 1420 result->setHasSourceURL(true); |
| 1423 | 1421 |
| 1424 if (styleSheet->ownerNode()) | 1422 if (styleSheet->ownerNode()) |
| 1425 result->setOwnerNode(DOMNodeIds::idForNode(styleSheet->ownerNode())); | 1423 result->setOwnerNode(DOMNodeIds::idForNode(styleSheet->ownerNode())); |
| 1426 | 1424 |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1995 | 1993 |
| 1996 DEFINE_TRACE(InspectorStyleSheetForInlineStyle) | 1994 DEFINE_TRACE(InspectorStyleSheetForInlineStyle) |
| 1997 { | 1995 { |
| 1998 visitor->trace(m_element); | 1996 visitor->trace(m_element); |
| 1999 visitor->trace(m_ruleSourceData); | 1997 visitor->trace(m_ruleSourceData); |
| 2000 visitor->trace(m_inspectorStyle); | 1998 visitor->trace(m_inspectorStyle); |
| 2001 InspectorStyleSheetBase::trace(visitor); | 1999 InspectorStyleSheetBase::trace(visitor); |
| 2002 } | 2000 } |
| 2003 | 2001 |
| 2004 } // namespace blink | 2002 } // namespace blink |
| OLD | NEW |