Changeset 15320 in webkit


Ignore:
Timestamp:
Jul 10, 2006 7:02:11 PM (18 years ago)
Author:
harrison
Message:

Reviewed by Dave Hyatt.

<rdar://problem/4602408> -webkit-highlight needs to support images and elements other than text

  • rendering/RenderBox.cpp: (WebCore::RenderBox::paintCustomHighlight):
  • rendering/RenderBox.h: Utility for subclasses.


  • rendering/RenderImage.cpp: (WebCore::RenderImage::paint): Custom highlight in front of images.


  • rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::paint): Custom highlight in front of list markers.
  • rendering/RenderWidget.cpp: (WebCore::RenderWidget::paint): Custom highlight in front of objects.
Location:
trunk/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r15319 r15320  
     12006-07-10  David Harrison  <harrison@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        <rdar://problem/4602408> -webkit-highlight needs to support images and elements other than text
     6
     7        * rendering/RenderBox.cpp:
     8        (WebCore::RenderBox::paintCustomHighlight):
     9        * rendering/RenderBox.h:
     10        Utility for subclasses.
     11       
     12        * rendering/RenderImage.cpp:
     13        (WebCore::RenderImage::paint):
     14        Custom highlight in front of images.
     15       
     16        * rendering/RenderListMarker.cpp:
     17        (WebCore::RenderListMarker::paint):
     18        Custom highlight in front of list markers.
     19
     20        * rendering/RenderWidget.cpp:
     21        (WebCore::RenderWidget::paint):
     22        Custom highlight in front of objects.
     23
    1242006-07-10  David Hyatt  <hyatt@apple.com>
    225
  • trunk/WebCore/rendering/RenderBox.cpp

    r15286 r15320  
    4242#include <algorithm>
    4343#include <math.h>
     44
     45#if PLATFORM(MAC)
     46#include "FrameMac.h"
     47#endif
    4448
    4549using namespace std;
     
    654658        p->restore(); // Undo the border radius clip
    655659}
     660
     661#if PLATFORM(MAC)
     662void RenderBox::paintCustomHighlight(int tx, int ty, const AtomicString& type, bool behindText)
     663{
     664    InlineBox* boxWrap = inlineBoxWrapper();
     665    RootInlineBox* r = boxWrap ? boxWrap->root() : 0;
     666    if (r) {
     667        FloatRect rootRect(tx + r->xPos(), ty + r->selectionTop(), r->width(), r->selectionHeight());
     668        FloatRect imageRect(tx + m_x, rootRect.y(), width(), rootRect.height());
     669        Mac(document()->frame())->paintCustomHighlight(type, imageRect, rootRect, behindText, false);
     670    } else {
     671        FloatRect imageRect(tx + m_x, ty + m_y, width(), height());
     672        Mac(document()->frame())->paintCustomHighlight(type, imageRect, imageRect, behindText, false);
     673    }
     674}
     675#endif
    656676
    657677void RenderBox::outlineBox(GraphicsContext* p, int _tx, int _ty, const char* color)
  • trunk/WebCore/rendering/RenderBox.h

    r15269 r15320  
    157157    void paintBackgrounds(GraphicsContext*, const Color&, const BackgroundLayer*, int clipy, int cliph, int _tx, int _ty, int w, int h);
    158158    void paintBackground(GraphicsContext*, const Color&, const BackgroundLayer*, int clipy, int cliph, int _tx, int _ty, int w, int h);
     159#if PLATFORM(MAC)
     160    void paintCustomHighlight(int tx, int ty, const AtomicString& type, bool behindText);
     161#endif
     162
    159163    void outlineBox(GraphicsContext*, int _tx, int _ty, const char *color = "red");
    160164
  • trunk/WebCore/rendering/RenderImage.cpp

    r15299 r15320  
    262262            }
    263263        }
    264     }
    265     else if (m_cachedImage) {
     264    } else if (m_cachedImage) {
    266265        IntRect rect(IntPoint(_tx + leftBorder + leftPad, _ty + topBorder + topPad), IntSize(cWidth, cHeight));
    267266       
     
    269268        CompositeOperator compositeOperator = imageElt ? imageElt->compositeOperator() : CompositeSourceOver;
    270269        p->drawImage(image(), rect, compositeOperator);
     270
     271#if PLATFORM(MAC)
     272        if (style()->highlight() != nullAtom && !i.p->paintingDisabled())
     273            paintCustomHighlight(_tx - m_x, _ty - m_y, style()->highlight(), false);
     274#endif
    271275
    272276        if (drawSelectionTint)
  • trunk/WebCore/rendering/RenderListMarker.cpp

    r15253 r15320  
    187187    if (m_listImage && !m_listImage->isErrorImage()) {
    188188        p->drawImage(m_listImage->image(), marker.location());
     189#if PLATFORM(MAC)
     190        if (style()->highlight() != nullAtom && !i.p->paintingDisabled())
     191            paintCustomHighlight(_tx, _ty, style()->highlight(), false);
     192#endif
    189193        if (selectionState() != SelectionNone)
    190194            p->fillRect(selectionRect(), selectionBackgroundColor());
     
    195199    p->setPen(red);
    196200    p->drawRect(box.x(), box.y(), box.width(), box.height());
     201#endif
     202
     203#if PLATFORM(MAC)
     204    // FIXME: paint gap between marker and list item proper
     205    if (style()->highlight() != nullAtom && !i.p->paintingDisabled())
     206        paintCustomHighlight(_tx, _ty, style()->highlight(), true);
    197207#endif
    198208
  • trunk/WebCore/rendering/RenderWidget.cpp

    r15253 r15320  
    191191    }
    192192
     193#if PLATFORM(MAC)
     194    if (style()->highlight() != nullAtom && !i.p->paintingDisabled())
     195        paintCustomHighlight(tx - m_x, ty - m_y, style()->highlight(), false);
     196#endif
     197
    193198    // Paint a partially transparent wash over selected widgets.
    194199    if (isSelected() && !document()->printing())
Note: See TracChangeset for help on using the changeset viewer.