OLD | NEW |
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 Loading... |
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->isRTL() ? AbstractInlineTextBoxDirectionRL : Abst
ractInlineTextBoxDirectionLR); |
| 1896 return (inlineTextBox->isRTL() ? AbstractInlineTextBoxDirectionBT : Abstract
InlineTextBoxDirectionTB); |
| 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 pos = textBreakNext(iterator); |
| 1912 if (isWordTextBreak(iterator)) |
| 1913 words.append(WordBoundaries(textBreakPrevious(iterator), textBreakNe
xt(iterator))); |
| 1914 } |
| 1915 } |
| 1916 |
| 1917 String RenderText::inlineTextBoxText(RenderText::AbstractInlineTextBox* inlineTe
xtBox) const |
| 1918 { |
| 1919 unsigned start = inlineTextBox->start(); |
| 1920 unsigned len = inlineTextBox->len(); |
| 1921 if (Node* node = this->node()) { |
| 1922 RefPtr<Range> range = Range::create(node->document()); |
| 1923 range->setStart(node, start, IGNORE_EXCEPTION); |
| 1924 range->setEnd(node, start + len, IGNORE_EXCEPTION); |
| 1925 return plainText(range.get(), TextIteratorIgnoresStyleVisibility); |
| 1926 } |
| 1927 |
| 1928 return text().substring(start, len); |
| 1929 } |
| 1930 |
1866 } // namespace WebCore | 1931 } // namespace WebCore |
OLD | NEW |