[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e
yurys at chromium.org
yurys at chromium.org
Fri Jan 21 14:41:16 UTC 2011
The following commit has been merged in the debian/experimental branch:
commit 418f91fdc608bbd5667f20faacc4058b476e27ad
Author: yurys at chromium.org <yurys at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Dec 24 17:51:25 2010 +0000
2010-12-24 Yury Semikhatsky <yurys at chromium.org>
Reviewed by Darin Adler.
inspector/debugger-step-out.html crashing intermittently in the bots
https://bugs.webkit.org/show_bug.cgi?id=50868
Use RefPtr rather instead of raw pointers when keeping references
to refcounted objects.
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::getStylesForNode2):
(WebCore::InspectorCSSAgent::getComputedStyleForNode2):
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyle::create):
(WebCore::InspectorStyle::InspectorStyle):
(WebCore::InspectorStyle::buildObjectForStyle):
(WebCore::InspectorStyle::setPropertyText):
(WebCore::InspectorStyle::toggleProperty):
(WebCore::InspectorStyle::styleText):
(WebCore::InspectorStyle::populateAllProperties):
(WebCore::InspectorStyle::replacePropertyInStyleText):
(WebCore::InspectorStyleSheet::create):
(WebCore::InspectorStyleSheet::InspectorStyleSheet):
(WebCore::InspectorStyleSheetForInlineStyle::create):
(WebCore::InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle):
(WebCore::InspectorStyleSheetForInlineStyle::getStyleAttributeRanges):
* inspector/InspectorStyleSheet.h:
(WebCore::InspectorStyle::cssStyle):
(WebCore::InspectorStyleSheet::pageStyleSheet):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74637 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c317d2e..39a9bb7 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,34 @@
+2010-12-24 Yury Semikhatsky <yurys at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ inspector/debugger-step-out.html crashing intermittently in the bots
+ https://bugs.webkit.org/show_bug.cgi?id=50868
+
+ Use RefPtr rather instead of raw pointers when keeping references
+ to refcounted objects.
+
+ * inspector/InspectorCSSAgent.cpp:
+ (WebCore::InspectorCSSAgent::getStylesForNode2):
+ (WebCore::InspectorCSSAgent::getComputedStyleForNode2):
+ * inspector/InspectorStyleSheet.cpp:
+ (WebCore::InspectorStyle::create):
+ (WebCore::InspectorStyle::InspectorStyle):
+ (WebCore::InspectorStyle::buildObjectForStyle):
+ (WebCore::InspectorStyle::setPropertyText):
+ (WebCore::InspectorStyle::toggleProperty):
+ (WebCore::InspectorStyle::styleText):
+ (WebCore::InspectorStyle::populateAllProperties):
+ (WebCore::InspectorStyle::replacePropertyInStyleText):
+ (WebCore::InspectorStyleSheet::create):
+ (WebCore::InspectorStyleSheet::InspectorStyleSheet):
+ (WebCore::InspectorStyleSheetForInlineStyle::create):
+ (WebCore::InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle):
+ (WebCore::InspectorStyleSheetForInlineStyle::getStyleAttributeRanges):
+ * inspector/InspectorStyleSheet.h:
+ (WebCore::InspectorStyle::cssStyle):
+ (WebCore::InspectorStyleSheet::pageStyleSheet):
+
2010-12-24 Justin Schuh <jschuh at chromium.org>
Reviewed by Nikolas Zimmermann.
diff --git a/WebCore/inspector/InspectorCSSAgent.cpp b/WebCore/inspector/InspectorCSSAgent.cpp
index 67980f8..725a26d 100644
--- a/WebCore/inspector/InspectorCSSAgent.cpp
+++ b/WebCore/inspector/InspectorCSSAgent.cpp
@@ -186,7 +186,7 @@ void InspectorCSSAgent::getStylesForNode2(long nodeId, RefPtr<InspectorValue>* r
resultObject->setObject("inlineStyle", styleSheet->buildObjectForStyle(element->style()));
RefPtr<CSSComputedStyleDeclaration> computedStyleInfo = computedStyle(element, true); // Support the viewing of :visited information in computed style.
- RefPtr<InspectorStyle> computedInspectorStyle = InspectorStyle::create(InspectorCSSId(), computedStyleInfo.get(), 0);
+ RefPtr<InspectorStyle> computedInspectorStyle = InspectorStyle::create(InspectorCSSId(), computedStyleInfo, 0);
resultObject->setObject("computedStyle", computedInspectorStyle->buildObjectForStyle());
CSSStyleSelector* selector = element->ownerDocument()->styleSelector();
@@ -248,7 +248,7 @@ void InspectorCSSAgent::getComputedStyleForNode2(long nodeId, RefPtr<InspectorVa
return;
RefPtr<CSSComputedStyleDeclaration> computedStyleInfo = computedStyle(element, true);
- RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), computedStyleInfo.get(), 0);
+ RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), computedStyleInfo, 0);
*style = inspectorStyle->buildObjectForStyle();
}
diff --git a/WebCore/inspector/InspectorStyleSheet.cpp b/WebCore/inspector/InspectorStyleSheet.cpp
index f575a52..61907a3 100644
--- a/WebCore/inspector/InspectorStyleSheet.cpp
+++ b/WebCore/inspector/InspectorStyleSheet.cpp
@@ -131,6 +131,19 @@ static PassRefPtr<CSSRuleList> asCSSRuleList(StyleBase* styleBase)
return 0;
}
+PassRefPtr<InspectorStyle> InspectorStyle::create(const InspectorCSSId& styleId, PassRefPtr<CSSStyleDeclaration> style, InspectorStyleSheet* parentStyleSheet)
+{
+ return adoptRef(new InspectorStyle(styleId, style, parentStyleSheet));
+}
+
+InspectorStyle::InspectorStyle(const InspectorCSSId& styleId, PassRefPtr<CSSStyleDeclaration> style, InspectorStyleSheet* parentStyleSheet)
+ : m_styleId(styleId)
+ , m_style(style)
+ , m_parentStyleSheet(parentStyleSheet)
+{
+ ASSERT(m_style);
+}
+
PassRefPtr<InspectorObject> InspectorStyle::buildObjectForStyle() const
{
RefPtr<InspectorObject> result = InspectorObject::create();
@@ -141,7 +154,7 @@ PassRefPtr<InspectorObject> InspectorStyle::buildObjectForStyle() const
propertiesObject->setString("width", m_style->getPropertyValue("width"));
propertiesObject->setString("height", m_style->getPropertyValue("height"));
- RefPtr<CSSRuleSourceData> sourceData = m_parentStyleSheet ? m_parentStyleSheet->ruleSourceDataFor(m_style) : 0;
+ RefPtr<CSSRuleSourceData> sourceData = m_parentStyleSheet ? m_parentStyleSheet->ruleSourceDataFor(m_style.get()) : 0;
if (sourceData) {
propertiesObject->setNumber("startOffset", sourceData->styleSourceData->styleBodyRange.start);
propertiesObject->setNumber("endOffset", sourceData->styleSourceData->styleBodyRange.end);
@@ -217,7 +230,7 @@ bool InspectorStyle::setPropertyText(unsigned index, const String& propertyText,
}
} else {
// Insert at index.
- RefPtr<CSSRuleSourceData> sourceData = m_parentStyleSheet->ruleSourceDataFor(m_style);
+ RefPtr<CSSRuleSourceData> sourceData = m_parentStyleSheet->ruleSourceDataFor(m_style.get());
if (!sourceData)
return false;
String text;
@@ -257,7 +270,7 @@ bool InspectorStyle::setPropertyText(unsigned index, const String& propertyText,
}
text.insert(textToSet, propertyStart);
- m_parentStyleSheet->setStyleText(m_style, text);
+ m_parentStyleSheet->setStyleText(m_style.get(), text);
}
// Recompute subsequent disabled property ranges if acting on a non-disabled property.
@@ -271,7 +284,7 @@ bool InspectorStyle::toggleProperty(unsigned index, bool disable)
ASSERT(m_parentStyleSheet);
if (!m_parentStyleSheet->ensureParsedDataReady())
return false; // Can toggle only source-based properties.
- RefPtr<CSSRuleSourceData> sourceData = m_parentStyleSheet->ruleSourceDataFor(m_style);
+ RefPtr<CSSRuleSourceData> sourceData = m_parentStyleSheet->ruleSourceDataFor(m_style.get());
if (!sourceData)
return false; // No source data for the style.
@@ -312,7 +325,7 @@ unsigned InspectorStyle::disabledIndexByOrdinal(unsigned ordinal, bool canUseSub
bool InspectorStyle::styleText(String* result) const
{
// Precondition: m_parentStyleSheet->ensureParsedDataReady() has been called successfully.
- RefPtr<CSSRuleSourceData> sourceData = m_parentStyleSheet->ruleSourceDataFor(m_style);
+ RefPtr<CSSRuleSourceData> sourceData = m_parentStyleSheet->ruleSourceDataFor(m_style.get());
if (!sourceData)
return false;
@@ -381,7 +394,7 @@ bool InspectorStyle::populateAllProperties(Vector<InspectorStyleProperty>* resul
if (disabledIndex < disabledLength)
disabledProperty = m_disabledProperties.at(disabledIndex);
- RefPtr<CSSRuleSourceData> sourceData = (m_parentStyleSheet && m_parentStyleSheet->ensureParsedDataReady()) ? m_parentStyleSheet->ruleSourceDataFor(m_style) : 0;
+ RefPtr<CSSRuleSourceData> sourceData = (m_parentStyleSheet && m_parentStyleSheet->ensureParsedDataReady()) ? m_parentStyleSheet->ruleSourceDataFor(m_style.get()) : 0;
Vector<CSSPropertySourceData>* sourcePropertyData = sourceData ? &(sourceData->styleSourceData->propertyData) : 0;
if (sourcePropertyData) {
String styleDeclaration;
@@ -508,7 +521,7 @@ bool InspectorStyle::replacePropertyInStyleText(const InspectorStyleProperty& pr
return false;
const SourceRange& range = property.sourceData.range;
text.replace(range.start, range.end - range.start, newText);
- success = m_parentStyleSheet->setStyleText(m_style, text);
+ success = m_parentStyleSheet->setStyleText(m_style.get(), text);
return success;
}
@@ -563,7 +576,12 @@ Vector<String> InspectorStyle::longhandProperties(const String& shorthandPropert
return properties;
}
-InspectorStyleSheet::InspectorStyleSheet(const String& id, CSSStyleSheet* pageStyleSheet, const String& origin, const String& documentURL)
+PassRefPtr<InspectorStyleSheet> InspectorStyleSheet::create(const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, const String& origin, const String& documentURL)
+{
+ return adoptRef(new InspectorStyleSheet(id, pageStyleSheet, origin, documentURL));
+}
+
+InspectorStyleSheet::InspectorStyleSheet(const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, const String& origin, const String& documentURL)
: m_id(id)
, m_pageStyleSheet(pageStyleSheet)
, m_origin(origin)
@@ -1092,12 +1110,17 @@ void InspectorStyleSheet::collectFlatRules(PassRefPtr<CSSRuleList> ruleList, Vec
}
}
-InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle(const String& id, Element* element, const String& origin)
+PassRefPtr<InspectorStyleSheetForInlineStyle> InspectorStyleSheetForInlineStyle::create(const String& id, PassRefPtr<Element> element, const String& origin)
+{
+ return adoptRef(new InspectorStyleSheetForInlineStyle(id, element, origin));
+}
+
+InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle(const String& id, PassRefPtr<Element> element, const String& origin)
: InspectorStyleSheet(id, 0, origin, "")
, m_element(element)
, m_ruleSourceData(0)
{
- ASSERT(element);
+ ASSERT(m_element);
m_inspectorStyle = InspectorStyle::create(InspectorCSSId(id, 0), inlineStyle(), this);
m_styleText = m_element->isStyledElement() ? m_element->getAttribute("style").string() : String();
}
diff --git a/WebCore/inspector/InspectorStyleSheet.h b/WebCore/inspector/InspectorStyleSheet.h
index ec266cd..9d5c842 100644
--- a/WebCore/inspector/InspectorStyleSheet.h
+++ b/WebCore/inspector/InspectorStyleSheet.h
@@ -121,26 +121,17 @@ struct InspectorStyleProperty {
class InspectorStyle : public RefCounted<InspectorStyle> {
public:
- static PassRefPtr<InspectorStyle> create(const InspectorCSSId& styleId, CSSStyleDeclaration* style, InspectorStyleSheet* parentStyleSheet)
- {
- return adoptRef(new InspectorStyle(styleId, style, parentStyleSheet));
- }
-
- InspectorStyle(const InspectorCSSId& styleId, CSSStyleDeclaration* style, InspectorStyleSheet* parentStyleSheet)
- : m_styleId(styleId)
- , m_style(style)
- , m_parentStyleSheet(parentStyleSheet)
- {
- ASSERT(style);
- }
+ static PassRefPtr<InspectorStyle> create(const InspectorCSSId& styleId, PassRefPtr<CSSStyleDeclaration> style, InspectorStyleSheet* parentStyleSheet);
- CSSStyleDeclaration* cssStyle() const { return m_style; }
+ CSSStyleDeclaration* cssStyle() const { return m_style.get(); }
PassRefPtr<InspectorObject> buildObjectForStyle() const;
bool hasDisabledProperties() const { return !m_disabledProperties.isEmpty(); }
bool setPropertyText(unsigned index, const String& text, bool overwrite);
bool toggleProperty(unsigned index, bool disable);
private:
+ InspectorStyle(const InspectorCSSId& styleId, PassRefPtr<CSSStyleDeclaration> style, InspectorStyleSheet* parentStyleSheet);
+
static unsigned disabledIndexByOrdinal(unsigned ordinal, bool canUseSubsequent, Vector<InspectorStyleProperty>& allProperties);
bool styleText(String* result) const;
@@ -155,7 +146,7 @@ private:
Vector<String> longhandProperties(const String& shorthandProperty) const;
InspectorCSSId m_styleId;
- CSSStyleDeclaration* m_style;
+ RefPtr<CSSStyleDeclaration> m_style;
InspectorStyleSheet* m_parentStyleSheet;
Vector<InspectorStyleProperty> m_disabledProperties;
};
@@ -163,17 +154,13 @@ private:
class InspectorStyleSheet : public RefCounted<InspectorStyleSheet> {
public:
typedef HashMap<CSSStyleDeclaration*, RefPtr<InspectorStyle> > InspectorStyleMap;
- static PassRefPtr<InspectorStyleSheet> create(const String& id, CSSStyleSheet* pageStyleSheet, const String& origin, const String& documentURL)
- {
- return adoptRef(new InspectorStyleSheet(id, pageStyleSheet, origin, documentURL));
- }
+ static PassRefPtr<InspectorStyleSheet> create(const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, const String& origin, const String& documentURL);
- InspectorStyleSheet(const String& id, CSSStyleSheet* pageStyleSheet, const String& origin, const String& documentURL);
virtual ~InspectorStyleSheet();
String id() const { return m_id; }
String finalURL() const;
- CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet; }
+ CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); }
void reparseStyleSheet(const String&);
bool setText(const String&);
bool setRuleSelector(const InspectorCSSId&, const String& selector);
@@ -189,6 +176,8 @@ public:
virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const;
protected:
+ InspectorStyleSheet(const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, const String& origin, const String& documentURL);
+
bool canBind() const { return m_origin != "userAgent" && m_origin != "user"; }
InspectorCSSId ruleOrStyleId(CSSStyleDeclaration* style) const;
virtual Document* ownerDocument() const;
@@ -218,7 +207,7 @@ private:
PassRefPtr<InspectorArray> buildArrayForRuleList(CSSRuleList*);
String m_id;
- CSSStyleSheet* m_pageStyleSheet;
+ RefPtr<CSSStyleSheet> m_pageStyleSheet;
String m_origin;
String m_documentURL;
bool m_isRevalidating;
@@ -231,17 +220,15 @@ private:
class InspectorStyleSheetForInlineStyle : public InspectorStyleSheet {
public:
- static PassRefPtr<InspectorStyleSheetForInlineStyle> create(const String& id, Element* element, const String& origin)
- {
- return adoptRef(new InspectorStyleSheetForInlineStyle(id, element, origin));
- }
+ static PassRefPtr<InspectorStyleSheetForInlineStyle> create(const String& id, PassRefPtr<Element> element, const String& origin);
- InspectorStyleSheetForInlineStyle(const String& id, Element* element, const String& origin);
void didModifyElementAttribute();
virtual bool text(String* result) const;
virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const { ASSERT_UNUSED(id, !id.ordinal()); return inlineStyle(); }
protected:
+ InspectorStyleSheetForInlineStyle(const String& id, PassRefPtr<Element> element, const String& origin);
+
virtual Document* ownerDocument() const;
virtual RefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration* style) const { ASSERT_UNUSED(style, style == inlineStyle()); return m_ruleSourceData; }
virtual unsigned ruleIndexByStyle(CSSStyleDeclaration*) const { return 0; }
@@ -257,7 +244,7 @@ private:
CSSStyleDeclaration* inlineStyle() const;
bool getStyleAttributeRanges(RefPtr<CSSStyleSourceData>* result);
- Element* m_element;
+ RefPtr<Element> m_element;
RefPtr<CSSRuleSourceData> m_ruleSourceData;
RefPtr<InspectorStyle> m_inspectorStyle;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list