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

Side by Side Diff: Source/core/rendering/RenderBlock.h

Issue 22463002: Optimize FloatIntervalSearchAdapter::collectIfNeeded (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Changes from review. Created 7 years, 4 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 | Source/core/rendering/RenderBlock.cpp » ('j') | 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 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights 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 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 typedef FloatingObjectSet::const_iterator FloatingObjectSetIterator; 1161 typedef FloatingObjectSet::const_iterator FloatingObjectSetIterator;
1162 typedef PODInterval<int, FloatingObject*> FloatingObjectInterval; 1162 typedef PODInterval<int, FloatingObject*> FloatingObjectInterval;
1163 typedef PODIntervalTree<int, FloatingObject*> FloatingObjectTree; 1163 typedef PODIntervalTree<int, FloatingObject*> FloatingObjectTree;
1164 typedef PODFreeListArena<PODRedBlackTree<FloatingObjectInterval>::Node> Inte rvalArena; 1164 typedef PODFreeListArena<PODRedBlackTree<FloatingObjectInterval>::Node> Inte rvalArena;
1165 1165
1166 template <FloatingObject::Type FloatTypeValue> 1166 template <FloatingObject::Type FloatTypeValue>
1167 class FloatIntervalSearchAdapter { 1167 class FloatIntervalSearchAdapter {
1168 public: 1168 public:
1169 typedef FloatingObjectInterval IntervalType; 1169 typedef FloatingObjectInterval IntervalType;
1170 1170
1171 FloatIntervalSearchAdapter(const RenderBlock* renderer, int lowValue, in t highValue, LayoutUnit& offset, LayoutUnit* heightRemaining) 1171 FloatIntervalSearchAdapter(const RenderBlock* renderer, int lowValue, in t highValue, LayoutUnit& offset)
1172 : m_renderer(renderer) 1172 : m_renderer(renderer)
1173 , m_lowValue(lowValue) 1173 , m_lowValue(lowValue)
1174 , m_highValue(highValue) 1174 , m_highValue(highValue)
1175 , m_offset(offset) 1175 , m_offset(offset)
1176 , m_heightRemaining(heightRemaining)
1177 , m_last(0) 1176 , m_last(0)
1177 , m_floatForHeight(0)
1178 { 1178 {
1179 } 1179 }
1180 1180
1181 inline int lowValue() const { return m_lowValue; } 1181 inline int lowValue() const { return m_lowValue; }
1182 inline int highValue() const { return m_highValue; } 1182 inline int highValue() const { return m_highValue; }
1183 void collectIfNeeded(const IntervalType&) const; 1183 void collectIfNeeded(const IntervalType&);
1184 1184
1185 // When computing the offset caused by the floats on a given line, if 1185 // When computing the offset caused by the floats on a given line, if
1186 // the outermost float on that line has a shape-outside, the inline 1186 // the outermost float on that line has a shape-outside, the inline
1187 // content that butts up against that float must be positioned using 1187 // content that butts up against that float must be positioned using
1188 // the contours of the shape, not the margin box of the float. 1188 // the contours of the shape, not the margin box of the float.
1189 // We save the last float encountered so that the offset can be 1189 // We save the last float encountered so that the offset can be
1190 // computed correctly by the code using this adapter. 1190 // computed correctly by the code using this adapter.
1191 const FloatingObject* lastFloat() const { return m_last; } 1191 const FloatingObject* lastFloat() const { return m_last; }
1192 1192
1193 LayoutUnit getHeightRemaining() const;
1194
1193 private: 1195 private:
1194 bool updateOffsetIfNeeded(const FloatingObject*) const; 1196 bool updateOffsetIfNeeded(const FloatingObject*) const;
1195 1197
1196 const RenderBlock* m_renderer; 1198 const RenderBlock* m_renderer;
1197 int m_lowValue; 1199 int m_lowValue;
1198 int m_highValue; 1200 int m_highValue;
1199 LayoutUnit& m_offset; 1201 LayoutUnit& m_offset;
1200 LayoutUnit* m_heightRemaining; 1202 const FloatingObject* m_last;
1201 // This member variable is mutable because the collectIfNeeded method 1203 const FloatingObject* m_floatForHeight;
1202 // is declared as const, even though it doesn't actually respect that
1203 // contract. It modifies other member variables via loopholes in the
1204 // const behavior. Instead of using loopholes, I decided it was better
1205 // to make the fact that this is modified in a const method explicit.
1206 mutable const FloatingObject* m_last;
1207 }; 1204 };
1208 1205
1209 void createFloatingObjects(); 1206 void createFloatingObjects();
1210 1207
1211 public: 1208 public:
1212 1209
1213 class FloatingObjects { 1210 class FloatingObjects {
1214 WTF_MAKE_NONCOPYABLE(FloatingObjects); WTF_MAKE_FAST_ALLOCATED; 1211 WTF_MAKE_NONCOPYABLE(FloatingObjects); WTF_MAKE_FAST_ALLOCATED;
1215 public: 1212 public:
1216 void clear(); 1213 void clear();
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 static String string(const int value); 1339 static String string(const int value);
1343 }; 1340 };
1344 template<> struct ValueToString<RenderBlock::FloatingObject*> { 1341 template<> struct ValueToString<RenderBlock::FloatingObject*> {
1345 static String string(const RenderBlock::FloatingObject*); 1342 static String string(const RenderBlock::FloatingObject*);
1346 }; 1343 };
1347 #endif 1344 #endif
1348 1345
1349 } // namespace WebCore 1346 } // namespace WebCore
1350 1347
1351 #endif // RenderBlock_h 1348 #endif // RenderBlock_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/RenderBlock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698