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

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

Issue 22417002: Rename ASSERT_NO_EXCEPTION_STATE and IGNORE_EXCEPTION_STATE (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/Editor.cpp ('k') | Source/core/editing/FormatBlockCommand.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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 return executeInsertFragment(frame, fragment.release()); 206 return executeInsertFragment(frame, fragment.release());
207 } 207 }
208 208
209 static bool expandSelectionToGranularity(Frame* frame, TextGranularity granulari ty) 209 static bool expandSelectionToGranularity(Frame* frame, TextGranularity granulari ty)
210 { 210 {
211 VisibleSelection selection = frame->selection()->selection(); 211 VisibleSelection selection = frame->selection()->selection();
212 selection.expandUsingGranularity(granularity); 212 selection.expandUsingGranularity(granularity);
213 RefPtr<Range> newRange = selection.toNormalizedRange(); 213 RefPtr<Range> newRange = selection.toNormalizedRange();
214 if (!newRange) 214 if (!newRange)
215 return false; 215 return false;
216 if (newRange->collapsed(IGNORE_EXCEPTION_STATE)) 216 if (newRange->collapsed(IGNORE_EXCEPTION))
217 return false; 217 return false;
218 RefPtr<Range> oldRange = frame->selection()->selection().toNormalizedRange() ; 218 RefPtr<Range> oldRange = frame->selection()->selection().toNormalizedRange() ;
219 EAffinity affinity = frame->selection()->affinity(); 219 EAffinity affinity = frame->selection()->affinity();
220 if (!frame->editor()->client()->shouldChangeSelectedRange(oldRange.get(), ne wRange.get(), affinity, false)) 220 if (!frame->editor()->client()->shouldChangeSelectedRange(oldRange.get(), ne wRange.get(), affinity, false))
221 return false; 221 return false;
222 frame->selection()->setSelectedRange(newRange.get(), affinity, true); 222 frame->selection()->setSelectedRange(newRange.get(), affinity, true);
223 return true; 223 return true;
224 } 224 }
225 225
226 static TriState stateStyle(Frame* frame, CSSPropertyID propertyID, const char* d esiredValue) 226 static TriState stateStyle(Frame* frame, CSSPropertyID propertyID, const char* d esiredValue)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 if (!style) 258 if (!style)
259 return 0; 259 return 0;
260 if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || focuse dElement->rendererIsEditable())) 260 if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || focuse dElement->rendererIsEditable()))
261 return 0; 261 return 0;
262 int height = std::min<int>(toRenderBox(renderer)->clientHeight(), frame->vie w()->visibleHeight()); 262 int height = std::min<int>(toRenderBox(renderer)->clientHeight(), frame->vie w()->visibleHeight());
263 return static_cast<unsigned>(max(max<int>(height * ScrollableArea::minFracti onToStepWhenPaging(), height - ScrollableArea::maxOverlapBetweenPages()), 1)); 263 return static_cast<unsigned>(max(max<int>(height * ScrollableArea::minFracti onToStepWhenPaging(), height - ScrollableArea::maxOverlapBetweenPages()), 1));
264 } 264 }
265 265
266 static RefPtr<Range> unionDOMRanges(Range* a, Range* b) 266 static RefPtr<Range> unionDOMRanges(Range* a, Range* b)
267 { 267 {
268 Range* start = a->compareBoundaryPoints(Range::START_TO_START, b, ASSERT_NO_ EXCEPTION_STATE) <= 0 ? a : b; 268 Range* start = a->compareBoundaryPoints(Range::START_TO_START, b, ASSERT_NO_ EXCEPTION) <= 0 ? a : b;
269 Range* end = a->compareBoundaryPoints(Range::END_TO_END, b, ASSERT_NO_EXCEPT ION_STATE) <= 0 ? b : a; 269 Range* end = a->compareBoundaryPoints(Range::END_TO_END, b, ASSERT_NO_EXCEPT ION) <= 0 ? b : a;
270 270
271 return Range::create(a->ownerDocument(), start->startContainer(), start->sta rtOffset(), end->endContainer(), end->endOffset()); 271 return Range::create(a->ownerDocument(), start->startContainer(), start->sta rtOffset(), end->endContainer(), end->endOffset());
272 } 272 }
273 273
274 // Execute command functions 274 // Execute command functions
275 275
276 static bool executeBackColor(Frame* frame, Event*, EditorCommandSource source, c onst String& value) 276 static bool executeBackColor(Frame* frame, Event*, EditorCommandSource source, c onst String& value)
277 { 277 {
278 return executeApplyStyle(frame, source, EditActionSetBackgroundColor, CSSPro pertyBackgroundColor, value); 278 return executeApplyStyle(frame, source, EditActionSetBackgroundColor, CSSPro pertyBackgroundColor, value);
279 } 279 }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 return executeApplyStyle(frame, source, EditActionSetColor, CSSPropertyColor , value); 435 return executeApplyStyle(frame, source, EditActionSetColor, CSSPropertyColor , value);
436 } 436 }
437 437
438 static bool executeFormatBlock(Frame* frame, Event*, EditorCommandSource, const String& value) 438 static bool executeFormatBlock(Frame* frame, Event*, EditorCommandSource, const String& value)
439 { 439 {
440 String tagName = value.lower(); 440 String tagName = value.lower();
441 if (tagName[0] == '<' && tagName[tagName.length() - 1] == '>') 441 if (tagName[0] == '<' && tagName[tagName.length() - 1] == '>')
442 tagName = tagName.substring(1, tagName.length() - 2); 442 tagName = tagName.substring(1, tagName.length() - 2);
443 443
444 String localName, prefix; 444 String localName, prefix;
445 if (!Document::parseQualifiedName(tagName, prefix, localName, IGNORE_EXCEPTI ON_STATE)) 445 if (!Document::parseQualifiedName(tagName, prefix, localName, IGNORE_EXCEPTI ON))
446 return false; 446 return false;
447 QualifiedName qualifiedTagName(prefix, localName, xhtmlNamespaceURI); 447 QualifiedName qualifiedTagName(prefix, localName, xhtmlNamespaceURI);
448 448
449 RefPtr<FormatBlockCommand> command = FormatBlockCommand::create(frame->docum ent(), qualifiedTagName); 449 RefPtr<FormatBlockCommand> command = FormatBlockCommand::create(frame->docum ent(), qualifiedTagName);
450 applyCommand(command); 450 applyCommand(command);
451 return command->didApply(); 451 return command->didApply();
452 } 452 }
453 453
454 static bool executeForwardDelete(Frame* frame, Event*, EditorCommandSource sourc e, const String&) 454 static bool executeForwardDelete(Frame* frame, Event*, EditorCommandSource sourc e, const String&)
455 { 455 {
(...skipping 1286 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/Editor.cpp ('k') | Source/core/editing/FormatBlockCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698