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 30 matching lines...) Expand all Loading... |
41 #include "core/rendering/RenderBlock.h" | 41 #include "core/rendering/RenderBlock.h" |
42 #include "core/rendering/RenderListItem.h" | 42 #include "core/rendering/RenderListItem.h" |
43 #include "core/rendering/RenderListMarker.h" | 43 #include "core/rendering/RenderListMarker.h" |
44 #include "core/rendering/RenderTableCell.h" | 44 #include "core/rendering/RenderTableCell.h" |
45 #include "core/rendering/RenderView.h" | 45 #include "core/rendering/RenderView.h" |
46 | 46 |
47 #ifdef AUTOSIZING_DOM_DEBUG_INFO | 47 #ifdef AUTOSIZING_DOM_DEBUG_INFO |
48 #include "core/dom/ExecutionContextTask.h" | 48 #include "core/dom/ExecutionContextTask.h" |
49 #endif | 49 #endif |
50 | 50 |
51 using namespace std; | |
52 | |
53 namespace WebCore { | 51 namespace WebCore { |
54 | 52 |
55 #ifdef AUTOSIZING_DOM_DEBUG_INFO | 53 #ifdef AUTOSIZING_DOM_DEBUG_INFO |
56 class WriteDebugInfoTask : public ExecutionContextTask { | 54 class WriteDebugInfoTask : public ExecutionContextTask { |
57 public: | 55 public: |
58 WriteDebugInfoTask(PassRefPtrWillBeRawPtr<Element> element, AtomicString val
ue) | 56 WriteDebugInfoTask(PassRefPtrWillBeRawPtr<Element> element, AtomicString val
ue) |
59 : m_element(element) | 57 : m_element(element) |
60 , m_value(value) | 58 , m_value(value) |
61 { | 59 { |
62 } | 60 } |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 | 853 |
856 float FastTextAutosizer::multiplierFromBlock(const RenderBlock* block) | 854 float FastTextAutosizer::multiplierFromBlock(const RenderBlock* block) |
857 { | 855 { |
858 // If block->needsLayout() is false, it does not need to be in m_blocksThatH
aveBegunLayout. | 856 // If block->needsLayout() is false, it does not need to be in m_blocksThatH
aveBegunLayout. |
859 // This can happen during layout of a positioned object if the cluster's DBC
AT is deeper | 857 // This can happen during layout of a positioned object if the cluster's DBC
AT is deeper |
860 // than the positioned object's containing block, and wasn't marked as needi
ng layout. | 858 // than the positioned object's containing block, and wasn't marked as needi
ng layout. |
861 ASSERT(m_blocksThatHaveBegunLayout.contains(block) || !block->needsLayout())
; | 859 ASSERT(m_blocksThatHaveBegunLayout.contains(block) || !block->needsLayout())
; |
862 | 860 |
863 // Block width, in CSS pixels. | 861 // Block width, in CSS pixels. |
864 float blockWidth = widthFromBlock(block); | 862 float blockWidth = widthFromBlock(block); |
865 float multiplier = m_pageInfo.m_frameWidth ? min(blockWidth, static_cast<flo
at>(m_pageInfo.m_layoutWidth)) / m_pageInfo.m_frameWidth : 1.0f; | 863 float multiplier = m_pageInfo.m_frameWidth ? std::min(blockWidth, static_cas
t<float>(m_pageInfo.m_layoutWidth)) / m_pageInfo.m_frameWidth : 1.0f; |
866 | 864 |
867 return max(m_pageInfo.m_baseMultiplier * multiplier, 1.0f); | 865 return std::max(m_pageInfo.m_baseMultiplier * multiplier, 1.0f); |
868 } | 866 } |
869 | 867 |
870 const RenderBlock* FastTextAutosizer::deepestBlockContainingAllText(Cluster* clu
ster) | 868 const RenderBlock* FastTextAutosizer::deepestBlockContainingAllText(Cluster* clu
ster) |
871 { | 869 { |
872 if (!cluster->m_deepestBlockContainingAllText) | 870 if (!cluster->m_deepestBlockContainingAllText) |
873 cluster->m_deepestBlockContainingAllText = deepestBlockContainingAllText
(cluster->m_root); | 871 cluster->m_deepestBlockContainingAllText = deepestBlockContainingAllText
(cluster->m_root); |
874 | 872 |
875 return cluster->m_deepestBlockContainingAllText; | 873 return cluster->m_deepestBlockContainingAllText; |
876 } | 874 } |
877 | 875 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 FastTextAutosizer::DeferUpdatePageInfo::~DeferUpdatePageInfo() | 1120 FastTextAutosizer::DeferUpdatePageInfo::~DeferUpdatePageInfo() |
1123 { | 1121 { |
1124 if (FastTextAutosizer* textAutosizer = m_mainFrame->document()->fastTextAuto
sizer()) { | 1122 if (FastTextAutosizer* textAutosizer = m_mainFrame->document()->fastTextAuto
sizer()) { |
1125 ASSERT(textAutosizer->m_updatePageInfoDeferred); | 1123 ASSERT(textAutosizer->m_updatePageInfoDeferred); |
1126 textAutosizer->m_updatePageInfoDeferred = false; | 1124 textAutosizer->m_updatePageInfoDeferred = false; |
1127 textAutosizer->updatePageInfoInAllFrames(); | 1125 textAutosizer->updatePageInfoInAllFrames(); |
1128 } | 1126 } |
1129 } | 1127 } |
1130 | 1128 |
1131 } // namespace WebCore | 1129 } // namespace WebCore |
OLD | NEW |