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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutText.cpp

Issue 2299213003: Fix the inconsistent problem while the content of textNodes is changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git rebase... Created 4 years 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 | third_party/WebKit/Source/core/layout/TextAutosizer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 16 matching lines...) Expand all
27 #include "core/dom/AXObjectCache.h" 27 #include "core/dom/AXObjectCache.h"
28 #include "core/dom/Text.h" 28 #include "core/dom/Text.h"
29 #include "core/editing/VisiblePosition.h" 29 #include "core/editing/VisiblePosition.h"
30 #include "core/editing/iterators/TextIterator.h" 30 #include "core/editing/iterators/TextIterator.h"
31 #include "core/frame/FrameView.h" 31 #include "core/frame/FrameView.h"
32 #include "core/frame/Settings.h" 32 #include "core/frame/Settings.h"
33 #include "core/layout/LayoutBlock.h" 33 #include "core/layout/LayoutBlock.h"
34 #include "core/layout/LayoutTableCell.h" 34 #include "core/layout/LayoutTableCell.h"
35 #include "core/layout/LayoutTextCombine.h" 35 #include "core/layout/LayoutTextCombine.h"
36 #include "core/layout/LayoutView.h" 36 #include "core/layout/LayoutView.h"
37 #include "core/layout/TextAutosizer.h"
37 #include "core/layout/api/LineLayoutBox.h" 38 #include "core/layout/api/LineLayoutBox.h"
38 #include "core/layout/line/AbstractInlineTextBox.h" 39 #include "core/layout/line/AbstractInlineTextBox.h"
39 #include "core/layout/line/EllipsisBox.h" 40 #include "core/layout/line/EllipsisBox.h"
40 #include "core/layout/line/GlyphOverflow.h" 41 #include "core/layout/line/GlyphOverflow.h"
41 #include "core/layout/line/InlineTextBox.h" 42 #include "core/layout/line/InlineTextBox.h"
42 #include "platform/fonts/CharacterRange.h" 43 #include "platform/fonts/CharacterRange.h"
43 #include "platform/geometry/FloatQuad.h" 44 #include "platform/geometry/FloatQuad.h"
44 #include "platform/text/BidiResolver.h" 45 #include "platform/text/BidiResolver.h"
45 #include "platform/text/Character.h" 46 #include "platform/text/Character.h"
46 #include "platform/text/Hyphenation.h" 47 #include "platform/text/Hyphenation.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 ETextTransform oldTransform = 204 ETextTransform oldTransform =
204 oldStyle ? oldStyle->textTransform() : ETextTransform::None; 205 oldStyle ? oldStyle->textTransform() : ETextTransform::None;
205 ETextSecurity oldSecurity = oldStyle ? oldStyle->textSecurity() : TSNONE; 206 ETextSecurity oldSecurity = oldStyle ? oldStyle->textSecurity() : TSNONE;
206 if (oldTransform != newStyle.textTransform() || 207 if (oldTransform != newStyle.textTransform() ||
207 oldSecurity != newStyle.textSecurity()) 208 oldSecurity != newStyle.textSecurity())
208 transformText(); 209 transformText();
209 210
210 // This is an optimization that kicks off font load before layout. 211 // This is an optimization that kicks off font load before layout.
211 if (!text().containsOnlyWhitespace()) 212 if (!text().containsOnlyWhitespace())
212 newStyle.font().willUseFontData(text()); 213 newStyle.font().willUseFontData(text());
214
215 TextAutosizer* textAutosizer = document().textAutosizer();
216 if (!oldStyle && textAutosizer)
217 textAutosizer->record(this);
213 } 218 }
214 219
215 void LayoutText::removeAndDestroyTextBoxes() { 220 void LayoutText::removeAndDestroyTextBoxes() {
216 if (!documentBeingDestroyed()) { 221 if (!documentBeingDestroyed()) {
217 if (firstTextBox()) { 222 if (firstTextBox()) {
218 if (isBR()) { 223 if (isBR()) {
219 RootInlineBox* next = firstTextBox()->root().nextRootBox(); 224 RootInlineBox* next = firstTextBox()->root().nextRootBox();
220 if (next) 225 if (next)
221 next->markDirty(); 226 next->markDirty();
222 } 227 }
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 // LayoutObjectChildList::insertChildNode() fails to set true to owner. 1666 // LayoutObjectChildList::insertChildNode() fails to set true to owner.
1662 // To avoid that, we call setNeedsLayoutAndPrefWidthsRecalc() only if this 1667 // To avoid that, we call setNeedsLayoutAndPrefWidthsRecalc() only if this
1663 // LayoutText has parent. 1668 // LayoutText has parent.
1664 if (parent()) 1669 if (parent())
1665 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( 1670 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(
1666 LayoutInvalidationReason::TextChanged); 1671 LayoutInvalidationReason::TextChanged);
1667 m_knownToHaveNoOverflowAndNoFallbackFonts = false; 1672 m_knownToHaveNoOverflowAndNoFallbackFonts = false;
1668 1673
1669 if (AXObjectCache* cache = document().existingAXObjectCache()) 1674 if (AXObjectCache* cache = document().existingAXObjectCache())
1670 cache->textChanged(this); 1675 cache->textChanged(this);
1676
1677 TextAutosizer* textAutosizer = document().textAutosizer();
1678 if (textAutosizer)
1679 textAutosizer->record(this);
1671 } 1680 }
1672 1681
1673 void LayoutText::dirtyOrDeleteLineBoxesIfNeeded(bool fullLayout) { 1682 void LayoutText::dirtyOrDeleteLineBoxesIfNeeded(bool fullLayout) {
1674 if (fullLayout) 1683 if (fullLayout)
1675 deleteTextBoxes(); 1684 deleteTextBoxes();
1676 else if (!m_linesDirty) 1685 else if (!m_linesDirty)
1677 dirtyLineBoxes(); 1686 dirtyLineBoxes();
1678 m_linesDirty = false; 1687 m_linesDirty = false;
1679 } 1688 }
1680 1689
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 LayoutRect rect = LayoutRect( 1984 LayoutRect rect = LayoutRect(
1976 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height())); 1985 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height()));
1977 LayoutBlock* block = containingBlock(); 1986 LayoutBlock* block = containingBlock();
1978 if (block && hasTextBoxes()) 1987 if (block && hasTextBoxes())
1979 block->adjustChildDebugRect(rect); 1988 block->adjustChildDebugRect(rect);
1980 1989
1981 return rect; 1990 return rect;
1982 } 1991 }
1983 1992
1984 } // namespace blink 1993 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/TextAutosizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698