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

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

Issue 2775663008: LayoutObject::absoluteBoundingBoxRectForRange() should take EphemeralRange (Closed)
Patch Set: Y Created 3 years, 8 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 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2009 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 986
987 IntRect LayoutObject::absoluteElementBoundingBoxRect() const { 987 IntRect LayoutObject::absoluteElementBoundingBoxRect() const {
988 Vector<LayoutRect> rects; 988 Vector<LayoutRect> rects;
989 const LayoutBoxModelObject& container = enclosingLayer()->layoutObject(); 989 const LayoutBoxModelObject& container = enclosingLayer()->layoutObject();
990 addElementVisualOverflowRects( 990 addElementVisualOverflowRects(
991 rects, LayoutPoint(localToAncestorPoint(FloatPoint(), &container))); 991 rects, LayoutPoint(localToAncestorPoint(FloatPoint(), &container)));
992 return container.localToAbsoluteQuad(FloatQuad(FloatRect(unionRect(rects)))) 992 return container.localToAbsoluteQuad(FloatQuad(FloatRect(unionRect(rects))))
993 .enclosingBoundingBox(); 993 .enclosingBoundingBox();
994 } 994 }
995 995
996 FloatRect LayoutObject::absoluteBoundingBoxRectForRange(const Range* range) { 996 FloatRect LayoutObject::absoluteBoundingBoxRectForRange(
997 if (!range || !range->startContainer()) 997 const EphemeralRange& range) {
998 if (range.isNull() || !range.startPosition().computeContainerNode())
998 return FloatRect(); 999 return FloatRect();
999 1000
1000 range->ownerDocument().updateStyleAndLayout(); 1001 range.document().updateStyleAndLayout();
1001 1002
1002 Vector<FloatQuad> quads; 1003 Vector<FloatQuad> quads;
1003 range->textQuads(quads); 1004 textQuad(quads, range);
Xiaocheng 2017/03/28 21:29:34 Let's make textQuad return |Vector<FloatQuad>| dir
tanvir 2017/03/30 19:11:06 Done.
1004 1005
1005 FloatRect result; 1006 FloatRect result;
1006 for (size_t i = 0; i < quads.size(); ++i) 1007 for (size_t i = 0; i < quads.size(); ++i)
1007 result.unite(quads[i].boundingBox()); 1008 result.unite(quads[i].boundingBox());
1008 1009
1009 return result; 1010 return result;
1010 } 1011 }
1011 1012
1012 void LayoutObject::addAbsoluteRectForLayer(IntRect& result) { 1013 void LayoutObject::addAbsoluteRectForLayer(IntRect& result) {
1013 if (hasLayer()) 1014 if (hasLayer())
(...skipping 2611 matching lines...) Expand 10 before | Expand all | Expand 10 after
3625 const blink::LayoutObject* root = object1; 3626 const blink::LayoutObject* root = object1;
3626 while (root->parent()) 3627 while (root->parent())
3627 root = root->parent(); 3628 root = root->parent();
3628 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3629 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3629 } else { 3630 } else {
3630 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3631 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3631 } 3632 }
3632 } 3633 }
3633 3634
3634 #endif 3635 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698