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

Side by Side Diff: Source/core/editing/EditorCommand.cpp

Issue 22438008: Replace static_cast with safe casting methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/editing/EditingStyle.cpp ('k') | Source/core/editing/markup.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2009 Igalia S.L. 4 * Copyright (C) 2009 Igalia S.L.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // until https://bugs.webkit.org/show_bug.cgi?id=27818 is resolved. 134 // until https://bugs.webkit.org/show_bug.cgi?id=27818 is resolved.
135 static bool executeToggleStyleInList(Frame* frame, EditorCommandSource source, E ditAction action, CSSPropertyID propertyID, CSSValue* value) 135 static bool executeToggleStyleInList(Frame* frame, EditorCommandSource source, E ditAction action, CSSPropertyID propertyID, CSSValue* value)
136 { 136 {
137 RefPtr<EditingStyle> selectionStyle = EditingStyle::styleAtSelectionStart(fr ame->selection()->selection()); 137 RefPtr<EditingStyle> selectionStyle = EditingStyle::styleAtSelectionStart(fr ame->selection()->selection());
138 if (!selectionStyle || !selectionStyle->style()) 138 if (!selectionStyle || !selectionStyle->style())
139 return false; 139 return false;
140 140
141 RefPtr<CSSValue> selectedCSSValue = selectionStyle->style()->getPropertyCSSV alue(propertyID); 141 RefPtr<CSSValue> selectedCSSValue = selectionStyle->style()->getPropertyCSSV alue(propertyID);
142 String newStyle = ASCIILiteral("none"); 142 String newStyle = ASCIILiteral("none");
143 if (selectedCSSValue->isValueList()) { 143 if (selectedCSSValue->isValueList()) {
144 RefPtr<CSSValueList> selectedCSSValueList = static_cast<CSSValueList*>(s electedCSSValue.get()); 144 RefPtr<CSSValueList> selectedCSSValueList = toCSSValueList(selectedCSSVa lue.get());
145 if (!selectedCSSValueList->removeAll(value)) 145 if (!selectedCSSValueList->removeAll(value))
146 selectedCSSValueList->append(value); 146 selectedCSSValueList->append(value);
147 if (selectedCSSValueList->length()) 147 if (selectedCSSValueList->length())
148 newStyle = selectedCSSValueList->cssText(); 148 newStyle = selectedCSSValueList->cssText();
149 149
150 } else if (selectedCSSValue->cssText() == "none") 150 } else if (selectedCSSValue->cssText() == "none")
151 newStyle = value->cssText(); 151 newStyle = value->cssText();
152 152
153 // FIXME: We shouldn't be having to convert new style into text. We should have setPropertyCSSValue. 153 // FIXME: We shouldn't be having to convert new style into text. We should have setPropertyCSSValue.
154 RefPtr<MutableStylePropertySet> newMutableStyle = MutableStylePropertySet::c reate(); 154 RefPtr<MutableStylePropertySet> newMutableStyle = MutableStylePropertySet::c reate();
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 return m_command->state(m_frame.get(), triggeringEvent) == TrueTriState ? "true" : "false"; 1742 return m_command->state(m_frame.get(), triggeringEvent) == TrueTriState ? "true" : "false";
1743 return m_command->value(m_frame.get(), triggeringEvent); 1743 return m_command->value(m_frame.get(), triggeringEvent);
1744 } 1744 }
1745 1745
1746 bool Editor::Command::isTextInsertion() const 1746 bool Editor::Command::isTextInsertion() const
1747 { 1747 {
1748 return m_command && m_command->isTextInsertion; 1748 return m_command && m_command->isTextInsertion;
1749 } 1749 }
1750 1750
1751 } // namespace WebCore 1751 } // namespace WebCore
OLDNEW
« 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