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

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

Issue 16402019: Remove clips where we can show that they are unnecessary. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add TestExpectations for layout test changes due to crbug.com/249478 Created 7 years, 6 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) 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 538
539 virtual bool hasLineIfEmpty() const; 539 virtual bool hasLineIfEmpty() const;
540 540
541 bool simplifiedLayout(); 541 bool simplifiedLayout();
542 virtual void simplifiedNormalFlowLayout(); 542 virtual void simplifiedNormalFlowLayout();
543 543
544 void setDesiredColumnCountAndWidth(int, LayoutUnit); 544 void setDesiredColumnCountAndWidth(int, LayoutUnit);
545 545
546 public: 546 public:
547 void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = f alse); 547 void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = f alse);
548 virtual void addVisualOverflow(const LayoutRect&, VisualOverflowClipBehavior ) OVERRIDE FINAL;
548 protected: 549 protected:
549 virtual void addOverflowFromChildren(); 550 virtual void addOverflowFromChildren();
550 void addOverflowFromFloats(); 551 void addOverflowFromFloats();
551 void addOverflowFromPositionedObjects(); 552 void addOverflowFromPositionedObjects();
552 void addOverflowFromBlockChildren(); 553 void addOverflowFromBlockChildren();
553 void addOverflowFromInlineChildren(); 554 void addOverflowFromInlineChildren();
554 void addVisualOverflowFromTheme(); 555 void addVisualOverflowFromTheme();
555 556
556 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& addition alOffset, const RenderLayerModelObject* paintContainer = 0) OVERRIDE; 557 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& addition alOffset, const RenderLayerModelObject* paintContainer = 0) OVERRIDE;
557 558
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 bool m_horizontalWritingMode; 1222 bool m_horizontalWritingMode;
1222 const RenderBlock* m_renderer; 1223 const RenderBlock* m_renderer;
1223 1224
1224 friend void RenderBlock::createFloatingObjects(); 1225 friend void RenderBlock::createFloatingObjects();
1225 }; 1226 };
1226 1227
1227 // Allocated only when some of these fields have non-default values 1228 // Allocated only when some of these fields have non-default values
1228 struct RenderBlockRareData { 1229 struct RenderBlockRareData {
1229 WTF_MAKE_NONCOPYABLE(RenderBlockRareData); WTF_MAKE_FAST_ALLOCATED; 1230 WTF_MAKE_NONCOPYABLE(RenderBlockRareData); WTF_MAKE_FAST_ALLOCATED;
1230 public: 1231 public:
1231 RenderBlockRareData(const RenderBlock* block) 1232 RenderBlockRareData(const RenderBlock* block)
1232 : m_margins(positiveMarginBeforeDefault(block), negativeMarginBefore Default(block), positiveMarginAfterDefault(block), negativeMarginAfterDefault(bl ock)) 1233 : m_margins(positiveMarginBeforeDefault(block), negativeMarginBefore Default(block), positiveMarginAfterDefault(block), negativeMarginAfterDefault(bl ock))
1233 , m_paginationStrut(0) 1234 , m_paginationStrut(0)
1234 , m_pageLogicalOffset(0) 1235 , m_pageLogicalOffset(0)
1235 , m_lineGridBox(0) 1236 , m_lineGridBox(0)
1236 , m_lineBreakToAvoidWidow(0) 1237 , m_lineBreakToAvoidWidow(0)
1237 , m_shouldBreakAtLineToAvoidWidow(false) 1238 , m_shouldBreakAtLineToAvoidWidow(false)
1238 , m_discardMarginBefore(false) 1239 , m_discardMarginBefore(false)
1239 , m_discardMarginAfter(false) 1240 , m_discardMarginAfter(false)
1240 { 1241 {
1241 } 1242 }
1242 1243
1243 static LayoutUnit positiveMarginBeforeDefault(const RenderBlock* block) 1244 static LayoutUnit positiveMarginBeforeDefault(const RenderBlock* block)
1244 { 1245 {
1245 return std::max<LayoutUnit>(block->marginBefore(), 0); 1246 return std::max<LayoutUnit>(block->marginBefore(), 0);
1246 } 1247 }
1247 static LayoutUnit negativeMarginBeforeDefault(const RenderBlock* block) 1248 static LayoutUnit negativeMarginBeforeDefault(const RenderBlock* block)
1248 { 1249 {
1249 return std::max<LayoutUnit>(-block->marginBefore(), 0); 1250 return std::max<LayoutUnit>(-block->marginBefore(), 0);
1250 } 1251 }
1251 static LayoutUnit positiveMarginAfterDefault(const RenderBlock* block) 1252 static LayoutUnit positiveMarginAfterDefault(const RenderBlock* block)
1252 { 1253 {
1253 return std::max<LayoutUnit>(block->marginAfter(), 0); 1254 return std::max<LayoutUnit>(block->marginAfter(), 0);
1254 } 1255 }
1255 static LayoutUnit negativeMarginAfterDefault(const RenderBlock* block) 1256 static LayoutUnit negativeMarginAfterDefault(const RenderBlock* block)
1256 { 1257 {
1257 return std::max<LayoutUnit>(-block->marginAfter(), 0); 1258 return std::max<LayoutUnit>(-block->marginAfter(), 0);
1258 } 1259 }
1259 1260
1260 MarginValues m_margins; 1261 MarginValues m_margins;
1261 LayoutUnit m_paginationStrut; 1262 LayoutUnit m_paginationStrut;
1262 LayoutUnit m_pageLogicalOffset; 1263 LayoutUnit m_pageLogicalOffset;
1263 1264
1264 RootInlineBox* m_lineGridBox; 1265 RootInlineBox* m_lineGridBox;
1265 1266
1266 RootInlineBox* m_lineBreakToAvoidWidow; 1267 RootInlineBox* m_lineBreakToAvoidWidow;
1267 OwnPtr<ExclusionShapeInsideInfo> m_shapeInsideInfo; 1268 OwnPtr<ExclusionShapeInsideInfo> m_shapeInsideInfo;
1268 bool m_shouldBreakAtLineToAvoidWidow : 1; 1269 bool m_shouldBreakAtLineToAvoidWidow : 1;
1269 bool m_discardMarginBefore : 1; 1270 bool m_discardMarginBefore : 1;
1270 bool m_discardMarginAfter : 1; 1271 bool m_discardMarginAfter : 1;
1272
1273 LayoutRect m_contentsVisualOverflowRect;
1271 }; 1274 };
1272 1275
1273 protected: 1276 protected:
1274 1277
1275 OwnPtr<FloatingObjects> m_floatingObjects; 1278 OwnPtr<FloatingObjects> m_floatingObjects;
1276 OwnPtr<RenderBlockRareData> m_rareData; 1279 OwnPtr<RenderBlockRareData> m_rareData;
1277 1280
1278 RenderObjectChildList m_children; 1281 RenderObjectChildList m_children;
1279 RenderLineBoxList m_lineBoxes; // All of the root line boxes created for t his block flow. For example, <div>Hello<br>world.</div> will have two total lin es for the <div>. 1282 RenderLineBoxList m_lineBoxes; // All of the root line boxes created for t his block flow. For example, <div>Hello<br>world.</div> will have two total lin es for the <div>.
1280 1283
1281 mutable signed m_lineHeight : 27; 1284 mutable signed m_lineHeight : 27;
1282 unsigned m_hasMarginBeforeQuirk : 1; // Note these quirk values can't be put in RenderBlockRareData since they are set too frequently. 1285 unsigned m_hasMarginBeforeQuirk : 1; // Note these quirk values can't be put in RenderBlockRareData since they are set too frequently.
1283 unsigned m_hasMarginAfterQuirk : 1; 1286 unsigned m_hasMarginAfterQuirk : 1;
1284 unsigned m_beingDestroyed : 1; 1287 unsigned m_beingDestroyed : 1;
1285 unsigned m_hasMarkupTruncation : 1; 1288 unsigned m_hasMarkupTruncation : 1;
1286 unsigned m_hasBorderOrPaddingLogicalWidthChanged : 1; 1289 unsigned m_hasBorderOrPaddingLogicalWidthChanged : 1;
1287 1290
1288 // RenderRubyBase objects need to be able to split and merge, moving their c hildren around 1291 // RenderRubyBase objects need to be able to split and merge, moving their c hildren around
1289 // (calling moveChildTo, moveAllChildrenTo, and makeChildrenNonInline). 1292 // (calling moveChildTo, moveAllChildrenTo, and makeChildrenNonInline).
1290 friend class RenderRubyBase; 1293 friend class RenderRubyBase;
1291 friend class LineWidth; // Needs to know FloatingObject 1294 friend class LineWidth; // Needs to know FloatingObject
1292 1295
1293 private: 1296 private:
1294 // Used to store state between styleWillChange and styleDidChange 1297 // Used to store state between styleWillChange and styleDidChange
1295 static bool s_canPropagateFloatIntoSibling; 1298 static bool s_canPropagateFloatIntoSibling;
1296 }; 1299 };
1297 1300
1298 inline RenderBlock* toRenderBlock(RenderObject* object) 1301 inline RenderBlock* toRenderBlock(RenderObject* object)
1299 { 1302 {
1300 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderBlock()); 1303 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderBlock());
1301 return static_cast<RenderBlock*>(object); 1304 return static_cast<RenderBlock*>(object);
1302 } 1305 }
1303 1306
1304 inline const RenderBlock* toRenderBlock(const RenderObject* object) 1307 inline const RenderBlock* toRenderBlock(const RenderObject* object)
1305 { 1308 {
1306 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderBlock()); 1309 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderBlock());
1307 return static_cast<const RenderBlock*>(object); 1310 return static_cast<const RenderBlock*>(object);
1308 } 1311 }
1309 1312
1310 // This will catch anyone doing an unnecessary cast. 1313 // This will catch anyone doing an unnecessary cast.
1311 void toRenderBlock(const RenderBlock*); 1314 void toRenderBlock(const RenderBlock*);
1312 1315
1313 #ifndef NDEBUG 1316 #ifndef NDEBUG
1314 // These structures are used by PODIntervalTree for debugging purposes. 1317 // These structures are used by PODIntervalTree for debugging purposes.
1315 template <> struct ValueToString<int> { 1318 template <> struct ValueToString<int> {
1316 static String string(const int value); 1319 static String string(const int value);
1317 }; 1320 };
1318 template<> struct ValueToString<RenderBlock::FloatingObject*> { 1321 template<> struct ValueToString<RenderBlock::FloatingObject*> {
1319 static String string(const RenderBlock::FloatingObject*); 1322 static String string(const RenderBlock::FloatingObject*);
1320 }; 1323 };
1321 #endif 1324 #endif
1322 1325
1323 } // namespace WebCore 1326 } // namespace WebCore
1324 1327
1325 #endif // RenderBlock_h 1328 #endif // RenderBlock_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698