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

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

Issue 1044593002: Revert of 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 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 } 1768 }
1769 } 1769 }
1770 1770
1771 FloatRect Range::boundingRect() const 1771 FloatRect Range::boundingRect() const
1772 { 1772 {
1773 m_ownerDocument->updateLayoutIgnorePendingStylesheets(); 1773 m_ownerDocument->updateLayoutIgnorePendingStylesheets();
1774 1774
1775 Vector<FloatQuad> quads; 1775 Vector<FloatQuad> quads;
1776 getBorderAndTextQuads(quads); 1776 getBorderAndTextQuads(quads);
1777 1777
1778 if (quads.isEmpty())
1779 return FloatRect();
1780
1781 FloatRect result; 1778 FloatRect result;
1782 for (const FloatQuad& quad : quads) { 1779 for (const FloatQuad& quad : quads)
1783 if (result.isEmpty()) { 1780 result.unite(quad.boundingBox());
1784 result = quad.boundingBox();
1785 continue;
1786 }
1787
1788 result.uniteEvenIfEmpty(quad.boundingBox());
1789 }
1790 1781
1791 return result; 1782 return result;
1792 } 1783 }
1793 1784
1794 DEFINE_TRACE(Range) 1785 DEFINE_TRACE(Range)
1795 { 1786 {
1796 visitor->trace(m_ownerDocument); 1787 visitor->trace(m_ownerDocument);
1797 visitor->trace(m_start); 1788 visitor->trace(m_start);
1798 visitor->trace(m_end); 1789 visitor->trace(m_end);
1799 } 1790 }
1800 1791
1801 } // namespace blink 1792 } // namespace blink
1802 1793
1803 #ifndef NDEBUG 1794 #ifndef NDEBUG
1804 1795
1805 void showTree(const blink::Range* range) 1796 void showTree(const blink::Range* range)
1806 { 1797 {
1807 if (range && range->boundaryPointsValid()) { 1798 if (range && range->boundaryPointsValid()) {
1808 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E"); 1799 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E");
1809 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset()); 1800 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset());
1810 } 1801 }
1811 } 1802 }
1812 1803
1813 #endif 1804 #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