Title: [174405] trunk/Source/WebCore
Revision
174405
Author
mh...@apple.com
Date
2014-10-07 13:52:26 -0700 (Tue, 07 Oct 2014)

Log Message

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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (174404 => 174405)


--- trunk/Source/WebCore/ChangeLog	2014-10-07 20:37:48 UTC (rev 174404)
+++ trunk/Source/WebCore/ChangeLog	2014-10-07 20:52:26 UTC (rev 174405)
@@ -1,3 +1,23 @@
+2014-10-07  Martin Hock  <mh...@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-07  Pratik Solanki  <psola...@apple.com>
 
         [iOS] WebKit1 clients crash in DiskCacheMonitor::tryGetFileBackedSharedBufferFromCFURLCachedResponse()

Modified: trunk/Source/WebCore/dom/Document.cpp (174404 => 174405)


--- trunk/Source/WebCore/dom/Document.cpp	2014-10-07 20:37:48 UTC (rev 174404)
+++ trunk/Source/WebCore/dom/Document.cpp	2014-10-07 20:52:26 UTC (rev 174405)
@@ -3001,15 +3001,6 @@
     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();
 }
 

Modified: trunk/Source/WebCore/dom/ViewportArguments.cpp (174404 => 174405)


--- trunk/Source/WebCore/dom/ViewportArguments.cpp	2014-10-07 20:37:48 UTC (rev 174404)
+++ trunk/Source/WebCore/dom/ViewportArguments.cpp	2014-10-07 20:52:26 UTC (rev 174405)
@@ -401,21 +401,6 @@
         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[] = {

Modified: trunk/Source/WebCore/dom/ViewportArguments.h (174404 => 174405)


--- trunk/Source/WebCore/dom/ViewportArguments.h	2014-10-07 20:37:48 UTC (rev 174404)
+++ trunk/Source/WebCore/dom/ViewportArguments.h	2014-10-07 20:52:26 UTC (rev 174405)
@@ -152,10 +152,6 @@
 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

Modified: trunk/Source/WebCore/page/ViewportConfiguration.cpp (174404 => 174405)


--- trunk/Source/WebCore/page/ViewportConfiguration.cpp	2014-10-07 20:37:48 UTC (rev 174404)
+++ trunk/Source/WebCore/page/ViewportConfiguration.cpp	2014-10-07 20:52:26 UTC (rev 174405)
@@ -272,8 +272,8 @@
 
     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;
@@ -290,6 +290,15 @@
 #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));

Modified: trunk/Source/WebCore/page/ViewportConfiguration.h (174404 => 174405)


--- trunk/Source/WebCore/page/ViewportConfiguration.h	2014-10-07 20:37:48 UTC (rev 174404)
+++ trunk/Source/WebCore/page/ViewportConfiguration.h	2014-10-07 20:52:26 UTC (rev 174405)
@@ -105,6 +105,7 @@
     
 private:
     void updateConfiguration();
+    double viewportArgumentsLength(double length) const;
     int layoutWidth() const;
     int layoutHeight() const;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to