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

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

Issue 224113002: Oilpan: move Range object to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use STACK_ALLOCATED() + incorporate ager's overview of macros in this area. Created 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 clearRenderTreeSelection = true; 347 clearRenderTreeSelection = true;
348 } else if (baseRemoved || extentRemoved) { 348 } else if (baseRemoved || extentRemoved) {
349 // The base and/or extent are about to be removed, but the start and end aren't. 349 // The base and/or extent are about to be removed, but the start and end aren't.
350 // Change the base and extent to the start and end, but don't re-validat e the 350 // Change the base and extent to the start and end, but don't re-validat e the
351 // selection, since doing so could move the start and end into the node 351 // selection, since doing so could move the start and end into the node
352 // that is about to be removed. 352 // that is about to be removed.
353 if (m_selection.isBaseFirst()) 353 if (m_selection.isBaseFirst())
354 m_selection.setWithoutValidation(m_selection.start(), m_selection.en d()); 354 m_selection.setWithoutValidation(m_selection.start(), m_selection.en d());
355 else 355 else
356 m_selection.setWithoutValidation(m_selection.end(), m_selection.star t()); 356 m_selection.setWithoutValidation(m_selection.end(), m_selection.star t());
357 } else if (RefPtr<Range> range = m_selection.firstRange()) { 357 } else if (RefPtrWillBeRawPtr<Range> range = m_selection.firstRange()) {
358 TrackExceptionState exceptionState; 358 TrackExceptionState exceptionState;
359 Range::CompareResults compareResult = range->compareNode(&node, exceptio nState); 359 Range::CompareResults compareResult = range->compareNode(&node, exceptio nState);
360 if (!exceptionState.hadException() && (compareResult == Range::NODE_BEFO RE_AND_AFTER || compareResult == Range::NODE_INSIDE)) { 360 if (!exceptionState.hadException() && (compareResult == Range::NODE_BEFO RE_AND_AFTER || compareResult == Range::NODE_INSIDE)) {
361 // If we did nothing here, when this node's renderer was destroyed, the rect that it 361 // If we did nothing here, when this node's renderer was destroyed, the rect that it
362 // occupied would be invalidated, but, selection gaps that change as a result of 362 // occupied would be invalidated, but, selection gaps that change as a result of
363 // the removal wouldn't be invalidated. 363 // the removal wouldn't be invalidated.
364 // FIXME: Don't do so much unnecessary invalidation. 364 // FIXME: Don't do so much unnecessary invalidation.
365 clearRenderTreeSelection = true; 365 clearRenderTreeSelection = true;
366 } 366 }
367 } 367 }
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 VisiblePosition visibleStart(range->startPosition(), collapsed ? affinity : DOWNSTREAM); 1421 VisiblePosition visibleStart(range->startPosition(), collapsed ? affinity : DOWNSTREAM);
1422 VisiblePosition visibleEnd(range->endPosition(), SEL_DEFAULT_AFFINITY); 1422 VisiblePosition visibleEnd(range->endPosition(), SEL_DEFAULT_AFFINITY);
1423 setSelection(VisibleSelection(visibleStart, visibleEnd), options); 1423 setSelection(VisibleSelection(visibleStart, visibleEnd), options);
1424 1424
1425 m_logicalRange = range->cloneRange(ASSERT_NO_EXCEPTION); 1425 m_logicalRange = range->cloneRange(ASSERT_NO_EXCEPTION);
1426 startObservingVisibleSelectionChange(); 1426 startObservingVisibleSelectionChange();
1427 1427
1428 return true; 1428 return true;
1429 } 1429 }
1430 1430
1431 PassRefPtr<Range> FrameSelection::firstRange() const 1431 PassRefPtrWillBeRawPtr<Range> FrameSelection::firstRange() const
1432 { 1432 {
1433 if (m_logicalRange) 1433 if (m_logicalRange)
1434 return m_logicalRange->cloneRange(ASSERT_NO_EXCEPTION); 1434 return m_logicalRange->cloneRange(ASSERT_NO_EXCEPTION);
1435 return m_selection.firstRange(); 1435 return m_selection.firstRange();
1436 } 1436 }
1437 1437
1438 bool FrameSelection::isInPasswordField() const 1438 bool FrameSelection::isInPasswordField() const
1439 { 1439 {
1440 HTMLTextFormControlElement* textControl = enclosingTextFormControl(start()); 1440 HTMLTextFormControlElement* textControl = enclosingTextFormControl(start());
1441 return isHTMLInputElement(textControl) && toHTMLInputElement(textControl)->i sPasswordField(); 1441 return isHTMLInputElement(textControl) && toHTMLInputElement(textControl)->i sPasswordField();
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 sel.showTreeForThis(); 1876 sel.showTreeForThis();
1877 } 1877 }
1878 1878
1879 void showTree(const WebCore::FrameSelection* sel) 1879 void showTree(const WebCore::FrameSelection* sel)
1880 { 1880 {
1881 if (sel) 1881 if (sel)
1882 sel->showTreeForThis(); 1882 sel->showTreeForThis();
1883 } 1883 }
1884 1884
1885 #endif 1885 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698