Title: [93834] trunk/Source/WebCore
- Revision
- 93834
- Author
- commit-qu...@webkit.org
- Date
- 2011-08-25 16:19:26 -0700 (Thu, 25 Aug 2011)
Log Message
Remove use of magic number -1 in WebCore/editing/visible_units.cpp
https://bugs.webkit.org/show_bug.cgi?id=66980
Patch by Van Lam <van...@google.com> on 2011-08-25
Reviewed by Ryosuke Niwa.
Replaced use of magic number -1 with constant offsetNotFound.
* editing/visible_units.cpp:
(WebCore::greatestOffsetUnder):
(WebCore::smallestOffsetAbove):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (93833 => 93834)
--- trunk/Source/WebCore/ChangeLog 2011-08-25 23:08:34 UTC (rev 93833)
+++ trunk/Source/WebCore/ChangeLog 2011-08-25 23:19:26 UTC (rev 93834)
@@ -1,3 +1,16 @@
+2011-08-25 Van Lam <van...@google.com>
+
+ Remove use of magic number -1 in WebCore/editing/visible_units.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=66980
+
+ Reviewed by Ryosuke Niwa.
+
+ Replaced use of magic number -1 with constant offsetNotFound.
+
+ * editing/visible_units.cpp:
+ (WebCore::greatestOffsetUnder):
+ (WebCore::smallestOffsetAbove):
+
2011-08-25 Igor Oliveira <igor.olive...@openbossa.org>
Rollout r93799: Caused bad clipping on the bottom of tall glyphs inside a button label
Modified: trunk/Source/WebCore/editing/visible_units.cpp (93833 => 93834)
--- trunk/Source/WebCore/editing/visible_units.cpp 2011-08-25 23:08:34 UTC (rev 93833)
+++ trunk/Source/WebCore/editing/visible_units.cpp 2011-08-25 23:19:26 UTC (rev 93834)
@@ -1144,6 +1144,7 @@
}
static const int invalidOffset = -1;
+static const int offsetNotFound = -1;
static bool isBoxVisuallyLastInLine(const InlineBox* box, TextDirection blockDirection)
{
@@ -1436,39 +1437,39 @@
static int greatestOffsetUnder(int offset, bool boxAndBlockAreInSameDirection, const WordBoundaryVector& orderedWordBoundaries)
{
if (!orderedWordBoundaries.size())
- return -1;
+ return offsetNotFound;
// FIXME: binary search.
if (boxAndBlockAreInSameDirection) {
for (unsigned i = 0; i < orderedWordBoundaries.size(); ++i) {
if (orderedWordBoundaries[i].offsetInInlineBox < offset)
return i;
}
- return -1;
+ return offsetNotFound;
}
for (int i = orderedWordBoundaries.size() - 1; i >= 0; --i) {
if (orderedWordBoundaries[i].offsetInInlineBox < offset)
return i;
}
- return -1;
+ return offsetNotFound;
}
static int smallestOffsetAbove(int offset, bool boxAndBlockAreInSameDirection, const WordBoundaryVector& orderedWordBoundaries)
{
if (!orderedWordBoundaries.size())
- return -1;
+ return offsetNotFound;
// FIXME: binary search.
if (boxAndBlockAreInSameDirection) {
for (int i = orderedWordBoundaries.size() - 1; i >= 0; --i) {
if (orderedWordBoundaries[i].offsetInInlineBox > offset)
return i;
}
- return -1;
+ return offsetNotFound;
}
for (unsigned i = 0; i < orderedWordBoundaries.size(); ++i) {
if (orderedWordBoundaries[i].offsetInInlineBox > offset)
return i;
}
- return -1;
+ return offsetNotFound;
}
static const RenderBlock* blockWithPreviousLineBox(const RenderBlock* startingBlock)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes