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

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: fix testcase 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 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 } 1645 }
1646 1646
1647 void InspectorStyleSheetForInlineStyle::didModifyElementAttribute() 1647 void InspectorStyleSheetForInlineStyle::didModifyElementAttribute()
1648 { 1648 {
1649 m_isStyleTextValid = false; 1649 m_isStyleTextValid = false;
1650 if (m_element->isStyledElement() && m_element->style() != m_inspectorStyle-> cssStyle()) 1650 if (m_element->isStyledElement() && m_element->style() != m_inspectorStyle-> cssStyle())
1651 m_inspectorStyle = InspectorStyle::create(InspectorCSSId(id(), 0), inlin eStyle(), this); 1651 m_inspectorStyle = InspectorStyle::create(InspectorCSSId(id(), 0), inlin eStyle(), this);
1652 m_ruleSourceData.clear(); 1652 m_ruleSourceData.clear();
1653 } 1653 }
1654 1654
1655 void InspectorStyleSheetForInlineStyle::reparseStyleSheet(const String& text)
1656 {
1657 fireStyleSheetChanged();
1658 }
1659
1660 bool InspectorStyleSheetForInlineStyle::setText(const String& text, ExceptionSta te& exceptionState)
1661 {
1662 bool success = setStyleText(inlineStyle(), text);
1663 if (!success) {
1664 exceptionState.throwDOMException(SyntaxError, "Style sheet text is inval id.");
1665 return false;
apavlov 2014/02/12 11:52:32 Collapse both returns into return success;
lushnikov 2014/02/12 12:21:23 Done.
1666 }
1667 return true;
1668 }
1669
1655 bool InspectorStyleSheetForInlineStyle::getText(String* result) const 1670 bool InspectorStyleSheetForInlineStyle::getText(String* result) const
1656 { 1671 {
1657 if (!m_isStyleTextValid) { 1672 if (!m_isStyleTextValid) {
1658 m_styleText = elementStyleText(); 1673 m_styleText = elementStyleText();
1659 m_isStyleTextValid = true; 1674 m_isStyleTextValid = true;
1660 } 1675 }
1661 *result = m_styleText; 1676 *result = m_styleText;
1662 return true; 1677 return true;
1663 } 1678 }
1664 1679
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 1757
1743 RefPtr<MutableStylePropertySet> tempDeclaration = MutableStylePropertySet::c reate(); 1758 RefPtr<MutableStylePropertySet> tempDeclaration = MutableStylePropertySet::c reate();
1744 RuleSourceDataList ruleSourceDataResult; 1759 RuleSourceDataList ruleSourceDataResult;
1745 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do cument().elementSheet()->contents(), &ruleSourceDataResult); 1760 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do cument().elementSheet()->contents(), &ruleSourceDataResult);
1746 createCSSParser(&m_element->document())->parseDeclaration(tempDeclaration.ge t(), m_styleText, &handler, m_element->document().elementSheet()->contents()); 1761 createCSSParser(&m_element->document())->parseDeclaration(tempDeclaration.ge t(), m_styleText, &handler, m_element->document().elementSheet()->contents());
1747 return ruleSourceDataResult.first().release(); 1762 return ruleSourceDataResult.first().release();
1748 } 1763 }
1749 1764
1750 } // namespace WebCore 1765 } // namespace WebCore
1751 1766
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