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

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

Issue 8366015: Merge 97907 - Multiple crashes in RenderTable during layout (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/912/
Patch Set: Created 9 years, 2 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 | « LayoutTests/fast/table/crash-anonymous-table-layout-expected.txt ('k') | no next file » | 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 LayoutUnit availableLogicalWidth = containingBlockLogicalWidthForContent(); 233 LayoutUnit availableLogicalWidth = containingBlockLogicalWidthForContent();
234 bool hasPerpendicularContainingBlock = cb->style()->isHorizontalWritingMode( ) != style()->isHorizontalWritingMode(); 234 bool hasPerpendicularContainingBlock = cb->style()->isHorizontalWritingMode( ) != style()->isHorizontalWritingMode();
235 LayoutUnit containerWidthInInlineDirection = hasPerpendicularContainingBlock ? perpendicularContainingBlockLogicalHeight() : availableLogicalWidth; 235 LayoutUnit containerWidthInInlineDirection = hasPerpendicularContainingBlock ? perpendicularContainingBlockLogicalHeight() : availableLogicalWidth;
236 236
237 LengthType logicalWidthType = style()->logicalWidth().type(); 237 LengthType logicalWidthType = style()->logicalWidth().type();
238 if (logicalWidthType > Relative && style()->logicalWidth().isPositive()) { 238 if (logicalWidthType > Relative && style()->logicalWidth().isPositive()) {
239 // Percent or fixed table 239 // Percent or fixed table
240 // HTML tables size as though CSS width includes border/padding, CSS tab les do not. 240 // HTML tables size as though CSS width includes border/padding, CSS tab les do not.
241 LayoutUnit borders = 0; 241 LayoutUnit borders = 0;
242 if (!node()->hasTagName(tableTag)) { 242 if (!node() || !node()->hasTagName(tableTag)) {
243 bool collapsing = collapseBorders(); 243 bool collapsing = collapseBorders();
244 LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? 0 : paddingBefore()); 244 LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? 0 : paddingBefore());
245 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? 0 : paddingAfter()); 245 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? 0 : paddingAfter());
246 borders = borderAndPaddingBefore + borderAndPaddingAfter; 246 borders = borderAndPaddingBefore + borderAndPaddingAfter;
247 } 247 }
248 setLogicalWidth(style()->logicalWidth().calcMinValue(containerWidthInInl ineDirection) + borders); 248 setLogicalWidth(style()->logicalWidth().calcMinValue(containerWidthInInl ineDirection) + borders);
249 setLogicalWidth(max(minPreferredLogicalWidth(), logicalWidth())); 249 setLogicalWidth(max(minPreferredLogicalWidth(), logicalWidth()));
250 } else { 250 } else {
251 // Subtract out any fixed margins from our available width for auto widt h tables. 251 // Subtract out any fixed margins from our available width for auto widt h tables.
252 LayoutUnit marginTotal = 0; 252 LayoutUnit marginTotal = 0;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 362
363 setLogicalHeight(logicalHeight() + borderAndPaddingBefore); 363 setLogicalHeight(logicalHeight() + borderAndPaddingBefore);
364 364
365 if (!isPositioned()) 365 if (!isPositioned())
366 computeLogicalHeight(); 366 computeLogicalHeight();
367 367
368 Length logicalHeightLength = style()->logicalHeight(); 368 Length logicalHeightLength = style()->logicalHeight();
369 LayoutUnit computedLogicalHeight = 0; 369 LayoutUnit computedLogicalHeight = 0;
370 if (logicalHeightLength.isFixed()) { 370 if (logicalHeightLength.isFixed()) {
371 // HTML tables size as though CSS height includes border/padding, CSS ta bles do not. 371 // HTML tables size as though CSS height includes border/padding, CSS ta bles do not.
372 LayoutUnit borders = node()->hasTagName(tableTag) ? (borderAndPaddingBef ore + borderAndPaddingAfter) : 0; 372 LayoutUnit borders = node() && node()->hasTagName(tableTag) ? (borderAnd PaddingBefore + borderAndPaddingAfter) : 0;
373 computedLogicalHeight = logicalHeightLength.value() - borders; 373 computedLogicalHeight = logicalHeightLength.value() - borders;
374 } else if (logicalHeightLength.isPercent()) 374 } else if (logicalHeightLength.isPercent())
375 computedLogicalHeight = computePercentageLogicalHeight(logicalHeightLeng th); 375 computedLogicalHeight = computePercentageLogicalHeight(logicalHeightLeng th);
376 computedLogicalHeight = max<LayoutUnit>(0, computedLogicalHeight); 376 computedLogicalHeight = max<LayoutUnit>(0, computedLogicalHeight);
377 377
378 for (RenderObject* child = firstChild(); child; child = child->nextSibling() ) { 378 for (RenderObject* child = firstChild(); child; child = child->nextSibling() ) {
379 if (child->isTableSection()) 379 if (child->isTableSection())
380 // FIXME: Distribute extra height between all table body sections in stead of giving it all to the first one. 380 // FIXME: Distribute extra height between all table body sections in stead of giving it all to the first one.
381 toRenderTableSection(child)->layoutRows(child == m_firstBody ? max<L ayoutUnit>(0, computedLogicalHeight - totalSectionLogicalHeight) : 0); 381 toRenderTableSection(child)->layoutRows(child == m_firstBody ? max<L ayoutUnit>(0, computedLogicalHeight - totalSectionLogicalHeight) : 0);
382 } 382 }
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && boundsRect.intersects(result.rectForPoint(pointI nContainer))) { 1230 if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && boundsRect.intersects(result.rectForPoint(pointI nContainer))) {
1231 updateHitTestResult(result, flipForWritingMode(pointInContainer - toLayo utSize(adjustedLocation))); 1231 updateHitTestResult(result, flipForWritingMode(pointInContainer - toLayo utSize(adjustedLocation)));
1232 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, bound sRect)) 1232 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, bound sRect))
1233 return true; 1233 return true;
1234 } 1234 }
1235 1235
1236 return false; 1236 return false;
1237 } 1237 }
1238 1238
1239 } 1239 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/table/crash-anonymous-table-layout-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698