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

Side by Side Diff: Source/core/accessibility/AXRenderObject.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
« no previous file with comments | « no previous file | Source/core/dom/Document.h » ('j') | Source/core/editing/Editor.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 if (!allowsTextRanges() && !m_renderer->isText()) 1735 if (!allowsTextRanges() && !m_renderer->isText())
1736 return VisiblePosition(); 1736 return VisiblePosition();
1737 1737
1738 Node* node = m_renderer->node(); 1738 Node* node = m_renderer->node();
1739 if (!node) 1739 if (!node)
1740 return VisiblePosition(); 1740 return VisiblePosition();
1741 1741
1742 if (index <= 0) 1742 if (index <= 0)
1743 return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM); 1743 return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM);
1744 1744
1745 RefPtr<Range> range = Range::create(m_renderer->document()); 1745 RefPtrWillBeRawPtr<Range> range = Range::create(m_renderer->document());
1746 range->selectNodeContents(node, IGNORE_EXCEPTION); 1746 range->selectNodeContents(node, IGNORE_EXCEPTION);
1747 CharacterIterator it(range.get()); 1747 CharacterIterator it(range.get());
1748 it.advance(index - 1); 1748 it.advance(index - 1);
1749 return VisiblePosition(Position(it.range()->endContainer(), it.range()->endO ffset(), Position::PositionIsOffsetInAnch\ 1749 return VisiblePosition(Position(it.range()->endContainer(), it.range()->endO ffset(), Position::PositionIsOffsetInAnch\
1750 or), UPSTREAM); 1750 or), UPSTREAM);
1751 } 1751 }
1752 1752
1753 int AXRenderObject::indexForVisiblePosition(const VisiblePosition& pos) const 1753 int AXRenderObject::indexForVisiblePosition(const VisiblePosition& pos) const
1754 { 1754 {
1755 if (isNativeTextControl() && m_renderer->isTextControl()) { 1755 if (isNativeTextControl() && m_renderer->isTextControl()) {
1756 HTMLTextFormControlElement* textControl = toRenderTextControl(m_renderer )->textFormControlElement(); 1756 HTMLTextFormControlElement* textControl = toRenderTextControl(m_renderer )->textFormControlElement();
1757 return textControl->indexForVisiblePosition(pos); 1757 return textControl->indexForVisiblePosition(pos);
1758 } 1758 }
1759 1759
1760 if (!isTextControl()) 1760 if (!isTextControl())
1761 return 0; 1761 return 0;
1762 1762
1763 Node* node = m_renderer->node(); 1763 Node* node = m_renderer->node();
1764 if (!node) 1764 if (!node)
1765 return 0; 1765 return 0;
1766 1766
1767 Position indexPosition = pos.deepEquivalent(); 1767 Position indexPosition = pos.deepEquivalent();
1768 if (indexPosition.isNull() || highestEditableRoot(indexPosition, HasEditable AXRole) != node) 1768 if (indexPosition.isNull() || highestEditableRoot(indexPosition, HasEditable AXRole) != node)
1769 return 0; 1769 return 0;
1770 1770
1771 RefPtr<Range> range = Range::create(m_renderer->document()); 1771 RefPtrWillBeRawPtr<Range> range = Range::create(m_renderer->document());
1772 range->setStart(node, 0, IGNORE_EXCEPTION); 1772 range->setStart(node, 0, IGNORE_EXCEPTION);
1773 range->setEnd(indexPosition, IGNORE_EXCEPTION); 1773 range->setEnd(indexPosition, IGNORE_EXCEPTION);
1774 1774
1775 return TextIterator::rangeLength(range.get()); 1775 return TextIterator::rangeLength(range.get());
1776 } 1776 }
1777 1777
1778 void AXRenderObject::addInlineTextBoxChildren() 1778 void AXRenderObject::addInlineTextBoxChildren()
1779 { 1779 {
1780 if (!axObjectCache()->inlineTextBoxAccessibility()) 1780 if (!axObjectCache()->inlineTextBoxAccessibility())
1781 return; 1781 return;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 } 1856 }
1857 } 1857 }
1858 1858
1859 AXObject::PlainTextRange AXRenderObject::ariaSelectedTextRange() const 1859 AXObject::PlainTextRange AXRenderObject::ariaSelectedTextRange() const
1860 { 1860 {
1861 Node* node = m_renderer->node(); 1861 Node* node = m_renderer->node();
1862 if (!node) 1862 if (!node)
1863 return PlainTextRange(); 1863 return PlainTextRange();
1864 1864
1865 VisibleSelection visibleSelection = selection(); 1865 VisibleSelection visibleSelection = selection();
1866 RefPtr<Range> currentSelectionRange = visibleSelection.toNormalizedRange(); 1866 RefPtrWillBeRawPtr<Range> currentSelectionRange = visibleSelection.toNormali zedRange();
1867 if (!currentSelectionRange || !currentSelectionRange->intersectsNode(node, I GNORE_EXCEPTION)) 1867 if (!currentSelectionRange || !currentSelectionRange->intersectsNode(node, I GNORE_EXCEPTION))
1868 return PlainTextRange(); 1868 return PlainTextRange();
1869 1869
1870 int start = indexForVisiblePosition(visibleSelection.visibleStart()); 1870 int start = indexForVisiblePosition(visibleSelection.visibleStart());
1871 int end = indexForVisiblePosition(visibleSelection.visibleEnd()); 1871 int end = indexForVisiblePosition(visibleSelection.visibleEnd());
1872 1872
1873 return PlainTextRange(start, end - start); 1873 return PlainTextRange(start, end - start);
1874 } 1874 }
1875 1875
1876 bool AXRenderObject::nodeIsTextControl(const Node* node) const 1876 bool AXRenderObject::nodeIsTextControl(const Node* node) const
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
2351 if (label && label->renderer()) { 2351 if (label && label->renderer()) {
2352 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); 2352 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect();
2353 result.unite(labelRect); 2353 result.unite(labelRect);
2354 } 2354 }
2355 } 2355 }
2356 2356
2357 return result; 2357 return result;
2358 } 2358 }
2359 2359
2360 } // namespace WebCore 2360 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/Document.h » ('j') | Source/core/editing/Editor.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698