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

Unified Diff: content/renderer/render_view.h

Issue 7831028: Compute pageScaleFactor on page so that fixed layout page fits width of window. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/render_view.h
diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h
index ac81413ebfa4503ee2422e736583a92953ca962d..09c3090aec74df626a3e01ec37a21146a289f1c3 100644
--- a/content/renderer/render_view.h
+++ b/content/renderer/render_view.h
@@ -150,6 +150,7 @@ struct WebFindOptions;
struct WebMediaPlayerAction;
struct WebPluginParams;
struct WebPoint;
+struct WebRect;
struct WebWindowFeatures;
}
@@ -371,6 +372,7 @@ class RenderView : public RenderWidget,
virtual WebKit::WebExternalPopupMenu* createExternalPopupMenu(
const WebKit::WebPopupMenuInfo& popup_menu_info,
WebKit::WebExternalPopupMenuClient* popup_menu_client);
+ virtual WebKit::WebRect getDeviceRect() const;
virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(
unsigned quota);
virtual void didAddMessageToConsole(
@@ -633,6 +635,8 @@ class RenderView : public RenderWidget,
TransportDIB** dib,
gfx::Rect* location,
gfx::Rect* clip);
+ virtual gfx::Size GetContentSize();
+ virtual float GetPageScaleFactor();
virtual gfx::Point GetScrollOffset();
virtual void DidHandleKeyEvent();
virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event);
@@ -885,6 +889,16 @@ class RenderView : public RenderWidget,
// Check whether the preferred size has changed.
void CheckPreferredSize();
+ // Return the offset, restricted to the document area at the given scale.
+ // (The offset is in the coordinate space of the new scale).
+ gfx::Point ClampOffsetAtScale(const gfx::Point& offset, float scale);
+
+ // Get the scale when the document is fully zoomed out (minimum scale).
+ float ComputeOverviewScale(gfx::Size content_size);
+
+ // Compute the scale within min/max limits.
+ float ComputeScaleWithinLimits(float scale);
+
// This callback is triggered when DownloadFavicon completes, either
// succesfully or with a failure. See DownloadFavicon for more
// details.
@@ -925,6 +939,18 @@ class RenderView : public RenderWidget,
const WebKit::WebURLError& error,
bool replace);
+ // Scales current scroll offset to a new factor.
+ void SetPageScaleFactor(float scale);
+
+ // Moves to the scroll offset (should be provided in the new scale, not the
+ // previous one).
+ void SetPageScaleFactorAndScroll(float scale, const gfx::Point& offset);
+
+ // Keeps Keeps the anchor (in window coordinates) in a stable position on the
jam 2011/09/02 17:11:41 nit Keeps Keeps
Fady Samuel 2011/09/08 23:46:39 Done.
+ // screen.
+ void SetPageScaleFactorWithAnchor(float scale,
+ const gfx::Point& window_anchor);
+
// Starts nav_state_sync_timer_ if it isn't already running.
void StartNavStateSyncTimerIfNecessary();
@@ -938,12 +964,17 @@ class RenderView : public RenderWidget,
// selection handles in sync with the webpage.
void SyncSelectionIfRequired();
+ // If not already initialized, initialize the scale to the overview scale.
+ bool TryInitializeScale();
+
#if defined(OS_POSIX) && !defined(OS_MACOSX)
void UpdateFontRenderingFromRendererPrefs();
#else
void UpdateFontRenderingFromRendererPrefs() {}
#endif
+ void UpdatePageScale(gfx::Size new_content_size);
+
// Update the target url and tell the browser that the target URL has changed.
// If |url| is empty, show |fallback_url|.
void UpdateTargetURL(const GURL& url, const GURL& fallback_url);
@@ -1177,6 +1208,13 @@ class RenderView : public RenderWidget,
DevToolsAgent* devtools_agent_;
+ // Scaling and Fixed Layout --------------------------------------------------
+
+ // viewport scale related fields.
+ bool user_scalable_;
+ float minimum_scale_;
+ float maximum_scale_;
jamesr 2011/09/02 17:43:09 why are these member variables? from what I can te
Fady Samuel 2011/09/08 23:46:39 These will be used in an upcoming patch once the v
+
// Misc ----------------------------------------------------------------------
// The current and pending file chooser completion objects. If the queue is

Powered by Google App Engine
This is Rietveld 408576698