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

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

Issue 2616483002: Reduce rectangle merges when doing region-based hit test on text boxes (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | 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 * 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 } 869 }
870 870
871 namespace { 871 namespace {
872 872
873 class HitTestCulledInlinesGeneratorContext { 873 class HitTestCulledInlinesGeneratorContext {
874 public: 874 public:
875 HitTestCulledInlinesGeneratorContext(Region& region, 875 HitTestCulledInlinesGeneratorContext(Region& region,
876 const HitTestLocation& location) 876 const HitTestLocation& location)
877 : m_intersected(false), m_region(region), m_location(location) {} 877 : m_intersected(false), m_region(region), m_location(location) {}
878 void operator()(const FloatRect& rect) { 878 void operator()(const FloatRect& rect) {
879 m_intersected = m_intersected || m_location.intersects(rect); 879 bool intersects = m_location.intersects(rect);
880 m_region.unite(enclosingIntRect(rect)); 880 m_intersected = m_intersected || intersects;
wkorman 2017/01/04 00:36:35 nit: could use |= here and below.
881 if (intersects)
882 m_region.unite(enclosingIntRect(rect));
881 } 883 }
882 void operator()(const LayoutRect& rect) { 884 void operator()(const LayoutRect& rect) {
883 m_intersected = m_intersected || m_location.intersects(rect); 885 bool intersects = m_location.intersects(rect);
884 m_region.unite(enclosingIntRect(rect)); 886 m_intersected = m_intersected || intersects;
887 if (intersects)
888 m_region.unite(enclosingIntRect(rect));
885 } 889 }
886 bool intersected() const { return m_intersected; } 890 bool intersected() const { return m_intersected; }
887 891
888 private: 892 private:
889 bool m_intersected; 893 bool m_intersected;
890 Region& m_region; 894 Region& m_region;
891 const HitTestLocation& m_location; 895 const HitTestLocation& m_location;
892 }; 896 };
893 897
894 } // unnamed namespace 898 } // unnamed namespace
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason); 1518 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason);
1515 } 1519 }
1516 1520
1517 // TODO(lunalu): Not to just dump 0, 0 as the x and y here 1521 // TODO(lunalu): Not to just dump 0, 0 as the x and y here
1518 LayoutRect LayoutInline::debugRect() const { 1522 LayoutRect LayoutInline::debugRect() const {
1519 IntRect linesBox = enclosingIntRect(linesBoundingBox()); 1523 IntRect linesBox = enclosingIntRect(linesBoundingBox());
1520 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height())); 1524 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height()));
1521 } 1525 }
1522 1526
1523 } // namespace blink 1527 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698