Changeset 92431 in webkit
- Timestamp:
- Aug 4, 2011, 4:56:24 PM (14 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r92430 r92431 1 2011-08-04 Van Lam <vanlam@google.com> 2 3 A few purely stylistic modifications to visible_units.cpp 4 https://bugs.webkit.org/show_bug.cgi?id=65723 5 6 Reviewed by Ryosuke Niwa. 7 8 Renamed greatestValueUnder to greatestOffsetUnder, positionIsInsideBox 9 to positionIsInBoxButNotOnBoundary (to avoid confusion with 10 positionIsInBox, which is just a getInlineBoxAndOffset check). 11 Removed use of invalidOffset as an error value in greatestOffsetUnder 12 and smallestOffsetAbove since semantically it should only be used to 13 check if it makes sense to compare offsets in a single box. 14 15 * editing/visible_units.cpp: 16 (WebCore::greatestOffsetUnder): 17 (WebCore::smallestOffsetAbove): 18 (WebCore::positionIsInBoxButNotOnBoundary): 19 (WebCore::leftWordPositionAcrossBoundary): 20 (WebCore::rightWordPositionAcrossBoundary): 21 1 22 2011-08-04 James Robinson <jamesr@chromium.org> 2 23 -
trunk/Source/WebCore/editing/visible_units.cpp
r92286 r92431 1445 1445 } 1446 1446 1447 static int greatest ValueUnder(int offset, bool boxAndBlockAreInSameDirection, const WordBoundaryVector& orderedWordBoundaries)1447 static int greatestOffsetUnder(int offset, bool boxAndBlockAreInSameDirection, const WordBoundaryVector& orderedWordBoundaries) 1448 1448 { 1449 1449 if (!orderedWordBoundaries.size()) 1450 return invalidOffset;1450 return -1; 1451 1451 // FIXME: binary search. 1452 1452 if (boxAndBlockAreInSameDirection) { … … 1455 1455 return i; 1456 1456 } 1457 return invalidOffset;1457 return -1; 1458 1458 } 1459 1459 for (int i = orderedWordBoundaries.size() - 1; i >= 0; --i) { … … 1461 1461 return i; 1462 1462 } 1463 return invalidOffset;1463 return -1; 1464 1464 } 1465 1465 … … 1467 1467 { 1468 1468 if (!orderedWordBoundaries.size()) 1469 return invalidOffset;1469 return -1; 1470 1470 // FIXME: binary search. 1471 1471 if (boxAndBlockAreInSameDirection) { … … 1474 1474 return i; 1475 1475 } 1476 return invalidOffset;1476 return -1; 1477 1477 } 1478 1478 for (unsigned i = 0; i < orderedWordBoundaries.size(); ++i) { … … 1480 1480 return i; 1481 1481 } 1482 return invalidOffset;1482 return -1; 1483 1483 } 1484 1484 … … 1600 1600 } 1601 1601 1602 static bool positionIsIn sideBox(const VisiblePosition& wordBreak, const InlineBox* box)1602 static bool positionIsInBoxButNotOnBoundary(const VisiblePosition& wordBreak, const InlineBox* box) 1603 1603 { 1604 1604 int offsetOfWordBreak; … … 1634 1634 wordBreak = nextBoundary(visiblePosition, nextWordPositionBoundary); 1635 1635 } 1636 if (wordBreak.isNotNull() && positionIsIn sideBox(wordBreak, box))1636 if (wordBreak.isNotNull() && positionIsInBoxButNotOnBoundary(wordBreak, box)) 1637 1637 return wordBreak; 1638 1638 … … 1640 1640 collectWordBreaksInBox(box, orderedWordBoundaries, blockDirection); 1641 1641 1642 int index = box->isLeftToRightDirection() ? greatest ValueUnder(offset, blockDirection == LTR, orderedWordBoundaries) :1643 smallestOffsetAbove(offset, blockDirection == RTL, orderedWordBoundaries);1644 if (index != invalidOffset)1642 int index = box->isLeftToRightDirection() ? greatestOffsetUnder(offset, blockDirection == LTR, orderedWordBoundaries) 1643 : smallestOffsetAbove(offset, blockDirection == RTL, orderedWordBoundaries); 1644 if (index >= 0) 1645 1645 return orderedWordBoundaries[index].visiblePosition; 1646 1646 … … 1671 1671 wordBreak = nextBoundary(visiblePosition, nextWordPositionBoundary); 1672 1672 } 1673 if (wordBreak.isNotNull() && positionIsIn sideBox(wordBreak, box))1673 if (wordBreak.isNotNull() && positionIsInBoxButNotOnBoundary(wordBreak, box)) 1674 1674 return wordBreak; 1675 1675 … … 1677 1677 collectWordBreaksInBox(box, orderedWordBoundaries, blockDirection); 1678 1678 1679 int index = box->isLeftToRightDirection() ? smallestOffsetAbove(offset, blockDirection == LTR, orderedWordBoundaries) :1680 greatestValueUnder(offset, blockDirection == RTL, orderedWordBoundaries);1681 if (index != invalidOffset)1679 int index = box->isLeftToRightDirection() ? smallestOffsetAbove(offset, blockDirection == LTR, orderedWordBoundaries) 1680 : greatestOffsetUnder(offset, blockDirection == RTL, orderedWordBoundaries); 1681 if (index >= 0) 1682 1682 return orderedWordBoundaries[index].visiblePosition; 1683 1683
Note:
See TracChangeset
for help on using the changeset viewer.