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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 #endif | 714 #endif |
715 return cluster; | 715 return cluster; |
716 } | 716 } |
717 | 717 |
718 FastTextAutosizer::Supercluster* FastTextAutosizer::getSupercluster(const Render
Block* block) | 718 FastTextAutosizer::Supercluster* FastTextAutosizer::getSupercluster(const Render
Block* block) |
719 { | 719 { |
720 Fingerprint fingerprint = m_fingerprintMapper.get(block); | 720 Fingerprint fingerprint = m_fingerprintMapper.get(block); |
721 if (!fingerprint) | 721 if (!fingerprint) |
722 return 0; | 722 return 0; |
723 | 723 |
724 BlockSet* roots = &m_fingerprintMapper.getTentativeClusterRoots(fingerprint)
; | 724 BlockSet* roots = m_fingerprintMapper.getTentativeClusterRoots(fingerprint); |
725 if (!roots || roots->size() < 2 || !roots->contains(block)) | 725 if (!roots || roots->size() < 2 || !roots->contains(block)) |
726 return 0; | 726 return 0; |
727 | 727 |
728 SuperclusterMap::AddResult addResult = m_superclusters.add(fingerprint, Pass
OwnPtr<Supercluster>()); | 728 SuperclusterMap::AddResult addResult = m_superclusters.add(fingerprint, Pass
OwnPtr<Supercluster>()); |
729 if (!addResult.isNewEntry) | 729 if (!addResult.isNewEntry) |
730 return addResult.storedValue->value.get(); | 730 return addResult.storedValue->value.get(); |
731 | 731 |
732 Supercluster* supercluster = new Supercluster(roots); | 732 Supercluster* supercluster = new Supercluster(roots); |
733 addResult.storedValue->value = adoptPtr(supercluster); | 733 addResult.storedValue->value = adoptPtr(supercluster); |
734 return supercluster; | 734 return supercluster; |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 assertMapsAreConsistent(); | 1067 assertMapsAreConsistent(); |
1068 #endif | 1068 #endif |
1069 return true; | 1069 return true; |
1070 } | 1070 } |
1071 | 1071 |
1072 FastTextAutosizer::Fingerprint FastTextAutosizer::FingerprintMapper::get(const R
enderObject* renderer) | 1072 FastTextAutosizer::Fingerprint FastTextAutosizer::FingerprintMapper::get(const R
enderObject* renderer) |
1073 { | 1073 { |
1074 return m_fingerprints.get(renderer); | 1074 return m_fingerprints.get(renderer); |
1075 } | 1075 } |
1076 | 1076 |
1077 FastTextAutosizer::BlockSet& FastTextAutosizer::FingerprintMapper::getTentativeC
lusterRoots(Fingerprint fingerprint) | 1077 FastTextAutosizer::BlockSet* FastTextAutosizer::FingerprintMapper::getTentativeC
lusterRoots(Fingerprint fingerprint) |
1078 { | 1078 { |
1079 return *m_blocksForFingerprint.get(fingerprint); | 1079 return m_blocksForFingerprint.get(fingerprint); |
1080 } | 1080 } |
1081 | 1081 |
1082 FastTextAutosizer::LayoutScope::LayoutScope(RenderBlock* block) | 1082 FastTextAutosizer::LayoutScope::LayoutScope(RenderBlock* block) |
1083 : m_textAutosizer(block->document().fastTextAutosizer()) | 1083 : m_textAutosizer(block->document().fastTextAutosizer()) |
1084 , m_block(block) | 1084 , m_block(block) |
1085 { | 1085 { |
1086 if (!m_textAutosizer) | 1086 if (!m_textAutosizer) |
1087 return; | 1087 return; |
1088 | 1088 |
1089 if (m_textAutosizer->shouldHandleLayout()) | 1089 if (m_textAutosizer->shouldHandleLayout()) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 computedSize = multiplier * specifiedSize; | 1148 computedSize = multiplier * specifiedSize; |
1149 } else { | 1149 } else { |
1150 computedSize = multiplier * pleasantSize + gradientAfterPleasantSize * (
specifiedSize - pleasantSize); | 1150 computedSize = multiplier * pleasantSize + gradientAfterPleasantSize * (
specifiedSize - pleasantSize); |
1151 if (computedSize < specifiedSize) | 1151 if (computedSize < specifiedSize) |
1152 computedSize = specifiedSize; | 1152 computedSize = specifiedSize; |
1153 } | 1153 } |
1154 return computedSize; | 1154 return computedSize; |
1155 } | 1155 } |
1156 | 1156 |
1157 } // namespace blink | 1157 } // namespace blink |
OLD | NEW |