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

Side by Side Diff: Source/core/rendering/InlineFlowBox.cpp

Issue 182413005: Return refererence from InlineBox::root() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: re-upload because previous patch didn't upload correctly. Created 6 years, 9 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) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 checkConsistency(); 177 checkConsistency();
178 } 178 }
179 179
180 void InlineFlowBox::removeChild(InlineBox* child) 180 void InlineFlowBox::removeChild(InlineBox* child)
181 { 181 {
182 checkConsistency(); 182 checkConsistency();
183 183
184 if (!isDirty()) 184 if (!isDirty())
185 dirtyLineBoxes(); 185 dirtyLineBoxes();
186 186
187 root()->childRemoved(child); 187 root().childRemoved(child);
188 188
189 if (child == m_firstChild) 189 if (child == m_firstChild)
190 m_firstChild = child->nextOnLine(); 190 m_firstChild = child->nextOnLine();
191 if (child == m_lastChild) 191 if (child == m_lastChild)
192 m_lastChild = child->prevOnLine(); 192 m_lastChild = child->prevOnLine();
193 if (child->nextOnLine()) 193 if (child->nextOnLine())
194 child->nextOnLine()->setPrevOnLine(child->prevOnLine()); 194 child->nextOnLine()->setPrevOnLine(child->prevOnLine());
195 if (child->prevOnLine()) 195 if (child->prevOnLine())
196 child->prevOnLine()->setNextOnLine(child->nextOnLine()); 196 child->prevOnLine()->setNextOnLine(child->nextOnLine());
197 197
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 if (knownToHaveNoOverflow()) 394 if (knownToHaveNoOverflow())
395 maxLogicalRight = max(logicalLeft, maxLogicalRight); 395 maxLogicalRight = max(logicalLeft, maxLogicalRight);
396 } else { 396 } else {
397 if (curr->renderer().isOutOfFlowPositioned()) { 397 if (curr->renderer().isOutOfFlowPositioned()) {
398 if (curr->renderer().parent()->style()->isLeftToRightDirection() ) { 398 if (curr->renderer().parent()->style()->isLeftToRightDirection() ) {
399 curr->setLogicalLeft(logicalLeft); 399 curr->setLogicalLeft(logicalLeft);
400 } else { 400 } else {
401 // Our offset that we cache needs to be from the edge of the right border box and 401 // Our offset that we cache needs to be from the edge of the right border box and
402 // not the left border box. We have to subtract |x| from th e width of the block 402 // not the left border box. We have to subtract |x| from th e width of the block
403 // (which can be obtained from the root line box). 403 // (which can be obtained from the root line box).
404 curr->setLogicalLeft(root()->block().logicalWidth() - logica lLeft); 404 curr->setLogicalLeft(root().block().logicalWidth() - logical Left);
405 } 405 }
406 continue; // The positioned object has no effect on the width. 406 continue; // The positioned object has no effect on the width.
407 } 407 }
408 if (curr->renderer().isRenderInline()) { 408 if (curr->renderer().isRenderInline()) {
409 InlineFlowBox* flow = toInlineFlowBox(curr); 409 InlineFlowBox* flow = toInlineFlowBox(curr);
410 logicalLeft += flow->marginLogicalLeft(); 410 logicalLeft += flow->marginLogicalLeft();
411 if (knownToHaveNoOverflow()) 411 if (knownToHaveNoOverflow())
412 minLogicalLeft = min(logicalLeft, minLogicalLeft); 412 minLogicalLeft = min(logicalLeft, minLogicalLeft);
413 logicalLeft = flow->placeBoxesInInlineDirection(logicalLeft, nee dsWordSpacing, textBoxDataMap); 413 logicalLeft = flow->placeBoxesInInlineDirection(logicalLeft, nee dsWordSpacing, textBoxDataMap);
414 if (knownToHaveNoOverflow()) 414 if (knownToHaveNoOverflow())
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 // Now check ourselves. Pixel snap hit testing. 1037 // Now check ourselves. Pixel snap hit testing.
1038 LayoutRect frameRect = roundedFrameRect(); 1038 LayoutRect frameRect = roundedFrameRect();
1039 LayoutUnit minX = frameRect.x(); 1039 LayoutUnit minX = frameRect.x();
1040 LayoutUnit minY = frameRect.y(); 1040 LayoutUnit minY = frameRect.y();
1041 LayoutUnit width = frameRect.width(); 1041 LayoutUnit width = frameRect.width();
1042 LayoutUnit height = frameRect.height(); 1042 LayoutUnit height = frameRect.height();
1043 1043
1044 // Constrain our hit testing to the line top and bottom if necessary. 1044 // Constrain our hit testing to the line top and bottom if necessary.
1045 bool noQuirksMode = renderer().document().inNoQuirksMode(); 1045 bool noQuirksMode = renderer().document().inNoQuirksMode();
1046 if (!noQuirksMode && !hasTextChildren() && !(descendantsHaveSameLineHeightAn dBaseline() && hasTextDescendants())) { 1046 if (!noQuirksMode && !hasTextChildren() && !(descendantsHaveSameLineHeightAn dBaseline() && hasTextDescendants())) {
1047 RootInlineBox* rootBox = root(); 1047 RootInlineBox& rootBox = root();
1048 LayoutUnit& top = isHorizontal() ? minY : minX; 1048 LayoutUnit& top = isHorizontal() ? minY : minX;
1049 LayoutUnit& logicalHeight = isHorizontal() ? height : width; 1049 LayoutUnit& logicalHeight = isHorizontal() ? height : width;
1050 LayoutUnit bottom = min(rootBox->lineBottom(), top + logicalHeight); 1050 LayoutUnit bottom = min(rootBox.lineBottom(), top + logicalHeight);
1051 top = max(rootBox->lineTop(), top); 1051 top = max(rootBox.lineTop(), top);
1052 logicalHeight = bottom - top; 1052 logicalHeight = bottom - top;
1053 } 1053 }
1054 1054
1055 // Move x/y to our coordinates. 1055 // Move x/y to our coordinates.
1056 LayoutRect rect(minX, minY, width, height); 1056 LayoutRect rect(minX, minY, width, height);
1057 flipForWritingMode(rect); 1057 flipForWritingMode(rect);
1058 rect.moveBy(accumulatedOffset); 1058 rect.moveBy(accumulatedOffset);
1059 1059
1060 if (visibleToHitTestRequest(request) && locationInContainer.intersects(rect) ) { 1060 if (visibleToHitTestRequest(request) && locationInContainer.intersects(rect) ) {
1061 renderer().updateHitTestResult(result, flipForWritingMode(locationInCont ainer.point() - toLayoutSize(accumulatedOffset))); // Don't add in m_x or m_y he re, we want coords in the containing block's space. 1061 renderer().updateHitTestResult(result, flipForWritingMode(locationInCont ainer.point() - toLayoutSize(accumulatedOffset))); // Don't add in m_x or m_y he re, we want coords in the containing block's space.
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 // FIXME: We can do better here in the multi-line case. We want to push a clip so that the shadow doesn't 1205 // FIXME: We can do better here in the multi-line case. We want to push a clip so that the shadow doesn't
1206 // protrude incorrectly at the edges, and we want to possibly include sh adows cast from the previous/following lines 1206 // protrude incorrectly at the edges, and we want to possibly include sh adows cast from the previous/following lines
1207 boxModelObject()->paintBoxShadow(info, paintRect, s, shadowStyle, includ eLogicalLeftEdge(), includeLogicalRightEdge()); 1207 boxModelObject()->paintBoxShadow(info, paintRect, s, shadowStyle, includ eLogicalLeftEdge(), includeLogicalRightEdge());
1208 } 1208 }
1209 } 1209 }
1210 1210
1211 void InlineFlowBox::constrainToLineTopAndBottomIfNeeded(LayoutRect& rect) const 1211 void InlineFlowBox::constrainToLineTopAndBottomIfNeeded(LayoutRect& rect) const
1212 { 1212 {
1213 bool noQuirksMode = renderer().document().inNoQuirksMode(); 1213 bool noQuirksMode = renderer().document().inNoQuirksMode();
1214 if (!noQuirksMode && !hasTextChildren() && !(descendantsHaveSameLineHeightAn dBaseline() && hasTextDescendants())) { 1214 if (!noQuirksMode && !hasTextChildren() && !(descendantsHaveSameLineHeightAn dBaseline() && hasTextDescendants())) {
1215 const RootInlineBox* rootBox = root(); 1215 const RootInlineBox& rootBox = root();
1216 LayoutUnit logicalTop = isHorizontal() ? rect.y() : rect.x(); 1216 LayoutUnit logicalTop = isHorizontal() ? rect.y() : rect.x();
1217 LayoutUnit logicalHeight = isHorizontal() ? rect.height() : rect.width() ; 1217 LayoutUnit logicalHeight = isHorizontal() ? rect.height() : rect.width() ;
1218 LayoutUnit bottom = min(rootBox->lineBottom(), logicalTop + logicalHeigh t); 1218 LayoutUnit bottom = min(rootBox.lineBottom(), logicalTop + logicalHeight );
1219 logicalTop = max(rootBox->lineTop(), logicalTop); 1219 logicalTop = max(rootBox.lineTop(), logicalTop);
1220 logicalHeight = bottom - logicalTop; 1220 logicalHeight = bottom - logicalTop;
1221 if (isHorizontal()) { 1221 if (isHorizontal()) {
1222 rect.setY(logicalTop); 1222 rect.setY(logicalTop);
1223 rect.setHeight(logicalHeight); 1223 rect.setHeight(logicalHeight);
1224 } else { 1224 } else {
1225 rect.setX(logicalTop); 1225 rect.setX(logicalTop);
1226 rect.setWidth(logicalHeight); 1226 rect.setWidth(logicalHeight);
1227 } 1227 }
1228 } 1228 }
1229 } 1229 }
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 ASSERT(child->prevOnLine() == prev); 1638 ASSERT(child->prevOnLine() == prev);
1639 prev = child; 1639 prev = child;
1640 } 1640 }
1641 ASSERT(prev == m_lastChild); 1641 ASSERT(prev == m_lastChild);
1642 #endif 1642 #endif
1643 } 1643 }
1644 1644
1645 #endif 1645 #endif
1646 1646
1647 } // namespace WebCore 1647 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698