!= rowColor) 1091 RETURN_LAYOUT_ANSWER(false, "2 styles of row background color, non-bordered"); 1092 } 1093 } 1094 1095 // Check for many rows 1096 const uint32_t kMaxLayoutRows = 20; 1097 if (rowCount > kMaxLayoutRows) { // A ton of rows, this is probably for data 1098 RETURN_LAYOUT_ANSWER(false, ">= kMaxLayoutRows (20) and non-bordered"); 1099 } 1100 1101 // Check for very wide table. 1102 nsIFrame* documentFrame = Document()->GetFrame(); 1103 nsSize documentSize = documentFrame->GetSize(); 1104 if (documentSize.width > 0) { 1105 nsSize tableSize = GetFrame()->GetSize(); 1106 int32_t percentageOfDocWidth = (100 * tableSize.width) / documentSize.width; 1107 if (percentageOfDocWidth > 95) { 1108 // 3-4 columns, no borders, not a lot of rows, and 95% of the doc's width 1109 // Probably for layout 1110 RETURN_LAYOUT_ANSWER(true, 1111 "<= 4 columns, table width is 95% of document width"); 1112 } 1113 } 1114 1115 // Two column rules 1116 if (rowCount * colCount <= 10) { 1117 RETURN_LAYOUT_ANSWER(true, "2-4 columns, 10 cells or less, non-bordered"); 1118 } 1119 1120 if (HasDescendant(NS_LITERAL_STRING("embed")) || 1121 HasDescendant(NS_LITERAL_STRING("object")) || 1122 HasDescendant(NS_LITERAL_STRING("applet")) || 1123 HasDescendant(NS_LITERAL_STRING("iframe"))) { 1124 RETURN_LAYOUT_ANSWER(true, "Has no borders, and has iframe, object, applet or iframe, typical of advertisements"); 1125 } 1126 1127 RETURN_LAYOUT_ANSWER(false, "no layout factor strong enough, so will guess data"); 1128 } 1129 1130 1131 //////////////////////////////////////////////////////////////////////////////// 1132 // HTMLCaptionAccessible 1133 //////////////////////////////////////////////////////////////////////////////// 1134 1135 Relation 1136 HTMLCaptionAccessible::RelationByType(RelationType aType) 1137 { 1089 1090 if (childIdx > 0 && prevRowColor != rowColor) 1091 RETURN_LAYOUT_ANSWER(false, "2 styles of row background color, non-bordered"); 1092 } 1093 } 1094 1095 // Check for many rows 1096 const uint32_t kMaxLayoutRows = 20; 1097 if (rowCount > kMaxLayoutRows) { // A ton of rows, this is probably for data 1098 RETURN_LAYOUT_ANSWER(false, ">= kMaxLayoutRows (20) and non-bordered"); 1099 } 1100 1101 // Check for very wide table. 1102 nsIFrame* documentFrame = Document()->GetFrame(); 1103 nsSize documentSize = documentFrame->GetSize(); 1104 if (documentSize.width > 0) { 1105 nsSize tableSize = GetFrame()->GetSize(); 1106 int32_t percentageOfDocWidth = (100 * tableSize.width) / documentSize.width; 1107 if (percentageOfDocWidth > 95) { 1108 // 3-4 columns, no borders, not a lot of rows, and 95% of the doc's width 1109 // Probably for layout 1110 RETURN_LAYOUT_ANSWER(true, 1111 "<= 4 columns, table width is 95% of document width"); 1112 } 1113 } 1114 1115 // Two column rules 1116 if (rowCount * colCount <= 10) { 1117 RETURN_LAYOUT_ANSWER(true, "2-4 columns, 10 cells or less, non-bordered"); 1118 } 1119 1120 if (HasDescendant(NS_LITERAL_STRING("embed")) || 1121 HasDescendant(NS_LITERAL_STRING("object")) || 1122 HasDescendant(NS_LITERAL_STRING("applet")) || 1123 HasDescendant(NS_LITERAL_STRING("iframe"))) { 1124 RETURN_LAYOUT_ANSWER(true, "Has no borders, and has iframe, object, applet or iframe, typical of advertisements"); 1125 } 1126 1127 RETURN_LAYOUT_ANSWER(false, "no layout factor strong enough, so will guess data"); 1128 } 1129 1130 1131 //////////////////////////////////////////////////////////////////////////////// 1132 // HTMLCaptionAccessible 1133 //////////////////////////////////////////////////////////////////////////////// 1134 1135 Relation 1136 HTMLCaptionAccessible::RelationByType(RelationType aType) 1137 {