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

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

Issue 10993072: Merge 129814 - REGRESSION(r129186): Pressing enter at the end of a line deletes the line (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1229/
Patch Set: Created 8 years, 2 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 | « no previous file | 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 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 } 1246 }
1247 1247
1248 // The containing block can be null in case of an orphaned tree. 1248 // The containing block can be null in case of an orphaned tree.
1249 RenderBlock* containingBlock = this->containingBlock(); 1249 RenderBlock* containingBlock = this->containingBlock();
1250 if (containingBlock && !containingBlock->isRenderView()) 1250 if (containingBlock && !containingBlock->isRenderView())
1251 containingBlock->setSelectionState(state); 1251 containingBlock->setSelectionState(state);
1252 } 1252 }
1253 1253
1254 void RenderText::setTextWithOffset(PassRefPtr<StringImpl> text, unsigned offset, unsigned len, bool force) 1254 void RenderText::setTextWithOffset(PassRefPtr<StringImpl> text, unsigned offset, unsigned len, bool force)
1255 { 1255 {
1256 if (!force && equal(m_text.impl(), text.get()))
1257 return;
1258
1256 unsigned oldLen = textLength(); 1259 unsigned oldLen = textLength();
1257 unsigned newLen = text->length(); 1260 unsigned newLen = text->length();
1258 int delta = newLen - oldLen; 1261 int delta = newLen - oldLen;
1259 unsigned end = len ? offset + len - 1 : offset; 1262 unsigned end = len ? offset + len - 1 : offset;
1260 1263
1261 RootInlineBox* firstRootBox = 0; 1264 RootInlineBox* firstRootBox = 0;
1262 RootInlineBox* lastRootBox = 0; 1265 RootInlineBox* lastRootBox = 0;
1263 1266
1264 bool dirtiedLines = false; 1267 bool dirtiedLines = false;
1265 1268
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 curr->setLineBreakPos(curr->lineBreakPos() + delta); 1320 curr->setLineBreakPos(curr->lineBreakPos() + delta);
1318 } 1321 }
1319 1322
1320 // If the text node is empty, dirty the line where new text will be inserted . 1323 // If the text node is empty, dirty the line where new text will be inserted .
1321 if (!firstTextBox() && parent()) { 1324 if (!firstTextBox() && parent()) {
1322 parent()->dirtyLinesFromChangedChild(this); 1325 parent()->dirtyLinesFromChangedChild(this);
1323 dirtiedLines = true; 1326 dirtiedLines = true;
1324 } 1327 }
1325 1328
1326 m_linesDirty = dirtiedLines; 1329 m_linesDirty = dirtiedLines;
1327 setText(text, force); 1330 setText(text, force || dirtiedLines);
1328 } 1331 }
1329 1332
1330 void RenderText::transformText() 1333 void RenderText::transformText()
1331 { 1334 {
1332 if (RefPtr<StringImpl> textToTransform = originalText()) 1335 if (RefPtr<StringImpl> textToTransform = originalText())
1333 setText(textToTransform.release(), true); 1336 setText(textToTransform.release(), true);
1334 } 1337 }
1335 1338
1336 static inline bool isInlineFlowOrEmptyText(const RenderObject* o) 1339 static inline bool isInlineFlowOrEmptyText(const RenderObject* o)
1337 { 1340 {
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 1911
1909 SecureTextTimer* secureTextTimer = gSecureTextTimers->get(this); 1912 SecureTextTimer* secureTextTimer = gSecureTextTimers->get(this);
1910 if (!secureTextTimer) { 1913 if (!secureTextTimer) {
1911 secureTextTimer = new SecureTextTimer(this); 1914 secureTextTimer = new SecureTextTimer(this);
1912 gSecureTextTimers->add(this, secureTextTimer); 1915 gSecureTextTimers->add(this, secureTextTimer);
1913 } 1916 }
1914 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); 1917 secureTextTimer->restartWithNewText(lastTypedCharacterOffset);
1915 } 1918 }
1916 1919
1917 } // namespace WebCore 1920 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698