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

Side by Side Diff: Source/core/rendering/FastTextAutosizer.cpp

Issue 257273002: Descend into inner tables for has-enough-text check. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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/text-autosizing/nested-table-expected.html ('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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 return false; 609 return false;
610 } 610 }
611 611
612 // 4 lines of text is considered enough to autosize. 612 // 4 lines of text is considered enough to autosize.
613 float minimumTextLengthToAutosize = widthFromBlock(widthProvider) * 4; 613 float minimumTextLengthToAutosize = widthFromBlock(widthProvider) * 4;
614 614
615 float length = 0; 615 float length = 0;
616 RenderObject* descendant = root->nextInPreOrder(root); 616 RenderObject* descendant = root->nextInPreOrder(root);
617 while (descendant) { 617 while (descendant) {
618 if (descendant->isRenderBlock()) { 618 if (descendant->isRenderBlock()) {
619 if (!descendant->isTableCell() && classifyBlock(descendant, INDEPEND ENT | SUPPRESSING)) { 619 if (!(descendant->isTableCell() || (root->isTableCell() && descendan t->isTable()))
620 && classifyBlock(descendant, INDEPENDENT | SUPPRESSING)) {
620 descendant = descendant->nextInPreOrderAfterChildren(root); 621 descendant = descendant->nextInPreOrderAfterChildren(root);
621 continue; 622 continue;
622 } 623 }
623 } else if (descendant->isText()) { 624 } else if (descendant->isText()) {
624 // Note: Using text().stripWhiteSpace().length() instead of rendered TextLength() because 625 // Note: Using text().stripWhiteSpace().length() instead of rendered TextLength() because
625 // the lineboxes will not be built until layout. These values can be different. 626 // the lineboxes will not be built until layout. These values can be different.
626 // Note: This is an approximation assuming each character is 1em wid e. 627 // Note: This is an approximation assuming each character is 1em wid e.
627 length += toRenderText(descendant)->text().stripWhiteSpace().length( ) * descendant->style()->specifiedFontSize(); 628 length += toRenderText(descendant)->text().stripWhiteSpace().length( ) * descendant->style()->specifiedFontSize();
628 629
629 if (length >= minimumTextLengthToAutosize) { 630 if (length >= minimumTextLengthToAutosize) {
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 FastTextAutosizer::DeferUpdatePageInfo::~DeferUpdatePageInfo() 1096 FastTextAutosizer::DeferUpdatePageInfo::~DeferUpdatePageInfo()
1096 { 1097 {
1097 if (FastTextAutosizer* textAutosizer = m_mainFrame->document()->fastTextAuto sizer()) { 1098 if (FastTextAutosizer* textAutosizer = m_mainFrame->document()->fastTextAuto sizer()) {
1098 ASSERT(textAutosizer->m_updatePageInfoDeferred); 1099 ASSERT(textAutosizer->m_updatePageInfoDeferred);
1099 textAutosizer->m_updatePageInfoDeferred = false; 1100 textAutosizer->m_updatePageInfoDeferred = false;
1100 textAutosizer->updatePageInfoInAllFrames(); 1101 textAutosizer->updatePageInfoInAllFrames();
1101 } 1102 }
1102 } 1103 }
1103 1104
1104 } // namespace WebCore 1105 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/text-autosizing/nested-table-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698