| 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 20 matching lines...) Expand all Loading... |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/layout/TextAutosizer.h" | 32 #include "core/layout/TextAutosizer.h" |
| 33 | 33 |
| 34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
| 35 #include "core/frame/FrameHost.h" | 35 #include "core/frame/FrameHost.h" |
| 36 #include "core/frame/FrameView.h" | 36 #include "core/frame/FrameView.h" |
| 37 #include "core/frame/LocalFrame.h" | 37 #include "core/frame/LocalFrame.h" |
| 38 #include "core/frame/PinchViewport.h" | 38 #include "core/frame/PinchViewport.h" |
| 39 #include "core/frame/Settings.h" | 39 #include "core/frame/Settings.h" |
| 40 #include "core/html/HTMLTextAreaElement.h" | 40 #include "core/html/HTMLTextAreaElement.h" |
| 41 #include "core/layout/LayoutListItem.h" |
| 42 #include "core/layout/LayoutListMarker.h" |
| 41 #include "core/layout/LayoutTableCell.h" | 43 #include "core/layout/LayoutTableCell.h" |
| 42 #include "core/layout/line/InlineIterator.h" | 44 #include "core/layout/line/InlineIterator.h" |
| 43 #include "core/page/Page.h" | 45 #include "core/page/Page.h" |
| 44 #include "core/rendering/RenderBlock.h" | 46 #include "core/rendering/RenderBlock.h" |
| 45 #include "core/rendering/RenderListItem.h" | |
| 46 #include "core/rendering/RenderListMarker.h" | |
| 47 #include "core/rendering/RenderView.h" | 47 #include "core/rendering/RenderView.h" |
| 48 | 48 |
| 49 #ifdef AUTOSIZING_DOM_DEBUG_INFO | 49 #ifdef AUTOSIZING_DOM_DEBUG_INFO |
| 50 #include "core/dom/ExecutionContextTask.h" | 50 #include "core/dom/ExecutionContextTask.h" |
| 51 #endif | 51 #endif |
| 52 | 52 |
| 53 namespace blink { | 53 namespace blink { |
| 54 | 54 |
| 55 #ifdef AUTOSIZING_DOM_DEBUG_INFO | 55 #ifdef AUTOSIZING_DOM_DEBUG_INFO |
| 56 class WriteDebugInfoTask : public ExecutionContextTask { | 56 class WriteDebugInfoTask : public ExecutionContextTask { |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 | 365 |
| 366 if (Cluster* cluster = maybeCreateCluster(block)) | 366 if (Cluster* cluster = maybeCreateCluster(block)) |
| 367 m_clusterStack.append(adoptPtr(cluster)); | 367 m_clusterStack.append(adoptPtr(cluster)); |
| 368 | 368 |
| 369 // Cells in auto-layout tables are handled separately by inflateAutoTable. | 369 // Cells in auto-layout tables are handled separately by inflateAutoTable. |
| 370 bool isAutoTableCell = block->isTableCell() && !toLayoutTableCell(block)->ta
ble()->style()->isFixedTableLayout(); | 370 bool isAutoTableCell = block->isTableCell() && !toLayoutTableCell(block)->ta
ble()->style()->isFixedTableLayout(); |
| 371 if (!isAutoTableCell && !m_clusterStack.isEmpty()) | 371 if (!isAutoTableCell && !m_clusterStack.isEmpty()) |
| 372 inflate(block); | 372 inflate(block); |
| 373 } | 373 } |
| 374 | 374 |
| 375 void TextAutosizer::inflateListItem(RenderListItem* listItem, RenderListMarker*
listItemMarker) | 375 void TextAutosizer::inflateListItem(LayoutListItem* listItem, LayoutListMarker*
listItemMarker) |
| 376 { | 376 { |
| 377 if (!shouldHandleLayout()) | 377 if (!shouldHandleLayout()) |
| 378 return; | 378 return; |
| 379 ASSERT(listItem && listItemMarker); | 379 ASSERT(listItem && listItemMarker); |
| 380 | 380 |
| 381 if (prepareForLayout(listItem) == StopLayout) | 381 if (prepareForLayout(listItem) == StopLayout) |
| 382 return; | 382 return; |
| 383 | 383 |
| 384 // Force the LI to be inside the DBCAT when computing the multiplier. | 384 // Force the LI to be inside the DBCAT when computing the multiplier. |
| 385 // This guarantees that the DBCAT has entered layout, so we can ask for its
width. | 385 // This guarantees that the DBCAT has entered layout, so we can ask for its
width. |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 if (!containingBlock) | 936 if (!containingBlock) |
| 937 return root; | 937 return root; |
| 938 | 938 |
| 939 ASSERT(containingBlock->isDescendantOf(root)); | 939 ASSERT(containingBlock->isDescendantOf(root)); |
| 940 return containingBlock; | 940 return containingBlock; |
| 941 } | 941 } |
| 942 | 942 |
| 943 const LayoutObject* TextAutosizer::findTextLeaf(const LayoutObject* parent, size
_t& depth, TextLeafSearch firstOrLast) const | 943 const LayoutObject* TextAutosizer::findTextLeaf(const LayoutObject* parent, size
_t& depth, TextLeafSearch firstOrLast) const |
| 944 { | 944 { |
| 945 // List items are treated as text due to the marker. | 945 // List items are treated as text due to the marker. |
| 946 // The actual renderer for the marker (RenderListMarker) may not be in the t
ree yet since it is added during layout. | 946 // The actual renderer for the marker (LayoutListMarker) may not be in the t
ree yet since it is added during layout. |
| 947 if (parent->isListItem()) | 947 if (parent->isListItem()) |
| 948 return parent; | 948 return parent; |
| 949 | 949 |
| 950 if (parent->isText()) | 950 if (parent->isText()) |
| 951 return parent; | 951 return parent; |
| 952 | 952 |
| 953 ++depth; | 953 ++depth; |
| 954 const LayoutObject* child = (firstOrLast == First) ? parent->slowFirstChild(
) : parent->slowLastChild(); | 954 const LayoutObject* child = (firstOrLast == First) ? parent->slowFirstChild(
) : parent->slowLastChild(); |
| 955 while (child) { | 955 while (child) { |
| 956 // Note: At this point clusters may not have been created for these bloc
ks so we cannot rely | 956 // Note: At this point clusters may not have been created for these bloc
ks so we cannot rely |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 } | 1174 } |
| 1175 return computedSize; | 1175 return computedSize; |
| 1176 } | 1176 } |
| 1177 | 1177 |
| 1178 DEFINE_TRACE(TextAutosizer) | 1178 DEFINE_TRACE(TextAutosizer) |
| 1179 { | 1179 { |
| 1180 visitor->trace(m_document); | 1180 visitor->trace(m_document); |
| 1181 } | 1181 } |
| 1182 | 1182 |
| 1183 } // namespace blink | 1183 } // namespace blink |
| OLD | NEW |