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

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

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