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

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

Issue 308963002: Minimize calls to Node::nodeType() as it is virtual (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix typo Created 6 years, 6 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 | Annotate | Revision Log
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 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 return false; 1524 return false;
1525 1525
1526 bool base64Encoded; 1526 bool base64Encoded;
1527 bool success = m_resourceAgent->fetchResourceContent(ownerDocument()->frame( ), KURL(ParsedURLString, m_pageStyleSheet->href()), result, &base64Encoded) && ! base64Encoded; 1527 bool success = m_resourceAgent->fetchResourceContent(ownerDocument()->frame( ), KURL(ParsedURLString, m_pageStyleSheet->href()), result, &base64Encoded) && ! base64Encoded;
1528 return success; 1528 return success;
1529 } 1529 }
1530 1530
1531 bool InspectorStyleSheet::inlineStyleSheetText(String* result) const 1531 bool InspectorStyleSheet::inlineStyleSheetText(String* result) const
1532 { 1532 {
1533 Node* ownerNode = m_pageStyleSheet->ownerNode(); 1533 Node* ownerNode = m_pageStyleSheet->ownerNode();
1534 if (!ownerNode || ownerNode->nodeType() != Node::ELEMENT_NODE) 1534 if (!ownerNode || !ownerNode->isElementNode())
1535 return false; 1535 return false;
1536 Element& ownerElement = toElement(*ownerNode); 1536 Element& ownerElement = toElement(*ownerNode);
1537 1537
1538 if (!isHTMLStyleElement(ownerElement) && !isSVGStyleElement(ownerElement)) 1538 if (!isHTMLStyleElement(ownerElement) && !isSVGStyleElement(ownerElement))
1539 return false; 1539 return false;
1540 *result = ownerElement.textContent(); 1540 *result = ownerElement.textContent();
1541 return true; 1541 return true;
1542 } 1542 }
1543 1543
1544 PassRefPtr<InspectorStyleSheetForInlineStyle> InspectorStyleSheetForInlineStyle: :create(const String& id, PassRefPtr<Element> element, Listener* listener) 1544 PassRefPtr<InspectorStyleSheetForInlineStyle> InspectorStyleSheetForInlineStyle: :create(const String& id, PassRefPtr<Element> element, Listener* listener)
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 1665
1666 RefPtrWillBeRawPtr<MutableStylePropertySet> tempDeclaration = MutableStylePr opertySet::create(); 1666 RefPtrWillBeRawPtr<MutableStylePropertySet> tempDeclaration = MutableStylePr opertySet::create();
1667 RuleSourceDataList ruleSourceDataResult; 1667 RuleSourceDataList ruleSourceDataResult;
1668 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do cument().elementSheet().contents(), &ruleSourceDataResult); 1668 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do cument().elementSheet().contents(), &ruleSourceDataResult);
1669 BisonCSSParser(parserContextForDocument(&m_element->document())).parseDeclar ation(tempDeclaration.get(), m_styleText, &handler, m_element->document().elemen tSheet().contents()); 1669 BisonCSSParser(parserContextForDocument(&m_element->document())).parseDeclar ation(tempDeclaration.get(), m_styleText, &handler, m_element->document().elemen tSheet().contents());
1670 return ruleSourceDataResult.first().release(); 1670 return ruleSourceDataResult.first().release();
1671 } 1671 }
1672 1672
1673 } // namespace WebCore 1673 } // namespace WebCore
1674 1674
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698