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

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

Issue 1828163002: Remove ASSERT_ARG(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 bool LayoutRubyBase::isChildAllowed(LayoutObject* child, const ComputedStyle&) c onst 54 bool LayoutRubyBase::isChildAllowed(LayoutObject* child, const ComputedStyle&) c onst
55 { 55 {
56 return child->isInline(); 56 return child->isInline();
57 } 57 }
58 58
59 void LayoutRubyBase::moveChildren(LayoutRubyBase* toBase, LayoutObject* beforeCh ild) 59 void LayoutRubyBase::moveChildren(LayoutRubyBase* toBase, LayoutObject* beforeCh ild)
60 { 60 {
61 // This function removes all children that are before (!) beforeChild 61 // This function removes all children that are before (!) beforeChild
62 // and appends them to toBase. 62 // and appends them to toBase.
63 ASSERT_ARG(toBase, toBase); 63 DCHECK(toBase);
64 // Callers should have handled the percent height descendant map. 64 // Callers should have handled the percent height descendant map.
65 ASSERT(!hasPercentHeightDescendants()); 65 ASSERT(!hasPercentHeightDescendants());
66 66
67 if (beforeChild && beforeChild->parent() != this) 67 if (beforeChild && beforeChild->parent() != this)
68 beforeChild = splitAnonymousBoxesAroundChild(beforeChild); 68 beforeChild = splitAnonymousBoxesAroundChild(beforeChild);
69 69
70 if (childrenInline()) 70 if (childrenInline())
71 moveInlineChildren(toBase, beforeChild); 71 moveInlineChildren(toBase, beforeChild);
72 else 72 else
73 moveBlockChildren(toBase, beforeChild); 73 moveBlockChildren(toBase, beforeChild);
74 74
75 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalidation Reason::Unknown); 75 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalidation Reason::Unknown);
76 toBase->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInva lidationReason::Unknown); 76 toBase->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInva lidationReason::Unknown);
77 } 77 }
78 78
79 void LayoutRubyBase::moveInlineChildren(LayoutRubyBase* toBase, LayoutObject* be foreChild) 79 void LayoutRubyBase::moveInlineChildren(LayoutRubyBase* toBase, LayoutObject* be foreChild)
80 { 80 {
81 ASSERT(childrenInline()); 81 ASSERT(childrenInline());
82 ASSERT_ARG(toBase, toBase); 82 DCHECK(toBase);
83 83
84 if (!firstChild()) 84 if (!firstChild())
85 return; 85 return;
86 86
87 LayoutBlock* toBlock; 87 LayoutBlock* toBlock;
88 if (toBase->childrenInline()) { 88 if (toBase->childrenInline()) {
89 // The standard and easy case: move the children into the target base 89 // The standard and easy case: move the children into the target base
90 toBlock = toBase; 90 toBlock = toBase;
91 } else { 91 } else {
92 // We need to wrap the inline objects into an anonymous block. 92 // We need to wrap the inline objects into an anonymous block.
93 // If toBase has a suitable block, we re-use it, otherwise create a new one. 93 // If toBase has a suitable block, we re-use it, otherwise create a new one.
94 LayoutObject* lastChild = toBase->lastChild(); 94 LayoutObject* lastChild = toBase->lastChild();
95 if (lastChild && lastChild->isAnonymousBlock() && lastChild->childrenInl ine()) { 95 if (lastChild && lastChild->isAnonymousBlock() && lastChild->childrenInl ine()) {
96 toBlock = toLayoutBlock(lastChild); 96 toBlock = toLayoutBlock(lastChild);
97 } else { 97 } else {
98 toBlock = toBase->createAnonymousBlock(); 98 toBlock = toBase->createAnonymousBlock();
99 toBase->children()->appendChildNode(toBase, toBlock); 99 toBase->children()->appendChildNode(toBase, toBlock);
100 } 100 }
101 } 101 }
102 // Move our inline children into the target block we determined above. 102 // Move our inline children into the target block we determined above.
103 moveChildrenTo(toBlock, firstChild(), beforeChild); 103 moveChildrenTo(toBlock, firstChild(), beforeChild);
104 } 104 }
105 105
106 void LayoutRubyBase::moveBlockChildren(LayoutRubyBase* toBase, LayoutObject* bef oreChild) 106 void LayoutRubyBase::moveBlockChildren(LayoutRubyBase* toBase, LayoutObject* bef oreChild)
107 { 107 {
108 ASSERT(!childrenInline()); 108 ASSERT(!childrenInline());
109 ASSERT_ARG(toBase, toBase); 109 DCHECK(toBase);
110 110
111 if (!firstChild()) 111 if (!firstChild())
112 return; 112 return;
113 113
114 if (toBase->childrenInline()) 114 if (toBase->childrenInline())
115 toBase->makeChildrenNonInline(); 115 toBase->makeChildrenNonInline();
116 116
117 // If an anonymous block would be put next to another such block, then merge those. 117 // If an anonymous block would be put next to another such block, then merge those.
118 LayoutObject* firstChildHere = firstChild(); 118 LayoutObject* firstChildHere = firstChild();
119 LayoutObject* lastChildThere = toBase->lastChild(); 119 LayoutObject* lastChildThere = toBase->lastChild();
(...skipping 25 matching lines...) Expand all
145 expansionOpportunityCount = maxCount; 145 expansionOpportunityCount = maxCount;
146 146
147 // Inset the ruby base by half the inter-ideograph expansion amount. 147 // Inset the ruby base by half the inter-ideograph expansion amount.
148 LayoutUnit inset = (logicalWidth - maxPreferredLogicalWidth) / (expansionOpp ortunityCount + 1); 148 LayoutUnit inset = (logicalWidth - maxPreferredLogicalWidth) / (expansionOpp ortunityCount + 1);
149 149
150 logicalLeft += inset / 2; 150 logicalLeft += inset / 2;
151 logicalWidth -= inset; 151 logicalWidth -= inset;
152 } 152 }
153 153
154 } // namespace blink 154 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698