Skip to content
Permalink
Browse files
2010-03-01 Jakob Petsovits <jpetsovits@rim.com>
        Reviewed by Adam Barth.

        Convert the zoom mode (page vs. text-only) into a proper enum.
        https://bugs.webkit.org/show_bug.cgi?id=35347

        * GNUmakefile.am:
        * WebCore.base.exp: Substituted symbols __ZN7WebCore5Frame13setZoomFactorEfNS_8ZoomModeE
        and __ZN7WebCore8Settings11setZoomModeENS_8ZoomModeE for __ZN7WebCore5Frame13setZoomFactorEfb
        and __ZN7WebCore8Settings16setZoomsTextOnlyEb, respectively.
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * page/Frame.cpp:
        (WebCore::Frame::zoomMode):
        (WebCore::Frame::shouldApplyTextZoom):
        (WebCore::Frame::shouldApplyPageZoom):
        (WebCore::Frame::setZoomFactor):
        * page/Frame.h:
        * page/Settings.cpp:
        (WebCore::Settings::Settings):
        (WebCore::Settings::setZoomMode):
        * page/Settings.h:
        (WebCore::Settings::zoomMode):
        * page/ZoomMode.h: Added.
        (WebCore::):
        * svg/SVGSVGElement.cpp:
        (WebCore::SVGSVGElement::setCurrentScale):
2010-03-01  Jakob Petsovits  <jpetsovits@rim.com>

        Reviewed by Adam Barth.

        Adapt to the new ZoomMode enum.
        https://bugs.webkit.org/show_bug.cgi?id=35347

        * src/WebViewImpl.cpp:
        (WebKit::WebViewImpl::setZoomLevel):
2010-03-01  Jakob Petsovits  <jpetsovits@rim.com>

        Reviewed by Adam Barth.

        Adapt to the new ZoomMode enum.
        https://bugs.webkit.org/show_bug.cgi?id=35347

        * webkit/webkitwebview.cpp:
        (DNDContentsRequest::webkit_web_view_apply_zoom_level):
2010-03-01  Jakob Petsovits  <jpetsovits@rim.com>

        Reviewed by Adam Barth.

        Adapt to the new ZoomMode enum.
        https://bugs.webkit.org/show_bug.cgi?id=35347

        * WebView/WebView.mm:
        (-[WebView _preferencesChangedNotification:]):
        (-[WebView _setZoomMultiplier:isTextOnly:]):
        (-[WebView _realZoomMultiplierIsTextOnly]):
2010-03-01  Jakob Petsovits  <jpetsovits@rim.com>

        Reviewed by Adam Barth.

        Adapt to the new ZoomMode enum.
        https://bugs.webkit.org/show_bug.cgi?id=35347

        * Api/qwebframe.cpp:
        (QWebFrame::setTextSizeMultiplier):
        (QWebFrame::setZoomFactor):
        * Api/qwebsettings.cpp:
        (QWebSettingsPrivate::apply):
2010-03-01  Jakob Petsovits  <jpetsovits@rim.com>

        Reviewed by Adam Barth.

        Adapt to the new ZoomMode enum.
        https://bugs.webkit.org/show_bug.cgi?id=35347

        * WebFrame.cpp:
        (WebFrame::setTextSizeMultiplier):
        * WebView.cpp:
        (WebView::setZoomMultiplier):
        (WebView::zoomMultiplier):
        (WebView::canMakeTextLarger):
        (WebView::makeTextLarger):
        (WebView::canMakeTextSmaller):
        (WebView::makeTextSmaller):
        (WebView::notifyPreferencesChanged):
2010-03-01  Jakob Petsovits  <jpetsovits@rim.com>

        Reviewed by Adam Barth.

        Adapt to the new ZoomMode enum.
        https://bugs.webkit.org/show_bug.cgi?id=35347

        * WebFrame.cpp:
        (wxWebFrame::IncreaseTextSize):
        (wxWebFrame::DecreaseTextSize):
        (wxWebFrame::ResetTextSize):

Canonical link: https://commits.webkit.org/46688@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55387 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eseidel committed Mar 2, 2010
1 parent 0b5b105 commit 07950d451866f6683d7061b5a0203e295008eed9
Showing 27 changed files with 194 additions and 46 deletions.
@@ -1,3 +1,34 @@
2010-03-01 Jakob Petsovits <jpetsovits@rim.com>

Reviewed by Adam Barth.

Convert the zoom mode (page vs. text-only) into a proper enum.
https://bugs.webkit.org/show_bug.cgi?id=35347

* GNUmakefile.am:
* WebCore.base.exp: Substituted symbols __ZN7WebCore5Frame13setZoomFactorEfNS_8ZoomModeE
and __ZN7WebCore8Settings11setZoomModeENS_8ZoomModeE for __ZN7WebCore5Frame13setZoomFactorEfb
and __ZN7WebCore8Settings16setZoomsTextOnlyEb, respectively.
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* page/Frame.cpp:
(WebCore::Frame::zoomMode):
(WebCore::Frame::shouldApplyTextZoom):
(WebCore::Frame::shouldApplyPageZoom):
(WebCore::Frame::setZoomFactor):
* page/Frame.h:
* page/Settings.cpp:
(WebCore::Settings::Settings):
(WebCore::Settings::setZoomMode):
* page/Settings.h:
(WebCore::Settings::zoomMode):
* page/ZoomMode.h: Added.
(WebCore::):
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::setCurrentScale):

2010-03-01 Alex Milowski <alex@milowski.com>

Reviewed by Kenneth Rohde Christiansen.
@@ -1430,6 +1430,7 @@ webcore_sources += \
WebCore/page/WindowFeatures.h \
WebCore/page/XSSAuditor.cpp \
WebCore/page/XSSAuditor.h \
WebCore/page/ZoomMode.h \
WebCore/page/animation/AnimationBase.cpp \
WebCore/page/animation/AnimationBase.h \
WebCore/page/animation/AnimationController.cpp \
@@ -515,7 +515,7 @@ __ZN7WebCore5Cache13setCapacitiesEjjj
__ZN7WebCore5Frame10findStringERKNS_6StringEbbbb
__ZN7WebCore5Frame11shouldCloseEv
__ZN7WebCore5Frame13reapplyStylesEv
__ZN7WebCore5Frame13setZoomFactorEfb
__ZN7WebCore5Frame13setZoomFactorEfNS_8ZoomModeE
__ZN7WebCore5Frame14frameForWidgetEPKNS_6WidgetE
__ZN7WebCore5Frame15revealSelectionERKNS_15ScrollAlignmentEb
__ZN7WebCore5Frame17setIsDisconnectedEb
@@ -624,10 +624,10 @@ __ZN7WebCore8Document4headEv
__ZN7WebCore8FormDataD1Ev
__ZN7WebCore8IntPointC1ERK8_NSPoint
__ZN7WebCore8PositionC1EN3WTF10PassRefPtrINS_4NodeEEEi
__ZN7WebCore8Settings11setZoomModeENS_8ZoomModeE
__ZN7WebCore8Settings14setJavaEnabledEb
__ZN7WebCore8Settings15setWebGLEnabledEb
__ZN7WebCore8Settings16setUsesPageCacheEb
__ZN7WebCore8Settings16setZoomsTextOnlyEb
__ZN7WebCore8Settings17setPluginsEnabledEb
__ZN7WebCore8Settings18setDOMPasteAllowedEb
__ZN7WebCore8Settings18setDefaultFontSizeEi
@@ -1893,6 +1893,7 @@
'page/WorkerNavigator.h',
'page/XSSAuditor.cpp',
'page/XSSAuditor.h',
'page/ZoomMode.h',
'platform/animation/Animation.cpp',
'platform/animation/Animation.h',
'platform/animation/AnimationList.cpp',
@@ -1483,6 +1483,7 @@ HEADERS += \
page/WindowFeatures.h \
page/WorkerNavigator.h \
page/XSSAuditor.h \
page/ZoomMode.h \
platform/animation/Animation.h \
platform/animation/AnimationList.h \
platform/Arena.h \
@@ -21024,6 +21024,10 @@
RelativePath="..\page\XSSAuditor.h"
>
</File>
<File
RelativePath="..\page\ZoomMode.h"
>
</File>
<Filter
Name="win"
>
@@ -4656,6 +4656,7 @@
C5EBDD84105EDDEC0056816F /* StorageEventDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */; };
C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */ = {isa = PBXBuildFile; fileRef = C6D74AD309AA282E000B0A52 /* ModifySelectionListLevel.h */; };
C6D74AE409AA290A000B0A52 /* ModifySelectionListLevel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6D74AE309AA290A000B0A52 /* ModifySelectionListLevel.cpp */; };
CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */ = {isa = PBXBuildFile; fileRef = CE172E001136E8CE0062A533 /* ZoomMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
CE4C00E410F6F7BA00CA38F5 /* HTMLNoScriptElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE4C00E310F6F7BA00CA38F5 /* HTMLNoScriptElement.cpp */; };
CE4C00E610F6F7C100CA38F5 /* HTMLNoScriptElement.h in Headers */ = {isa = PBXBuildFile; fileRef = CE4C00E510F6F7C100CA38F5 /* HTMLNoScriptElement.h */; };
CE54FD381016D9A6008B44C8 /* ScriptSourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = CE54FD371016D9A6008B44C8 /* ScriptSourceProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9949,6 +9950,7 @@
C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageEventDispatcher.h; sourceTree = "<group>"; };
C6D74AD309AA282E000B0A52 /* ModifySelectionListLevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModifySelectionListLevel.h; sourceTree = "<group>"; };
C6D74AE309AA290A000B0A52 /* ModifySelectionListLevel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModifySelectionListLevel.cpp; sourceTree = "<group>"; };
CE172E001136E8CE0062A533 /* ZoomMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZoomMode.h; sourceTree = "<group>"; };
CE4C00E310F6F7BA00CA38F5 /* HTMLNoScriptElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLNoScriptElement.cpp; sourceTree = "<group>"; };
CE4C00E510F6F7C100CA38F5 /* HTMLNoScriptElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLNoScriptElement.h; sourceTree = "<group>"; };
CE54FD371016D9A6008B44C8 /* ScriptSourceProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptSourceProvider.h; sourceTree = "<group>"; };
@@ -11572,6 +11574,7 @@
E1271A510EEECD1C00F61213 /* WorkerNavigator.idl */,
97DD4D840FDF4D6D00ECF9A4 /* XSSAuditor.cpp */,
97DD4D850FDF4D6E00ECF9A4 /* XSSAuditor.h */,
CE172E001136E8CE0062A533 /* ZoomMode.h */,
);
path = page;
sourceTree = "<group>";
@@ -18590,6 +18593,7 @@
65E0E9441133C89F00B4CB10 /* JSDOMWrapper.h in Headers */,
5962297A1133EFE200DC4CBB /* GeolocationPositionCache.h in Headers */,
0BC2C7781134A8FC000B2F61 /* CanvasSurface.h in Headers */,
CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -661,28 +661,24 @@ float Frame::zoomFactor() const
return m_zoomFactor;
}

bool Frame::isZoomFactorTextOnly() const
ZoomMode Frame::zoomMode() const
{
return m_page->settings()->zoomsTextOnly();
return m_page->settings()->zoomMode();
}

bool Frame::shouldApplyTextZoom() const
{
if (m_zoomFactor == 1.0f || !isZoomFactorTextOnly())
return false;
return true;
return m_zoomFactor != 1.0f && zoomMode() == ZoomTextOnly;
}

bool Frame::shouldApplyPageZoom() const
{
if (m_zoomFactor == 1.0f || isZoomFactorTextOnly())
return false;
return true;
return m_zoomFactor != 1.0f && zoomMode() == ZoomPage;
}

void Frame::setZoomFactor(float percent, bool isTextOnly)
void Frame::setZoomFactor(float percent, ZoomMode mode)
{
if (m_zoomFactor == percent && isZoomFactorTextOnly() == isTextOnly)
if (m_zoomFactor == percent && zoomMode() == mode)
return;

#if ENABLE(SVG)
@@ -696,20 +692,20 @@ void Frame::setZoomFactor(float percent, bool isTextOnly)
}
#endif

if (!isTextOnly) {
if (mode == ZoomPage) {
// Update the scroll position when doing a full page zoom, so the content stays in relatively the same position.
IntPoint scrollPosition = view()->scrollPosition();
float percentDifference = (percent / m_zoomFactor);
view()->setScrollPosition(IntPoint(scrollPosition.x() * percentDifference, scrollPosition.y() * percentDifference));
}

m_zoomFactor = percent;
m_page->settings()->setZoomsTextOnly(isTextOnly);
m_page->settings()->setZoomMode(mode);

m_doc->recalcStyle(Node::Force);

for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling())
child->setZoomFactor(m_zoomFactor, isTextOnly);
child->setZoomFactor(m_zoomFactor, mode);

if (m_doc->renderer() && m_doc->renderer()->needsLayout() && view()->didFirstLayout())
view()->layout();
@@ -38,6 +38,7 @@
#include "ScrollBehavior.h"
#include "SelectionController.h"
#include "UserScriptTypes.h"
#include "ZoomMode.h"

#if PLATFORM(WIN)
#include "FrameWin.h"
@@ -169,9 +170,9 @@ namespace WebCore {
// === to be moved into FrameView

public:
void setZoomFactor(float scale, bool isTextOnly);
void setZoomFactor(float scale, ZoomMode);
float zoomFactor() const;
bool isZoomFactorTextOnly() const;
ZoomMode zoomMode() const;
bool shouldApplyTextZoom() const;
bool shouldApplyPageZoom() const;
float pageZoomFactor() const { return shouldApplyPageZoom() ? zoomFactor() : 1.0f; }
@@ -64,6 +64,7 @@ Settings::Settings(Page* page)
, m_maximumDecodedImageSize(numeric_limits<size_t>::max())
, m_localStorageQuota(5 * 1024 * 1024) // Suggested by the HTML5 spec.
, m_pluginAllowedRunTime(numeric_limits<unsigned>::max())
, m_zoomMode(ZoomPage)
, m_isJavaEnabled(false)
, m_loadsImagesAutomatically(false)
, m_privateBrowsingEnabled(false)
@@ -102,7 +103,6 @@ Settings::Settings(Page* page)
, m_inApplicationChromeMode(false)
, m_offlineWebApplicationCacheEnabled(false)
, m_shouldPaintCustomScrollbars(false)
, m_zoomsTextOnly(false)
, m_enforceCSSMIMETypeInStrictMode(true)
, m_usesEncodingDetector(false)
, m_allowScriptsToCloseWindows(false)
@@ -467,12 +467,12 @@ void Settings::setShouldPaintCustomScrollbars(bool shouldPaintCustomScrollbars)
m_shouldPaintCustomScrollbars = shouldPaintCustomScrollbars;
}

void Settings::setZoomsTextOnly(bool zoomsTextOnly)
void Settings::setZoomMode(ZoomMode mode)
{
if (zoomsTextOnly == m_zoomsTextOnly)
if (mode == m_zoomMode)
return;

m_zoomsTextOnly = zoomsTextOnly;
m_zoomMode = mode;
setNeedsReapplyStylesInAllFrames(m_page);
}

@@ -30,6 +30,7 @@
#include "AtomicString.h"
#include "FontRenderingMode.h"
#include "KURL.h"
#include "ZoomMode.h"

namespace WebCore {

@@ -234,8 +235,8 @@ namespace WebCore {
void setShouldPaintCustomScrollbars(bool);
bool shouldPaintCustomScrollbars() const { return m_shouldPaintCustomScrollbars; }

void setZoomsTextOnly(bool);
bool zoomsTextOnly() const { return m_zoomsTextOnly; }
void setZoomMode(ZoomMode);
ZoomMode zoomMode() const { return m_zoomMode; }

void setEnforceCSSMIMETypeInStrictMode(bool);
bool enforceCSSMIMETypeInStrictMode() { return m_enforceCSSMIMETypeInStrictMode; }
@@ -309,6 +310,7 @@ namespace WebCore {
size_t m_maximumDecodedImageSize;
unsigned m_localStorageQuota;
unsigned m_pluginAllowedRunTime;
ZoomMode m_zoomMode;
bool m_isJavaEnabled : 1;
bool m_loadsImagesAutomatically : 1;
bool m_privateBrowsingEnabled : 1;
@@ -347,7 +349,6 @@ namespace WebCore {
bool m_inApplicationChromeMode : 1;
bool m_offlineWebApplicationCacheEnabled : 1;
bool m_shouldPaintCustomScrollbars : 1;
bool m_zoomsTextOnly : 1;
bool m_enforceCSSMIMETypeInStrictMode : 1;
bool m_usesEncodingDetector : 1;
bool m_allowScriptsToCloseWindows : 1;
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2010 Research in Motion Ltd. http://www.rim.com/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/

#ifndef ZoomMode_h
#define ZoomMode_h

namespace WebCore {

enum ZoomMode {
ZoomPage,
ZoomTextOnly
};

}

#endif
@@ -199,7 +199,7 @@ void SVGSVGElement::setCurrentScale(float scale)
// Calling setCurrentScale() on the outermost <svg> element in a standalone SVG document
// is allowed to change the page zoom factor, influencing the document size, scrollbars etc.
if (parentNode() == document())
frame->setZoomFactor(scale, false);
frame->setZoomFactor(scale, ZoomPage);
return;
}

@@ -1,3 +1,13 @@
2010-03-01 Jakob Petsovits <jpetsovits@rim.com>

Reviewed by Adam Barth.

Adapt to the new ZoomMode enum.
https://bugs.webkit.org/show_bug.cgi?id=35347

* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::setZoomLevel):

2010-03-01 Thatcher Ulrich <tulrich@google.com>

Reviewed by Darin Fisher.
@@ -1302,7 +1302,7 @@ int WebViewImpl::setZoomLevel(bool textOnly, int zoomLevel)
Frame* frame = mainFrameImpl()->frame();
if (zoomFactor != frame->zoomFactor()) {
m_zoomLevel = zoomLevel;
frame->setZoomFactor(zoomFactor, textOnly);
frame->setZoomFactor(zoomFactor, textOnly ? ZoomTextOnly : ZoomPage);
}
return m_zoomLevel;
}
@@ -1,3 +1,13 @@
2010-03-01 Jakob Petsovits <jpetsovits@rim.com>

Reviewed by Adam Barth.

Adapt to the new ZoomMode enum.
https://bugs.webkit.org/show_bug.cgi?id=35347

* webkit/webkitwebview.cpp:
(DNDContentsRequest::webkit_web_view_apply_zoom_level):

2010-03-01 Kalle Vahlman <zuh@iki.fi>

Reviewed by Gustavo Noronha Silva.
@@ -3711,7 +3711,7 @@ static void webkit_web_view_apply_zoom_level(WebKitWebView* webView, gfloat zoom
return;

WebKitWebViewPrivate* priv = webView->priv;
frame->setZoomFactor(zoomLevel, !priv->zoomFullContent);
frame->setZoomFactor(zoomLevel, priv->zoomFullContent ? ZoomPage : ZoomTextOnly);
}

/**
@@ -1,3 +1,15 @@
2010-03-01 Jakob Petsovits <jpetsovits@rim.com>

Reviewed by Adam Barth.

Adapt to the new ZoomMode enum.
https://bugs.webkit.org/show_bug.cgi?id=35347

* WebView/WebView.mm:
(-[WebView _preferencesChangedNotification:]):
(-[WebView _setZoomMultiplier:isTextOnly:]):
(-[WebView _realZoomMultiplierIsTextOnly]):

2010-02-27 Jing Jin <jjin@apple.com>

Reviewed by Timothy Hatcher.

0 comments on commit 07950d4

Please sign in to comment.