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

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

Issue 143323014: *** DO NOT LAND *** Attempt to understand Regions complexity Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderTable.h ('k') | Source/core/rendering/RenderTableSection.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) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights reserved.
8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 setLogicalWidth(convertStyleLogicalWidthToComputedWidth(styleLogicalWidt h, containerWidthInInlineDirection)); 268 setLogicalWidth(convertStyleLogicalWidthToComputedWidth(styleLogicalWidt h, containerWidthInInlineDirection));
269 else { 269 else {
270 // Subtract out any fixed margins from our available width for auto widt h tables. 270 // Subtract out any fixed margins from our available width for auto widt h tables.
271 LayoutUnit marginStart = minimumValueForLength(style()->marginStart(), a vailableLogicalWidth); 271 LayoutUnit marginStart = minimumValueForLength(style()->marginStart(), a vailableLogicalWidth);
272 LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd(), avail ableLogicalWidth); 272 LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd(), avail ableLogicalWidth);
273 LayoutUnit marginTotal = marginStart + marginEnd; 273 LayoutUnit marginTotal = marginStart + marginEnd;
274 274
275 // Subtract out our margins to get the available content width. 275 // Subtract out our margins to get the available content width.
276 LayoutUnit availableContentLogicalWidth = max<LayoutUnit>(0, containerWi dthInInlineDirection - marginTotal); 276 LayoutUnit availableContentLogicalWidth = max<LayoutUnit>(0, containerWi dthInInlineDirection - marginTotal);
277 if (shrinkToAvoidFloats() && cb->containsFloats() && !hasPerpendicularCo ntainingBlock) { 277 if (shrinkToAvoidFloats() && cb->containsFloats() && !hasPerpendicularCo ntainingBlock) {
278 // FIXME: Work with regions someday. 278 availableContentLogicalWidth = shrinkLogicalWidthToAvoidFloats(margi nStart, marginEnd, toRenderBlockFlow(cb));
279 availableContentLogicalWidth = shrinkLogicalWidthToAvoidFloats(margi nStart, marginEnd, toRenderBlockFlow(cb), 0);
280 } 279 }
281 280
282 // Ensure we aren't bigger than our available width. 281 // Ensure we aren't bigger than our available width.
283 setLogicalWidth(min<int>(availableContentLogicalWidth, maxPreferredLogic alWidth())); 282 setLogicalWidth(min<int>(availableContentLogicalWidth, maxPreferredLogic alWidth()));
284 } 283 }
285 284
286 // Ensure we aren't bigger than our max-width style. 285 // Ensure we aren't bigger than our max-width style.
287 Length styleMaxLogicalWidth = style()->logicalMaxWidth(); 286 Length styleMaxLogicalWidth = style()->logicalMaxWidth();
288 if ((styleMaxLogicalWidth.isSpecified() && !styleMaxLogicalWidth.isNegative( )) || styleMaxLogicalWidth.isIntrinsic()) { 287 if ((styleMaxLogicalWidth.isSpecified() && !styleMaxLogicalWidth.isNegative( )) || styleMaxLogicalWidth.isIntrinsic()) {
289 LayoutUnit computedMaxLogicalWidth = convertStyleLogicalWidthToComputedW idth(styleMaxLogicalWidth, availableLogicalWidth); 288 LayoutUnit computedMaxLogicalWidth = convertStyleLogicalWidthToComputedW idth(styleMaxLogicalWidth, availableLogicalWidth);
(...skipping 10 matching lines...) Expand all
300 LayoutUnit computedMinLogicalWidth = convertStyleLogicalWidthToComputedW idth(styleMinLogicalWidth, availableLogicalWidth); 299 LayoutUnit computedMinLogicalWidth = convertStyleLogicalWidthToComputedW idth(styleMinLogicalWidth, availableLogicalWidth);
301 setLogicalWidth(max<int>(logicalWidth(), computedMinLogicalWidth)); 300 setLogicalWidth(max<int>(logicalWidth(), computedMinLogicalWidth));
302 } 301 }
303 302
304 // Finally, with our true width determined, compute our margins for real. 303 // Finally, with our true width determined, compute our margins for real.
305 setMarginStart(0); 304 setMarginStart(0);
306 setMarginEnd(0); 305 setMarginEnd(0);
307 if (!hasPerpendicularContainingBlock) { 306 if (!hasPerpendicularContainingBlock) {
308 LayoutUnit containerLogicalWidthForAutoMargins = availableLogicalWidth; 307 LayoutUnit containerLogicalWidthForAutoMargins = availableLogicalWidth;
309 if (avoidsFloats() && cb->containsFloats()) 308 if (avoidsFloats() && cb->containsFloats())
310 containerLogicalWidthForAutoMargins = containingBlockAvailableLineWi dthInRegion(0); // FIXME: Work with regions someday. 309 containerLogicalWidthForAutoMargins = containingBlockAvailableLineWi dth();
311 ComputedMarginValues marginValues; 310 ComputedMarginValues marginValues;
312 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() == st yle()->isLeftToRightDirection(); 311 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() == st yle()->isLeftToRightDirection();
313 computeInlineDirectionMargins(cb, containerLogicalWidthForAutoMargins, l ogicalWidth(), 312 computeInlineDirectionMargins(cb, containerLogicalWidthForAutoMargins, l ogicalWidth(),
314 hasInvertedDirection ? marginValues.m_start : marginValues.m_end, 313 hasInvertedDirection ? marginValues.m_start : marginValues.m_end,
315 hasInvertedDirection ? marginValues.m_end : marginValues.m_start); 314 hasInvertedDirection ? marginValues.m_end : marginValues.m_start);
316 setMarginStart(marginValues.m_start); 315 setMarginStart(marginValues.m_start);
317 setMarginEnd(marginValues.m_end); 316 setMarginEnd(marginValues.m_end);
318 } else { 317 } else {
319 setMarginStart(minimumValueForLength(style()->marginStart(), availableLo gicalWidth)); 318 setMarginStart(minimumValueForLength(style()->marginStart(), availableLo gicalWidth));
320 setMarginEnd(minimumValueForLength(style()->marginEnd(), availableLogica lWidth)); 319 setMarginEnd(minimumValueForLength(style()->marginEnd(), availableLogica lWidth));
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 return -1; 1367 return -1;
1369 1368
1370 int baseline = topNonEmptySection->firstLineBoxBaseline(); 1369 int baseline = topNonEmptySection->firstLineBoxBaseline();
1371 if (baseline > 0) 1370 if (baseline > 0)
1372 return topNonEmptySection->logicalTop() + baseline; 1371 return topNonEmptySection->logicalTop() + baseline;
1373 1372
1374 // FIXME: A table row always has a baseline per CSS 2.1. Will this return th e right value? 1373 // FIXME: A table row always has a baseline per CSS 2.1. Will this return th e right value?
1375 return -1; 1374 return -1;
1376 } 1375 }
1377 1376
1378 LayoutRect RenderTable::overflowClipRect(const LayoutPoint& location, RenderRegi on* region, OverlayScrollbarSizeRelevancy relevancy) 1377 LayoutRect RenderTable::overflowClipRect(const LayoutPoint& location, OverlayScr ollbarSizeRelevancy relevancy)
1379 { 1378 {
1380 LayoutRect rect = RenderBlock::overflowClipRect(location, region, relevancy) ; 1379 LayoutRect rect = RenderBlock::overflowClipRect(location, relevancy);
1381 1380
1382 // If we have a caption, expand the clip to include the caption. 1381 // If we have a caption, expand the clip to include the caption.
1383 // FIXME: Technically this is wrong, but it's virtually impossible to fix th is 1382 // FIXME: Technically this is wrong, but it's virtually impossible to fix th is
1384 // for real until captions have been re-written. 1383 // for real until captions have been re-written.
1385 // FIXME: This code assumes (like all our other caption code) that only top/ bottom are 1384 // FIXME: This code assumes (like all our other caption code) that only top/ bottom are
1386 // supported. When we actually support left/right and stop mapping them to top/bottom, 1385 // supported. When we actually support left/right and stop mapping them to top/bottom,
1387 // we might have to hack this code first (depending on what order we do thes e bug fixes in). 1386 // we might have to hack this code first (depending on what order we do thes e bug fixes in).
1388 if (!m_captions.isEmpty()) { 1387 if (!m_captions.isEmpty()) {
1389 if (style()->isHorizontalWritingMode()) { 1388 if (style()->isHorizontalWritingMode()) {
1390 rect.setHeight(height()); 1389 rect.setHeight(height());
1391 rect.setY(location.y()); 1390 rect.setY(location.y());
1392 } else { 1391 } else {
1393 rect.setWidth(width()); 1392 rect.setWidth(width());
1394 rect.setX(location.x()); 1393 rect.setX(location.x());
1395 } 1394 }
1396 } 1395 }
1397 1396
1398 return rect; 1397 return rect;
1399 } 1398 }
1400 1399
1401 bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf fset, HitTestAction action) 1400 bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf fset, HitTestAction action)
1402 { 1401 {
1403 LayoutPoint adjustedLocation = accumulatedOffset + location(); 1402 LayoutPoint adjustedLocation = accumulatedOffset + location();
1404 1403
1405 // Check kids first. 1404 // Check kids first.
1406 if (!hasOverflowClip() || locationInContainer.intersects(overflowClipRect(ad justedLocation, locationInContainer.region()))) { 1405 if (!hasOverflowClip() || locationInContainer.intersects(overflowClipRect(ad justedLocation))) {
1407 for (RenderObject* child = lastChild(); child; child = child->previousSi bling()) { 1406 for (RenderObject* child = lastChild(); child; child = child->previousSi bling()) {
1408 if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child->isTableCaption())) { 1407 if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child->isTableCaption())) {
1409 LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox( child), adjustedLocation); 1408 LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox( child), adjustedLocation);
1410 if (child->nodeAtPoint(request, result, locationInContainer, chi ldPoint, action)) { 1409 if (child->nodeAtPoint(request, result, locationInContainer, chi ldPoint, action)) {
1411 updateHitTestResult(result, toLayoutPoint(locationInContaine r.point() - childPoint)); 1410 updateHitTestResult(result, toLayoutPoint(locationInContaine r.point() - childPoint));
1412 return true; 1411 return true;
1413 } 1412 }
1414 } 1413 }
1415 } 1414 }
1416 } 1415 }
(...skipping 30 matching lines...) Expand all
1447 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const 1446 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const
1448 { 1447 {
1449 ASSERT(cell->isFirstOrLastCellInRow()); 1448 ASSERT(cell->isFirstOrLastCellInRow());
1450 if (hasSameDirectionAs(cell->row())) 1449 if (hasSameDirectionAs(cell->row()))
1451 return style()->borderEnd(); 1450 return style()->borderEnd();
1452 1451
1453 return style()->borderStart(); 1452 return style()->borderStart();
1454 } 1453 }
1455 1454
1456 } 1455 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderTable.h ('k') | Source/core/rendering/RenderTableSection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698