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

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

Issue 9695005: Merge 110323 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 years, 9 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/WebCore/rendering/RenderReplaced.cpp ('k') | Source/WebCore/rendering/RenderView.cpp » ('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 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 return m_firstTextBox ? m_firstTextBox->x() : 0; 1127 return m_firstTextBox ? m_firstTextBox->x() : 0;
1128 } 1128 }
1129 1129
1130 float RenderText::firstRunY() const 1130 float RenderText::firstRunY() const
1131 { 1131 {
1132 return m_firstTextBox ? m_firstTextBox->y() : 0; 1132 return m_firstTextBox ? m_firstTextBox->y() : 0;
1133 } 1133 }
1134 1134
1135 void RenderText::setSelectionState(SelectionState state) 1135 void RenderText::setSelectionState(SelectionState state)
1136 { 1136 {
1137 InlineTextBox* box; 1137 RenderObject::setSelectionState(state);
1138 1138
1139 RenderObject::setSelectionState(state); 1139 if (canUpdateSelectionOnRootLineBoxes()) {
1140 if (state == SelectionStart || state == SelectionEnd || state == SelectionBo th) { 1140 if (state == SelectionStart || state == SelectionEnd || state == Selecti onBoth) {
1141 int startPos, endPos; 1141 int startPos, endPos;
1142 selectionStartEnd(startPos, endPos); 1142 selectionStartEnd(startPos, endPos);
1143 if (selectionState() == SelectionStart) { 1143 if (selectionState() == SelectionStart) {
1144 endPos = textLength(); 1144 endPos = textLength();
1145 1145
1146 // to handle selection from end of text to end of line 1146 // to handle selection from end of text to end of line
1147 if (startPos != 0 && startPos == endPos) 1147 if (startPos && startPos == endPos)
1148 startPos = endPos - 1; 1148 startPos = endPos - 1;
1149 } else if (selectionState() == SelectionEnd) 1149 } else if (selectionState() == SelectionEnd)
1150 startPos = 0; 1150 startPos = 0;
1151 1151
1152 for (box = firstTextBox(); box; box = box->nextTextBox()) { 1152 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBo x()) {
1153 if (box->isSelected(startPos, endPos)) { 1153 if (box->isSelected(startPos, endPos)) {
1154 RootInlineBox* line = box->root(); 1154 RootInlineBox* root = box->root();
1155 if (line) 1155 if (root)
1156 line->setHasSelectedChildren(true); 1156 root->setHasSelectedChildren(true);
1157 }
1157 } 1158 }
1158 } 1159 } else {
1159 } else { 1160 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBo x()) {
1160 for (box = firstTextBox(); box; box = box->nextTextBox()) { 1161 RootInlineBox* root = box->root();
1161 RootInlineBox* line = box->root(); 1162 if (root)
1162 if (line) 1163 root->setHasSelectedChildren(state == SelectionInside);
1163 line->setHasSelectedChildren(state == SelectionInside); 1164 }
1164 } 1165 }
1165 } 1166 }
1166 1167
1167 // The returned value can be null in case of an orphaned tree. 1168 // The containing block can be null in case of an orphaned tree.
1168 if (RenderBlock* cb = containingBlock()) 1169 RenderBlock* containingBlock = this->containingBlock();
1169 cb->setSelectionState(state); 1170 if (containingBlock && !containingBlock->isRenderView())
1171 containingBlock->setSelectionState(state);
1170 } 1172 }
1171 1173
1172 void RenderText::setTextWithOffset(PassRefPtr<StringImpl> text, unsigned offset, unsigned len, bool force) 1174 void RenderText::setTextWithOffset(PassRefPtr<StringImpl> text, unsigned offset, unsigned len, bool force)
1173 { 1175 {
1174 unsigned oldLen = textLength(); 1176 unsigned oldLen = textLength();
1175 unsigned newLen = text->length(); 1177 unsigned newLen = text->length();
1176 int delta = newLen - oldLen; 1178 int delta = newLen - oldLen;
1177 unsigned end = len ? offset + len - 1 : offset; 1179 unsigned end = len ? offset + len - 1 : offset;
1178 1180
1179 RootInlineBox* firstRootBox = 0; 1181 RootInlineBox* firstRootBox = 0;
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 1813
1812 SecureTextTimer* secureTextTimer = gSecureTextTimers->get(this); 1814 SecureTextTimer* secureTextTimer = gSecureTextTimers->get(this);
1813 if (!secureTextTimer) { 1815 if (!secureTextTimer) {
1814 secureTextTimer = new SecureTextTimer(this); 1816 secureTextTimer = new SecureTextTimer(this);
1815 gSecureTextTimers->add(this, secureTextTimer); 1817 gSecureTextTimers->add(this, secureTextTimer);
1816 } 1818 }
1817 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); 1819 secureTextTimer->restartWithNewText(lastTypedCharacterOffset);
1818 } 1820 }
1819 1821
1820 } // namespace WebCore 1822 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/RenderReplaced.cpp ('k') | Source/WebCore/rendering/RenderView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698