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

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 23101004: Make configurationForViewport match production code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Renamed configurationForViewport to viewportAsText Created 7 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
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 else { 932 else {
933 es.throwDOMException(SyntaxError); 933 es.throwDOMException(SyntaxError);
934 return; 934 return;
935 } 935 }
936 936
937 pagination.gap = gap; 937 pagination.gap = gap;
938 pagination.pageLength = pageLength; 938 pagination.pageLength = pageLength;
939 page->setPagination(pagination); 939 page->setPagination(pagination);
940 } 940 }
941 941
942 String Internals::configurationForViewport(Document* document, float, int device Width, int deviceHeight, int availableWidth, int availableHeight, ExceptionState & es) 942 String Internals::viewportAsText(Document* document, float, int availableWidth, int availableHeight, ExceptionState& es)
943 { 943 {
944 if (!document || !document->page()) { 944 if (!document || !document->page()) {
945 es.throwDOMException(InvalidAccessError); 945 es.throwDOMException(InvalidAccessError);
946 return String(); 946 return String();
947 } 947 }
948 Page* page = document->page(); 948 Page* page = document->page();
949 949
950 // Update initial viewport size. 950 // Update initial viewport size.
951 IntSize initialViewportSize(availableWidth, availableHeight); 951 IntSize initialViewportSize(availableWidth, availableHeight);
952 document->page()->mainFrame()->view()->setFrameRect(IntRect(IntPoint::zero() , initialViewportSize)); 952 document->page()->mainFrame()->view()->setFrameRect(IntRect(IntPoint::zero() , initialViewportSize));
953 document->styleResolver()->viewportStyleResolver()->resolve(); 953 document->styleResolver()->viewportStyleResolver()->resolve();
954 954
955 ViewportArguments arguments = page->viewportArguments(); 955 ViewportArguments arguments = page->viewportArguments();
956 PageScaleConstraints constraints = arguments.resolve(initialViewportSize, Fl oatSize(deviceWidth, deviceHeight), 980 /* defaultLayoutWidthForNonMobilePages * /); 956 PageScaleConstraints constraints = arguments.resolve(initialViewportSize, 98 0 /* defaultLayoutWidthForNonMobilePages */);
957 957
958 constraints.fitToContentsWidth(constraints.layoutSize.width(), availableWidt h); 958 constraints.fitToContentsWidth(constraints.layoutSize.width(), availableWidt h);
959 959
960 StringBuilder builder; 960 StringBuilder builder;
961 961
962 builder.appendLiteral("viewport size "); 962 builder.appendLiteral("viewport size ");
963 builder.append(String::number(constraints.layoutSize.width())); 963 builder.append(String::number(constraints.layoutSize.width()));
964 builder.append('x'); 964 builder.append('x');
965 builder.append(String::number(constraints.layoutSize.height())); 965 builder.append(String::number(constraints.layoutSize.height()));
966 966
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2147 return false; 2147 return false;
2148 sharedContext->getExtensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CON TEXT_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB); 2148 sharedContext->getExtensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CON TEXT_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB);
2149 // To prevent tests that call loseSharedGraphicsContext3D from being 2149 // To prevent tests that call loseSharedGraphicsContext3D from being
2150 // flaky, we call finish so that the context is guaranteed to be lost 2150 // flaky, we call finish so that the context is guaranteed to be lost
2151 // synchronously (i.e. before returning). 2151 // synchronously (i.e. before returning).
2152 sharedContext->finish(); 2152 sharedContext->finish();
2153 return true; 2153 return true;
2154 } 2154 }
2155 2155
2156 } 2156 }
OLDNEW
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698