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 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 if (!cluster->deepest_block_containing_all_text_) | 1002 if (!cluster->deepest_block_containing_all_text_) |
1003 cluster->deepest_block_containing_all_text_ = | 1003 cluster->deepest_block_containing_all_text_ = |
1004 DeepestBlockContainingAllText(cluster->root_); | 1004 DeepestBlockContainingAllText(cluster->root_); |
1005 | 1005 |
1006 return cluster->deepest_block_containing_all_text_; | 1006 return cluster->deepest_block_containing_all_text_; |
1007 } | 1007 } |
1008 | 1008 |
1009 // FIXME: Refactor this to look more like TextAutosizer::deepestCommonAncestor. | 1009 // FIXME: Refactor this to look more like TextAutosizer::deepestCommonAncestor. |
1010 const LayoutBlock* TextAutosizer::DeepestBlockContainingAllText( | 1010 const LayoutBlock* TextAutosizer::DeepestBlockContainingAllText( |
1011 const LayoutBlock* root) const { | 1011 const LayoutBlock* root) const { |
| 1012 // To avoid font-size shaking caused by the change of LayoutView's |
| 1013 // DeepestBlockContainingAllText. |
| 1014 if (root->IsLayoutView()) |
| 1015 return root; |
| 1016 |
1012 size_t first_depth = 0; | 1017 size_t first_depth = 0; |
1013 const LayoutObject* first_text_leaf = FindTextLeaf(root, first_depth, kFirst); | 1018 const LayoutObject* first_text_leaf = FindTextLeaf(root, first_depth, kFirst); |
1014 if (!first_text_leaf) | 1019 if (!first_text_leaf) |
1015 return root; | 1020 return root; |
1016 | 1021 |
1017 size_t last_depth = 0; | 1022 size_t last_depth = 0; |
1018 const LayoutObject* last_text_leaf = FindTextLeaf(root, last_depth, kLast); | 1023 const LayoutObject* last_text_leaf = FindTextLeaf(root, last_depth, kLast); |
1019 DCHECK(last_text_leaf); | 1024 DCHECK(last_text_leaf); |
1020 | 1025 |
1021 // Equalize the depths if necessary. Only one of the while loops below will | 1026 // Equalize the depths if necessary. Only one of the while loops below will |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 } | 1393 } |
1389 } | 1394 } |
1390 potentially_inconsistent_superclusters.clear(); | 1395 potentially_inconsistent_superclusters.clear(); |
1391 } | 1396 } |
1392 | 1397 |
1393 DEFINE_TRACE(TextAutosizer) { | 1398 DEFINE_TRACE(TextAutosizer) { |
1394 visitor->Trace(document_); | 1399 visitor->Trace(document_); |
1395 } | 1400 } |
1396 | 1401 |
1397 } // namespace blink | 1402 } // namespace blink |
OLD | NEW |