| Index: Source/core/inspector/InspectorStyleSheet.cpp
|
| diff --git a/Source/core/inspector/InspectorStyleSheet.cpp b/Source/core/inspector/InspectorStyleSheet.cpp
|
| index e67260ddfab34950f3320d49c81fd852ace089b6..00cb30ebc34bc422b3043193cef5793471ab365d 100644
|
| --- a/Source/core/inspector/InspectorStyleSheet.cpp
|
| +++ b/Source/core/inspector/InspectorStyleSheet.cpp
|
| @@ -547,13 +547,13 @@ PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> > Insp
|
| //
|
| // The propertyText (if not empty) is checked to be a valid style declaration (containing at least one property). If not,
|
| // the method returns false (denoting an error).
|
| -bool InspectorStyle::setPropertyText(unsigned index, const String& propertyText, bool overwrite, String* oldText, ExceptionState& es)
|
| +bool InspectorStyle::setPropertyText(unsigned index, const String& propertyText, bool overwrite, String* oldText, ExceptionState& exceptionState)
|
| {
|
| ASSERT(m_parentStyleSheet);
|
| DEFINE_STATIC_LOCAL(String, bogusPropertyName, ("-webkit-boguz-propertee"));
|
|
|
| if (!m_parentStyleSheet->ensureParsedDataReady()) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return false;
|
| }
|
|
|
| @@ -568,27 +568,27 @@ bool InspectorStyle::setPropertyText(unsigned index, const String& propertyText,
|
|
|
| // At least one property + the bogus property added just above should be present.
|
| if (propertyCount < 2) {
|
| - es.throwUninformativeAndGenericDOMException(SyntaxError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
|
| return false;
|
| }
|
|
|
| // Check for the proper propertyText termination (the parser could at least restore to the PROPERTY_NAME state).
|
| if (propertyData.at(propertyCount - 1).name != bogusPropertyName) {
|
| - es.throwUninformativeAndGenericDOMException(SyntaxError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
|
| return false;
|
| }
|
| }
|
|
|
| RefPtr<CSSRuleSourceData> sourceData = extractSourceData();
|
| if (!sourceData) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return false;
|
| }
|
|
|
| String text;
|
| bool success = styleText(&text);
|
| if (!success) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return false;
|
| }
|
|
|
| @@ -598,7 +598,7 @@ bool InspectorStyle::setPropertyText(unsigned index, const String& propertyText,
|
| InspectorStyleTextEditor editor(&allProperties, text, newLineAndWhitespaceDelimiters());
|
| if (overwrite) {
|
| if (index >= allProperties.size()) {
|
| - es.throwUninformativeAndGenericDOMException(IndexSizeError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError);
|
| return false;
|
| }
|
| *oldText = allProperties.at(index).rawText;
|
| @@ -609,31 +609,31 @@ bool InspectorStyle::setPropertyText(unsigned index, const String& propertyText,
|
| return applyStyleText(editor.styleText());
|
| }
|
|
|
| -bool InspectorStyle::toggleProperty(unsigned index, bool disable, ExceptionState& es)
|
| +bool InspectorStyle::toggleProperty(unsigned index, bool disable, ExceptionState& exceptionState)
|
| {
|
| ASSERT(m_parentStyleSheet);
|
| if (!m_parentStyleSheet->ensureParsedDataReady()) {
|
| - es.throwUninformativeAndGenericDOMException(NoModificationAllowedError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NoModificationAllowedError);
|
| return false;
|
| }
|
|
|
| RefPtr<CSSRuleSourceData> sourceData = extractSourceData();
|
| if (!sourceData) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return false;
|
| }
|
|
|
| String text;
|
| bool success = styleText(&text);
|
| if (!success) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return false;
|
| }
|
|
|
| Vector<InspectorStyleProperty> allProperties;
|
| populateAllProperties(allProperties);
|
| if (index >= allProperties.size()) {
|
| - es.throwUninformativeAndGenericDOMException(IndexSizeError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError);
|
| return false;
|
| }
|
|
|
| @@ -1028,9 +1028,9 @@ void InspectorStyleSheet::reparseStyleSheet(const String& text)
|
| m_pageStyleSheet->ownerDocument()->styleResolverChanged(RecalcStyleImmediately, FullStyleUpdate);
|
| }
|
|
|
| -bool InspectorStyleSheet::setText(const String& text, ExceptionState& es)
|
| +bool InspectorStyleSheet::setText(const String& text, ExceptionState& exceptionState)
|
| {
|
| - if (!checkPageStyleSheet(es))
|
| + if (!checkPageStyleSheet(exceptionState))
|
| return false;
|
| if (!m_parsedStyleSheet)
|
| return false;
|
| @@ -1041,35 +1041,35 @@ bool InspectorStyleSheet::setText(const String& text, ExceptionState& es)
|
| return true;
|
| }
|
|
|
| -String InspectorStyleSheet::ruleSelector(const InspectorCSSId& id, ExceptionState& es)
|
| +String InspectorStyleSheet::ruleSelector(const InspectorCSSId& id, ExceptionState& exceptionState)
|
| {
|
| CSSStyleRule* rule = ruleForId(id);
|
| if (!rule) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return "";
|
| }
|
| return rule->selectorText();
|
| }
|
|
|
| -bool InspectorStyleSheet::setRuleSelector(const InspectorCSSId& id, const String& selector, ExceptionState& es)
|
| +bool InspectorStyleSheet::setRuleSelector(const InspectorCSSId& id, const String& selector, ExceptionState& exceptionState)
|
| {
|
| - if (!checkPageStyleSheet(es))
|
| + if (!checkPageStyleSheet(exceptionState))
|
| return false;
|
| CSSStyleRule* rule = ruleForId(id);
|
| if (!rule) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return false;
|
| }
|
| CSSStyleSheet* styleSheet = rule->parentStyleSheet();
|
| if (!styleSheet || !ensureParsedDataReady()) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return false;
|
| }
|
|
|
| rule->setSelectorText(selector);
|
| RefPtr<CSSRuleSourceData> sourceData = ruleSourceDataFor(rule->style());
|
| if (!sourceData) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return false;
|
| }
|
|
|
| @@ -1087,26 +1087,26 @@ static bool checkStyleRuleSelector(Document* document, const String& selector)
|
| return selectorList.isValid();
|
| }
|
|
|
| -CSSStyleRule* InspectorStyleSheet::addRule(const String& selector, ExceptionState& es)
|
| +CSSStyleRule* InspectorStyleSheet::addRule(const String& selector, ExceptionState& exceptionState)
|
| {
|
| - if (!checkPageStyleSheet(es))
|
| + if (!checkPageStyleSheet(exceptionState))
|
| return 0;
|
| if (!checkStyleRuleSelector(m_pageStyleSheet->ownerDocument(), selector)) {
|
| - es.throwUninformativeAndGenericDOMException(SyntaxError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
|
| return 0;
|
| }
|
|
|
| String text;
|
| bool success = getText(&text);
|
| if (!success) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return 0;
|
| }
|
| StringBuilder styleSheetText;
|
| styleSheetText.append(text);
|
|
|
| - m_pageStyleSheet->addRule(selector, "", es);
|
| - if (es.hadException())
|
| + m_pageStyleSheet->addRule(selector, "", exceptionState);
|
| + if (exceptionState.hadException())
|
| return 0;
|
| ASSERT(m_pageStyleSheet->length());
|
| unsigned lastRuleIndex = m_pageStyleSheet->length() - 1;
|
| @@ -1118,7 +1118,7 @@ CSSStyleRule* InspectorStyleSheet::addRule(const String& selector, ExceptionStat
|
| // What we just added has to be a CSSStyleRule - we cannot handle other types of rules yet.
|
| // If it is not a style rule, pretend we never touched the stylesheet.
|
| m_pageStyleSheet->deleteRule(lastRuleIndex, ASSERT_NO_EXCEPTION);
|
| - es.throwUninformativeAndGenericDOMException(SyntaxError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
|
| return 0;
|
| }
|
|
|
| @@ -1135,31 +1135,31 @@ CSSStyleRule* InspectorStyleSheet::addRule(const String& selector, ExceptionStat
|
| return styleRule;
|
| }
|
|
|
| -bool InspectorStyleSheet::deleteRule(const InspectorCSSId& id, ExceptionState& es)
|
| +bool InspectorStyleSheet::deleteRule(const InspectorCSSId& id, ExceptionState& exceptionState)
|
| {
|
| - if (!checkPageStyleSheet(es))
|
| + if (!checkPageStyleSheet(exceptionState))
|
| return false;
|
| RefPtr<CSSStyleRule> rule = ruleForId(id);
|
| if (!rule) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return false;
|
| }
|
| CSSStyleSheet* styleSheet = rule->parentStyleSheet();
|
| if (!styleSheet || !ensureParsedDataReady()) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return false;
|
| }
|
|
|
| RefPtr<CSSRuleSourceData> sourceData = ruleSourceDataFor(rule->style());
|
| if (!sourceData) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return false;
|
| }
|
|
|
| - styleSheet->deleteRule(id.ordinal(), es);
|
| + styleSheet->deleteRule(id.ordinal(), exceptionState);
|
| // |rule| MAY NOT be addressed after this line!
|
|
|
| - if (es.hadException())
|
| + if (exceptionState.hadException())
|
| return false;
|
|
|
| String sheetText = m_parsedStyleSheet->text();
|
| @@ -1329,17 +1329,17 @@ PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyleSheet::buildObjectForStyle(
|
| return result.release();
|
| }
|
|
|
| -bool InspectorStyleSheet::setStyleText(const InspectorCSSId& id, const String& text, String* oldText, ExceptionState& es)
|
| +bool InspectorStyleSheet::setStyleText(const InspectorCSSId& id, const String& text, String* oldText, ExceptionState& exceptionState)
|
| {
|
| RefPtr<InspectorStyle> inspectorStyle = inspectorStyleForId(id);
|
| if (!inspectorStyle || !inspectorStyle->cssStyle()) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return false;
|
| }
|
|
|
| bool success = inspectorStyle->styleText(oldText);
|
| if (!success) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return false;
|
| }
|
|
|
| @@ -1347,33 +1347,33 @@ bool InspectorStyleSheet::setStyleText(const InspectorCSSId& id, const String& t
|
| if (success)
|
| fireStyleSheetChanged();
|
| else
|
| - es.throwUninformativeAndGenericDOMException(SyntaxError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
|
| return success;
|
| }
|
|
|
| -bool InspectorStyleSheet::setPropertyText(const InspectorCSSId& id, unsigned propertyIndex, const String& text, bool overwrite, String* oldText, ExceptionState& es)
|
| +bool InspectorStyleSheet::setPropertyText(const InspectorCSSId& id, unsigned propertyIndex, const String& text, bool overwrite, String* oldText, ExceptionState& exceptionState)
|
| {
|
| RefPtr<InspectorStyle> inspectorStyle = inspectorStyleForId(id);
|
| if (!inspectorStyle) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return false;
|
| }
|
|
|
| - bool success = inspectorStyle->setPropertyText(propertyIndex, text, overwrite, oldText, es);
|
| + bool success = inspectorStyle->setPropertyText(propertyIndex, text, overwrite, oldText, exceptionState);
|
| if (success)
|
| fireStyleSheetChanged();
|
| return success;
|
| }
|
|
|
| -bool InspectorStyleSheet::toggleProperty(const InspectorCSSId& id, unsigned propertyIndex, bool disable, ExceptionState& es)
|
| +bool InspectorStyleSheet::toggleProperty(const InspectorCSSId& id, unsigned propertyIndex, bool disable, ExceptionState& exceptionState)
|
| {
|
| RefPtr<InspectorStyle> inspectorStyle = inspectorStyleForId(id);
|
| if (!inspectorStyle) {
|
| - es.throwUninformativeAndGenericDOMException(NotFoundError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotFoundError);
|
| return false;
|
| }
|
|
|
| - bool success = inspectorStyle->toggleProperty(propertyIndex, disable, es);
|
| + bool success = inspectorStyle->toggleProperty(propertyIndex, disable, exceptionState);
|
| if (success)
|
| fireStyleSheetChanged();
|
| return success;
|
| @@ -1540,10 +1540,10 @@ unsigned InspectorStyleSheet::ruleIndexByRule(const CSSRule* rule) const
|
| return index == kNotFound ? UINT_MAX : static_cast<unsigned>(index);
|
| }
|
|
|
| -bool InspectorStyleSheet::checkPageStyleSheet(ExceptionState& es) const
|
| +bool InspectorStyleSheet::checkPageStyleSheet(ExceptionState& exceptionState) const
|
| {
|
| if (!m_pageStyleSheet) {
|
| - es.throwUninformativeAndGenericDOMException(NotSupportedError);
|
| + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError);
|
| return false;
|
| }
|
| return true;
|
| @@ -1609,12 +1609,12 @@ bool InspectorStyleSheet::setStyleText(CSSStyleDeclaration* style, const String&
|
| if (id.isEmpty())
|
| return false;
|
|
|
| - TrackExceptionState es;
|
| - style->setCSSText(text, es);
|
| - if (!es.hadException())
|
| + TrackExceptionState exceptionState;
|
| + style->setCSSText(text, exceptionState);
|
| + if (!exceptionState.hadException())
|
| m_parsedStyleSheet->setText(patchedStyleSheetText);
|
|
|
| - return !es.hadException();
|
| + return !exceptionState.hadException();
|
| }
|
|
|
| bool InspectorStyleSheet::styleSheetTextWithChangedStyle(CSSStyleDeclaration* style, const String& newStyleText, String* result)
|
| @@ -1735,17 +1735,17 @@ bool InspectorStyleSheetForInlineStyle::getText(String* result) const
|
| bool InspectorStyleSheetForInlineStyle::setStyleText(CSSStyleDeclaration* style, const String& text)
|
| {
|
| ASSERT_UNUSED(style, style == inlineStyle());
|
| - TrackExceptionState es;
|
| + TrackExceptionState exceptionState;
|
|
|
| {
|
| InspectorCSSAgent::InlineStyleOverrideScope overrideScope(m_element->ownerDocument());
|
| - m_element->setAttribute("style", text, es);
|
| + m_element->setAttribute("style", text, exceptionState);
|
| }
|
|
|
| m_styleText = text;
|
| m_isStyleTextValid = true;
|
| m_ruleSourceData.clear();
|
| - return !es.hadException();
|
| + return !exceptionState.hadException();
|
| }
|
|
|
| PassOwnPtr<Vector<unsigned> > InspectorStyleSheetForInlineStyle::lineEndings() const
|
|
|