| 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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 settings->setViewportMetaEnabled(true); | 874 settings->setViewportMetaEnabled(true); |
| 875 settings->setViewportEnabled(true); | 875 settings->setViewportEnabled(true); |
| 876 settings->setMainFrameResizesAreOrientationChanges(true); | 876 settings->setMainFrameResizesAreOrientationChanges(true); |
| 877 settings->setShrinksViewportContentToFit(true); | 877 settings->setShrinksViewportContentToFit(true); |
| 878 } | 878 } |
| 879 | 879 |
| 880 // Helper function to set autosizing multipliers on a document. | 880 // Helper function to set autosizing multipliers on a document. |
| 881 bool setTextAutosizingMultiplier(Document* document, float multiplier) | 881 bool setTextAutosizingMultiplier(Document* document, float multiplier) |
| 882 { | 882 { |
| 883 bool multiplierSet = false; | 883 bool multiplierSet = false; |
| 884 for (LayoutObject* layoutObject = document->layoutView(); layoutObject; layo
utObject = layoutObject->nextInPreOrder()) { | 884 for (LayoutItem layoutItem = document->layoutViewItem(); !layoutItem.isNull(
); layoutItem = layoutItem.nextInPreOrder()) { |
| 885 if (layoutObject->style()) { | 885 if (layoutItem.style()) { |
| 886 layoutObject->mutableStyleRef().setTextAutosizingMultiplier(multipli
er); | 886 layoutItem.mutableStyleRef().setTextAutosizingMultiplier(multiplier)
; |
| 887 | 887 |
| 888 EXPECT_EQ(multiplier, layoutObject->style()->textAutosizingMultiplie
r()); | 888 EXPECT_EQ(multiplier, layoutItem.style()->textAutosizingMultiplier()
); |
| 889 multiplierSet = true; | 889 multiplierSet = true; |
| 890 } | 890 } |
| 891 } | 891 } |
| 892 return multiplierSet; | 892 return multiplierSet; |
| 893 } | 893 } |
| 894 | 894 |
| 895 // Helper function to check autosizing multipliers on a document. | 895 // Helper function to check autosizing multipliers on a document. |
| 896 bool checkTextAutosizingMultiplier(Document* document, float multiplier) | 896 bool checkTextAutosizingMultiplier(Document* document, float multiplier) |
| 897 { | 897 { |
| 898 bool multiplierChecked = false; | 898 bool multiplierChecked = false; |
| 899 for (LayoutObject* layoutObject = document->layoutView(); layoutObject; layo
utObject = layoutObject->nextInPreOrder()) { | 899 for (LayoutItem layoutItem = document->layoutViewItem(); !layoutItem.isNull(
); layoutItem = layoutItem.nextInPreOrder()) { |
| 900 if (layoutObject->style() && layoutObject->isText()) { | 900 if (layoutItem.style() && layoutItem.isText()) { |
| 901 EXPECT_EQ(multiplier, layoutObject->style()->textAutosizingMultiplie
r()); | 901 EXPECT_EQ(multiplier, layoutItem.style()->textAutosizingMultiplier()
); |
| 902 multiplierChecked = true; | 902 multiplierChecked = true; |
| 903 } | 903 } |
| 904 } | 904 } |
| 905 return multiplierChecked; | 905 return multiplierChecked; |
| 906 } | 906 } |
| 907 | 907 |
| 908 } // anonymous namespace | 908 } // anonymous namespace |
| 909 | 909 |
| 910 TEST_P(ParameterizedWebFrameTest, ChangeInFixedLayoutResetsTextAutosizingMultipl
iers) | 910 TEST_P(ParameterizedWebFrameTest, ChangeInFixedLayoutResetsTextAutosizingMultipl
iers) |
| 911 { | 911 { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 Document* document = mainFrame->document(); | 970 Document* document = mainFrame->document(); |
| 971 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi
ew(); | 971 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi
ew(); |
| 972 document->settings()->setTextAutosizingEnabled(true); | 972 document->settings()->setTextAutosizingEnabled(true); |
| 973 EXPECT_TRUE(document->settings()->textAutosizingEnabled()); | 973 EXPECT_TRUE(document->settings()->textAutosizingEnabled()); |
| 974 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); | 974 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); |
| 975 | 975 |
| 976 for (Frame* frame = mainFrame; frame; frame = frame->tree().traverseNext())
{ | 976 for (Frame* frame = mainFrame; frame; frame = frame->tree().traverseNext())
{ |
| 977 if (!frame->isLocalFrame()) | 977 if (!frame->isLocalFrame()) |
| 978 continue; | 978 continue; |
| 979 EXPECT_TRUE(setTextAutosizingMultiplier(toLocalFrame(frame)->document(),
2)); | 979 EXPECT_TRUE(setTextAutosizingMultiplier(toLocalFrame(frame)->document(),
2)); |
| 980 for (LayoutObject* layoutObject = toLocalFrame(frame)->document()->layou
tView(); layoutObject; layoutObject = layoutObject->nextInPreOrder()) { | 980 for (LayoutItem layoutItem = toLocalFrame(frame)->document()->layoutView
Item(); !layoutItem.isNull(); layoutItem = layoutItem.nextInPreOrder()) { |
| 981 if (layoutObject->isText()) | 981 if (layoutItem.isText()) |
| 982 EXPECT_FALSE(layoutObject->needsLayout()); | 982 EXPECT_FALSE(layoutItem.needsLayout()); |
| 983 } | 983 } |
| 984 } | 984 } |
| 985 | 985 |
| 986 frameView->page()->frameHost().visualViewport().setSize(IntSize(200, 200)); | 986 frameView->page()->frameHost().visualViewport().setSize(IntSize(200, 200)); |
| 987 | 987 |
| 988 for (Frame* frame = mainFrame; frame; frame = frame->tree().traverseNext())
{ | 988 for (Frame* frame = mainFrame; frame; frame = frame->tree().traverseNext())
{ |
| 989 if (!frame->isLocalFrame()) | 989 if (!frame->isLocalFrame()) |
| 990 continue; | 990 continue; |
| 991 for (LayoutObject* layoutObject = toLocalFrame(frame)->document()->layou
tView(); layoutObject; layoutObject = layoutObject->nextInPreOrder()) { | 991 for (LayoutItem layoutItem = toLocalFrame(frame)->document()->layoutView
Item(); !layoutItem.isNull(); layoutItem = layoutItem.nextInPreOrder()) { |
| 992 if (layoutObject->isText()) | 992 if (layoutItem.isText()) |
| 993 EXPECT_TRUE(layoutObject->needsLayout()); | 993 EXPECT_TRUE(layoutItem.needsLayout()); |
| 994 } | 994 } |
| 995 } | 995 } |
| 996 } | 996 } |
| 997 | 997 |
| 998 TEST_P(ParameterizedWebFrameTest, ZeroHeightPositiveWidthNotIgnored) | 998 TEST_P(ParameterizedWebFrameTest, ZeroHeightPositiveWidthNotIgnored) |
| 999 { | 999 { |
| 1000 FixedLayoutTestWebViewClient client; | 1000 FixedLayoutTestWebViewClient client; |
| 1001 client.m_screenInfo.deviceScaleFactor = 1; | 1001 client.m_screenInfo.deviceScaleFactor = 1; |
| 1002 int viewportWidth = 1280; | 1002 int viewportWidth = 1280; |
| 1003 int viewportHeight = 0; | 1003 int viewportHeight = 0; |
| (...skipping 7808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8812 request.setURL(toKURL("javascript:location='" + redirectURL + "'")); | 8812 request.setURL(toKURL("javascript:location='" + redirectURL + "'")); |
| 8813 helper.webViewImpl()->mainFrame()->toWebLocalFrame()->loadRequest(request); | 8813 helper.webViewImpl()->mainFrame()->toWebLocalFrame()->loadRequest(request); |
| 8814 | 8814 |
| 8815 // Normally, the result of the JS url replaces the existing contents on the | 8815 // Normally, the result of the JS url replaces the existing contents on the |
| 8816 // Document. However, if the JS triggers a navigation, the contents should | 8816 // Document. However, if the JS triggers a navigation, the contents should |
| 8817 // not be replaced. | 8817 // not be replaced. |
| 8818 EXPECT_EQ("", toLocalFrame(helper.webViewImpl()->page()->mainFrame())->docum
ent()->documentElement()->innerText()); | 8818 EXPECT_EQ("", toLocalFrame(helper.webViewImpl()->page()->mainFrame())->docum
ent()->documentElement()->innerText()); |
| 8819 } | 8819 } |
| 8820 | 8820 |
| 8821 } // namespace blink | 8821 } // namespace blink |
| OLD | NEW |