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

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

Issue 197283025: Use new is*Element() helper functions more in rendering code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderProgress.cpp ('k') | Source/core/rendering/RenderTableCell.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 11 matching lines...) Expand all
22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA. 23 * Boston, MA 02110-1301, USA.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "core/rendering/RenderTable.h" 27 #include "core/rendering/RenderTable.h"
28 28
29 #include "HTMLNames.h" 29 #include "HTMLNames.h"
30 #include "core/dom/Document.h" 30 #include "core/dom/Document.h"
31 #include "core/frame/FrameView.h" 31 #include "core/frame/FrameView.h"
32 #include "core/html/HTMLTableElement.h"
32 #include "core/rendering/AutoTableLayout.h" 33 #include "core/rendering/AutoTableLayout.h"
33 #include "core/rendering/FastTextAutosizer.h" 34 #include "core/rendering/FastTextAutosizer.h"
34 #include "core/rendering/FixedTableLayout.h" 35 #include "core/rendering/FixedTableLayout.h"
35 #include "core/rendering/GraphicsContextAnnotator.h" 36 #include "core/rendering/GraphicsContextAnnotator.h"
36 #include "core/rendering/HitTestResult.h" 37 #include "core/rendering/HitTestResult.h"
37 #include "core/rendering/LayoutRectRecorder.h" 38 #include "core/rendering/LayoutRectRecorder.h"
38 #include "core/rendering/LayoutRepainter.h" 39 #include "core/rendering/LayoutRepainter.h"
39 #include "core/rendering/RenderLayer.h" 40 #include "core/rendering/RenderLayer.h"
40 #include "core/rendering/RenderTableCaption.h" 41 #include "core/rendering/RenderTableCaption.h"
41 #include "core/rendering/RenderTableCell.h" 42 #include "core/rendering/RenderTableCell.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 } 326 }
326 327
327 // This method takes a RenderStyle's logical width, min-width, or max-width leng th and computes its actual value. 328 // This method takes a RenderStyle's logical width, min-width, or max-width leng th and computes its actual value.
328 LayoutUnit RenderTable::convertStyleLogicalWidthToComputedWidth(const Length& st yleLogicalWidth, LayoutUnit availableWidth) 329 LayoutUnit RenderTable::convertStyleLogicalWidthToComputedWidth(const Length& st yleLogicalWidth, LayoutUnit availableWidth)
329 { 330 {
330 if (styleLogicalWidth.isIntrinsic()) 331 if (styleLogicalWidth.isIntrinsic())
331 return computeIntrinsicLogicalWidthUsing(styleLogicalWidth, availableWid th, bordersPaddingAndSpacingInRowDirection()); 332 return computeIntrinsicLogicalWidthUsing(styleLogicalWidth, availableWid th, bordersPaddingAndSpacingInRowDirection());
332 333
333 // HTML tables' width styles already include borders and paddings, but CSS t ables' width styles do not. 334 // HTML tables' width styles already include borders and paddings, but CSS t ables' width styles do not.
334 LayoutUnit borders = 0; 335 LayoutUnit borders = 0;
335 bool isCSSTable = !node() || !node()->hasTagName(tableTag); 336 bool isCSSTable = !isHTMLTableElement(node());
336 if (isCSSTable && styleLogicalWidth.isSpecified() && styleLogicalWidth.isPos itive() && style()->boxSizing() == CONTENT_BOX) 337 if (isCSSTable && styleLogicalWidth.isSpecified() && styleLogicalWidth.isPos itive() && style()->boxSizing() == CONTENT_BOX)
337 borders = borderStart() + borderEnd() + (collapseBorders() ? LayoutUnit( ) : paddingStart() + paddingEnd()); 338 borders = borderStart() + borderEnd() + (collapseBorders() ? LayoutUnit( ) : paddingStart() + paddingEnd());
338 339
339 return minimumValueForLength(styleLogicalWidth, availableWidth) + borders; 340 return minimumValueForLength(styleLogicalWidth, availableWidth) + borders;
340 } 341 }
341 342
342 LayoutUnit RenderTable::convertStyleLogicalHeightToComputedHeight(const Length& styleLogicalHeight) 343 LayoutUnit RenderTable::convertStyleLogicalHeightToComputedHeight(const Length& styleLogicalHeight)
343 { 344 {
344 LayoutUnit borderAndPaddingBefore = borderBefore() + (collapseBorders() ? La youtUnit() : paddingBefore()); 345 LayoutUnit borderAndPaddingBefore = borderBefore() + (collapseBorders() ? La youtUnit() : paddingBefore());
345 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapseBorders() ? Layo utUnit() : paddingAfter()); 346 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapseBorders() ? Layo utUnit() : paddingAfter());
346 LayoutUnit borderAndPadding = borderAndPaddingBefore + borderAndPaddingAfter ; 347 LayoutUnit borderAndPadding = borderAndPaddingBefore + borderAndPaddingAfter ;
347 LayoutUnit computedLogicalHeight = 0; 348 LayoutUnit computedLogicalHeight = 0;
348 if (styleLogicalHeight.isFixed()) { 349 if (styleLogicalHeight.isFixed()) {
349 // HTML tables size as though CSS height includes border/padding, CSS ta bles do not. 350 // HTML tables size as though CSS height includes border/padding, CSS ta bles do not.
350 LayoutUnit borders = LayoutUnit(); 351 LayoutUnit borders = LayoutUnit();
351 // FIXME: We cannot apply box-sizing: content-box on <table> which other browsers allow. 352 // FIXME: We cannot apply box-sizing: content-box on <table> which other browsers allow.
352 if ((node() && node()->hasTagName(tableTag)) || style()->boxSizing() == BORDER_BOX) { 353 if (isHTMLTableElement(node()) || style()->boxSizing() == BORDER_BOX) {
353 borders = borderAndPadding; 354 borders = borderAndPadding;
354 } 355 }
355 computedLogicalHeight = styleLogicalHeight.value() - borders; 356 computedLogicalHeight = styleLogicalHeight.value() - borders;
356 } else if (styleLogicalHeight.isPercent()) 357 } else if (styleLogicalHeight.isPercent())
357 computedLogicalHeight = computePercentageLogicalHeight(styleLogicalHeigh t); 358 computedLogicalHeight = computePercentageLogicalHeight(styleLogicalHeigh t);
358 else if (styleLogicalHeight.isIntrinsic()) 359 else if (styleLogicalHeight.isIntrinsic())
359 computedLogicalHeight = computeIntrinsicLogicalContentHeightUsing(styleL ogicalHeight, logicalHeight() - borderAndPadding, borderAndPadding); 360 computedLogicalHeight = computeIntrinsicLogicalContentHeightUsing(styleL ogicalHeight, logicalHeight() - borderAndPadding, borderAndPadding);
360 else 361 else
361 ASSERT_NOT_REACHED(); 362 ASSERT_NOT_REACHED();
362 return max<LayoutUnit>(0, computedLogicalHeight); 363 return max<LayoutUnit>(0, computedLogicalHeight);
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const 1458 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const
1458 { 1459 {
1459 ASSERT(cell->isFirstOrLastCellInRow()); 1460 ASSERT(cell->isFirstOrLastCellInRow());
1460 if (hasSameDirectionAs(cell->row())) 1461 if (hasSameDirectionAs(cell->row()))
1461 return style()->borderEnd(); 1462 return style()->borderEnd();
1462 1463
1463 return style()->borderStart(); 1464 return style()->borderStart();
1464 } 1465 }
1465 1466
1466 } 1467 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderProgress.cpp ('k') | Source/core/rendering/RenderTableCell.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698