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

Side by Side Diff: Source/core/dom/Range.cpp

Issue 998263002: range.getBoundingClientRect() returns incorrect value for collapsed ranges (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 | « LayoutTests/fast/dom/Range/getBoundingClientRect-caret-expected.txt ('k') | 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 Gunnstein Lye (gunnstein@netcom.no) 3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no)
4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no) 4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
5 * (C) 2001 Peter Kelly (pmk@post.com) 5 * (C) 2001 Peter Kelly (pmk@post.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 } 1779 }
1780 1780
1781 FloatRect Range::boundingRect() const 1781 FloatRect Range::boundingRect() const
1782 { 1782 {
1783 m_ownerDocument->updateLayoutIgnorePendingStylesheets(); 1783 m_ownerDocument->updateLayoutIgnorePendingStylesheets();
1784 1784
1785 Vector<FloatQuad> quads; 1785 Vector<FloatQuad> quads;
1786 getBorderAndTextQuads(quads); 1786 getBorderAndTextQuads(quads);
1787 1787
1788 FloatRect result; 1788 FloatRect result;
1789 for (const FloatQuad& quad : quads) 1789 for (const FloatQuad& quad : quads) {
1790 result.unite(quad.boundingBox()); 1790 if (result.isEmpty())
1791 result = quad.boundingBox();
eae 2015/03/19 20:52:21 This doesn't seem right, if the last quad is empty
Abhijeet Kandalkar Slow 2015/03/20 07:48:47 Done.
1792 else
1793 result.uniteEvenIfEmpty(quad.boundingBox());
1794 }
1791 1795
1792 return result; 1796 return result;
1793 } 1797 }
1794 1798
1795 DEFINE_TRACE(Range) 1799 DEFINE_TRACE(Range)
1796 { 1800 {
1797 visitor->trace(m_ownerDocument); 1801 visitor->trace(m_ownerDocument);
1798 visitor->trace(m_start); 1802 visitor->trace(m_start);
1799 visitor->trace(m_end); 1803 visitor->trace(m_end);
1800 } 1804 }
1801 1805
1802 } // namespace blink 1806 } // namespace blink
1803 1807
1804 #ifndef NDEBUG 1808 #ifndef NDEBUG
1805 1809
1806 void showTree(const blink::Range* range) 1810 void showTree(const blink::Range* range)
1807 { 1811 {
1808 if (range && range->boundaryPointsValid()) { 1812 if (range && range->boundaryPointsValid()) {
1809 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E"); 1813 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E");
1810 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset()); 1814 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset());
1811 } 1815 }
1812 } 1816 }
1813 1817
1814 #endif 1818 #endif
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/Range/getBoundingClientRect-caret-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698