Reviewed by Dave and Darin.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Aug 2004 02:21:32 +0000 (02:21 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Aug 2004 02:21:32 +0000 (02:21 +0000)
        * khtml/rendering/render_text.cpp:
        (RenderText::paint): Split apple and non-apple code paths to allow further cleanup.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7305 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/rendering/render_text.cpp

index c4edd3d..5340165 100644 (file)
@@ -1,3 +1,10 @@
+2004-08-19  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Dave and Darin.
+
+        * khtml/rendering/render_text.cpp:
+        (RenderText::paint): Split apple and non-apple code paths to allow further cleanup.
+
 2004-08-19  Darin Adler  <darin@apple.com>
 
         Reviewed by Dave.
index 463f85c..35c1f9c 100644 (file)
@@ -798,7 +798,6 @@ void RenderText::paint(PaintInfo& i, int tx, int ty)
         bool drawSelectionBackground = haveSelection && pass == 0 && i.phase != PaintActionSelection;
         bool drawMarkedTextBackground = haveMarkedText && pass == 0 && i.phase != PaintActionSelection;
         bool drawText = !(haveSelection || haveMarkedText) || pass == 1;
-#endif
 
     // run until we find one that is outside the range, then we
     // know we can stop
@@ -809,11 +808,7 @@ void RenderText::paint(PaintInfo& i, int tx, int ty)
             {
                RenderCanvas* canvasObj = canvas();
                if (ty+s->m_y < canvasObj->truncatedAt())
-#if APPLE_CHANGES
                    canvasObj->setBestTruncatedAt(ty+s->m_y, this);
-#else
-                   canvasObj->setTruncatedAt(ty+s->m_y);
-#endif
                // Let's stop here.
                break;
             }
@@ -829,9 +824,7 @@ void RenderText::paint(PaintInfo& i, int tx, int ty)
 
         font = &_style->htmlFont(); // Always update, since smallCaps is not stored in the QFont.
 
-#if APPLE_CHANGES
         if (drawText) {
-#endif
         
         QColor textColor = _style->color();
         if (_style->shouldCorrectTextColor()) {
@@ -841,7 +834,6 @@ void RenderText::paint(PaintInfo& i, int tx, int ty)
         if(textColor != p->pen().color())
             p->setPen(textColor);
 
-#if APPLE_CHANGES
         // Set a text shadow if we have one.
         // FIXME: Support multiple shadow effects.  Need more from the CG API before
         // we can do this.
@@ -851,7 +843,6 @@ void RenderText::paint(PaintInfo& i, int tx, int ty)
                          _style->textShadow()->blur, _style->textShadow()->color);
             setShadow = true;
         }
-#endif
         
         if (s->m_len > 0) {
             bool paintSelectedTextOnly = (i.phase == PaintActionSelection);
@@ -889,36 +880,18 @@ void RenderText::paint(PaintInfo& i, int tx, int ty)
                 int ePos = QMIN( endPos - offset, s->m_len );
                 if (paintSelectedTextSeparately) {
                     if (sPos >= ePos)
-#if APPLE_CHANGES
                         font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline,
                                        str->s, str->l, s->m_start, s->m_len,
                                        s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR, style()->visuallyOrdered());
-#else
-                        font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline,
-                                       str->s, str->l, s->m_start, s->m_len,
-                                       s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR);
-#endif
                     else {
                         if (sPos-1 >= 0)
-#if APPLE_CHANGES
                             font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline, str->s,
                                         str->l, s->m_start, s->m_len,
                                         s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR, style()->visuallyOrdered(), 0, sPos);
-#else
-                            font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline, str->s,
-                                        str->l, s->m_start, s->m_len,
-                                        s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR, 0, sPos);
-#endif
                         if (ePos < s->m_start+s->m_len)
-#if APPLE_CHANGES
                             font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline, str->s,
                                         str->l, s->m_start, s->m_len,
                                         s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR, style()->visuallyOrdered(), ePos, -1);
-#else
-                            font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline, str->s,
-                                        str->l, s->m_start, s->m_len,
-                                        s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR, ePos, -1);
-#endif
                     }
                 }
                 
@@ -926,28 +899,16 @@ void RenderText::paint(PaintInfo& i, int tx, int ty)
                     if (selectionColor != p->pen().color())
                         p->setPen(selectionColor);
 
-#if APPLE_CHANGES
                     if (selectionTextShadow)
                         p->setShadow(selectionTextShadow->x,
                                      selectionTextShadow->y,
                                      selectionTextShadow->blur,
                                      selectionTextShadow->color);
-#endif                       
-
-#if APPLE_CHANGES
                     font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline, str->s,
                                    str->l, s->m_start, s->m_len,
                                    s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR, style()->visuallyOrdered(), sPos, ePos);
-#else
-                    font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline, str->s,
-                                   str->l, s->m_start, s->m_len,
-                                   s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR, sPos, ePos);
-#endif
-
-#if APPLE_CHANGES
                     if (selectionTextShadow)
                         p->clearShadow();
-#endif
                 }
             } 
         }
@@ -985,22 +946,15 @@ void RenderText::paint(PaintInfo& i, int tx, int ty)
             }
         }
 
-#if APPLE_CHANGES
         if (setShadow)
             p->clearShadow();
         
         } // drawText
-#endif
 
-#if APPLE_CHANGES
         if (drawMarkedTextBackground && !isPrinting)
            s->paintMarkedTextBackground(font, this, p, _style, tx, ty, markedTextRange.startOffset(), markedTextRange.endOffset());
 
-#endif
-
-#if APPLE_CHANGES
         if (drawSelectionBackground)
-#endif
         if (!isPrinting && (selectionState() != SelectionNone))
             s->paintSelection(font, this, p, _style, tx, ty, startPos, endPos);
 
@@ -1018,8 +972,9 @@ void RenderText::paint(PaintInfo& i, int tx, int ty)
 
     } while (((s = s->nextTextBox()) != 0) && s->checkVerticalPoint(i.r.y(), ty, i.r.height()));
 
-#if APPLE_CHANGES
     } // end of for loop
+#else
+#error This file no longer works without Apple changes
 #endif
 }