Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(633)

Side by Side Diff: Source/core/frame/FrameView.cpp

Issue 209353003: Clean up handling of autosizing state changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@crap_base
Patch Set: Fix segfault in unit test. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/page/Page.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 renderer->repaintRectangle(repaintRect); 363 renderer->repaintRectangle(repaintRect);
364 } 364 }
365 365
366 void FrameView::setFrameRect(const IntRect& newRect) 366 void FrameView::setFrameRect(const IntRect& newRect)
367 { 367 {
368 IntRect oldRect = frameRect(); 368 IntRect oldRect = frameRect();
369 if (newRect == oldRect) 369 if (newRect == oldRect)
370 return; 370 return;
371 371
372 // Autosized font sizes depend on the width of the viewing area. 372 // Autosized font sizes depend on the width of the viewing area.
373 bool autosizerNeedsUpdating = false;
373 if (newRect.width() != oldRect.width()) { 374 if (newRect.width() != oldRect.width()) {
374 if (isMainFrame() && m_frame->settings()->textAutosizingEnabled()) { 375 if (isMainFrame() && m_frame->settings()->textAutosizingEnabled()) {
376 autosizerNeedsUpdating = true;
375 for (LocalFrame* frame = m_frame.get(); frame; frame = frame->tree() .traverseNext()) { 377 for (LocalFrame* frame = m_frame.get(); frame; frame = frame->tree() .traverseNext()) {
376 if (TextAutosizer* textAutosizer = frame->document()->textAutosi zer()) 378 if (TextAutosizer* textAutosizer = frame->document()->textAutosi zer())
377 textAutosizer->recalculateMultipliers(); 379 textAutosizer->recalculateMultipliers();
378 } 380 }
379 } 381 }
380 } 382 }
381 383
382 ScrollView::setFrameRect(newRect); 384 ScrollView::setFrameRect(newRect);
383 385
384 updateScrollableAreaSet(); 386 updateScrollableAreaSet();
385 387
388 if (autosizerNeedsUpdating) {
389 // This needs to be after the call to ScrollView::setFrameRect, because it reads the new width.
390 if (FastTextAutosizer* textAutosizer = m_frame->document()->fastTextAuto sizer())
391 textAutosizer->updatePageInfoInAllFrames();
392 }
393
386 if (RenderView* renderView = this->renderView()) { 394 if (RenderView* renderView = this->renderView()) {
387 if (renderView->usesCompositing()) 395 if (renderView->usesCompositing())
388 renderView->compositor()->frameViewDidChangeSize(); 396 renderView->compositor()->frameViewDidChangeSize();
389 } 397 }
390 398
391 viewportConstrainedVisibleContentSizeChanged(newRect.width() != oldRect.widt h(), newRect.height() != oldRect.height()); 399 viewportConstrainedVisibleContentSizeChanged(newRect.width() != oldRect.widt h(), newRect.height() != oldRect.height());
392 } 400 }
393 401
394 bool FrameView::scheduleAnimation() 402 bool FrameView::scheduleAnimation()
395 { 403 {
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1734 IntRect repaintRect = r; 1742 IntRect repaintRect = r;
1735 repaintRect.move(-scrollOffset()); 1743 repaintRect.move(-scrollOffset());
1736 m_trackedRepaintRects.append(repaintRect); 1744 m_trackedRepaintRects.append(repaintRect);
1737 } 1745 }
1738 1746
1739 ScrollView::repaintContentRectangle(r); 1747 ScrollView::repaintContentRectangle(r);
1740 } 1748 }
1741 1749
1742 void FrameView::contentsResized() 1750 void FrameView::contentsResized()
1743 { 1751 {
1752 if (isMainFrame() && m_frame->document()) {
1753 if (FastTextAutosizer* textAutosizer = m_frame->document()->fastTextAuto sizer())
1754 textAutosizer->updatePageInfoInAllFrames();
1755 }
1756
1744 ScrollView::contentsResized(); 1757 ScrollView::contentsResized();
1745 setNeedsLayout(); 1758 setNeedsLayout();
1746 } 1759 }
1747 1760
1748 void FrameView::scrollbarExistenceDidChange() 1761 void FrameView::scrollbarExistenceDidChange()
1749 { 1762 {
1750 // We check to make sure the view is attached to a frame() as this method ca n 1763 // We check to make sure the view is attached to a frame() as this method ca n
1751 // be triggered before the view is attached by LocalFrame::createView(...) s etting 1764 // be triggered before the view is attached by LocalFrame::createView(...) s etting
1752 // various values such as setScrollBarModes(...) for example. An ASSERT is 1765 // various values such as setScrollBarModes(...) for example. An ASSERT is
1753 // triggered when a view is layout before being attached to a frame(). 1766 // triggered when a view is layout before being attached to a frame().
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
3211 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3224 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3212 { 3225 {
3213 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3226 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3214 if (AXObjectCache* cache = axObjectCache()) { 3227 if (AXObjectCache* cache = axObjectCache()) {
3215 cache->remove(scrollbar); 3228 cache->remove(scrollbar);
3216 cache->handleScrollbarUpdate(this); 3229 cache->handleScrollbarUpdate(this);
3217 } 3230 }
3218 } 3231 }
3219 3232
3220 } // namespace WebCore 3233 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/page/Page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698