OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |