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

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: 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
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 mainFrameWidthChanged = false;
373 if (newRect.width() != oldRect.width()) { 374 if (newRect.width() != oldRect.width()) {
374 if (isMainFrame()) { 375 if (isMainFrame()) {
376 mainFrameWidthChanged = true;
375 if (m_frame->settings()->textAutosizingEnabled()) { 377 if (m_frame->settings()->textAutosizingEnabled()) {
376 for (LocalFrame* frame = m_frame.get(); frame; frame = frame->tr ee().traverseNext()) { 378 for (LocalFrame* frame = m_frame.get(); frame; frame = frame->tr ee().traverseNext()) {
377 if (TextAutosizer* textAutosizer = frame->document()->textAu tosizer()) 379 if (TextAutosizer* textAutosizer = frame->document()->textAu tosizer())
378 textAutosizer->recalculateMultipliers(); 380 textAutosizer->recalculateMultipliers();
379 } 381 }
380 } 382 }
381 } 383 }
382 } 384 }
383 385
384 ScrollView::setFrameRect(newRect); 386 ScrollView::setFrameRect(newRect);
385 387
386 updateScrollableAreaSet(); 388 updateScrollableAreaSet();
387 389
390 if (mainFrameWidthChanged) {
391 // This needs to be after the call to ScrollView::setFrameRect, because it reads the new width.
392 if (FastTextAutosizer* textAutosizer = m_frame->document()->fastTextAuto sizer())
393 textAutosizer->updatePageInfoInAllFrames();
394 }
395
388 if (RenderView* renderView = this->renderView()) { 396 if (RenderView* renderView = this->renderView()) {
389 if (renderView->usesCompositing()) 397 if (renderView->usesCompositing())
390 renderView->compositor()->frameViewDidChangeSize(); 398 renderView->compositor()->frameViewDidChangeSize();
391 } 399 }
392 400
393 viewportConstrainedVisibleContentSizeChanged(newRect.width() != oldRect.widt h(), newRect.height() != oldRect.height()); 401 viewportConstrainedVisibleContentSizeChanged(newRect.width() != oldRect.widt h(), newRect.height() != oldRect.height());
394 } 402 }
395 403
396 bool FrameView::scheduleAnimation() 404 bool FrameView::scheduleAnimation()
397 { 405 {
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 IntRect repaintRect = r; 1747 IntRect repaintRect = r;
1740 repaintRect.move(-scrollOffset()); 1748 repaintRect.move(-scrollOffset());
1741 m_trackedRepaintRects.append(repaintRect); 1749 m_trackedRepaintRects.append(repaintRect);
1742 } 1750 }
1743 1751
1744 ScrollView::repaintContentRectangle(r); 1752 ScrollView::repaintContentRectangle(r);
1745 } 1753 }
1746 1754
1747 void FrameView::contentsResized() 1755 void FrameView::contentsResized()
1748 { 1756 {
1757 if (isMainFrame()) {
pdr. 2014/03/24 01:03:18 Is this testable?
skobes 2014/03/25 01:23:24 This notifies the FTA when the layout size changes
1758 if (FastTextAutosizer* textAutosizer = m_frame->document()->fastTextAuto sizer())
1759 textAutosizer->updatePageInfoInAllFrames();
1760 }
1761
1749 ScrollView::contentsResized(); 1762 ScrollView::contentsResized();
1750 setNeedsLayout(); 1763 setNeedsLayout();
1751 } 1764 }
1752 1765
1753 void FrameView::scrollbarExistenceDidChange() 1766 void FrameView::scrollbarExistenceDidChange()
1754 { 1767 {
1755 // We check to make sure the view is attached to a frame() as this method ca n 1768 // We check to make sure the view is attached to a frame() as this method ca n
1756 // be triggered before the view is attached by LocalFrame::createView(...) s etting 1769 // be triggered before the view is attached by LocalFrame::createView(...) s etting
1757 // various values such as setScrollBarModes(...) for example. An ASSERT is 1770 // various values such as setScrollBarModes(...) for example. An ASSERT is
1758 // triggered when a view is layout before being attached to a frame(). 1771 // triggered when a view is layout before being attached to a frame().
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
3213 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3226 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3214 { 3227 {
3215 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3228 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3216 if (AXObjectCache* cache = axObjectCache()) { 3229 if (AXObjectCache* cache = axObjectCache()) {
3217 cache->remove(scrollbar); 3230 cache->remove(scrollbar);
3218 cache->handleScrollbarUpdate(this); 3231 cache->handleScrollbarUpdate(this);
3219 } 3232 }
3220 } 3233 }
3221 3234
3222 } // namespace WebCore 3235 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698