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 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1776 String(&revealed_text, 1)); | 1776 String(&revealed_text, 1)); |
1777 // m_text may be updated later before timer fires. We invalidate the | 1777 // m_text may be updated later before timer fires. We invalidate the |
1778 // lastTypedCharacterOffset to avoid inconsistency. | 1778 // lastTypedCharacterOffset to avoid inconsistency. |
1779 secure_text_timer->Invalidate(); | 1779 secure_text_timer->Invalidate(); |
1780 } | 1780 } |
1781 } | 1781 } |
1782 | 1782 |
1783 void LayoutText::SetText(PassRefPtr<StringImpl> text, bool force) { | 1783 void LayoutText::SetText(PassRefPtr<StringImpl> text, bool force) { |
1784 DCHECK(text); | 1784 DCHECK(text); |
1785 | 1785 |
1786 if (!force && Equal(text_.Impl(), text.Get())) | 1786 bool equal = Equal(text_.Impl(), text.Get()); |
| 1787 if (equal && !force) |
1787 return; | 1788 return; |
1788 | 1789 |
1789 SetTextInternal(std::move(text)); | 1790 SetTextInternal(std::move(text)); |
1790 // If preferredLogicalWidthsDirty() of an orphan child is true, | 1791 // If preferredLogicalWidthsDirty() of an orphan child is true, |
1791 // LayoutObjectChildList::insertChildNode() fails to set true to owner. | 1792 // LayoutObjectChildList::insertChildNode() fails to set true to owner. |
1792 // To avoid that, we call setNeedsLayoutAndPrefWidthsRecalc() only if this | 1793 // To avoid that, we call setNeedsLayoutAndPrefWidthsRecalc() only if this |
1793 // LayoutText has parent. | 1794 // LayoutText has parent. |
1794 if (Parent()) | 1795 if (Parent()) |
1795 SetNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( | 1796 SetNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( |
1796 LayoutInvalidationReason::kTextChanged); | 1797 LayoutInvalidationReason::kTextChanged); |
1797 known_to_have_no_overflow_and_no_fallback_fonts_ = false; | 1798 known_to_have_no_overflow_and_no_fallback_fonts_ = false; |
1798 | 1799 |
1799 if (AXObjectCache* cache = GetDocument().ExistingAXObjectCache()) | 1800 // Don't bother updating the AX tree if there's no change. Otherwise, when |
1800 cache->TextChanged(this); | 1801 // typing in password fields, we would announce each "dot" twice: once when a |
| 1802 // character is typed, and second when that character is hidden. |
| 1803 if (!equal) { |
| 1804 AXObjectCache* cache = GetDocument().ExistingAXObjectCache(); |
| 1805 if (cache) |
| 1806 cache->TextChanged(this); |
| 1807 } |
1801 | 1808 |
1802 TextAutosizer* text_autosizer = GetDocument().GetTextAutosizer(); | 1809 TextAutosizer* text_autosizer = GetDocument().GetTextAutosizer(); |
1803 if (text_autosizer) | 1810 if (text_autosizer) |
1804 text_autosizer->Record(this); | 1811 text_autosizer->Record(this); |
1805 } | 1812 } |
1806 | 1813 |
1807 void LayoutText::DirtyOrDeleteLineBoxesIfNeeded(bool full_layout) { | 1814 void LayoutText::DirtyOrDeleteLineBoxesIfNeeded(bool full_layout) { |
1808 if (full_layout) | 1815 if (full_layout) |
1809 DeleteTextBoxes(); | 1816 DeleteTextBoxes(); |
1810 else if (!lines_dirty_) | 1817 else if (!lines_dirty_) |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2130 LayoutRect rect = LayoutRect( | 2137 LayoutRect rect = LayoutRect( |
2131 IntRect(FirstRunX(), FirstRunY(), lines_box.Width(), lines_box.Height())); | 2138 IntRect(FirstRunX(), FirstRunY(), lines_box.Width(), lines_box.Height())); |
2132 LayoutBlock* block = ContainingBlock(); | 2139 LayoutBlock* block = ContainingBlock(); |
2133 if (block && HasTextBoxes()) | 2140 if (block && HasTextBoxes()) |
2134 block->AdjustChildDebugRect(rect); | 2141 block->AdjustChildDebugRect(rect); |
2135 | 2142 |
2136 return rect; | 2143 return rect; |
2137 } | 2144 } |
2138 | 2145 |
2139 } // namespace blink | 2146 } // namespace blink |
OLD | NEW |