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 2433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2444 | 2444 |
2445 Document* document = frame()->document(); | 2445 Document* document = frame()->document(); |
2446 if (!document) | 2446 if (!document) |
2447 return; | 2447 return; |
2448 | 2448 |
2449 RenderView* documentView = document->renderView(); | 2449 RenderView* documentView = document->renderView(); |
2450 Element* documentElement = document->documentElement(); | 2450 Element* documentElement = document->documentElement(); |
2451 if (!documentView || !documentElement) | 2451 if (!documentView || !documentElement) |
2452 return; | 2452 return; |
2453 | 2453 |
2454 // Start from the minimum height and allow it to grow. | 2454 RenderBox* documentRenderBox = documentElement->renderBox(); |
2455 resize(frameRect().width(), m_minAutoSize.height()); | 2455 if (!documentRenderBox) |
| 2456 return; |
| 2457 |
| 2458 // If this is the first time we run autosize, start from small height and |
| 2459 // allow it to grow. |
| 2460 if (!m_didRunAutosize) |
| 2461 resize(frameRect().width(), m_minAutoSize.height()); |
2456 | 2462 |
2457 IntSize size = frameRect().size(); | 2463 IntSize size = frameRect().size(); |
2458 | 2464 |
2459 // Do the resizing twice. The first time is basically a rough calculation us
ing the preferred width | 2465 // Do the resizing twice. The first time is basically a rough calculation us
ing the preferred width |
2460 // which may result in a height change during the second iteration. | 2466 // which may result in a height change during the second iteration. |
2461 for (int i = 0; i < 2; i++) { | 2467 for (int i = 0; i < 2; i++) { |
2462 // Update various sizes including contentsSize, scrollHeight, etc. | 2468 // Update various sizes including contentsSize, scrollHeight, etc. |
2463 document->updateLayoutIgnorePendingStylesheets(); | 2469 document->updateLayoutIgnorePendingStylesheets(); |
2464 int width = documentView->minPreferredLogicalWidth(); | 2470 int width = documentView->minPreferredLogicalWidth(); |
2465 int height = documentView->documentRect().height(); | 2471 int height = documentRenderBox->scrollHeight(); |
2466 IntSize newSize(width, height); | 2472 IntSize newSize(width, height); |
2467 | 2473 |
2468 // Check to see if a scrollbar is needed for a given dimension and | 2474 // Check to see if a scrollbar is needed for a given dimension and |
2469 // if so, increase the other dimension to account for the scrollbar. | 2475 // if so, increase the other dimension to account for the scrollbar. |
2470 // Since the dimensions are only for the view rectangle, once a | 2476 // Since the dimensions are only for the view rectangle, once a |
2471 // dimension exceeds the maximum, there is no need to increase it furthe
r. | 2477 // dimension exceeds the maximum, there is no need to increase it furthe
r. |
2472 if (newSize.width() > m_maxAutoSize.width()) { | 2478 if (newSize.width() > m_maxAutoSize.width()) { |
2473 RefPtr<Scrollbar> localHorizontalScrollbar = horizontalScrollbar(); | 2479 RefPtr<Scrollbar> localHorizontalScrollbar = horizontalScrollbar(); |
2474 if (!localHorizontalScrollbar) | 2480 if (!localHorizontalScrollbar) |
2475 localHorizontalScrollbar = createScrollbar(HorizontalScrollbar); | 2481 localHorizontalScrollbar = createScrollbar(HorizontalScrollbar); |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3600 } | 3606 } |
3601 | 3607 |
3602 AXObjectCache* FrameView::axObjectCache() const | 3608 AXObjectCache* FrameView::axObjectCache() const |
3603 { | 3609 { |
3604 if (frame() && frame()->document()) | 3610 if (frame() && frame()->document()) |
3605 return frame()->document()->existingAXObjectCache(); | 3611 return frame()->document()->existingAXObjectCache(); |
3606 return 0; | 3612 return 0; |
3607 } | 3613 } |
3608 | 3614 |
3609 } // namespace WebCore | 3615 } // namespace WebCore |
OLD | NEW |