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

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

Issue 153233002: *** DO NOT LAND *** Remove regions support, keeping a bare minimum to support "region-based"... (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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 | « 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 if ((styleLogicalWidth.isSpecified() && styleLogicalWidth.isPositive()) || s tyleLogicalWidth.isIntrinsic()) 267 if ((styleLogicalWidth.isSpecified() && styleLogicalWidth.isPositive()) || s tyleLogicalWidth.isIntrinsic())
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 }
281 279
282 // Ensure we aren't bigger than our available width. 280 // Ensure we aren't bigger than our available width.
283 setLogicalWidth(min<int>(availableContentLogicalWidth, maxPreferredLogic alWidth())); 281 setLogicalWidth(min<int>(availableContentLogicalWidth, maxPreferredLogic alWidth()));
284 } 282 }
285 283
286 // Ensure we aren't bigger than our max-width style. 284 // Ensure we aren't bigger than our max-width style.
287 Length styleMaxLogicalWidth = style()->logicalMaxWidth(); 285 Length styleMaxLogicalWidth = style()->logicalMaxWidth();
288 if ((styleMaxLogicalWidth.isSpecified() && !styleMaxLogicalWidth.isNegative( )) || styleMaxLogicalWidth.isIntrinsic()) { 286 if ((styleMaxLogicalWidth.isSpecified() && !styleMaxLogicalWidth.isNegative( )) || styleMaxLogicalWidth.isIntrinsic()) {
289 LayoutUnit computedMaxLogicalWidth = convertStyleLogicalWidthToComputedW idth(styleMaxLogicalWidth, availableLogicalWidth); 287 LayoutUnit computedMaxLogicalWidth = convertStyleLogicalWidthToComputedW idth(styleMaxLogicalWidth, availableLogicalWidth);
290 setLogicalWidth(min<int>(logicalWidth(), computedMaxLogicalWidth)); 288 setLogicalWidth(min<int>(logicalWidth(), computedMaxLogicalWidth));
291 } 289 }
292 290
293 // Ensure we aren't smaller than our min preferred width. This MUST be done after 'max-width' as 291 // Ensure we aren't smaller than our min preferred width. This MUST be done after 'max-width' as
294 // we ignore it if it means we wouldn't accomodate our content. 292 // we ignore it if it means we wouldn't accomodate our content.
295 setLogicalWidth(max<int>(logicalWidth(), minPreferredLogicalWidth())); 293 setLogicalWidth(max<int>(logicalWidth(), minPreferredLogicalWidth()));
296 294
297 // Ensure we aren't smaller than our min-width style. 295 // Ensure we aren't smaller than our min-width style.
298 Length styleMinLogicalWidth = style()->logicalMinWidth(); 296 Length styleMinLogicalWidth = style()->logicalMinWidth();
299 if ((styleMinLogicalWidth.isSpecified() && !styleMinLogicalWidth.isNegative( )) || styleMinLogicalWidth.isIntrinsic()) { 297 if ((styleMinLogicalWidth.isSpecified() && !styleMinLogicalWidth.isNegative( )) || styleMinLogicalWidth.isIntrinsic()) {
300 LayoutUnit computedMinLogicalWidth = convertStyleLogicalWidthToComputedW idth(styleMinLogicalWidth, availableLogicalWidth); 298 LayoutUnit computedMinLogicalWidth = convertStyleLogicalWidthToComputedW idth(styleMinLogicalWidth, availableLogicalWidth);
301 setLogicalWidth(max<int>(logicalWidth(), computedMinLogicalWidth)); 299 setLogicalWidth(max<int>(logicalWidth(), computedMinLogicalWidth));
302 } 300 }
303 301
304 // Finally, with our true width determined, compute our margins for real. 302 // Finally, with our true width determined, compute our margins for real.
305 setMarginStart(0); 303 setMarginStart(0);
306 setMarginEnd(0); 304 setMarginEnd(0);
307 if (!hasPerpendicularContainingBlock) { 305 if (!hasPerpendicularContainingBlock) {
308 LayoutUnit containerLogicalWidthForAutoMargins = availableLogicalWidth; 306 LayoutUnit containerLogicalWidthForAutoMargins = availableLogicalWidth;
309 if (avoidsFloats() && cb->containsFloats()) 307 if (avoidsFloats() && cb->containsFloats())
310 containerLogicalWidthForAutoMargins = containingBlockAvailableLineWi dthInRegion(0); // FIXME: Work with regions someday. 308 containerLogicalWidthForAutoMargins = containingBlockAvailableLineWi dth();
311 ComputedMarginValues marginValues; 309 ComputedMarginValues marginValues;
312 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() == st yle()->isLeftToRightDirection(); 310 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() == st yle()->isLeftToRightDirection();
313 computeInlineDirectionMargins(cb, containerLogicalWidthForAutoMargins, l ogicalWidth(), 311 computeInlineDirectionMargins(cb, containerLogicalWidthForAutoMargins, l ogicalWidth(),
314 hasInvertedDirection ? marginValues.m_start : marginValues.m_end, 312 hasInvertedDirection ? marginValues.m_start : marginValues.m_end,
315 hasInvertedDirection ? marginValues.m_end : marginValues.m_start); 313 hasInvertedDirection ? marginValues.m_end : marginValues.m_start);
316 setMarginStart(marginValues.m_start); 314 setMarginStart(marginValues.m_start);
317 setMarginEnd(marginValues.m_end); 315 setMarginEnd(marginValues.m_end);
318 } else { 316 } else {
319 setMarginStart(minimumValueForLength(style()->marginStart(), availableLo gicalWidth)); 317 setMarginStart(minimumValueForLength(style()->marginStart(), availableLo gicalWidth));
320 setMarginEnd(minimumValueForLength(style()->marginEnd(), availableLogica lWidth)); 318 setMarginEnd(minimumValueForLength(style()->marginEnd(), availableLogica lWidth));
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 return -1; 1369 return -1;
1372 1370
1373 int baseline = topNonEmptySection->firstLineBoxBaseline(); 1371 int baseline = topNonEmptySection->firstLineBoxBaseline();
1374 if (baseline > 0) 1372 if (baseline > 0)
1375 return topNonEmptySection->logicalTop() + baseline; 1373 return topNonEmptySection->logicalTop() + baseline;
1376 1374
1377 // FIXME: A table row always has a baseline per CSS 2.1. Will this return th e right value? 1375 // FIXME: A table row always has a baseline per CSS 2.1. Will this return th e right value?
1378 return -1; 1376 return -1;
1379 } 1377 }
1380 1378
1381 LayoutRect RenderTable::overflowClipRect(const LayoutPoint& location, RenderRegi on* region, OverlayScrollbarSizeRelevancy relevancy) 1379 LayoutRect RenderTable::overflowClipRect(const LayoutPoint& location, OverlayScr ollbarSizeRelevancy relevancy)
1382 { 1380 {
1383 LayoutRect rect = RenderBlock::overflowClipRect(location, region, relevancy) ; 1381 LayoutRect rect = RenderBlock::overflowClipRect(location, relevancy);
1384 1382
1385 // If we have a caption, expand the clip to include the caption. 1383 // If we have a caption, expand the clip to include the caption.
1386 // FIXME: Technically this is wrong, but it's virtually impossible to fix th is 1384 // FIXME: Technically this is wrong, but it's virtually impossible to fix th is
1387 // for real until captions have been re-written. 1385 // for real until captions have been re-written.
1388 // FIXME: This code assumes (like all our other caption code) that only top/ bottom are 1386 // FIXME: This code assumes (like all our other caption code) that only top/ bottom are
1389 // supported. When we actually support left/right and stop mapping them to top/bottom, 1387 // supported. When we actually support left/right and stop mapping them to top/bottom,
1390 // we might have to hack this code first (depending on what order we do thes e bug fixes in). 1388 // we might have to hack this code first (depending on what order we do thes e bug fixes in).
1391 if (!m_captions.isEmpty()) { 1389 if (!m_captions.isEmpty()) {
1392 if (style()->isHorizontalWritingMode()) { 1390 if (style()->isHorizontalWritingMode()) {
1393 rect.setHeight(height()); 1391 rect.setHeight(height());
1394 rect.setY(location.y()); 1392 rect.setY(location.y());
1395 } else { 1393 } else {
1396 rect.setWidth(width()); 1394 rect.setWidth(width());
1397 rect.setX(location.x()); 1395 rect.setX(location.x());
1398 } 1396 }
1399 } 1397 }
1400 1398
1401 return rect; 1399 return rect;
1402 } 1400 }
1403 1401
1404 bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf fset, HitTestAction action) 1402 bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf fset, HitTestAction action)
1405 { 1403 {
1406 LayoutPoint adjustedLocation = accumulatedOffset + location(); 1404 LayoutPoint adjustedLocation = accumulatedOffset + location();
1407 1405
1408 // Check kids first. 1406 // Check kids first.
1409 if (!hasOverflowClip() || locationInContainer.intersects(overflowClipRect(ad justedLocation, locationInContainer.region()))) { 1407 if (!hasOverflowClip() || locationInContainer.intersects(overflowClipRect(ad justedLocation))) {
1410 for (RenderObject* child = lastChild(); child; child = child->previousSi bling()) { 1408 for (RenderObject* child = lastChild(); child; child = child->previousSi bling()) {
1411 if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child->isTableCaption())) { 1409 if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child->isTableCaption())) {
1412 LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox( child), adjustedLocation); 1410 LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox( child), adjustedLocation);
1413 if (child->nodeAtPoint(request, result, locationInContainer, chi ldPoint, action)) { 1411 if (child->nodeAtPoint(request, result, locationInContainer, chi ldPoint, action)) {
1414 updateHitTestResult(result, toLayoutPoint(locationInContaine r.point() - childPoint)); 1412 updateHitTestResult(result, toLayoutPoint(locationInContaine r.point() - childPoint));
1415 return true; 1413 return true;
1416 } 1414 }
1417 } 1415 }
1418 } 1416 }
1419 } 1417 }
(...skipping 30 matching lines...) Expand all
1450 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const 1448 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const
1451 { 1449 {
1452 ASSERT(cell->isFirstOrLastCellInRow()); 1450 ASSERT(cell->isFirstOrLastCellInRow());
1453 if (hasSameDirectionAs(cell->row())) 1451 if (hasSameDirectionAs(cell->row()))
1454 return style()->borderEnd(); 1452 return style()->borderEnd();
1455 1453
1456 return style()->borderStart(); 1454 return style()->borderStart();
1457 } 1455 }
1458 1456
1459 } 1457 }
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