Source/WebCore/ChangeLog

 12012-06-26 Arpita Bahuguna <arpitabahuguna@gmail.com>
 2
 3 Change RenderTable sections' iterations for removing anti-patterns and using helper functions.
 4 https://bugs.webkit.org/show_bug.cgi?id=89751
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Removing anti-pattern wherever possible from RenderTable code. Also, modifying
 9 RenderTable sections' iterations to use helper functions.
 10
 11 No new tests required for this change.
 12
 13 * rendering/RenderTable.cpp:
 14 (WebCore::RenderTable::addOverflowFromChildren):
 15 (WebCore::RenderTable::setCellLogicalWidths):
 16 (WebCore::RenderTable::splitColumn):
 17 (WebCore::RenderTable::outerBorderStart):
 18 (WebCore::RenderTable::outerBorderEnd):
 19 Removed anti-patterns involving iterations over RenderObjects.
 20
 21 (WebCore::RenderTable::outerBorderAfter):
 22 Modified RenderTable sections' iteration to use helper functions.
 23
1242012-06-26 Taiju Tsuiki <tzik@chromium.org>
225
326 Web Inspector: Add requestMetadata command and metadataReceived event to FileSystem
121252

Source/WebCore/rendering/RenderTable.cpp

@@void RenderTable::addOverflowFromChildre
517517 addOverflowFromChild(m_captions[i]);
518518
519519 // Add overflow from our sections.
520  for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
521  if (child->isTableSection()) {
522  RenderTableSection* section = toRenderTableSection(child);
523  addOverflowFromChild(section);
524  }
525  }
 520 for (RenderTableSection* section = topSection(); section; section = sectionBelow(section))
 521 addOverflowFromChild(section);
526522}
527523
528524void RenderTable::setCellLogicalWidths()
529525{
530  for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
531  if (child->isTableSection())
532  toRenderTableSection(child)->setCellLogicalWidths();
533  }
 526 for (RenderTableSection* section = topSection(); section; section = sectionBelow(section))
 527 section->setCellLogicalWidths();
534528}
535529
536530void RenderTable::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)

@@void RenderTable::splitColumn(unsigned p
686680
687681 // Propagate the change in our columns representation to the sections that don't need
688682 // cell recalc. If they do, they will be synced up directly with m_columns later.
689  for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
690  if (!child->isTableSection())
691  continue;
692 
693  RenderTableSection* section = toRenderTableSection(child);
 683 for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) {
694684 if (section->needsCellRecalc())
695685 continue;
696686

@@int RenderTable::outerBorderAfter() cons
996986 if (!collapseBorders())
997987 return 0;
998988 int borderWidth = 0;
999  RenderTableSection* bottomSection;
1000  if (m_foot)
1001  bottomSection = m_foot;
1002  else {
1003  RenderObject* child;
1004  for (child = lastChild(); child && !child->isTableSection(); child = child->previousSibling()) { }
1005  bottomSection = child ? toRenderTableSection(child) : 0;
1006  }
1007  if (bottomSection) {
1008  borderWidth = bottomSection->outerBorderAfter();
 989
 990 if (RenderTableSection* section = bottomSection()) {
 991 borderWidth = section->outerBorderAfter();
1009992 if (borderWidth < 0)
1010  return 0; // Overridden by hidden
 993 return 0; // Overridden by hidden
1011994 }
1012995 const BorderValue& tb = style()->borderAfter();
1013996 if (tb.style() == BHIDDEN)

@@int RenderTable::outerBorderStart() cons
10311014 borderWidth = (tb.width() + (style()->isLeftToRightDirection() ? 0 : 1)) / 2;
10321015
10331016 bool allHidden = true;
1034  for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
1035  if (!child->isTableSection())
1036  continue;
1037  int sw = toRenderTableSection(child)->outerBorderStart();
 1017 for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) {
 1018 int sw = section->outerBorderStart();
10381019 if (sw < 0)
10391020 continue;
10401021 allHidden = false;

@@int RenderTable::outerBorderEnd() const
10601041 borderWidth = (tb.width() + (style()->isLeftToRightDirection() ? 1 : 0)) / 2;
10611042
10621043 bool allHidden = true;
1063  for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
1064  if (!child->isTableSection())
1065  continue;
1066  int sw = toRenderTableSection(child)->outerBorderEnd();
 1044 for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) {
 1045 int sw = section->outerBorderEnd();
10671046 if (sw < 0)
10681047 continue;
10691048 allHidden = false;
121252