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

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

Issue 1285123002: Move Position::isRenderedCharacter() for Text node to LayoutText (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-12T16:31:05 Created 5 years, 4 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
« no previous file with comments | « Source/core/layout/LayoutText.h ('k') | no next file » | 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 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 } 1127 }
1128 return true; 1128 return true;
1129 } 1129 }
1130 for (unsigned i = 0; i < length; ++i) { 1130 for (unsigned i = 0; i < length; ++i) {
1131 if (!style()->isCollapsibleWhiteSpace(characters16()[i])) 1131 if (!style()->isCollapsibleWhiteSpace(characters16()[i]))
1132 return false; 1132 return false;
1133 } 1133 }
1134 return true; 1134 return true;
1135 } 1135 }
1136 1136
1137 bool LayoutText::isRenderedCharacter(int offsetInNode) const
1138 {
1139 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
1140 if (offsetInNode < static_cast<int>(box->start()) && !containsReversedTe xt()) {
1141 // The offset we're looking for is before this node
1142 // this means the offset must be in content that is
1143 // not laid out. Return false.
1144 return false;
1145 }
1146 if (offsetInNode >= static_cast<int>(box->start()) && offsetInNode < sta tic_cast<int>(box->start() + box->len()))
1147 return true;
1148 }
1149
1150 return false;
1151 }
1152
1137 bool LayoutText::containsOnlyWhitespace(unsigned from, unsigned len) const 1153 bool LayoutText::containsOnlyWhitespace(unsigned from, unsigned len) const
1138 { 1154 {
1139 ASSERT(m_text); 1155 ASSERT(m_text);
1140 StringImpl& text = *m_text.impl(); 1156 StringImpl& text = *m_text.impl();
1141 unsigned currPos; 1157 unsigned currPos;
1142 for (currPos = from; 1158 for (currPos = from;
1143 currPos < from + len && (text[currPos] == newlineCharacter || text[currPos] == spaceCharacter || text[currPos] == tabulationCharacter); 1159 currPos < from + len && (text[currPos] == newlineCharacter || text[currPos] == spaceCharacter || text[currPos] == tabulationCharacter);
1144 currPos++) { } 1160 currPos++) { }
1145 return currPos >= (from + len); 1161 return currPos >= (from + len);
1146 } 1162 }
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 1876 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
1861 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box); 1877 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box);
1862 if (box->truncation() != cNoTruncation) { 1878 if (box->truncation() != cNoTruncation) {
1863 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox()) 1879 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox())
1864 paintInvalidationContainer.invalidateDisplayItemClientOnBacking( *ellipsisBox); 1880 paintInvalidationContainer.invalidateDisplayItemClientOnBacking( *ellipsisBox);
1865 } 1881 }
1866 } 1882 }
1867 } 1883 }
1868 1884
1869 } // namespace blink 1885 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutText.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698