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

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: Address review comments. 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() && m_frame->settings()->textAutosizingEnabled()) { 375 if (isMainFrame()) {
375 for (LocalFrame* frame = m_frame.get(); frame; frame = frame->tree() .traverseNext()) { 376 mainFrameWidthChanged = true;
376 if (TextAutosizer* textAutosizer = frame->document()->textAutosi zer()) 377 if (m_frame->settings()->textAutosizingEnabled()) {
timvolodine 2014/03/25 13:08:14 should this be higher up, i.e. if (isMainFrame() &
skobes 2014/03/25 18:25:26 Done. It doesn't really matter since FTA does not
377 textAutosizer->recalculateMultipliers(); 378 for (LocalFrame* frame = m_frame.get(); frame; frame = frame->tr ee().traverseNext()) {
379 if (TextAutosizer* textAutosizer = frame->document()->textAu tosizer())
380 textAutosizer->recalculateMultipliers();
381 }
378 } 382 }
379 } 383 }
380 } 384 }
381 385
382 ScrollView::setFrameRect(newRect); 386 ScrollView::setFrameRect(newRect);
383 387
384 updateScrollableAreaSet(); 388 updateScrollableAreaSet();
385 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
386 if (RenderView* renderView = this->renderView()) { 396 if (RenderView* renderView = this->renderView()) {
387 if (renderView->usesCompositing()) 397 if (renderView->usesCompositing())
388 renderView->compositor()->frameViewDidChangeSize(); 398 renderView->compositor()->frameViewDidChangeSize();
389 } 399 }
390 400
391 viewportConstrainedVisibleContentSizeChanged(newRect.width() != oldRect.widt h(), newRect.height() != oldRect.height()); 401 viewportConstrainedVisibleContentSizeChanged(newRect.width() != oldRect.widt h(), newRect.height() != oldRect.height());
392 } 402 }
393 403
394 bool FrameView::scheduleAnimation() 404 bool FrameView::scheduleAnimation()
395 { 405 {
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 IntRect repaintRect = r; 1748 IntRect repaintRect = r;
1739 repaintRect.move(-scrollOffset()); 1749 repaintRect.move(-scrollOffset());
1740 m_trackedRepaintRects.append(repaintRect); 1750 m_trackedRepaintRects.append(repaintRect);
1741 } 1751 }
1742 1752
1743 ScrollView::repaintContentRectangle(r); 1753 ScrollView::repaintContentRectangle(r);
1744 } 1754 }
1745 1755
1746 void FrameView::contentsResized() 1756 void FrameView::contentsResized()
1747 { 1757 {
1758 if (isMainFrame()) {
1759 if (FastTextAutosizer* textAutosizer = m_frame->document()->fastTextAuto sizer())
1760 textAutosizer->updatePageInfoInAllFrames();
1761 }
1762
1748 ScrollView::contentsResized(); 1763 ScrollView::contentsResized();
1749 setNeedsLayout(); 1764 setNeedsLayout();
1750 } 1765 }
1751 1766
1752 void FrameView::scrollbarExistenceDidChange() 1767 void FrameView::scrollbarExistenceDidChange()
1753 { 1768 {
1754 // We check to make sure the view is attached to a frame() as this method ca n 1769 // We check to make sure the view is attached to a frame() as this method ca n
1755 // be triggered before the view is attached by LocalFrame::createView(...) s etting 1770 // be triggered before the view is attached by LocalFrame::createView(...) s etting
1756 // various values such as setScrollBarModes(...) for example. An ASSERT is 1771 // various values such as setScrollBarModes(...) for example. An ASSERT is
1757 // triggered when a view is layout before being attached to a frame(). 1772 // triggered when a view is layout before being attached to a frame().
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after
3219 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3234 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3220 { 3235 {
3221 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3236 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3222 if (AXObjectCache* cache = axObjectCache()) { 3237 if (AXObjectCache* cache = axObjectCache()) {
3223 cache->remove(scrollbar); 3238 cache->remove(scrollbar);
3224 cache->handleScrollbarUpdate(this); 3239 cache->handleScrollbarUpdate(this);
3225 } 3240 }
3226 } 3241 }
3227 3242
3228 } // namespace WebCore 3243 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698