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

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

Issue 1313883002: Introduce firstRangeOf() as replacement of VisibleSelection::firstRange() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-25T17:47:14 Created 5 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
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 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 static String valueForeColor(LocalFrame& frame, Event*) 1429 static String valueForeColor(LocalFrame& frame, Event*)
1430 { 1430 {
1431 return valueStyle(frame, CSSPropertyColor); 1431 return valueStyle(frame, CSSPropertyColor);
1432 } 1432 }
1433 1433
1434 static String valueFormatBlock(LocalFrame& frame, Event*) 1434 static String valueFormatBlock(LocalFrame& frame, Event*)
1435 { 1435 {
1436 const VisibleSelection& selection = frame.selection().selection(); 1436 const VisibleSelection& selection = frame.selection().selection();
1437 if (!selection.isNonOrphanedCaretOrRange() || !selection.isContentEditable() ) 1437 if (!selection.isNonOrphanedCaretOrRange() || !selection.isContentEditable() )
1438 return ""; 1438 return "";
1439 Element* formatBlockElement = FormatBlockCommand::elementForFormatBlockComma nd(selection.firstRange().get()); 1439 Element* formatBlockElement = FormatBlockCommand::elementForFormatBlockComma nd(firstRangeOf(selection).get());
1440 if (!formatBlockElement) 1440 if (!formatBlockElement)
1441 return ""; 1441 return "";
1442 return formatBlockElement->localName(); 1442 return formatBlockElement->localName();
1443 } 1443 }
1444 1444
1445 // Map of functions 1445 // Map of functions
1446 1446
1447 struct CommandEntry { 1447 struct CommandEntry {
1448 const char* name; 1448 const char* name;
1449 EditorInternalCommand command; 1449 EditorInternalCommand command;
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 { 1791 {
1792 return m_command && m_command->isTextInsertion; 1792 return m_command && m_command->isTextInsertion;
1793 } 1793 }
1794 1794
1795 int Editor::Command::idForHistogram() const 1795 int Editor::Command::idForHistogram() const
1796 { 1796 {
1797 return isSupported() ? m_command->idForUserMetrics : 0; 1797 return isSupported() ? m_command->idForUserMetrics : 0;
1798 } 1798 }
1799 1799
1800 } // namespace blink 1800 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/VisibleSelectionTest.cpp ('k') | Source/core/editing/commands/InsertListCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698