Changeset 135753 in webkit
- Timestamp:
- Nov 26, 2012, 12:27:36 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r135750 r135753 1 2012-11-26 Tony Chang <tony@chromium.org> 2 3 Move more functions from internals.settings to internals 4 https://bugs.webkit.org/show_bug.cgi?id=102976 5 6 Reviewed by Adam Barth. 7 8 Move internals.settings.setEnableMockPagePopup to internals.setEnableMockPagePopup. 9 10 * fast/forms/resources/picker-common.js: 11 1 12 2012-11-26 Andrei Bucur <abucur@adobe.com> 2 13 -
trunk/LayoutTests/fast/forms/resources/picker-common.js
r134180 r135753 1 1 window.jsTestIsAsync = true; 2 2 if (window.internals) 3 internals.set tings.setEnableMockPagePopup(true);3 internals.setEnableMockPagePopup(true); 4 4 5 5 var popupWindow = null; -
trunk/Source/WebCore/ChangeLog
r135750 r135753 1 2012-11-26 Tony Chang <tony@chromium.org> 2 3 Move more functions from internals.settings to internals 4 https://bugs.webkit.org/show_bug.cgi?id=102976 5 6 Reviewed by Adam Barth. 7 8 Move functions that don't have to do with Settings off of internals.settings. 9 setPagination and configurationForViewport were defined on internals, so we 10 can inline the functions (no test change). 11 12 setEnableMockPagePopup is moved to Internals. 13 14 No new tests, this is a refactor. 15 16 * testing/InternalSettings.cpp: 17 (WebCore::InternalSettings::reset): Move reset code into Internals. 18 * testing/InternalSettings.h: 19 (InternalSettings): Remove code for setPagination, configurationForViewport and setEnableMockPagePopup. 20 * testing/InternalSettings.idl: Remove setPagination and setEnableMockPagePopup. 21 * testing/Internals.cpp: 22 (WebCore): Use a static to keep track of the MockPagePopupDriver. 23 (WebCore::Internals::resetToConsistentState): Code from InternalSettings::reset 24 (WebCore::Internals::setEnableMockPagePopup): Code copied from InternalSettings. 25 (WebCore::Internals::pagePopupController): Code copied from InternalSettings. 26 (WebCore::Internals::setPagination): Code copied from InternalSettings. 27 (WebCore::Internals::configurationForViewport): Code copied from InternalSettings. 28 * testing/Internals.h: 29 (Internals): Add setEnableMockPagePopup. 30 * testing/Internals.idl: Add setEnableMockPagePopup. 31 1 32 2012-11-26 Andrei Bucur <abucur@adobe.com> 2 33 -
trunk/Source/WebCore/testing/InternalSettings.cpp
r135227 r135753 27 27 #include "InternalSettings.h" 28 28 29 #include "Chrome.h"30 #include "ChromeClient.h"31 29 #include "Document.h" 32 30 #include "ExceptionCode.h" … … 35 33 #include "Language.h" 36 34 #include "LocaleToScriptMapping.h" 37 #include "MockPagePopupDriver.h"38 35 #include "Page.h" 39 36 #include "RuntimeEnabledFeatures.h" … … 176 173 } 177 174 178 #if ENABLE(PAGE_POPUP)179 PagePopupController* InternalSettings::pagePopupController()180 {181 return m_pagePopupDriver ? m_pagePopupDriver->pagePopupController() : 0;182 }183 #endif184 185 175 void InternalSettings::reset() 186 176 { 187 page()->setPagination(Pagination());188 177 page()->setPageScaleFactor(1, IntPoint(0, 0)); 189 #if ENABLE(PAGE_POPUP)190 m_pagePopupDriver.clear();191 if (page()->chrome())192 page()->chrome()->client()->resetPagePopupDriver();193 #endif194 178 195 179 m_backup.restoreTo(page(), settings()); … … 559 543 } 560 544 561 void InternalSettings::setPagination(const String& mode, int gap, int pageLength, ExceptionCode& ec)562 {563 if (!page()) {564 ec = INVALID_ACCESS_ERR;565 return;566 }567 568 Pagination pagination;569 if (mode == "Unpaginated")570 pagination.mode = Pagination::Unpaginated;571 else if (mode == "LeftToRightPaginated")572 pagination.mode = Pagination::LeftToRightPaginated;573 else if (mode == "RightToLeftPaginated")574 pagination.mode = Pagination::RightToLeftPaginated;575 else if (mode == "TopToBottomPaginated")576 pagination.mode = Pagination::TopToBottomPaginated;577 else if (mode == "BottomToTopPaginated")578 pagination.mode = Pagination::BottomToTopPaginated;579 else {580 ec = SYNTAX_ERR;581 return;582 }583 584 pagination.gap = gap;585 pagination.pageLength = pageLength;586 page()->setPagination(pagination);587 }588 589 void InternalSettings::setEnableMockPagePopup(bool enabled, ExceptionCode& ec)590 {591 #if ENABLE(PAGE_POPUP)592 InternalSettingsGuardForPage();593 if (!page()->chrome())594 return;595 if (!enabled) {596 page()->chrome()->client()->resetPagePopupDriver();597 return;598 }599 if (!m_pagePopupDriver)600 m_pagePopupDriver = MockPagePopupDriver::create(page()->mainFrame());601 page()->chrome()->client()->setPagePopupDriver(m_pagePopupDriver.get());602 #else603 UNUSED_PARAM(enabled);604 UNUSED_PARAM(ec);605 #endif606 }607 608 String InternalSettings::configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec)609 {610 if (!page()) {611 ec = INVALID_ACCESS_ERR;612 return String();613 }614 615 const int defaultLayoutWidthForNonMobilePages = 980;616 617 ViewportArguments arguments = page()->viewportArguments();618 ViewportAttributes attributes = computeViewportAttributes(arguments, defaultLayoutWidthForNonMobilePages, deviceWidth, deviceHeight, devicePixelRatio, IntSize(availableWidth, availableHeight));619 restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight), devicePixelRatio);620 restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);621 622 return "viewport size " + String::number(attributes.layoutSize.width()) + "x" + String::number(attributes.layoutSize.height()) + " scale " + String::number(attributes.initialScale) + " with limits [" + String::number(attributes.minimumScale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " + (attributes.userScalable ? "true" : "false");623 }624 625 545 void InternalSettings::setMemoryInfoEnabled(bool enabled, ExceptionCode& ec) 626 546 { -
trunk/Source/WebCore/testing/InternalSettings.h
r135227 r135753 40 40 class Frame; 41 41 class Document; 42 class MockPagePopupDriver;43 42 class Page; 44 class PagePopupController;45 43 class Settings; 46 44 … … 101 99 102 100 virtual ~InternalSettings(); 103 #if ENABLE(PAGE_POPUP)104 PagePopupController* pagePopupController();105 #endif106 101 void reset(); 107 102 … … 149 144 void setWindowFocusRestricted(bool, ExceptionCode&); 150 145 void setDialogElementEnabled(bool, ExceptionCode&); 151 void setPagination(const String& mode, int gap, ExceptionCode& ec) { setPagination(mode, gap, 0, ec); }152 void setPagination(const String& mode, int gap, int pageLength, ExceptionCode&);153 146 void setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode&); 154 147 bool shouldDisplayTrackKind(const String& kind, ExceptionCode&); 155 void setEnableMockPagePopup(bool, ExceptionCode&);156 String configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode&);157 148 void setMemoryInfoEnabled(bool, ExceptionCode&); 158 149 void setStorageBlockingPolicy(const String&, ExceptionCode&); … … 169 160 Page* m_page; 170 161 Backup m_backup; 171 #if ENABLE(PAGE_POPUP)172 OwnPtr<MockPagePopupDriver> m_pagePopupDriver;173 #endif174 162 }; 175 163 -
trunk/Source/WebCore/testing/InternalSettings.idl
r135227 r135753 71 71 void setLangAttributeAwareFormControlUIEnabled(in boolean enabled); 72 72 73 void setPagination(in DOMString mode, in long gap, in [Optional] long pageLength) raises(DOMException);74 void setEnableMockPagePopup(in boolean enabled) raises(DOMException);75 73 [Conditional=VIDEO_TRACK] void setShouldDisplayTrackKind(in DOMString kind, in boolean enabled) raises (DOMException); 76 74 [Conditional=VIDEO_TRACK] boolean shouldDisplayTrackKind(in DOMString trackKind) raises (DOMException); -
trunk/Source/WebCore/testing/Internals.cpp
r135251 r135753 29 29 #include "BackForwardController.h" 30 30 #include "CachedResourceLoader.h" 31 #include "Chrome.h" 32 #include "ChromeClient.h" 31 33 #include "ClientRect.h" 32 34 #include "ClientRectList.h" … … 63 65 #include "Language.h" 64 66 #include "MallocStatistics.h" 67 #include "MockPagePopupDriver.h" 65 68 #include "NodeRenderingContext.h" 66 69 #include "Page.h" … … 112 115 113 116 namespace WebCore { 117 118 #if ENABLE(PAGE_POPUP) 119 static MockPagePopupDriver* s_pagePopupDriver = 0; 120 #endif 114 121 115 122 using namespace HTMLNames; … … 214 221 ASSERT(page); 215 222 223 page->setPagination(Pagination()); 216 224 TextRun::setAllowsRoundingHacks(false); 217 225 WebCore::overrideUserPreferredLanguages(Vector<String>()); 218 226 WebCore::Settings::setUsesOverlayScrollbars(false); 227 #if ENABLE(PAGE_POPUP) 228 delete s_pagePopupDriver; 229 s_pagePopupDriver = 0; 230 if (page->chrome()) 231 page->chrome()->client()->resetPagePopupDriver(); 232 #endif 219 233 #if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) 220 234 if (page->inspectorController()) … … 666 680 } 667 681 682 void Internals::setEnableMockPagePopup(bool enabled, ExceptionCode& ec) 683 { 684 #if ENABLE(PAGE_POPUP) 685 Document* document = contextDocument(); 686 if (!document || !document->page() || !document->page()->chrome()) 687 return; 688 Page* page = document->page(); 689 if (!enabled) { 690 page->chrome()->client()->resetPagePopupDriver(); 691 return; 692 } 693 if (!s_pagePopupDriver) 694 s_pagePopupDriver = MockPagePopupDriver::create(page->mainFrame()).leakPtr(); 695 page->chrome()->client()->setPagePopupDriver(s_pagePopupDriver); 696 #else 697 UNUSED_PARAM(enabled); 698 UNUSED_PARAM(ec); 699 #endif 700 } 701 668 702 #if ENABLE(PAGE_POPUP) 669 703 PassRefPtr<PagePopupController> Internals::pagePopupController() 670 704 { 671 InternalSettings* settings = this->settings(); 672 if (!settings) 673 return 0; 674 return settings->pagePopupController(); 705 return s_pagePopupDriver ? s_pagePopupDriver->pagePopupController() : 0; 675 706 } 676 707 #endif … … 829 860 } 830 861 831 void Internals::setPagination(Document*, const String& mode, int gap, int pageLength, ExceptionCode& ec) 832 { 833 settings()->setPagination(mode, gap, pageLength, ec); 834 } 835 836 String Internals::configurationForViewport(Document*, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec) 837 { 838 return settings()->configurationForViewport(devicePixelRatio, deviceWidth, deviceHeight, availableWidth, availableHeight, ec); 862 void Internals::setPagination(Document* document, const String& mode, int gap, int pageLength, ExceptionCode& ec) 863 { 864 if (!document || !document->page()) { 865 ec = INVALID_ACCESS_ERR; 866 return; 867 } 868 Page* page = document->page(); 869 870 Pagination pagination; 871 if (mode == "Unpaginated") 872 pagination.mode = Pagination::Unpaginated; 873 else if (mode == "LeftToRightPaginated") 874 pagination.mode = Pagination::LeftToRightPaginated; 875 else if (mode == "RightToLeftPaginated") 876 pagination.mode = Pagination::RightToLeftPaginated; 877 else if (mode == "TopToBottomPaginated") 878 pagination.mode = Pagination::TopToBottomPaginated; 879 else if (mode == "BottomToTopPaginated") 880 pagination.mode = Pagination::BottomToTopPaginated; 881 else { 882 ec = SYNTAX_ERR; 883 return; 884 } 885 886 pagination.gap = gap; 887 pagination.pageLength = pageLength; 888 page->setPagination(pagination); 889 } 890 891 String Internals::configurationForViewport(Document* document, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec) 892 { 893 if (!document || !document->page()) { 894 ec = INVALID_ACCESS_ERR; 895 return String(); 896 } 897 Page* page = document->page(); 898 899 const int defaultLayoutWidthForNonMobilePages = 980; 900 901 ViewportArguments arguments = page->viewportArguments(); 902 ViewportAttributes attributes = computeViewportAttributes(arguments, defaultLayoutWidthForNonMobilePages, deviceWidth, deviceHeight, devicePixelRatio, IntSize(availableWidth, availableHeight)); 903 restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight), devicePixelRatio); 904 restrictScaleFactorToInitialScaleIfNotUserScalable(attributes); 905 906 return "viewport size " + String::number(attributes.layoutSize.width()) + "x" + String::number(attributes.layoutSize.height()) + " scale " + String::number(attributes.initialScale) + " with limits [" + String::number(attributes.minimumScale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " + (attributes.userScalable ? "true" : "false"); 839 907 } 840 908 -
trunk/Source/WebCore/testing/Internals.h
r135227 r135753 119 119 PassRefPtr<DOMStringList> formControlStateOfPreviousHistoryItem(ExceptionCode&); 120 120 void setFormControlStateOfPreviousHistoryItem(PassRefPtr<DOMStringList>, ExceptionCode&); 121 void setEnableMockPagePopup(bool, ExceptionCode&); 121 122 #if ENABLE(PAGE_POPUP) 122 123 PassRefPtr<PagePopupController> pagePopupController(); -
trunk/Source/WebCore/testing/Internals.idl
r135227 r135753 79 79 DOMString[] formControlStateOfPreviousHistoryItem() raises(DOMException); 80 80 void setFormControlStateOfPreviousHistoryItem(in DOMString[] values) raises(DOMException); 81 void setEnableMockPagePopup(in boolean enabled) raises(DOMException); 81 82 #if defined(ENABLE_PAGE_POPUP) && ENABLE_PAGE_POPUP 82 83 readonly attribute PagePopupController pagePopupController;
Note:
See TracChangeset
for help on using the changeset viewer.