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

Side by Side Diff: third_party/WebKit/Source/core/frame/VisualViewport.cpp

Issue 1568383002: Preserve page resize information when main frame is remote (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small tweak to width comparison in setSize Created 4 years, 11 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 | « no previous file | third_party/WebKit/Source/web/WebViewImpl.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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 83
84 DEFINE_TRACE(VisualViewport) 84 DEFINE_TRACE(VisualViewport)
85 { 85 {
86 visitor->trace(m_frameHost); 86 visitor->trace(m_frameHost);
87 ScrollableArea::trace(visitor); 87 ScrollableArea::trace(visitor);
88 } 88 }
89 89
90 void VisualViewport::setSize(const IntSize& size) 90 void VisualViewport::setSize(const IntSize& size)
91 { 91 {
92 // When the main frame is remote, we won't have an associated frame.
93 if (!mainFrame())
94 return;
95
96 if (m_size == size) 92 if (m_size == size)
97 return; 93 return;
98 94
99 bool autosizerNeedsUpdating =
100 (size.width() != m_size.width())
101 && mainFrame()->settings()
102 && mainFrame()->settings()->textAutosizingEnabled();
103
104 TRACE_EVENT2("blink", "VisualViewport::setSize", "width", size.width(), "hei ght", size.height()); 95 TRACE_EVENT2("blink", "VisualViewport::setSize", "width", size.width(), "hei ght", size.height());
96 bool widthDidChange = size.width() != m_size.width();
105 m_size = size; 97 m_size = size;
106 98
107 if (m_innerViewportContainerLayer) { 99 if (m_innerViewportContainerLayer) {
108 m_innerViewportContainerLayer->setSize(FloatSize(m_size)); 100 m_innerViewportContainerLayer->setSize(FloatSize(m_size));
109 101
110 // Need to re-compute sizes for the overlay scrollbars. 102 // Need to re-compute sizes for the overlay scrollbars.
111 initializeScrollbars(); 103 initializeScrollbars();
112 } 104 }
113 105
106 if (!mainFrame())
107 return;
108
109 bool autosizerNeedsUpdating = widthDidChange
110 && mainFrame()->settings()
111 && mainFrame()->settings()->textAutosizingEnabled();
112
114 if (autosizerNeedsUpdating) { 113 if (autosizerNeedsUpdating) {
115 // This needs to happen after setting the m_size member since it'll be r ead in the update call. 114 // This needs to happen after setting the m_size member since it'll be r ead in the update call.
116 if (TextAutosizer* textAutosizer = mainFrame()->document()->textAutosize r()) 115 if (TextAutosizer* textAutosizer = mainFrame()->document()->textAutosize r())
117 textAutosizer->updatePageInfoInAllFrames(); 116 textAutosizer->updatePageInfoInAllFrames();
118 } 117 }
119 } 118 }
120 119
121 void VisualViewport::reset() 120 void VisualViewport::reset()
122 { 121 {
123 setScaleAndLocation(1, FloatPoint()); 122 setScaleAndLocation(1, FloatPoint());
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 } else if (graphicsLayer == m_rootTransformLayer) { 738 } else if (graphicsLayer == m_rootTransformLayer) {
740 name = "Root Transform Layer"; 739 name = "Root Transform Layer";
741 } else { 740 } else {
742 ASSERT_NOT_REACHED(); 741 ASSERT_NOT_REACHED();
743 } 742 }
744 743
745 return name; 744 return name;
746 } 745 }
747 746
748 } // namespace blink 747 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698