Commit a73a0e10 authored by pilgrim@chromium.org's avatar pilgrim@chromium.org

[Line Layout API] Convert most of InlineBoxPainter to new API

This CL adds two necessary methods to the line layout API and updates callers
to use them.

1. LineLayoutBoxModel::boxShadowShouldBeAppliedToBackground
2. LineLayoutItem::enclosingBoxModelObject (implemented in LineLayoutBoxModel.h
   to avoid pulling LayoutBoxModel into LineLayoutItem)

BUG=499321

Review URL: https://codereview.chromium.org/1303303002

git-svn-id: svn://svn.chromium.org/blink/trunk@201013 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent dac67a13
...@@ -133,11 +133,21 @@ public: ...@@ -133,11 +133,21 @@ public:
return toBoxModel()->borderAndPaddingLogicalHeight(); return toBoxModel()->borderAndPaddingLogicalHeight();
} }
bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox* inlineFlowBox = nullptr) const
{
return toBoxModel()->boxShadowShouldBeAppliedToBackground(bleedAvoidance, inlineFlowBox);
}
private: private:
LayoutBoxModelObject* toBoxModel() { return toLayoutBoxModelObject(layoutObject()); } LayoutBoxModelObject* toBoxModel() { return toLayoutBoxModelObject(layoutObject()); }
const LayoutBoxModelObject* toBoxModel() const { return toLayoutBoxModelObject(layoutObject()); } const LayoutBoxModelObject* toBoxModel() const { return toLayoutBoxModelObject(layoutObject()); }
}; };
inline LineLayoutBoxModel LineLayoutItem::enclosingBoxModelObject() const
{
return LineLayoutBoxModel(layoutObject()->enclosingBoxModelObject());
}
} // namespace blink } // namespace blink
#endif // LineLayoutBoxModel_h #endif // LineLayoutBoxModel_h
...@@ -18,6 +18,7 @@ class HitTestRequest; ...@@ -18,6 +18,7 @@ class HitTestRequest;
class HitTestLocation; class HitTestLocation;
class LayoutObject; class LayoutObject;
class LineLayoutBox; class LineLayoutBox;
class LineLayoutBoxModel;
enum HitTestFilter; enum HitTestFilter;
...@@ -61,10 +62,15 @@ public: ...@@ -61,10 +62,15 @@ public:
} }
// Implemented in LineLayoutBox.h // Implemented in LineLayoutBox.h
// Intentionally returns a Box instead of a Block to avoid exposing LayoutBlock // Intentionally returns a LineLayoutBox to avoid exposing LayoutBlock
// to the line layout code. // to the line layout code.
LineLayoutBox containingBlock() const; LineLayoutBox containingBlock() const;
// Implemented in LineLayoutBoxModel.h
// Intentionally returns a LineLayoutBoxModel to avoid exposing LayoutBoxModelObject
// to the line layout code.
LineLayoutBoxModel enclosingBoxModelObject() const;
LineLayoutItem container() const LineLayoutItem container() const
{ {
return LineLayoutItem(m_layoutObject->container()); return LineLayoutItem(m_layoutObject->container());
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "core/layout/LayoutBlock.h" #include "core/layout/LayoutBlock.h"
#include "core/layout/LayoutInline.h" #include "core/layout/LayoutInline.h"
#include "core/layout/LayoutView.h" #include "core/layout/LayoutView.h"
#include "core/layout/api/LineLayoutBoxModel.h"
#include "core/layout/api/SelectionState.h" #include "core/layout/api/SelectionState.h"
#include "core/layout/line/InlineFlowBox.h" #include "core/layout/line/InlineFlowBox.h"
#include "core/paint/BoxPainter.h" #include "core/paint/BoxPainter.h"
...@@ -44,8 +45,8 @@ void InlineFlowBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& ...@@ -44,8 +45,8 @@ void InlineFlowBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint&
containingBlockPaintsContinuationOutline = false; containingBlockPaintsContinuationOutline = false;
} else { } else {
cb = enclosingAnonymousBlock->containingBlock(); cb = enclosingAnonymousBlock->containingBlock();
for (LayoutBoxModelObject* box = m_inlineFlowBox.deprecatedBoxModelObject(); box != cb; box = box->parent()->enclosingBoxModelObject()) { for (LineLayoutBoxModel box = m_inlineFlowBox.boxModelObject(); box != cb; box = box.parent().enclosingBoxModelObject()) {
if (box->hasSelfPaintingLayer()) { if (box.hasSelfPaintingLayer()) {
containingBlockPaintsContinuationOutline = false; containingBlockPaintsContinuationOutline = false;
break; break;
} }
...@@ -84,7 +85,7 @@ void InlineFlowBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& ...@@ -84,7 +85,7 @@ void InlineFlowBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint&
childInfo.updatePaintingRootForChildren(&m_inlineFlowBox.layoutObject()); childInfo.updatePaintingRootForChildren(&m_inlineFlowBox.layoutObject());
for (InlineBox* curr = m_inlineFlowBox.firstChild(); curr; curr = curr->nextOnLine()) { for (InlineBox* curr = m_inlineFlowBox.firstChild(); curr; curr = curr->nextOnLine()) {
if (curr->layoutObject().isText() || !curr->deprecatedBoxModelObject()->hasSelfPaintingLayer()) if (curr->lineLayoutItem().isText() || !curr->boxModelObject().hasSelfPaintingLayer())
curr->paint(childInfo, paintOffset, lineTop, lineBottom); curr->paint(childInfo, paintOffset, lineTop, lineBottom);
} }
} }
...@@ -249,7 +250,7 @@ void InlineFlowBoxPainter::paintBoxDecorationBackground(const PaintInfo& paintIn ...@@ -249,7 +250,7 @@ void InlineFlowBoxPainter::paintBoxDecorationBackground(const PaintInfo& paintIn
BorderPaintingType borderPaintingType = getBorderPaintType(adjustedFrameRect, adjustedClipRect); BorderPaintingType borderPaintingType = getBorderPaintType(adjustedFrameRect, adjustedClipRect);
// Shadow comes first and is behind the background and border. // Shadow comes first and is behind the background and border.
if (!m_inlineFlowBox.deprecatedBoxModelObject()->boxShadowShouldBeAppliedToBackground(BackgroundBleedNone, &m_inlineFlowBox)) if (!m_inlineFlowBox.boxModelObject().boxShadowShouldBeAppliedToBackground(BackgroundBleedNone, &m_inlineFlowBox))
paintBoxShadow(paintInfo, *styleToUse, Normal, adjustedFrameRect); paintBoxShadow(paintInfo, *styleToUse, Normal, adjustedFrameRect);
Color backgroundColor = m_inlineFlowBox.layoutObject().resolveColor(*styleToUse, CSSPropertyBackgroundColor); Color backgroundColor = m_inlineFlowBox.layoutObject().resolveColor(*styleToUse, CSSPropertyBackgroundColor);
...@@ -291,7 +292,7 @@ void InlineFlowBoxPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoi ...@@ -291,7 +292,7 @@ void InlineFlowBoxPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoi
// Figure out if we need to push a transparency layer to render our mask. // Figure out if we need to push a transparency layer to render our mask.
bool pushTransparencyLayer = false; bool pushTransparencyLayer = false;
bool compositedMask = m_inlineFlowBox.layoutObject().hasLayer() && m_inlineFlowBox.deprecatedBoxModelObject()->layer()->hasCompositedMask(); bool compositedMask = m_inlineFlowBox.layoutObject().hasLayer() && m_inlineFlowBox.boxModelObject().layer()->hasCompositedMask();
bool flattenCompositingLayers = paintInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayers; bool flattenCompositingLayers = paintInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayers;
SkXfermode::Mode compositeOp = SkXfermode::kSrcOver_Mode; SkXfermode::Mode compositeOp = SkXfermode::kSrcOver_Mode;
if (!compositedMask || flattenCompositingLayers) { if (!compositedMask || flattenCompositingLayers) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment