OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 , m_inProgrammaticScroll(false) | 141 , m_inProgrammaticScroll(false) |
142 , m_deferredRepaintTimer(this, &FrameView::deferredRepaintTimerFired) | 142 , m_deferredRepaintTimer(this, &FrameView::deferredRepaintTimerFired) |
143 , m_disableRepaints(0) | 143 , m_disableRepaints(0) |
144 , m_isTrackingRepaints(false) | 144 , m_isTrackingRepaints(false) |
145 , m_shouldUpdateWhileOffscreen(true) | 145 , m_shouldUpdateWhileOffscreen(true) |
146 , m_deferSetNeedsLayouts(0) | 146 , m_deferSetNeedsLayouts(0) |
147 , m_setNeedsLayoutWasDeferred(false) | 147 , m_setNeedsLayoutWasDeferred(false) |
148 , m_scrollCorner(0) | 148 , m_scrollCorner(0) |
149 , m_shouldAutoSize(false) | 149 , m_shouldAutoSize(false) |
150 , m_inAutoSize(false) | 150 , m_inAutoSize(false) |
| 151 , m_didRunAutosize(false) |
151 { | 152 { |
152 init(); | 153 init(); |
153 | 154 |
154 // FIXME: Can m_frame ever be null here? | 155 // FIXME: Can m_frame ever be null here? |
155 if (!m_frame) | 156 if (!m_frame) |
156 return; | 157 return; |
157 | 158 |
158 Page* page = m_frame->page(); | 159 Page* page = m_frame->page(); |
159 if (!page) | 160 if (!page) |
160 return; | 161 return; |
(...skipping 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2413 | 2414 |
2414 RenderView* documentView = document->renderView(); | 2415 RenderView* documentView = document->renderView(); |
2415 Element* documentElement = document->documentElement(); | 2416 Element* documentElement = document->documentElement(); |
2416 if (!documentView || !documentElement) | 2417 if (!documentView || !documentElement) |
2417 return; | 2418 return; |
2418 | 2419 |
2419 RenderBox* documentRenderBox = documentElement->renderBox(); | 2420 RenderBox* documentRenderBox = documentElement->renderBox(); |
2420 if (!documentRenderBox) | 2421 if (!documentRenderBox) |
2421 return; | 2422 return; |
2422 | 2423 |
| 2424 // If this is the first time we run autosize, start from small height and |
| 2425 // allow it to grow. |
| 2426 if (!m_didRunAutosize) |
| 2427 resize(frameRect().width(), m_minAutoSize.height()); |
| 2428 |
2423 // Do the resizing twice. The first time is basically a rough calculation us
ing the preferred width | 2429 // Do the resizing twice. The first time is basically a rough calculation us
ing the preferred width |
2424 // which may result in a height change during the second iteration. | 2430 // which may result in a height change during the second iteration. |
2425 for (int i = 0; i < 2; i++) { | 2431 for (int i = 0; i < 2; i++) { |
2426 // Update various sizes including contentsSize, scrollHeight, etc. | 2432 // Update various sizes including contentsSize, scrollHeight, etc. |
2427 document->updateLayoutIgnorePendingStylesheets(); | 2433 document->updateLayoutIgnorePendingStylesheets(); |
2428 IntSize size = frameRect().size(); | 2434 IntSize size = frameRect().size(); |
2429 int width = documentView->minPreferredLogicalWidth(); | 2435 int width = documentView->minPreferredLogicalWidth(); |
2430 int height = documentRenderBox->scrollHeight(); | 2436 int height = documentRenderBox->scrollHeight(); |
2431 IntSize newSize(width, height); | 2437 IntSize newSize(width, height); |
2432 | 2438 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2469 verticalScrollbarMode = ScrollbarAlwaysOn; | 2475 verticalScrollbarMode = ScrollbarAlwaysOn; |
2470 } | 2476 } |
2471 | 2477 |
2472 if (newSize == size) | 2478 if (newSize == size) |
2473 continue; | 2479 continue; |
2474 | 2480 |
2475 // Avoid doing resizing to a smaller size while the frame is loading to
avoid switching to a small size | 2481 // Avoid doing resizing to a smaller size while the frame is loading to
avoid switching to a small size |
2476 // during an intermediate state (and then changing back to a bigger size
as the load progresses). | 2482 // during an intermediate state (and then changing back to a bigger size
as the load progresses). |
2477 if (!frame()->loader()->isComplete() && (newSize.height() < size.height(
) || newSize.width() < size.width())) | 2483 if (!frame()->loader()->isComplete() && (newSize.height() < size.height(
) || newSize.width() < size.width())) |
2478 break; | 2484 break; |
| 2485 else if (document->processingLoadEvent()) |
| 2486 newSize = newSize.expandedTo(size); |
2479 resize(newSize.width(), newSize.height()); | 2487 resize(newSize.width(), newSize.height()); |
2480 // Force the scrollbar state to avoid the scrollbar code adding them and
causing them to be needed. For example, | 2488 // Force the scrollbar state to avoid the scrollbar code adding them and
causing them to be needed. For example, |
2481 // a vertical scrollbar may cause text to wrap and thus increase the hei
ght (which is the only reason the scollbar is needed). | 2489 // a vertical scrollbar may cause text to wrap and thus increase the hei
ght (which is the only reason the scollbar is needed). |
2482 setVerticalScrollbarLock(false); | 2490 setVerticalScrollbarLock(false); |
2483 setHorizontalScrollbarLock(false); | 2491 setHorizontalScrollbarLock(false); |
2484 setScrollbarModes(horizonalScrollbarMode, verticalScrollbarMode, true, t
rue); | 2492 setScrollbarModes(horizonalScrollbarMode, verticalScrollbarMode, true, t
rue); |
2485 } | 2493 } |
| 2494 m_didRunAutosize = true; |
2486 } | 2495 } |
2487 | 2496 |
2488 void FrameView::updateOverflowStatus(bool horizontalOverflow, bool verticalOverf
low) | 2497 void FrameView::updateOverflowStatus(bool horizontalOverflow, bool verticalOverf
low) |
2489 { | 2498 { |
2490 if (!m_viewportRenderer) | 2499 if (!m_viewportRenderer) |
2491 return; | 2500 return; |
2492 | 2501 |
2493 if (m_overflowStatusDirty) { | 2502 if (m_overflowStatusDirty) { |
2494 m_horizontalOverflow = horizontalOverflow; | 2503 m_horizontalOverflow = horizontalOverflow; |
2495 m_verticalOverflow = verticalOverflow; | 2504 m_verticalOverflow = verticalOverflow; |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3112 ASSERT(!enable || !minSize.isEmpty()); | 3121 ASSERT(!enable || !minSize.isEmpty()); |
3113 ASSERT(minSize.width() <= maxSize.width()); | 3122 ASSERT(minSize.width() <= maxSize.width()); |
3114 ASSERT(minSize.height() <= maxSize.height()); | 3123 ASSERT(minSize.height() <= maxSize.height()); |
3115 | 3124 |
3116 if (m_shouldAutoSize == enable && m_minAutoSize == minSize && m_maxAutoSize
== maxSize) | 3125 if (m_shouldAutoSize == enable && m_minAutoSize == minSize && m_maxAutoSize
== maxSize) |
3117 return; | 3126 return; |
3118 | 3127 |
3119 m_shouldAutoSize = enable; | 3128 m_shouldAutoSize = enable; |
3120 m_minAutoSize = minSize; | 3129 m_minAutoSize = minSize; |
3121 m_maxAutoSize = maxSize; | 3130 m_maxAutoSize = maxSize; |
| 3131 m_didRunAutosize = false; |
3122 | 3132 |
3123 setNeedsLayout(); | 3133 setNeedsLayout(); |
3124 scheduleRelayout(); | 3134 scheduleRelayout(); |
3125 if (m_shouldAutoSize) | 3135 if (m_shouldAutoSize) |
3126 return; | 3136 return; |
3127 | 3137 |
3128 // Since autosize mode forces the scrollbar mode, change them to being auto. | 3138 // Since autosize mode forces the scrollbar mode, change them to being auto. |
3129 setVerticalScrollbarLock(false); | 3139 setVerticalScrollbarLock(false); |
3130 setHorizontalScrollbarLock(false); | 3140 setHorizontalScrollbarLock(false); |
3131 setScrollbarModes(ScrollbarAuto, ScrollbarAuto); | 3141 setScrollbarModes(ScrollbarAuto, ScrollbarAuto); |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3478 } | 3488 } |
3479 | 3489 |
3480 AXObjectCache* FrameView::axObjectCache() const | 3490 AXObjectCache* FrameView::axObjectCache() const |
3481 { | 3491 { |
3482 if (frame() && frame()->document() && frame()->document()->axObjectCacheExis
ts()) | 3492 if (frame() && frame()->document() && frame()->document()->axObjectCacheExis
ts()) |
3483 return frame()->document()->axObjectCache(); | 3493 return frame()->document()->axObjectCache(); |
3484 return 0; | 3494 return 0; |
3485 } | 3495 } |
3486 | 3496 |
3487 } // namespace WebCore | 3497 } // namespace WebCore |
OLD | NEW |