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

Unified Diff: Source/core/editing/EditorCommand.cpp

Issue 1164573002: CSSValue Immediates: Change CSSValue to an object instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 5 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
« no previous file with comments | « Source/core/editing/EditingStyle.cpp ('k') | Source/core/editing/markup.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/EditorCommand.cpp
diff --git a/Source/core/editing/EditorCommand.cpp b/Source/core/editing/EditorCommand.cpp
index 56bbf4d5c94c3ef1e8cb3065456431a3e2daceee..55a45a821997c6d3657c27a30a0de851787f6fff 100644
--- a/Source/core/editing/EditorCommand.cpp
+++ b/Source/core/editing/EditorCommand.cpp
@@ -135,23 +135,24 @@ static bool executeApplyStyle(LocalFrame& frame, EditorCommandSource source, Edi
// FIXME: executeToggleStyleInList does not handle complicated cases such as <b><u>hello</u>world</b> properly.
// This function must use Editor::selectionHasStyle to determine the current style but we cannot fix this
// until https://bugs.webkit.org/show_bug.cgi?id=27818 is resolved.
-static bool executeToggleStyleInList(LocalFrame& frame, EditorCommandSource source, EditAction action, CSSPropertyID propertyID, CSSValue* value)
+static bool executeToggleStyleInList(LocalFrame& frame, EditorCommandSource source, EditAction action, CSSPropertyID propertyID, CSSValue value)
{
RefPtrWillBeRawPtr<EditingStyle> selectionStyle = EditingStyle::styleAtSelectionStart(frame.selection().selection());
if (!selectionStyle || !selectionStyle->style())
return false;
- RefPtrWillBeRawPtr<CSSValue> selectedCSSValue = selectionStyle->style()->getPropertyCSSValue(propertyID);
+ NullableCSSValue selectedCSSValue = selectionStyle->style()->getPropertyCSSValue(propertyID);
String newStyle("none");
- if (selectedCSSValue->isValueList()) {
- RefPtrWillBeRawPtr<CSSValueList> selectedCSSValueList = toCSSValueList(selectedCSSValue.get());
+ if (selectedCSSValue && selectedCSSValue->isValueList()) {
+ RefPtrWillBeRawPtr<CSSValueList> selectedCSSValueList = toCSSValueList(selectedCSSValue);
if (!selectedCSSValueList->removeAll(value))
selectedCSSValueList->append(value);
if (selectedCSSValueList->length())
newStyle = selectedCSSValueList->cssText();
- } else if (selectedCSSValue->cssText() == "none")
- newStyle = value->cssText();
+ } else if (selectedCSSValue && selectedCSSValue->cssText() == "none") {
+ newStyle = value.cssText();
+ }
// FIXME: We shouldn't be having to convert new style into text. We should have setPropertyCSSValue.
RefPtrWillBeRawPtr<MutableStylePropertySet> newMutableStyle = MutableStylePropertySet::create();
@@ -1061,8 +1062,8 @@ static bool executeSetMark(LocalFrame& frame, Event*, EditorCommandSource, const
static bool executeStrikethrough(LocalFrame& frame, Event*, EditorCommandSource source, const String&)
{
- RefPtrWillBeRawPtr<CSSPrimitiveValue> lineThrough = CSSPrimitiveValue::createIdentifier(CSSValueLineThrough);
- return executeToggleStyleInList(frame, source, EditActionUnderline, CSSPropertyWebkitTextDecorationsInEffect, lineThrough.get());
+ CSSValue lineThrough = CSSPrimitiveValue::createIdentifier(CSSValueLineThrough);
+ return executeToggleStyleInList(frame, source, EditActionUnderline, CSSPropertyWebkitTextDecorationsInEffect, lineThrough);
}
static bool executeStyleWithCSS(LocalFrame& frame, Event*, EditorCommandSource, const String& value)
@@ -1117,7 +1118,7 @@ static bool executeTranspose(LocalFrame& frame, Event*, EditorCommandSource, con
static bool executeUnderline(LocalFrame& frame, Event*, EditorCommandSource source, const String&)
{
RefPtrWillBeRawPtr<CSSPrimitiveValue> underline = CSSPrimitiveValue::createIdentifier(CSSValueUnderline);
- return executeToggleStyleInList(frame, source, EditActionUnderline, CSSPropertyWebkitTextDecorationsInEffect, underline.get());
+ return executeToggleStyleInList(frame, source, EditActionUnderline, CSSPropertyWebkitTextDecorationsInEffect, CSSValue(*underline));
}
static bool executeUndo(LocalFrame& frame, Event*, EditorCommandSource, const String&)
« no previous file with comments | « Source/core/editing/EditingStyle.cpp ('k') | Source/core/editing/markup.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698