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

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

Issue 9117049: Merge 105768 - Incorrect positioning of floating pseudo-elements in table captions (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 8 years, 11 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
« no previous file with comments | « Source/WebCore/rendering/RenderTable.h ('k') | no next file » | 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 setMarginStart(0); 258 setMarginStart(0);
259 setMarginEnd(0); 259 setMarginEnd(0);
260 if (!hasPerpendicularContainingBlock) 260 if (!hasPerpendicularContainingBlock)
261 computeInlineDirectionMargins(cb, availableLogicalWidth, logicalWidth()) ; 261 computeInlineDirectionMargins(cb, availableLogicalWidth, logicalWidth()) ;
262 else { 262 else {
263 setMarginStart(style()->marginStart().calcMinValue(availableLogicalWidth )); 263 setMarginStart(style()->marginStart().calcMinValue(availableLogicalWidth ));
264 setMarginEnd(style()->marginEnd().calcMinValue(availableLogicalWidth)); 264 setMarginEnd(style()->marginEnd().calcMinValue(availableLogicalWidth));
265 } 265 }
266 } 266 }
267 267
268 void RenderTable::adjustLogicalHeightForCaption(RenderBlock* caption) 268 void RenderTable::layoutCaption(RenderTableCaption* caption)
269 { 269 {
270 IntRect captionRect(caption->x(), caption->y(), caption->width(), caption->h eight()); 270 IntRect captionRect(caption->x(), caption->y(), caption->width(), caption->h eight());
271 271
272 if (caption->needsLayout()) {
273 // The margins may not be available but ensure the caption is at least l ocated beneath any previous sibling caption
274 // so that it does not mistakenly think any floats in the previous capti on intrude into it.
275 caption->setLogicalLocation(IntPoint(caption->marginStart(), caption->ma rginBefore() + logicalHeight()));
276 // If RenderTableCaption ever gets a layout() function, use it here.
277 caption->layoutIfNeeded();
278 }
279 // Apply the margins to the location now that they are definitely available from layout
272 caption->setLogicalLocation(IntPoint(caption->marginStart(), caption->margin Before() + logicalHeight())); 280 caption->setLogicalLocation(IntPoint(caption->marginStart(), caption->margin Before() + logicalHeight()));
281
273 if (!selfNeedsLayout() && caption->checkForRepaintDuringLayout()) 282 if (!selfNeedsLayout() && caption->checkForRepaintDuringLayout())
274 caption->repaintDuringLayoutIfMoved(captionRect); 283 caption->repaintDuringLayoutIfMoved(captionRect);
275 284
276 setLogicalHeight(logicalHeight() + caption->logicalHeight() + caption->margi nBefore() + caption->marginAfter()); 285 setLogicalHeight(logicalHeight() + caption->logicalHeight() + caption->margi nBefore() + caption->marginAfter());
277 } 286 }
278 287
279 void RenderTable::layout() 288 void RenderTable::layout()
280 { 289 {
281 ASSERT(needsLayout()); 290 ASSERT(needsLayout());
282 291
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 totalSectionLogicalHeight += section->calcRowLogicalHeight(); 332 totalSectionLogicalHeight += section->calcRowLogicalHeight();
324 if (collapsing) 333 if (collapsing)
325 section->recalcOuterBorder(); 334 section->recalcOuterBorder();
326 ASSERT(!section->needsLayout()); 335 ASSERT(!section->needsLayout());
327 } else if (child->isTableCol()) { 336 } else if (child->isTableCol()) {
328 child->layoutIfNeeded(); 337 child->layoutIfNeeded();
329 ASSERT(!child->needsLayout()); 338 ASSERT(!child->needsLayout());
330 } 339 }
331 } 340 }
332 341
333 // Only lay out one caption, since it's the only one we're going to end up p ainting.
334 for (unsigned i = 0; i < m_captions.size(); i++)
335 m_captions[i]->layoutIfNeeded();
336
337 // If any table section moved vertically, we will just repaint everything fr om that 342 // If any table section moved vertically, we will just repaint everything fr om that
338 // section down (it is quite unlikely that any of the following sections 343 // section down (it is quite unlikely that any of the following sections
339 // did not shift). 344 // did not shift).
340 bool sectionMoved = false; 345 bool sectionMoved = false;
341 LayoutUnit movedSectionLogicalTop = 0; 346 LayoutUnit movedSectionLogicalTop = 0;
342 347
343 // FIXME: Collapse caption margin. 348 // FIXME: Collapse caption margin.
344 if (!m_captions.isEmpty()) { 349 if (!m_captions.isEmpty()) {
345 for (unsigned i = 0; i < m_captions.size(); i++) { 350 for (unsigned i = 0; i < m_captions.size(); i++) {
346 if (m_captions[i]->style()->captionSide() == CAPBOTTOM) 351 if (m_captions[i]->style()->captionSide() == CAPBOTTOM)
347 continue; 352 continue;
348 adjustLogicalHeightForCaption(m_captions[i]); 353 layoutCaption(m_captions[i]);
349 } 354 }
350 if (logicalHeight() != oldTableLogicalTop) { 355 if (logicalHeight() != oldTableLogicalTop) {
351 sectionMoved = true; 356 sectionMoved = true;
352 movedSectionLogicalTop = min(logicalHeight(), oldTableLogicalTop); 357 movedSectionLogicalTop = min(logicalHeight(), oldTableLogicalTop);
353 } 358 }
354 } 359 }
355 360
356 LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? 0 : paddi ngBefore()); 361 LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? 0 : paddi ngBefore());
357 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? 0 : padding After()); 362 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? 0 : padding After());
358 363
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 403
399 setLogicalHeight(logicalHeight() + section->logicalHeight()); 404 setLogicalHeight(logicalHeight() + section->logicalHeight());
400 section = sectionBelow(section); 405 section = sectionBelow(section);
401 } 406 }
402 407
403 setLogicalHeight(logicalHeight() + borderAndPaddingAfter); 408 setLogicalHeight(logicalHeight() + borderAndPaddingAfter);
404 409
405 for (unsigned i = 0; i < m_captions.size(); i++) { 410 for (unsigned i = 0; i < m_captions.size(); i++) {
406 if (m_captions[i]->style()->captionSide() != CAPBOTTOM) 411 if (m_captions[i]->style()->captionSide() != CAPBOTTOM)
407 continue; 412 continue;
408 adjustLogicalHeightForCaption(m_captions[i]); 413 layoutCaption(m_captions[i]);
409 } 414 }
410 415
411 if (isPositioned()) 416 if (isPositioned())
412 computeLogicalHeight(); 417 computeLogicalHeight();
413 418
414 // table can be containing block of positioned elements. 419 // table can be containing block of positioned elements.
415 // FIXME: Only pass true if width or height changed. 420 // FIXME: Only pass true if width or height changed.
416 layoutPositionedObjects(true); 421 layoutPositionedObjects(true);
417 422
418 updateLayerTransform(); 423 updateLayerTransform();
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && boundsRect.intersects(result.rectForPoint(pointI nContainer))) { 1233 if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && boundsRect.intersects(result.rectForPoint(pointI nContainer))) {
1229 updateHitTestResult(result, flipForWritingMode(pointInContainer - toLayo utSize(adjustedLocation))); 1234 updateHitTestResult(result, flipForWritingMode(pointInContainer - toLayo utSize(adjustedLocation)));
1230 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, bound sRect)) 1235 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, bound sRect))
1231 return true; 1236 return true;
1232 } 1237 }
1233 1238
1234 return false; 1239 return false;
1235 } 1240 }
1236 1241
1237 } 1242 }
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/RenderTable.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698