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

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

Issue 1974323002: Move inlineElementContinuation() to LayoutBlockFlow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Don't introduce unnecessary type checks. Created 4 years, 7 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 m_lineBoxes.deleteLineBoxes(); 106 m_lineBoxes.deleteLineBoxes();
107 107
108 LayoutBoxModelObject::willBeDestroyed(); 108 LayoutBoxModelObject::willBeDestroyed();
109 } 109 }
110 110
111 LayoutInline* LayoutInline::inlineElementContinuation() const 111 LayoutInline* LayoutInline::inlineElementContinuation() const
112 { 112 {
113 LayoutBoxModelObject* continuation = this->continuation(); 113 LayoutBoxModelObject* continuation = this->continuation();
114 if (!continuation || continuation->isInline()) 114 if (!continuation || continuation->isInline())
115 return toLayoutInline(continuation); 115 return toLayoutInline(continuation);
116 return toLayoutBlock(continuation)->inlineElementContinuation(); 116 return toLayoutBlockFlow(continuation)->inlineElementContinuation();
117 } 117 }
118 118
119 void LayoutInline::updateFromStyle() 119 void LayoutInline::updateFromStyle()
120 { 120 {
121 LayoutBoxModelObject::updateFromStyle(); 121 LayoutBoxModelObject::updateFromStyle();
122 122
123 // FIXME: Is this still needed. Was needed for run-ins, since run-in is cons idered a block display type. 123 // FIXME: Is this still needed. Was needed for run-ins, since run-in is cons idered a block display type.
124 setInline(true); 124 setInline(true);
125 125
126 // FIXME: Support transforms and reflections on inline flows someday. 126 // FIXME: Support transforms and reflections on inline flows someday.
127 setHasTransformRelatedProperty(false); 127 setHasTransformRelatedProperty(false);
128 setHasReflection(false); 128 setHasReflection(false);
129 } 129 }
130 130
131 static LayoutObject* inFlowPositionedInlineAncestor(LayoutObject* p) 131 static LayoutObject* inFlowPositionedInlineAncestor(LayoutObject* p)
132 { 132 {
133 while (p && p->isLayoutInline()) { 133 while (p && p->isLayoutInline()) {
134 if (p->isInFlowPositioned()) 134 if (p->isInFlowPositioned())
135 return p; 135 return p;
136 p = p->parent(); 136 p = p->parent();
137 } 137 }
138 return nullptr; 138 return nullptr;
139 } 139 }
140 140
141 static void updateInFlowPositionOfAnonymousBlockContinuations(LayoutObject* bloc k, const ComputedStyle& newStyle, const ComputedStyle& oldStyle, LayoutObject* c ontainingBlockOfEndOfContinuation) 141 static void updateInFlowPositionOfAnonymousBlockContinuations(LayoutObject* bloc k, const ComputedStyle& newStyle, const ComputedStyle& oldStyle, LayoutObject* c ontainingBlockOfEndOfContinuation)
szager1 2016/05/13 22:08:48 Similarly, this seems like it could be refactored
mstensho (USE GERRIT) 2016/05/15 18:48:37 Definitely food for thought, but maybe we can deal
142 { 142 {
143 for (; block && block != containingBlockOfEndOfContinuation && block->isAnon ymousBlock(); block = block->nextSibling()) { 143 for (; block && block != containingBlockOfEndOfContinuation && block->isAnon ymousBlock(); block = block->nextSibling()) {
144 if (!toLayoutBlock(block)->isAnonymousBlockContinuation()) 144 LayoutBlockFlow* blockFlow = toLayoutBlockFlow(block);
145 if (!blockFlow->isAnonymousBlockContinuation())
145 continue; 146 continue;
146 147
147 // If we are no longer in-flow positioned but our descendant block(s) st ill have an in-flow positioned ancestor then 148 // If we are no longer in-flow positioned but our descendant block(s) st ill have an in-flow positioned ancestor then
148 // their containing anonymous block should keep its in-flow positioning. 149 // their containing anonymous block should keep its in-flow positioning.
149 if (oldStyle.hasInFlowPosition() && inFlowPositionedInlineAncestor(toLay outBlock(block)->inlineElementContinuation())) 150 if (oldStyle.hasInFlowPosition() && inFlowPositionedInlineAncestor(block Flow->inlineElementContinuation()))
150 continue; 151 continue;
151 152
152 RefPtr<ComputedStyle> newBlockStyle = ComputedStyle::clone(block->styleR ef()); 153 RefPtr<ComputedStyle> newBlockStyle = ComputedStyle::clone(block->styleR ef());
153 newBlockStyle->setPosition(newStyle.position()); 154 newBlockStyle->setPosition(newStyle.position());
154 block->setStyle(newBlockStyle); 155 block->setStyle(newBlockStyle);
155 } 156 }
156 } 157 }
157 158
158 void LayoutInline::styleDidChange(StyleDifference diff, const ComputedStyle* old Style) 159 void LayoutInline::styleDidChange(StyleDifference diff, const ComputedStyle* old Style)
159 { 160 {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 beforeChild = beforeChild->parent(); 268 beforeChild = beforeChild->parent();
268 if (continuation()) 269 if (continuation())
269 return addChildToContinuation(newChild, beforeChild); 270 return addChildToContinuation(newChild, beforeChild);
270 return addChildIgnoringContinuation(newChild, beforeChild); 271 return addChildIgnoringContinuation(newChild, beforeChild);
271 } 272 }
272 273
273 static LayoutBoxModelObject* nextContinuation(LayoutObject* layoutObject) 274 static LayoutBoxModelObject* nextContinuation(LayoutObject* layoutObject)
274 { 275 {
275 if (layoutObject->isInline() && !layoutObject->isAtomicInlineLevel()) 276 if (layoutObject->isInline() && !layoutObject->isAtomicInlineLevel())
276 return toLayoutInline(layoutObject)->continuation(); 277 return toLayoutInline(layoutObject)->continuation();
277 return toLayoutBlock(layoutObject)->inlineElementContinuation(); 278 return toLayoutBlockFlow(layoutObject)->inlineElementContinuation();
278 } 279 }
279 280
280 LayoutBoxModelObject* LayoutInline::continuationBefore(LayoutObject* beforeChild ) 281 LayoutBoxModelObject* LayoutInline::continuationBefore(LayoutObject* beforeChild )
281 { 282 {
282 if (beforeChild && beforeChild->parent() == this) 283 if (beforeChild && beforeChild->parent() == this)
283 return this; 284 return this;
284 285
285 LayoutBoxModelObject* curr = nextContinuation(this); 286 LayoutBoxModelObject* curr = nextContinuation(this);
286 LayoutBoxModelObject* nextToLast = this; 287 LayoutBoxModelObject* nextToLast = this;
287 LayoutBoxModelObject* last = this; 288 LayoutBoxModelObject* last = this;
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 return cb->positionForPoint(point); 833 return cb->positionForPoint(point);
833 } 834 }
834 835
835 // Translate the coords from the pre-anonymous block to the post-anonymous b lock. 836 // Translate the coords from the pre-anonymous block to the post-anonymous b lock.
836 LayoutPoint parentBlockPoint = cb->location() + point; 837 LayoutPoint parentBlockPoint = cb->location() + point;
837 LayoutBoxModelObject* c = continuation(); 838 LayoutBoxModelObject* c = continuation();
838 while (c) { 839 while (c) {
839 LayoutBox* contBlock = c->isInline() ? c->containingBlock() : toLayoutBl ock(c); 840 LayoutBox* contBlock = c->isInline() ? c->containingBlock() : toLayoutBl ock(c);
840 if (c->isInline() || c->slowFirstChild()) 841 if (c->isInline() || c->slowFirstChild())
841 return c->positionForPoint(parentBlockPoint - contBlock->locationOff set()); 842 return c->positionForPoint(parentBlockPoint - contBlock->locationOff set());
842 c = toLayoutBlock(c)->inlineElementContinuation(); 843 c = toLayoutBlockFlow(c)->inlineElementContinuation();
843 } 844 }
844 845
845 return LayoutBoxModelObject::positionForPoint(point); 846 return LayoutBoxModelObject::positionForPoint(point);
846 } 847 }
847 848
848 namespace { 849 namespace {
849 850
850 class LinesBoundingBoxGeneratorContext { 851 class LinesBoundingBoxGeneratorContext {
851 public: 852 public:
852 LinesBoundingBoxGeneratorContext(FloatRect& rect) : m_rect(rect) { } 853 LinesBoundingBoxGeneratorContext(FloatRect& rect) : m_rect(rect) { }
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 1360
1360 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const 1361 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const
1361 { 1362 {
1362 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason); 1363 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason);
1363 1364
1364 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) 1365 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
1365 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason); 1366 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason);
1366 } 1367 }
1367 1368
1368 } // namespace blink 1369 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698