Skip to content

Commit

Permalink
Merge r174405 - Defer resolution of viewport size.
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=137376
rdar://problem/18558094

Reviewed by Benjamin Poulain.

ViewportConfiguration should resolve the viewport size on configuration update.

* dom/Document.cpp:
(WebCore::Document::processViewport): Defer resolution of viewport size.
* dom/ViewportArguments.cpp:
(WebCore::finalizeViewportArguments): Deleted.
* dom/ViewportArguments.h:
* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::updateConfiguration): Resolve viewport size.
(WebCore::ViewportConfiguration::viewportArgumentsLength): Resolves width or height based on viewport arguments.
* page/ViewportConfiguration.h:

Canonical link: https://commits.webkit.org/154760.111@webkitgtk/2.6
git-svn-id: https://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.6@174963 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Martin Hock authored and carlosgcampos committed Oct 21, 2014
1 parent fec9d26 commit 0dec1aa
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 30 deletions.
20 changes: 20 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,23 @@
2014-10-07 Martin Hock <mhock@apple.com>

Defer resolution of viewport size.
https://bugs.webkit.org/show_bug.cgi?id=137376
rdar://problem/18558094

Reviewed by Benjamin Poulain.

ViewportConfiguration should resolve the viewport size on configuration update.

* dom/Document.cpp:
(WebCore::Document::processViewport): Defer resolution of viewport size.
* dom/ViewportArguments.cpp:
(WebCore::finalizeViewportArguments): Deleted.
* dom/ViewportArguments.h:
* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::updateConfiguration): Resolve viewport size.
(WebCore::ViewportConfiguration::viewportArgumentsLength): Resolves width or height based on viewport arguments.
* page/ViewportConfiguration.h:

2014-10-06 David Hyatt <hyatt@apple.com>

REGRESSION (Simple Line Layout): Inline block baselines computed incorrectly
Expand Down
9 changes: 0 additions & 9 deletions Source/WebCore/dom/Document.cpp
Expand Up @@ -2955,15 +2955,6 @@ void Document::processViewport(const String& features, ViewportArguments::Type o
m_viewportArguments = ViewportArguments(origin);
processArguments(features, (void*)&m_viewportArguments, &setViewportFeature);

#if PLATFORM(IOS)
// FIXME: <rdar://problem/8955959> Investigate moving to ToT WebKit's extended Viewport Implementation
// Moving to ToT's implementation would mean calling findConfigurationForViewportData, which does
// bounds checking and determining concrete values for ValueAuto which we already do in UIKit.
// To maintain old behavior, we just need to update a few values, leaving Auto's for UIKit.
if (Page* page = this->page())
finalizeViewportArguments(m_viewportArguments, page->chrome().screenSize());
#endif

updateViewportArguments();
}

Expand Down
15 changes: 0 additions & 15 deletions Source/WebCore/dom/ViewportArguments.cpp
Expand Up @@ -401,21 +401,6 @@ void setViewportFeature(const String& keyString, const String& valueString, Docu
reportViewportWarning(document, UnrecognizedViewportArgumentKeyError, keyString, String());
}

#if PLATFORM(IOS)
void finalizeViewportArguments(ViewportArguments& arguments, const FloatSize& screenSize)
{
if (arguments.width == ViewportArguments::ValueDeviceWidth)
arguments.width = screenSize.width();
else if (arguments.width == ViewportArguments::ValueDeviceHeight)
arguments.width = screenSize.height();

if (arguments.height == ViewportArguments::ValueDeviceWidth)
arguments.height = screenSize.width();
else if (arguments.height == ViewportArguments::ValueDeviceHeight)
arguments.height = screenSize.height();
}
#endif

static const char* viewportErrorMessageTemplate(ViewportErrorCode errorCode)
{
static const char* const errors[] = {
Expand Down
4 changes: 0 additions & 4 deletions Source/WebCore/dom/ViewportArguments.h
Expand Up @@ -152,10 +152,6 @@ float computeMinimumScaleFactorForContentContained(const ViewportAttributes& res
void setViewportFeature(const String& keyString, const String& valueString, Document*, void* data);
void reportViewportWarning(Document*, ViewportErrorCode, const String& replacement1, const String& replacement2);

#if PLATFORM(IOS)
void finalizeViewportArguments(ViewportArguments&, const FloatSize& screenSize);
#endif

} // namespace WebCore

#endif // ViewportArguments_h
13 changes: 11 additions & 2 deletions Source/WebCore/page/ViewportConfiguration.cpp
Expand Up @@ -272,8 +272,8 @@ void ViewportConfiguration::updateConfiguration()

double minimumViewportArgumentsDimension = 10;
double maximumViewportArgumentsDimension = 10000;
applyViewportArgument(m_configuration.width, viewportArgumentsOverridesWidth, m_viewportArguments.width, minimumViewportArgumentsDimension, maximumViewportArgumentsDimension);
applyViewportArgument(m_configuration.height, viewportArgumentsOverridesHeight, m_viewportArguments.height, minimumViewportArgumentsDimension, maximumViewportArgumentsDimension);
applyViewportArgument(m_configuration.width, viewportArgumentsOverridesWidth, viewportArgumentsLength(m_viewportArguments.width), minimumViewportArgumentsDimension, maximumViewportArgumentsDimension);
applyViewportArgument(m_configuration.height, viewportArgumentsOverridesHeight, viewportArgumentsLength(m_viewportArguments.height), minimumViewportArgumentsDimension, maximumViewportArgumentsDimension);

if (viewportArgumentsOverridesInitialScale || viewportArgumentsOverridesWidth || viewportArgumentsOverridesHeight) {
m_configuration.initialScaleIsSet = viewportArgumentsOverridesInitialScale;
Expand All @@ -290,6 +290,15 @@ void ViewportConfiguration::updateConfiguration()
#endif
}

double ViewportConfiguration::viewportArgumentsLength(double length) const
{
if (length == ViewportArguments::ValueDeviceWidth)
return activeMinimumLayoutSizeInScrollViewCoordinates().width();
if (length == ViewportArguments::ValueDeviceHeight)
return activeMinimumLayoutSizeInScrollViewCoordinates().height();
return length;
}

int ViewportConfiguration::layoutWidth() const
{
ASSERT(!constraintsAreAllRelative(m_configuration));
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/page/ViewportConfiguration.h
Expand Up @@ -105,6 +105,7 @@ class ViewportConfiguration {

private:
void updateConfiguration();
double viewportArgumentsLength(double length) const;
int layoutWidth() const;
int layoutHeight() const;

Expand Down

0 comments on commit 0dec1aa

Please sign in to comment.