| 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 |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y | 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y |
| 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N | 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N |
| 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #include "config.h" | 25 #include "config.h" |
| 26 #include "core/inspector/InspectorStyleSheet.h" | 26 #include "core/inspector/InspectorStyleSheet.h" |
| 27 | 27 |
| 28 #include "CSSPropertyNames.h" | 28 #include "CSSPropertyNames.h" |
| 29 #include "HTMLNames.h" | |
| 30 #include "SVGNames.h" | |
| 31 #include "bindings/v8/ExceptionState.h" | 29 #include "bindings/v8/ExceptionState.h" |
| 32 #include "bindings/v8/ExceptionStatePlaceholder.h" | 30 #include "bindings/v8/ExceptionStatePlaceholder.h" |
| 33 #include "bindings/v8/ScriptRegexp.h" | 31 #include "bindings/v8/ScriptRegexp.h" |
| 34 #include "core/css/CSSKeyframesRule.h" | 32 #include "core/css/CSSKeyframesRule.h" |
| 35 #include "core/css/CSSMediaRule.h" | 33 #include "core/css/CSSMediaRule.h" |
| 36 #include "core/css/parser/BisonCSSParser.h" | 34 #include "core/css/parser/BisonCSSParser.h" |
| 37 #include "core/css/CSSRuleList.h" | 35 #include "core/css/CSSRuleList.h" |
| 38 #include "core/css/CSSStyleRule.h" | 36 #include "core/css/CSSStyleRule.h" |
| 39 #include "core/css/CSSStyleSheet.h" | 37 #include "core/css/CSSStyleSheet.h" |
| 40 #include "core/css/CSSSupportsRule.h" | 38 #include "core/css/CSSSupportsRule.h" |
| 41 #include "core/css/StylePropertySet.h" | 39 #include "core/css/StylePropertySet.h" |
| 42 #include "core/css/StyleRule.h" | 40 #include "core/css/StyleRule.h" |
| 43 #include "core/css/StyleSheetContents.h" | 41 #include "core/css/StyleSheetContents.h" |
| 44 #include "core/dom/Document.h" | 42 #include "core/dom/Document.h" |
| 45 #include "core/dom/Element.h" | 43 #include "core/dom/Element.h" |
| 46 #include "core/frame/PageConsole.h" | 44 #include "core/frame/PageConsole.h" |
| 45 #include "core/html/HTMLStyleElement.h" |
| 47 #include "core/html/parser/HTMLParserIdioms.h" | 46 #include "core/html/parser/HTMLParserIdioms.h" |
| 48 #include "core/inspector/ContentSearchUtils.h" | 47 #include "core/inspector/ContentSearchUtils.h" |
| 49 #include "core/inspector/InspectorCSSAgent.h" | 48 #include "core/inspector/InspectorCSSAgent.h" |
| 50 #include "core/inspector/InspectorPageAgent.h" | 49 #include "core/inspector/InspectorPageAgent.h" |
| 51 #include "core/inspector/InspectorResourceAgent.h" | 50 #include "core/inspector/InspectorResourceAgent.h" |
| 51 #include "core/svg/SVGStyleElement.h" |
| 52 #include "wtf/OwnPtr.h" | 52 #include "wtf/OwnPtr.h" |
| 53 #include "wtf/PassOwnPtr.h" | 53 #include "wtf/PassOwnPtr.h" |
| 54 #include "wtf/text/StringBuilder.h" | 54 #include "wtf/text/StringBuilder.h" |
| 55 #include "wtf/text/TextPosition.h" | 55 #include "wtf/text/TextPosition.h" |
| 56 | 56 |
| 57 using WebCore::TypeBuilder::Array; | 57 using WebCore::TypeBuilder::Array; |
| 58 using WebCore::RuleSourceDataList; | 58 using WebCore::RuleSourceDataList; |
| 59 using WebCore::CSSRuleSourceData; | 59 using WebCore::CSSRuleSourceData; |
| 60 using WebCore::CSSStyleSheet; | 60 using WebCore::CSSStyleSheet; |
| 61 | 61 |
| (...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 } | 1508 } |
| 1509 | 1509 |
| 1510 bool InspectorStyleSheet::inlineStyleSheetText(String* result) const | 1510 bool InspectorStyleSheet::inlineStyleSheetText(String* result) const |
| 1511 { | 1511 { |
| 1512 if (!m_pageStyleSheet) | 1512 if (!m_pageStyleSheet) |
| 1513 return false; | 1513 return false; |
| 1514 | 1514 |
| 1515 Node* ownerNode = m_pageStyleSheet->ownerNode(); | 1515 Node* ownerNode = m_pageStyleSheet->ownerNode(); |
| 1516 if (!ownerNode || ownerNode->nodeType() != Node::ELEMENT_NODE) | 1516 if (!ownerNode || ownerNode->nodeType() != Node::ELEMENT_NODE) |
| 1517 return false; | 1517 return false; |
| 1518 Element* ownerElement = toElement(ownerNode); | 1518 Element& ownerElement = toElement(*ownerNode); |
| 1519 | 1519 |
| 1520 if (!ownerElement->hasTagName(HTMLNames::styleTag) && !ownerElement->hasTagN
ame(SVGNames::styleTag)) | 1520 if (!isHTMLStyleElement(ownerElement) && !isSVGStyleElement(ownerElement)) |
| 1521 return false; | 1521 return false; |
| 1522 *result = ownerElement->textContent(); | 1522 *result = ownerElement.textContent(); |
| 1523 return true; | 1523 return true; |
| 1524 } | 1524 } |
| 1525 | 1525 |
| 1526 PassRefPtr<InspectorStyleSheetForInlineStyle> InspectorStyleSheetForInlineStyle:
:create(InspectorPageAgent* pageAgent, InspectorResourceAgent* resourceAgent, co
nst String& id, PassRefPtr<Element> element, TypeBuilder::CSS::StyleSheetOrigin:
:Enum origin, Listener* listener) | 1526 PassRefPtr<InspectorStyleSheetForInlineStyle> InspectorStyleSheetForInlineStyle:
:create(InspectorPageAgent* pageAgent, InspectorResourceAgent* resourceAgent, co
nst String& id, PassRefPtr<Element> element, TypeBuilder::CSS::StyleSheetOrigin:
:Enum origin, Listener* listener) |
| 1527 { | 1527 { |
| 1528 return adoptRef(new InspectorStyleSheetForInlineStyle(pageAgent, resourceAge
nt, id, element, origin, listener)); | 1528 return adoptRef(new InspectorStyleSheetForInlineStyle(pageAgent, resourceAge
nt, id, element, origin, listener)); |
| 1529 } | 1529 } |
| 1530 | 1530 |
| 1531 InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle(InspectorPa
geAgent* pageAgent, InspectorResourceAgent* resourceAgent, const String& id, Pas
sRefPtr<Element> element, TypeBuilder::CSS::StyleSheetOrigin::Enum origin, Liste
ner* listener) | 1531 InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle(InspectorPa
geAgent* pageAgent, InspectorResourceAgent* resourceAgent, const String& id, Pas
sRefPtr<Element> element, TypeBuilder::CSS::StyleSheetOrigin::Enum origin, Liste
ner* listener) |
| 1532 : InspectorStyleSheet(pageAgent, resourceAgent, id, nullptr, origin, "", lis
tener) | 1532 : InspectorStyleSheet(pageAgent, resourceAgent, id, nullptr, origin, "", lis
tener) |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 | 1650 |
| 1651 RefPtr<MutableStylePropertySet> tempDeclaration = MutableStylePropertySet::c
reate(); | 1651 RefPtr<MutableStylePropertySet> tempDeclaration = MutableStylePropertySet::c
reate(); |
| 1652 RuleSourceDataList ruleSourceDataResult; | 1652 RuleSourceDataList ruleSourceDataResult; |
| 1653 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do
cument().elementSheet().contents(), &ruleSourceDataResult); | 1653 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do
cument().elementSheet().contents(), &ruleSourceDataResult); |
| 1654 createCSSParser(&m_element->document())->parseDeclaration(tempDeclaration.ge
t(), m_styleText, &handler, m_element->document().elementSheet().contents()); | 1654 createCSSParser(&m_element->document())->parseDeclaration(tempDeclaration.ge
t(), m_styleText, &handler, m_element->document().elementSheet().contents()); |
| 1655 return ruleSourceDataResult.first().release(); | 1655 return ruleSourceDataResult.first().release(); |
| 1656 } | 1656 } |
| 1657 | 1657 |
| 1658 } // namespace WebCore | 1658 } // namespace WebCore |
| 1659 | 1659 |
| OLD | NEW |