[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
apavlov at chromium.org
apavlov at chromium.org
Wed Dec 22 14:18:06 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 141a6c4c24d5527ae8b8868b39f890471451a997
Author: apavlov at chromium.org <apavlov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Oct 6 15:43:55 2010 +0000
2010-10-06 Alexander Pavlov <apavlov at chromium.org>
Reviewed by Pavel Feldman.
CSSParser: Enable rule selector source range extraction.
API modification followed by clients.
https://bugs.webkit.org/show_bug.cgi?id=46367
Some code removal suggested by Darin Adler.
* css/CSSGrammar.y:
* css/CSSParser.cpp:
(WebCore::CSSParser::CSSParser):
(WebCore::CSSParser::parseSheet):
(WebCore::CSSParser::parseDeclaration):
(WebCore::CSSParser::createStyleRule):
(WebCore::CSSParser::markSelectorListStart):
(WebCore::CSSParser::markSelectorListEnd):
(WebCore::CSSParser::markRuleBodyStart):
(WebCore::CSSParser::markRuleBodyEnd):
(WebCore::CSSParser::markPropertyStart):
(WebCore::CSSParser::markPropertyEnd):
* css/CSSParser.h:
(WebCore::CSSParser::resetSelectorListMarks):
(WebCore::CSSParser::resetRuleBodyMarks):
(WebCore::CSSParser::resetPropertyMarks):
* css/CSSPropertySourceData.cpp:
* css/CSSPropertySourceData.h:
(WebCore::CSSRuleSourceData::create):
* inspector/InspectorCSSStore.cpp:
(WebCore::InspectorCSSStore::getRuleSourceData):
(WebCore::InspectorCSSStore::extractRanges):
(WebCore::InspectorCSSStore::getStyleAttributeRanges):
* inspector/InspectorCSSStore.h:
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::getStyleSourceData):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index bc2eb14..14fcc32 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,40 @@
+2010-10-06 Alexander Pavlov <apavlov at chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ CSSParser: Enable rule selector source range extraction.
+ API modification followed by clients.
+ https://bugs.webkit.org/show_bug.cgi?id=46367
+
+ Some code removal suggested by Darin Adler.
+
+ * css/CSSGrammar.y:
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::CSSParser):
+ (WebCore::CSSParser::parseSheet):
+ (WebCore::CSSParser::parseDeclaration):
+ (WebCore::CSSParser::createStyleRule):
+ (WebCore::CSSParser::markSelectorListStart):
+ (WebCore::CSSParser::markSelectorListEnd):
+ (WebCore::CSSParser::markRuleBodyStart):
+ (WebCore::CSSParser::markRuleBodyEnd):
+ (WebCore::CSSParser::markPropertyStart):
+ (WebCore::CSSParser::markPropertyEnd):
+ * css/CSSParser.h:
+ (WebCore::CSSParser::resetSelectorListMarks):
+ (WebCore::CSSParser::resetRuleBodyMarks):
+ (WebCore::CSSParser::resetPropertyMarks):
+ * css/CSSPropertySourceData.cpp:
+ * css/CSSPropertySourceData.h:
+ (WebCore::CSSRuleSourceData::create):
+ * inspector/InspectorCSSStore.cpp:
+ (WebCore::InspectorCSSStore::getRuleSourceData):
+ (WebCore::InspectorCSSStore::extractRanges):
+ (WebCore::InspectorCSSStore::getStyleAttributeRanges):
+ * inspector/InspectorCSSStore.h:
+ * inspector/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::getStyleSourceData):
+
2010-10-06 Dirk Schulze <krit at webkit.org>
Added reviewer to commit r69187.
diff --git a/WebCore/css/CSSGrammar.y b/WebCore/css/CSSGrammar.y
index c55f998..c0139a2 100644
--- a/WebCore/css/CSSGrammar.y
+++ b/WebCore/css/CSSGrammar.y
@@ -408,7 +408,9 @@ rule_list:
;
valid_rule:
- ruleset
+ before_ruleset ruleset {
+ $$ = $2;
+ }
| media
| page
| font_face
@@ -910,8 +912,22 @@ maybe_space_before_declaration:
}
;
+before_ruleset:
+ /* empty */ {
+ CSSParser* p = static_cast<CSSParser*>(parser);
+ p->markSelectorListStart();
+ }
+ ;
+
+before_rule_opening_brace:
+ /* empty */ {
+ CSSParser* p = static_cast<CSSParser*>(parser);
+ p->markSelectorListEnd();
+ }
+ ;
+
ruleset:
- selector_list '{' maybe_space_before_declaration declaration_list closing_brace {
+ selector_list before_rule_opening_brace '{' maybe_space_before_declaration declaration_list closing_brace {
CSSParser* p = static_cast<CSSParser*>(parser);
$$ = p->createStyleRule($1);
}
diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
index 21811ff..eb4109e 100644
--- a/WebCore/css/CSSParser.cpp
+++ b/WebCore/css/CSSParser.cpp
@@ -144,12 +144,11 @@ CSSParser::CSSParser(bool strictParsing)
, m_hasFontFaceOnlyValues(false)
, m_hadSyntacticallyValidCSSRule(false)
, m_defaultNamespace(starAtom)
- , m_ruleBodyStartOffset(0)
- , m_ruleBodyEndOffset(0)
- , m_propertyStartOffset(UINT_MAX)
- , m_propertyEndOffset(UINT_MAX)
+ , m_selectorListRange(0, 0)
+ , m_ruleBodyRange(0, 0)
+ , m_propertyRange(UINT_MAX, UINT_MAX)
, m_ruleRangeMap(0)
- , m_currentStyleData(0)
+ , m_currentRuleData(0)
, m_data(0)
, yy_start(1)
, m_lineNumber(0)
@@ -229,14 +228,16 @@ void CSSParser::parseSheet(CSSStyleSheet* sheet, const String& string, int start
m_styleSheet = sheet;
m_defaultNamespace = starAtom; // Reset the default namespace.
m_ruleRangeMap = ruleRangeMap;
- if (ruleRangeMap)
- m_currentStyleData = CSSStyleSourceData::create();
+ if (ruleRangeMap) {
+ m_currentRuleData = CSSRuleSourceData::create();
+ m_currentRuleData->styleSourceData = CSSStyleSourceData::create();
+ }
m_lineNumber = startLineNumber;
setupParser("", string, "");
cssyyparse(this);
m_ruleRangeMap = 0;
- m_currentStyleData = 0;
+ m_currentRuleData = 0;
m_rule = 0;
}
@@ -333,14 +334,17 @@ void CSSParser::parseSelector(const String& string, Document* doc, CSSSelectorLi
m_selectorListForParseSelector = 0;
}
-bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const String& string, CSSStyleSourceData* styleSourceData)
+bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const String& string, RefPtr<CSSStyleSourceData>* styleSourceData)
{
// Length of the "@-webkit-decls{" prefix.
static const unsigned prefixLength = 15;
ASSERT(!declaration->stylesheet() || declaration->stylesheet()->isCSSStyleSheet());
m_styleSheet = static_cast<CSSStyleSheet*>(declaration->stylesheet());
- m_currentStyleData = styleSourceData;
+ if (styleSourceData) {
+ m_currentRuleData = CSSRuleSourceData::create();
+ m_currentRuleData->styleSourceData = CSSStyleSourceData::create();
+ }
setupParser("@-webkit-decls{", string, "} ");
cssyyparse(this);
@@ -355,17 +359,19 @@ bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const
clearProperties();
}
- if (m_currentStyleData) {
- m_currentStyleData->styleBodyRange.start = 0;
- m_currentStyleData->styleBodyRange.end = string.length();
- for (Vector<CSSPropertySourceData>::iterator it = m_currentStyleData->propertyData.begin(); it != m_currentStyleData->propertyData.end(); ++it) {
+ if (m_currentRuleData) {
+ m_currentRuleData->styleSourceData->styleBodyRange.start = 0;
+ m_currentRuleData->styleSourceData->styleBodyRange.end = string.length();
+ for (Vector<CSSPropertySourceData>::iterator it = m_currentRuleData->styleSourceData->propertyData.begin(), endIt = m_currentRuleData->styleSourceData->propertyData.end(); it != endIt; ++it) {
(*it).range.start -= prefixLength;
(*it).range.end -= prefixLength;
}
}
- if (!m_ruleRangeMap)
- m_currentStyleData = 0;
+ if (styleSourceData) {
+ *styleSourceData = m_currentRuleData->styleSourceData.release();
+ m_currentRuleData = 0;
+ }
return ok;
}
@@ -5479,12 +5485,15 @@ CSSRule* CSSParser::createStyleRule(Vector<CSSSelector*>* selectors)
result = rule.get();
m_parsedStyleObjects.append(rule.release());
if (m_ruleRangeMap) {
- ASSERT(m_currentStyleData);
- m_currentStyleData->styleBodyRange = SourceRange(m_ruleBodyStartOffset, m_ruleBodyEndOffset);
- m_ruleRangeMap->set(result, m_currentStyleData.release());
- m_currentStyleData = CSSStyleSourceData::create();
+ ASSERT(m_currentRuleData);
+ m_currentRuleData->styleSourceData->styleBodyRange = m_ruleBodyRange;
+ m_currentRuleData->selectorListRange = m_selectorListRange;
+ m_ruleRangeMap->set(result, m_currentRuleData.release());
+ m_currentRuleData = CSSRuleSourceData::create();
+ m_currentRuleData->styleSourceData = CSSStyleSourceData::create();
}
}
+ resetSelectorListMarks();
resetRuleBodyMarks();
clearProperties();
return result;
@@ -5733,26 +5742,44 @@ void CSSParser::updateLastSelectorLineAndPosition()
markRuleBodyStart();
}
+void CSSParser::markSelectorListStart()
+{
+ m_selectorListRange.start = yytext - m_data;
+}
+
+void CSSParser::markSelectorListEnd()
+{
+ if (!m_currentRuleData)
+ return;
+ UChar* listEnd = yytext;
+ while (listEnd > m_data + 1) {
+ if (isHTMLSpace(*(listEnd - 1)))
+ --listEnd;
+ else
+ break;
+ }
+ m_selectorListRange.end = listEnd - m_data;
+}
+
void CSSParser::markRuleBodyStart()
{
unsigned offset = yytext - m_data;
if (*yytext == '{')
++offset; // Skip the rule body opening brace.
- if (offset > m_ruleBodyStartOffset)
- m_ruleBodyStartOffset = offset;
+ if (offset > m_ruleBodyRange.start)
+ m_ruleBodyRange.start = offset;
}
void CSSParser::markRuleBodyEnd()
{
unsigned offset = yytext - m_data;
- if (offset > m_ruleBodyEndOffset)
- m_ruleBodyEndOffset = offset;
+ if (offset > m_ruleBodyRange.end)
+ m_ruleBodyRange.end = offset;
}
void CSSParser::markPropertyStart()
{
- unsigned offset = yytext - m_data;
- m_propertyStartOffset = offset;
+ m_propertyRange.start = yytext - m_data;
}
void CSSParser::markPropertyEnd(bool isImportantFound, bool isPropertyParsed)
@@ -5760,11 +5787,11 @@ void CSSParser::markPropertyEnd(bool isImportantFound, bool isPropertyParsed)
unsigned offset = yytext - m_data;
if (*yytext == ';') // Include semicolon into the property text.
++offset;
- m_propertyEndOffset = offset;
- if (m_propertyStartOffset != UINT_MAX && m_currentStyleData) {
+ m_propertyRange.end = offset;
+ if (m_propertyRange.start != UINT_MAX && m_currentRuleData) {
// This stuff is only executed when the style data retrieval is requested by client.
- const unsigned start = m_propertyStartOffset;
- const unsigned end = m_propertyEndOffset;
+ const unsigned start = m_propertyRange.start;
+ const unsigned end = m_propertyRange.end;
ASSERT(start < end);
String propertyString = String(m_data + start, end - start).stripWhiteSpace();
if (propertyString.endsWith(";", true))
@@ -5776,8 +5803,8 @@ void CSSParser::markPropertyEnd(bool isImportantFound, bool isPropertyParsed)
String name = propertyString.left(colonIndex).stripWhiteSpace();
String value = propertyString.substring(colonIndex + 1, propertyString.length()).stripWhiteSpace();
// The property range is relative to the declaration start offset.
- m_currentStyleData->propertyData.append(
- CSSPropertySourceData(name, value, isImportantFound, isPropertyParsed, SourceRange(m_propertyStartOffset - m_ruleBodyStartOffset, m_propertyEndOffset - m_ruleBodyStartOffset)));
+ m_currentRuleData->styleSourceData->propertyData.append(
+ CSSPropertySourceData(name, value, isImportantFound, isPropertyParsed, SourceRange(start - m_ruleBodyRange.start, end - m_ruleBodyRange.start)));
}
resetPropertyMarks();
}
diff --git a/WebCore/css/CSSParser.h b/WebCore/css/CSSParser.h
index f8b24df..8f3c6dd 100644
--- a/WebCore/css/CSSParser.h
+++ b/WebCore/css/CSSParser.h
@@ -65,7 +65,7 @@ namespace WebCore {
bool parseValue(CSSMutableStyleDeclaration*, int propId, const String&, bool important);
static bool parseColor(RGBA32& color, const String&, bool strict = false);
bool parseColor(CSSMutableStyleDeclaration*, const String&);
- bool parseDeclaration(CSSMutableStyleDeclaration*, const String&, CSSStyleSourceData* styleSourceData = 0);
+ bool parseDeclaration(CSSMutableStyleDeclaration*, const String&, RefPtr<CSSStyleSourceData>* styleSourceData = 0);
bool parseMediaQuery(MediaList*, const String&);
Document* document() const;
@@ -241,18 +241,20 @@ namespace WebCore {
AtomicString m_defaultNamespace;
// tokenizer methods and data
- unsigned m_ruleBodyStartOffset;
- unsigned m_ruleBodyEndOffset;
- unsigned m_propertyStartOffset;
- unsigned m_propertyEndOffset;
+ SourceRange m_selectorListRange;
+ SourceRange m_ruleBodyRange;
+ SourceRange m_propertyRange;
StyleRuleRangeMap* m_ruleRangeMap;
- RefPtr<CSSStyleSourceData> m_currentStyleData;
+ RefPtr<CSSRuleSourceData> m_currentRuleData;
+ void markSelectorListStart();
+ void markSelectorListEnd();
void markRuleBodyStart();
void markRuleBodyEnd();
void markPropertyStart();
void markPropertyEnd(bool isImportantFound, bool isPropertyParsed);
- void resetRuleBodyMarks() { m_ruleBodyStartOffset = m_ruleBodyEndOffset = 0; }
- void resetPropertyMarks() { m_propertyStartOffset = m_propertyEndOffset = UINT_MAX; }
+ void resetSelectorListMarks() { m_selectorListRange.start = m_selectorListRange.end = 0; }
+ void resetRuleBodyMarks() { m_ruleBodyRange.start = m_ruleBodyRange.end = 0; }
+ void resetPropertyMarks() { m_propertyRange.start = m_propertyRange.end = UINT_MAX; }
int lex(void* yylval);
int token() { return yyTok; }
UChar* text(int* length);
diff --git a/WebCore/css/CSSPropertySourceData.cpp b/WebCore/css/CSSPropertySourceData.cpp
index 1628031..eb9c2c1 100644
--- a/WebCore/css/CSSPropertySourceData.cpp
+++ b/WebCore/css/CSSPropertySourceData.cpp
@@ -54,13 +54,6 @@ SourceRange::SourceRange(unsigned start, unsigned end)
{
}
-SourceRange& SourceRange::operator=(const SourceRange& other)
-{
- this->start = other.start;
- this->end = other.end;
- return *this;
-}
-
CSSPropertySourceData::CSSPropertySourceData(const String& name, const String& value, bool important, bool parsedOk, const SourceRange& range)
: name(name)
, value(value)
@@ -88,16 +81,6 @@ CSSPropertySourceData::CSSPropertySourceData()
{
}
-CSSPropertySourceData& CSSPropertySourceData::operator=(const CSSPropertySourceData& other)
-{
- name = other.name;
- value = other.value;
- important = other.important;
- parsedOk = other.parsedOk;
- range = other.range;
- return *this;
-}
-
String CSSPropertySourceData::toString() const
{
DEFINE_STATIC_LOCAL(String, emptyValue, ("e"));
diff --git a/WebCore/css/CSSPropertySourceData.h b/WebCore/css/CSSPropertySourceData.h
index beae9d0..db80d46 100644
--- a/WebCore/css/CSSPropertySourceData.h
+++ b/WebCore/css/CSSPropertySourceData.h
@@ -44,7 +44,6 @@ class CSSStyleRule;
struct SourceRange {
SourceRange();
SourceRange(unsigned start, unsigned end);
- SourceRange& operator=(const SourceRange& other);
unsigned start;
unsigned end;
@@ -56,9 +55,7 @@ struct CSSPropertySourceData {
CSSPropertySourceData(const String& name, const String& value, bool important, bool parsedOk, const SourceRange& range);
CSSPropertySourceData(const CSSPropertySourceData& other);
CSSPropertySourceData();
- ALWAYS_INLINE ~CSSPropertySourceData() { }
- CSSPropertySourceData& operator=(const CSSPropertySourceData& other);
String toString() const;
unsigned hash() const;
@@ -83,7 +80,18 @@ struct CSSStyleSourceData : public RefCounted<CSSStyleSourceData> {
SourceRange styleBodyRange;
Vector<CSSPropertySourceData> propertyData;
};
-typedef HashMap<CSSStyleRule*, RefPtr<CSSStyleSourceData> > StyleRuleRangeMap;
+
+struct CSSRuleSourceData : public RefCounted<CSSRuleSourceData> {
+ static PassRefPtr<CSSRuleSourceData> create()
+ {
+ return adoptRef(new CSSRuleSourceData());
+ }
+
+ // Range of the selector list in the enclosing source.
+ SourceRange selectorListRange;
+ RefPtr<CSSStyleSourceData> styleSourceData;
+};
+typedef HashMap<CSSStyleRule*, RefPtr<CSSRuleSourceData> > StyleRuleRangeMap;
} // namespace WebCore
diff --git a/WebCore/inspector/InspectorCSSStore.cpp b/WebCore/inspector/InspectorCSSStore.cpp
index b019860..e0b658f 100644
--- a/WebCore/inspector/InspectorCSSStore.cpp
+++ b/WebCore/inspector/InspectorCSSStore.cpp
@@ -158,7 +158,7 @@ String InspectorCSSStore::inlineStyleSheetText(CSSStyleSheet* styleSheet)
// All ranges are: [start; end) (start - inclusive, end - exclusive).
-bool InspectorCSSStore::getStyleSourceData(CSSStyleDeclaration* style, RefPtr<CSSStyleSourceData>* result)
+bool InspectorCSSStore::getRuleSourceData(CSSStyleDeclaration* style, RefPtr<CSSRuleSourceData>* result)
{
if (!style)
return false;
@@ -166,11 +166,13 @@ bool InspectorCSSStore::getStyleSourceData(CSSStyleDeclaration* style, RefPtr<CS
Element* element = inlineStyleElement(style);
if (element) {
// Inline: style="...".
+ RefPtr<CSSRuleSourceData> ruleSourceData = CSSRuleSourceData::create();
RefPtr<CSSStyleSourceData> styleSourceData = CSSStyleSourceData::create();
bool success = getStyleAttributeRanges(element, &styleSourceData);
if (!success)
return false;
- *result = styleSourceData;
+ ruleSourceData->styleSourceData = styleSourceData.release();
+ *result = ruleSourceData;
return true;
}
@@ -178,7 +180,7 @@ bool InspectorCSSStore::getStyleSourceData(CSSStyleDeclaration* style, RefPtr<CS
if (!styleSheet)
return false;
- Vector<RefPtr<CSSStyleSourceData> >* rangesVector = 0;
+ Vector<RefPtr<CSSRuleSourceData> >* rangesVector = 0;
StyleSheetToOffsetsMap::iterator it = m_styleSheetToOffsets.find(styleSheet);
if (it == m_styleSheetToOffsets.end()) {
String text = styleSheetText(bindStyleSheet(styleSheet));
@@ -187,7 +189,7 @@ bool InspectorCSSStore::getStyleSourceData(CSSStyleDeclaration* style, RefPtr<CS
CSSParser p;
StyleRuleRangeMap ruleRangeMap;
p.parseSheet(newStyleSheet.get(), text, 0, &ruleRangeMap);
- rangesVector = new Vector<RefPtr<CSSStyleSourceData> >;
+ rangesVector = new Vector<RefPtr<CSSRuleSourceData> >;
extractRanges(newStyleSheet.get(), ruleRangeMap, rangesVector);
m_styleSheetToOffsets.set(styleSheet, rangesVector);
}
@@ -211,7 +213,7 @@ bool InspectorCSSStore::getStyleSourceData(CSSStyleDeclaration* style, RefPtr<CS
return false;
}
-void InspectorCSSStore::extractRanges(CSSStyleSheet* styleSheet, const StyleRuleRangeMap& ruleRangeMap, Vector<RefPtr<CSSStyleSourceData> >* rangesVector)
+void InspectorCSSStore::extractRanges(CSSStyleSheet* styleSheet, const StyleRuleRangeMap& ruleRangeMap, Vector<RefPtr<CSSRuleSourceData> >* rangesVector)
{
for (unsigned i = 0, length = styleSheet->length(); i < length; ++i) {
CSSStyleRule* rule = asCSSStyleRule(styleSheet->item(i));
@@ -237,7 +239,7 @@ bool InspectorCSSStore::getStyleAttributeRanges(Node* node, RefPtr<CSSStyleSourc
RefPtr<CSSMutableStyleDeclaration> tempDeclaration = CSSMutableStyleDeclaration::create();
CSSParser p;
- p.parseDeclaration(tempDeclaration.get(), styleText, result->get());
+ p.parseDeclaration(tempDeclaration.get(), styleText, result);
return true;
}
diff --git a/WebCore/inspector/InspectorCSSStore.h b/WebCore/inspector/InspectorCSSStore.h
index 9b329df..25a9d15 100644
--- a/WebCore/inspector/InspectorCSSStore.h
+++ b/WebCore/inspector/InspectorCSSStore.h
@@ -55,7 +55,7 @@ typedef HashMap<CSSStyleDeclaration*, long> StyleToIdMap;
typedef HashMap<long, RefPtr<CSSStyleDeclaration> > IdToStyleMap;
typedef HashMap<CSSStyleRule*, long> RuleToIdMap;
typedef HashMap<long, RefPtr<CSSStyleRule> > IdToRuleMap;
-typedef HashMap<CSSStyleSheet*, Vector<RefPtr<CSSStyleSourceData> >* > StyleSheetToOffsetsMap;
+typedef HashMap<CSSStyleSheet*, Vector<RefPtr<CSSRuleSourceData> >* > StyleSheetToOffsetsMap;
typedef HashMap<CSSStyleSheet*, long> StyleSheetToIdMap;
typedef HashMap<long, RefPtr<CSSStyleSheet> > IdToStyleSheetMap;
typedef HashMap<long, String> IdToStyleSheetTextMap;
@@ -71,7 +71,7 @@ public:
InspectorCSSStore(InspectorController* inspectorController);
~InspectorCSSStore();
void reset();
- bool getStyleSourceData(CSSStyleDeclaration*, RefPtr<CSSStyleSourceData>* result);
+ bool getRuleSourceData(CSSStyleDeclaration*, RefPtr<CSSRuleSourceData>* result);
CSSStyleDeclaration* styleForId(long styleId);
CSSStyleSheet* styleSheetForId(long styleSheetId);
CSSStyleRule* ruleForId(long styleRuleId);
@@ -88,7 +88,7 @@ private:
static CSSStyleRule* asCSSStyleRule(StyleBase*);
String inlineStyleSheetText(CSSStyleSheet*);
bool resourceStyleSheetText(CSSStyleSheet*, String* result);
- void extractRanges(CSSStyleSheet*, const StyleRuleRangeMap&, Vector<RefPtr<CSSStyleSourceData> >* rangesVector);
+ void extractRanges(CSSStyleSheet*, const StyleRuleRangeMap&, Vector<RefPtr<CSSRuleSourceData> >* rangesVector);
bool getStyleAttributeRanges(Node* parentNode, RefPtr<CSSStyleSourceData>* result);
StyleToIdMap m_styleToId;
diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp
index c1c21b6..2316f04 100644
--- a/WebCore/inspector/InspectorDOMAgent.cpp
+++ b/WebCore/inspector/InspectorDOMAgent.cpp
@@ -1223,18 +1223,25 @@ void InspectorDOMAgent::getStyleSourceData(long styleId, RefPtr<InspectorObject>
CSSStyleDeclaration* style = cssStore()->styleForId(styleId);
if (!style)
return;
- RefPtr<CSSStyleSourceData> sourceData = CSSStyleSourceData::create();
- bool success = cssStore()->getStyleSourceData(style, &sourceData);
+ RefPtr<CSSRuleSourceData> sourceData = CSSRuleSourceData::create();
+ bool success = cssStore()->getRuleSourceData(style, &sourceData);
if (!success)
return;
RefPtr<InspectorObject> result = InspectorObject::create();
+
RefPtr<InspectorObject> bodyRange = InspectorObject::create();
result->setObject("bodyRange", bodyRange);
- bodyRange->setNumber("start", sourceData->styleBodyRange.start);
- bodyRange->setNumber("end", sourceData->styleBodyRange.end);
+ bodyRange->setNumber("start", sourceData->styleSourceData->styleBodyRange.start);
+ bodyRange->setNumber("end", sourceData->styleSourceData->styleBodyRange.end);
+
+ RefPtr<InspectorObject> selectorRange = InspectorObject::create();
+ result->setObject("selectorRange", selectorRange);
+ selectorRange->setNumber("start", sourceData->selectorListRange.start);
+ selectorRange->setNumber("end", sourceData->selectorListRange.end);
+
RefPtr<InspectorArray> propertyRanges = InspectorArray::create();
result->setArray("propertyData", propertyRanges);
- Vector<CSSPropertySourceData>& propertyData = sourceData->propertyData;
+ Vector<CSSPropertySourceData>& propertyData = sourceData->styleSourceData->propertyData;
for (Vector<CSSPropertySourceData>::iterator it = propertyData.begin(); it != propertyData.end(); ++it) {
RefPtr<InspectorObject> propertyRange = InspectorObject::create();
propertyRange->setString("name", it->name);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list