Changeset 117832 in webkit
- Timestamp:
- May 21, 2012 4:42:54 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r117795 r117832 1114 1114 platform/Language.cpp 1115 1115 platform/Length.cpp 1116 platform/LengthBox.cpp 1116 1117 platform/LinkHash.cpp 1117 1118 platform/Logging.cpp -
trunk/Source/WebCore/ChangeLog
r117826 r117832 1 2012-05-21 Emil A Eklund <eae@chromium.org> 2 3 Move padding/margin/offset writing mode logic from RenderStyle to LengthBox 4 https://bugs.webkit.org/show_bug.cgi?id=86970 5 6 Reviewed by Eric Seidel. 7 8 Move writing mode and bidi logic for paddings, margins and offsets from 9 RenderStyle to LengthBox. This way the same logic can be used for all 10 three removing unnecessary code duplication. 11 12 No new tests, no change in functionality. 13 14 * CMakeLists.txt: 15 * GNUmakefile.list.am: 16 * Target.pri: 17 * WebCore.gypi: 18 * WebCore.vcproj/WebCore.vcproj: 19 * WebCore.xcodeproj/project.pbxproj: 20 * platform/LengthBox.cpp: Added. 21 * platform/LengthBox.h: 22 * rendering/style/RenderStyle.cpp: 23 * rendering/style/RenderStyle.h: 24 1 25 2012-05-21 Mike West <mkwst@chromium.org> 2 26 -
trunk/Source/WebCore/GNUmakefile.list.am
r117612 r117832 3384 3384 Source/WebCore/platform/Language.cpp \ 3385 3385 Source/WebCore/platform/Language.h \ 3386 Source/WebCore/platform/LengthBox.cpp \ 3386 3387 Source/WebCore/platform/LengthBox.h \ 3387 3388 Source/WebCore/platform/Length.cpp \ -
trunk/Source/WebCore/Target.pri
r117420 r117832 1144 1144 platform/Language.cpp \ 1145 1145 platform/Length.cpp \ 1146 platform/LengthBox.cpp \ 1146 1147 platform/text/LineEnding.cpp \ 1147 1148 platform/leveldb/LevelDBDatabase.cpp \ -
trunk/Source/WebCore/WebCore.gypi
r117750 r117832 3160 3160 'platform/Language.cpp', 3161 3161 'platform/Length.cpp', 3162 'platform/LengthBox.cpp', 3162 3163 'platform/LinkHash.cpp', 3163 3164 'platform/Logging.cpp', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r117750 r117832 27847 27847 </File> 27848 27848 <File 27849 RelativePath="..\platform\LengthBox.cpp" 27850 > 27851 </File> 27852 <File 27849 27853 RelativePath="..\platform\LengthBox.h" 27850 27854 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r117738 r117832 300 300 144FCFE114EF2509000D17A3 /* FractionalLayoutRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 144FCFDF14EF2509000D17A3 /* FractionalLayoutRect.h */; settings = {ATTRIBUTES = (Private, ); }; }; 301 301 1464E06C135EC10600FDB00A /* JSMediaListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1464E06B135EC10600FDB00A /* JSMediaListCustom.cpp */; }; 302 146CC115156988E400109E37 /* LengthBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 146CC113156988BD00109E37 /* LengthBox.cpp */; }; 302 303 1477E7760BF4134A00152872 /* PageCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1477E7740BF4134A00152872 /* PageCache.cpp */; }; 303 304 1477E7770BF4134A00152872 /* PageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 1477E7750BF4134A00152872 /* PageCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 7185 7186 144FCFDF14EF2509000D17A3 /* FractionalLayoutRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FractionalLayoutRect.h; sourceTree = "<group>"; }; 7186 7187 1464E06B135EC10600FDB00A /* JSMediaListCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaListCustom.cpp; sourceTree = "<group>"; }; 7188 146CC113156988BD00109E37 /* LengthBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LengthBox.cpp; sourceTree = "<group>"; }; 7187 7189 1477E7740BF4134A00152872 /* PageCache.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PageCache.cpp; sourceTree = "<group>"; }; 7188 7190 1477E7750BF4134A00152872 /* PageCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PageCache.h; sourceTree = "<group>"; }; … … 20329 20331 BCE65BE80EACDF16007E4533 /* Length.cpp */, 20330 20332 BCE65BE90EACDF16007E4533 /* Length.h */, 20333 146CC113156988BD00109E37 /* LengthBox.cpp */, 20331 20334 BCFF648F0EAD15C200C1D6F7 /* LengthBox.h */, 20332 20335 BCFF64900EAD15C200C1D6F7 /* LengthSize.h */, … … 27938 27941 FDB052DF1561A42C00B500D6 /* AudioSummingJunction.cpp in Sources */, 27939 27942 371941961566B37200A276D8 /* WebCoreNSCellExtras.m in Sources */, 27943 146CC115156988E400109E37 /* LengthBox.cpp in Sources */, 27940 27944 ); 27941 27945 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebCore/platform/LengthBox.h
r61295 r117832 2 2 Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 3 Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 4 Copyright (c) 2012, Google Inc. All rights reserved. 4 5 5 6 This library is free software; you can redistribute it and/or … … 25 26 26 27 namespace WebCore { 28 29 class RenderStyle; 27 30 28 31 struct LengthBox { … … 68 71 Length bottom() const { return m_bottom; } 69 72 73 Length logicalLeft(const RenderStyle*) const; 74 Length logicalRight(const RenderStyle*) const; 75 76 Length before(const RenderStyle*) const; 77 Length after(const RenderStyle*) const; 78 Length start(const RenderStyle*) const; 79 Length end(const RenderStyle*) const; 80 70 81 bool operator==(const LengthBox& o) const 71 82 { -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r117613 r117832 1413 1413 return isLeftToRightDirection() ? borderBottomWidth() : borderTopWidth(); 1414 1414 } 1415 1416 Length RenderStyle::marginBefore() const1417 {1418 switch (writingMode()) {1419 case TopToBottomWritingMode:1420 return marginTop();1421 case BottomToTopWritingMode:1422 return marginBottom();1423 case LeftToRightWritingMode:1424 return marginLeft();1425 case RightToLeftWritingMode:1426 return marginRight();1427 }1428 ASSERT_NOT_REACHED();1429 return marginTop();1430 }1431 1432 Length RenderStyle::marginAfter() const1433 {1434 switch (writingMode()) {1435 case TopToBottomWritingMode:1436 return marginBottom();1437 case BottomToTopWritingMode:1438 return marginTop();1439 case LeftToRightWritingMode:1440 return marginRight();1441 case RightToLeftWritingMode:1442 return marginLeft();1443 }1444 ASSERT_NOT_REACHED();1445 return marginBottom();1446 }1447 1448 Length RenderStyle::marginBeforeUsing(const RenderStyle* otherStyle) const1449 {1450 switch (otherStyle->writingMode()) {1451 case TopToBottomWritingMode:1452 return marginTop();1453 case BottomToTopWritingMode:1454 return marginBottom();1455 case LeftToRightWritingMode:1456 return marginLeft();1457 case RightToLeftWritingMode:1458 return marginRight();1459 }1460 ASSERT_NOT_REACHED();1461 return marginTop();1462 }1463 1464 Length RenderStyle::marginAfterUsing(const RenderStyle* otherStyle) const1465 {1466 switch (otherStyle->writingMode()) {1467 case TopToBottomWritingMode:1468 return marginBottom();1469 case BottomToTopWritingMode:1470 return marginTop();1471 case LeftToRightWritingMode:1472 return marginRight();1473 case RightToLeftWritingMode:1474 return marginLeft();1475 }1476 ASSERT_NOT_REACHED();1477 return marginBottom();1478 }1479 1480 Length RenderStyle::marginStart() const1481 {1482 if (isHorizontalWritingMode())1483 return isLeftToRightDirection() ? marginLeft() : marginRight();1484 return isLeftToRightDirection() ? marginTop() : marginBottom();1485 }1486 1487 Length RenderStyle::marginEnd() const1488 {1489 if (isHorizontalWritingMode())1490 return isLeftToRightDirection() ? marginRight() : marginLeft();1491 return isLeftToRightDirection() ? marginBottom() : marginTop();1492 }1493 1494 Length RenderStyle::marginStartUsing(const RenderStyle* otherStyle) const1495 {1496 if (otherStyle->isHorizontalWritingMode())1497 return otherStyle->isLeftToRightDirection() ? marginLeft() : marginRight();1498 return otherStyle->isLeftToRightDirection() ? marginTop() : marginBottom();1499 }1500 1501 Length RenderStyle::marginEndUsing(const RenderStyle* otherStyle) const1502 {1503 if (otherStyle->isHorizontalWritingMode())1504 return otherStyle->isLeftToRightDirection() ? marginRight() : marginLeft();1505 return otherStyle->isLeftToRightDirection() ? marginBottom() : marginTop();1506 }1507 1415 1508 1416 void RenderStyle::setMarginStart(Length margin) … … 1536 1444 } 1537 1445 1538 Length RenderStyle::paddingBefore() const1539 {1540 switch (writingMode()) {1541 case TopToBottomWritingMode:1542 return paddingTop();1543 case BottomToTopWritingMode:1544 return paddingBottom();1545 case LeftToRightWritingMode:1546 return paddingLeft();1547 case RightToLeftWritingMode:1548 return paddingRight();1549 }1550 ASSERT_NOT_REACHED();1551 return paddingTop();1552 }1553 1554 Length RenderStyle::paddingAfter() const1555 {1556 switch (writingMode()) {1557 case TopToBottomWritingMode:1558 return paddingBottom();1559 case BottomToTopWritingMode:1560 return paddingTop();1561 case LeftToRightWritingMode:1562 return paddingRight();1563 case RightToLeftWritingMode:1564 return paddingLeft();1565 }1566 ASSERT_NOT_REACHED();1567 return paddingBottom();1568 }1569 1570 Length RenderStyle::paddingStart() const1571 {1572 if (isHorizontalWritingMode())1573 return isLeftToRightDirection() ? paddingLeft() : paddingRight();1574 return isLeftToRightDirection() ? paddingTop() : paddingBottom();1575 }1576 1577 Length RenderStyle::paddingEnd() const1578 {1579 if (isHorizontalWritingMode())1580 return isLeftToRightDirection() ? paddingRight() : paddingLeft();1581 return isLeftToRightDirection() ? paddingBottom() : paddingTop();1582 }1583 1584 1446 TextEmphasisMark RenderStyle::textEmphasisMark() const 1585 1447 { -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r117613 r117832 499 499 500 500 // Accessors for positioned object edges that take into account writing mode. 501 Length logicalLeft() const { return isHorizontalWritingMode() ? left() : top(); }502 Length logicalRight() const { return isHorizontalWritingMode() ? right() : bottom(); }503 Length logicalTop() const { return isHorizontalWritingMode() ? (isFlippedBlocksWritingMode() ? bottom() : top()) : (isFlippedBlocksWritingMode() ? right() : left()); }504 Length logicalBottom() const { return isHorizontalWritingMode() ? (isFlippedBlocksWritingMode() ? top() : bottom()) : (isFlippedBlocksWritingMode() ? left() : right()); }501 Length logicalLeft() const { return surround->offset.logicalLeft(this); } 502 Length logicalRight() const { return surround->offset.logicalRight(this); } 503 Length logicalTop() const { return surround->offset.before(this); } 504 Length logicalBottom() const { return surround->offset.after(this); } 505 505 506 506 // Whether or not a positioned element requires normal flow x/y to be computed … … 739 739 Length marginLeft() const { return surround->margin.left(); } 740 740 Length marginRight() const { return surround->margin.right(); } 741 Length marginBefore() const ;742 Length marginAfter() const ;743 Length marginStart() const ;744 Length marginEnd() const ;745 Length marginStartUsing(const RenderStyle* otherStyle) const ;746 Length marginEndUsing(const RenderStyle* otherStyle) const ;747 Length marginBeforeUsing(const RenderStyle* otherStyle) const ;748 Length marginAfterUsing(const RenderStyle* otherStyle) const ;741 Length marginBefore() const { return surround->margin.before(this); } 742 Length marginAfter() const { return surround->margin.after(this); } 743 Length marginStart() const { return surround->margin.start(this); } 744 Length marginEnd() const { return surround->margin.end(this); } 745 Length marginStartUsing(const RenderStyle* otherStyle) const { return surround->margin.start(otherStyle); } 746 Length marginEndUsing(const RenderStyle* otherStyle) const { return surround->margin.end(otherStyle); } 747 Length marginBeforeUsing(const RenderStyle* otherStyle) const { return surround->margin.before(otherStyle); } 748 Length marginAfterUsing(const RenderStyle* otherStyle) const { return surround->margin.after(otherStyle); } 749 749 750 750 LengthBox paddingBox() const { return surround->padding; } … … 753 753 Length paddingLeft() const { return surround->padding.left(); } 754 754 Length paddingRight() const { return surround->padding.right(); } 755 Length paddingBefore() const ;756 Length paddingAfter() const ;757 Length paddingStart() const ;758 Length paddingEnd() const ;755 Length paddingBefore() const { return surround->padding.before(this); } 756 Length paddingAfter() const { return surround->padding.after(this); } 757 Length paddingStart() const { return surround->padding.start(this); } 758 Length paddingEnd() const { return surround->padding.end(this); } 759 759 760 760 ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor_style); }
Note: See TracChangeset
for help on using the changeset viewer.