| OLD | NEW |
| 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 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1865 HTMLTextFormControlElement* textControl = toLayoutTextControl(m_layoutOb
ject)->textFormControlElement(); | 1865 HTMLTextFormControlElement* textControl = toLayoutTextControl(m_layoutOb
ject)->textFormControlElement(); |
| 1866 textControl->setSelectionRange(range.start, range.start + range.length,
SelectionHasNoDirection, NotDispatchSelectEvent); | 1866 textControl->setSelectionRange(range.start, range.start + range.length,
SelectionHasNoDirection, NotDispatchSelectEvent); |
| 1867 return; | 1867 return; |
| 1868 } | 1868 } |
| 1869 | 1869 |
| 1870 Document& document = m_layoutObject->document(); | 1870 Document& document = m_layoutObject->document(); |
| 1871 LocalFrame* frame = document.frame(); | 1871 LocalFrame* frame = document.frame(); |
| 1872 if (!frame) | 1872 if (!frame) |
| 1873 return; | 1873 return; |
| 1874 Node* node = m_layoutObject->node(); | 1874 Node* node = m_layoutObject->node(); |
| 1875 frame->selection().setSelection(VisibleSelection(Position(node, range.start,
Position::PositionIsOffsetInAnchor), | 1875 frame->selection().setSelection(VisibleSelection(Position(node, range.start)
, |
| 1876 Position(node, range.start + range.length, Position::PositionIsOffsetInA
nchor), DOWNSTREAM)); | 1876 Position(node, range.start + range.length), DOWNSTREAM)); |
| 1877 } | 1877 } |
| 1878 | 1878 |
| 1879 void AXLayoutObject::setValue(const String& string) | 1879 void AXLayoutObject::setValue(const String& string) |
| 1880 { | 1880 { |
| 1881 if (!node() || !node()->isElementNode()) | 1881 if (!node() || !node()->isElementNode()) |
| 1882 return; | 1882 return; |
| 1883 if (!m_layoutObject || !m_layoutObject->isBoxModelObject()) | 1883 if (!m_layoutObject || !m_layoutObject->isBoxModelObject()) |
| 1884 return; | 1884 return; |
| 1885 | 1885 |
| 1886 LayoutBoxModelObject* layoutObject = toLayoutBoxModelObject(m_layoutObject); | 1886 LayoutBoxModelObject* layoutObject = toLayoutBoxModelObject(m_layoutObject); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1998 if (index <= 0) | 1998 if (index <= 0) |
| 1999 return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM); | 1999 return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM); |
| 2000 | 2000 |
| 2001 Position start, end; | 2001 Position start, end; |
| 2002 bool selected = Range::selectNodeContents(node, start, end); | 2002 bool selected = Range::selectNodeContents(node, start, end); |
| 2003 if (!selected) | 2003 if (!selected) |
| 2004 return VisiblePosition(); | 2004 return VisiblePosition(); |
| 2005 | 2005 |
| 2006 CharacterIterator it(start, end); | 2006 CharacterIterator it(start, end); |
| 2007 it.advance(index - 1); | 2007 it.advance(index - 1); |
| 2008 return VisiblePosition(Position(it.currentContainer(), it.endOffset(), Posit
ion::PositionIsOffsetInAnchor), UPSTREAM); | 2008 return VisiblePosition(Position(it.currentContainer(), it.endOffset()), UPST
REAM); |
| 2009 } | 2009 } |
| 2010 | 2010 |
| 2011 int AXLayoutObject::indexForVisiblePosition(const VisiblePosition& pos) const | 2011 int AXLayoutObject::indexForVisiblePosition(const VisiblePosition& pos) const |
| 2012 { | 2012 { |
| 2013 if (m_layoutObject->isTextControl()) { | 2013 if (m_layoutObject->isTextControl()) { |
| 2014 HTMLTextFormControlElement* textControl = toLayoutTextControl(m_layoutOb
ject)->textFormControlElement(); | 2014 HTMLTextFormControlElement* textControl = toLayoutTextControl(m_layoutOb
ject)->textFormControlElement(); |
| 2015 return textControl->indexForVisiblePosition(pos); | 2015 return textControl->indexForVisiblePosition(pos); |
| 2016 } | 2016 } |
| 2017 | 2017 |
| 2018 if (!isTextControl()) | 2018 if (!isTextControl()) |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2507 if (label && label->layoutObject()) { | 2507 if (label && label->layoutObject()) { |
| 2508 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); | 2508 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); |
| 2509 result.unite(labelRect); | 2509 result.unite(labelRect); |
| 2510 } | 2510 } |
| 2511 } | 2511 } |
| 2512 | 2512 |
| 2513 return result; | 2513 return result; |
| 2514 } | 2514 } |
| 2515 | 2515 |
| 2516 } // namespace blink | 2516 } // namespace blink |
| OLD | NEW |