[webkit-changes] cvs commit: WebCore/khtml/rendering
render_text.cpp render_text.h
Darin
darin at opensource.apple.com
Thu Sep 1 09:21:06 PDT 2005
darin 05/09/01 09:21:06
Modified: . ChangeLog
khtml/rendering render_text.cpp render_text.h
Added: manual-tests word-spacing-highlight.html
Log:
Reviewed and landed by Darin.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4672
Incorrect highlight when selection begins with space and word-spacing>0
Test cases added:
* manual-tests/word-spacing-highlight.html: Added.
* khtml/rendering/render_text.h: (InlineTextBox::textObject): Made inline.
* khtml/rendering/render_text.cpp: (InlineTextBox::selectionRect): Add word
spacing in as necessary when computing the rect.
Revision Changes Path
1.69 +14 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- ChangeLog 1 Sep 2005 10:12:39 -0000 1.68
+++ ChangeLog 1 Sep 2005 16:21:04 -0000 1.69
@@ -1,3 +1,17 @@
+2005-09-01 Mitz Pettel <opendarwin.org at mitzpettel.com>
+
+ Reviewed and landed by Darin.
+
+ - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4672
+ Incorrect highlight when selection begins with space and word-spacing>0
+
+ Test cases added:
+ * manual-tests/word-spacing-highlight.html: Added.
+
+ * khtml/rendering/render_text.h: (InlineTextBox::textObject): Made inline.
+ * khtml/rendering/render_text.cpp: (InlineTextBox::selectionRect): Add word
+ spacing in as necessary when computing the rect.
+
2005-09-01 Eric Seidel <eseidel at apple.com>
Removing unused files from SVG repository, no review requested.
1.1 WebCore/manual-tests/word-spacing-highlight.html
Index: word-spacing-highlight.html
===================================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Highlighting with word spacing</title>
</head>
<body>
<p style="word-spacing:5em;">
M xylophone
</p>
<p style="margin-left:1em;">
↑ click there and drag to the right
</p>
</body>
</html>
1.194 +5 -7 WebCore/khtml/rendering/render_text.cpp
Index: render_text.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_text.cpp,v
retrieving revision 1.193
retrieving revision 1.194
diff -u -r1.193 -r1.194
--- render_text.cpp 31 Aug 2005 05:12:54 -0000 1.193
+++ render_text.cpp 1 Sep 2005 16:21:05 -0000 1.194
@@ -83,11 +83,6 @@
*(size_t *)ptr = sz;
}
-RenderText* InlineTextBox::textObject()
-{
- return static_cast<RenderText*>(m_object);
-}
-
bool InlineTextBox::checkVerticalPoint(int _y, int _ty, int _h)
{
int topY = m_y;
@@ -140,6 +135,7 @@
return QRect();
RootInlineBox* rootBox = root();
+ RenderText* textObj = textObject();
int selStart = m_reversed ? m_x + m_width : m_x;
int selEnd = selStart;
int selTop = rootBox->selectionTop();
@@ -149,7 +145,7 @@
// way to get the width of a run including the justification padding.
if (sPos > 0 && !m_toAdd) {
// The selection begins in the middle of our run.
- int w = textObject()->width(m_start, sPos, m_firstLine, m_x);
+ int w = textObj->width(m_start, sPos, m_firstLine, m_x);
if (m_reversed)
selStart -= w;
else
@@ -164,7 +160,9 @@
}
else {
// Our run is partially selected, and so we need to measure.
- int w = textObject()->width(sPos + m_start, ePos - sPos, m_firstLine);
+ int w = textObj->width(sPos + m_start, ePos - sPos, m_firstLine);
+ if (sPos + m_start > 0 && textObj->str->s[sPos + m_start].isSpace() && !textObj->str->s[sPos + m_start - 1].isSpace())
+ w += textObj->style(m_firstLine)->wordSpacing();
if (m_reversed)
selEnd = selStart - w;
else
1.87 +9 -2 WebCore/khtml/rendering/render_text.h
Index: render_text.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_text.h,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- render_text.h 31 Aug 2005 05:12:54 -0000 1.86
+++ render_text.h 1 Sep 2005 16:21:05 -0000 1.87
@@ -88,7 +88,7 @@
virtual void paint(RenderObject::PaintInfo& i, int tx, int ty);
virtual bool nodeAtPoint(RenderObject::NodeInfo& i, int x, int y, int tx, int ty);
- RenderText* textObject();
+ RenderText* textObject() const;
virtual void deleteLine(RenderArena* arena);
virtual void extractLine();
@@ -337,5 +337,12 @@
uint m_end;
DOM::DOMStringImpl* m_generatedContentStr;
};
-};
+
+inline RenderText *InlineTextBox::textObject() const
+{
+ return static_cast<RenderText *>(m_object);
+}
+
+}
+
#endif
More information about the webkit-changes
mailing list