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 22 matching lines...) Expand all Loading... |
33 #include "core/dom/Document.h" | 33 #include "core/dom/Document.h" |
34 #include "core/frame/FrameHost.h" | 34 #include "core/frame/FrameHost.h" |
35 #include "core/frame/FrameView.h" | 35 #include "core/frame/FrameView.h" |
36 #include "core/frame/LocalFrame.h" | 36 #include "core/frame/LocalFrame.h" |
37 #include "core/frame/Settings.h" | 37 #include "core/frame/Settings.h" |
38 #include "core/frame/VisualViewport.h" | 38 #include "core/frame/VisualViewport.h" |
39 #include "core/html/HTMLTextAreaElement.h" | 39 #include "core/html/HTMLTextAreaElement.h" |
40 #include "core/layout/LayoutBlock.h" | 40 #include "core/layout/LayoutBlock.h" |
41 #include "core/layout/LayoutListItem.h" | 41 #include "core/layout/LayoutListItem.h" |
42 #include "core/layout/LayoutListMarker.h" | 42 #include "core/layout/LayoutListMarker.h" |
| 43 #include "core/layout/LayoutTable.h" |
43 #include "core/layout/LayoutTableCell.h" | 44 #include "core/layout/LayoutTableCell.h" |
44 #include "core/layout/LayoutView.h" | 45 #include "core/layout/LayoutView.h" |
45 #include "core/layout/line/InlineIterator.h" | 46 #include "core/layout/line/InlineIterator.h" |
46 #include "core/page/Page.h" | 47 #include "core/page/Page.h" |
47 | 48 |
48 #ifdef AUTOSIZING_DOM_DEBUG_INFO | 49 #ifdef AUTOSIZING_DOM_DEBUG_INFO |
49 #include "core/dom/ExecutionContextTask.h" | 50 #include "core/dom/ExecutionContextTask.h" |
50 #endif | 51 #endif |
51 | 52 |
52 namespace blink { | 53 namespace blink { |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 , m_blocksThatHaveBegunLayout() | 287 , m_blocksThatHaveBegunLayout() |
287 #endif | 288 #endif |
288 , m_superclusters() | 289 , m_superclusters() |
289 , m_clusterStack() | 290 , m_clusterStack() |
290 , m_fingerprintMapper() | 291 , m_fingerprintMapper() |
291 , m_pageInfo() | 292 , m_pageInfo() |
292 , m_updatePageInfoDeferred(false) | 293 , m_updatePageInfoDeferred(false) |
293 { | 294 { |
294 } | 295 } |
295 | 296 |
| 297 TextAutosizer::~TextAutosizer() |
| 298 { |
| 299 } |
| 300 |
296 void TextAutosizer::record(const LayoutBlock* block) | 301 void TextAutosizer::record(const LayoutBlock* block) |
297 { | 302 { |
298 if (!m_pageInfo.m_settingEnabled) | 303 if (!m_pageInfo.m_settingEnabled) |
299 return; | 304 return; |
300 | 305 |
301 ASSERT(!m_blocksThatHaveBegunLayout.contains(block)); | 306 ASSERT(!m_blocksThatHaveBegunLayout.contains(block)); |
302 | 307 |
303 if (!classifyBlock(block, INDEPENDENT | EXPLICIT_WIDTH)) | 308 if (!classifyBlock(block, INDEPENDENT | EXPLICIT_WIDTH)) |
304 return; | 309 return; |
305 | 310 |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 | 1038 |
1034 return false; | 1039 return false; |
1035 } | 1040 } |
1036 | 1041 |
1037 TextAutosizer::Cluster* TextAutosizer::currentCluster() const | 1042 TextAutosizer::Cluster* TextAutosizer::currentCluster() const |
1038 { | 1043 { |
1039 ASSERT_WITH_SECURITY_IMPLICATION(!m_clusterStack.isEmpty()); | 1044 ASSERT_WITH_SECURITY_IMPLICATION(!m_clusterStack.isEmpty()); |
1040 return m_clusterStack.last().get(); | 1045 return m_clusterStack.last().get(); |
1041 } | 1046 } |
1042 | 1047 |
| 1048 TextAutosizer::Cluster::Cluster(const LayoutBlock* root, BlockFlags flags, Clust
er* parent, Supercluster* supercluster) |
| 1049 : m_root(root) |
| 1050 , m_flags(flags) |
| 1051 , m_deepestBlockContainingAllText(nullptr) |
| 1052 , m_parent(parent) |
| 1053 , m_multiplier(0) |
| 1054 , m_hasEnoughTextToAutosize(UnknownAmountOfText) |
| 1055 , m_supercluster(supercluster) |
| 1056 , m_hasTableAncestor(root->isTableCell() || (m_parent && m_parent->m_hasTabl
eAncestor)) |
| 1057 { |
| 1058 } |
| 1059 |
1043 #if ENABLE(ASSERT) | 1060 #if ENABLE(ASSERT) |
1044 void TextAutosizer::FingerprintMapper::assertMapsAreConsistent() | 1061 void TextAutosizer::FingerprintMapper::assertMapsAreConsistent() |
1045 { | 1062 { |
1046 // For each fingerprint -> block mapping in m_blocksForFingerprint we should
have an associated | 1063 // For each fingerprint -> block mapping in m_blocksForFingerprint we should
have an associated |
1047 // map from block -> fingerprint in m_fingerprints. | 1064 // map from block -> fingerprint in m_fingerprints. |
1048 ReverseFingerprintMap::iterator end = m_blocksForFingerprint.end(); | 1065 ReverseFingerprintMap::iterator end = m_blocksForFingerprint.end(); |
1049 for (ReverseFingerprintMap::iterator fingerprintIt = m_blocksForFingerprint.
begin(); fingerprintIt != end; ++fingerprintIt) { | 1066 for (ReverseFingerprintMap::iterator fingerprintIt = m_blocksForFingerprint.
begin(); fingerprintIt != end; ++fingerprintIt) { |
1050 Fingerprint fingerprint = fingerprintIt->key; | 1067 Fingerprint fingerprint = fingerprintIt->key; |
1051 BlockSet* blocks = fingerprintIt->value.get(); | 1068 BlockSet* blocks = fingerprintIt->value.get(); |
1052 for (BlockSet::iterator blockIt = blocks->begin(); blockIt != blocks->en
d(); ++blockIt) { | 1069 for (BlockSet::iterator blockIt = blocks->begin(); blockIt != blocks->en
d(); ++blockIt) { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 } | 1201 } |
1185 return computedSize; | 1202 return computedSize; |
1186 } | 1203 } |
1187 | 1204 |
1188 DEFINE_TRACE(TextAutosizer) | 1205 DEFINE_TRACE(TextAutosizer) |
1189 { | 1206 { |
1190 visitor->trace(m_document); | 1207 visitor->trace(m_document); |
1191 } | 1208 } |
1192 | 1209 |
1193 } // namespace blink | 1210 } // namespace blink |
OLD | NEW |