OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |