Commit 49035d32 authored by apavlov@chromium.org's avatar apavlov@chromium.org

2010-11-24 Alexander Pavlov <apavlov@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: Crash when inspecting http://alphaarnhem.nl/beta/
        https://bugs.webkit.org/show_bug.cgi?id=50025

        @font-face rules were improperly handled by source data extractor.

        WebCore:
        * css/CSSParser.cpp:
        (WebCore::CSSParser::CSSParser):
        (WebCore::CSSParser::parseDeclaration):
        (WebCore::CSSParser::createStyleRule):
        (WebCore::CSSParser::markRuleBodyStart):
        (WebCore::CSSParser::markPropertyStart):
        (WebCore::CSSParser::markPropertyEnd):
        * css/CSSParser.h:

        LayoutTests:
        * inspector/resources/styles-new-API-1.css:
        (@font-face):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72687 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 704d88ad
2010-11-24 Alexander Pavlov <apavlov@chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: Crash when inspecting http://alphaarnhem.nl/beta/
https://bugs.webkit.org/show_bug.cgi?id=50025
* inspector/resources/styles-new-API-1.css:
(@font-face):
2010-11-24 Cris Neckar <cdn@chromium.org>
Reviewed by Adam Barth.
......@@ -9,6 +9,13 @@
#absent-id {
}
@font-face {
font-family: 'TheFont';
src: url('font.url');
font-weight: normal;
font-style: normal;
}
body {
property: imported-media-screen-stylesheet;
}
......
2010-11-24 Alexander Pavlov <apavlov@chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: Crash when inspecting http://alphaarnhem.nl/beta/
https://bugs.webkit.org/show_bug.cgi?id=50025
@font-face rules were improperly handled by source data extractor.
* css/CSSParser.cpp:
(WebCore::CSSParser::CSSParser):
(WebCore::CSSParser::parseDeclaration):
(WebCore::CSSParser::createStyleRule):
(WebCore::CSSParser::markRuleBodyStart):
(WebCore::CSSParser::markPropertyStart):
(WebCore::CSSParser::markPropertyEnd):
* css/CSSParser.h:
2010-11-24 Cris Neckar <cdn@chromium.org>
Reviewed by Adam Barth.
......@@ -141,6 +141,7 @@ CSSParser::CSSParser(bool strictParsing)
, m_hasFontFaceOnlyValues(false)
, m_hadSyntacticallyValidCSSRule(false)
, m_defaultNamespace(starAtom)
, m_inStyleRuleOrDeclaration(false)
, m_selectorListRange(0, 0)
, m_ruleBodyRange(0, 0)
, m_propertyRange(UINT_MAX, UINT_MAX)
......@@ -341,6 +342,7 @@ bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const
if (styleSourceData) {
m_currentRuleData = CSSRuleSourceData::create();
m_currentRuleData->styleSourceData = CSSStyleSourceData::create();
m_inStyleRuleOrDeclaration = true;
}
setupParser("@-webkit-decls{", string, "} ");
......@@ -368,6 +370,7 @@ bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const
if (styleSourceData) {
*styleSourceData = m_currentRuleData->styleSourceData.release();
m_currentRuleData = 0;
m_inStyleRuleOrDeclaration = false;
}
return ok;
}
......@@ -5474,6 +5477,7 @@ CSSRule* CSSParser::createStyleRule(Vector<CSSSelector*>* selectors)
m_ruleRangeMap->set(result, m_currentRuleData.release());
m_currentRuleData = CSSRuleSourceData::create();
m_currentRuleData->styleSourceData = CSSStyleSourceData::create();
m_inStyleRuleOrDeclaration = false;
}
}
resetSelectorListMarks();
......@@ -5627,6 +5631,7 @@ void CSSParser::markRuleBodyStart()
++offset; // Skip the rule body opening brace.
if (offset > m_ruleBodyRange.start)
m_ruleBodyRange.start = offset;
m_inStyleRuleOrDeclaration = true;
}
void CSSParser::markRuleBodyEnd()
......@@ -5638,11 +5643,15 @@ void CSSParser::markRuleBodyEnd()
void CSSParser::markPropertyStart()
{
if (!m_inStyleRuleOrDeclaration)
return;
m_propertyRange.start = yytext - m_data;
}
void CSSParser::markPropertyEnd(bool isImportantFound, bool isPropertyParsed)
{
if (!m_inStyleRuleOrDeclaration)
return;
unsigned offset = yytext - m_data;
if (*yytext == ';') // Include semicolon into the property text.
++offset;
......
......@@ -230,6 +230,7 @@ namespace WebCore {
AtomicString m_defaultNamespace;
// tokenizer methods and data
bool m_inStyleRuleOrDeclaration;
SourceRange m_selectorListRange;
SourceRange m_ruleBodyRange;
SourceRange m_propertyRange;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment