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

Side by Side Diff: Source/core/layout/LayoutTable.cpp

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 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/layout/LayoutTable.h ('k') | Source/core/layout/LayoutTableCell.h » ('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, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 , m_borderEnd(0) 68 , m_borderEnd(0)
69 { 69 {
70 ASSERT(!childrenInline()); 70 ASSERT(!childrenInline());
71 m_columnPos.fill(0, 1); 71 m_columnPos.fill(0, 1);
72 } 72 }
73 73
74 LayoutTable::~LayoutTable() 74 LayoutTable::~LayoutTable()
75 { 75 {
76 } 76 }
77 77
78 void LayoutTable::styleDidChange(StyleDifference diff, const LayoutStyle* oldSty le) 78 void LayoutTable::styleDidChange(StyleDifference diff, const ComputedStyle* oldS tyle)
79 { 79 {
80 LayoutBlock::styleDidChange(diff, oldStyle); 80 LayoutBlock::styleDidChange(diff, oldStyle);
81 propagateStyleToAnonymousChildren(); 81 propagateStyleToAnonymousChildren();
82 82
83 bool oldFixedTableLayout = oldStyle ? oldStyle->isFixedTableLayout() : false ; 83 bool oldFixedTableLayout = oldStyle ? oldStyle->isFixedTableLayout() : false ;
84 84
85 // In the collapsed border model, there is no cell spacing. 85 // In the collapsed border model, there is no cell spacing.
86 m_hSpacing = collapseBorders() ? 0 : style()->horizontalBorderSpacing(); 86 m_hSpacing = collapseBorders() ? 0 : style()->horizontalBorderSpacing();
87 m_vSpacing = collapseBorders() ? 0 : style()->verticalBorderSpacing(); 87 m_vSpacing = collapseBorders() ? 0 : style()->verticalBorderSpacing();
88 m_columnPos[0] = m_hSpacing; 88 m_columnPos[0] = m_hSpacing;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 setMarginStart(marginValues.m_start); 315 setMarginStart(marginValues.m_start);
316 setMarginEnd(marginValues.m_end); 316 setMarginEnd(marginValues.m_end);
317 317
318 // We should NEVER shrink the table below the min-content logical width, or else the table can't accomodate 318 // We should NEVER shrink the table below the min-content logical width, or else the table can't accomodate
319 // its own content which doesn't match CSS nor what authors expect. 319 // its own content which doesn't match CSS nor what authors expect.
320 // FIXME: When we convert to sub-pixel layout for tables we can remove the i nt conversion 320 // FIXME: When we convert to sub-pixel layout for tables we can remove the i nt conversion
321 // https://code.google.com/p/chromium/issues/detail?id=241198 321 // https://code.google.com/p/chromium/issues/detail?id=241198
322 ASSERT(logicalWidth().toInt() >= minPreferredLogicalWidth().toInt()); 322 ASSERT(logicalWidth().toInt() >= minPreferredLogicalWidth().toInt());
323 } 323 }
324 324
325 // This method takes a LayoutStyle's logical width, min-width, or max-width leng th and computes its actual value. 325 // This method takes a ComputedStyle's logical width, min-width, or max-width le ngth and computes its actual value.
326 LayoutUnit LayoutTable::convertStyleLogicalWidthToComputedWidth(const Length& st yleLogicalWidth, LayoutUnit availableWidth) 326 LayoutUnit LayoutTable::convertStyleLogicalWidthToComputedWidth(const Length& st yleLogicalWidth, LayoutUnit availableWidth)
327 { 327 {
328 if (styleLogicalWidth.isIntrinsic()) 328 if (styleLogicalWidth.isIntrinsic())
329 return computeIntrinsicLogicalWidthUsing(styleLogicalWidth, availableWid th, bordersPaddingAndSpacingInRowDirection()); 329 return computeIntrinsicLogicalWidthUsing(styleLogicalWidth, availableWid th, bordersPaddingAndSpacingInRowDirection());
330 330
331 // HTML tables' width styles already include borders and paddings, but CSS t ables' width styles do not. 331 // HTML tables' width styles already include borders and paddings, but CSS t ables' width styles do not.
332 LayoutUnit borders = 0; 332 LayoutUnit borders = 0;
333 bool isCSSTable = !isHTMLTableElement(node()); 333 bool isCSSTable = !isHTMLTableElement(node());
334 if (isCSSTable && styleLogicalWidth.isSpecified() && styleLogicalWidth.isPos itive() && style()->boxSizing() == CONTENT_BOX) 334 if (isCSSTable && styleLogicalWidth.isSpecified() && styleLogicalWidth.isPos itive() && style()->boxSizing() == CONTENT_BOX)
335 borders = borderStart() + borderEnd() + (collapseBorders() ? LayoutUnit( ) : paddingStart() + paddingEnd()); 335 borders = borderStart() + borderEnd() + (collapseBorders() ? LayoutUnit( ) : paddingStart() + paddingEnd());
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 687
688 int bordersPaddingAndSpacing = bordersPaddingAndSpacingInRowDirection(); 688 int bordersPaddingAndSpacing = bordersPaddingAndSpacingInRowDirection();
689 m_minPreferredLogicalWidth += bordersPaddingAndSpacing; 689 m_minPreferredLogicalWidth += bordersPaddingAndSpacing;
690 m_maxPreferredLogicalWidth += bordersPaddingAndSpacing; 690 m_maxPreferredLogicalWidth += bordersPaddingAndSpacing;
691 691
692 m_tableLayout->applyPreferredLogicalWidthQuirks(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth); 692 m_tableLayout->applyPreferredLogicalWidthQuirks(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth);
693 693
694 for (unsigned i = 0; i < m_captions.size(); i++) 694 for (unsigned i = 0; i < m_captions.size(); i++)
695 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, m_capt ions[i]->minPreferredLogicalWidth()); 695 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, m_capt ions[i]->minPreferredLogicalWidth());
696 696
697 const LayoutStyle& styleToUse = styleRef(); 697 const ComputedStyle& styleToUse = styleRef();
698 // FIXME: This should probably be checking for isSpecified since you should be able to use percentage or calc values for min-width. 698 // FIXME: This should probably be checking for isSpecified since you should be able to use percentage or calc values for min-width.
699 if (styleToUse.logicalMinWidth().isFixed() && styleToUse.logicalMinWidth().v alue() > 0) { 699 if (styleToUse.logicalMinWidth().isFixed() && styleToUse.logicalMinWidth().v alue() > 0) {
700 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value())); 700 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value()));
701 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value())); 701 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value()));
702 } 702 }
703 703
704 // FIXME: This should probably be checking for isSpecified since you should be able to use percentage or calc values for maxWidth. 704 // FIXME: This should probably be checking for isSpecified since you should be able to use percentage or calc values for maxWidth.
705 if (styleToUse.logicalMaxWidth().isFixed()) { 705 if (styleToUse.logicalMaxWidth().isFixed()) {
706 // We don't constrain m_minPreferredLogicalWidth as the table should be at least the size of its min-content, regardless of 'max-width'. 706 // We don't constrain m_minPreferredLogicalWidth as the table should be at least the size of its min-content, regardless of 'max-width'.
707 m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value())); 707 m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value()));
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 updateHitTestResult(result, flipForWritingMode(locationInContainer.point () - toLayoutSize(adjustedLocation))); 1334 updateHitTestResult(result, flipForWritingMode(locationInContainer.point () - toLayoutSize(adjustedLocation)));
1335 if (!result.addNodeToListBasedTestResult(node(), request, locationInCont ainer, boundsRect)) 1335 if (!result.addNodeToListBasedTestResult(node(), request, locationInCont ainer, boundsRect))
1336 return true; 1336 return true;
1337 } 1337 }
1338 1338
1339 return false; 1339 return false;
1340 } 1340 }
1341 1341
1342 LayoutTable* LayoutTable::createAnonymousWithParentRenderer(const LayoutObject* parent) 1342 LayoutTable* LayoutTable::createAnonymousWithParentRenderer(const LayoutObject* parent)
1343 { 1343 {
1344 RefPtr<LayoutStyle> newStyle = LayoutStyle::createAnonymousStyleWithDisplay( parent->styleRef(), TABLE); 1344 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp lay(parent->styleRef(), TABLE);
1345 LayoutTable* newTable = new LayoutTable(0); 1345 LayoutTable* newTable = new LayoutTable(0);
1346 newTable->setDocumentForAnonymous(&parent->document()); 1346 newTable->setDocumentForAnonymous(&parent->document());
1347 newTable->setStyle(newStyle.release()); 1347 newTable->setStyle(newStyle.release());
1348 return newTable; 1348 return newTable;
1349 } 1349 }
1350 1350
1351 const BorderValue& LayoutTable::tableStartBorderAdjoiningCell(const LayoutTableC ell* cell) const 1351 const BorderValue& LayoutTable::tableStartBorderAdjoiningCell(const LayoutTableC ell* cell) const
1352 { 1352 {
1353 ASSERT(cell->isFirstOrLastCellInRow()); 1353 ASSERT(cell->isFirstOrLastCellInRow());
1354 if (hasSameDirectionAs(cell->row())) 1354 if (hasSameDirectionAs(cell->row()))
1355 return style()->borderStart(); 1355 return style()->borderStart();
1356 1356
1357 return style()->borderEnd(); 1357 return style()->borderEnd();
1358 } 1358 }
1359 1359
1360 const BorderValue& LayoutTable::tableEndBorderAdjoiningCell(const LayoutTableCel l* cell) const 1360 const BorderValue& LayoutTable::tableEndBorderAdjoiningCell(const LayoutTableCel l* cell) const
1361 { 1361 {
1362 ASSERT(cell->isFirstOrLastCellInRow()); 1362 ASSERT(cell->isFirstOrLastCellInRow());
1363 if (hasSameDirectionAs(cell->row())) 1363 if (hasSameDirectionAs(cell->row()))
1364 return style()->borderEnd(); 1364 return style()->borderEnd();
1365 1365
1366 return style()->borderStart(); 1366 return style()->borderStart();
1367 } 1367 }
1368 1368
1369 } 1369 }
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutTable.h ('k') | Source/core/layout/LayoutTableCell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698