Changeset 137930 in webkit
- Timestamp:
- Dec 17, 2012 12:07:57 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 11 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r137928 r137930 1 2012-12-17 Bem Jones-Bey <bjonesbe@adobe.com> 2 3 [CSS Exclusions] shape-outside on floats for rectangle shapes height/width 4 https://bugs.webkit.org/show_bug.cgi?id=100398 5 6 Reviewed by Julien Chaffraix. 7 8 Tests for the basic shape outside functionality to show how the shape affects inline text and other floats. 9 Also test using percentages to specify the shape and that margins are properly ignored (per the spec), when a 10 shape is applied to a float. 11 12 * fast/exclusions/shape-outside-floats/shape-outside-floats-margin-is-ignored-expected.html: Added. 13 * fast/exclusions/shape-outside-floats/shape-outside-floats-margin-is-ignored.html: Added. 14 * fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle-expected.html: Added. 15 * fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle-horizontal-multiple-expected.html: Added. 16 * fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle-horizontal-multiple.html: Added. 17 * fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle-percentage-expected.html: Added. 18 * fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle-percentage.html: Added. 19 * fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle.html: Added. 20 1 21 2012-12-17 John J. Barton <johnjbarton@chromium.org> 2 22 -
trunk/Source/WebCore/CMakeLists.txt
r137795 r137930 2086 2086 rendering/ExclusionShape.cpp 2087 2087 rendering/ExclusionShapeInsideInfo.cpp 2088 rendering/ExclusionShapeOutsideInfo.cpp 2088 2089 rendering/FilterEffectRenderer.cpp 2089 2090 rendering/FixedTableLayout.cpp -
trunk/Source/WebCore/ChangeLog
r137928 r137930 1 2012-12-17 Bem Jones-Bey <bjonesbe@adobe.com> 2 3 [CSS Exclusions] shape-outside on floats for rectangle shapes height/width 4 https://bugs.webkit.org/show_bug.cgi?id=100398 5 6 Reviewed by Julien Chaffraix. 7 8 Implement shape outside for floats changing only the height and width 9 as a simple starting point. 10 11 This implementation changes floats to use the bounding box of the 12 shape outside instead of the margin box for layout. The content box of 13 the float is unchanged. This patch does not support positioning the 14 shape outside box, so the x and y parameters are currently ignored in 15 the specified shape. This will be fixed in a patch for bug 100399. 16 17 Tests: fast/exclusions/shape-outside-floats/shape-outside-floats-margin-is-ignored.html 18 fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle-horizontal-multiple.html 19 fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle-percentage.html 20 fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle.html 21 22 * CMakeLists.txt: Add ExclusionShapeOutsideInfo.{cpp,h}. 23 * GNUmakefile.list.am: Add ExclusionShapeOutsideInfo.{cpp,h}. 24 * Target.pri: Add ExclusionShapeOutsideInfo.{cpp,h}. 25 * WebCore.gypi: Add ExclusionShapeOutsideInfo.{cpp,h}. 26 * WebCore.vcproj/WebCore.vcproj: Add ExclusionShapeOutsideInfo.{cpp,h}. 27 * WebCore.xcodeproj/project.pbxproj: Add ExclusionShapeOutsideInfo.{cpp,h}. 28 * rendering/ExclusionShapeOutsideInfo.cpp: Added. Associates the 29 ExclusionShape object for shape outside with a RenderBox. Analagous to 30 ExclusionShapeInsideInfo. 31 (WebCore::exclusionShapeOutsideInfoMap): 32 (WebCore::ExclusionShapeOutsideInfo::ExclusionShapeOutsideInfo): 33 (WebCore::ExclusionShapeOutsideInfo::~ExclusionShapeOutsideInfo): 34 (WebCore::ExclusionShapeOutsideInfo::ensureInfoForRenderBox): 35 (WebCore::ExclusionShapeOutsideInfo::infoForRenderBox): 36 (WebCore::ExclusionShapeOutsideInfo::isInfoEnabledForRenderBox): 37 (WebCore::ExclusionShapeOutsideInfo::removeInfoForRenderBox): 38 (WebCore::ExclusionShapeOutsideInfo::computedShape): 39 * rendering/ExclusionShapeOutsideInfo.h: Added. Associates the 40 ExclusionShape object for shape outside with a RenderBox. Analagous to 41 ExclusionShapeInsideInfo. 42 (ExclusionShapeOutsideInfo): 43 (WebCore::ExclusionShapeOutsideInfo::create): 44 (WebCore::ExclusionShapeOutsideInfo::shapeLogicalLeft): 45 (WebCore::ExclusionShapeOutsideInfo::shapeLogicalRight): 46 (WebCore::ExclusionShapeOutsideInfo::shapeLogicalTop): 47 (WebCore::ExclusionShapeOutsideInfo::shapeLogicalBottom): 48 (WebCore::ExclusionShapeOutsideInfo::shapeLogicalWidth): 49 (WebCore::ExclusionShapeOutsideInfo::shapeLogicalHeight): 50 (WebCore::ExclusionShapeOutsideInfo::setShapeSize): 51 (WebCore::ExclusionShapeOutsideInfo::dirtyShapeSize): 52 * rendering/RenderBlock.cpp: 53 (WebCore::RenderBlock::insertFloatingObject): Use the shape outside's bounding box to set the width that is 54 used for inline layout for the float and it's siblings. 55 (WebCore::RenderBlock::positionNewFloats): Use the shape outside's bounding box to set the height that 56 is used for inline layout for the float and it's siblings. Ignore margins when positioning if the float 57 has shape outside, per the exclusions spec. 58 * rendering/RenderBox.cpp: 59 (WebCore::RenderBox::willBeDestroyed): Clean up associated ExclusionShape. 60 (WebCore::RenderBox::styleDidChange): Handle style change for shape outside. 61 (WebCore::RenderBox::updateExclusionShapeOutsideInfoAfterStyleChange): Handle style change for shape outside. 62 * rendering/RenderBox.h: 63 (WebCore::RenderBox::exclusionShapeOutsideInfo): Get the ExclusionShapeOutsideInfo associated with this 64 RenderBox. 65 1 66 2012-12-17 John J. Barton <johnjbarton@chromium.org> 2 67 -
trunk/Source/WebCore/GNUmakefile.list.am
r137839 r137930 4244 4244 Source/WebCore/rendering/ExclusionShapeInsideInfo.cpp \ 4245 4245 Source/WebCore/rendering/ExclusionShapeInsideInfo.h \ 4246 Source/WebCore/rendering/ExclusionShapeOutsideInfo.cpp \ 4247 Source/WebCore/rendering/ExclusionShapeOutsideInfo.h \ 4246 4248 Source/WebCore/rendering/FilterEffectRenderer.cpp \ 4247 4249 Source/WebCore/rendering/FilterEffectRenderer.h \ -
trunk/Source/WebCore/Target.pri
r137795 r137930 1129 1129 rendering/ExclusionShape.cpp \ 1130 1130 rendering/ExclusionShapeInsideInfo.cpp \ 1131 rendering/ExclusionShapeOutsideInfo.cpp \ 1131 1132 rendering/FilterEffectRenderer.cpp \ 1132 1133 rendering/FixedTableLayout.cpp \ … … 2367 2368 rendering/ExclusionShape.h \ 2368 2369 rendering/ExclusionShapeInsideInfo.h \ 2370 rendering/ExclusionShapeOutsideInfo.h \ 2369 2371 rendering/FilterEffectRenderer.h \ 2370 2372 rendering/FixedTableLayout.h \ -
trunk/Source/WebCore/WebCore.gypi
r137795 r137930 2246 2246 'rendering/ExclusionShapeInsideInfo.cpp', 2247 2247 'rendering/ExclusionShapeInsideInfo.h', 2248 'rendering/ExclusionShapeOutsideInfo.cpp', 2249 'rendering/ExclusionShapeOutsideInfo.h', 2248 2250 'rendering/FilterEffectRenderer.cpp', 2249 2251 'rendering/FilterEffectRenderer.h', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r137795 r137930 38575 38575 </File> 38576 38576 <File 38577 RelativePath="..\rendering\ExclusionShapeOutsideInfo.cpp" 38578 > 38579 </File> 38580 <File 38581 RelativePath="..\rendering\ExclusionShapeOutsideInfo.h" 38582 > 38583 </File> 38584 <File 38577 38585 RelativePath="..\rendering\FilterEffectRenderer.cpp" 38578 38586 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r137876 r137930 3759 3759 98EB1F951313FE0500D0E1EA /* NotImplemented.h in Headers */ = {isa = PBXBuildFile; fileRef = 98EB1F941313FE0500D0E1EA /* NotImplemented.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3760 3760 9A1B6F97158869C80011A8C4 /* JSDOMStringListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A1B6F96158869C80011A8C4 /* JSDOMStringListCustom.cpp */; }; 3761 9A9CEF8D163B3EA100DE7EFE /* ExclusionShapeOutsideInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9CEF8B163B3EA100DE7EFE /* ExclusionShapeOutsideInfo.cpp */; }; 3762 9A9CEF8E163B3EA100DE7EFE /* ExclusionShapeOutsideInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A9CEF8C163B3EA100DE7EFE /* ExclusionShapeOutsideInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3761 3763 9B0FB191140DB5790022588F /* HTTPValidation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B0FB18F140DB5790022588F /* HTTPValidation.cpp */; }; 3762 3764 9B0FB192140DB5790022588F /* HTTPValidation.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B0FB190140DB5790022588F /* HTTPValidation.h */; }; … … 11093 11095 98EB1F941313FE0500D0E1EA /* NotImplemented.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotImplemented.h; sourceTree = "<group>"; }; 11094 11096 9A1B6F96158869C80011A8C4 /* JSDOMStringListCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMStringListCustom.cpp; sourceTree = "<group>"; }; 11097 9A9CEF8B163B3EA100DE7EFE /* ExclusionShapeOutsideInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExclusionShapeOutsideInfo.cpp; sourceTree = "<group>"; }; 11098 9A9CEF8C163B3EA100DE7EFE /* ExclusionShapeOutsideInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExclusionShapeOutsideInfo.h; sourceTree = "<group>"; }; 11095 11099 9B0FB18F140DB5790022588F /* HTTPValidation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPValidation.cpp; sourceTree = "<group>"; }; 11096 11100 9B0FB190140DB5790022588F /* HTTPValidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPValidation.h; sourceTree = "<group>"; }; … … 21657 21661 FD748ABD15BF74ED0059CF0D /* ExclusionShapeInsideInfo.cpp */, 21658 21662 FD748ABE15BF74ED0059CF0D /* ExclusionShapeInsideInfo.h */, 21663 9A9CEF8B163B3EA100DE7EFE /* ExclusionShapeOutsideInfo.cpp */, 21664 9A9CEF8C163B3EA100DE7EFE /* ExclusionShapeOutsideInfo.h */, 21659 21665 31313F631443B35E006E2A90 /* FilterEffectRenderer.cpp */, 21660 21666 31313F641443B35E006E2A90 /* FilterEffectRenderer.h */, … … 22618 22624 41E1B1D10FF5986900576B3B /* AbstractWorker.h in Headers */, 22619 22625 29A8122E0FBB9C1D00510293 /* AccessibilityARIAGridCell.h in Headers */, 22626 9A9CEF8E163B3EA100DE7EFE /* ExclusionShapeOutsideInfo.h in Headers */, 22620 22627 29A812330FBB9C1D00510293 /* AccessibilityARIAGridRow.h in Headers */, 22621 22628 29A8123B0FBB9C1D00510293 /* AccessibilityImageMapLink.h in Headers */, … … 29068 29075 F37A56221679CF7B00C57046 /* HeapGraphSerializer.cpp in Sources */, 29069 29076 CD1E7347167BC78E009A885D /* TextTrackRepresentation.cpp in Sources */, 29077 9A9CEF8D163B3EA100DE7EFE /* ExclusionShapeOutsideInfo.cpp in Sources */, 29070 29078 ); 29071 29079 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r137920 r137930 66 66 #if ENABLE(CSS_EXCLUSIONS) 67 67 #include "ExclusionShapeInsideInfo.h" 68 #include "ExclusionShapeOutsideInfo.h" 68 69 #endif 69 70 #include <wtf/MemoryInstrumentationHashMap.h> … … 3750 3751 o->computeAndSetBlockDirectionMargins(this); 3751 3752 } 3752 setLogicalWidthForFloat(newObj, logicalWidthForChild(o) + marginStartForChild(o) + marginEndForChild(o)); 3753 3754 #if ENABLE(CSS_EXCLUSIONS) 3755 ExclusionShapeOutsideInfo* shapeOutside = o->exclusionShapeOutsideInfo(); 3756 if (shapeOutside) { 3757 shapeOutside->setShapeSize(o->logicalWidth(), o->logicalHeight()); 3758 // The CSS Exclusions specification says that the margins are ignored 3759 // when a float has a shape outside. 3760 setLogicalWidthForFloat(newObj, shapeOutside->shapeLogicalWidth()); 3761 } else 3762 #endif 3763 setLogicalWidthForFloat(newObj, logicalWidthForChild(o) + marginStartForChild(o) + marginEndForChild(o)); 3753 3764 3754 3765 newObj->setShouldPaint(!o->hasSelfPaintingLayer()); // If a layer exists, the float will paint itself. Otherwise someone else will. … … 3936 3947 3937 3948 setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); 3938 setLogicalLeftForChild(childBox, floatLogicalLocation.x() + childLogicalLeftMargin); 3939 setLogicalTopForChild(childBox, floatLogicalLocation.y() + marginBeforeForChild(childBox)); 3949 3950 bool hasShapeOutside = false; 3951 #if ENABLE(CSS_EXCLUSIONS) 3952 hasShapeOutside = floatingObject->renderer()->exclusionShapeOutsideInfo(); 3953 #endif 3954 // The CSS Exclusions specification says that the margins are ignored when a float has a shape outside. 3955 setLogicalLeftForChild(childBox, floatLogicalLocation.x() + (hasShapeOutside ? LayoutUnit() : childLogicalLeftMargin)); 3956 setLogicalTopForChild(childBox, floatLogicalLocation.y() + (hasShapeOutside ? LayoutUnit() : marginBeforeForChild(childBox))); 3940 3957 3941 3958 LayoutState* layoutState = view()->layoutState(); … … 3965 3982 floatLogicalLocation = computeLogicalLocationForFloat(floatingObject, newLogicalTop); 3966 3983 setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); 3967 setLogicalLeftForChild(childBox, floatLogicalLocation.x() + childLogicalLeftMargin); 3968 setLogicalTopForChild(childBox, floatLogicalLocation.y() + marginBeforeForChild(childBox)); 3984 3985 // The CSS Exclusions specification says that the margins are ignored when a float has a shape outside. 3986 setLogicalLeftForChild(childBox, floatLogicalLocation.x() + (hasShapeOutside ? LayoutUnit() : childLogicalLeftMargin)); 3987 setLogicalTopForChild(childBox, floatLogicalLocation.y() + (hasShapeOutside ? LayoutUnit() : marginBeforeForChild(childBox))); 3969 3988 3970 3989 if (childBlock) … … 3975 3994 3976 3995 setLogicalTopForFloat(floatingObject, floatLogicalLocation.y()); 3977 setLogicalHeightForFloat(floatingObject, logicalHeightForChild(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox)); 3996 #if ENABLE(CSS_EXCLUSIONS) 3997 if (hasShapeOutside) 3998 setLogicalHeightForFloat(floatingObject, floatingObject->renderer()->exclusionShapeOutsideInfo()->shapeLogicalHeight()); 3999 else 4000 #endif 4001 setLogicalHeightForFloat(floatingObject, logicalHeightForChild(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox)); 3978 4002 3979 4003 m_floatingObjects->addPlacedObject(floatingObject); -
trunk/Source/WebCore/rendering/RenderBox.cpp
r137847 r137930 151 151 RenderBlock::removePercentHeightDescendantIfNeeded(this); 152 152 153 #if ENABLE(CSS_EXCLUSIONS) 154 ExclusionShapeOutsideInfo::removeInfoForRenderBox(this); 155 #endif 156 153 157 RenderBoxModelObject::willBeDestroyed(); 154 158 } … … 283 287 frame()->view()->recalculateScrollbarOverlayStyle(); 284 288 } 285 } 289 290 #if ENABLE(CSS_EXCLUSIONS) 291 updateExclusionShapeOutsideInfoAfterStyleChange(style()->shapeOutside(), oldStyle ? oldStyle->shapeOutside() : 0); 292 #endif 293 } 294 295 #if ENABLE(CSS_EXCLUSIONS) 296 void RenderBox::updateExclusionShapeOutsideInfoAfterStyleChange(const ExclusionShapeValue* shapeOutside, const ExclusionShapeValue* oldShapeOutside) 297 { 298 // FIXME: A future optimization would do a deep comparison for equality. (bug 100811) 299 if (shapeOutside == oldShapeOutside) 300 return; 301 302 if (shapeOutside) { 303 ExclusionShapeOutsideInfo* exclusionShapeOutsideInfo = ExclusionShapeOutsideInfo::ensureInfoForRenderBox(this); 304 exclusionShapeOutsideInfo->dirtyShapeSize(); 305 } else 306 ExclusionShapeOutsideInfo::removeInfoForRenderBox(this); 307 } 308 #endif 286 309 287 310 void RenderBox::updateFromStyle() -
trunk/Source/WebCore/rendering/RenderBox.h
r137847 r137930 27 27 #include "RenderOverflow.h" 28 28 #include "ScrollTypes.h" 29 #if ENABLE(CSS_EXCLUSIONS) 30 #include "ExclusionShapeOutsideInfo.h" 31 #endif 29 32 30 33 namespace WebCore { … … 572 575 static void reportStaticMembersMemoryUsage(MemoryInstrumentation*); 573 576 577 #if ENABLE(CSS_EXCLUSIONS) 578 ExclusionShapeOutsideInfo* exclusionShapeOutsideInfo() const 579 { 580 return style()->shapeOutside() && ExclusionShapeOutsideInfo::isInfoEnabledForRenderBox(this) ? ExclusionShapeOutsideInfo::infoForRenderBox(this) : 0; 581 } 582 #endif 583 574 584 protected: 575 585 virtual void willBeDestroyed(); … … 607 617 608 618 private: 619 #if ENABLE(CSS_EXCLUSIONS) 620 void updateExclusionShapeOutsideInfoAfterStyleChange(const ExclusionShapeValue* shapeOutside, const ExclusionShapeValue* oldShapeOutside); 621 #endif 622 609 623 bool fixedElementLaysOutRelativeToFrame(Frame*, FrameView*) const; 610 624
Note: See TracChangeset
for help on using the changeset viewer.