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

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

Issue 132803013: DevTools: [CSS] setStyleSheetText to work with inline stylesheets. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address @apavlov comments Created 6 years, 10 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
« no previous file with comments | « Source/core/inspector/InspectorStyleSheet.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 } 1644 }
1645 1645
1646 void InspectorStyleSheetForInlineStyle::didModifyElementAttribute() 1646 void InspectorStyleSheetForInlineStyle::didModifyElementAttribute()
1647 { 1647 {
1648 m_isStyleTextValid = false; 1648 m_isStyleTextValid = false;
1649 if (m_element->isStyledElement() && m_element->style() != m_inspectorStyle-> cssStyle()) 1649 if (m_element->isStyledElement() && m_element->style() != m_inspectorStyle-> cssStyle())
1650 m_inspectorStyle = InspectorStyle::create(InspectorCSSId(id(), 0), inlin eStyle(), this); 1650 m_inspectorStyle = InspectorStyle::create(InspectorCSSId(id(), 0), inlin eStyle(), this);
1651 m_ruleSourceData.clear(); 1651 m_ruleSourceData.clear();
1652 } 1652 }
1653 1653
1654 void InspectorStyleSheetForInlineStyle::reparseStyleSheet(const String& text)
1655 {
1656 fireStyleSheetChanged();
1657 }
1658
1659 bool InspectorStyleSheetForInlineStyle::setText(const String& text, ExceptionSta te& exceptionState)
1660 {
1661 bool success = setStyleText(inlineStyle(), text);
1662 if (!success)
1663 exceptionState.throwDOMException(SyntaxError, "Style sheet text is inval id.");
1664 return success;
1665 }
1666
1654 bool InspectorStyleSheetForInlineStyle::getText(String* result) const 1667 bool InspectorStyleSheetForInlineStyle::getText(String* result) const
1655 { 1668 {
1656 if (!m_isStyleTextValid) { 1669 if (!m_isStyleTextValid) {
1657 m_styleText = elementStyleText(); 1670 m_styleText = elementStyleText();
1658 m_isStyleTextValid = true; 1671 m_isStyleTextValid = true;
1659 } 1672 }
1660 *result = m_styleText; 1673 *result = m_styleText;
1661 return true; 1674 return true;
1662 } 1675 }
1663 1676
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 1754
1742 RefPtr<MutableStylePropertySet> tempDeclaration = MutableStylePropertySet::c reate(); 1755 RefPtr<MutableStylePropertySet> tempDeclaration = MutableStylePropertySet::c reate();
1743 RuleSourceDataList ruleSourceDataResult; 1756 RuleSourceDataList ruleSourceDataResult;
1744 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do cument().elementSheet()->contents(), &ruleSourceDataResult); 1757 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do cument().elementSheet()->contents(), &ruleSourceDataResult);
1745 createCSSParser(&m_element->document())->parseDeclaration(tempDeclaration.ge t(), m_styleText, &handler, m_element->document().elementSheet()->contents()); 1758 createCSSParser(&m_element->document())->parseDeclaration(tempDeclaration.ge t(), m_styleText, &handler, m_element->document().elementSheet()->contents());
1746 return ruleSourceDataResult.first().release(); 1759 return ruleSourceDataResult.first().release();
1747 } 1760 }
1748 1761
1749 } // namespace WebCore 1762 } // namespace WebCore
1750 1763
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorStyleSheet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698