Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: third_party/WebKit/Source/core/editing/EditingStyle.cpp

Issue 1855203002: Revert of Improve DEFINE_STATIC_LOCAL()'s handling of Blink GCed objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/EditingStyle.cpp
diff --git a/third_party/WebKit/Source/core/editing/EditingStyle.cpp b/third_party/WebKit/Source/core/editing/EditingStyle.cpp
index b189ce93cb5fcc17673ba44286b22b35a1c75084..d7489943d0f7f90c418129edbd1050c8a2c13b28 100644
--- a/third_party/WebKit/Source/core/editing/EditingStyle.cpp
+++ b/third_party/WebKit/Source/core/editing/EditingStyle.cpp
@@ -57,7 +57,6 @@
#include "core/layout/LayoutBox.h"
#include "core/layout/LayoutObject.h"
#include "core/style/ComputedStyle.h"
-#include "wtf/StdLibExtras.h"
namespace blink {
@@ -826,7 +825,7 @@
static const HeapVector<Member<HTMLElementEquivalent>>& htmlElementEquivalents()
{
- DEFINE_STATIC_LOCAL(HeapVector<Member<HTMLElementEquivalent>>, HTMLElementEquivalents, (new HeapVector<Member<HTMLElementEquivalent>>));
+ DEFINE_STATIC_LOCAL(PersistentHeapVector<Member<HTMLElementEquivalent>>, HTMLElementEquivalents, ());
if (!HTMLElementEquivalents.size()) {
HTMLElementEquivalents.append(HTMLElementEquivalent::create(CSSPropertyFontWeight, CSSValueBold, HTMLNames::bTag));
HTMLElementEquivalents.append(HTMLElementEquivalent::create(CSSPropertyFontWeight, CSSValueBold, HTMLNames::strongTag));
@@ -864,7 +863,7 @@
static const HeapVector<Member<HTMLAttributeEquivalent>>& htmlAttributeEquivalents()
{
- DEFINE_STATIC_LOCAL(HeapVector<Member<HTMLAttributeEquivalent>>, HTMLAttributeEquivalents, (new HeapVector<Member<HTMLAttributeEquivalent>>));
+ DEFINE_STATIC_LOCAL(PersistentHeapVector<Member<HTMLAttributeEquivalent>>, HTMLAttributeEquivalents, ());
if (!HTMLAttributeEquivalents.size()) {
// elementIsStyledSpanOrHTMLEquivalent depends on the fact each HTMLAttriuteEquivalent matches exactly one attribute
// of exactly one element except dirAttr.
@@ -1131,13 +1130,13 @@
static void mergeTextDecorationValues(CSSValueList* mergedValue, const CSSValueList* valueToMerge)
{
- DEFINE_STATIC_LOCAL(CSSPrimitiveValue, underline, (CSSPrimitiveValue::createIdentifier(CSSValueUnderline)));
- DEFINE_STATIC_LOCAL(CSSPrimitiveValue, lineThrough, (CSSPrimitiveValue::createIdentifier(CSSValueLineThrough)));
- if (valueToMerge->hasValue(&underline) && !mergedValue->hasValue(&underline))
- mergedValue->append(&underline);
-
- if (valueToMerge->hasValue(&lineThrough) && !mergedValue->hasValue(&lineThrough))
- mergedValue->append(&lineThrough);
+ DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, underline, (CSSPrimitiveValue::createIdentifier(CSSValueUnderline)));
+ DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, lineThrough, (CSSPrimitiveValue::createIdentifier(CSSValueLineThrough)));
+ if (valueToMerge->hasValue(underline) && !mergedValue->hasValue(underline))
+ mergedValue->append(underline);
+
+ if (valueToMerge->hasValue(lineThrough) && !mergedValue->hasValue(lineThrough))
+ mergedValue->append(lineThrough);
}
void EditingStyle::mergeStyle(const StylePropertySet* style, CSSPropertyOverrideMode mode)
@@ -1525,12 +1524,12 @@
// Furthermore, text-decoration: none has been trimmed so that text-decoration property is always a CSSValueList.
RawPtr<CSSValue> textDecoration = style->getPropertyCSSValue(textDecorationPropertyForEditing());
if (textDecoration && textDecoration->isValueList()) {
- DEFINE_STATIC_LOCAL(CSSPrimitiveValue, underline, (CSSPrimitiveValue::createIdentifier(CSSValueUnderline)));
- DEFINE_STATIC_LOCAL(CSSPrimitiveValue, lineThrough, (CSSPrimitiveValue::createIdentifier(CSSValueLineThrough)));
+ DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, underline, (CSSPrimitiveValue::createIdentifier(CSSValueUnderline)));
+ DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, lineThrough, (CSSPrimitiveValue::createIdentifier(CSSValueLineThrough)));
RawPtr<CSSValueList> newTextDecoration = toCSSValueList(textDecoration.get())->copy();
- if (newTextDecoration->removeAll(&underline))
+ if (newTextDecoration->removeAll(underline))
m_applyUnderline = true;
- if (newTextDecoration->removeAll(&lineThrough))
+ if (newTextDecoration->removeAll(lineThrough))
m_applyLineThrough = true;
// If trimTextDecorations, delete underline and line-through

Powered by Google App Engine
This is Rietveld 408576698