commit | 3bc0e5036665b1d4e0768e1a240d8b738b883a37 | [log] [tgz] |
---|---|---|
author | hyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Wed Jan 24 22:52:56 2018 +0000 |
committer | hyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Wed Jan 24 22:52:56 2018 +0000 |
tree | 848e728def51a143d43eeb2d7aca516b8d2ea892 | |
parent | c2600c1d009bd0c42409e1b215c2d981116183e1 [diff] |
Implement line clamp for mail. https://bugs.webkit.org/show_bug.cgi?id=180818 Reviewed by Dean Jackson. Source/WebCore: This patch implements a form of clamping that can clamp lines at both the top and the bottom, and the interior can be replaced with a DOM element (identified by id) that replaces the middle section. The implementation derives from the multicolumn classes, but ultimately the clamp should derive from the fragmentset classes instead (with most of the current multicolumn code moving into base classes). The virtualization of many of the multicolumn functions is something that would happen once we move pages/printing over to this pagination model anyway. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: Add the new clamp classes. * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/CSSProperties.json: * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueWebkitLinesClamp): * css/parser/CSSParser.cpp: (WebCore::CSSParserContext::CSSParserContext): * css/parser/CSSParserMode.h: (WebCore::CSSParserContextHash::hash): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeLinesClamp): (WebCore::CSSPropertyParser::parseSingleValue): Implement the new CSS property, webkit-lines-clamp. This is only exposed if a preference is set, so it is not exposed to the Web. * page/Settings.yaml: Add a new setting to control allowing access to the new CSS property. * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::willCreateColumns const): Make sure columns are created when lines clamp is set. (WebCore::getHeightForLineCount): (WebCore::RenderBlockFlow::logicalHeightForLineCount): (WebCore::RenderBlockFlow::logicalHeightExcludingLineCount): (WebCore::RenderBlockFlow::layoutExcludedChildren): (WebCore::RenderBlockFlow::heightForLineCount): Deleted. * rendering/RenderBlockFlow.h: Re-use the same clamping logic as the old line clamp code, but modernize it to work with writing modes and to be able to go backwards from the end of the block. * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp): The line count method got renamed to have the word "logical" in it, since it now works with vertical writing. * rendering/RenderFragmentContainer.cpp: (WebCore::RenderFragmentContainer::pageLogicalHeightForOffset const): * rendering/RenderFragmentContainer.h: Since line clamp sets have variable page heights, this new method takes the offset as an argument so that it can return the appropriate page for the given offset. This method will eventually be used by printing/page sets as well, since pages can have variable heights. * rendering/RenderFragmentedFlow.cpp: (WebCore::RenderFragmentedFlow::validateFragments): (WebCore::RenderFragmentedFlow::pageLogicalHeightForOffset const): (WebCore::RenderFragmentedFlow::pageRemainingLogicalHeightForOffset const): * rendering/RenderFragmentedFlow.h: Support for variable page heights in a fragment set. * rendering/RenderLinesClampFlow.cpp: Added. (WebCore::RenderLinesClampFlow::RenderLinesClampFlow): (WebCore::RenderLinesClampFlow::renderName const): (WebCore::RenderLinesClampFlow::layout): (WebCore::RenderLinesClampFlow::createMultiColumnSet): (WebCore::RenderLinesClampFlow::isChildAllowedInFragmentedFlow const): (WebCore::RenderLinesClampFlow::layoutFlowExcludedObjects): * rendering/RenderLinesClampFlow.h: Added. * rendering/RenderLinesClampSet.cpp: Added. (WebCore::RenderLinesClampSet::RenderLinesClampSet): (WebCore::RenderLinesClampSet::recalculateColumnHeight): (WebCore::RenderLinesClampSet::computeLogicalHeight const): (WebCore::RenderLinesClampSet::columnCount const): (WebCore::RenderLinesClampSet::columnRectAt const): (WebCore::RenderLinesClampSet::columnIndexAtOffset const): (WebCore::RenderLinesClampSet::pageLogicalTopForOffset const): (WebCore::RenderLinesClampSet::pageLogicalHeightForOffset const): (WebCore::RenderLinesClampSet::fragmentedFlowPortionRectAt const): (WebCore::RenderLinesClampSet::fragmentedFlowPortionOverflowRect): (WebCore::RenderLinesClampSet::customBlockProgressionAdjustmentForColumn const): (WebCore::RenderLinesClampSet::renderName const): * rendering/RenderLinesClampSet.h: Added. The new classes. They subclass all the methods necessary to do multi-pass layout, and to determine the page heights of each section. * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::isColumnSpanningDescendant const): (WebCore::isValidColumnSpanner): (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant): (WebCore::RenderMultiColumnFlow::createMultiColumnSet): * rendering/RenderMultiColumnFlow.h: * rendering/RenderMultiColumnSet.cpp: (WebCore::RenderMultiColumnSet::collectLayerFragments): (WebCore::RenderMultiColumnSet::columnTranslationForOffset const): * rendering/RenderMultiColumnSet.h: (WebCore::RenderMultiColumnSet::skipLayerFragmentCollectionForColumn const): (WebCore::RenderMultiColumnSet::customBlockProgressionAdjustmentForColumn const): Virtualized methods so that lines clamp can subclass and change behavior. * rendering/RenderObject.h: (WebCore::RenderObject::isRenderLinesClampFlow const): (WebCore::RenderObject::isRenderLinesClampSet const): Add new functions for type checking. * rendering/RenderRubyText.cpp: Include adjustment. * rendering/style/LineClampValue.h: (WebCore::LinesClampValue::LinesClampValue): (WebCore::LinesClampValue::isNone const): (WebCore::LinesClampValue::operator== const): (WebCore::LinesClampValue::operator!= const): (WebCore::LinesClampValue::start const): (WebCore::LinesClampValue::end const): (WebCore::LinesClampValue::center const): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::linesClamp const): (WebCore::RenderStyle::hasLinesClamp const): (WebCore::RenderStyle::setLinesClamp): (WebCore::RenderStyle::initialLinesClamp): (WebCore::RenderStyle::hasInlineColumnAxis const): * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): (WebCore::StyleRareNonInheritedData::operator== const): * rendering/style/StyleRareNonInheritedData.h: The front end style implementation of the new property. * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow): Make sure to build the correct renderer when lines clamp is set. LayoutTests: Added parsing tests, basic and advanced clamping examples, and vertical writing tests. Revised an iOS clamp test to account for a slight change in rendering caused by altering clamping to be consistent with the pagination model of breaking beteween lines. * fast/block/lines-clamp-advanced-expected.html: Added. * fast/block/lines-clamp-advanced-rl-expected.html: Added. * fast/block/lines-clamp-advanced-rl.html: Added. * fast/block/lines-clamp-advanced.html: Added. * fast/block/lines-clamp-basic-expected.html: Added. * fast/block/lines-clamp-basic-rl-expected.html: Added. * fast/block/lines-clamp-basic-rl.html: Added. * fast/block/lines-clamp-basic.html: Added. * fast/css/lines-clamp-parsing-expected.txt: Added. * fast/css/lines-clamp-parsing.html: Added. * platform/ios-simulator-wk2/fast/overflow: Added. * platform/ios-simulator-wk2/fast/overflow/line-clamp-expected.txt: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@227577 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.
Downloading Safari Technology Preview to test the latest version of WebKit.
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
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.
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 WebKit.
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.
Install the dependencies by running the following command:
Tools/gtk/install-dependencies
Then run the following command to build additional dependencies:
Tools/Scripts/update-webkitgtk-libs
Run the following command to build WebKit with debugging symbols for GTK+ port:
Tools/Scripts/build-webkit --debug --gtk
Note that the procedure for building a release tarball is different. For more information, see the wiki page.
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
.
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.