commit | 6cd879f079a7e4bacee4f2333e66c9bdd465f750 | [log] [tgz] |
---|---|---|
author | simon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Wed Dec 04 02:22:35 2019 +0000 |
committer | simon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Wed Dec 04 02:22:35 2019 +0000 |
tree | 30035ab09f68b96d0cd34194fc64bf0a0cd607c2 | |
parent | 06cd1700e18b7cdc354283f031de8b8588061653 [diff] |
calc() serialization doesn't match the spec https://bugs.webkit.org/show_bug.cgi?id=203442 LayoutTests/imported/w3c: <rdar://problem/56639402> Reviewed by Dean Jackson. New results. Current WPT don't reflect the new serialization rules yet, so we expect some failing results here. * web-platform-tests/css/css-align/gaps/column-gap-parsing-001-expected.txt: * web-platform-tests/css/css-align/gaps/gap-parsing-001-expected.txt: * web-platform-tests/css/css-align/gaps/grid-column-gap-parsing-001-expected.txt: * web-platform-tests/css/css-align/gaps/grid-gap-parsing-001-expected.txt: * web-platform-tests/css/css-align/gaps/grid-row-gap-parsing-001-expected.txt: * web-platform-tests/css/css-align/gaps/row-gap-parsing-001-expected.txt: * web-platform-tests/css/css-box/parsing/padding-valid-expected.txt: * web-platform-tests/css/css-shapes/animation/shape-outside-interpolation-expected.txt: * web-platform-tests/css/css-shapes/shape-outside/values/shape-margin-003-expected.txt: * web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-circle-010-expected.txt: * web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-circle-011-expected.txt: * web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-ellipse-010-expected.txt: * web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-ellipse-011-expected.txt: * web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-inset-008-expected.txt: * web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-inset-009-expected.txt: * web-platform-tests/css/css-shapes/shape-outside/values/shape-outside-polygon-006-expected.txt: * web-platform-tests/css/css-values/calc-background-position-002-expected.txt: * web-platform-tests/css/css-values/calc-background-position-003-expected.txt: * web-platform-tests/css/css-values/calc-nesting-002-expected.txt: * web-platform-tests/css/css-values/calc-serialization-002-expected.txt: * web-platform-tests/css/css-values/calc-serialization-expected.txt: * web-platform-tests/css/css-values/minmax-angle-computed-expected.txt: * web-platform-tests/css/css-values/minmax-angle-serialize-expected.txt: * web-platform-tests/css/css-values/minmax-length-percent-serialize-expected.txt: * web-platform-tests/css/css-values/minmax-length-serialize-expected.txt: * web-platform-tests/css/css-values/minmax-percentage-serialize-expected.txt: * web-platform-tests/css/css-values/minmax-time-computed-expected.txt: * web-platform-tests/css/css-values/minmax-time-serialize-expected.txt: Source/WebCore: <rdar://problem/56639402> Reviewed by Dean Jackson. These changes implement the calc() simplification and serialization rules described in https://drafts.csswg.org/css-values-4/#calc-internal. They also make it easy to add the new math functions in future. The major changes are: 1. Create Negate and Invert nodes to handle subtraction and division, so that Product and Sum are the only math operators that are tracked, which makes it possible to sort child nodes for simplification. 2. After parsing, do a bottom-up simplification parse following <https://drafts.csswg.org/css-values-4/#calc-simplification>, which sorts child nodes according to <https://drafts.csswg.org/css-values-4/#sort-a-calculations-children>, combines child nodes where possible, and hoists child nodes up to their parents were possible. Simplification always preserves a calc-like function at the root. This simplification also does unit canonicalization (e.g. all absolute lengths get px units). To make unit conversion more explicit, pass a CSSUnitType into doubleValue() methods so that it's clear what units the resulting value is in. 3. Serialize according to <https://drafts.csswg.org/css-values-4/#calc-serialize> which fixes bugs with nested parentheses. This patch does not completely implement the type checking and conversion rules described in <https://drafts.csswg.org/css-values-4/#calc-type-checking> and <https://drafts.css-houdini.org/css-typed-om-1/#numeric-typing>. Tests: fast/css/calc-parsing-limits.html fast/css/calc-parsing.html * css/CSSCalculationValue.cpp: (WebCore::calculationCategoryForCombination): (WebCore::canonicalUnitTypeForCalculationCategory): (WebCore::functionFromOperator): (WebCore::CSSCalcPrimitiveValueNode::isNumericValue const): (WebCore::CSSCalcPrimitiveValueNode::isNegative const): (WebCore::CSSCalcPrimitiveValueNode::negate): (WebCore::CSSCalcPrimitiveValueNode::invert): (WebCore::CSSCalcPrimitiveValueNode::add): (WebCore::CSSCalcPrimitiveValueNode::multiply): (WebCore::CSSCalcPrimitiveValueNode::convertToUnitType): (WebCore::CSSCalcPrimitiveValueNode::canonicalizeUnit): (WebCore::CSSCalcPrimitiveValueNode::doubleValue const): (WebCore::CSSCalcNegateNode::createCalcExpression const): (WebCore::CSSCalcNegateNode::dump const): (WebCore::CSSCalcInvertNode::createCalcExpression const): (WebCore::CSSCalcInvertNode::dump const): (WebCore::categoryForInvert): (WebCore::determineCategory): (WebCore::CSSCalcOperationNode::create): (WebCore::CSSCalcOperationNode::createSum): (WebCore::CSSCalcOperationNode::createProduct): (WebCore::CSSCalcOperationNode::hoistChildrenWithOperator): (WebCore::sortingCategoryForType): (WebCore::sortingCategory): (WebCore::primitiveTypeForCombination): (WebCore::conversionToAddValuesWithTypes): (WebCore::CSSCalcOperationNode::canCombineAllChildren const): (WebCore::CSSCalcOperationNode::combineChildren): (WebCore::CSSCalcOperationNode::simplify): (WebCore::CSSCalcOperationNode::simplifyRecursive): (WebCore::CSSCalcOperationNode::simplifyNode): (WebCore::CSSCalcOperationNode::primitiveType const): (WebCore::CSSCalcOperationNode::doubleValue const): (WebCore::CSSCalcOperationNode::computeLengthPx const): (WebCore::CSSCalcOperationNode::buildCSSText): (WebCore::functionPrefixForOperator): (WebCore::CSSCalcOperationNode::buildCSSTextRecursive): (WebCore::CSSCalcOperationNode::evaluateOperator): (WebCore::CSSCalcExpressionNodeParser::parseCalc): (WebCore::checkDepthAndIndex): (WebCore::CSSCalcExpressionNodeParser::parseCalcFunction): (WebCore::CSSCalcExpressionNodeParser::parseValue): (WebCore::CSSCalcExpressionNodeParser::parseCalcValue): (WebCore::CSSCalcExpressionNodeParser::parseCalcProduct): (WebCore::CSSCalcExpressionNodeParser::parseCalcSum): (WebCore::createCSS): (WebCore::CSSCalcValue::customCSSText const): (WebCore::CSSCalcValue::doubleValue const): (WebCore::CSSCalcValue::create): (WebCore::CSSCalcOperationNode::createSimplified): Deleted. (WebCore::CSSCalcOperationNode::buildCssText): Deleted. (WebCore::CSSCalcOperationNode::customCSSText const): Deleted. (WebCore::CSSCalcExpressionNodeParser::parseValueTerm): Deleted. (WebCore::CSSCalcExpressionNodeParser::parseValueMultiplicativeExpression): Deleted. (WebCore::CSSCalcExpressionNodeParser::parseAdditiveValueExpression): Deleted. (WebCore::CSSCalcExpressionNodeParser::parseMinMaxExpression): Deleted. (WebCore::CSSCalcExpressionNodeParser::parseValueExpression): Deleted. * css/CSSCalculationValue.h: * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::unitTypeString): * css/CSSPrimitiveValue.h: * platform/CalculationValue.cpp: (WebCore::CalcExpressionNegation::evaluate const): (WebCore::CalcExpressionNegation::operator== const): (WebCore::CalcExpressionNegation::dump const): (WebCore::operator==): (WebCore::CalcExpressionInversion::evaluate const): (WebCore::CalcExpressionInversion::dump const): (WebCore::CalcExpressionInversion::operator== const): (WebCore::CalcExpressionOperation::evaluate const): (WebCore::operator<<): * platform/CalculationValue.h: LayoutTests: Reviewed by Dean Jackson. New results, mainly because of new simplification rules. * css3/calc/cssom-expected.txt: * css3/calc/simplification-expected.txt: * css3/flexbox/flex-property-parsing-expected.txt: * css3/flexbox/flex-property-parsing.html: * css3/scroll-snap/scroll-snap-property-computed-style-expected.txt: * css3/scroll-snap/scroll-snap-property-computed-style.js: * css3/scroll-snap/scroll-snap-property-parsing-expected.txt: * css3/scroll-snap/scroll-snap-property-parsing.js: * css3/shapes/shape-outside/values/support/parsing-utils.js: * fast/css-grid-layout/grid-columns-rows-get-set-expected.txt: * fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt: * fast/css-grid-layout/non-grid-columns-rows-get-set-expected.txt: * fast/css-grid-layout/non-grid-columns-rows-get-set-multiple-expected.txt: * fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js: * fast/css-grid-layout/resources/grid-columns-rows-get-set.js: * fast/css-grid-layout/resources/non-grid-columns-rows-get-set-multiple.js: * fast/css-grid-layout/resources/non-grid-columns-rows-get-set.js: * fast/css/calc-parsing-expected.txt: Added. * fast/css/calc-parsing-limits-expected.txt: Added. * fast/css/calc-parsing-limits.html: Added. * fast/css/calc-parsing.html: Added. * fast/css/calc-with-angle-time-frequency-expected.txt: * fast/css/calc-with-angle-time-frequency.html: * fast/css/column-width-calculated-value-expected.txt: * fast/css/column-width-calculated-value.html: * fast/css/turn-angle-double-expected.txt: * fast/css/turn-angle-double.html: * fast/shapes/parsing/parsing-shape-outside-expected.txt: * fast/shapes/parsing/parsing-test-utils.js: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@253079 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit is a cross-platform web browser engine. On iOS and macOS, it powers Safari, Mail, iBooks, and many other applications.
Visit WebKit Feature Status page to see which Web API has been implemented, in development, or under consideration.
On macOS, download Safari Technology Preview to test the latest version of WebKit. On Linux, download Epiphany Technology Preview. On Windows, you'll have to build it yourself.
Once your bug is filed, you will receive email when it is updated at each stage in the bug life cycle. After the bug is considered fixed, you may be asked to download the latest nightly and confirm that the fix works for you.
On Windows, follow the instructions on our website.
Run the following command to clone WebKit's Git SVN repository:
git clone git://git.webkit.org/WebKit.git WebKit
or
git clone https://git.webkit.org/git/WebKit.git WebKit
If you want to be able to commit changes to the repository, or just want to check out branches that aren’t contained in WebKit.git, you will need track WebKit's Subversion repository. You can run the following command to configure this and other options of the new Git clone for WebKit development.
Tools/Scripts/webkit-patch setup-git-clone
For information about this, and other aspects of using Git with WebKit, read the wiki page.
If you don‘t want to use Git, run the following command to check out WebKit’s Subversion repository:
svn checkout https://svn.webkit.org/repository/webkit/trunk WebKit
Install Xcode and its command line tools if you haven't done so already:
xcode-select --install
Run the following command to build a debug build with debugging symbols and assertions:
Tools/Scripts/build-webkit --debug
For performance testing, and other purposes, use --release
instead.
You can open WebKit.xcworkspace
to build and debug WebKit within Xcode.
If you don't use a custom build location in Xcode preferences, you have to update the workspace settings to use WebKitBuild
directory. In menu bar, choose File > Workspace Settings, then click the Advanced button, select “Custom”, “Relative to Workspace”, and enter WebKitBuild
for both Products and Intermediates.
The first time after you install a new Xcode, you will need to run the following command to enable Xcode to build command line tools for iOS Simulator:
sudo Tools/Scripts/configure-xcode-for-ios-development
Without this step, you will see the error message: “target specifies product type ‘com.apple.product-type.tool’, but there’s no such product type for the ‘iphonesimulator’ platform.
” when building target JSCLLIntOffsetsExtractor
of project JavaScriptCore
.
Run the following command to build a debug build with debugging symbols and assertions for iOS:
Tools/Scripts/build-webkit --debug --ios-simulator
For production builds:
cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/gtk/install-dependencies Tools/Scripts/update-webkitgtk-libs Tools/Scripts/build-webkit --gtk --debug
For more information on building WebKitGTK+, see the wiki page.
For production builds:
cmake -DPORT=WPE -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/wpe/install-dependencies Tools/Scripts/update-webkitwpe-libs Tools/Scripts/build-webkit --wpe --debug
For building WebKit on Windows, see the wiki page.
Run the following command to launch Safari with your local build of WebKit:
Tools/Scripts/run-safari --debug
The run-safari
script sets the DYLD_FRAMEWORK_PATH
environment variable to point to your build products, and then launches /Applications/Safari.app
. DYLD_FRAMEWORK_PATH
tells the system loader to prefer your build products over the frameworks installed in /System/Library/Frameworks
.
To run other applications with your local build of WebKit, run the following command:
Tools/Scripts/run-webkit-app <application-path>
Run the following command to launch iOS simulator with your local build of WebKit:
run-safari --debug --ios-simulator
In both cases, if you have built release builds instead, use --release
instead of --debug
.
If you have a development build, you can use the run-minibrowser script, e.g.:
run-minibrowser --debug --wpe
Pass one of --gtk
, --jsc-only
, or --wpe
to indicate the port to use.
Congratulations! You’re up and running. Now you can begin coding in WebKit and contribute your fixes and new features to the project. For details on submitting your code to the project, read Contributing Code.