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

Side by Side Diff: Source/WebCore/platform/chromium/PlatformScreenChromium.cpp

Issue 11862015: Merge 139356 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 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 | « Source/WebCore/page/Settings.in ('k') | Source/WebCore/rendering/TextAutosizer.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) 2008, 2009, Google Inc. All rights reserved. 2 * Copyright (c) 2008, 2009, 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 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "PlatformScreen.h" 32 #include "PlatformScreen.h"
33 33
34 #include "FloatRect.h" 34 #include "FloatRect.h"
35 #include "Frame.h"
36 #include "FrameView.h"
35 #include "HostWindow.h" 37 #include "HostWindow.h"
38 #include "Page.h"
36 #include "ScrollView.h" 39 #include "ScrollView.h"
40 #include "Settings.h"
37 #include "Widget.h" 41 #include "Widget.h"
38 #include <public/Platform.h> 42 #include <public/Platform.h>
39 #include <public/WebScreenInfo.h> 43 #include <public/WebScreenInfo.h>
40 44
41 namespace WebCore { 45 namespace WebCore {
42 46
43 static PlatformPageClient toPlatformPageClient(Widget* widget) 47 static PlatformPageClient toPlatformPageClient(Widget* widget)
44 { 48 {
45 if (!widget) 49 if (!widget)
46 return 0; 50 return 0;
(...skipping 23 matching lines...) Expand all
70 } 74 }
71 75
72 bool screenIsMonochrome(Widget* widget) 76 bool screenIsMonochrome(Widget* widget)
73 { 77 {
74 PlatformPageClient client = toPlatformPageClient(widget); 78 PlatformPageClient client = toPlatformPageClient(widget);
75 if (!client) 79 if (!client)
76 return false; 80 return false;
77 return client->screenInfo().isMonochrome; 81 return client->screenInfo().isMonochrome;
78 } 82 }
79 83
84 // On Chrome for Android, the screenInfo rects are in physical screen pixels
85 // instead of density independent (UI) pixels, and must be scaled down.
86 static FloatRect toUserSpace(FloatRect rect, Widget* widget)
87 {
88 if (widget->isFrameView()) {
89 Page* page = static_cast<FrameView*>(widget)->frame()->page();
90 if (page && !page->settings()->applyDeviceScaleFactorInCompositor())
91 rect.scale(1 / page->deviceScaleFactor());
92 }
93 return rect;
94 }
95
80 FloatRect screenRect(Widget* widget) 96 FloatRect screenRect(Widget* widget)
81 { 97 {
82 PlatformPageClient client = toPlatformPageClient(widget); 98 PlatformPageClient client = toPlatformPageClient(widget);
83 if (!client) 99 if (!client)
84 return FloatRect(); 100 return FloatRect();
85 return IntRect(client->screenInfo().rect); 101 return toUserSpace(IntRect(client->screenInfo().rect), widget);
86 } 102 }
87 103
88 FloatRect screenAvailableRect(Widget* widget) 104 FloatRect screenAvailableRect(Widget* widget)
89 { 105 {
90 PlatformPageClient client = toPlatformPageClient(widget); 106 PlatformPageClient client = toPlatformPageClient(widget);
91 if (!client) 107 if (!client)
92 return FloatRect(); 108 return FloatRect();
93 return IntRect(client->screenInfo().availableRect); 109 return toUserSpace(IntRect(client->screenInfo().availableRect), widget);
94 } 110 }
95 111
96 void screenColorProfile(ColorProfile& toProfile) 112 void screenColorProfile(ColorProfile& toProfile)
97 { 113 {
98 WebKit::WebVector<char> profile; 114 WebKit::WebVector<char> profile;
99 WebKit::Platform::current()->screenColorProfile(&profile); 115 WebKit::Platform::current()->screenColorProfile(&profile);
100 toProfile.append(profile.data(), profile.size()); 116 toProfile.append(profile.data(), profile.size());
101 } 117 }
102 118
103 } // namespace WebCore 119 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/page/Settings.in ('k') | Source/WebCore/rendering/TextAutosizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698