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

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

Issue 215503003: Reland text autosizing changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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 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 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 IntRect repaintRect = r; 1774 IntRect repaintRect = r;
1767 repaintRect.move(-scrollOffset()); 1775 repaintRect.move(-scrollOffset());
1768 m_trackedRepaintRects.append(repaintRect); 1776 m_trackedRepaintRects.append(repaintRect);
1769 } 1777 }
1770 1778
1771 ScrollView::repaintContentRectangle(r); 1779 ScrollView::repaintContentRectangle(r);
1772 } 1780 }
1773 1781
1774 void FrameView::contentsResized() 1782 void FrameView::contentsResized()
1775 { 1783 {
1784 if (isMainFrame() && m_frame->document()) {
1785 if (FastTextAutosizer* textAutosizer = m_frame->document()->fastTextAuto sizer())
1786 textAutosizer->updatePageInfoInAllFrames();
1787 }
1788
1776 ScrollView::contentsResized(); 1789 ScrollView::contentsResized();
1777 setNeedsLayout(); 1790 setNeedsLayout();
1778 } 1791 }
1779 1792
1780 void FrameView::scrollbarExistenceDidChange() 1793 void FrameView::scrollbarExistenceDidChange()
1781 { 1794 {
1782 // We check to make sure the view is attached to a frame() as this method ca n 1795 // We check to make sure the view is attached to a frame() as this method ca n
1783 // be triggered before the view is attached by LocalFrame::createView(...) s etting 1796 // be triggered before the view is attached by LocalFrame::createView(...) s etting
1784 // various values such as setScrollBarModes(...) for example. An ASSERT is 1797 // various values such as setScrollBarModes(...) for example. An ASSERT is
1785 // triggered when a view is layout before being attached to a frame(). 1798 // triggered when a view is layout before being attached to a frame().
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after
3247 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3260 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3248 { 3261 {
3249 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3262 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3250 if (AXObjectCache* cache = axObjectCache()) { 3263 if (AXObjectCache* cache = axObjectCache()) {
3251 cache->remove(scrollbar); 3264 cache->remove(scrollbar);
3252 cache->handleScrollbarUpdate(this); 3265 cache->handleScrollbarUpdate(this);
3253 } 3266 }
3254 } 3267 }
3255 3268
3256 } // namespace WebCore 3269 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698