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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 { | 196 { |
197 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); | 197 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); |
198 view->show(); | 198 view->show(); |
199 return view.release(); | 199 return view.release(); |
200 } | 200 } |
201 | 201 |
202 PassRefPtr<FrameView> FrameView::create(Frame* frame, const IntSize& initialSize ) | 202 PassRefPtr<FrameView> FrameView::create(Frame* frame, const IntSize& initialSize ) |
203 { | 203 { |
204 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); | 204 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); |
205 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); | 205 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); |
206 view->setLayoutSize(initialSize); | |
207 | |
206 view->show(); | 208 view->show(); |
207 return view.release(); | 209 return view.release(); |
208 } | 210 } |
209 | 211 |
210 FrameView::~FrameView() | 212 FrameView::~FrameView() |
211 { | 213 { |
212 if (m_postLayoutTasksTimer.isActive()) { | 214 if (m_postLayoutTasksTimer.isActive()) { |
213 m_postLayoutTasksTimer.stop(); | 215 m_postLayoutTasksTimer.stop(); |
214 m_overflowEventQueue.clear(); | 216 m_overflowEventQueue.clear(); |
215 } | 217 } |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1049 setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This causes a horizontal scrollbar to disappear. | 1051 setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This causes a horizontal scrollbar to disappear. |
1050 | 1052 |
1051 setScrollbarModes(hMode, vMode); | 1053 setScrollbarModes(hMode, vMode); |
1052 setScrollbarsSuppressed(false, true); | 1054 setScrollbarsSuppressed(false, true); |
1053 } else | 1055 } else |
1054 setScrollbarModes(hMode, vMode); | 1056 setScrollbarModes(hMode, vMode); |
1055 } | 1057 } |
1056 | 1058 |
1057 LayoutSize oldSize = m_size; | 1059 LayoutSize oldSize = m_size; |
1058 | 1060 |
1059 m_size = LayoutSize(layoutWidth(), layoutHeight()); | 1061 m_size = LayoutSize(layoutSize().width(), layoutSize().height()); |
1060 | 1062 |
1061 if (oldSize != m_size) { | 1063 if (oldSize != m_size) { |
1062 m_doFullRepaint = true; | 1064 m_doFullRepaint = true; |
1063 if (!m_firstLayout) { | 1065 if (!m_firstLayout) { |
1064 RenderBox* rootRenderer = document->documentElement() ? docu ment->documentElement()->renderBox() : 0; | 1066 RenderBox* rootRenderer = document->documentElement() ? docu ment->documentElement()->renderBox() : 0; |
1065 RenderBox* bodyRenderer = rootRenderer && document->body() ? document->body()->renderBox() : 0; | 1067 RenderBox* bodyRenderer = rootRenderer && document->body() ? document->body()->renderBox() : 0; |
1066 if (bodyRenderer && bodyRenderer->stretchesToViewport()) | 1068 if (bodyRenderer && bodyRenderer->stretchesToViewport()) |
1067 bodyRenderer->setChildNeedsLayout(); | 1069 bodyRenderer->setChildNeedsLayout(); |
1068 else if (rootRenderer && rootRenderer->stretchesToViewport() ) | 1070 else if (rootRenderer && rootRenderer->stretchesToViewport() ) |
1069 rootRenderer->setChildNeedsLayout(); | 1071 rootRenderer->setChildNeedsLayout(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1105 | 1107 |
1106 if (AXObjectCache* cache = rootForThisLayout->document().existingAXObjectCac he()) | 1108 if (AXObjectCache* cache = rootForThisLayout->document().existingAXObjectCac he()) |
1107 cache->postNotification(rootForThisLayout, AXObjectCache::AXLayoutComple te, true); | 1109 cache->postNotification(rootForThisLayout, AXObjectCache::AXLayoutComple te, true); |
1108 updateAnnotatedRegions(); | 1110 updateAnnotatedRegions(); |
1109 | 1111 |
1110 ASSERT(partialLayout().isStopping() || !rootForThisLayout->needsLayout()); | 1112 ASSERT(partialLayout().isStopping() || !rootForThisLayout->needsLayout()); |
1111 | 1113 |
1112 updateCanBlitOnScrollRecursively(); | 1114 updateCanBlitOnScrollRecursively(); |
1113 | 1115 |
1114 if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER)) | 1116 if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER)) |
1115 updateOverflowStatus(layoutWidth() < contentsWidth(), layoutHeight() < c ontentsHeight()); | 1117 updateOverflowStatus(layoutSize().width() < contentsWidth(), layoutSize( ).height() < contentsHeight()); |
1116 | 1118 |
1117 scheduleOrPerformPostLayoutTasks(); | 1119 scheduleOrPerformPostLayoutTasks(); |
1118 | 1120 |
1119 InspectorInstrumentation::didLayout(cookie, rootForThisLayout); | 1121 InspectorInstrumentation::didLayout(cookie, rootForThisLayout); |
1120 | 1122 |
1121 m_nestedLayoutCount--; | 1123 m_nestedLayoutCount--; |
1122 if (m_nestedLayoutCount) | 1124 if (m_nestedLayoutCount) |
1123 return; | 1125 return; |
1124 | 1126 |
1125 if (partialLayout().isStopping()) | 1127 if (partialLayout().isStopping()) |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1599 if (!hasViewportConstrainedObjects()) | 1601 if (!hasViewportConstrainedObjects()) |
1600 return; | 1602 return; |
1601 | 1603 |
1602 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje cts->end(); | 1604 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje cts->end(); |
1603 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained Objects->begin(); it != end; ++it) { | 1605 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained Objects->begin(); it != end; ++it) { |
1604 RenderObject* renderer = *it; | 1606 RenderObject* renderer = *it; |
1605 renderer->setNeedsLayout(); | 1607 renderer->setNeedsLayout(); |
1606 } | 1608 } |
1607 } | 1609 } |
1608 | 1610 |
1611 IntSize FrameView::layoutSize(IncludeScrollbarsInRect scrollbarInclusion) const | |
1612 { | |
1613 return scrollbarInclusion == ExcludeScrollbars ? excludeScrollbars(m_layoutS ize) : m_layoutSize; | |
1614 } | |
1615 | |
1616 void FrameView::setLayoutSize(const IntSize& size) | |
1617 { | |
1618 if (m_layoutSize == size) | |
1619 return; | |
1620 | |
1621 m_layoutSize = size; | |
1622 contentsResized(); | |
1623 } | |
1609 | 1624 |
1610 void FrameView::scrollPositionChanged() | 1625 void FrameView::scrollPositionChanged() |
1611 { | 1626 { |
1612 m_frame->eventHandler()->sendScrollEvent(); | 1627 m_frame->eventHandler()->sendScrollEvent(); |
1613 m_frame->eventHandler()->dispatchFakeMouseMoveEventSoon(); | 1628 m_frame->eventHandler()->dispatchFakeMouseMoveEventSoon(); |
1614 | 1629 |
1615 if (RenderView* renderView = this->renderView()) { | 1630 if (RenderView* renderView = this->renderView()) { |
1616 if (renderView->usesCompositing()) | 1631 if (renderView->usesCompositing()) |
1617 renderView->compositor()->frameViewDidScroll(); | 1632 renderView->compositor()->frameViewDidScroll(); |
1618 } | 1633 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1715 | 1730 |
1716 ScrollView::repaintContentRectangle(r); | 1731 ScrollView::repaintContentRectangle(r); |
1717 } | 1732 } |
1718 | 1733 |
1719 void FrameView::contentsResized() | 1734 void FrameView::contentsResized() |
1720 { | 1735 { |
1721 ScrollView::contentsResized(); | 1736 ScrollView::contentsResized(); |
1722 setNeedsLayout(); | 1737 setNeedsLayout(); |
1723 } | 1738 } |
1724 | 1739 |
1725 void FrameView::visibleContentsResized() | 1740 void FrameView::scrollbarExistenceDidChange() |
1726 { | 1741 { |
1727 // We check to make sure the view is attached to a frame() as this method ca n | 1742 // We check to make sure the view is attached to a frame() as this method ca n |
1728 // be triggered before the view is attached by Frame::createView(...) settin g | 1743 // be triggered before the view is attached by Frame::createView(...) settin g |
1729 // various values such as setScrollBarModes(...) for example. An ASSERT is | 1744 // various values such as setScrollBarModes(...) for example. An ASSERT is |
1730 // triggered when a view is layout before being attached to a frame(). | 1745 // triggered when a view is layout before being attached to a frame(). |
1731 if (!frame().view()) | 1746 if (!frame().view()) |
1732 return; | 1747 return; |
1733 | 1748 |
1734 if (!useFixedLayout() && needsLayout()) | 1749 if (!m_frame->page()->settings().viewportEnabled() && needsLayout()) |
aelias_OOO_until_Jul13
2013/10/01 05:09:30
Checking viewportEnabled here doesn't seem very pr
bokan
2013/10/02 17:44:01
A few unit tests in WebFrameTest fail when I check
aelias_OOO_until_Jul13
2013/10/02 18:59:59
Yes, both Clank and WebView always use overlay scr
bokan
2013/10/02 21:27:26
Done.
| |
1735 layout(); | 1750 layout(); |
1736 | 1751 |
1737 if (RenderView* renderView = this->renderView()) { | 1752 if (RenderView* renderView = this->renderView()) { |
1738 if (renderView->usesCompositing()) | 1753 if (renderView->usesCompositing()) |
1739 renderView->compositor()->frameViewDidChangeSize(); | 1754 renderView->compositor()->frameViewDidChangeSize(); |
1740 } | 1755 } |
1741 } | 1756 } |
1742 | 1757 |
1743 void FrameView::beginDeferredRepaints() | 1758 void FrameView::beginDeferredRepaints() |
1744 { | 1759 { |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2402 if (newSize == size) | 2417 if (newSize == size) |
2403 continue; | 2418 continue; |
2404 | 2419 |
2405 // While loading only allow the size to increase (to avoid twitching dur ing intermediate smaller states) | 2420 // While loading only allow the size to increase (to avoid twitching dur ing intermediate smaller states) |
2406 // unless autoresize has just been turned on or the maximum size is smal ler than the current size. | 2421 // unless autoresize has just been turned on or the maximum size is smal ler than the current size. |
2407 if (m_didRunAutosize && size.height() <= m_maxAutoSize.height() && size. width() <= m_maxAutoSize.width() | 2422 if (m_didRunAutosize && size.height() <= m_maxAutoSize.height() && size. width() <= m_maxAutoSize.width() |
2408 && !m_frame->document()->loadEventFinished() && (newSize.height() < size.height() || newSize.width() < size.width())) | 2423 && !m_frame->document()->loadEventFinished() && (newSize.height() < size.height() || newSize.width() < size.width())) |
2409 break; | 2424 break; |
2410 | 2425 |
2411 resize(newSize.width(), newSize.height()); | 2426 resize(newSize.width(), newSize.height()); |
2427 setLayoutSize(newSize); | |
2412 // Force the scrollbar state to avoid the scrollbar code adding them and causing them to be needed. For example, | 2428 // Force the scrollbar state to avoid the scrollbar code adding them and causing them to be needed. For example, |
2413 // a vertical scrollbar may cause text to wrap and thus increase the hei ght (which is the only reason the scollbar is needed). | 2429 // a vertical scrollbar may cause text to wrap and thus increase the hei ght (which is the only reason the scollbar is needed). |
2414 setVerticalScrollbarLock(false); | 2430 setVerticalScrollbarLock(false); |
2415 setHorizontalScrollbarLock(false); | 2431 setHorizontalScrollbarLock(false); |
2416 setScrollbarModes(horizonalScrollbarMode, verticalScrollbarMode, true, t rue); | 2432 setScrollbarModes(horizonalScrollbarMode, verticalScrollbarMode, true, t rue); |
2417 } | 2433 } |
2418 m_didRunAutosize = true; | 2434 m_didRunAutosize = true; |
2419 } | 2435 } |
2420 | 2436 |
2421 void FrameView::updateOverflowStatus(bool horizontalOverflow, bool verticalOverf low) | 2437 void FrameView::updateOverflowStatus(bool horizontalOverflow, bool verticalOverf low) |
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3408 if (frame().document()) | 3424 if (frame().document()) |
3409 return frame().document()->existingAXObjectCache(); | 3425 return frame().document()->existingAXObjectCache(); |
3410 return 0; | 3426 return 0; |
3411 } | 3427 } |
3412 | 3428 |
3413 bool FrameView::isMainFrame() const | 3429 bool FrameView::isMainFrame() const |
3414 { | 3430 { |
3415 return m_frame->page() && m_frame->page()->mainFrame() == m_frame; | 3431 return m_frame->page() && m_frame->page()->mainFrame() == m_frame; |
3416 } | 3432 } |
3417 | 3433 |
3434 void FrameView::frameRectsChanged() | |
3435 { | |
3436 Document* doc = m_frame->document(); | |
3437 bool layoutSizeIsExplicitlySet = m_frame->page() && m_frame->page()->mainFra me() == m_frame | |
aelias_OOO_until_Jul13
2013/10/01 05:09:30
Instead of this, how about a public method FrameVi
bokan
2013/10/02 17:44:01
Done, only I set it false from Frame::createView
| |
3438 && doc && (doc->isHTMLDocument() || doc->isXHTMLDocument()); | |
3439 | |
3440 // Non-main frames' layout size should always match the frame size. For main frames we | |
3441 // explicitly set the layout size from WebViewImpl | |
3442 if (!layoutSizeIsExplicitlySet) | |
3443 setLayoutSize(frameRect().size()); | |
3444 | |
3445 ScrollView::frameRectsChanged(); | |
3446 } | |
3447 | |
3418 } // namespace WebCore | 3448 } // namespace WebCore |
OLD | NEW |