예제 #1
0
bool ThemePainterDefault::paintMenuList(const LayoutObject& o,
                                        const PaintInfo& i,
                                        const IntRect& rect) {
  if (!o.isBox())
    return false;

  WebThemeEngine::ExtraParams extraParams;
  const LayoutBox& box = toLayoutBox(o);
  // Match Chromium Win behaviour of showing all borders if any are shown.
  extraParams.menuList.hasBorder = box.borderRight() || box.borderLeft() ||
                                   box.borderTop() || box.borderBottom();
  extraParams.menuList.hasBorderRadius = o.styleRef().hasBorderRadius();
  // Fallback to transparent if the specified color object is invalid.
  Color backgroundColor(Color::transparent);
  if (o.styleRef().hasBackground())
    backgroundColor = o.resolveColor(CSSPropertyBackgroundColor);
  extraParams.menuList.backgroundColor = backgroundColor.rgb();

  // If we have a background image, don't fill the content area to expose the
  // parent's background. Also, we shouldn't fill the content area if the
  // alpha of the color is 0. The API of Windows GDI ignores the alpha.
  // FIXME: the normal Aura theme doesn't care about this, so we should
  // investigate if we really need fillContentArea.
  extraParams.menuList.fillContentArea =
      !o.styleRef().hasBackgroundImage() && backgroundColor.alpha();

  setupMenuListArrow(box, rect, extraParams);

  WebCanvas* canvas = i.context.canvas();
  Platform::current()->themeEngine()->paint(
      canvas, WebThemeEngine::PartMenuList, getWebThemeState(o), WebRect(rect),
      &extraParams);
  return false;
}
예제 #2
0
bool ThemePainterDefault::paintSliderThumb(const LayoutObject& o,
                                           const PaintInfo& i,
                                           const IntRect& rect) {
  WebThemeEngine::ExtraParams extraParams;
  WebCanvas* canvas = i.context.canvas();
  extraParams.slider.vertical =
      o.styleRef().appearance() == SliderThumbVerticalPart;
  extraParams.slider.inDrag = LayoutTheme::isPressed(o);

  // FIXME: Mock theme doesn't handle zoomed sliders.
  float zoomLevel = useMockTheme() ? 1 : o.styleRef().effectiveZoom();
  GraphicsContextStateSaver stateSaver(i.context, false);
  IntRect unzoomedRect = rect;
  if (zoomLevel != 1) {
    stateSaver.save();
    unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel);
    unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel);
    i.context.translate(unzoomedRect.x(), unzoomedRect.y());
    i.context.scale(zoomLevel, zoomLevel);
    i.context.translate(-unzoomedRect.x(), -unzoomedRect.y());
  }

  Platform::current()->themeEngine()->paint(
      canvas, WebThemeEngine::PartSliderThumb, getWebThemeState(o),
      WebRect(unzoomedRect), &extraParams);
  return false;
}
예제 #3
0
bool ThemePainterDefault::paintCheckbox(const LayoutObject& o,
                                        const PaintInfo& i,
                                        const IntRect& rect) {
  WebThemeEngine::ExtraParams extraParams;
  WebCanvas* canvas = i.context.canvas();
  extraParams.button.checked = LayoutTheme::isChecked(o);
  extraParams.button.indeterminate = LayoutTheme::isIndeterminate(o);

  float zoomLevel = o.styleRef().effectiveZoom();
  GraphicsContextStateSaver stateSaver(i.context, false);
  IntRect unzoomedRect = rect;
  if (zoomLevel != 1) {
    stateSaver.save();
    unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel);
    unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel);
    i.context.translate(unzoomedRect.x(), unzoomedRect.y());
    i.context.scale(zoomLevel, zoomLevel);
    i.context.translate(-unzoomedRect.x(), -unzoomedRect.y());
  }

  Platform::current()->themeEngine()->paint(
      canvas, WebThemeEngine::PartCheckbox, getWebThemeState(o),
      WebRect(unzoomedRect), &extraParams);
  return false;
}
예제 #4
0
bool RenderThemeNix::paintSliderTrack(RenderObject* object, const PaintInfo& info, const IntRect& rect)
{
    themeEngine()->paintSliderTrack(webCanvas(info), getWebThemeState(this, object), rect);
#if ENABLE(DATALIST_ELEMENT)
    paintSliderTicks(object, info, rect);
#endif
    return false;
}
bool RenderThemeChromiumLinux::paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    PlatformSupport::ThemePaintExtraParams extraParams;
    extraParams.button.checked = isChecked(o);

    PlatformSupport::paintThemePart(i.context, PlatformSupport::PartRadio, getWebThemeState(this, o), rect, &extraParams);
    return false;
}
bool RenderThemeChromiumLinux::paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    PlatformSupport::ThemePaintExtraParams extraParams;
    extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart;

    PlatformSupport::paintThemePart(i.context, PlatformSupport::PartSliderTrack, getWebThemeState(this, o), rect, &extraParams);
    return false;
}
예제 #7
0
bool RenderThemeChromiumLinux::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    PlatformBridge::ThemePaintExtraParams extraParams;
    extraParams.slider.vertical = o->style()->appearance() == SliderThumbVerticalPart;
    extraParams.slider.inDrag = isPressed(o);

    PlatformBridge::paintThemePart(i.context, PlatformBridge::PartSliderThumb, getWebThemeState(this, o), rect, &extraParams);
    return false;
}
예제 #8
0
bool RenderThemeChromiumLinux::paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    PlatformBridge::ThemePaintExtraParams extraParams;
    extraParams.button.checked = isChecked(o);
    extraParams.button.indeterminate = isIndeterminate(o);

    PlatformBridge::paintThemePart(i.context, PlatformBridge::PartCheckbox, getWebThemeState(this, o), rect, &extraParams);
    return false;
}
예제 #9
0
bool RenderThemeNix::paintInnerSpinButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    WebKit::WebThemeEngine::InnerSpinButtonExtraParams extraParams;
    extraParams.spinUp = isSpinUpButtonPartPressed(o);
    extraParams.readOnly = isReadOnlyControl(o);

    themeEngine()->paintInnerSpinButton(webCanvas(i), getWebThemeState(this, o), WebKit::WebRect(rect), extraParams);
    return false;
}
예제 #10
0
bool RenderThemeNix::paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    WebKit::WebThemeEngine::ButtonExtraParams extraParams;
    extraParams.checked = isChecked(o);
    extraParams.indeterminate = isIndeterminate(o);

    themeEngine()->paintRadio(webCanvas(i), getWebThemeState(this, o), WebKit::WebRect(rect), extraParams);
    return false;
}
bool RenderThemeChromiumLinux::paintInnerSpinButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    PlatformSupport::ThemePaintExtraParams extraParams;
    extraParams.innerSpin.spinUp = (controlStatesForRenderer(o) & SpinUpState);
    extraParams.innerSpin.readOnly = isReadOnlyControl(o);

    PlatformSupport::paintThemePart(i.context, PlatformSupport::PartInnerSpinButton, getWebThemeState(this, o), rect, &extraParams);
    return false;
}
예제 #12
0
bool RenderThemeNix::paintTextField(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    // WebThemeEngine does not handle border rounded corner and background image
    // so return true to draw CSS border and background.
    if (o->style()->hasBorderRadius() || o->style()->hasBackgroundImage())
        return true;

    themeEngine()->paintTextField(webCanvas(i), getWebThemeState(this, o), WebKit::WebRect(rect));
    return false;
}
예제 #13
0
bool RenderThemeNix::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    WebKit::WebThemeEngine::ButtonExtraParams extraParams;
    extraParams.isDefault = isDefault(o);
    extraParams.hasBorder = true;
    extraParams.backgroundColor = defaultButtonBackgroundColor;
    if (o->hasBackground())
        extraParams.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb();

    themeEngine()->paintButton(webCanvas(i), getWebThemeState(this, o), WebKit::WebRect(rect), extraParams);
    return false;
}
예제 #14
0
bool RenderThemeNix::paintProgressBar(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    RenderProgress* renderProgress = toRenderProgress(o);
    WebKit::WebThemeEngine::ProgressBarExtraParams extraParams;
    extraParams.isDeterminate = renderProgress->isDeterminate();
    extraParams.position = renderProgress->position();
    extraParams.animationProgress = renderProgress->animationProgress();
    extraParams.animationStartTime = renderProgress->animationStartTime();
    themeEngine()->paintProgressBar(webCanvas(i), getWebThemeState(this, o), WebKit::WebRect(rect), extraParams);

    return false;
}
bool RenderThemeChromiumLinux::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    PlatformSupport::ThemePaintExtraParams extraParams;
    extraParams.button.isDefault = isDefault(o);
    extraParams.button.hasBorder = true;
    extraParams.button.backgroundColor = defaultButtonBackgroundColor;
    if (o->hasBackground())
        extraParams.button.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb();

    PlatformSupport::paintThemePart(i.context, PlatformSupport::PartButton, getWebThemeState(this, o), rect, &extraParams);
    return false;
}
예제 #16
0
bool ThemePainterDefault::paintRadio(const LayoutObject& o,
                                     const PaintInfo& i,
                                     const IntRect& rect) {
  WebThemeEngine::ExtraParams extraParams;
  WebCanvas* canvas = i.context.canvas();
  extraParams.button.checked = LayoutTheme::isChecked(o);

  Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartRadio,
                                            getWebThemeState(o), WebRect(rect),
                                            &extraParams);
  return false;
}
예제 #17
0
bool ThemePainterDefault::paintInnerSpinButton(const LayoutObject& o,
                                               const PaintInfo& i,
                                               const IntRect& rect) {
  WebThemeEngine::ExtraParams extraParams;
  WebCanvas* canvas = i.context.canvas();
  extraParams.innerSpin.spinUp =
      (LayoutTheme::controlStatesForLayoutObject(o) & SpinUpControlState);
  extraParams.innerSpin.readOnly = LayoutTheme::isReadOnlyControl(o);

  Platform::current()->themeEngine()->paint(
      canvas, WebThemeEngine::PartInnerSpinButton, getWebThemeState(o),
      WebRect(rect), &extraParams);
  return false;
}
예제 #18
0
bool ThemePainterDefault::paintButton(const LayoutObject& o,
                                      const PaintInfo& i,
                                      const IntRect& rect) {
  WebThemeEngine::ExtraParams extraParams;
  WebCanvas* canvas = i.context.canvas();
  extraParams.button.hasBorder = true;
  extraParams.button.backgroundColor =
      useMockTheme() ? 0xffc0c0c0 : defaultButtonBackgroundColor;
  if (o.styleRef().hasBackground())
    extraParams.button.backgroundColor =
        o.resolveColor(CSSPropertyBackgroundColor).rgb();

  Platform::current()->themeEngine()->paint(canvas, WebThemeEngine::PartButton,
                                            getWebThemeState(o), WebRect(rect),
                                            &extraParams);
  return false;
}
bool RenderThemeChromiumLinux::paintProgressBar(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    if (!o->isProgress())
        return true;

    RenderProgress* renderProgress = toRenderProgress(o);
    IntRect valueRect = progressValueRectFor(renderProgress, rect);

    PlatformSupport::ThemePaintExtraParams extraParams;
    extraParams.progressBar.determinate = renderProgress->isDeterminate();
    extraParams.progressBar.valueRectX = valueRect.x();
    extraParams.progressBar.valueRectY = valueRect.y();
    extraParams.progressBar.valueRectWidth = valueRect.width();
    extraParams.progressBar.valueRectHeight = valueRect.height();

    PlatformSupport::paintThemePart(i.context, PlatformSupport::PartProgressBar, getWebThemeState(this, o), rect, &extraParams);
    return false;
}
예제 #20
0
bool RenderThemeNix::paintMeter(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    if (!o->isMeter())
        return true;

    RenderMeter* renderMeter = toRenderMeter(o);
    HTMLMeterElement* e = renderMeter->meterElement();
    WebKit::WebThemeEngine::MeterExtraParams extraParams;
    extraParams.min = e->min();
    extraParams.max = e->max();
    extraParams.value = e->value();
    extraParams.low = e->low();
    extraParams.high = e->high();
    extraParams.optimum = e->optimum();

    themeEngine()->paintMeter(webCanvas(i), getWebThemeState(this, o), rect, extraParams);

    return false;
}
예제 #21
0
bool ThemePainterDefault::paintMenuListButton(const LayoutObject& o,
                                              const PaintInfo& i,
                                              const IntRect& rect) {
  if (!o.isBox())
    return false;

  WebThemeEngine::ExtraParams extraParams;
  extraParams.menuList.hasBorder = false;
  extraParams.menuList.hasBorderRadius = o.styleRef().hasBorderRadius();
  extraParams.menuList.backgroundColor = Color::transparent;
  extraParams.menuList.fillContentArea = false;
  setupMenuListArrow(toLayoutBox(o), rect, extraParams);

  WebCanvas* canvas = i.context.canvas();
  Platform::current()->themeEngine()->paint(
      canvas, WebThemeEngine::PartMenuList, getWebThemeState(o), WebRect(rect),
      &extraParams);
  return false;
}
bool RenderThemeChromiumLinux::paintTextField(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    // WebThemeEngine does not handle border rounded corner and background image
    // so return true to draw CSS border and background.
    if (o->style()->hasBorderRadius() || o->style()->hasBackgroundImage())
        return true;

    ControlPart part = o->style()->appearance();

    PlatformSupport::ThemePaintExtraParams extraParams;
    extraParams.textField.isTextArea = part == TextAreaPart;
    extraParams.textField.isListbox = part == ListboxPart;

    // Fallback to white if the specified color object is invalid.
    Color backgroundColor(Color::white);
    if (o->style()->visitedDependentColor(CSSPropertyBackgroundColor).isValid())
        backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor);
    extraParams.textField.backgroundColor = backgroundColor.rgb();

    PlatformSupport::paintThemePart(i.context, PlatformSupport::PartTextField, getWebThemeState(this, o), rect, &extraParams);
    return false;
}
bool RenderThemeChromiumLinux::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    if (!o->isBox())
        return false;

    const int right = rect.x() + rect.width();
    const int middle = rect.y() + rect.height() / 2;

    PlatformSupport::ThemePaintExtraParams extraParams;
    extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x() + 7 : right - 13;
    extraParams.menuList.arrowY = middle;
    const RenderBox* box = toRenderBox(o);
    // Match Chromium Win behaviour of showing all borders if any are shown.
    extraParams.menuList.hasBorder = box->borderRight() || box->borderLeft() || box->borderTop() || box->borderBottom();
    extraParams.menuList.hasBorderRadius = o->style()->hasBorderRadius();
    // Fallback to transparent if the specified color object is invalid.
    extraParams.menuList.backgroundColor = Color::transparent;
    if (o->hasBackground())
        extraParams.menuList.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb();

    PlatformSupport::paintThemePart(i.context, PlatformSupport::PartMenuList, getWebThemeState(this, o), rect, &extraParams);
    return false;
}
예제 #24
0
bool ThemePainterDefault::paintProgressBar(const LayoutObject& o,
                                           const PaintInfo& i,
                                           const IntRect& rect) {
  if (!o.isProgress())
    return true;

  const LayoutProgress& layoutProgress = toLayoutProgress(o);
  IntRect valueRect = progressValueRectFor(layoutProgress, rect);

  WebThemeEngine::ExtraParams extraParams;
  extraParams.progressBar.determinate = layoutProgress.isDeterminate();
  extraParams.progressBar.valueRectX = valueRect.x();
  extraParams.progressBar.valueRectY = valueRect.y();
  extraParams.progressBar.valueRectWidth = valueRect.width();
  extraParams.progressBar.valueRectHeight = valueRect.height();

  DirectionFlippingScope scope(o, i, rect);
  WebCanvas* canvas = i.context.canvas();
  Platform::current()->themeEngine()->paint(
      canvas, WebThemeEngine::PartProgressBar, getWebThemeState(o),
      WebRect(rect), &extraParams);
  return false;
}
예제 #25
0
bool ThemePainterDefault::paintTextField(const LayoutObject& o,
                                         const PaintInfo& i,
                                         const IntRect& rect) {
  // WebThemeEngine does not handle border rounded corner and background image
  // so return true to draw CSS border and background.
  if (o.styleRef().hasBorderRadius() || o.styleRef().hasBackgroundImage())
    return true;

  ControlPart part = o.styleRef().appearance();

  WebThemeEngine::ExtraParams extraParams;
  extraParams.textField.isTextArea = part == TextAreaPart;
  extraParams.textField.isListbox = part == ListboxPart;

  WebCanvas* canvas = i.context.canvas();

  Color backgroundColor = o.resolveColor(CSSPropertyBackgroundColor);
  extraParams.textField.backgroundColor = backgroundColor.rgb();

  Platform::current()->themeEngine()->paint(
      canvas, WebThemeEngine::PartTextField, getWebThemeState(o), WebRect(rect),
      &extraParams);
  return false;
}
예제 #26
0
bool RenderThemeChromiumDefault::paintProgressBar(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    if (!o->isProgress())
        return true;

    RenderProgress* renderProgress = toRenderProgress(o);
    IntRect valueRect = progressValueRectFor(renderProgress, rect);

    WebKit::WebThemeEngine::ExtraParams extraParams;
    extraParams.progressBar.determinate = renderProgress->isDeterminate();
    extraParams.progressBar.valueRectX = valueRect.x();
    extraParams.progressBar.valueRectY = valueRect.y();
    extraParams.progressBar.valueRectWidth = valueRect.width();
    extraParams.progressBar.valueRectHeight = valueRect.height();

    DirectionFlippingScope scope(o, i, rect);
    WebKit::WebCanvas* canvas = i.context->canvas();
    WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartProgressBar, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
    return false;
}
예제 #27
0
bool RenderThemeChromiumDefault::paintInnerSpinButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    WebKit::WebThemeEngine::ExtraParams extraParams;
    WebKit::WebCanvas* canvas = i.context->canvas();
    extraParams.innerSpin.spinUp = (controlStatesForRenderer(o) & SpinUpState);
    extraParams.innerSpin.readOnly = isReadOnlyControl(o);

    WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartInnerSpinButton, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
    return false;
}
예제 #28
0
bool RenderThemeChromiumDefault::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    WebKit::WebThemeEngine::ExtraParams extraParams;
    WebKit::WebCanvas* canvas = i.context->canvas();
    extraParams.button.hasBorder = true;
    extraParams.button.backgroundColor = defaultButtonBackgroundColor;
    if (o->hasBackground())
        extraParams.button.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb();

    WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartButton, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
    return false;
}
예제 #29
0
bool RenderThemeChromiumDefault::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    WebKit::WebThemeEngine::ExtraParams extraParams;
    WebKit::WebCanvas* canvas = i.context->canvas();
    extraParams.slider.vertical = o->style()->appearance() == SliderThumbVerticalPart;
    extraParams.slider.inDrag = isPressed(o);

    float zoomLevel = o->style()->effectiveZoom();
    GraphicsContextStateSaver stateSaver(*i.context);
    IntRect unzoomedRect = rect;
    if (zoomLevel != 1) {
        unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel);
        unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel);
        i.context->translate(unzoomedRect.x(), unzoomedRect.y());
        i.context->scale(FloatSize(zoomLevel, zoomLevel));
        i.context->translate(-unzoomedRect.x(), -unzoomedRect.y());
    }

    WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartSliderThumb, getWebThemeState(this, o), WebKit::WebRect(unzoomedRect), &extraParams);
    return false;
}
예제 #30
0
bool RenderThemeChromiumDefault::paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    WebKit::WebThemeEngine::ExtraParams extraParams;
    WebKit::WebCanvas* canvas = i.context->canvas();
    extraParams.button.checked = isChecked(o);

    WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartRadio, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
    return false;
}