| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "core/paint/FieldsetPainter.h" | 5 #include "core/paint/FieldsetPainter.h" | 
| 6 | 6 | 
| 7 #include "core/layout/LayoutFieldset.h" | 7 #include "core/layout/LayoutFieldset.h" | 
| 8 #include "core/paint/BoxDecorationData.h" | 8 #include "core/paint/BoxDecorationData.h" | 
| 9 #include "core/paint/BoxPainter.h" | 9 #include "core/paint/BoxPainter.h" | 
| 10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 62         LayoutUnit clipLeft = paintRect.x(); | 62         LayoutUnit clipLeft = paintRect.x(); | 
| 63         LayoutUnit clipWidth = max(static_cast<LayoutUnit>(m_layoutFieldset.styl
     e()->borderLeftWidth()), legend->size().width()); | 63         LayoutUnit clipWidth = max(static_cast<LayoutUnit>(m_layoutFieldset.styl
     e()->borderLeftWidth()), legend->size().width()); | 
| 64         graphicsContext.clipOut(pixelSnappedIntRect(clipLeft, paintRect.y() + le
     gend->location().y(), clipWidth, legend->size().height())); | 64         graphicsContext.clipOut(pixelSnappedIntRect(clipLeft, paintRect.y() + le
     gend->location().y(), clipWidth, legend->size().height())); | 
| 65     } | 65     } | 
| 66 | 66 | 
| 67     BoxPainter::paintBorder(m_layoutFieldset, paintInfo, paintRect, m_layoutFiel
     dset.styleRef()); | 67     BoxPainter::paintBorder(m_layoutFieldset, paintInfo, paintRect, m_layoutFiel
     dset.styleRef()); | 
| 68 } | 68 } | 
| 69 | 69 | 
| 70 void FieldsetPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoint& p
     aintOffset) | 70 void FieldsetPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoint& p
     aintOffset) | 
| 71 { | 71 { | 
| 72     if (m_layoutFieldset.style()->visibility() != VISIBLE || paintInfo.phase != 
     PaintPhaseMask) | 72     if (m_layoutFieldset.style()->visibility() != EVisibility::Visible || paintI
     nfo.phase != PaintPhaseMask) | 
| 73         return; | 73         return; | 
| 74 | 74 | 
| 75     LayoutRect paintRect = LayoutRect(paintOffset, m_layoutFieldset.size()); | 75     LayoutRect paintRect = LayoutRect(paintOffset, m_layoutFieldset.size()); | 
| 76     LayoutBox* legend = m_layoutFieldset.findInFlowLegend(); | 76     LayoutBox* legend = m_layoutFieldset.findInFlowLegend(); | 
| 77     if (!legend) | 77     if (!legend) | 
| 78         return BoxPainter(m_layoutFieldset).paintMask(paintInfo, paintOffset); | 78         return BoxPainter(m_layoutFieldset).paintMask(paintInfo, paintOffset); | 
| 79 | 79 | 
| 80     if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
     t, m_layoutFieldset, paintInfo.phase)) | 80     if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
     t, m_layoutFieldset, paintInfo.phase)) | 
| 81         return; | 81         return; | 
| 82 | 82 | 
| 83     // FIXME: We need to work with "rl" and "bt" block flow directions.  In thos
     e | 83     // FIXME: We need to work with "rl" and "bt" block flow directions.  In thos
     e | 
| 84     // cases the legend is embedded in the right and bottom borders respectively
     . | 84     // cases the legend is embedded in the right and bottom borders respectively
     . | 
| 85     // https://bugs.webkit.org/show_bug.cgi?id=47236 | 85     // https://bugs.webkit.org/show_bug.cgi?id=47236 | 
| 86     if (m_layoutFieldset.style()->isHorizontalWritingMode()) { | 86     if (m_layoutFieldset.style()->isHorizontalWritingMode()) { | 
| 87         LayoutUnit yOff = (legend->location().y() > LayoutUnit()) ? LayoutUnit()
      : (legend->size().height() - m_layoutFieldset.borderTop()) / 2; | 87         LayoutUnit yOff = (legend->location().y() > LayoutUnit()) ? LayoutUnit()
      : (legend->size().height() - m_layoutFieldset.borderTop()) / 2; | 
| 88         paintRect.expand(LayoutUnit(), -yOff); | 88         paintRect.expand(LayoutUnit(), -yOff); | 
| 89         paintRect.move(LayoutUnit(), yOff); | 89         paintRect.move(LayoutUnit(), yOff); | 
| 90     } else { | 90     } else { | 
| 91         LayoutUnit xOff = (legend->location().x() > LayoutUnit()) ? LayoutUnit()
      : (legend->size().width() - m_layoutFieldset.borderLeft()) / 2; | 91         LayoutUnit xOff = (legend->location().x() > LayoutUnit()) ? LayoutUnit()
      : (legend->size().width() - m_layoutFieldset.borderLeft()) / 2; | 
| 92         paintRect.expand(-xOff, LayoutUnit()); | 92         paintRect.expand(-xOff, LayoutUnit()); | 
| 93         paintRect.move(xOff, LayoutUnit()); | 93         paintRect.move(xOff, LayoutUnit()); | 
| 94     } | 94     } | 
| 95 | 95 | 
| 96     LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFieldset, pa
     intInfo.phase, paintRect); | 96     LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFieldset, pa
     intInfo.phase, paintRect); | 
| 97     BoxPainter(m_layoutFieldset).paintMaskImages(paintInfo, paintRect); | 97     BoxPainter(m_layoutFieldset).paintMaskImages(paintInfo, paintRect); | 
| 98 } | 98 } | 
| 99 | 99 | 
| 100 } // namespace blink | 100 } // namespace blink | 
| OLD | NEW | 
|---|