Chromium Code Reviews| 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 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1550 text.replace(bodyStart, bodyEnd - bodyStart, newStyleText); | 1550 text.replace(bodyStart, bodyEnd - bodyStart, newStyleText); |
| 1551 *result = text; | 1551 *result = text; |
| 1552 return true; | 1552 return true; |
| 1553 } | 1553 } |
| 1554 | 1554 |
| 1555 InspectorCSSId InspectorStyleSheet::ruleId(CSSStyleRule* rule) const | 1555 InspectorCSSId InspectorStyleSheet::ruleId(CSSStyleRule* rule) const |
| 1556 { | 1556 { |
| 1557 return ruleOrStyleId(rule->style()); | 1557 return ruleOrStyleId(rule->style()); |
| 1558 } | 1558 } |
| 1559 | 1559 |
| 1560 bool InspectorStyleSheet::lineNumberAndColumnToOffset(unsigned lineNumber, unsig ned columnNumber, unsigned* offset) const | |
| 1561 { | |
| 1562 OwnPtr<Vector<unsigned> > endings = lineEndings(); | |
| 1563 if (lineNumber >= endings->size()) | |
| 1564 return false; | |
| 1565 TextPosition position(OrdinalNumber::fromZeroBasedInt(lineNumber), OrdinalNu mber::fromZeroBasedInt(columnNumber)); | |
| 1566 *offset = position.toOffsetPosition(*endings).zeroBasedInt(); | |
|
apavlov
2014/02/21 14:37:55
This should check for columnNumber-is-beyond-last-
lushnikov
2014/02/23 16:07:07
Added check that columnNumber is beyond the amount
| |
| 1567 return true; | |
| 1568 } | |
| 1569 | |
| 1560 void InspectorStyleSheet::revalidateStyle(CSSStyleDeclaration* pageStyle) | 1570 void InspectorStyleSheet::revalidateStyle(CSSStyleDeclaration* pageStyle) |
| 1561 { | 1571 { |
| 1562 if (m_isRevalidating) | 1572 if (m_isRevalidating) |
| 1563 return; | 1573 return; |
| 1564 | 1574 |
| 1565 m_isRevalidating = true; | 1575 m_isRevalidating = true; |
| 1566 ensureFlatRules(); | 1576 ensureFlatRules(); |
| 1567 for (unsigned i = 0, size = m_flatRules.size(); i < size; ++i) { | 1577 for (unsigned i = 0, size = m_flatRules.size(); i < size; ++i) { |
| 1568 CSSStyleRule* parsedRule = InspectorCSSAgent::asCSSStyleRule(m_flatRules .at(i).get()); | 1578 CSSStyleRule* parsedRule = InspectorCSSAgent::asCSSStyleRule(m_flatRules .at(i).get()); |
| 1569 if (parsedRule && parsedRule->style() == pageStyle) { | 1579 if (parsedRule && parsedRule->style() == pageStyle) { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1739 | 1749 |
| 1740 RefPtr<MutableStylePropertySet> tempDeclaration = MutableStylePropertySet::c reate(); | 1750 RefPtr<MutableStylePropertySet> tempDeclaration = MutableStylePropertySet::c reate(); |
| 1741 RuleSourceDataList ruleSourceDataResult; | 1751 RuleSourceDataList ruleSourceDataResult; |
| 1742 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do cument().elementSheet()->contents(), &ruleSourceDataResult); | 1752 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do cument().elementSheet()->contents(), &ruleSourceDataResult); |
| 1743 createCSSParser(&m_element->document())->parseDeclaration(tempDeclaration.ge t(), m_styleText, &handler, m_element->document().elementSheet()->contents()); | 1753 createCSSParser(&m_element->document())->parseDeclaration(tempDeclaration.ge t(), m_styleText, &handler, m_element->document().elementSheet()->contents()); |
| 1744 return ruleSourceDataResult.first().release(); | 1754 return ruleSourceDataResult.first().release(); |
| 1745 } | 1755 } |
| 1746 | 1756 |
| 1747 } // namespace WebCore | 1757 } // namespace WebCore |
| 1748 | 1758 |
| OLD | NEW |