Changeset 94912 in webkit


Ignore:
Timestamp:
Sep 10, 2011 2:08:05 PM (13 years ago)
Author:
hyatt@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=67861

Implement border-image-outset (and the mask equivalents).

Reviewed by Beth Dakin.

Source/WebCore:

Added new tests in fast/borders and fast/reflections.

  • css/CSSBorderImageValue.cpp:

(WebCore::CSSBorderImageValue::CSSBorderImageValue):
(WebCore::CSSBorderImageValue::cssText):

  • css/CSSBorderImageValue.h:

(WebCore::CSSBorderImageValue::create):
Add m_outset field to CSSBorderImageValue and teach it how to dump the field as
part of cssText().

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::valueForNinePieceImageQuad):
(WebCore::valueForNinePieceImage):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
Add support for border-image-outset and -webkit-mask-box-image-outset. Refactor
the code so that border-image-width and border-image-outset use a common
function.

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseValue):
(WebCore::BorderImageParseContext::BorderImageParseContext):
(WebCore::BorderImageParseContext::allowOutset):
(WebCore::BorderImageParseContext::commitSlash):
(WebCore::BorderImageParseContext::commitBorderWidth):
(WebCore::BorderImageParseContext::commitBorderOutset):
(WebCore::BorderImageParseContext::commitRepeat):
(WebCore::BorderImageParseContext::commitBorderImage):
(WebCore::CSSParser::parseBorderImage):
Teach the border image parsing code about outsets. This code will soon be
replaced by true shorthand parsing code, but for now keep it working and add
outset support to it.

(WebCore::BorderImageQuadParseContext::BorderImageQuadParseContext):
(WebCore::BorderImageQuadParseContext::commitBorderImageQuad):
(WebCore::CSSParser::parseBorderImageQuad):
(WebCore::CSSParser::parseBorderImageWidth):
(WebCore::CSSParser::parseBorderImageOutset):

  • css/CSSParser.h:

Refactor the border-image-width code so that it can be shared by border-image-outset, since
they are extremely similar.

  • css/CSSPropertyNames.in:

Add the new properties.

  • css/CSSStyleSelector.cpp:

(WebCore::CSSStyleSelector::applyProperty):
(WebCore::CSSStyleSelector::mapNinePieceImage):
(WebCore::CSSStyleSelector::mapNinePieceImageQuad):
(WebCore::CSSStyleSelector::loadPendingImages):

  • css/CSSStyleSelector.h:

Refactor the code so that width/outset share common mapping functions. Add support for outset.

  • rendering/InlineFlowBox.cpp:

(WebCore::InlineFlowBox::addToLine):
(WebCore::InlineFlowBox::addBoxShadowVisualOverflow):
(WebCore::InlineFlowBox::addBorderOutsetVisualOverflow):
(WebCore::InlineFlowBox::computeOverflow):
Add new functions for computing the visual overflow caused by border outsets. Fix bugs in
the shadow overflow code as well.

(WebCore::clipRectForNinePieceImageStrip):
(WebCore::InlineFlowBox::paintBoxDecorations):
(WebCore::InlineFlowBox::paintMask):

  • rendering/InlineFlowBox.h:

Make sure the clip rect pushed when painting one piece of a split inline strip is expanded to
include the border and mask outsets. Always include the block direction expansion, and conditionally
include the inline direction expansion based off includeLogicalLeftEdge()/includeLogicalRightEdge().
clipRectForNinePieceImageStrip is a common function shared by masks and border images that does this
work.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::computeOverflow):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::maskClipRect):
(WebCore::RenderBox::addBoxShadowAndBorderOverflow):

  • rendering/RenderBox.h:

Rename addShadowOverflow to addBoxShadowAndBorderOverflow. Have it compute both shadow and border image
outset overflow. Fix bugs with shadow overflow computation.

  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::paintNinePieceImage):
Change painting to apply the outsets to inflate the border image drawing area.

  • rendering/RenderEmbeddedObject.cpp:

(WebCore::RenderEmbeddedObject::layout):

  • rendering/RenderIFrame.cpp:

(WebCore::RenderIFrame::layout):
Patched to call the renamed addBoxShadowAndBorderOverflow function instead of addShadowOverflow.

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::calculateRects):
Patched to no longer apply box-shadow to overflow clip areas when inflating the intersection area for the
layer bounds. Instead we generically apply all visual overflow so that border image outsets will also be
included. This fixes https://bugs.webkit.org/show_bug.cgi?id=37467.

  • rendering/RenderReplaced.cpp:

(WebCore::RenderReplaced::layout):
Patched to call the renamed addBoxShadowAndBorderOverflow function instead of addShadowOverflow.

  • rendering/style/NinePieceImage.cpp:

(WebCore::NinePieceImage::operator==):

  • rendering/style/NinePieceImage.h:

(WebCore::NinePieceImage::NinePieceImage):
(WebCore::NinePieceImage::outset):
(WebCore::NinePieceImage::setOutset):
(WebCore::NinePieceImage::computeOutset):
(WebCore::NinePieceImage::copyOutsetFrom):
Add the outset field to NinePieceImage along with some helpers for manipulating outsets.

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::getImageOutsets):
(WebCore::RenderStyle::getImageHorizontalOutsets):
(WebCore::RenderStyle::getImageVerticalOutsets):

  • rendering/style/RenderStyle.h:

(WebCore::InheritedFlags::hasBorderImageOutsets):
(WebCore::InheritedFlags::getBorderImageOutsets):
(WebCore::InheritedFlags::getBorderImageHorizontalOutsets):
(WebCore::InheritedFlags::getBorderImageVerticalOutsets):
(WebCore::InheritedFlags::getBorderImageInlineDirectionOutsets):
(WebCore::InheritedFlags::getBorderImageBlockDirectionOutsets):
(WebCore::InheritedFlags::getImageInlineDirectionOutsets):
(WebCore::InheritedFlags::getImageBlockDirectionOutsets):
Helpers for outset computation used by painting and overflow functions.

LayoutTests:

  • fast/borders/block-mask-overlay-image-outset.html: Added.
  • fast/borders/block-mask-overlay-image.html~: Added.
  • fast/borders/border-image-outset-in-shorthand.html: Added.
  • fast/borders/border-image-outset-split-inline-vertical-lr.html: Added.
  • fast/borders/border-image-outset-split-inline.html: Added.
  • fast/borders/border-image-outset.html: Added.
  • fast/borders/inline-mask-overlay-image-outset-vertical-rl.html: Added.
  • fast/borders/inline-mask-overlay-image-outset.html: Added.
  • fast/css/getComputedStyle/computed-style-expected.txt:
  • fast/css/getComputedStyle/computed-style-with-zoom-expected.txt:
  • fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
  • fast/css/getComputedStyle/getComputedStyle-border-image-expected.txt:
  • fast/reflections/reflection-computed-style-expected.txt:
  • fast/reflections/reflection-masks-outset.html: Added.
  • platform/mac/fast/borders/block-mask-overlay-image-outset-expected.png: Added.
  • platform/mac/fast/borders/block-mask-overlay-image-outset-expected.txt: Added.
  • platform/mac/fast/borders/border-image-outset-expected.png: Added.
  • platform/mac/fast/borders/border-image-outset-expected.txt: Added.
  • platform/mac/fast/borders/border-image-outset-in-shorthand-expected.png: Added.
  • platform/mac/fast/borders/border-image-outset-in-shorthand-expected.txt: Added.
  • platform/mac/fast/borders/border-image-outset-split-inline-expected.png: Added.
  • platform/mac/fast/borders/border-image-outset-split-inline-expected.txt: Added.
  • platform/mac/fast/borders/border-image-outset-split-inline-vertical-lr-expected.png: Added.
  • platform/mac/fast/borders/border-image-outset-split-inline-vertical-lr-expected.txt: Added.
  • platform/mac/fast/borders/inline-mask-overlay-image-outset-expected.png: Added.
  • platform/mac/fast/borders/inline-mask-overlay-image-outset-expected.txt: Added.
  • platform/mac/fast/borders/inline-mask-overlay-image-outset-vertical-rl-expected.png: Added.
  • platform/mac/fast/borders/inline-mask-overlay-image-outset-vertical-rl-expected.txt: Added.
  • platform/mac/fast/reflections/reflection-masks-outset-expected.png: Added.
  • platform/mac/fast/reflections/reflection-masks-outset-expected.txt: Added.
  • svg/css/getComputedStyle-basic-expected.txt:
Location:
trunk
Files:
25 added
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r94907 r94912  
     12011-09-09  David Hyatt  <hyatt@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=67861
     4       
     5        Implement border-image-outset (and the mask equivalents).
     6
     7        Reviewed by Beth Dakin.
     8
     9        * fast/borders/block-mask-overlay-image-outset.html: Added.
     10        * fast/borders/block-mask-overlay-image.html~: Added.
     11        * fast/borders/border-image-outset-in-shorthand.html: Added.
     12        * fast/borders/border-image-outset-split-inline-vertical-lr.html: Added.
     13        * fast/borders/border-image-outset-split-inline.html: Added.
     14        * fast/borders/border-image-outset.html: Added.
     15        * fast/borders/inline-mask-overlay-image-outset-vertical-rl.html: Added.
     16        * fast/borders/inline-mask-overlay-image-outset.html: Added.
     17        * fast/css/getComputedStyle/computed-style-expected.txt:
     18        * fast/css/getComputedStyle/computed-style-with-zoom-expected.txt:
     19        * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
     20        * fast/css/getComputedStyle/getComputedStyle-border-image-expected.txt:
     21        * fast/reflections/reflection-computed-style-expected.txt:
     22        * fast/reflections/reflection-masks-outset.html: Added.
     23        * platform/mac/fast/borders/block-mask-overlay-image-outset-expected.png: Added.
     24        * platform/mac/fast/borders/block-mask-overlay-image-outset-expected.txt: Added.
     25        * platform/mac/fast/borders/border-image-outset-expected.png: Added.
     26        * platform/mac/fast/borders/border-image-outset-expected.txt: Added.
     27        * platform/mac/fast/borders/border-image-outset-in-shorthand-expected.png: Added.
     28        * platform/mac/fast/borders/border-image-outset-in-shorthand-expected.txt: Added.
     29        * platform/mac/fast/borders/border-image-outset-split-inline-expected.png: Added.
     30        * platform/mac/fast/borders/border-image-outset-split-inline-expected.txt: Added.
     31        * platform/mac/fast/borders/border-image-outset-split-inline-vertical-lr-expected.png: Added.
     32        * platform/mac/fast/borders/border-image-outset-split-inline-vertical-lr-expected.txt: Added.
     33        * platform/mac/fast/borders/inline-mask-overlay-image-outset-expected.png: Added.
     34        * platform/mac/fast/borders/inline-mask-overlay-image-outset-expected.txt: Added.
     35        * platform/mac/fast/borders/inline-mask-overlay-image-outset-vertical-rl-expected.png: Added.
     36        * platform/mac/fast/borders/inline-mask-overlay-image-outset-vertical-rl-expected.txt: Added.
     37        * platform/mac/fast/reflections/reflection-masks-outset-expected.png: Added.
     38        * platform/mac/fast/reflections/reflection-masks-outset-expected.txt: Added.
     39        * svg/css/getComputedStyle-basic-expected.txt:
     40
    1412011-09-10  Csaba Osztrogonác  <ossy@webkit.org>
    242
  • trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt

    r94726 r94912  
    1515border-bottom-width: 0px;
    1616border-collapse: separate;
     17border-image-outset: 0px;
    1718border-image-repeat: stretch;
    1819border-image-slice: 100%;
     
    160161-webkit-mask-attachment: scroll;
    161162-webkit-mask-box-image: none;
     163-webkit-mask-box-image-outset: 0px;
    162164-webkit-mask-box-image-repeat: stretch;
    163165-webkit-mask-box-image-slice: 0;
  • trunk/LayoutTests/fast/css/getComputedStyle/computed-style-with-zoom-expected.txt

    r94593 r94912  
    66PASS -webkit-border-horizontal-spacing, value: "20px"
    77PASS -webkit-border-vertical-spacing, value: "20px"
    8 PASS -webkit-box-reflect, value: "below 20px -webkit-gradient(linear, 0% 0%, 0% 100%, from(transparent), to(white)) 0 fill / auto stretch"
     8PASS -webkit-box-reflect, value: "below 20px -webkit-gradient(linear, 0% 0%, 0% 100%, from(transparent), to(white)) 0 fill / auto / 0px stretch"
    99PASS -webkit-box-shadow, value: "rgb(255, 0, 0) 20px 20px 20px 20px"
    1010PASS -webkit-column-rule-width, value: "20px"
  • trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt

    r94726 r94912  
    1414    border-bottom-width: 0px
    1515    border-collapse: separate
     16    border-image-outset: 0px
    1617    border-image-repeat: stretch
    1718    border-image-slice: 100%
     
    159160    -webkit-mask-attachment: scroll
    160161    -webkit-mask-box-image: none
     162    -webkit-mask-box-image-outset: 0px
    161163    -webkit-mask-box-image-repeat: stretch
    162164    -webkit-mask-box-image-slice: 0
  • trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-image-expected.txt

    r94593 r94912  
    88-webkit-border-image: -webkit-gradient(linear, 0 0, 0 0) 25 25 25 25 stretch stretch;
    99  -webkit-border-image
    10     getPropertyValue:    -webkit-gradient(linear, 0 0, 0 0) 25 fill / 1 stretch
     10    getPropertyValue:    -webkit-gradient(linear, 0 0, 0 0) 25 fill / 1 / 0px stretch
    1111    getPropertyCSSValue: [object CSSValue]
    1212
    1313-webkit-border-image: -webkit-gradient(linear, 0 0, 0 0) 50 repeat;
    1414  -webkit-border-image
    15     getPropertyValue:    -webkit-gradient(linear, 0 0, 0 0) 50 fill / 1 repeat
     15    getPropertyValue:    -webkit-gradient(linear, 0 0, 0 0) 50 fill / 1 / 0px repeat
    1616    getPropertyCSSValue: [object CSSValue]
    1717
  • trunk/LayoutTests/fast/reflections/reflection-computed-style-expected.txt

    r94595 r94912  
    1818-webkit-box-reflect: below 5px -webkit-gradient(linear, 0 0, 0 0) 25 25 25 25 stretch stretch;
    1919  -webkit-box-reflect
    20     getPropertyValue:    below 5px -webkit-gradient(linear, 0 0, 0 0) 25 fill / auto stretch
     20    getPropertyValue:    below 5px -webkit-gradient(linear, 0 0, 0 0) 25 fill / auto / 0px stretch
    2121    getPropertyCSSValue: [object CSSValue]
    2222
  • trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt

    r94726 r94912  
    2727rect: style.getPropertyValue(border-collapse) : separate
    2828rect: style.getPropertyCSSValue(border-collapse) : [object CSSPrimitiveValue]
     29rect: style.getPropertyValue(border-image-outset) : 0px
     30rect: style.getPropertyCSSValue(border-image-outset) : [object CSSPrimitiveValue]
    2931rect: style.getPropertyValue(border-image-repeat) : stretch
    3032rect: style.getPropertyCSSValue(border-image-repeat) : [object CSSPrimitiveValue]
     
    317319rect: style.getPropertyValue(-webkit-mask-box-image) : none
    318320rect: style.getPropertyCSSValue(-webkit-mask-box-image) : [object CSSPrimitiveValue]
     321rect: style.getPropertyValue(-webkit-mask-box-image-outset) : 0px
     322rect: style.getPropertyCSSValue(-webkit-mask-box-image-outset) : [object CSSPrimitiveValue]
    319323rect: style.getPropertyValue(-webkit-mask-box-image-repeat) : stretch
    320324rect: style.getPropertyCSSValue(-webkit-mask-box-image-repeat) : [object CSSPrimitiveValue]
     
    503507g: style.getPropertyValue(border-collapse) : separate
    504508g: style.getPropertyCSSValue(border-collapse) : [object CSSPrimitiveValue]
     509g: style.getPropertyValue(border-image-outset) : 0px
     510g: style.getPropertyCSSValue(border-image-outset) : [object CSSPrimitiveValue]
    505511g: style.getPropertyValue(border-image-repeat) : stretch
    506512g: style.getPropertyCSSValue(border-image-repeat) : [object CSSPrimitiveValue]
     
    793799g: style.getPropertyValue(-webkit-mask-box-image) : none
    794800g: style.getPropertyCSSValue(-webkit-mask-box-image) : [object CSSPrimitiveValue]
     801g: style.getPropertyValue(-webkit-mask-box-image-outset) : 0px
     802g: style.getPropertyCSSValue(-webkit-mask-box-image-outset) : [object CSSPrimitiveValue]
    795803g: style.getPropertyValue(-webkit-mask-box-image-repeat) : stretch
    796804g: style.getPropertyCSSValue(-webkit-mask-box-image-repeat) : [object CSSPrimitiveValue]
  • trunk/Source/WebCore/ChangeLog

    r94911 r94912  
     12011-09-09  David Hyatt  <hyatt@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=67861
     4       
     5        Implement border-image-outset (and the mask equivalents).
     6
     7        Reviewed by Beth Dakin.
     8
     9        Added new tests in fast/borders and fast/reflections.
     10
     11        * css/CSSBorderImageValue.cpp:
     12        (WebCore::CSSBorderImageValue::CSSBorderImageValue):
     13        (WebCore::CSSBorderImageValue::cssText):
     14        * css/CSSBorderImageValue.h:
     15        (WebCore::CSSBorderImageValue::create):
     16        Add m_outset field to CSSBorderImageValue and teach it how to dump the field as
     17        part of cssText().
     18
     19        * css/CSSComputedStyleDeclaration.cpp:
     20        (WebCore::valueForNinePieceImageQuad):
     21        (WebCore::valueForNinePieceImage):
     22        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     23        Add support for border-image-outset and -webkit-mask-box-image-outset. Refactor
     24        the code so that border-image-width and border-image-outset use a common
     25        function.
     26
     27        * css/CSSParser.cpp:
     28        (WebCore::CSSParser::parseValue):
     29        (WebCore::BorderImageParseContext::BorderImageParseContext):
     30        (WebCore::BorderImageParseContext::allowOutset):
     31        (WebCore::BorderImageParseContext::commitSlash):
     32        (WebCore::BorderImageParseContext::commitBorderWidth):
     33        (WebCore::BorderImageParseContext::commitBorderOutset):
     34        (WebCore::BorderImageParseContext::commitRepeat):
     35        (WebCore::BorderImageParseContext::commitBorderImage):
     36        (WebCore::CSSParser::parseBorderImage):
     37        Teach the border image parsing code about outsets. This code will soon be
     38        replaced by true shorthand parsing code, but for now keep it working and add
     39        outset support to it.
     40
     41        (WebCore::BorderImageQuadParseContext::BorderImageQuadParseContext):
     42        (WebCore::BorderImageQuadParseContext::commitBorderImageQuad):
     43        (WebCore::CSSParser::parseBorderImageQuad):
     44        (WebCore::CSSParser::parseBorderImageWidth):
     45        (WebCore::CSSParser::parseBorderImageOutset):
     46        * css/CSSParser.h:
     47        Refactor the border-image-width code so that it can be shared by border-image-outset, since
     48        they are extremely similar.
     49
     50        * css/CSSPropertyNames.in:
     51        Add the new properties.
     52
     53        * css/CSSStyleSelector.cpp:
     54        (WebCore::CSSStyleSelector::applyProperty):
     55        (WebCore::CSSStyleSelector::mapNinePieceImage):
     56        (WebCore::CSSStyleSelector::mapNinePieceImageQuad):
     57        (WebCore::CSSStyleSelector::loadPendingImages):
     58        * css/CSSStyleSelector.h:
     59        Refactor the code so that width/outset share common mapping functions. Add support for outset.
     60
     61        * rendering/InlineFlowBox.cpp:
     62        (WebCore::InlineFlowBox::addToLine):
     63        (WebCore::InlineFlowBox::addBoxShadowVisualOverflow):
     64        (WebCore::InlineFlowBox::addBorderOutsetVisualOverflow):
     65        (WebCore::InlineFlowBox::computeOverflow):
     66        Add new functions for computing the visual overflow caused by border outsets. Fix bugs in
     67        the shadow overflow code as well.
     68
     69        (WebCore::clipRectForNinePieceImageStrip):
     70        (WebCore::InlineFlowBox::paintBoxDecorations):
     71        (WebCore::InlineFlowBox::paintMask):
     72        * rendering/InlineFlowBox.h:
     73        Make sure the clip rect pushed when painting one piece of a split inline strip is expanded to
     74        include the border and mask outsets. Always include the block direction expansion, and conditionally
     75        include the inline direction expansion based off includeLogicalLeftEdge()/includeLogicalRightEdge().
     76        clipRectForNinePieceImageStrip is a common function shared by masks and border images that does this
     77        work.
     78
     79        * rendering/RenderBlock.cpp:
     80        (WebCore::RenderBlock::computeOverflow):
     81        * rendering/RenderBox.cpp:
     82        (WebCore::RenderBox::maskClipRect):
     83        (WebCore::RenderBox::addBoxShadowAndBorderOverflow):
     84        * rendering/RenderBox.h:
     85        Rename addShadowOverflow to addBoxShadowAndBorderOverflow. Have it compute both shadow and border image
     86        outset overflow. Fix bugs with shadow overflow computation.
     87
     88        * rendering/RenderBoxModelObject.cpp:
     89        (WebCore::RenderBoxModelObject::paintNinePieceImage):
     90        Change painting to apply the outsets to inflate the border image drawing area.
     91
     92        * rendering/RenderEmbeddedObject.cpp:
     93        (WebCore::RenderEmbeddedObject::layout):
     94        * rendering/RenderIFrame.cpp:
     95        (WebCore::RenderIFrame::layout):
     96        Patched to call the renamed addBoxShadowAndBorderOverflow function instead of addShadowOverflow.
     97
     98        * rendering/RenderLayer.cpp:
     99        (WebCore::RenderLayer::calculateRects):
     100        Patched to no longer apply box-shadow to overflow clip areas when inflating the intersection area for the
     101        layer bounds. Instead we generically apply all visual overflow so that border image outsets will also be
     102        included. This fixes https://bugs.webkit.org/show_bug.cgi?id=37467.
     103
     104        * rendering/RenderReplaced.cpp:
     105        (WebCore::RenderReplaced::layout):
     106        Patched to call the renamed addBoxShadowAndBorderOverflow function instead of addShadowOverflow.
     107
     108        * rendering/style/NinePieceImage.cpp:
     109        (WebCore::NinePieceImage::operator==):
     110        * rendering/style/NinePieceImage.h:
     111        (WebCore::NinePieceImage::NinePieceImage):
     112        (WebCore::NinePieceImage::outset):
     113        (WebCore::NinePieceImage::setOutset):
     114        (WebCore::NinePieceImage::computeOutset):
     115        (WebCore::NinePieceImage::copyOutsetFrom):
     116        Add the outset field to NinePieceImage along with some helpers for manipulating outsets.
     117
     118        * rendering/style/RenderStyle.cpp:
     119        (WebCore::RenderStyle::getImageOutsets):
     120        (WebCore::RenderStyle::getImageHorizontalOutsets):
     121        (WebCore::RenderStyle::getImageVerticalOutsets):
     122        * rendering/style/RenderStyle.h:
     123        (WebCore::InheritedFlags::hasBorderImageOutsets):
     124        (WebCore::InheritedFlags::getBorderImageOutsets):
     125        (WebCore::InheritedFlags::getBorderImageHorizontalOutsets):
     126        (WebCore::InheritedFlags::getBorderImageVerticalOutsets):
     127        (WebCore::InheritedFlags::getBorderImageInlineDirectionOutsets):
     128        (WebCore::InheritedFlags::getBorderImageBlockDirectionOutsets):
     129        (WebCore::InheritedFlags::getImageInlineDirectionOutsets):
     130        (WebCore::InheritedFlags::getImageBlockDirectionOutsets):
     131        Helpers for outset computation used by painting and overflow functions.
     132
    11332011-09-10  Dan Bernstein  <mitz@apple.com>
    2134
  • trunk/Source/WebCore/css/CSSBorderImageValue.cpp

    r94593 r94912  
    2828
    2929CSSBorderImageValue::CSSBorderImageValue(PassRefPtr<CSSValue> image, PassRefPtr<CSSBorderImageSliceValue> imageSlice,
    30     PassRefPtr<CSSValue> borderSlice, PassRefPtr<CSSValue> repeat)
     30    PassRefPtr<CSSValue> borderSlice, PassRefPtr<CSSValue> outset, PassRefPtr<CSSValue> repeat)
    3131    : m_image(image)
    3232    , m_imageSlice(imageSlice)
    3333    , m_borderSlice(borderSlice)
     34    , m_outset(outset)
    3435    , m_repeat(repeat)
    3536{
     
    5556    }
    5657
     58    if (m_outset) {
     59        text += " / ";
     60        text += m_outset->cssText();
     61    }
     62
    5763    if (m_repeat) {
    5864        // Now the keywords.
  • trunk/Source/WebCore/css/CSSBorderImageValue.h

    r94593 r94912  
    3333public:
    3434    static PassRefPtr<CSSBorderImageValue> create(PassRefPtr<CSSValue> image, PassRefPtr<CSSBorderImageSliceValue> imageSlice,
    35         PassRefPtr<CSSValue> borderSlice, PassRefPtr<CSSValue> repeat)
     35        PassRefPtr<CSSValue> borderSlice, PassRefPtr<CSSValue> outset, PassRefPtr<CSSValue> repeat)
    3636    {
    37         return adoptRef(new CSSBorderImageValue(image, imageSlice, borderSlice, repeat));
     37        return adoptRef(new CSSBorderImageValue(image, imageSlice, borderSlice, outset, repeat));
    3838    }
    3939    virtual ~CSSBorderImageValue();
     
    5656    RefPtr<CSSValue> m_borderSlice;
    5757
     58    // The outset values are used to inflate the border image drawing area.
     59    RefPtr<CSSValue> m_outset;
     60
    5861    // Values for how to handle the scaling/stretching/tiling of the image slices.
    5962    RefPtr<CSSValue> m_repeat;
    6063
    6164private:
    62     CSSBorderImageValue(PassRefPtr<CSSValue> image, PassRefPtr<CSSBorderImageSliceValue>, PassRefPtr<CSSValue> borderSlice, PassRefPtr<CSSValue> repeat);
     65    CSSBorderImageValue(PassRefPtr<CSSValue> image, PassRefPtr<CSSBorderImageSliceValue>, PassRefPtr<CSSValue> borderSlice,
     66        PassRefPtr<CSSValue> outset, PassRefPtr<CSSValue> repeat);
    6367    virtual bool isBorderImageValue() const { return true; }
    6468};
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r94710 r94912  
    7575    CSSPropertyBorderBottomWidth,
    7676    CSSPropertyBorderCollapse,
     77    CSSPropertyBorderImageOutset,
    7778    CSSPropertyBorderImageRepeat,
    7879    CSSPropertyBorderImageSlice,
     
    230231    CSSPropertyWebkitMaskAttachment,
    231232    CSSPropertyWebkitMaskBoxImage,
     233    CSSPropertyWebkitMaskBoxImageOutset,
    232234    CSSPropertyWebkitMaskBoxImageRepeat,
    233235    CSSPropertyWebkitMaskBoxImageSlice,
     
    383385}
    384386
    385 static PassRefPtr<CSSPrimitiveValue> valueForNinePieceImageWidth(const NinePieceImage& image, CSSPrimitiveValueCache* primitiveValueCache)
     387static PassRefPtr<CSSPrimitiveValue> valueForNinePieceImageQuad(const LengthBox& box, CSSPrimitiveValueCache* primitiveValueCache)
    386388{
    387389    // Create the slices.
     
    391393    RefPtr<CSSPrimitiveValue> left;
    392394
    393     if (image.borderSlices().top().isRelative())
    394         top = primitiveValueCache->createValue(image.borderSlices().top().value(), CSSPrimitiveValue::CSS_NUMBER);
     395    if (box.top().isRelative())
     396        top = primitiveValueCache->createValue(box.top().value(), CSSPrimitiveValue::CSS_NUMBER);
    395397    else
    396         top = primitiveValueCache->createValue(image.borderSlices().top());
    397 
    398     if (image.borderSlices().right() == image.borderSlices().top() && image.borderSlices().bottom() == image.borderSlices().top()
    399         && image.borderSlices().left() == image.borderSlices().top()) {
     398        top = primitiveValueCache->createValue(box.top());
     399
     400    if (box.right() == box.top() && box.bottom() == box.top() && box.left() == box.top()) {
    400401        right = top;
    401402        bottom = top;
    402403        left = top;
    403404    } else {
    404         if (image.borderSlices().right().isRelative())
    405             right = primitiveValueCache->createValue(image.borderSlices().right().value(), CSSPrimitiveValue::CSS_NUMBER);
     405        if (box.right().isRelative())
     406            right = primitiveValueCache->createValue(box.right().value(), CSSPrimitiveValue::CSS_NUMBER);
    406407        else
    407             right = primitiveValueCache->createValue(image.borderSlices().right());
     408            right = primitiveValueCache->createValue(box.right());
    408409       
    409         if (image.borderSlices().bottom() == image.borderSlices().top() && image.borderSlices().right() == image.borderSlices().left()) {
     410        if (box.bottom() == box.top() && box.right() == box.left()) {
    410411            bottom = top;
    411412            right = left;
    412413        } else {
    413             if (image.borderSlices().bottom().isRelative())
    414                 bottom = primitiveValueCache->createValue(image.borderSlices().bottom().value(), CSSPrimitiveValue::CSS_NUMBER);
     414            if (box.bottom().isRelative())
     415                bottom = primitiveValueCache->createValue(box.bottom().value(), CSSPrimitiveValue::CSS_NUMBER);
    415416            else
    416                 bottom = primitiveValueCache->createValue(image.borderSlices().bottom());
     417                bottom = primitiveValueCache->createValue(box.bottom());
    417418   
    418             if (image.borderSlices().left() == image.borderSlices().right())
     419            if (box.left() == box.right())
    419420                left = right;
    420421            else {
    421                 if (image.borderSlices().left().isRelative())
    422                     left = primitiveValueCache->createValue(image.borderSlices().left().value(), CSSPrimitiveValue::CSS_NUMBER);
     422                if (box.left().isRelative())
     423                    left = primitiveValueCache->createValue(box.left().value(), CSSPrimitiveValue::CSS_NUMBER);
    423424                else
    424                     left = primitiveValueCache->createValue(image.borderSlices().left());
     425                    left = primitiveValueCache->createValue(box.left());
    425426            }
    426427        }
     
    463464   
    464465    // Create the border area slices.
    465     RefPtr<CSSValue> borderSlices = valueForNinePieceImageWidth(image, primitiveValueCache);
     466    RefPtr<CSSValue> borderSlices = valueForNinePieceImageQuad(image.borderSlices(), primitiveValueCache);
     467
     468    // Create the border outset.
     469    RefPtr<CSSValue> outset = valueForNinePieceImageQuad(image.outset(), primitiveValueCache);
    466470
    467471    // Create the repeat rules.
    468472    RefPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image, primitiveValueCache);
    469473
    470     return CSSBorderImageValue::create(imageValue.release(), imageSlices.release(), borderSlices.release(), repeat);
     474    return CSSBorderImageValue::create(imageValue.release(), imageSlices.release(), borderSlices.release(), outset.release(), repeat);
    471475}
    472476
     
    17001704        case CSSPropertyWebkitBorderImage:
    17011705            return valueForNinePieceImage(style->borderImage(), primitiveValueCache);
     1706        case CSSPropertyBorderImageOutset:
     1707            return valueForNinePieceImageQuad(style->borderImage().outset(), primitiveValueCache);
    17021708        case CSSPropertyBorderImageRepeat:
    17031709            return valueForNinePieceImageRepeat(style->borderImage(), primitiveValueCache);
     
    17051711            return valueForNinePieceImageSlice(style->borderImage(), primitiveValueCache);
    17061712        case CSSPropertyBorderImageWidth:
    1707             return valueForNinePieceImageWidth(style->borderImage(), primitiveValueCache);
     1713            return valueForNinePieceImageQuad(style->borderImage().borderSlices(), primitiveValueCache);
    17081714        case CSSPropertyWebkitMaskBoxImage:
    17091715            return valueForNinePieceImage(style->maskBoxImage(), primitiveValueCache);
     1716        case CSSPropertyWebkitMaskBoxImageOutset:
     1717            return valueForNinePieceImageQuad(style->maskBoxImage().outset(), primitiveValueCache);
    17101718        case CSSPropertyWebkitMaskBoxImageRepeat:
    17111719            return valueForNinePieceImageRepeat(style->maskBoxImage(), primitiveValueCache);
     
    17131721            return valueForNinePieceImageSlice(style->maskBoxImage(), primitiveValueCache);
    17141722        case CSSPropertyWebkitMaskBoxImageWidth:
    1715             return valueForNinePieceImageWidth(style->maskBoxImage(), primitiveValueCache);
     1723            return valueForNinePieceImageQuad(style->maskBoxImage().borderSlices(), primitiveValueCache);
    17161724        case CSSPropertyWebkitMaskBoxImageSource:
    17171725            if (style->maskBoxImageSource())
  • trunk/Source/WebCore/css/CSSParser.cpp

    r94710 r94912  
    14521452        break;
    14531453    }
     1454    case CSSPropertyBorderImageOutset:
     1455    case CSSPropertyWebkitMaskBoxImageOutset: {
     1456        RefPtr<CSSPrimitiveValue> result;
     1457        if (parseBorderImageOutset(result)) {
     1458            addProperty(propId, result, important);
     1459            return true;
     1460        }
     1461        break;
     1462    }
    14541463    case CSSPropertyBorderImageRepeat:
    14551464    case CSSPropertyWebkitMaskBoxImageRepeat: {
     
    14731482    case CSSPropertyWebkitMaskBoxImageWidth: {
    14741483        RefPtr<CSSPrimitiveValue> result;
    1475         if (parseBorderImageWidth(propId, result)) {
     1484        if (parseBorderImageWidth(result)) {
    14761485            addProperty(propId, result, important);
    14771486            return true;
     
    51525161    , m_allowSlash(false)
    51535162    , m_allowWidth(false)
     5163    , m_allowOutset(false)
    51545164    , m_allowRepeat(false)
    51555165    {}
     
    51585168    bool allowSlash() const { return m_allowSlash; }
    51595169    bool allowWidth() const { return m_allowWidth; }
     5170    bool allowOutset() const { return m_allowOutset; }
    51605171    bool allowRepeat() const { return m_allowRepeat; }
    51615172
     
    51665177        m_allowBreak = m_allowSlash = m_allowRepeat = true;
    51675178    }
    5168     void commitSlash() { m_allowBreak = m_allowSlash = m_allowRepeat = false; m_allowWidth = true; }
     5179    void commitSlash()
     5180    {
     5181        m_allowBreak = m_allowSlash = m_allowRepeat = false;
     5182        if (!m_borderSlice)
     5183            m_allowWidth = true;
     5184        else
     5185            m_allowOutset = true;
     5186    }
    51695187    void commitBorderWidth(PassRefPtr<CSSPrimitiveValue> slice)
    51705188    {
     
    51725190        m_allowBreak = m_allowRepeat = true;
    51735191        m_allowWidth = false;
     5192        m_allowSlash = true;
     5193    }
     5194    void commitBorderOutset(PassRefPtr<CSSPrimitiveValue> outset)
     5195    {
     5196        m_outset = outset;
     5197        m_allowBreak = m_allowRepeat = true;
     5198        m_allowWidth = m_allowOutset = m_allowSlash = false;
    51745199    }
    51755200    void commitRepeat(PassRefPtr<CSSValue> repeat)
    51765201    {
    51775202        m_repeat = repeat;
    5178         m_allowRepeat = m_allowSlash = m_allowWidth = false;
     5203        m_allowRepeat = m_allowSlash = m_allowWidth = m_allowOutset = false;
    51795204        m_allowBreak = true;
    51805205    }
     
    51835208    {
    51845209        // Make our new border image value now.
    5185         return CSSBorderImageValue::create(m_image, m_imageSlice, m_borderSlice, m_repeat);
     5210        return CSSBorderImageValue::create(m_image, m_imageSlice, m_borderSlice, m_outset, m_repeat);
    51865211    }
    51875212   
     
    51915216    bool m_allowSlash;
    51925217    bool m_allowWidth;
     5218    bool m_allowOutset;
    51935219    bool m_allowRepeat;
    51945220
     
    51965222    RefPtr<CSSBorderImageSliceValue> m_imageSlice;
    51975223    RefPtr<CSSPrimitiveValue> m_borderSlice;
     5224    RefPtr<CSSPrimitiveValue> m_outset;
    51985225
    51995226    RefPtr<CSSValue> m_repeat;
     
    52035230{
    52045231    // Look for an image initially. If the first value is not a URI or the keyword "none", then we're done.
     5232    ShorthandScope scope(this, propId);
    52055233    BorderImageParseContext context(primitiveValueCache());
    52065234    CSSParserValue* val = m_valueList->current();
     
    52325260        } else if (context.allowWidth()) {
    52335261            RefPtr<CSSPrimitiveValue> borderSlice;
    5234             if (!parseBorderImageWidth(propId, borderSlice))
     5262            if (!parseBorderImageWidth(borderSlice))
    52355263                return false;
    52365264            context.commitBorderWidth(borderSlice.release());
     5265            continue;
     5266        } else if (context.allowOutset()) {
     5267            RefPtr<CSSPrimitiveValue> borderOutset;
     5268            if (!parseBorderImageOutset(borderOutset))
     5269                return false;
     5270            context.commitBorderOutset(borderOutset.release());
    52375271            continue;
    52385272        } else if (context.allowRepeat()) {
     
    54025436}
    54035437
    5404 class BorderImageWidthParseContext {
     5438class BorderImageQuadParseContext {
    54055439public:
    5406     BorderImageWidthParseContext(CSSPrimitiveValueCache* primitiveValueCache)
     5440    BorderImageQuadParseContext(CSSPrimitiveValueCache* primitiveValueCache)
    54075441    : m_primitiveValueCache(primitiveValueCache)
    54085442    , m_allowNumber(true)
     
    54405474    void setTop(PassRefPtr<CSSPrimitiveValue> val) { m_top = val; }
    54415475
    5442     PassRefPtr<CSSPrimitiveValue> commitBorderImageWidth()
     5476    PassRefPtr<CSSPrimitiveValue> commitBorderImageQuad()
    54435477    {
    54445478        // We need to clone and repeat values for any omissions.
     
    54795513};
    54805514
    5481 bool CSSParser::parseBorderImageWidth(int propId, RefPtr<CSSPrimitiveValue>& result)
    5482 {
    5483     BorderImageWidthParseContext context(primitiveValueCache());
     5515bool CSSParser::parseBorderImageQuad(Units validUnits, RefPtr<CSSPrimitiveValue>& result)
     5516{
     5517    BorderImageQuadParseContext context(primitiveValueCache());
    54845518    CSSParserValue* val;
    54855519    while ((val = m_valueList->current())) {
    5486         if (context.allowNumber() && (validUnit(val, FLength | FInteger | FNonNeg | FPercent, true) || val->id == CSSValueAuto)) {
     5520        if (context.allowNumber() && (validUnit(val, validUnits, true) || val->id == CSSValueAuto)) {
    54875521            context.commitNumber(val);
    5488         } else if (propId == CSSPropertyBorderImageWidth || propId == CSSPropertyWebkitMaskBoxImageWidth) {
     5522        } else if (!inShorthand()) {
    54895523            // If we're not parsing a shorthand then we are invalid.
    54905524            return false;
     
    54965530    if (context.allowFinalCommit()) {
    54975531        // Need to fully commit as a single value.
    5498         result = context.commitBorderImageWidth();
     5532        result = context.commitBorderImageQuad();
    54995533        return true;
    55005534    }
    55015535    return false;
     5536}
     5537
     5538bool CSSParser::parseBorderImageWidth(RefPtr<CSSPrimitiveValue>& result)
     5539{
     5540    return parseBorderImageQuad(FLength | FInteger | FNonNeg | FPercent, result);
     5541}
     5542
     5543bool CSSParser::parseBorderImageOutset(RefPtr<CSSPrimitiveValue>& result)
     5544{
     5545    return parseBorderImageQuad(FLength | FInteger | FNonNeg, result);
    55025546}
    55035547
  • trunk/Source/WebCore/css/CSSParser.h

    r94593 r94912  
    170170    bool parseBorderImageRepeat(RefPtr<CSSValue>&);
    171171    bool parseBorderImageSlice(int propId, RefPtr<CSSBorderImageSliceValue>&);
    172     bool parseBorderImageWidth(int propId, RefPtr<CSSPrimitiveValue>&);
     172    bool parseBorderImageWidth(RefPtr<CSSPrimitiveValue>&);
     173    bool parseBorderImageOutset(RefPtr<CSSPrimitiveValue>&);
    173174    bool parseBorderRadius(int propId, bool important);
    174175
     
    374375    static bool validUnit(CSSParserValue*, Units, bool strict);
    375376
     377    bool parseBorderImageQuad(Units, RefPtr<CSSPrimitiveValue>&);
     378   
    376379    PassRefPtr<CSSPrimitiveValue> createPrimitiveNumericValue(CSSParserValue*);
    377380    PassRefPtr<CSSPrimitiveValue> createPrimitiveStringValue(CSSParserValue*);
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r94710 r94912  
    5959border-collapse
    6060border-color
     61border-image-outset
    6162border-image-repeat
    6263border-image-slice
     
    284285-webkit-mask-attachment
    285286-webkit-mask-box-image
     287-webkit-mask-box-image-outset
    286288-webkit-mask-box-image-repeat
    287289-webkit-mask-box-image-slice
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r94889 r94912  
    31833183        return;
    31843184    }
     3185    case CSSPropertyBorderImageOutset:
     3186    case CSSPropertyWebkitMaskBoxImageOutset: {
     3187        bool isBorderImage = id == CSSPropertyBorderImageOutset;
     3188        NinePieceImage image(isBorderImage ? m_style->borderImage() : m_style->maskBoxImage());
     3189        if (isInherit)
     3190            image.copyOutsetFrom(isBorderImage ? m_parentStyle->borderImage() : m_parentStyle->maskBoxImage());
     3191        else if (isInitial)
     3192            image.setOutset(LengthBox());
     3193        else
     3194            image.setOutset(mapNinePieceImageQuad(value));
     3195       
     3196        if (isBorderImage)
     3197            m_style->setBorderImage(image);
     3198        else
     3199            m_style->setMaskBoxImage(image);
     3200        return;
     3201    }
    31853202    case CSSPropertyBorderImageRepeat:
    31863203    case CSSPropertyWebkitMaskBoxImageRepeat: {
     
    32303247            image.setBorderSlices(isBorderImage ? LengthBox(Length(1, Relative), Length(1, Relative), Length(1, Relative), Length(1, Relative)) : LengthBox());
    32313248        } else
    3232             mapNinePieceImageWidth(value, image);
    3233        
     3249            image.setBorderSlices(mapNinePieceImageQuad(value));
     3250
    32343251        if (isBorderImage)
    32353252            m_style->setBorderImage(image);
     
    45974614
    45984615    // Map in the border slices.
    4599     mapNinePieceImageWidth(borderImage->m_borderSlice.get(), image);
     4616    if (borderImage->m_borderSlice)
     4617        image.setBorderSlices(mapNinePieceImageQuad(borderImage->m_borderSlice.get()));
     4618   
     4619    // Map in the outset.
     4620    if (borderImage->m_outset)
     4621        image.setOutset(mapNinePieceImageQuad(borderImage->m_outset.get()));
    46004622
    46014623    if (property == CSSPropertyWebkitBorderImage) {
     
    46504672}
    46514673
    4652 void CSSStyleSelector::mapNinePieceImageWidth(CSSValue* value, NinePieceImage& image)
     4674LengthBox CSSStyleSelector::mapNinePieceImageQuad(CSSValue* value)
    46534675{
    46544676    if (!value || !value->isPrimitiveValue())
    4655         return;
     4677        return LengthBox();
    46564678
    46574679    // Get our zoom value.
     
    46684690    else if (slices->top()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
    46694691        box.m_top = Length(slices->top()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
    4670     else
     4692    else if (slices->top()->getIdent() != CSSValueAuto)
    46714693        box.m_top = slices->top()->computeLength<Length>(style(), rootElementStyle(), zoom);
    46724694
     
    46754697    else if (slices->right()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
    46764698        box.m_right = Length(slices->right()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
    4677     else
     4699    else if (slices->right()->getIdent() != CSSValueAuto)
    46784700        box.m_right = slices->right()->computeLength<Length>(style(), rootElementStyle(), zoom);
    46794701
     
    46824704    else if (slices->bottom()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
    46834705        box.m_bottom = Length(slices->bottom()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
    4684     else
     4706    else if (slices->bottom()->getIdent() != CSSValueAuto)
    46854707        box.m_bottom = slices->bottom()->computeLength<Length>(style(), rootElementStyle(), zoom);
    46864708
     
    46894711    else if (slices->left()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
    46904712        box.m_left = Length(slices->left()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
    4691     else
     4713    else if (slices->left()->getIdent() != CSSValueAuto)
    46924714        box.m_left = slices->left()->computeLength<Length>(style(), rootElementStyle(), zoom);
    46934715
    4694     image.setBorderSlices(box);
     4716    return box;
    46954717}
    46964718
     
    54215443                    if (maskImage.image() && maskImage.image()->isPendingImage()) {
    54225444                        CSSImageValue* imageValue = static_cast<StylePendingImage*>(maskImage.image())->cssImageValue();
    5423                         reflection->setMask(NinePieceImage(imageValue->cachedImage(cachedResourceLoader), maskImage.imageSlices(), maskImage.fill(), maskImage.borderSlices(), maskImage.horizontalRule(), maskImage.verticalRule()));
     5445                        reflection->setMask(NinePieceImage(imageValue->cachedImage(cachedResourceLoader), maskImage.imageSlices(), maskImage.fill(), maskImage.borderSlices(), maskImage.outset(), maskImage.horizontalRule(), maskImage.verticalRule()));
    54245446                    }
    54255447                }
  • trunk/Source/WebCore/css/CSSStyleSelector.h

    r94656 r94912  
    302302    void mapNinePieceImage(CSSPropertyID, CSSValue*, NinePieceImage&);
    303303    void mapNinePieceImageSlice(CSSValue*, NinePieceImage&);
    304     void mapNinePieceImageWidth(CSSValue*, NinePieceImage&);
     304    LengthBox mapNinePieceImageQuad(CSSValue*);
    305305    void mapNinePieceImageRepeat(CSSValue*, NinePieceImage&);
    306306
  • trunk/Source/WebCore/rendering/InlineFlowBox.cpp

    r92340 r94912  
    153153                child->clearKnownToHaveNoOverflow();
    154154        } else if (!child->renderer()->isBR() && (child->renderer()->style(m_firstLine)->boxShadow() || child->boxModelObject()->hasSelfPaintingLayer()
    155                    || (child->renderer()->isListMarker() && !toRenderListMarker(child->renderer())->isInside())))
     155                   || (child->renderer()->isListMarker() && !toRenderListMarker(child->renderer())->isInside())
     156                   || child->renderer()->style(m_firstLine)->hasBorderImageOutsets()))
    156157            child->clearKnownToHaveNoOverflow();
    157158       
     
    722723inline void InlineFlowBox::addBoxShadowVisualOverflow(LayoutRect& logicalVisualOverflow)
    723724{
     725    // box-shadow on root line boxes is applying to the block and not to the lines.
    724726    if (!parent())
    725         return; // Box-shadow doesn't apply to root line boxes.
     727        return;
     728
     729    RenderStyle* style = renderer()->style(m_firstLine);
     730    if (!style->boxShadow())
     731        return;
    726732
    727733    LayoutUnit boxShadowLogicalTop;
    728734    LayoutUnit boxShadowLogicalBottom;
    729     renderer()->style(m_firstLine)->getBoxShadowBlockDirectionExtent(boxShadowLogicalTop, boxShadowLogicalBottom);
    730    
    731     LayoutUnit logicalTopVisualOverflow = min(logicalTop() + boxShadowLogicalTop, logicalVisualOverflow.y());
    732     LayoutUnit logicalBottomVisualOverflow = max(logicalBottom() + boxShadowLogicalBottom, logicalVisualOverflow.maxY());
     735    style->getBoxShadowBlockDirectionExtent(boxShadowLogicalTop, boxShadowLogicalBottom);
     736   
     737    // Similar to how glyph overflow works, if our lines are flipped, then it's actually the opposite shadow that applies, since
     738    // the line is "upside down" in terms of block coordinates.
     739    LayoutUnit shadowLogicalTop = style->isFlippedLinesWritingMode() ? -boxShadowLogicalBottom : boxShadowLogicalTop;
     740    LayoutUnit shadowLogicalBottom = style->isFlippedLinesWritingMode() ? -boxShadowLogicalTop : boxShadowLogicalBottom;
     741   
     742    LayoutUnit logicalTopVisualOverflow = min(logicalTop() + shadowLogicalTop, logicalVisualOverflow.y());
     743    LayoutUnit logicalBottomVisualOverflow = max(logicalBottom() + shadowLogicalBottom, logicalVisualOverflow.maxY());
    733744   
    734745    LayoutUnit boxShadowLogicalLeft;
    735746    LayoutUnit boxShadowLogicalRight;
    736     renderer()->style(m_firstLine)->getBoxShadowInlineDirectionExtent(boxShadowLogicalLeft, boxShadowLogicalRight);
     747    style->getBoxShadowInlineDirectionExtent(boxShadowLogicalLeft, boxShadowLogicalRight);
    737748
    738749    LayoutUnit logicalLeftVisualOverflow = min(pixelSnappedLogicalLeft() + boxShadowLogicalLeft, logicalVisualOverflow.x());
    739750    LayoutUnit logicalRightVisualOverflow = max(pixelSnappedLogicalRight() + boxShadowLogicalRight, logicalVisualOverflow.maxX());
     751   
     752    logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisualOverflow,
     753                                       logicalRightVisualOverflow - logicalLeftVisualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow);
     754}
     755
     756inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisualOverflow)
     757{
     758    // border-image-outset on root line boxes is applying to the block and not to the lines.
     759    if (!parent())
     760        return;
     761   
     762    RenderStyle* style = renderer()->style(m_firstLine);
     763    if (!style->hasBorderImageOutsets())
     764        return;
     765   
     766    LayoutUnit borderOutsetLogicalTop;
     767    LayoutUnit borderOutsetLogicalBottom;
     768    style->getBorderImageBlockDirectionOutsets(borderOutsetLogicalTop, borderOutsetLogicalBottom);
     769
     770    // Similar to how glyph overflow works, if our lines are flipped, then it's actually the opposite border that applies, since
     771    // the line is "upside down" in terms of block coordinates. vertical-rl and horizontal-bt are the flipped line modes.
     772    LayoutUnit outsetLogicalTop = style->isFlippedLinesWritingMode() ? borderOutsetLogicalBottom : borderOutsetLogicalTop;
     773    LayoutUnit outsetLogicalBottom = style->isFlippedLinesWritingMode() ? borderOutsetLogicalTop : borderOutsetLogicalBottom;
     774
     775    LayoutUnit logicalTopVisualOverflow = min(logicalTop() - outsetLogicalTop, logicalVisualOverflow.y());
     776    LayoutUnit logicalBottomVisualOverflow = max(logicalBottom() + outsetLogicalBottom, logicalVisualOverflow.maxY());
     777   
     778    LayoutUnit borderOutsetLogicalLeft;
     779    LayoutUnit borderOutsetLogicalRight;
     780    style->getBorderImageInlineDirectionOutsets(borderOutsetLogicalLeft, borderOutsetLogicalRight);
     781
     782    LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogicalLeft : 0;
     783    LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogicalRight : 0;
     784
     785    LayoutUnit logicalLeftVisualOverflow = min(pixelSnappedLogicalLeft() - outsetLogicalLeft, logicalVisualOverflow.x());
     786    LayoutUnit logicalRightVisualOverflow = max(pixelSnappedLogicalRight() + outsetLogicalRight, logicalVisualOverflow.maxX());
    740787   
    741788    logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisualOverflow,
     
    836883    LayoutRect logicalVisualOverflow(logicalLayoutOverflow);
    837884 
    838     // box-shadow on root line boxes is applying to the block and not to the lines.
    839885    addBoxShadowVisualOverflow(logicalVisualOverflow);
     886    addBorderOutsetVisualOverflow(logicalVisualOverflow);
    840887
    841888    for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
     
    10951142}
    10961143
     1144static LayoutRect clipRectForNinePieceImageStrip(InlineFlowBox* box, const NinePieceImage& image, const LayoutRect& paintRect)
     1145{
     1146    LayoutRect clipRect(paintRect);
     1147    RenderStyle* style = box->renderer()->style();
     1148    LayoutUnit topOutset;
     1149    LayoutUnit rightOutset;
     1150    LayoutUnit bottomOutset;
     1151    LayoutUnit leftOutset;
     1152    style->getImageOutsets(image, topOutset, rightOutset, bottomOutset, leftOutset);
     1153    if (box->isHorizontal()) {
     1154        clipRect.setY(paintRect.y() - topOutset);
     1155        clipRect.setHeight(paintRect.height() + topOutset + bottomOutset);
     1156        if (box->includeLogicalLeftEdge()) {
     1157            clipRect.setX(paintRect.x() - leftOutset);
     1158            clipRect.setWidth(paintRect.width() + leftOutset);
     1159        }
     1160        if (box->includeLogicalRightEdge())
     1161            clipRect.setWidth(clipRect.width() + rightOutset);
     1162    } else {
     1163        clipRect.setX(paintRect.x() - leftOutset);
     1164        clipRect.setWidth(paintRect.width() + leftOutset + rightOutset);
     1165        if (box->includeLogicalLeftEdge()) {
     1166            clipRect.setY(paintRect.y() - topOutset);
     1167            clipRect.setHeight(paintRect.height() + topOutset);
     1168        }
     1169        if (box->includeLogicalRightEdge())
     1170            clipRect.setHeight(clipRect.height() + bottomOutset);
     1171    }
     1172    return clipRect;
     1173}
     1174
    10971175void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
    10981176{
     
    11271205        // non-first-line style.
    11281206        if (parent() && renderer()->style()->hasBorder()) {
    1129             StyleImage* borderImage = renderer()->style()->borderImage().image();
    1130             bool hasBorderImage = borderImage && borderImage->canRender(styleToUse->effectiveZoom());
    1131             if (hasBorderImage && !borderImage->isLoaded())
     1207            const NinePieceImage& borderImage = renderer()->style()->borderImage();
     1208            StyleImage* borderImageSource = borderImage.image();
     1209            bool hasBorderImage = borderImageSource && borderImageSource->canRender(styleToUse->effectiveZoom());
     1210            if (hasBorderImage && !borderImageSource->isLoaded())
    11321211                return; // Don't paint anything while we wait for the image to load.
    11331212
     
    11561235                LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : totalLogicalWidth;
    11571236
     1237                LayoutRect clipRect = clipRectForNinePieceImageStrip(this, borderImage, paintRect);
    11581238                GraphicsContextStateSaver stateSaver(*context);
    1159                 context->clip(paintRect);
     1239                context->clip(clipRect);
    11601240                boxModelObject()->paintBorder(paintInfo, LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer()->style());
    11611241            }
     
    12231303        LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : totalLogicalWidth;
    12241304
     1305        LayoutRect clipRect = clipRectForNinePieceImageStrip(this, maskNinePieceImage, paintRect);
    12251306        GraphicsContextStateSaver stateSaver(*paintInfo.context);
    1226         paintInfo.context->clip(paintRect);
     1307        paintInfo.context->clip(clipRect);
    12271308        boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer()->style(), maskNinePieceImage, compositeOp);
    12281309    }
  • trunk/Source/WebCore/rendering/InlineFlowBox.h

    r93333 r94912  
    275275private:
    276276    void addBoxShadowVisualOverflow(LayoutRect& logicalVisualOverflow);
     277    void addBorderOutsetVisualOverflow(LayoutRect& logicalVisualOverflow);
    277278    void addTextBoxVisualOverflow(InlineTextBox*, GlyphOverflowAndFallbackFontsMap&, LayoutRect& logicalVisualOverflow);
    278279    void addReplacedChildOverflow(const InlineBox*, LayoutRect& logicalLayoutOverflow, LayoutRect& logicalVisualOverflow);
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r94877 r94912  
    14271427    }
    14281428       
    1429     // Add visual overflow from box-shadow and reflections.
    1430     addShadowOverflow();
     1429    // Add visual overflow from box-shadow and border-image-outset.
     1430    addBoxShadowAndBorderOverflow();
    14311431}
    14321432
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r94706 r94912  
    989989LayoutRect RenderBox::maskClipRect()
    990990{
    991     LayoutRect bbox = borderBoxRect();
    992     if (style()->maskBoxImage().image())
    993         return bbox;
     991    const NinePieceImage& maskBoxImage = style()->maskBoxImage();
     992    if (maskBoxImage.image()) {
     993        LayoutRect borderImageRect = borderBoxRect();
     994       
     995        // Apply outsets to the border box.
     996        LayoutUnit topOutset;
     997        LayoutUnit rightOutset;
     998        LayoutUnit bottomOutset;
     999        LayoutUnit leftOutset;
     1000        style()->getMaskBoxImageOutsets(topOutset, rightOutset, bottomOutset, leftOutset);
     1001         
     1002        borderImageRect.setX(borderImageRect.x() - leftOutset);
     1003        borderImageRect.setY(borderImageRect.y() - topOutset);
     1004        borderImageRect.setWidth(borderImageRect.width() + leftOutset + rightOutset);
     1005        borderImageRect.setHeight(borderImageRect.height() + topOutset + bottomOutset);
     1006
     1007        return borderImageRect;
     1008    }
    9941009   
    9951010    LayoutRect result;
     1011    LayoutRect borderBox = borderBoxRect();
    9961012    for (const FillLayer* maskLayer = style()->maskLayers(); maskLayer; maskLayer = maskLayer->next()) {
    9971013        if (maskLayer->image()) {
    9981014            BackgroundImageGeometry geometry;
    999             calculateBackgroundImageGeometry(maskLayer, bbox, geometry);
     1015            calculateBackgroundImageGeometry(maskLayer, borderBox, geometry);
    10001016            result.unite(geometry.destRect());
    10011017        }
     
    32473263}
    32483264
    3249 void RenderBox::addShadowOverflow()
    3250 {
    3251     LayoutUnit shadowLeft;
    3252     LayoutUnit shadowRight;
    3253     LayoutUnit shadowTop;
    3254     LayoutUnit shadowBottom;
    3255     style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft);
     3265void RenderBox::addBoxShadowAndBorderOverflow()
     3266{
     3267    if (!style()->boxShadow() && !style()->hasBorderImageOutsets())
     3268        return;
     3269
     3270    bool isFlipped = style()->isFlippedBlocksWritingMode();
     3271    bool isHorizontal = isHorizontalWritingMode();
     3272   
    32563273    LayoutRect borderBox = borderBoxRect();
    3257     LayoutUnit overflowLeft = borderBox.x() + shadowLeft;
    3258     LayoutUnit overflowRight = borderBox.maxX() + shadowRight;
    3259     LayoutUnit overflowTop = borderBox.y() + shadowTop;
    3260     LayoutUnit overflowBottom = borderBox.maxY() + shadowBottom;
    3261     addVisualOverflow(LayoutRect(overflowLeft, overflowTop, overflowRight - overflowLeft, overflowBottom - overflowTop));
     3274    LayoutUnit overflowMinX = borderBox.x();
     3275    LayoutUnit overflowMaxX = borderBox.maxX();
     3276    LayoutUnit overflowMinY = borderBox.y();
     3277    LayoutUnit overflowMaxY = borderBox.maxY();
     3278   
     3279    // Compute box-shadow overflow first.
     3280    if (style()->boxShadow()) {
     3281        LayoutUnit shadowLeft;
     3282        LayoutUnit shadowRight;
     3283        LayoutUnit shadowTop;
     3284        LayoutUnit shadowBottom;
     3285        style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft);
     3286
     3287        // In flipped blocks writing modes such as vertical-rl, the physical right shadow value is actually at the lower x-coordinate.
     3288        overflowMinX = borderBox.x() + ((!isFlipped || isHorizontal) ? shadowLeft : -shadowRight);
     3289        overflowMaxX = borderBox.maxX() + ((!isFlipped || isHorizontal) ? shadowRight : -shadowLeft);
     3290        overflowMinY = borderBox.y() + ((!isFlipped || !isHorizontal) ? shadowTop : -shadowBottom);
     3291        overflowMaxY = borderBox.maxY() + ((!isFlipped || !isHorizontal) ? shadowBottom : -shadowTop);
     3292    }
     3293
     3294    // Now compute border-image-outset overflow.
     3295    if (style()->hasBorderImageOutsets()) {
     3296        LayoutUnit borderOutsetLeft;
     3297        LayoutUnit borderOutsetRight;
     3298        LayoutUnit borderOutsetTop;
     3299        LayoutUnit borderOutsetBottom;
     3300        style()->getBorderImageOutsets(borderOutsetTop, borderOutsetRight, borderOutsetBottom, borderOutsetLeft);
     3301       
     3302        // In flipped blocks writing modes, the physical sides are inverted. For example in vertical-rl, the right
     3303        // border is at the lower x coordinate value.
     3304        overflowMinX = min(overflowMinX, borderBox.x() - ((!isFlipped || isHorizontal) ? borderOutsetLeft : borderOutsetRight));
     3305        overflowMaxX = max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHorizontal) ? borderOutsetRight : borderOutsetLeft));
     3306        overflowMinY = min(overflowMinY, borderBox.y() - ((!isFlipped || !isHorizontal) ? borderOutsetTop : borderOutsetBottom));
     3307        overflowMaxY = max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isHorizontal) ? borderOutsetBottom : borderOutsetTop));
     3308    }
     3309
     3310    // Add in the final overflow with shadows and outsets combined.
     3311    addVisualOverflow(LayoutRect(overflowMinX, overflowMinY, overflowMaxX - overflowMinX, overflowMaxY - overflowMinY));
    32623312}
    32633313
  • trunk/Source/WebCore/rendering/RenderBox.h

    r94706 r94912  
    160160    void addVisualOverflow(const LayoutRect&);
    161161   
    162     void addShadowOverflow();
     162    void addBoxShadowAndBorderOverflow();
    163163    void addOverflowFromChild(RenderBox* child) { addOverflowFromChild(child, child->locationOffset()); }
    164164    void addOverflowFromChild(RenderBox* child, const LayoutSize& delta);
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r94593 r94912  
    990990    ENinePieceImageRule vRule = ninePieceImage.verticalRule();
    991991   
    992     LayoutUnit topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), style->borderTopWidth(), topSlice, rect.height());
    993     LayoutUnit rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(), style->borderRightWidth(), rightSlice, rect.width());
    994     LayoutUnit bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().bottom(), style->borderBottomWidth(), bottomSlice, rect.height());
    995     LayoutUnit leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(), style->borderLeftWidth(), leftSlice, rect.width());
     992    LayoutUnit topOutset;
     993    LayoutUnit rightOutset;
     994    LayoutUnit bottomOutset;
     995    LayoutUnit leftOutset;
     996    style->getImageOutsets(ninePieceImage, topOutset, rightOutset, bottomOutset, leftOutset);
     997
     998    LayoutUnit topWithOutset = rect.y() - topOutset;
     999    LayoutUnit bottomWithOutset = rect.maxY() + bottomOutset;
     1000    LayoutUnit leftWithOutset = rect.x() - leftOutset;
     1001    LayoutUnit rightWithOutset = rect.maxX() + rightOutset;
     1002    LayoutRect borderImageRect = LayoutRect(leftWithOutset, topWithOutset, rightWithOutset - leftWithOutset, bottomWithOutset - topWithOutset);
     1003   
     1004    LayoutUnit topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), style->borderTopWidth(), topSlice, borderImageRect.height());
     1005    LayoutUnit rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(), style->borderRightWidth(), rightSlice, borderImageRect.width());
     1006    LayoutUnit bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().bottom(), style->borderBottomWidth(), bottomSlice, borderImageRect.height());
     1007    LayoutUnit leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(), style->borderLeftWidth(), leftSlice, borderImageRect.width());
    9961008   
    9971009    // Reduce the widths if they're too large.
     
    10011013    int borderSideWidth = max(1, leftWidth + rightWidth);
    10021014    int borderSideHeight = max(1, topWidth + bottomWidth);
    1003     float borderSideScaleFactor = min((float)rect.width() / borderSideWidth, (float)rect.height() / borderSideHeight);
     1015    float borderSideScaleFactor = min((float)borderImageRect.width() / borderSideWidth, (float)borderImageRect.height() / borderSideHeight);
    10041016    if (borderSideScaleFactor < 1) {
    10051017        topWidth *= borderSideScaleFactor;
     
    10131025    bool drawRight = rightSlice > 0 && rightWidth > 0;
    10141026    bool drawBottom = bottomSlice > 0 && bottomWidth > 0;
    1015     bool drawMiddle = ninePieceImage.fill() && (imageWidth - leftSlice - rightSlice) > 0 && (rect.width() - leftWidth - rightWidth) > 0
    1016                       && (imageHeight - topSlice - bottomSlice) > 0 && (rect.height() - topWidth - bottomWidth) > 0;
     1027    bool drawMiddle = ninePieceImage.fill() && (imageWidth - leftSlice - rightSlice) > 0 && (borderImageRect.width() - leftWidth - rightWidth) > 0
     1028                      && (imageHeight - topSlice - bottomSlice) > 0 && (borderImageRect.height() - topWidth - bottomWidth) > 0;
    10171029
    10181030    RefPtr<Image> image = styleImage->image(this, imageSize);
     
    10251037        // The rect to use from within the image is obtained from our slice, and is (0, 0, leftSlice, topSlice)
    10261038        if (drawTop)
    1027             graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(rect.location(), LayoutSize(leftWidth, topWidth)),
     1039            graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(borderImageRect.location(), LayoutSize(leftWidth, topWidth)),
    10281040                                       LayoutRect(0, 0, leftSlice, topSlice), op);
    10291041
     
    10311043        // The rect to use from within the image is (0, imageHeight - bottomSlice, leftSlice, botomSlice)
    10321044        if (drawBottom)
    1033             graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(rect.x(), rect.y() + rect.height() - bottomWidth, leftWidth, bottomWidth),
     1045            graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(borderImageRect.x(), borderImageRect.maxY() - bottomWidth, leftWidth, bottomWidth),
    10341046                                       LayoutRect(0, imageHeight - bottomSlice, leftSlice, bottomSlice), op);
    10351047
    10361048        // Paint the left edge.
    10371049        // Have to scale and tile into the border rect.
    1038         graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(rect.x(), rect.y() + topWidth, leftWidth,
    1039                                         rect.height() - topWidth - bottomWidth),
     1050        graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(borderImageRect.x(), borderImageRect.y() + topWidth, leftWidth,
     1051                                        borderImageRect.height() - topWidth - bottomWidth),
    10401052                                        LayoutRect(0, topSlice, leftSlice, imageHeight - topSlice - bottomSlice),
    10411053                                        Image::StretchTile, (Image::TileRule)vRule, op);
     
    10471059        // The rect to use from within the image is obtained from our slice, and is (imageWidth - rightSlice, 0, rightSlice, topSlice)
    10481060        if (drawTop)
    1049             graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(rect.x() + rect.width() - rightWidth, rect.y(), rightWidth, topWidth),
     1061            graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(borderImageRect.maxX() - rightWidth, borderImageRect.y(), rightWidth, topWidth),
    10501062                                       LayoutRect(imageWidth - rightSlice, 0, rightSlice, topSlice), op);
    10511063
     
    10531065        // The rect to use from within the image is (imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice)
    10541066        if (drawBottom)
    1055             graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(rect.x() + rect.width() - rightWidth, rect.y() + rect.height() - bottomWidth, rightWidth, bottomWidth),
     1067            graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(borderImageRect.maxX() - rightWidth, borderImageRect.maxY() - bottomWidth, rightWidth, bottomWidth),
    10561068                                       LayoutRect(imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice), op);
    10571069
    10581070        // Paint the right edge.
    1059         graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(rect.x() + rect.width() - rightWidth, rect.y() + topWidth, rightWidth,
    1060                                         rect.height() - topWidth - bottomWidth),
     1071        graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(borderImageRect.maxX() - rightWidth, borderImageRect.y() + topWidth, rightWidth,
     1072                                        borderImageRect.height() - topWidth - bottomWidth),
    10611073                                        LayoutRect(imageWidth - rightSlice, topSlice, rightSlice, imageHeight - topSlice - bottomSlice),
    10621074                                        Image::StretchTile, (Image::TileRule)vRule, op);
     
    10651077    // Paint the top edge.
    10661078    if (drawTop)
    1067         graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(rect.x() + leftWidth, rect.y(), rect.width() - leftWidth - rightWidth, topWidth),
     1079        graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(borderImageRect.x() + leftWidth, borderImageRect.y(), borderImageRect.width() - leftWidth - rightWidth, topWidth),
    10681080                                        LayoutRect(leftSlice, 0, imageWidth - rightSlice - leftSlice, topSlice),
    10691081                                        (Image::TileRule)hRule, Image::StretchTile, op);
     
    10711083    // Paint the bottom edge.
    10721084    if (drawBottom)
    1073         graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(rect.x() + leftWidth, rect.y() + rect.height() - bottomWidth,
    1074                                         rect.width() - leftWidth - rightWidth, bottomWidth),
     1085        graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(borderImageRect.x() + leftWidth, borderImageRect.maxY() - bottomWidth,
     1086                                        borderImageRect.width() - leftWidth - rightWidth, bottomWidth),
    10751087                                        LayoutRect(leftSlice, imageHeight - bottomSlice, imageWidth - rightSlice - leftSlice, bottomSlice),
    10761088                                        (Image::TileRule)hRule, Image::StretchTile, op);
     
    10781090    // Paint the middle.
    10791091    if (drawMiddle)
    1080         graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(rect.x() + leftWidth, rect.y() + topWidth, rect.width() - leftWidth - rightWidth,
    1081                                         rect.height() - topWidth - bottomWidth),
     1092        graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(borderImageRect.x() + leftWidth, borderImageRect.y() + topWidth, borderImageRect.width() - leftWidth - rightWidth,
     1093                                        borderImageRect.height() - topWidth - bottomWidth),
    10821094                                        LayoutRect(leftSlice, topSlice, imageWidth - rightSlice - leftSlice, imageHeight - topSlice - bottomSlice),
    10831095                                        (Image::TileRule)hRule, (Image::TileRule)vRule, op);
  • trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp

    r90667 r94912  
    221221
    222222    m_overflow.clear();
    223     addShadowOverflow();
     223    addBoxShadowAndBorderOverflow();
    224224
    225225    updateLayerTransform();
  • trunk/Source/WebCore/rendering/RenderIFrame.cpp

    r90069 r94912  
    125125
    126126    m_overflow.clear();
    127     addShadowOverflow();
     127    addBoxShadowAndBorderOverflow();
    128128    updateLayerTransform();
    129129
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r94910 r94912  
    35343534
    35353535        // If we establish a clip at all, then go ahead and make sure our background
    3536         // rect is intersected with our layer's bounds.
    3537         // FIXME: This could be changed to just use generic visual overflow.
    3538         // See https://bugs.webkit.org/show_bug.cgi?id=37467 for more information.
    3539         if (const ShadowData* boxShadow = renderer()->style()->boxShadow()) {
    3540             LayoutRect overflow = layerBounds;
    3541             do {
    3542                 if (boxShadow->style() == Normal) {
    3543                     LayoutRect shadowRect = layerBounds;
    3544                     shadowRect.move(boxShadow->x(), boxShadow->y());
    3545                     shadowRect.inflate(boxShadow->blur() + boxShadow->spread());
    3546                     overflow.unite(shadowRect);
    3547                 }
    3548 
    3549                 boxShadow = boxShadow->next();
    3550             } while (boxShadow);
    3551             backgroundRect.intersect(overflow);
    3552         } else
    3553             backgroundRect.intersect(layerBounds);
     3536        // rect is intersected with our layer's bounds including our visual overflow,
     3537        // since any visual overflow like box-shadow or border-outset is not clipped by overflow:auto/hidden.
     3538        LayoutRect layerBoundsWithVisualOverflow = renderBox()->visualOverflowRect();
     3539        renderBox()->flipForWritingMode(layerBoundsWithVisualOverflow); // Layers are in physical coordinates, so the overflow has to be flipped.
     3540        layerBoundsWithVisualOverflow.moveBy(offset);
     3541        backgroundRect.intersect(layerBoundsWithVisualOverflow);
    35543542    }
    35553543}
     
    36553643        RenderBox* box = renderBox();
    36563644        ASSERT(box);
    3657         if (box->hasMask())
     3645        if (box->hasMask()) {
    36583646            result = box->maskClipRect();
    3659         else {
     3647            box->flipForWritingMode(result); // The mask clip rect is in physical coordinates, so we have to flip, since localBoundingBox is not.
     3648        } else {
    36603649            LayoutRect bbox = box->borderBoxRect();
    36613650            result = bbox;
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r94372 r94912  
    8989
    9090    m_overflow.clear();
    91     addShadowOverflow();
     91    addBoxShadowAndBorderOverflow();
    9292    updateLayerTransform();
    9393   
  • trunk/Source/WebCore/rendering/style/NinePieceImage.cpp

    r94593 r94912  
    3030{
    3131    return StyleImage::imagesEquivalent(m_image.get(), o.m_image.get()) && m_imageSlices == o.m_imageSlices && m_fill == o.m_fill
    32            && m_borderSlices == o.m_borderSlices && m_horizontalRule == o.m_horizontalRule && m_verticalRule == o.m_verticalRule;
     32           && m_borderSlices == o.m_borderSlices && m_outset == o.m_outset && m_horizontalRule == o.m_horizontalRule && m_verticalRule == o.m_verticalRule;
    3333}
    3434
  • trunk/Source/WebCore/rendering/style/NinePieceImage.h

    r94593 r94912  
    2525#define NinePieceImage_h
    2626
     27#include "LayoutTypes.h"
    2728#include "LengthBox.h"
    2829#include "StyleImage.h"
     
    4041        , m_imageSlices(Length(100, Percent), Length(100, Percent), Length(100, Percent), Length(100, Percent))
    4142        , m_borderSlices(Length(1, Relative), Length(1, Relative), Length(1, Relative), Length(1, Relative))
     43        , m_outset(0)
    4244        , m_fill(false)
    4345        , m_horizontalRule(StretchImageRule)
     
    4648    }
    4749
    48     NinePieceImage(StyleImage* image, LengthBox imageSlices, bool fill, LengthBox borderSlices, ENinePieceImageRule h, ENinePieceImageRule v)
     50    NinePieceImage(StyleImage* image, LengthBox imageSlices, bool fill, LengthBox borderSlices, LengthBox outset, ENinePieceImageRule h, ENinePieceImageRule v)
    4951      : m_image(image)
    5052      , m_imageSlices(imageSlices)
    5153      , m_borderSlices(borderSlices)
     54      , m_outset(outset)
    5255      , m_fill(fill)
    5356      , m_horizontalRule(h)
     
    7275    void setBorderSlices(const LengthBox& slices) { m_borderSlices = slices; }
    7376
     77    const LengthBox& outset() const { return m_outset; }
     78    void setOutset(const LengthBox& outset) { m_outset = outset; }
     79   
     80    static LayoutUnit computeOutset(Length outsetSide, LayoutUnit borderSide)
     81    {
     82        if (outsetSide.isRelative())
     83            return outsetSide.value() * borderSide;
     84        return outsetSide.value();
     85    }
     86
    7487    ENinePieceImageRule horizontalRule() const { return static_cast<ENinePieceImageRule>(m_horizontalRule); }
    7588    void setHorizontalRule(ENinePieceImageRule rule) { m_horizontalRule = rule; }
     
    88101        m_borderSlices = other.m_borderSlices;
    89102    }
     103   
     104    void copyOutsetFrom(const NinePieceImage& other)
     105    {
     106        m_outset = other.m_outset;
     107    }
    90108
    91109    void copyRepeatFrom(const NinePieceImage& other)
     
    99117    LengthBox m_imageSlices;
    100118    LengthBox m_borderSlices;
     119    LengthBox m_outset;
    101120    bool m_fill : 1;
    102121    unsigned m_horizontalRule : 2; // ENinePieceImageRule
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r94887 r94912  
    15091509}
    15101510
     1511void RenderStyle::getImageOutsets(const NinePieceImage& image, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const
     1512{
     1513    top = NinePieceImage::computeOutset(image.outset().top(), borderTopWidth());
     1514    right = NinePieceImage::computeOutset(image.outset().right(), borderRightWidth());
     1515    bottom = NinePieceImage::computeOutset(image.outset().bottom(), borderBottomWidth());
     1516    left = NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth());
     1517}
     1518
     1519void RenderStyle::getImageHorizontalOutsets(const NinePieceImage& image, LayoutUnit& left, LayoutUnit& right) const
     1520{
     1521    right = NinePieceImage::computeOutset(image.outset().right(), borderRightWidth());
     1522    left = NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth());
     1523}
     1524
     1525void RenderStyle::getImageVerticalOutsets(const NinePieceImage& image, LayoutUnit& top, LayoutUnit& bottom) const
     1526{
     1527    top = NinePieceImage::computeOutset(image.outset().top(), borderTopWidth());
     1528    bottom = NinePieceImage::computeOutset(image.outset().bottom(), borderBottomWidth());
     1529}
     1530   
    15111531} // namespace WebCore
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r94887 r94912  
    359359            return true;
    360360        return hasBackgroundImage();
     361    }
     362   
     363    void getImageOutsets(const NinePieceImage&, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;
     364    bool hasBorderImageOutsets() const
     365    {
     366        return borderImage().hasImage() && borderImage().outset().nonZero();
     367    }
     368    void getBorderImageOutsets(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const
     369    {
     370        return getImageOutsets(borderImage(), top, right, bottom, left);
     371    }
     372    void getBorderImageHorizontalOutsets(LayoutUnit& left, LayoutUnit& right) const
     373    {
     374        return getImageHorizontalOutsets(borderImage(), left, right);
     375    }
     376    void getBorderImageVerticalOutsets(LayoutUnit& top, LayoutUnit& bottom) const
     377    {
     378        return getImageVerticalOutsets(borderImage(), top, bottom);
     379    }
     380    void getBorderImageInlineDirectionOutsets(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const
     381    {
     382        return getImageInlineDirectionOutsets(borderImage(), logicalLeft, logicalRight);
     383    }
     384    void getBorderImageBlockDirectionOutsets(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const
     385    {
     386        return getImageBlockDirectionOutsets(borderImage(), logicalTop, logicalBottom);
     387    }
     388   
     389    void getMaskBoxImageOutsets(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const
     390    {
     391        return getImageOutsets(maskBoxImage(), top, right, bottom, left);
    361392    }
    362393
     
    14391470    }
    14401471
     1472    // Helpers for obtaining border image outsets for overflow.
     1473    void getImageHorizontalOutsets(const NinePieceImage&, LayoutUnit& left, LayoutUnit& right) const;
     1474    void getImageVerticalOutsets(const NinePieceImage&, LayoutUnit& top, LayoutUnit& bottom) const;
     1475    void getImageInlineDirectionOutsets(const NinePieceImage& image, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const
     1476    {
     1477        return isHorizontalWritingMode() ? getImageHorizontalOutsets(image, logicalLeft, logicalRight) : getImageVerticalOutsets(image, logicalLeft, logicalRight);
     1478    }
     1479    void getImageBlockDirectionOutsets(const NinePieceImage& image, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const
     1480    {
     1481        return isHorizontalWritingMode() ? getImageVerticalOutsets(image, logicalTop, logicalBottom) : getImageHorizontalOutsets(image, logicalTop, logicalBottom);
     1482    }
     1483
    14411484    // Color accessors are all private to make sure callers use visitedDependentColor instead to access them.
    14421485    const Color& borderLeftColor() const { return surround->border.left().color(); }
Note: See TracChangeset for help on using the changeset viewer.