WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-50868-20101224172841.patch (text/plain), 15.30 KB, created by
Yury Semikhatsky
on 2010-12-24 06:28:45 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yury Semikhatsky
Created:
2010-12-24 06:28:45 PST
Size:
15.30 KB
patch
obsolete
>diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog >index b8b514f580df4ec3355b2120ee44b27a9484497f..7579a6b61e1dbd144bd953e9a748b36b52dc61bd 100644 >--- a/WebCore/ChangeLog >+++ b/WebCore/ChangeLog >@@ -1,3 +1,34 @@ >+2010-12-24 Yury Semikhatsky <yurys@chromium.org> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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 Noel Gordon <noel.gordon@gmail.com> > > Reviewed by Andreas Kling. >diff --git a/WebCore/inspector/InspectorCSSAgent.cpp b/WebCore/inspector/InspectorCSSAgent.cpp >index 31d951a28e9fad5ba7c8c75386c9bfc1fa6bf123..ee06e54bede9dad916f2405909d9f5682e48069b 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 6e3ebe82fb72873240793d6cdcd87863db8ad2f6..bc8052753ec28999538f78105ea86784606649b7 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); > } > >@@ -1154,7 +1177,7 @@ bool InspectorStyleSheetForInlineStyle::getStyleAttributeRanges(RefPtr<CSSStyleS > if (!m_element->isStyledElement()) > return false; > >- String styleText = static_cast<StyledElement*>(m_element)->getAttribute(styleAttributeName); >+ String styleText = static_cast<StyledElement*>(m_element.get())->getAttribute(styleAttributeName); > if (styleText.isEmpty()) { > (*result)->styleBodyRange.start = 0; > (*result)->styleBodyRange.end = 0; >diff --git a/WebCore/inspector/InspectorStyleSheet.h b/WebCore/inspector/InspectorStyleSheet.h >index b649bedea3896da29c587c44d27c7205f566d083..a9e2cc752c7b1098674b857ae31b6b9c3d9c43e2 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,16 +220,14 @@ 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); > 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; } >@@ -256,7 +243,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; > };
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
darin
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 50868
:
77337
| 77413