| 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 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 120 } |
| 121 | 121 |
| 122 void RenderBoxModelObject::updateFromStyle() | 122 void RenderBoxModelObject::updateFromStyle() |
| 123 { | 123 { |
| 124 RenderLayerModelObject::updateFromStyle(); | 124 RenderLayerModelObject::updateFromStyle(); |
| 125 | 125 |
| 126 RenderStyle* styleToUse = style(); | 126 RenderStyle* styleToUse = style(); |
| 127 setHasBoxDecorationBackground(calculateHasBoxDecorations()); | 127 setHasBoxDecorationBackground(calculateHasBoxDecorations()); |
| 128 setInline(styleToUse->isDisplayInlineType()); | 128 setInline(styleToUse->isDisplayInlineType()); |
| 129 setPositionState(styleToUse->position()); | 129 setPositionState(styleToUse->position()); |
| 130 setHorizontalWritingMode(styleToUse->isHorizontalWritingMode()); | |
| 131 } | 130 } |
| 132 | 131 |
| 133 static LayoutSize accumulateInFlowPositionOffsets(const RenderObject* child) | 132 static LayoutSize accumulateInFlowPositionOffsets(const RenderObject* child) |
| 134 { | 133 { |
| 135 if (!child->isAnonymousBlock() || !child->isRelPositioned()) | 134 if (!child->isAnonymousBlock() || !child->isRelPositioned()) |
| 136 return LayoutSize(); | 135 return LayoutSize(); |
| 137 LayoutSize offset; | 136 LayoutSize offset; |
| 138 RenderObject* p = toRenderBlock(child)->inlineElementContinuation(); | 137 RenderObject* p = toRenderBlock(child)->inlineElementContinuation(); |
| 139 while (p && p->isRenderInline()) { | 138 while (p && p->isRenderInline()) { |
| 140 if (p->isRelPositioned()) { | 139 if (p->isRelPositioned()) { |
| (...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2191 BoxSide side, const class BorderEdge edges[]) | 2190 BoxSide side, const class BorderEdge edges[]) |
| 2192 { | 2191 { |
| 2193 graphicsContext->clip(calculateSideRectIncludingInner(outerBorder, edges, si
de)); | 2192 graphicsContext->clip(calculateSideRectIncludingInner(outerBorder, edges, si
de)); |
| 2194 RoundedRect adjustedInnerRect = calculateAdjustedInnerBorder(innerBorder, si
de); | 2193 RoundedRect adjustedInnerRect = calculateAdjustedInnerBorder(innerBorder, si
de); |
| 2195 if (!adjustedInnerRect.isEmpty()) | 2194 if (!adjustedInnerRect.isEmpty()) |
| 2196 graphicsContext->clipOutRoundedRect(adjustedInnerRect); | 2195 graphicsContext->clipOutRoundedRect(adjustedInnerRect); |
| 2197 } | 2196 } |
| 2198 | 2197 |
| 2199 void RenderBoxModelObject::getBorderEdgeInfo(BorderEdge edges[], const RenderSty
le* style, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const | 2198 void RenderBoxModelObject::getBorderEdgeInfo(BorderEdge edges[], const RenderSty
le* style, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const |
| 2200 { | 2199 { |
| 2201 bool horizontal = style->isHorizontalWritingMode(); | |
| 2202 | |
| 2203 edges[BSTop] = BorderEdge(style->borderTopWidth(), | 2200 edges[BSTop] = BorderEdge(style->borderTopWidth(), |
| 2204 resolveColor(style, CSSPropertyBorderTopColor), | 2201 resolveColor(style, CSSPropertyBorderTopColor), |
| 2205 style->borderTopStyle(), | 2202 style->borderTopStyle(), |
| 2206 style->borderTopIsTransparent(), | 2203 style->borderTopIsTransparent(), |
| 2207 horizontal || includeLogicalLeftEdge); | 2204 true); |
| 2208 | 2205 |
| 2209 edges[BSRight] = BorderEdge(style->borderRightWidth(), | 2206 edges[BSRight] = BorderEdge(style->borderRightWidth(), |
| 2210 resolveColor(style, CSSPropertyBorderRightColor), | 2207 resolveColor(style, CSSPropertyBorderRightColor), |
| 2211 style->borderRightStyle(), | 2208 style->borderRightStyle(), |
| 2212 style->borderRightIsTransparent(), | 2209 style->borderRightIsTransparent(), |
| 2213 !horizontal || includeLogicalRightEdge); | 2210 includeLogicalRightEdge); |
| 2214 | 2211 |
| 2215 edges[BSBottom] = BorderEdge(style->borderBottomWidth(), | 2212 edges[BSBottom] = BorderEdge(style->borderBottomWidth(), |
| 2216 resolveColor(style, CSSPropertyBorderBottomColor), | 2213 resolveColor(style, CSSPropertyBorderBottomColor), |
| 2217 style->borderBottomStyle(), | 2214 style->borderBottomStyle(), |
| 2218 style->borderBottomIsTransparent(), | 2215 style->borderBottomIsTransparent(), |
| 2219 horizontal || includeLogicalRightEdge); | 2216 true); |
| 2220 | 2217 |
| 2221 edges[BSLeft] = BorderEdge(style->borderLeftWidth(), | 2218 edges[BSLeft] = BorderEdge(style->borderLeftWidth(), |
| 2222 resolveColor(style, CSSPropertyBorderLeftColor), | 2219 resolveColor(style, CSSPropertyBorderLeftColor), |
| 2223 style->borderLeftStyle(), | 2220 style->borderLeftStyle(), |
| 2224 style->borderLeftIsTransparent(), | 2221 style->borderLeftIsTransparent(), |
| 2225 !horizontal || includeLogicalLeftEdge); | 2222 includeLogicalLeftEdge); |
| 2226 } | 2223 } |
| 2227 | 2224 |
| 2228 bool RenderBoxModelObject::borderObscuresBackgroundEdge(const FloatSize& context
Scale) const | 2225 bool RenderBoxModelObject::borderObscuresBackgroundEdge(const FloatSize& context
Scale) const |
| 2229 { | 2226 { |
| 2230 BorderEdge edges[4]; | 2227 BorderEdge edges[4]; |
| 2231 getBorderEdgeInfo(edges, style()); | 2228 getBorderEdgeInfo(edges, style()); |
| 2232 | 2229 |
| 2233 for (int i = BSTop; i <= BSLeft; ++i) { | 2230 for (int i = BSTop; i <= BSLeft; ++i) { |
| 2234 const BorderEdge& currEdge = edges[i]; | 2231 const BorderEdge& currEdge = edges[i]; |
| 2235 // FIXME: for vertical text | 2232 // FIXME: for vertical text |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2316 { | 2313 { |
| 2317 // FIXME: Deal with border-image. Would be great to use border-image as a m
ask. | 2314 // FIXME: Deal with border-image. Would be great to use border-image as a m
ask. |
| 2318 GraphicsContext* context = info.context; | 2315 GraphicsContext* context = info.context; |
| 2319 if (!s->boxShadow()) | 2316 if (!s->boxShadow()) |
| 2320 return; | 2317 return; |
| 2321 | 2318 |
| 2322 RoundedRect border = (shadowStyle == Inset) ? s->getRoundedInnerBorderFor(pa
intRect, includeLogicalLeftEdge, includeLogicalRightEdge) | 2319 RoundedRect border = (shadowStyle == Inset) ? s->getRoundedInnerBorderFor(pa
intRect, includeLogicalLeftEdge, includeLogicalRightEdge) |
| 2323 : s->getRoundedBorderFor(paintRect, includeLogicalLeftEdge, includeLogic
alRightEdge); | 2320 : s->getRoundedBorderFor(paintRect, includeLogicalLeftEdge, includeLogic
alRightEdge); |
| 2324 | 2321 |
| 2325 bool hasBorderRadius = s->hasBorderRadius(); | 2322 bool hasBorderRadius = s->hasBorderRadius(); |
| 2326 bool isHorizontal = s->isHorizontalWritingMode(); | |
| 2327 bool hasOpaqueBackground = s->colorIncludingFallback(CSSPropertyBackgroundCo
lor).alpha() == 255; | 2323 bool hasOpaqueBackground = s->colorIncludingFallback(CSSPropertyBackgroundCo
lor).alpha() == 255; |
| 2328 | 2324 |
| 2329 GraphicsContextStateSaver stateSaver(*context, false); | 2325 GraphicsContextStateSaver stateSaver(*context, false); |
| 2330 | 2326 |
| 2331 const ShadowList* shadowList = s->boxShadow(); | 2327 const ShadowList* shadowList = s->boxShadow(); |
| 2332 for (size_t i = shadowList->shadows().size(); i--; ) { | 2328 for (size_t i = shadowList->shadows().size(); i--; ) { |
| 2333 const ShadowData& shadow = shadowList->shadows()[i]; | 2329 const ShadowData& shadow = shadowList->shadows()[i]; |
| 2334 if (shadow.style() != shadowStyle) | 2330 if (shadow.style() != shadowStyle) |
| 2335 continue; | 2331 continue; |
| 2336 | 2332 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2415 roundedFillRect.adjustRadii(); | 2411 roundedFillRect.adjustRadii(); |
| 2416 context->fillRoundedRect(roundedFillRect, Color::black); | 2412 context->fillRoundedRect(roundedFillRect, Color::black); |
| 2417 } | 2413 } |
| 2418 } else { | 2414 } else { |
| 2419 context->fillRect(fillRect, Color::black); | 2415 context->fillRect(fillRect, Color::black); |
| 2420 } | 2416 } |
| 2421 } else { | 2417 } else { |
| 2422 // The inset shadow case. | 2418 // The inset shadow case. |
| 2423 GraphicsContext::Edges clippedEdges = GraphicsContext::NoEdge; | 2419 GraphicsContext::Edges clippedEdges = GraphicsContext::NoEdge; |
| 2424 if (!includeLogicalLeftEdge) { | 2420 if (!includeLogicalLeftEdge) { |
| 2425 if (isHorizontal) | 2421 clippedEdges |= GraphicsContext::LeftEdge; |
| 2426 clippedEdges |= GraphicsContext::LeftEdge; | |
| 2427 else | |
| 2428 clippedEdges |= GraphicsContext::TopEdge; | |
| 2429 } | 2422 } |
| 2430 if (!includeLogicalRightEdge) { | 2423 if (!includeLogicalRightEdge) { |
| 2431 if (isHorizontal) | 2424 clippedEdges |= GraphicsContext::RightEdge; |
| 2432 clippedEdges |= GraphicsContext::RightEdge; | |
| 2433 else | |
| 2434 clippedEdges |= GraphicsContext::BottomEdge; | |
| 2435 } | 2425 } |
| 2436 // TODO: support non-integer shadows - crbug.com/334828 | 2426 // TODO: support non-integer shadows - crbug.com/334828 |
| 2437 context->drawInnerShadow(border, shadowColor, flooredIntSize(shadowO
ffset), shadowBlur, shadowSpread, clippedEdges); | 2427 context->drawInnerShadow(border, shadowColor, flooredIntSize(shadowO
ffset), shadowBlur, shadowSpread, clippedEdges); |
| 2438 } | 2428 } |
| 2439 } | 2429 } |
| 2440 } | 2430 } |
| 2441 | 2431 |
| 2442 LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const | 2432 LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const |
| 2443 { | 2433 { |
| 2444 return containingBlock()->availableLogicalWidth(); | 2434 return containingBlock()->availableLogicalWidth(); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2634 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2624 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
| 2635 for (RenderObject* child = startChild; child && child != endChild; ) { | 2625 for (RenderObject* child = startChild; child && child != endChild; ) { |
| 2636 // Save our next sibling as moveChildTo will clear it. | 2626 // Save our next sibling as moveChildTo will clear it. |
| 2637 RenderObject* nextSibling = child->nextSibling(); | 2627 RenderObject* nextSibling = child->nextSibling(); |
| 2638 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2628 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
| 2639 child = nextSibling; | 2629 child = nextSibling; |
| 2640 } | 2630 } |
| 2641 } | 2631 } |
| 2642 | 2632 |
| 2643 } // namespace blink | 2633 } // namespace blink |
| OLD | NEW |