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

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

Issue 361683002: Make LayoutText::absoluteQuadsForRange to consider leading/trailing whitespaces (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-18T16:38:30 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
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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 // Work around signed/unsigned issues. This function takes unsigneds, and is often passed UINT_MAX 434 // Work around signed/unsigned issues. This function takes unsigneds, and is often passed UINT_MAX
435 // to mean "all the way to the end". InlineTextBox coordinates are unsigneds , so changing this 435 // to mean "all the way to the end". InlineTextBox coordinates are unsigneds , so changing this
436 // function to take ints causes various internal mismatches. But selectionRe ct takes ints, and 436 // function to take ints causes various internal mismatches. But selectionRe ct takes ints, and
437 // passing UINT_MAX to it causes trouble. Ideally we'd change selectionRect to take unsigneds, but 437 // passing UINT_MAX to it causes trouble. Ideally we'd change selectionRect to take unsigneds, but
438 // that would cause many ripple effects, so for now we'll just clamp our uns igned parameters to INT_MAX. 438 // that would cause many ripple effects, so for now we'll just clamp our uns igned parameters to INT_MAX.
439 ASSERT(end == UINT_MAX || end <= INT_MAX); 439 ASSERT(end == UINT_MAX || end <= INT_MAX);
440 ASSERT(start <= INT_MAX); 440 ASSERT(start <= INT_MAX);
441 start = std::min(start, static_cast<unsigned>(INT_MAX)); 441 start = std::min(start, static_cast<unsigned>(INT_MAX));
442 end = std::min(end, static_cast<unsigned>(INT_MAX)); 442 end = std::min(end, static_cast<unsigned>(INT_MAX));
443 443
444 const unsigned caretMinOffset = static_cast<unsigned>(this->caretMinOffset() );
445 const unsigned caretMaxOffset = static_cast<unsigned>(this->caretMaxOffset() );
446 // Skip leading and trailing unrendered whitespaces
eae 2015/08/18 16:14:45 The comment doesn't explain how this accounts for
yosin_UTC9 2015/08/19 06:08:55 Done.
447 start = std::min(std::max(caretMinOffset, start), caretMaxOffset);
448 end = std::min(std::max(caretMinOffset, end), caretMaxOffset);
449
444 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 450 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
445 // Note: box->end() returns the index of the last character, not the ind ex past it 451 // Note: box->end() returns the index of the last character, not the ind ex past it
446 if (start <= box->start() && box->end() < end) { 452 if (start <= box->start() && box->end() < end) {
447 LayoutRect r(box->calculateBoundaries()); 453 LayoutRect r(box->calculateBoundaries());
448 if (useSelectionHeight) { 454 if (useSelectionHeight) {
449 LayoutRect selectionRect = box->localSelectionRect(start, end); 455 LayoutRect selectionRect = box->localSelectionRect(start, end);
450 if (box->isHorizontal()) { 456 if (box->isHorizontal()) {
451 r.setHeight(selectionRect.height()); 457 r.setHeight(selectionRect.height());
452 r.setY(selectionRect.y()); 458 r.setY(selectionRect.y());
453 } else { 459 } else {
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 1882 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
1877 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box); 1883 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box);
1878 if (box->truncation() != cNoTruncation) { 1884 if (box->truncation() != cNoTruncation) {
1879 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox()) 1885 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox())
1880 paintInvalidationContainer.invalidateDisplayItemClientOnBacking( *ellipsisBox); 1886 paintInvalidationContainer.invalidateDisplayItemClientOnBacking( *ellipsisBox);
1881 } 1887 }
1882 } 1888 }
1883 } 1889 }
1884 1890
1885 } // namespace blink 1891 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698