| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. | 2 * Copyright (C) 2007 Apple Inc. |
| 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 4 * Copyright (C) 2008 Collabora Ltd. | 4 * Copyright (C) 2008 Collabora Ltd. |
| 5 * Copyright (C) 2008, 2009 Google Inc. | 5 * Copyright (C) 2008, 2009 Google Inc. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 partRect.move(offsetFromInputRenderer); | 215 partRect.move(offsetFromInputRenderer); |
| 216 // Account for the local drawing offset. | 216 // Account for the local drawing offset. |
| 217 partRect.move(localOffset.x(), localOffset.y()); | 217 partRect.move(localOffset.x(), localOffset.y()); |
| 218 | 218 |
| 219 return pixelSnappedIntRect(partRect); | 219 return pixelSnappedIntRect(partRect); |
| 220 } | 220 } |
| 221 | 221 |
| 222 bool RenderThemeChromiumSkia::paintSearchFieldCancelButton(RenderObject* cancelB
uttonObject, const PaintInfo& paintInfo, const IntRect& r) | 222 bool RenderThemeChromiumSkia::paintSearchFieldCancelButton(RenderObject* cancelB
uttonObject, const PaintInfo& paintInfo, const IntRect& r) |
| 223 { | 223 { |
| 224 // Get the renderer of <input> element. | 224 // Get the renderer of <input> element. |
| 225 if (!cancelButtonObject->node()) |
| 226 return false; |
| 225 Node* input = cancelButtonObject->node()->shadowHost(); | 227 Node* input = cancelButtonObject->node()->shadowHost(); |
| 226 RenderObject* baseRenderer = input ? input->renderer() : cancelButtonObject; | 228 RenderObject* baseRenderer = input ? input->renderer() : cancelButtonObject; |
| 227 if (!baseRenderer->isBox()) | 229 if (!baseRenderer->isBox()) |
| 228 return false; | 230 return false; |
| 229 RenderBox* inputRenderBox = toRenderBox(baseRenderer); | 231 RenderBox* inputRenderBox = toRenderBox(baseRenderer); |
| 230 LayoutRect inputContentBox = inputRenderBox->contentBoxRect(); | 232 LayoutRect inputContentBox = inputRenderBox->contentBoxRect(); |
| 231 | 233 |
| 232 // Make sure the scaled button stays square and will fit in its parent's box
. | 234 // Make sure the scaled button stays square and will fit in its parent's box
. |
| 233 LayoutUnit cancelButtonSize = std::min(inputContentBox.width(), std::min<Lay
outUnit>(inputContentBox.height(), r.height())); | 235 LayoutUnit cancelButtonSize = std::min(inputContentBox.width(), std::min<Lay
outUnit>(inputContentBox.height(), r.height())); |
| 234 // Calculate cancel button's coordinates relative to the input element. | 236 // Calculate cancel button's coordinates relative to the input element. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 258 float fontScale = style->fontSize() / defaultControlFontPixelSize; | 260 float fontScale = style->fontSize() / defaultControlFontPixelSize; |
| 259 int magnifierSize = lroundf(std::min(std::max(minSearchFieldResultsDecoratio
nSize, defaultSearchFieldResultsDecorationSize * fontScale), | 261 int magnifierSize = lroundf(std::min(std::max(minSearchFieldResultsDecoratio
nSize, defaultSearchFieldResultsDecorationSize * fontScale), |
| 260 maxSearchFieldResultsDecorationSize)); | 262 maxSearchFieldResultsDecorationSize)); |
| 261 style->setWidth(Length(magnifierSize, Fixed)); | 263 style->setWidth(Length(magnifierSize, Fixed)); |
| 262 style->setHeight(Length(magnifierSize, Fixed)); | 264 style->setHeight(Length(magnifierSize, Fixed)); |
| 263 } | 265 } |
| 264 | 266 |
| 265 bool RenderThemeChromiumSkia::paintSearchFieldResultsDecoration(RenderObject* ma
gnifierObject, const PaintInfo& paintInfo, const IntRect& r) | 267 bool RenderThemeChromiumSkia::paintSearchFieldResultsDecoration(RenderObject* ma
gnifierObject, const PaintInfo& paintInfo, const IntRect& r) |
| 266 { | 268 { |
| 267 // Get the renderer of <input> element. | 269 // Get the renderer of <input> element. |
| 270 if (!magnifierObject->node()) |
| 271 return false; |
| 268 Node* input = magnifierObject->node()->shadowHost(); | 272 Node* input = magnifierObject->node()->shadowHost(); |
| 269 RenderObject* baseRenderer = input ? input->renderer() : magnifierObject; | 273 RenderObject* baseRenderer = input ? input->renderer() : magnifierObject; |
| 270 if (!baseRenderer->isBox()) | 274 if (!baseRenderer->isBox()) |
| 271 return false; | 275 return false; |
| 272 RenderBox* inputRenderBox = toRenderBox(baseRenderer); | 276 RenderBox* inputRenderBox = toRenderBox(baseRenderer); |
| 273 LayoutRect inputContentBox = inputRenderBox->contentBoxRect(); | 277 LayoutRect inputContentBox = inputRenderBox->contentBoxRect(); |
| 274 | 278 |
| 275 // Make sure the scaled decoration stays square and will fit in its parent's
box. | 279 // Make sure the scaled decoration stays square and will fit in its parent's
box. |
| 276 LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min<Layout
Unit>(inputContentBox.height(), r.height())); | 280 LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min<Layout
Unit>(inputContentBox.height(), r.height())); |
| 277 // Calculate decoration's coordinates relative to the input element. | 281 // Calculate decoration's coordinates relative to the input element. |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 } | 476 } |
| 473 | 477 |
| 474 RenderThemeChromiumSkia::DirectionFlippingScope::~DirectionFlippingScope() | 478 RenderThemeChromiumSkia::DirectionFlippingScope::~DirectionFlippingScope() |
| 475 { | 479 { |
| 476 if (!m_needsFlipping) | 480 if (!m_needsFlipping) |
| 477 return; | 481 return; |
| 478 m_paintInfo.context->restore(); | 482 m_paintInfo.context->restore(); |
| 479 } | 483 } |
| 480 | 484 |
| 481 } // namespace WebCore | 485 } // namespace WebCore |
| OLD | NEW |