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

Side by Side Diff: Source/core/rendering/RenderText.cpp

Issue 23983002: Expose InlineTextBoxes in the accessibility tree. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix include path Created 7 years, 2 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
OLDNEW
1 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org) 3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 gSecureTextTimers = new SecureTextTimerMap; 1856 gSecureTextTimers = new SecureTextTimerMap;
1857 1857
1858 SecureTextTimer* secureTextTimer = gSecureTextTimers->get(this); 1858 SecureTextTimer* secureTextTimer = gSecureTextTimers->get(this);
1859 if (!secureTextTimer) { 1859 if (!secureTextTimer) {
1860 secureTextTimer = new SecureTextTimer(this); 1860 secureTextTimer = new SecureTextTimer(this);
1861 gSecureTextTimers->add(this, secureTextTimer); 1861 gSecureTextTimers->add(this, secureTextTimer);
1862 } 1862 }
1863 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); 1863 secureTextTimer->restartWithNewText(lastTypedCharacterOffset);
1864 } 1864 }
1865 1865
1866 RenderText::AbstractInlineTextBox* RenderText::firstInlineTextBox() const
1867 {
1868 return m_firstTextBox;
1869 }
1870
1871 RenderText::AbstractInlineTextBox* RenderText::nextInlineTextBox(RenderText::Abs tractInlineTextBox* inlineTextBox) const
1872 {
1873 return inlineTextBox->nextTextBox();
1874 }
1875
1876 LayoutRect RenderText::inlineTextBoxBounds(RenderText::AbstractInlineTextBox* in lineTextBox) const
1877 {
1878 FloatRect boundaries = inlineTextBox->calculateBoundaries();
1879 return localToAbsoluteQuad(boundaries).enclosingBoundingBox();
1880 }
1881
1882 unsigned RenderText::inlineTextBoxStart(RenderText::AbstractInlineTextBox* inlin eTextBox) const
1883 {
1884 return inlineTextBox->start();
1885 }
1886
1887 unsigned RenderText::inlineTextBoxLen(RenderText::AbstractInlineTextBox* inlineT extBox) const
1888 {
1889 return inlineTextBox->len();
1890 }
1891
1892 RenderText::AbstractInlineTextBoxDirection RenderText::inlineTextBoxDirection(Re nderText::AbstractInlineTextBox* inlineTextBox) const
1893 {
1894 if (style()->isHorizontalWritingMode())
1895 return (inlineTextBox->direction() == RTL ? AbstractInlineTextBoxDirecti onRL : AbstractInlineTextBoxDirectionLR);
1896 return (inlineTextBox->direction() == RTL ? AbstractInlineTextBoxDirectionBT : AbstractInlineTextBoxDirectionTB);
1897 }
1898
1899 void RenderText::inlineTextBoxCharacterWidths(RenderText::AbstractInlineTextBox* inlineTextBox, Vector<float>& widths) const
1900 {
1901 inlineTextBox->characterWidths(widths);
1902 }
1903
1904 void RenderText::inlineTextBoxWordBoundaries(RenderText::AbstractInlineTextBox* inlineTextBox, Vector<WordBoundaries>& words) const
1905 {
1906 int start = inlineTextBox->start();
1907 int len = inlineTextBox->len();
1908 TextBreakIterator* iterator = wordBreakIterator(text(), start, len);
1909 int pos = textBreakFirst(iterator);
1910 while (pos >= 0 && pos < len) {
1911 int next = textBreakNext(iterator);
1912 if (isWordTextBreak(iterator))
1913 words.append(WordBoundaries(pos, next));
1914 pos = next;
1915 }
1916 }
1917
1918 String RenderText::inlineTextBoxText(RenderText::AbstractInlineTextBox* inlineTe xtBox) const
1919 {
1920 unsigned start = inlineTextBox->start();
1921 unsigned len = inlineTextBox->len();
1922 if (Node* node = this->node()) {
1923 RefPtr<Range> range = Range::create(node->document());
1924 range->setStart(node, start, IGNORE_EXCEPTION);
1925 range->setEnd(node, start + len, IGNORE_EXCEPTION);
1926 return plainText(range.get(), TextIteratorIgnoresStyleVisibility);
1927 }
1928
1929 return text().substring(start, len);
1930 }
1931
1866 } // namespace WebCore 1932 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698