| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 11 matching lines...) Expand all Loading... |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 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 | |
| 33 #include "public/web/WebFrame.h" | 32 #include "public/web/WebFrame.h" |
| 34 | 33 |
| 35 #include "SkBitmap.h" | 34 #include "SkBitmap.h" |
| 36 #include "SkCanvas.h" | 35 #include "SkCanvas.h" |
| 37 #include "bindings/core/v8/SerializedScriptValueFactory.h" | 36 #include "bindings/core/v8/SerializedScriptValueFactory.h" |
| 38 #include "bindings/core/v8/V8Node.h" | 37 #include "bindings/core/v8/V8Node.h" |
| 39 #include "core/clipboard/DataTransfer.h" | 38 #include "core/clipboard/DataTransfer.h" |
| 40 #include "core/css/StyleSheetContents.h" | 39 #include "core/css/StyleSheetContents.h" |
| 41 #include "core/css/resolver/StyleResolver.h" | 40 #include "core/css/resolver/StyleResolver.h" |
| 42 #include "core/css/resolver/ViewportStyleResolver.h" | 41 #include "core/css/resolver/ViewportStyleResolver.h" |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 RefPtrWillBeRawPtr<LocalFrame> frame = toLocalFrame(webViewHelper.webViewImp
l()->page()->mainFrame()); | 754 RefPtrWillBeRawPtr<LocalFrame> frame = toLocalFrame(webViewHelper.webViewImp
l()->page()->mainFrame()); |
| 756 NonThrowableExceptionState exceptionState; | 755 NonThrowableExceptionState exceptionState; |
| 757 frame->domWindow()->postMessage(SerializedScriptValueFactory::instance().cre
ate("message"), 0, "*", frame->localDOMWindow(), exceptionState); | 756 frame->domWindow()->postMessage(SerializedScriptValueFactory::instance().cre
ate("message"), 0, "*", frame->localDOMWindow(), exceptionState); |
| 758 webViewHelper.reset(); | 757 webViewHelper.reset(); |
| 759 EXPECT_FALSE(exceptionState.hadException()); | 758 EXPECT_FALSE(exceptionState.hadException()); |
| 760 | 759 |
| 761 // Success is not crashing. | 760 // Success is not crashing. |
| 762 runPendingTasks(); | 761 runPendingTasks(); |
| 763 } | 762 } |
| 764 | 763 |
| 764 namespace { |
| 765 |
| 765 class FixedLayoutTestWebViewClient : public FrameTestHelpers::TestWebViewClient
{ | 766 class FixedLayoutTestWebViewClient : public FrameTestHelpers::TestWebViewClient
{ |
| 766 public: | 767 public: |
| 767 virtual WebScreenInfo screenInfo() override { return m_screenInfo; } | 768 virtual WebScreenInfo screenInfo() override { return m_screenInfo; } |
| 768 | 769 |
| 769 WebScreenInfo m_screenInfo; | 770 WebScreenInfo m_screenInfo; |
| 770 }; | 771 }; |
| 771 | 772 |
| 772 class FakeCompositingWebViewClient : public FixedLayoutTestWebViewClient { | 773 class FakeCompositingWebViewClient : public FixedLayoutTestWebViewClient { |
| 773 }; | 774 }; |
| 774 | 775 |
| 775 // Viewport settings need to be set before the page gets loaded | 776 // Viewport settings need to be set before the page gets loaded |
| 776 static void enableViewportSettings(WebSettings* settings) | 777 void enableViewportSettings(WebSettings* settings) |
| 777 { | 778 { |
| 778 settings->setViewportMetaEnabled(true); | 779 settings->setViewportMetaEnabled(true); |
| 779 settings->setViewportEnabled(true); | 780 settings->setViewportEnabled(true); |
| 780 settings->setMainFrameResizesAreOrientationChanges(true); | 781 settings->setMainFrameResizesAreOrientationChanges(true); |
| 781 settings->setShrinksViewportContentToFit(true); | 782 settings->setShrinksViewportContentToFit(true); |
| 782 } | 783 } |
| 783 | 784 |
| 784 // Helper function to set autosizing multipliers on a document. | 785 // Helper function to set autosizing multipliers on a document. |
| 785 static bool setTextAutosizingMultiplier(Document* document, float multiplier) | 786 bool setTextAutosizingMultiplier(Document* document, float multiplier) |
| 786 { | 787 { |
| 787 bool multiplierSet = false; | 788 bool multiplierSet = false; |
| 788 for (LayoutObject* layoutObject = document->layoutView(); layoutObject; layo
utObject = layoutObject->nextInPreOrder()) { | 789 for (LayoutObject* layoutObject = document->layoutView(); layoutObject; layo
utObject = layoutObject->nextInPreOrder()) { |
| 789 if (layoutObject->style()) { | 790 if (layoutObject->style()) { |
| 790 layoutObject->mutableStyleRef().setTextAutosizingMultiplier(multipli
er); | 791 layoutObject->mutableStyleRef().setTextAutosizingMultiplier(multipli
er); |
| 791 | 792 |
| 792 EXPECT_EQ(multiplier, layoutObject->style()->textAutosizingMultiplie
r()); | 793 EXPECT_EQ(multiplier, layoutObject->style()->textAutosizingMultiplie
r()); |
| 793 multiplierSet = true; | 794 multiplierSet = true; |
| 794 } | 795 } |
| 795 } | 796 } |
| 796 return multiplierSet; | 797 return multiplierSet; |
| 797 } | 798 } |
| 798 | 799 |
| 799 // Helper function to check autosizing multipliers on a document. | 800 // Helper function to check autosizing multipliers on a document. |
| 800 static bool checkTextAutosizingMultiplier(Document* document, float multiplier) | 801 bool checkTextAutosizingMultiplier(Document* document, float multiplier) |
| 801 { | 802 { |
| 802 bool multiplierChecked = false; | 803 bool multiplierChecked = false; |
| 803 for (LayoutObject* layoutObject = document->layoutView(); layoutObject; layo
utObject = layoutObject->nextInPreOrder()) { | 804 for (LayoutObject* layoutObject = document->layoutView(); layoutObject; layo
utObject = layoutObject->nextInPreOrder()) { |
| 804 if (layoutObject->style() && layoutObject->isText()) { | 805 if (layoutObject->style() && layoutObject->isText()) { |
| 805 EXPECT_EQ(multiplier, layoutObject->style()->textAutosizingMultiplie
r()); | 806 EXPECT_EQ(multiplier, layoutObject->style()->textAutosizingMultiplie
r()); |
| 806 multiplierChecked = true; | 807 multiplierChecked = true; |
| 807 } | 808 } |
| 808 } | 809 } |
| 809 return multiplierChecked; | 810 return multiplierChecked; |
| 810 } | 811 } |
| 811 | 812 |
| 813 } // anonymous namespace |
| 814 |
| 812 TEST_P(ParameterizedWebFrameTest, ChangeInFixedLayoutResetsTextAutosizingMultipl
iers) | 815 TEST_P(ParameterizedWebFrameTest, ChangeInFixedLayoutResetsTextAutosizingMultipl
iers) |
| 813 { | 816 { |
| 814 UseMockScrollbarSettings mockScrollbarSettings; | 817 UseMockScrollbarSettings mockScrollbarSettings; |
| 815 registerMockedHttpURLLoad("fixed_layout.html"); | 818 registerMockedHttpURLLoad("fixed_layout.html"); |
| 816 | 819 |
| 817 FixedLayoutTestWebViewClient client; | 820 FixedLayoutTestWebViewClient client; |
| 818 int viewportWidth = 640; | 821 int viewportWidth = 640; |
| 819 int viewportHeight = 480; | 822 int viewportHeight = 480; |
| 820 | 823 |
| 821 FrameTestHelpers::WebViewHelper webViewHelper(this); | 824 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| (...skipping 6899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7721 TEST_F(WebFrameTest, OrientationFrameDetach) | 7724 TEST_F(WebFrameTest, OrientationFrameDetach) |
| 7722 { | 7725 { |
| 7723 RuntimeEnabledFeatures::setOrientationEventEnabled(true); | 7726 RuntimeEnabledFeatures::setOrientationEventEnabled(true); |
| 7724 registerMockedHttpURLLoad("orientation-frame-detach.html"); | 7727 registerMockedHttpURLLoad("orientation-frame-detach.html"); |
| 7725 FrameTestHelpers::WebViewHelper webViewHelper; | 7728 FrameTestHelpers::WebViewHelper webViewHelper; |
| 7726 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "orie
ntation-frame-detach.html", true); | 7729 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "orie
ntation-frame-detach.html", true); |
| 7727 webViewImpl->mainFrameImpl()->sendOrientationChangeEvent(); | 7730 webViewImpl->mainFrameImpl()->sendOrientationChangeEvent(); |
| 7728 } | 7731 } |
| 7729 | 7732 |
| 7730 } // namespace blink | 7733 } // namespace blink |
| OLD | NEW |