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

Side by Side Diff: third_party/WebKit/Source/core/layout/line/InlineBox.h

Issue 2829683010: Optimize sizeof(InlineBox) by eliminating class layout padding (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/line/InlineBox.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) 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 LayoutPoint top_left, 56 LayoutPoint top_left,
57 LayoutUnit logical_width, 57 LayoutUnit logical_width,
58 bool first_line, 58 bool first_line,
59 bool constructed, 59 bool constructed,
60 bool dirty, 60 bool dirty,
61 bool extracted, 61 bool extracted,
62 bool is_horizontal, 62 bool is_horizontal,
63 InlineBox* next, 63 InlineBox* next,
64 InlineBox* prev, 64 InlineBox* prev,
65 InlineFlowBox* parent) 65 InlineFlowBox* parent)
66 : bitfields_(first_line, constructed, dirty, extracted, is_horizontal), 66 : next_(next),
67 next_(next),
68 prev_(prev), 67 prev_(prev),
69 parent_(parent), 68 parent_(parent),
70 line_layout_item_(item), 69 line_layout_item_(item),
71 location_(top_left), 70 location_(top_left),
72 logical_width_(logical_width) {} 71 logical_width_(logical_width),
72 bitfields_(first_line, constructed, dirty, extracted, is_horizontal) {}
73 73
74 virtual ~InlineBox(); 74 virtual ~InlineBox();
75 75
76 virtual void Destroy(); 76 virtual void Destroy();
77 77
78 virtual void DeleteLine(); 78 virtual void DeleteLine();
79 virtual void ExtractLine(); 79 virtual void ExtractLine();
80 virtual void AttachLine(); 80 virtual void AttachLine();
81 81
82 virtual bool IsLineBreak() const { return false; } 82 virtual bool IsLineBreak() const { return false; }
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 465
466 public: 466 public:
467 signed Expansion() const { return expansion_; } 467 signed Expansion() const { return expansion_; }
468 void SetExpansion(signed expansion) { expansion_ = expansion; } 468 void SetExpansion(signed expansion) { expansion_ = expansion; }
469 }; 469 };
470 #undef ADD_BOOLEAN_BITFIELD 470 #undef ADD_BOOLEAN_BITFIELD
471 471
472 private: 472 private:
473 void SetLineLayoutItemShouldDoFullPaintInvalidationIfNeeded(); 473 void SetLineLayoutItemShouldDoFullPaintInvalidationIfNeeded();
474 474
475 InlineBoxBitfields bitfields_;
476
477 InlineBox* next_; // The next element on the same line as us. 475 InlineBox* next_; // The next element on the same line as us.
478 InlineBox* prev_; // The previous element on the same line as us. 476 InlineBox* prev_; // The previous element on the same line as us.
479 477
480 InlineFlowBox* parent_; // The box that contains us. 478 InlineFlowBox* parent_; // The box that contains us.
481 LineLayoutItem line_layout_item_; 479 LineLayoutItem line_layout_item_;
482 480
483 protected: 481 protected:
484 // For RootInlineBox 482 // For RootInlineBox
485 bool EndsWithBreak() const { return bitfields_.EndsWithBreak(); } 483 bool EndsWithBreak() const { return bitfields_.EndsWithBreak(); }
486 void SetEndsWithBreak(bool ends_with_break) { 484 void SetEndsWithBreak(bool ends_with_break) {
(...skipping 26 matching lines...) Expand all
513 signed Expansion() { return bitfields_.Expansion(); } 511 signed Expansion() { return bitfields_.Expansion(); }
514 void SetExpansion(signed expansion) { bitfields_.SetExpansion(expansion); } 512 void SetExpansion(signed expansion) { bitfields_.SetExpansion(expansion); }
515 513
516 // For InlineFlowBox and InlineTextBox 514 // For InlineFlowBox and InlineTextBox
517 bool Extracted() const { return bitfields_.Extracted(); } 515 bool Extracted() const { return bitfields_.Extracted(); }
518 516
519 LayoutPoint location_; 517 LayoutPoint location_;
520 LayoutUnit logical_width_; 518 LayoutUnit logical_width_;
521 519
522 private: 520 private:
521 InlineBoxBitfields bitfields_;
522
523 #if DCHECK_IS_ON() 523 #if DCHECK_IS_ON()
524 bool has_bad_parent_ = false; 524 bool has_bad_parent_ = false;
525 #endif 525 #endif
526 }; 526 };
527 527
528 #if !DCHECK_IS_ON() 528 #if !DCHECK_IS_ON()
529 inline InlineBox::~InlineBox() {} 529 inline InlineBox::~InlineBox() {}
530 #endif 530 #endif
531 531
532 #if DCHECK_IS_ON() 532 #if DCHECK_IS_ON()
(...skipping 12 matching lines...) Expand all
545 545
546 } // namespace blink 546 } // namespace blink
547 547
548 #ifndef NDEBUG 548 #ifndef NDEBUG
549 // Outside the WebCore namespace for ease of invocation from gdb. 549 // Outside the WebCore namespace for ease of invocation from gdb.
550 void showTree(const blink::InlineBox*); 550 void showTree(const blink::InlineBox*);
551 void showLineTree(const blink::InlineBox*); 551 void showLineTree(const blink::InlineBox*);
552 #endif 552 #endif
553 553
554 #endif // InlineBox_h 554 #endif // InlineBox_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/line/InlineBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698