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

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

Issue 346603005: Remove the old text autosizer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase for landing Created 6 years, 4 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 | Annotate | Revision Log
« 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "core/rendering/RenderCounter.h" 57 #include "core/rendering/RenderCounter.h"
58 #include "core/rendering/RenderEmbeddedObject.h" 58 #include "core/rendering/RenderEmbeddedObject.h"
59 #include "core/rendering/RenderLayer.h" 59 #include "core/rendering/RenderLayer.h"
60 #include "core/rendering/RenderListBox.h" 60 #include "core/rendering/RenderListBox.h"
61 #include "core/rendering/RenderPart.h" 61 #include "core/rendering/RenderPart.h"
62 #include "core/rendering/RenderScrollbar.h" 62 #include "core/rendering/RenderScrollbar.h"
63 #include "core/rendering/RenderScrollbarPart.h" 63 #include "core/rendering/RenderScrollbarPart.h"
64 #include "core/rendering/RenderTheme.h" 64 #include "core/rendering/RenderTheme.h"
65 #include "core/rendering/RenderView.h" 65 #include "core/rendering/RenderView.h"
66 #include "core/rendering/RenderWidget.h" 66 #include "core/rendering/RenderWidget.h"
67 #include "core/rendering/TextAutosizer.h"
68 #include "core/rendering/compositing/CompositedLayerMapping.h" 67 #include "core/rendering/compositing/CompositedLayerMapping.h"
69 #include "core/rendering/compositing/RenderLayerCompositor.h" 68 #include "core/rendering/compositing/RenderLayerCompositor.h"
70 #include "core/rendering/style/RenderStyle.h" 69 #include "core/rendering/style/RenderStyle.h"
71 #include "core/rendering/svg/RenderSVGRoot.h" 70 #include "core/rendering/svg/RenderSVGRoot.h"
72 #include "core/svg/SVGDocumentExtensions.h" 71 #include "core/svg/SVGDocumentExtensions.h"
73 #include "core/svg/SVGSVGElement.h" 72 #include "core/svg/SVGSVGElement.h"
74 #include "platform/RuntimeEnabledFeatures.h" 73 #include "platform/RuntimeEnabledFeatures.h"
75 #include "platform/ScriptForbiddenScope.h" 74 #include "platform/ScriptForbiddenScope.h"
76 #include "platform/TraceEvent.h" 75 #include "platform/TraceEvent.h"
77 #include "platform/fonts/FontCache.h" 76 #include "platform/fonts/FontCache.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 339 }
341 340
342 void FrameView::setFrameRect(const IntRect& newRect) 341 void FrameView::setFrameRect(const IntRect& newRect)
343 { 342 {
344 IntRect oldRect = frameRect(); 343 IntRect oldRect = frameRect();
345 if (newRect == oldRect) 344 if (newRect == oldRect)
346 return; 345 return;
347 346
348 // Autosized font sizes depend on the width of the viewing area. 347 // Autosized font sizes depend on the width of the viewing area.
349 bool autosizerNeedsUpdating = false; 348 bool autosizerNeedsUpdating = false;
350 if (newRect.width() != oldRect.width()) { 349 if (newRect.width() != oldRect.width() && m_frame->isMainFrame() && m_frame- >settings()->textAutosizingEnabled())
351 if (m_frame->isMainFrame() && m_frame->settings()->textAutosizingEnabled ()) { 350 autosizerNeedsUpdating = true;
352 autosizerNeedsUpdating = true;
353 for (Frame* frame = m_frame.get(); frame; frame = frame->tree().trav erseNext()) {
354 if (!frame->isLocalFrame())
355 continue;
356 if (TextAutosizer* textAutosizer = toLocalFrame(frame)->document ()->textAutosizer())
357 textAutosizer->recalculateMultipliers();
358 }
359 }
360 }
361 351
362 ScrollView::setFrameRect(newRect); 352 ScrollView::setFrameRect(newRect);
363 353
364 updateScrollableAreaSet(); 354 updateScrollableAreaSet();
365 355
366 if (autosizerNeedsUpdating) { 356 if (autosizerNeedsUpdating) {
367 // This needs to be after the call to ScrollView::setFrameRect, because it reads the new width. 357 // This needs to be after the call to ScrollView::setFrameRect, because it reads the new width.
368 if (FastTextAutosizer* textAutosizer = m_frame->document()->fastTextAuto sizer()) 358 if (FastTextAutosizer* textAutosizer = m_frame->document()->fastTextAuto sizer())
369 textAutosizer->updatePageInfoInAllFrames(); 359 textAutosizer->updatePageInfoInAllFrames();
370 } 360 }
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 LayoutState layoutState(*rootForThisLayout); 775 LayoutState layoutState(*rootForThisLayout);
786 776
787 forceLayoutParentViewIfNeeded(); 777 forceLayoutParentViewIfNeeded();
788 778
789 // FIXME (crbug.com/256657): Do not do two layouts for text autosizing. 779 // FIXME (crbug.com/256657): Do not do two layouts for text autosizing.
790 rootForThisLayout->layout(); 780 rootForThisLayout->layout();
791 gatherDebugLayoutRects(rootForThisLayout); 781 gatherDebugLayoutRects(rootForThisLayout);
792 782
793 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAllIma geResourcePriorities(); 783 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAllIma geResourcePriorities();
794 784
795 TextAutosizer* textAutosizer = frame().document()->textAutosizer();
796 bool autosized;
797 {
798 AllowPaintInvalidationScope paintInvalidationAllowed(this);
799 autosized = textAutosizer && textAutosizer->processSubtree(rootForThisLa yout);
800 }
801
802 if (autosized && rootForThisLayout->needsLayout()) {
803 TRACE_EVENT0("blink", "2nd layout due to Text Autosizing");
804 UseCounter::count(*frame().document(), UseCounter::TextAutosizingLayout) ;
805 rootForThisLayout->layout();
806 gatherDebugLayoutRects(rootForThisLayout);
807 }
808
809 lifecycle().advanceTo(DocumentLifecycle::AfterPerformLayout); 785 lifecycle().advanceTo(DocumentLifecycle::AfterPerformLayout);
810 } 786 }
811 787
812 void FrameView::scheduleOrPerformPostLayoutTasks() 788 void FrameView::scheduleOrPerformPostLayoutTasks()
813 { 789 {
814 if (m_postLayoutTasksTimer.isActive()) 790 if (m_postLayoutTasksTimer.isActive())
815 return; 791 return;
816 792
817 if (!m_inSynchronousPostLayout) { 793 if (!m_inSynchronousPostLayout) {
818 m_inSynchronousPostLayout = true; 794 m_inSynchronousPostLayout = true;
(...skipping 2469 matching lines...) Expand 10 before | Expand all | Expand 10 after
3288 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3264 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3289 { 3265 {
3290 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3266 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3291 if (AXObjectCache* cache = axObjectCache()) { 3267 if (AXObjectCache* cache = axObjectCache()) {
3292 cache->remove(scrollbar); 3268 cache->remove(scrollbar);
3293 cache->handleScrollbarUpdate(this); 3269 cache->handleScrollbarUpdate(this);
3294 } 3270 }
3295 } 3271 }
3296 3272
3297 } // namespace blink 3273 } // namespace blink
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