Diff
Modified: trunk/LayoutTests/ChangeLog (135752 => 135753)
--- trunk/LayoutTests/ChangeLog 2012-11-26 20:17:36 UTC (rev 135752)
+++ trunk/LayoutTests/ChangeLog 2012-11-26 20:27:36 UTC (rev 135753)
@@ -1,3 +1,14 @@
+2012-11-26 Tony Chang <t...@chromium.org>
+
+ Move more functions from internals.settings to internals
+ https://bugs.webkit.org/show_bug.cgi?id=102976
+
+ Reviewed by Adam Barth.
+
+ Move internals.settings.setEnableMockPagePopup to internals.setEnableMockPagePopup.
+
+ * fast/forms/resources/picker-common.js:
+
2012-11-26 Andrei Bucur <abu...@adobe.com>
[CSS Regions] Add Region info for RootLineBoxes and pack the pagination data
Modified: trunk/LayoutTests/fast/forms/resources/picker-common.js (135752 => 135753)
--- trunk/LayoutTests/fast/forms/resources/picker-common.js 2012-11-26 20:17:36 UTC (rev 135752)
+++ trunk/LayoutTests/fast/forms/resources/picker-common.js 2012-11-26 20:27:36 UTC (rev 135753)
@@ -1,6 +1,6 @@
window.jsTestIsAsync = true;
if (window.internals)
- internals.settings.setEnableMockPagePopup(true);
+ internals.setEnableMockPagePopup(true);
var popupWindow = null;
Modified: trunk/Source/WebCore/ChangeLog (135752 => 135753)
--- trunk/Source/WebCore/ChangeLog 2012-11-26 20:17:36 UTC (rev 135752)
+++ trunk/Source/WebCore/ChangeLog 2012-11-26 20:27:36 UTC (rev 135753)
@@ -1,3 +1,34 @@
+2012-11-26 Tony Chang <t...@chromium.org>
+
+ Move more functions from internals.settings to internals
+ https://bugs.webkit.org/show_bug.cgi?id=102976
+
+ Reviewed by Adam Barth.
+
+ Move functions that don't have to do with Settings off of internals.settings.
+ setPagination and configurationForViewport were defined on internals, so we
+ can inline the functions (no test change).
+
+ setEnableMockPagePopup is moved to Internals.
+
+ No new tests, this is a refactor.
+
+ * testing/InternalSettings.cpp:
+ (WebCore::InternalSettings::reset): Move reset code into Internals.
+ * testing/InternalSettings.h:
+ (InternalSettings): Remove code for setPagination, configurationForViewport and setEnableMockPagePopup.
+ * testing/InternalSettings.idl: Remove setPagination and setEnableMockPagePopup.
+ * testing/Internals.cpp:
+ (WebCore): Use a static to keep track of the MockPagePopupDriver.
+ (WebCore::Internals::resetToConsistentState): Code from InternalSettings::reset
+ (WebCore::Internals::setEnableMockPagePopup): Code copied from InternalSettings.
+ (WebCore::Internals::pagePopupController): Code copied from InternalSettings.
+ (WebCore::Internals::setPagination): Code copied from InternalSettings.
+ (WebCore::Internals::configurationForViewport): Code copied from InternalSettings.
+ * testing/Internals.h:
+ (Internals): Add setEnableMockPagePopup.
+ * testing/Internals.idl: Add setEnableMockPagePopup.
+
2012-11-26 Andrei Bucur <abu...@adobe.com>
[CSS Regions] Add Region info for RootLineBoxes and pack the pagination data
Modified: trunk/Source/WebCore/testing/InternalSettings.cpp (135752 => 135753)
--- trunk/Source/WebCore/testing/InternalSettings.cpp 2012-11-26 20:17:36 UTC (rev 135752)
+++ trunk/Source/WebCore/testing/InternalSettings.cpp 2012-11-26 20:27:36 UTC (rev 135753)
@@ -26,15 +26,12 @@
#include "config.h"
#include "InternalSettings.h"
-#include "Chrome.h"
-#include "ChromeClient.h"
#include "Document.h"
#include "ExceptionCode.h"
#include "Frame.h"
#include "FrameView.h"
#include "Language.h"
#include "LocaleToScriptMapping.h"
-#include "MockPagePopupDriver.h"
#include "Page.h"
#include "RuntimeEnabledFeatures.h"
#include "Settings.h"
@@ -175,22 +172,9 @@
{
}
-#if ENABLE(PAGE_POPUP)
-PagePopupController* InternalSettings::pagePopupController()
-{
- return m_pagePopupDriver ? m_pagePopupDriver->pagePopupController() : 0;
-}
-#endif
-
void InternalSettings::reset()
{
- page()->setPagination(Pagination());
page()->setPageScaleFactor(1, IntPoint(0, 0));
-#if ENABLE(PAGE_POPUP)
- m_pagePopupDriver.clear();
- if (page()->chrome())
- page()->chrome()->client()->resetPagePopupDriver();
-#endif
m_backup.restoreTo(page(), settings());
m_backup = Backup(page(), settings());
@@ -558,70 +542,6 @@
#endif
}
-void InternalSettings::setPagination(const String& mode, int gap, int pageLength, ExceptionCode& ec)
-{
- if (!page()) {
- ec = INVALID_ACCESS_ERR;
- return;
- }
-
- Pagination pagination;
- if (mode == "Unpaginated")
- pagination.mode = Pagination::Unpaginated;
- else if (mode == "LeftToRightPaginated")
- pagination.mode = Pagination::LeftToRightPaginated;
- else if (mode == "RightToLeftPaginated")
- pagination.mode = Pagination::RightToLeftPaginated;
- else if (mode == "TopToBottomPaginated")
- pagination.mode = Pagination::TopToBottomPaginated;
- else if (mode == "BottomToTopPaginated")
- pagination.mode = Pagination::BottomToTopPaginated;
- else {
- ec = SYNTAX_ERR;
- return;
- }
-
- pagination.gap = gap;
- pagination.pageLength = pageLength;
- page()->setPagination(pagination);
-}
-
-void InternalSettings::setEnableMockPagePopup(bool enabled, ExceptionCode& ec)
-{
-#if ENABLE(PAGE_POPUP)
- InternalSettingsGuardForPage();
- if (!page()->chrome())
- return;
- if (!enabled) {
- page()->chrome()->client()->resetPagePopupDriver();
- return;
- }
- if (!m_pagePopupDriver)
- m_pagePopupDriver = MockPagePopupDriver::create(page()->mainFrame());
- page()->chrome()->client()->setPagePopupDriver(m_pagePopupDriver.get());
-#else
- UNUSED_PARAM(enabled);
- UNUSED_PARAM(ec);
-#endif
-}
-
-String InternalSettings::configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec)
-{
- if (!page()) {
- ec = INVALID_ACCESS_ERR;
- return String();
- }
-
- const int defaultLayoutWidthForNonMobilePages = 980;
-
- ViewportArguments arguments = page()->viewportArguments();
- ViewportAttributes attributes = computeViewportAttributes(arguments, defaultLayoutWidthForNonMobilePages, deviceWidth, deviceHeight, devicePixelRatio, IntSize(availableWidth, availableHeight));
- restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight), devicePixelRatio);
- restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);
-
- 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");
-}
-
void InternalSettings::setMemoryInfoEnabled(bool enabled, ExceptionCode& ec)
{
InternalSettingsGuardForSettings();
Modified: trunk/Source/WebCore/testing/InternalSettings.h (135752 => 135753)
--- trunk/Source/WebCore/testing/InternalSettings.h 2012-11-26 20:17:36 UTC (rev 135752)
+++ trunk/Source/WebCore/testing/InternalSettings.h 2012-11-26 20:27:36 UTC (rev 135753)
@@ -39,9 +39,7 @@
class Frame;
class Document;
-class MockPagePopupDriver;
class Page;
-class PagePopupController;
class Settings;
class InternalSettings : public RefCountedSupplement<Page, InternalSettings> {
@@ -100,9 +98,6 @@
static InternalSettings* from(Page*);
virtual ~InternalSettings();
-#if ENABLE(PAGE_POPUP)
- PagePopupController* pagePopupController();
-#endif
void reset();
void setForceCompositingMode(bool enabled, ExceptionCode&);
@@ -148,12 +143,8 @@
void setSyncXHRInDocumentsEnabled(bool, ExceptionCode&);
void setWindowFocusRestricted(bool, ExceptionCode&);
void setDialogElementEnabled(bool, ExceptionCode&);
- void setPagination(const String& mode, int gap, ExceptionCode& ec) { setPagination(mode, gap, 0, ec); }
- void setPagination(const String& mode, int gap, int pageLength, ExceptionCode&);
void setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode&);
bool shouldDisplayTrackKind(const String& kind, ExceptionCode&);
- void setEnableMockPagePopup(bool, ExceptionCode&);
- String configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode&);
void setMemoryInfoEnabled(bool, ExceptionCode&);
void setStorageBlockingPolicy(const String&, ExceptionCode&);
void setLangAttributeAwareFormControlUIEnabled(bool);
@@ -168,9 +159,6 @@
Page* m_page;
Backup m_backup;
-#if ENABLE(PAGE_POPUP)
- OwnPtr<MockPagePopupDriver> m_pagePopupDriver;
-#endif
};
} // namespace WebCore
Modified: trunk/Source/WebCore/testing/InternalSettings.idl (135752 => 135753)
--- trunk/Source/WebCore/testing/InternalSettings.idl 2012-11-26 20:17:36 UTC (rev 135752)
+++ trunk/Source/WebCore/testing/InternalSettings.idl 2012-11-26 20:27:36 UTC (rev 135753)
@@ -70,8 +70,6 @@
void setDialogElementEnabled(in boolean enabled) raises(DOMException);
void setLangAttributeAwareFormControlUIEnabled(in boolean enabled);
- void setPagination(in DOMString mode, in long gap, in [Optional] long pageLength) raises(DOMException);
- void setEnableMockPagePopup(in boolean enabled) raises(DOMException);
[Conditional=VIDEO_TRACK] void setShouldDisplayTrackKind(in DOMString kind, in boolean enabled) raises (DOMException);
[Conditional=VIDEO_TRACK] boolean shouldDisplayTrackKind(in DOMString trackKind) raises (DOMException);
void setMemoryInfoEnabled(in boolean enabled) raises(DOMException);
Modified: trunk/Source/WebCore/testing/Internals.cpp (135752 => 135753)
--- trunk/Source/WebCore/testing/Internals.cpp 2012-11-26 20:17:36 UTC (rev 135752)
+++ trunk/Source/WebCore/testing/Internals.cpp 2012-11-26 20:27:36 UTC (rev 135753)
@@ -28,6 +28,8 @@
#include "BackForwardController.h"
#include "CachedResourceLoader.h"
+#include "Chrome.h"
+#include "ChromeClient.h"
#include "ClientRect.h"
#include "ClientRectList.h"
#include "ComposedShadowTreeWalker.h"
@@ -62,6 +64,7 @@
#include "IntRect.h"
#include "Language.h"
#include "MallocStatistics.h"
+#include "MockPagePopupDriver.h"
#include "NodeRenderingContext.h"
#include "Page.h"
#include "PrintContext.h"
@@ -112,6 +115,10 @@
namespace WebCore {
+#if ENABLE(PAGE_POPUP)
+static MockPagePopupDriver* s_pagePopupDriver = 0;
+#endif
+
using namespace HTMLNames;
#if ENABLE(INSPECTOR)
@@ -213,9 +220,16 @@
{
ASSERT(page);
+ page->setPagination(Pagination());
TextRun::setAllowsRoundingHacks(false);
WebCore::overrideUserPreferredLanguages(Vector<String>());
WebCore::Settings::setUsesOverlayScrollbars(false);
+#if ENABLE(PAGE_POPUP)
+ delete s_pagePopupDriver;
+ s_pagePopupDriver = 0;
+ if (page->chrome())
+ page->chrome()->client()->resetPagePopupDriver();
+#endif
#if ENABLE(INSPECTOR) && ENABLE(_javascript__DEBUGGER)
if (page->inspectorController())
page->inspectorController()->setProfilerEnabled(false);
@@ -665,13 +679,30 @@
ec = INVALID_ACCESS_ERR;
}
+void Internals::setEnableMockPagePopup(bool enabled, ExceptionCode& ec)
+{
#if ENABLE(PAGE_POPUP)
+ Document* document = contextDocument();
+ if (!document || !document->page() || !document->page()->chrome())
+ return;
+ Page* page = document->page();
+ if (!enabled) {
+ page->chrome()->client()->resetPagePopupDriver();
+ return;
+ }
+ if (!s_pagePopupDriver)
+ s_pagePopupDriver = MockPagePopupDriver::create(page->mainFrame()).leakPtr();
+ page->chrome()->client()->setPagePopupDriver(s_pagePopupDriver);
+#else
+ UNUSED_PARAM(enabled);
+ UNUSED_PARAM(ec);
+#endif
+}
+
+#if ENABLE(PAGE_POPUP)
PassRefPtr<PagePopupController> Internals::pagePopupController()
{
- InternalSettings* settings = this->settings();
- if (!settings)
- return 0;
- return settings->pagePopupController();
+ return s_pagePopupDriver ? s_pagePopupDriver->pagePopupController() : 0;
}
#endif
@@ -828,14 +859,51 @@
frameView->setConstrainsScrollingToContentEdge(constrainsScrollingToContentEdgeOldValue);
}
-void Internals::setPagination(Document*, const String& mode, int gap, int pageLength, ExceptionCode& ec)
+void Internals::setPagination(Document* document, const String& mode, int gap, int pageLength, ExceptionCode& ec)
{
- settings()->setPagination(mode, gap, pageLength, ec);
+ if (!document || !document->page()) {
+ ec = INVALID_ACCESS_ERR;
+ return;
+ }
+ Page* page = document->page();
+
+ Pagination pagination;
+ if (mode == "Unpaginated")
+ pagination.mode = Pagination::Unpaginated;
+ else if (mode == "LeftToRightPaginated")
+ pagination.mode = Pagination::LeftToRightPaginated;
+ else if (mode == "RightToLeftPaginated")
+ pagination.mode = Pagination::RightToLeftPaginated;
+ else if (mode == "TopToBottomPaginated")
+ pagination.mode = Pagination::TopToBottomPaginated;
+ else if (mode == "BottomToTopPaginated")
+ pagination.mode = Pagination::BottomToTopPaginated;
+ else {
+ ec = SYNTAX_ERR;
+ return;
+ }
+
+ pagination.gap = gap;
+ pagination.pageLength = pageLength;
+ page->setPagination(pagination);
}
-String Internals::configurationForViewport(Document*, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec)
+String Internals::configurationForViewport(Document* document, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec)
{
- return settings()->configurationForViewport(devicePixelRatio, deviceWidth, deviceHeight, availableWidth, availableHeight, ec);
+ if (!document || !document->page()) {
+ ec = INVALID_ACCESS_ERR;
+ return String();
+ }
+ Page* page = document->page();
+
+ const int defaultLayoutWidthForNonMobilePages = 980;
+
+ ViewportArguments arguments = page->viewportArguments();
+ ViewportAttributes attributes = computeViewportAttributes(arguments, defaultLayoutWidthForNonMobilePages, deviceWidth, deviceHeight, devicePixelRatio, IntSize(availableWidth, availableHeight));
+ restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight), devicePixelRatio);
+ restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);
+
+ 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");
}
bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec)
Modified: trunk/Source/WebCore/testing/Internals.h (135752 => 135753)
--- trunk/Source/WebCore/testing/Internals.h 2012-11-26 20:17:36 UTC (rev 135752)
+++ trunk/Source/WebCore/testing/Internals.h 2012-11-26 20:27:36 UTC (rev 135753)
@@ -118,6 +118,7 @@
#endif
PassRefPtr<DOMStringList> formControlStateOfPreviousHistoryItem(ExceptionCode&);
void setFormControlStateOfPreviousHistoryItem(PassRefPtr<DOMStringList>, ExceptionCode&);
+ void setEnableMockPagePopup(bool, ExceptionCode&);
#if ENABLE(PAGE_POPUP)
PassRefPtr<PagePopupController> pagePopupController();
#endif
Modified: trunk/Source/WebCore/testing/Internals.idl (135752 => 135753)
--- trunk/Source/WebCore/testing/Internals.idl 2012-11-26 20:17:36 UTC (rev 135752)
+++ trunk/Source/WebCore/testing/Internals.idl 2012-11-26 20:27:36 UTC (rev 135753)
@@ -78,6 +78,7 @@
#endif
DOMString[] formControlStateOfPreviousHistoryItem() raises(DOMException);
void setFormControlStateOfPreviousHistoryItem(in DOMString[] values) raises(DOMException);
+ void setEnableMockPagePopup(in boolean enabled) raises(DOMException);
#if defined(ENABLE_PAGE_POPUP) && ENABLE_PAGE_POPUP
readonly attribute PagePopupController pagePopupController;
#endif