Changeset 71668 in webkit
- Timestamp:
- Nov 9, 2010 12:46:15 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r71660 r71668 1 2010-11-09 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Dave Hyatt. 4 5 Make tables work with vertical text 6 https://bugs.webkit.org/show_bug.cgi?id=46417 7 8 * fast/blockflow/table-hit-test-expected.txt: Added. 9 * fast/blockflow/table-hit-test.html: Added. 10 1 11 2010-11-09 Ryosuke Niwa <rniwa@webkit.org> 2 12 -
trunk/WebCore/ChangeLog
r71666 r71668 1 2010-11-09 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Dave Hyatt. 4 5 Made tables hit-test correctly in all writing modes. 6 7 Part of: Make tables work with vertical text 8 https://bugs.webkit.org/show_bug.cgi?id=46417 9 10 Test: fast/blockflow/table-hit-test.html 11 12 * rendering/RenderTable.cpp: 13 (WebCore::RenderTable::nodeAtPoint): 14 * rendering/RenderTableRow.cpp: 15 (WebCore::RenderTableRow::nodeAtPoint): 16 * rendering/RenderTableSection.cpp: 17 (WebCore::RenderTableSection::nodeAtPoint): 18 1 19 2010-11-09 Simon Fraser <simon.fraser@apple.com> 2 20 … … 2386 2404 table’s are not supported yet. 2387 2405 2388 Make tables work with vertical text2406 Part of: Make tables work with vertical text 2389 2407 https://bugs.webkit.org/show_bug.cgi?id=46417 2390 2408 -
trunk/WebCore/rendering/RenderTable.cpp
r71382 r71668 1153 1153 if (!hasOverflowClip() || overflowClipRect(tx, ty).intersects(result.rectForPoint(xPos, yPos))) { 1154 1154 for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { 1155 if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption) && 1156 child->nodeAtPoint(request, result, xPos, yPos, tx, ty, action)) { 1157 updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); 1158 return true; 1155 if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption)) { 1156 IntPoint childPoint = flipForWritingMode(toRenderBox(child), IntPoint(tx, ty), ParentToChildFlippingAdjustment); 1157 if (child->nodeAtPoint(request, result, xPos, yPos, childPoint.x(), childPoint.y(), action)) { 1158 updateHitTestResult(result, IntPoint(xPos - childPoint.x(), yPos - childPoint.y())); 1159 return true; 1160 } 1159 1161 } 1160 1162 } … … 1164 1166 IntRect boundsRect = IntRect(tx, ty, width(), height()); 1165 1167 if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && boundsRect.intersects(result.rectForPoint(xPos, yPos))) { 1166 updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty));1168 updateHitTestResult(result, flipForWritingMode(IntPoint(xPos - tx, yPos - ty))); 1167 1169 if (!result.addNodeToRectBasedTestResult(node(), xPos, yPos, boundsRect)) 1168 1170 return true; -
trunk/WebCore/rendering/RenderTableRow.cpp
r71382 r71668 176 176 // table-specific hit-test method (which we should do for performance reasons anyway), 177 177 // then we can remove this check. 178 if (child->isTableCell() && !toRenderBox(child)->hasSelfPaintingLayer() && child->nodeAtPoint(request, result, x, y, tx, ty, action)) { 179 updateHitTestResult(result, IntPoint(x - tx, y - ty)); 180 return true; 178 if (child->isTableCell() && !toRenderBox(child)->hasSelfPaintingLayer()) { 179 IntPoint cellPoint = flipForWritingMode(toRenderTableCell(child), IntPoint(tx, ty), ParentToChildFlippingAdjustment); 180 if (child->nodeAtPoint(request, result, x, y, cellPoint.x(), cellPoint.y(), action)) { 181 updateHitTestResult(result, IntPoint(x - cellPoint.x(), y - cellPoint.y())); 182 return true; 183 } 181 184 } 182 185 } -
trunk/WebCore/rendering/RenderTableSection.cpp
r71382 r71668 1219 1219 // table-specific hit-test method (which we should do for performance reasons anyway), 1220 1220 // then we can remove this check. 1221 if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && child->nodeAtPoint(request, result, xPos, yPos, tx, ty, action)) { 1222 updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); 1223 return true; 1221 if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer()) { 1222 IntPoint childPoint = flipForWritingMode(toRenderBox(child), IntPoint(tx, ty), ParentToChildFlippingAdjustment); 1223 if (child->nodeAtPoint(request, result, xPos, yPos, childPoint.x(), childPoint.y(), action)) { 1224 updateHitTestResult(result, IntPoint(xPos - childPoint.x(), yPos - childPoint.y())); 1225 return true; 1226 } 1224 1227 } 1225 1228 } … … 1227 1230 } 1228 1231 1229 int relativeY = yPos - ty; 1230 // leftrow corresponds to the first row that starts after the y mouse position 1231 unsigned leftrow = std::upper_bound(m_rowPos.begin(), m_rowPos.end(), relativeY) - m_rowPos.begin(); 1232 if (leftrow == m_rowPos.size()) 1232 IntPoint location = IntPoint(xPos - tx, yPos - ty); 1233 if (style()->isFlippedBlocksWritingMode()) { 1234 if (style()->isHorizontalWritingMode()) 1235 location.setY(height() - location.y()); 1236 else 1237 location.setX(width() - location.x()); 1238 } 1239 1240 int offsetInColumnDirection = style()->isHorizontalWritingMode() ? location.y() : location.x(); 1241 // Find the first row that starts after offsetInColumnDirection. 1242 unsigned nextRow = std::upper_bound(m_rowPos.begin(), m_rowPos.end(), offsetInColumnDirection) - m_rowPos.begin(); 1243 if (nextRow == m_rowPos.size()) 1233 1244 return false; 1234 // Grab the last row that starts before the y mouse position. 1235 if (leftrow > 0) 1236 --leftrow; 1245 // Now set hitRow to the index of the hit row, or 0. 1246 unsigned hitRow = nextRow > 0 ? nextRow - 1 : 0; 1237 1247 1238 1248 Vector<int>& columnPos = table()->columnPositions(); 1239 bool rtl = !style()->isLeftToRightDirection(); 1240 int relativeX = xPos - tx; 1241 if (rtl) 1242 relativeX = columnPos[columnPos.size() - 1] - relativeX; 1243 1244 unsigned leftcol = std::lower_bound(columnPos.begin(), columnPos.end(), relativeX) - columnPos.begin(); 1245 if (leftcol == columnPos.size()) 1249 int offsetInRowDirection = style()->isHorizontalWritingMode() ? location.x() : location.y(); 1250 if (!style()->isLeftToRightDirection()) 1251 offsetInRowDirection = columnPos[columnPos.size() - 1] - offsetInRowDirection; 1252 1253 unsigned nextColumn = std::lower_bound(columnPos.begin(), columnPos.end(), offsetInRowDirection) - columnPos.begin(); 1254 if (nextColumn == columnPos.size()) 1246 1255 return false; 1247 if (leftcol > 0) 1248 --leftcol; 1249 1250 CellStruct& current = cellAt(leftrow, leftcol); 1256 unsigned hitColumn = nextColumn > 0 ? nextColumn - 1 : 0; 1257 1258 CellStruct& current = cellAt(hitRow, hitColumn); 1251 1259 1252 1260 // If the cell is empty, there's nothing to do … … 1256 1264 for (int i = current.cells.size() - 1; i >= 0; --i) { 1257 1265 RenderTableCell* cell = current.cells[i]; 1258 if (static_cast<RenderObject*>(cell)->nodeAtPoint(request, result, xPos, yPos, tx, ty, action)) { 1259 updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); 1266 IntPoint cellPoint = flipForWritingMode(cell, IntPoint(tx, ty), ParentToChildFlippingAdjustment); 1267 if (static_cast<RenderObject*>(cell)->nodeAtPoint(request, result, xPos, yPos, cellPoint.x(), cellPoint.y(), action)) { 1268 updateHitTestResult(result, IntPoint(xPos - cellPoint.x(), yPos - cellPoint.y())); 1260 1269 return true; 1261 1270 }
Note: See TracChangeset
for help on using the changeset viewer.