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

Side by Side Diff: sky/engine/core/rendering/RenderText.cpp

Issue 847303003: Delete selection paint invalidation code. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 * (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 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 } 1357 }
1358 1358
1359 LayoutUnit logicalTop = firstTextBox()->logicalTopVisualOverflow(); 1359 LayoutUnit logicalTop = firstTextBox()->logicalTopVisualOverflow();
1360 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; 1360 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide;
1361 LayoutUnit logicalHeight = lastTextBox()->logicalBottomVisualOverflow() - lo gicalTop; 1361 LayoutUnit logicalHeight = lastTextBox()->logicalBottomVisualOverflow() - lo gicalTop;
1362 1362
1363 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); 1363 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight);
1364 return rect; 1364 return rect;
1365 } 1365 }
1366 1366
1367 LayoutRect RenderText::selectionRectForPaintInvalidation(const RenderLayerModelO bject* paintInvalidationContainer, bool clipToVisibleContent)
1368 {
1369 ASSERT(!needsLayout());
1370
1371 if (selectionState() == SelectionNone)
1372 return LayoutRect();
1373 RenderBlock* cb = containingBlock();
1374 if (!cb)
1375 return LayoutRect();
1376
1377 // Now calculate startPos and endPos for painting selection.
1378 // We include a selection while endPos > 0
1379 int startPos, endPos;
1380 if (selectionState() == SelectionInside) {
1381 // We are fully selected.
1382 startPos = 0;
1383 endPos = textLength();
1384 } else {
1385 selectionStartEnd(startPos, endPos);
1386 if (selectionState() == SelectionStart)
1387 endPos = textLength();
1388 else if (selectionState() == SelectionEnd)
1389 startPos = 0;
1390 }
1391
1392 if (startPos == endPos)
1393 return IntRect();
1394
1395 LayoutRect rect;
1396 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
1397 rect.unite(box->localSelectionRect(startPos, endPos));
1398 rect.unite(ellipsisRectForBox(box, startPos, endPos));
1399 }
1400
1401 if (clipToVisibleContent) {
1402 mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, 0);
1403 } else {
1404 rect = localToContainerQuad(FloatRect(rect), paintInvalidationContainer) .enclosingBoundingBox();
1405 }
1406
1407 return rect;
1408 }
1409
1410 int RenderText::caretMinOffset() const 1367 int RenderText::caretMinOffset() const
1411 { 1368 {
1412 InlineTextBox* box = firstTextBox(); 1369 InlineTextBox* box = firstTextBox();
1413 if (!box) 1370 if (!box)
1414 return 0; 1371 return 0;
1415 int minOffset = box->start(); 1372 int minOffset = box->start();
1416 for (box = box->nextTextBox(); box; box = box->nextTextBox()) 1373 for (box = box->nextTextBox(); box; box = box->nextTextBox())
1417 minOffset = std::min<int>(minOffset, box->start()); 1374 minOffset = std::min<int>(minOffset, box->start());
1418 return minOffset; 1375 return minOffset;
1419 } 1376 }
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 ASSERT(child->prevTextBox() == prev); 1583 ASSERT(child->prevTextBox() == prev);
1627 prev = child; 1584 prev = child;
1628 } 1585 }
1629 ASSERT(prev == m_lastTextBox); 1586 ASSERT(prev == m_lastTextBox);
1630 #endif 1587 #endif
1631 } 1588 }
1632 1589
1633 #endif 1590 #endif
1634 1591
1635 } // namespace blink 1592 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698