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

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

Issue 2169273004: Switch all LayoutTests to use new accessibility relative bounding box API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix absolute bounds in AXInlineTextBox::elementRect Created 4 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 // The ellipsis should be considered to be selected if the end of 399 // The ellipsis should be considered to be selected if the end of
400 // the selection is past the beginning of the truncation and the 400 // the selection is past the beginning of the truncation and the
401 // beginning of the selection is before or at the beginning of the trunc ation. 401 // beginning of the selection is before or at the beginning of the trunc ation.
402 if (ellipsisEndPosition >= truncation && ellipsisStartPosition <= trunca tion) 402 if (ellipsisEndPosition >= truncation && ellipsisStartPosition <= trunca tion)
403 return ellipsis->selectionRect(); 403 return ellipsis->selectionRect();
404 } 404 }
405 405
406 return IntRect(); 406 return IntRect();
407 } 407 }
408 408
409 void LayoutText::absoluteQuads(Vector<FloatQuad>& quads, ClippingOption option) const 409 void LayoutText::quads(Vector<FloatQuad>& quads, ClippingOption option, LocalOrA bsoluteOption localOrAbsolute) const
410 { 410 {
411 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 411 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
412 FloatRect boundaries(box->calculateBoundaries()); 412 FloatRect boundaries(box->calculateBoundaries());
413 413
414 // Shorten the width of this text box if it ends in an ellipsis. 414 // Shorten the width of this text box if it ends in an ellipsis.
415 // FIXME: ellipsisRectForBox should switch to return FloatRect soon with the subpixellayout branch. 415 // FIXME: ellipsisRectForBox should switch to return FloatRect soon with the subpixellayout branch.
416 IntRect ellipsisRect = (option == ClipToEllipsis) ? ellipsisRectForBox(b ox, 0, textLength()) : IntRect(); 416 IntRect ellipsisRect = (option == ClipToEllipsis) ? ellipsisRectForBox(b ox, 0, textLength()) : IntRect();
417 if (!ellipsisRect.isEmpty()) { 417 if (!ellipsisRect.isEmpty()) {
418 if (style()->isHorizontalWritingMode()) 418 if (style()->isHorizontalWritingMode())
419 boundaries.setWidth(ellipsisRect.maxX() - boundaries.x()); 419 boundaries.setWidth(ellipsisRect.maxX() - boundaries.x());
420 else 420 else
421 boundaries.setHeight(ellipsisRect.maxY() - boundaries.y()); 421 boundaries.setHeight(ellipsisRect.maxY() - boundaries.y());
422 } 422 }
423 quads.append(localToAbsoluteQuad(boundaries)); 423 if (localOrAbsolute == AbsoluteQuads)
424 quads.append(localToAbsoluteQuad(boundaries));
425 else
426 quads.append(boundaries);
424 } 427 }
425 } 428 }
426 429
427 void LayoutText::absoluteQuads(Vector<FloatQuad>& quads) const 430 void LayoutText::absoluteQuads(Vector<FloatQuad>& quads) const
428 { 431 {
429 absoluteQuads(quads, NoClipping); 432 this->quads(quads, NoClipping, AbsoluteQuads);
430 } 433 }
431 434
432 void LayoutText::absoluteQuadsForRange(Vector<FloatQuad>& quads, unsigned start, unsigned end, bool useSelectionHeight) 435 void LayoutText::absoluteQuadsForRange(Vector<FloatQuad>& quads, unsigned start, unsigned end, bool useSelectionHeight)
433 { 436 {
434 // Work around signed/unsigned issues. This function takes unsigneds, and is often passed UINT_MAX 437 // 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 438 // 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 439 // 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 440 // 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. 441 // 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); 442 ASSERT(end == UINT_MAX || end <= INT_MAX);
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 1756 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
1754 invalidateDisplayItemClient(*box, invalidationReason); 1757 invalidateDisplayItemClient(*box, invalidationReason);
1755 if (box->truncation() != cNoTruncation) { 1758 if (box->truncation() != cNoTruncation) {
1756 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox()) 1759 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox())
1757 invalidateDisplayItemClient(*ellipsisBox, invalidationReason); 1760 invalidateDisplayItemClient(*ellipsisBox, invalidationReason);
1758 } 1761 }
1759 } 1762 }
1760 } 1763 }
1761 1764
1762 } // namespace blink 1765 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutText.h ('k') | third_party/WebKit/Source/core/layout/line/AbstractInlineTextBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698