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

Side by Side Diff: Source/core/css/resolver/StyleAdjuster.cpp

Issue 1228373007: Compute the correct overflow-x and overflow-y values for table elements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 5 years, 5 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 | « LayoutTests/fast/table/table-different-overflow-values-expected.txt ('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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 if (toHTMLPlugInElement(element).usePlaceholderContent()) { 418 if (toHTMLPlugInElement(element).usePlaceholderContent()) {
419 if (style.width().isAuto()) 419 if (style.width().isAuto())
420 style.setWidth(Length(LayoutReplaced::defaultWidth, Fixed)); 420 style.setWidth(Length(LayoutReplaced::defaultWidth, Fixed));
421 if (style.height().isAuto()) 421 if (style.height().isAuto())
422 style.setHeight(Length(LayoutReplaced::defaultHeight, Fixed)); 422 style.setHeight(Length(LayoutReplaced::defaultHeight, Fixed));
423 } 423 }
424 424
425 return; 425 return;
426 } 426 }
427 } 427 }
428 inline bool overflowValueAllowedOnTable(EOverflow overflow)
429 {
430 return overflow == OSCROLL || overflow == OAUTO || overflow == OOVERLAY || o verflow == OPAGEDX || overflow == OPAGEDY;
mstensho (USE GERRIT) 2015/07/27 09:33:30 None of these values are allowed on tables (and th
rhogan 2015/07/27 18:18:55 Haha, just testing! ;)
Julien - ping for review 2015/07/27 20:08:34 Looks like I am overruled on that. /me goes back
431 }
428 432
429 void StyleAdjuster::adjustOverflow(ComputedStyle& style) 433 void StyleAdjuster::adjustOverflow(ComputedStyle& style)
430 { 434 {
431 ASSERT(style.overflowX() != OVISIBLE || style.overflowY() != OVISIBLE); 435 ASSERT(style.overflowX() != OVISIBLE || style.overflowY() != OVISIBLE);
432 436
433 // If either overflow value is not visible, change to auto. 437 if (style.display() == TABLE || style.display() == INLINE_TABLE) {
434 if (style.overflowX() == OVISIBLE && style.overflowY() != OVISIBLE) { 438 // Tables only support overflow:hidden and overflow:visible and ignore a nything else,
439 // see http://dev.w3.org/csswg/css2/visufx.html#overflow. As a table is not a block
440 // container box the rules for resolving conflicting x and y values in C SS Overflow Module
441 // Level 3 do not apply. Arguably overflow-x and overflow-y aren't allow ed on tables but
442 // all UAs allow it.
443 if (overflowValueAllowedOnTable(style.overflowX()))
444 style.setOverflowX(OVISIBLE);
445 if (overflowValueAllowedOnTable(style.overflowY()))
446 style.setOverflowY(OVISIBLE);
447 // If we are left with conflicting overflow values for the x and y axes on a table then resolve
448 // both to OVISIBLE. This is interoperable behaviour but is not specced anywhere.
449 if (style.overflowX() == OVISIBLE && style.overflowY() != OVISIBLE)
mstensho (USE GERRIT) 2015/07/27 09:33:30 No need for the style.overflowY() != OVISIBLE cond
rhogan 2015/07/27 18:18:55 Right enough!
450 style.setOverflowY(OVISIBLE);
451 else if (style.overflowY() == OVISIBLE && style.overflowX() != OVISIBLE)
mstensho (USE GERRIT) 2015/07/27 09:33:30 ditto.
452 style.setOverflowX(OVISIBLE);
453 } else if (style.overflowX() == OVISIBLE && style.overflowY() != OVISIBLE) {
454 // If either overflow value is not visible, change to auto.
435 // FIXME: Once we implement pagination controls, overflow-x should defau lt to hidden 455 // FIXME: Once we implement pagination controls, overflow-x should defau lt to hidden
436 // if overflow-y is set to -webkit-paged-x or -webkit-page-y. For now, w e'll let it 456 // if overflow-y is set to -webkit-paged-x or -webkit-page-y. For now, w e'll let it
437 // default to auto so we can at least scroll through the pages. 457 // default to auto so we can at least scroll through the pages.
438 style.setOverflowX(OAUTO); 458 style.setOverflowX(OAUTO);
439 } else if (style.overflowY() == OVISIBLE && style.overflowX() != OVISIBLE) { 459 } else if (style.overflowY() == OVISIBLE && style.overflowX() != OVISIBLE) {
440 style.setOverflowY(OAUTO); 460 style.setOverflowY(OAUTO);
441 } 461 }
442 462
443 // Table rows, sections and the table itself will support overflow:hidden an d will ignore scroll/auto.
444 // FIXME: Eventually table sections will support auto and scroll.
445 if (style.display() == TABLE || style.display() == INLINE_TABLE
446 || style.display() == TABLE_ROW_GROUP || style.display() == TABLE_ROW) {
447 if (style.overflowX() != OVISIBLE && style.overflowX() != OHIDDEN)
448 style.setOverflowX(OVISIBLE);
449 if (style.overflowY() != OVISIBLE && style.overflowY() != OHIDDEN)
450 style.setOverflowY(OVISIBLE);
451 }
452
453 // Menulists should have visible overflow 463 // Menulists should have visible overflow
454 if (style.appearance() == MenulistPart) { 464 if (style.appearance() == MenulistPart) {
455 style.setOverflowX(OVISIBLE); 465 style.setOverflowX(OVISIBLE);
456 style.setOverflowY(OVISIBLE); 466 style.setOverflowY(OVISIBLE);
457 } 467 }
458 } 468 }
459 469
460 void StyleAdjuster::adjustStyleForDisplay(ComputedStyle& style, const ComputedSt yle& parentStyle) 470 void StyleAdjuster::adjustStyleForDisplay(ComputedStyle& style, const ComputedSt yle& parentStyle)
461 { 471 {
462 if (style.display() == BLOCK && !style.isFloating()) 472 if (style.display() == BLOCK && !style.isFloating())
(...skipping 25 matching lines...) Expand all
488 if (style.writingMode() != TopToBottomWritingMode && (style.display() == BOX || style.display() == INLINE_BOX)) 498 if (style.writingMode() != TopToBottomWritingMode && (style.display() == BOX || style.display() == INLINE_BOX))
489 style.setWritingMode(TopToBottomWritingMode); 499 style.setWritingMode(TopToBottomWritingMode);
490 500
491 if (parentStyle.isDisplayFlexibleOrGridBox()) { 501 if (parentStyle.isDisplayFlexibleOrGridBox()) {
492 style.setFloating(NoFloat); 502 style.setFloating(NoFloat);
493 style.setDisplay(equivalentBlockDisplay(style.display(), style.isFloatin g(), !m_useQuirksModeStyles)); 503 style.setDisplay(equivalentBlockDisplay(style.display(), style.isFloatin g(), !m_useQuirksModeStyles));
494 } 504 }
495 } 505 }
496 506
497 } 507 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/table/table-different-overflow-values-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698