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

Side by Side Diff: Source/core/editing/VisibleUnits.cpp

Issue 429453004: Let FrameSelection::localCaretRect on a text input field avoid synchronous layout. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Nits Created 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 VisiblePosition leftBoundaryOfLine(const VisiblePosition& c, TextDirection direc tion) 1379 VisiblePosition leftBoundaryOfLine(const VisiblePosition& c, TextDirection direc tion)
1380 { 1380 {
1381 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); 1381 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c);
1382 } 1382 }
1383 1383
1384 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire ction) 1384 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire ction)
1385 { 1385 {
1386 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); 1386 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c);
1387 } 1387 }
1388 1388
1389 LayoutRect localCaretRectOfPosition(const PositionWithAffinity& position, Render Object*& renderer)
1390 {
1391 if (position.position().isNull()) {
1392 renderer = nullptr;
1393 return IntRect();
1394 }
1395 Node* node = position.position().anchorNode();
1396
1397 renderer = node->renderer();
1398 if (!renderer)
1399 return LayoutRect();
1400
1401 InlineBox* inlineBox;
1402 int caretOffset;
1403 position.position().getInlineBoxAndOffset(position.affinity(), inlineBox, ca retOffset);
1404
1405 if (inlineBox)
1406 renderer = &inlineBox->renderer();
1407
1408 return renderer->localCaretRect(inlineBox, caretOffset);
1389 } 1409 }
1410
1411 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698