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

Unified Diff: third_party/WebKit/Source/core/dom/Range.cpp

Issue 1949373003: Change Range.getBoundingClientRect() when the first rect is empty (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed test as per eae review Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/Range/get-bounding-client-rect-empty-and-non-empty.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Range.cpp
diff --git a/third_party/WebKit/Source/core/dom/Range.cpp b/third_party/WebKit/Source/core/dom/Range.cpp
index b662e2bbdc9d43968c99f0126332ed0825b854e1..4ccba20c1e763c9a6378159a32be036b4eb01fe7 100644
--- a/third_party/WebKit/Source/core/dom/Range.cpp
+++ b/third_party/WebKit/Source/core/dom/Range.cpp
@@ -1582,16 +1582,12 @@ FloatRect Range::boundingRect() const
getBorderAndTextQuads(quads);
FloatRect result;
- // As per section 10 in https://www.w3.org/TR/cssom-view/
- // "Return a static DOMRect object describing the smallest rectangle that
- // includes the first rectangle in list and all of the remaining rectangles
- // of which the height or width is not zero."
- for (const FloatQuad& quad : quads) {
- if (result.isEmpty())
- result.uniteIfNonZero(quad.boundingBox());
- else
- result.unite(quad.boundingBox()); // Skips empty rects.
- }
+ for (const FloatQuad& quad : quads)
+ result.unite(quad.boundingBox()); // Skips empty rects.
+
+ // If all rects are empty, return the first rect.
+ if (result.isEmpty() && !quads.isEmpty())
+ return quads.first().boundingBox();
return result;
}
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/Range/get-bounding-client-rect-empty-and-non-empty.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698