| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| 11 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
| 12 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
| 13 * | 13 * |
| 14 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
| 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 * Library General Public License for more details. | 17 * Library General Public License for more details. |
| 18 * | 18 * |
| 19 * You should have received a copy of the GNU Library General Public License | 19 * You should have received a copy of the GNU Library General Public License |
| 20 * along with this library; see the file COPYING.LIB. If not, write to | 20 * along with this library; see the file COPYING.LIB. If not, write to |
| 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 22 * Boston, MA 02110-1301, USA. | 22 * Boston, MA 02110-1301, USA. |
| 23 * | 23 * |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "sky/engine/config.h" | 26 #include "sky/engine/config.h" |
| 27 #include "sky/engine/core/rendering/RenderBoxModelObject.h" | 27 #include "sky/engine/core/rendering/RenderBoxModelObject.h" |
| 28 | 28 |
| 29 #include "sky/engine/core/frame/Settings.h" | 29 #include "sky/engine/core/frame/Settings.h" |
| 30 #include "sky/engine/core/rendering/ImageQualityController.h" | |
| 31 #include "sky/engine/core/rendering/RenderBlock.h" | 30 #include "sky/engine/core/rendering/RenderBlock.h" |
| 32 #include "sky/engine/core/rendering/RenderGeometryMap.h" | 31 #include "sky/engine/core/rendering/RenderGeometryMap.h" |
| 33 #include "sky/engine/core/rendering/RenderInline.h" | 32 #include "sky/engine/core/rendering/RenderInline.h" |
| 34 #include "sky/engine/core/rendering/RenderLayer.h" | 33 #include "sky/engine/core/rendering/RenderLayer.h" |
| 35 #include "sky/engine/core/rendering/RenderObjectInlines.h" | 34 #include "sky/engine/core/rendering/RenderObjectInlines.h" |
| 36 #include "sky/engine/core/rendering/RenderView.h" | 35 #include "sky/engine/core/rendering/RenderView.h" |
| 37 #include "sky/engine/core/rendering/style/ShadowList.h" | 36 #include "sky/engine/core/rendering/style/ShadowList.h" |
| 38 #include "sky/engine/platform/LengthFunctions.h" | 37 #include "sky/engine/platform/LengthFunctions.h" |
| 39 #include "sky/engine/platform/geometry/TransformState.h" | 38 #include "sky/engine/platform/geometry/TransformState.h" |
| 40 #include "sky/engine/platform/graphics/DrawLooperBuilder.h" | 39 #include "sky/engine/platform/graphics/DrawLooperBuilder.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 62 if (containingBlock && !containingBlock->isRenderView()) | 61 if (containingBlock && !containingBlock->isRenderView()) |
| 63 containingBlock->setSelectionState(state); | 62 containingBlock->setSelectionState(state); |
| 64 } | 63 } |
| 65 | 64 |
| 66 bool RenderBoxModelObject::hasAcceleratedCompositing() const | 65 bool RenderBoxModelObject::hasAcceleratedCompositing() const |
| 67 { | 66 { |
| 68 // FIXME(sky): Remove | 67 // FIXME(sky): Remove |
| 69 return false; | 68 return false; |
| 70 } | 69 } |
| 71 | 70 |
| 72 InterpolationQuality RenderBoxModelObject::chooseInterpolationQuality(GraphicsCo
ntext* context, Image* image, const void* layer, const LayoutSize& size) | |
| 73 { | |
| 74 return ImageQualityController::imageQualityController()->chooseInterpolation
Quality(context, this, image, layer, size); | |
| 75 } | |
| 76 | |
| 77 RenderBoxModelObject::RenderBoxModelObject(ContainerNode* node) | 71 RenderBoxModelObject::RenderBoxModelObject(ContainerNode* node) |
| 78 : RenderLayerModelObject(node) | 72 : RenderLayerModelObject(node) |
| 79 { | 73 { |
| 80 } | 74 } |
| 81 | 75 |
| 82 RenderBoxModelObject::~RenderBoxModelObject() | 76 RenderBoxModelObject::~RenderBoxModelObject() |
| 83 { | 77 { |
| 84 } | 78 } |
| 85 | 79 |
| 86 void RenderBoxModelObject::willBeDestroyed() | |
| 87 { | |
| 88 ImageQualityController::remove(this); | |
| 89 RenderLayerModelObject::willBeDestroyed(); | |
| 90 } | |
| 91 | |
| 92 bool RenderBoxModelObject::calculateHasBoxDecorations() const | 80 bool RenderBoxModelObject::calculateHasBoxDecorations() const |
| 93 { | 81 { |
| 94 RenderStyle* styleToUse = style(); | 82 RenderStyle* styleToUse = style(); |
| 95 ASSERT(styleToUse); | 83 ASSERT(styleToUse); |
| 96 return hasBackground() || styleToUse->hasBorder() || styleToUse->boxShadow()
; | 84 return hasBackground() || styleToUse->hasBorder() || styleToUse->boxShadow()
; |
| 97 } | 85 } |
| 98 | 86 |
| 99 void RenderBoxModelObject::updateFromStyle() | 87 void RenderBoxModelObject::updateFromStyle() |
| 100 { | 88 { |
| 101 RenderLayerModelObject::updateFromStyle(); | 89 RenderLayerModelObject::updateFromStyle(); |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 // no progressive loading of the background image | 501 // no progressive loading of the background image |
| 514 if (shouldPaintBackgroundImage) { | 502 if (shouldPaintBackgroundImage) { |
| 515 BackgroundImageGeometry geometry; | 503 BackgroundImageGeometry geometry; |
| 516 calculateBackgroundImageGeometry(paintInfo.paintContainer(), bgLayer, sc
rolledPaintRect, geometry, backgroundObject); | 504 calculateBackgroundImageGeometry(paintInfo.paintContainer(), bgLayer, sc
rolledPaintRect, geometry, backgroundObject); |
| 517 geometry.clip(paintInfo.rect); | 505 geometry.clip(paintInfo.rect); |
| 518 if (!geometry.destRect().isEmpty()) { | 506 if (!geometry.destRect().isEmpty()) { |
| 519 // FIXME(sky): Is it possible for the bgLayer to be something other
that CompositeSourceOver? | 507 // FIXME(sky): Is it possible for the bgLayer to be something other
that CompositeSourceOver? |
| 520 CompositeOperator compositeOp = bgLayer.composite(); | 508 CompositeOperator compositeOp = bgLayer.composite(); |
| 521 RenderObject* clientForBackgroundImage = backgroundObject ? backgrou
ndObject : this; | 509 RenderObject* clientForBackgroundImage = backgroundObject ? backgrou
ndObject : this; |
| 522 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome
try.tileSize()); | 510 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome
try.tileSize()); |
| 523 InterpolationQuality interpolationQuality = chooseInterpolationQuali
ty(context, image.get(), &bgLayer, geometry.tileSize()); | |
| 524 if (bgLayer.maskSourceType() == MaskLuminance) | 511 if (bgLayer.maskSourceType() == MaskLuminance) |
| 525 context->setColorFilter(ColorFilterLuminanceToAlpha); | 512 context->setColorFilter(ColorFilterLuminanceToAlpha); |
| 526 InterpolationQuality previousInterpolationQuality = context->imageIn
terpolationQuality(); | 513 InterpolationQuality previousInterpolationQuality = context->imageIn
terpolationQuality(); |
| 527 context->setImageInterpolationQuality(interpolationQuality); | 514 context->setImageInterpolationQuality(InterpolationLow); |
| 528 context->drawTiledImage(image.get(), geometry.destRect(), geometry.r
elativePhase(), geometry.tileSize(), | 515 context->drawTiledImage(image.get(), geometry.destRect(), geometry.r
elativePhase(), geometry.tileSize(), |
| 529 compositeOp, bgLayer.blendMode(), geometry.spaceSize()); | 516 compositeOp, bgLayer.blendMode(), geometry.spaceSize()); |
| 530 context->setImageInterpolationQuality(previousInterpolationQuality); | 517 context->setImageInterpolationQuality(previousInterpolationQuality); |
| 531 } | 518 } |
| 532 } | 519 } |
| 533 } | 520 } |
| 534 | 521 |
| 535 static inline int resolveWidthForRatio(int height, const FloatSize& intrinsicRat
io) | 522 static inline int resolveWidthForRatio(int height, const FloatSize& intrinsicRat
io) |
| 536 { | 523 { |
| 537 return ceilf(height * intrinsicRatio.width() / intrinsicRatio.height()); | 524 return ceilf(height * intrinsicRatio.width() / intrinsicRatio.height()); |
| (...skipping 1953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2491 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2478 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
| 2492 for (RenderObject* child = slowFirstChild(); child; ) { | 2479 for (RenderObject* child = slowFirstChild(); child; ) { |
| 2493 // Save our next sibling as moveChildTo will clear it. | 2480 // Save our next sibling as moveChildTo will clear it. |
| 2494 RenderObject* nextSibling = child->nextSibling(); | 2481 RenderObject* nextSibling = child->nextSibling(); |
| 2495 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2482 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
| 2496 child = nextSibling; | 2483 child = nextSibling; |
| 2497 } | 2484 } |
| 2498 } | 2485 } |
| 2499 | 2486 |
| 2500 } // namespace blink | 2487 } // namespace blink |
| OLD | NEW |