Title: [225277] trunk
Revision
225277
Author
simon.fra...@apple.com
Date
2017-11-29 10:59:39 -0800 (Wed, 29 Nov 2017)

Log Message

Viewport unit values affected by Comand-+ zoom
https://bugs.webkit.org/show_bug.cgi?id=145614

Reviewed by Zalan Bujtas.
Source/WebCore:

Don't apply zooming when resolving viewport-relative lengths, since they should not
change based on the zoom level.

Test: fast/css/viewport-units-zoom.html

* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):

Tools:

Fix Command+ and Command- in MiniBrowser to do zooming, rather than being tied
to editing commands.

* MiniBrowser/mac/MainMenu.xib:

LayoutTests:

* fast/css/viewport-units-zoom-expected.html: Added.
* fast/css/viewport-units-zoom.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (225276 => 225277)


--- trunk/LayoutTests/ChangeLog	2017-11-29 18:59:01 UTC (rev 225276)
+++ trunk/LayoutTests/ChangeLog	2017-11-29 18:59:39 UTC (rev 225277)
@@ -1,3 +1,13 @@
+2017-11-29  Simon Fraser  <simon.fra...@apple.com>
+
+        Viewport unit values affected by Comand-+ zoom
+        https://bugs.webkit.org/show_bug.cgi?id=145614
+
+        Reviewed by Zalan Bujtas.
+
+        * fast/css/viewport-units-zoom-expected.html: Added.
+        * fast/css/viewport-units-zoom.html: Added.
+
 2017-11-29  Ms2ger  <ms2...@igalia.com>
 
         Enable imported/w3c/web-platform-tests/resource-timing/single-entry-per-resource.html.

Added: trunk/LayoutTests/fast/css/viewport-units-zoom-expected.html (0 => 225277)


--- trunk/LayoutTests/fast/css/viewport-units-zoom-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/viewport-units-zoom-expected.html	2017-11-29 18:59:39 UTC (rev 225277)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            margin: 0;
+        }
+        .box {
+            background-color: green;
+            margin-top: 10px;
+        }
+        
+        .width {
+            width: 50vw;
+            height: 100px;
+        }
+    </style>
+</head>
+<body>
+<p>Both boxes should be the same width.</p>
+<div class="box width"></div>
+<div class="box width" style="height: 200px; margin-top: 20px"></div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/viewport-units-zoom.html (0 => 225277)


--- trunk/LayoutTests/fast/css/viewport-units-zoom.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/viewport-units-zoom.html	2017-11-29 18:59:39 UTC (rev 225277)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            margin: 0;
+        }
+        .box {
+            background-color: green;
+            margin-top: 10px;
+        }
+        
+        .width {
+            width: 50vw;
+            height: 100px;
+        }
+    </style>
+</head>
+<body>
+<p>Both boxes should be the same width.</p>
+<div class="box width"></div>
+<div class="box width" style="zoom:2"></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (225276 => 225277)


--- trunk/Source/WebCore/ChangeLog	2017-11-29 18:59:01 UTC (rev 225276)
+++ trunk/Source/WebCore/ChangeLog	2017-11-29 18:59:39 UTC (rev 225277)
@@ -1,3 +1,18 @@
+2017-11-29  Simon Fraser  <simon.fra...@apple.com>
+
+        Viewport unit values affected by Comand-+ zoom
+        https://bugs.webkit.org/show_bug.cgi?id=145614
+
+        Reviewed by Zalan Bujtas.
+        
+        Don't apply zooming when resolving viewport-relative lengths, since they should not
+        change based on the zoom level.
+
+        Test: fast/css/viewport-units-zoom.html
+
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):
+
 2017-11-29  Brent Fulgham  <bfulg...@apple.com>
 
         Unreviewed test fix after r225264.

Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (225276 => 225277)


--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2017-11-29 18:59:01 UTC (rev 225276)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2017-11-29 18:59:39 UTC (rev 225277)
@@ -640,6 +640,7 @@
 double CSSPrimitiveValue::computeNonCalcLengthDouble(const CSSToLengthConversionData& conversionData, UnitType primitiveType, double value)
 {
     double factor;
+    bool applyZoom = true;
 
     switch (primitiveType) {
     case CSS_EMS:
@@ -692,15 +693,19 @@
         return -1.0;
     case CSS_VH:
         factor = conversionData.viewportHeightFactor();
+        applyZoom = false;
         break;
     case CSS_VW:
         factor = conversionData.viewportWidthFactor();
+        applyZoom = false;
         break;
     case CSS_VMAX:
         factor = conversionData.viewportMaxFactor();
+        applyZoom = false;
         break;
     case CSS_VMIN:
         factor = conversionData.viewportMinFactor();
+        applyZoom = false;
         break;
     default:
         ASSERT_NOT_REACHED();
@@ -714,7 +719,10 @@
     if (conversionData.computingFontSize() || isFontRelativeLength(primitiveType))
         return result;
 
-    return result * conversionData.zoom();
+    if (applyZoom)
+        result *= conversionData.zoom();
+
+    return result;
 }
 
 ExceptionOr<void> CSSPrimitiveValue::setFloatValue(unsigned short, double)

Modified: trunk/Tools/ChangeLog (225276 => 225277)


--- trunk/Tools/ChangeLog	2017-11-29 18:59:01 UTC (rev 225276)
+++ trunk/Tools/ChangeLog	2017-11-29 18:59:39 UTC (rev 225277)
@@ -1,3 +1,15 @@
+2017-11-29  Simon Fraser  <simon.fra...@apple.com>
+
+        Viewport unit values affected by Comand-+ zoom
+        https://bugs.webkit.org/show_bug.cgi?id=145614
+
+        Reviewed by Zalan Bujtas.
+        
+        Fix Command+ and Command- in MiniBrowser to do zooming, rather than being tied
+        to editing commands.
+
+        * MiniBrowser/mac/MainMenu.xib:
+
 2017-11-29  Alex Christensen  <achristen...@webkit.org>
 
         Add test for _WKVisitedLinkStore.addVisitedLinkWithString

Modified: trunk/Tools/MiniBrowser/mac/MainMenu.xib (225276 => 225277)


--- trunk/Tools/MiniBrowser/mac/MainMenu.xib	2017-11-29 18:59:01 UTC (rev 225276)
+++ trunk/Tools/MiniBrowser/mac/MainMenu.xib	2017-11-29 18:59:39 UTC (rev 225277)
@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11521.1" systemVersion="16B2648a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13168.4" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
     <dependencies>
-        <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11521.1"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13168.4"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@@ -396,12 +395,14 @@
                                             </connections>
                                         </menuItem>
                                         <menuItem isSeparatorItem="YES" id="dKY-wH-ZAW"/>
-                                        <menuItem title="Bigger" tag="3" keyEquivalent="+" id="V0U-mA-5AK">
+                                        <menuItem title="Bigger" tag="3" id="V0U-mA-5AK">
+                                            <modifierMask key="keyEquivalentModifierMask"/>
                                             <connections>
                                                 <action selector="modifyFont:" target="420" id="hmF-PZ-vVH"/>
                                             </connections>
                                         </menuItem>
-                                        <menuItem title="Smaller" tag="4" keyEquivalent="-" id="hWP-7f-ZV3">
+                                        <menuItem title="Smaller" tag="4" id="hWP-7f-ZV3">
+                                            <modifierMask key="keyEquivalentModifierMask"/>
                                             <connections>
                                                 <action selector="modifyFont:" target="420" id="pnr-Yn-h6p"/>
                                             </connections>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to