| 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 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 , m_overrideLogicalContentWidth(-1) | 50 , m_overrideLogicalContentWidth(-1) |
| 51 { | 51 { |
| 52 } | 52 } |
| 53 | 53 |
| 54 // For inline replaced elements, the inline box that owns us. | 54 // For inline replaced elements, the inline box that owns us. |
| 55 InlineBox* m_inlineBoxWrapper; | 55 InlineBox* m_inlineBoxWrapper; |
| 56 LayoutUnit m_overrideLogicalContentHeight; | 56 LayoutUnit m_overrideLogicalContentHeight; |
| 57 LayoutUnit m_overrideLogicalContentWidth; | 57 LayoutUnit m_overrideLogicalContentWidth; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 enum LayerType { |
| 61 NoLayer, |
| 62 NormalLayer, |
| 63 // An overflow clip layer is required for bookkeeping purposes, |
| 64 // but does not force a layer to be self painting. |
| 65 OverflowClipLayer, |
| 66 }; |
| 60 | 67 |
| 61 class RenderBox : public RenderBoxModelObject { | 68 class RenderBox : public RenderBoxModelObject { |
| 62 public: | 69 public: |
| 63 explicit RenderBox(ContainerNode*); | 70 explicit RenderBox(ContainerNode*); |
| 64 | 71 |
| 65 // hasAutoZIndex only returns true if the element is positioned or a flex-it
em since | 72 // hasAutoZIndex only returns true if the element is positioned or a flex-it
em since |
| 66 // position:static elements that are not flex-items get their z-index coerce
d to auto. | 73 // position:static elements that are not flex-items get their z-index coerce
d to auto. |
| 67 virtual LayerType layerTypeRequired() const override | 74 virtual LayerType layerTypeRequired() const |
| 68 { | 75 { |
| 69 if (isPositioned() || createsGroup() || hasClipPath() || hasTransform()
|| hasHiddenBackface() || !style()->hasAutoZIndex()) | 76 if (isPositioned() || createsGroup() || hasClipPath() || hasTransform()
|| hasHiddenBackface() || !style()->hasAutoZIndex()) |
| 70 return NormalLayer; | 77 return NormalLayer; |
| 71 if (hasOverflowClip()) | 78 if (hasOverflowClip()) |
| 72 return OverflowClipLayer; | 79 return OverflowClipLayer; |
| 73 | |
| 74 return NoLayer; | 80 return NoLayer; |
| 75 } | 81 } |
| 76 | 82 |
| 83 void destroyLayer(); |
| 84 void createLayer(LayerType); |
| 85 bool hasSelfPaintingLayer() const; |
| 86 RenderLayer* layer() const { return m_layer.get(); } |
| 87 |
| 77 // Use this with caution! No type checking is done! | 88 // Use this with caution! No type checking is done! |
| 78 RenderBox* firstChildBox() const; | 89 RenderBox* firstChildBox() const; |
| 79 RenderBox* lastChildBox() const; | 90 RenderBox* lastChildBox() const; |
| 80 | 91 |
| 81 LayoutUnit x() const { return m_frameRect.x(); } | 92 LayoutUnit x() const { return m_frameRect.x(); } |
| 82 LayoutUnit y() const { return m_frameRect.y(); } | 93 LayoutUnit y() const { return m_frameRect.y(); } |
| 83 LayoutUnit width() const { return m_frameRect.width(); } | 94 LayoutUnit width() const { return m_frameRect.width(); } |
| 84 LayoutUnit height() const { return m_frameRect.height(); } | 95 LayoutUnit height() const { return m_frameRect.height(); } |
| 85 | 96 |
| 86 int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); } | 97 int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 LayoutRect contentBoxRect() const { return LayoutRect(borderLeft() + padding
Left(), borderTop() + paddingTop(), contentWidth(), contentHeight()); } | 169 LayoutRect contentBoxRect() const { return LayoutRect(borderLeft() + padding
Left(), borderTop() + paddingTop(), contentWidth(), contentHeight()); } |
| 159 // The content box in absolute coords. Ignores transforms. | 170 // The content box in absolute coords. Ignores transforms. |
| 160 IntRect absoluteContentBox() const; | 171 IntRect absoluteContentBox() const; |
| 161 // The content box converted to absolute coords (taking transforms into acco
unt). | 172 // The content box converted to absolute coords (taking transforms into acco
unt). |
| 162 FloatQuad absoluteContentQuad() const; | 173 FloatQuad absoluteContentQuad() const; |
| 163 | 174 |
| 164 // This returns the content area of the box (excluding padding and border).
The only difference with contentBoxRect is that computedCSSContentBoxRect | 175 // This returns the content area of the box (excluding padding and border).
The only difference with contentBoxRect is that computedCSSContentBoxRect |
| 165 // does include the intrinsic padding in the content box as this is what som
e callers expect (like getComputedStyle). | 176 // does include the intrinsic padding in the content box as this is what som
e callers expect (like getComputedStyle). |
| 166 LayoutRect computedCSSContentBoxRect() const { return LayoutRect(borderLeft(
) + computedCSSPaddingLeft(), borderTop() + computedCSSPaddingTop(), clientWidth
() - computedCSSPaddingLeft() - computedCSSPaddingRight(), clientHeight() - comp
utedCSSPaddingTop() - computedCSSPaddingBottom()); } | 177 LayoutRect computedCSSContentBoxRect() const { return LayoutRect(borderLeft(
) + computedCSSPaddingLeft(), borderTop() + computedCSSPaddingTop(), clientWidth
() - computedCSSPaddingLeft() - computedCSSPaddingRight(), clientHeight() - comp
utedCSSPaddingTop() - computedCSSPaddingBottom()); } |
| 167 | 178 |
| 168 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& addition
alOffset, const RenderLayerModelObject* paintContainer = 0) const override; | 179 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& addition
alOffset, const RenderBox* paintContainer = 0) const override; |
| 169 | 180 |
| 170 // Use this with caution! No type checking is done! | 181 // Use this with caution! No type checking is done! |
| 171 RenderBox* previousSiblingBox() const; | 182 RenderBox* previousSiblingBox() const; |
| 172 RenderBox* nextSiblingBox() const; | 183 RenderBox* nextSiblingBox() const; |
| 173 RenderBox* parentBox() const; | 184 RenderBox* parentBox() const; |
| 174 | 185 |
| 175 // Visual and layout overflow are in the coordinate space of the box. This
means that they aren't purely physical directions. | 186 // Visual and layout overflow are in the coordinate space of the box. This
means that they aren't purely physical directions. |
| 176 // For horizontal-tb and vertical-lr they will match physical directions, bu
t for horizontal-bt and vertical-rl, the top/bottom and left/right | 187 // For horizontal-tb and vertical-lr they will match physical directions, bu
t for horizontal-bt and vertical-rl, the top/bottom and left/right |
| 177 // respectively are flipped when compared to their physical counterparts. F
or example minX is on the left in vertical-lr, | 188 // respectively are flipped when compared to their physical counterparts. F
or example minX is on the left in vertical-lr, |
| 178 // but it is on the right in vertical-rl. | 189 // but it is on the right in vertical-rl. |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 440 |
| 430 virtual bool hasRelativeLogicalHeight() const; | 441 virtual bool hasRelativeLogicalHeight() const; |
| 431 | 442 |
| 432 bool hasSameDirectionAs(const RenderBox* object) const { return style()->dir
ection() == object->style()->direction(); } | 443 bool hasSameDirectionAs(const RenderBox* object) const { return style()->dir
ection() == object->style()->direction(); } |
| 433 | 444 |
| 434 protected: | 445 protected: |
| 435 virtual void willBeDestroyed() override; | 446 virtual void willBeDestroyed() override; |
| 436 | 447 |
| 437 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) o
verride; | 448 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) o
verride; |
| 438 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov
erride; | 449 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov
erride; |
| 439 virtual void updateFromStyle() override; | |
| 440 | 450 |
| 441 void paintBackground(const PaintInfo&, const LayoutRect&, const Color& backg
roundColor, BackgroundBleedAvoidance = BackgroundBleedNone); | 451 void paintBackground(const PaintInfo&, const LayoutRect&, const Color& backg
roundColor, BackgroundBleedAvoidance = BackgroundBleedNone); |
| 442 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer&, const
LayoutRect&, BackgroundBleedAvoidance, RenderObject* backgroundObject, bool skip
BaseColor = false); | 452 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer&, const
LayoutRect&, BackgroundBleedAvoidance, RenderObject* backgroundObject, bool skip
BaseColor = false); |
| 443 void paintFillLayers(const PaintInfo&, const Color&, const FillLayer&, const
LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone, RenderObject* back
groundObject = 0); | 453 void paintFillLayers(const PaintInfo&, const Color&, const FillLayer&, const
LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone, RenderObject* back
groundObject = 0); |
| 444 void paintBoxDecorationBackgroundWithRect(PaintInfo&, const LayoutPoint&, co
nst LayoutRect&); | 454 void paintBoxDecorationBackgroundWithRect(PaintInfo&, const LayoutPoint&, co
nst LayoutRect&); |
| 445 | 455 |
| 446 // Information extracted from RenderStyle for box painting. | 456 // Information extracted from RenderStyle for box painting. |
| 447 // These are always needed during box painting and recomputing them takes ti
me. | 457 // These are always needed during box painting and recomputing them takes ti
me. |
| 448 struct BoxDecorationData { | 458 struct BoxDecorationData { |
| 449 BoxDecorationData(const RenderStyle&); | 459 BoxDecorationData(const RenderStyle&); |
| 450 | 460 |
| 451 Color backgroundColor; | 461 Color backgroundColor; |
| 452 bool hasBackground; | 462 bool hasBackground; |
| 453 bool hasBorder; | 463 bool hasBorder; |
| 454 }; | 464 }; |
| 455 | 465 |
| 456 BackgroundBleedAvoidance determineBackgroundBleedAvoidance(GraphicsContext*,
const BoxDecorationData&) const; | 466 BackgroundBleedAvoidance determineBackgroundBleedAvoidance(GraphicsContext*,
const BoxDecorationData&) const; |
| 457 bool backgroundHasOpaqueTopLayer() const; | 467 bool backgroundHasOpaqueTopLayer() const; |
| 458 | 468 |
| 459 void computePositionedLogicalWidth(LogicalExtentComputedValues&) const; | 469 void computePositionedLogicalWidth(LogicalExtentComputedValues&) const; |
| 460 | 470 |
| 461 LayoutUnit computeIntrinsicLogicalWidthUsing(const Length& logicalWidthLengt
h, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const; | 471 LayoutUnit computeIntrinsicLogicalWidthUsing(const Length& logicalWidthLengt
h, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const; |
| 462 LayoutUnit computeIntrinsicLogicalContentHeightUsing(const Length& logicalHe
ightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPadding) cons
t; | 472 LayoutUnit computeIntrinsicLogicalContentHeightUsing(const Length& logicalHe
ightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPadding) cons
t; |
| 463 | 473 |
| 464 virtual bool shouldComputeSizeAsReplaced() const { return isReplaced() && !i
sInlineBlock(); } | 474 virtual bool shouldComputeSizeAsReplaced() const { return isReplaced() && !i
sInlineBlock(); } |
| 465 | 475 |
| 466 virtual void mapLocalToContainer(const RenderLayerModelObject* paintInvalida
tionContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip) const
override; | 476 virtual void mapLocalToContainer(const RenderBox* paintInvalidationContainer
, TransformState&, MapCoordinatesFlags = ApplyContainerFlip) const override; |
| 467 | 477 |
| 468 void paintRootBoxFillLayers(const PaintInfo&); | 478 void paintRootBoxFillLayers(const PaintInfo&); |
| 469 | 479 |
| 470 RenderObject* splitAnonymousBoxesAroundChild(RenderObject* beforeChild); | 480 RenderObject* splitAnonymousBoxesAroundChild(RenderObject* beforeChild); |
| 471 | 481 |
| 472 void updateIntrinsicContentLogicalHeight(LayoutUnit intrinsicContentLogicalH
eight) const { m_intrinsicContentLogicalHeight = intrinsicContentLogicalHeight;
} | 482 void updateIntrinsicContentLogicalHeight(LayoutUnit intrinsicContentLogicalH
eight) const { m_intrinsicContentLogicalHeight = intrinsicContentLogicalHeight;
} |
| 473 | 483 |
| 474 private: | 484 private: |
| 485 void updateFromStyle(); |
| 486 |
| 475 PassRefPtr<HitTestingTransformState> createLocalTransformState( | 487 PassRefPtr<HitTestingTransformState> createLocalTransformState( |
| 476 RenderLayer* rootLayer, RenderLayer* containerLayer, | 488 RenderLayer* rootLayer, RenderLayer* containerLayer, |
| 477 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, | 489 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, |
| 478 const HitTestingTransformState* containerTransformState) const; | 490 const HitTestingTransformState* containerTransformState) const; |
| 479 bool hitTestNonLayerDescendants(const HitTestRequest& request, HitTestResult
& result, | 491 bool hitTestNonLayerDescendants(const HitTestRequest& request, HitTestResult
& result, |
| 480 const LayoutRect& layerBounds, const HitTestLocation& hitTestLocation); | 492 const LayoutRect& layerBounds, const HitTestLocation& hitTestLocation); |
| 481 | 493 |
| 482 void paintLayerContents(GraphicsContext* context, const LayerPaintingInfo& p
aintingInfo, const IntRect& rect); | 494 void paintLayerContents(GraphicsContext* context, const LayerPaintingInfo& p
aintingInfo, const IntRect& rect); |
| 483 | 495 |
| 484 void shrinkToFitWidth(const LayoutUnit availableSpace, const LayoutUnit logi
calLeftValue, const LayoutUnit bordersPlusPadding, LogicalExtentComputedValues&)
const; | 496 void shrinkToFitWidth(const LayoutUnit availableSpace, const LayoutUnit logi
calLeftValue, const LayoutUnit bordersPlusPadding, LogicalExtentComputedValues&)
const; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 // The preferred logical width of the element if it were to break its lines
at every possible opportunity. | 547 // The preferred logical width of the element if it were to break its lines
at every possible opportunity. |
| 536 LayoutUnit m_minPreferredLogicalWidth; | 548 LayoutUnit m_minPreferredLogicalWidth; |
| 537 | 549 |
| 538 // The preferred logical width of the element if it never breaks any lines a
t all. | 550 // The preferred logical width of the element if it never breaks any lines a
t all. |
| 539 LayoutUnit m_maxPreferredLogicalWidth; | 551 LayoutUnit m_maxPreferredLogicalWidth; |
| 540 | 552 |
| 541 // Our overflow information. | 553 // Our overflow information. |
| 542 OwnPtr<RenderOverflow> m_overflow; | 554 OwnPtr<RenderOverflow> m_overflow; |
| 543 | 555 |
| 544 private: | 556 private: |
| 557 OwnPtr<RenderLayer> m_layer; |
| 545 OwnPtr<RenderBoxRareData> m_rareData; | 558 OwnPtr<RenderBoxRareData> m_rareData; |
| 546 }; | 559 }; |
| 547 | 560 |
| 548 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBox, isBox()); | 561 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBox, isBox()); |
| 549 | 562 |
| 550 inline RenderBox* RenderBox::previousSiblingBox() const | 563 inline RenderBox* RenderBox::previousSiblingBox() const |
| 551 { | 564 { |
| 552 return toRenderBox(previousSibling()); | 565 return toRenderBox(previousSibling()); |
| 553 } | 566 } |
| 554 | 567 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 583 if (UNLIKELY(inlineBoxWrapper() != 0)) | 596 if (UNLIKELY(inlineBoxWrapper() != 0)) |
| 584 deleteLineBoxWrapper(); | 597 deleteLineBoxWrapper(); |
| 585 } | 598 } |
| 586 | 599 |
| 587 ensureRareData().m_inlineBoxWrapper = boxWrapper; | 600 ensureRareData().m_inlineBoxWrapper = boxWrapper; |
| 588 } | 601 } |
| 589 | 602 |
| 590 } // namespace blink | 603 } // namespace blink |
| 591 | 604 |
| 592 #endif // SKY_ENGINE_CORE_RENDERING_RENDERBOX_H_ | 605 #endif // SKY_ENGINE_CORE_RENDERING_RENDERBOX_H_ |
| OLD | NEW |