Changeset 166909 in webkit


Ignore:
Timestamp:
Apr 7, 2014 9:47:05 PM (10 years ago)
Author:
zoltan@webkit.org
Message:

[CSS Shapes] Simplify the parsing of width arguments for Inset shapes
https://bugs.webkit.org/show_bug.cgi?id=131305

Reviewed by Andreas Kling.

This code introduces some helper functions for setting the size arguments of inset shapes. This change
also modifies the code to be the same as in Blink, so it helps us to keep the shapes code similar.

No new tests, no behavior change.

  • css/CSSBasicShapes.h:

(WebCore::CSSBasicShapeInset::updateShapeSize4Values):
(WebCore::CSSBasicShapeInset::updateShapeSize1Value):
(WebCore::CSSBasicShapeInset::updateShapeSize2Values):
(WebCore::CSSBasicShapeInset::updateShapeSize3Values):

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseBasicShapeInset):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r166902 r166909  
     12014-04-07  Zoltan Horvath  <zoltan@webkit.org>
     2
     3        [CSS Shapes] Simplify the parsing of width arguments for Inset shapes
     4        https://bugs.webkit.org/show_bug.cgi?id=131305
     5
     6        Reviewed by Andreas Kling.
     7
     8        This code introduces some helper functions for setting the size arguments of inset shapes. This change
     9        also modifies the code to be the same as in Blink, so it helps us to keep the shapes code similar.
     10
     11        No new tests, no behavior change.
     12
     13        * css/CSSBasicShapes.h:
     14        (WebCore::CSSBasicShapeInset::updateShapeSize4Values):
     15        (WebCore::CSSBasicShapeInset::updateShapeSize1Value):
     16        (WebCore::CSSBasicShapeInset::updateShapeSize2Values):
     17        (WebCore::CSSBasicShapeInset::updateShapeSize3Values):
     18        * css/CSSParser.cpp:
     19        (WebCore::CSSParser::parseBasicShapeInset):
     20
    1212014-04-07  Martin Robinson  <mrobinson@igalia.com>
    222
  • trunk/Source/WebCore/css/CSSBasicShapes.h

    r165843 r166909  
    8282    void setLeft(PassRefPtr<CSSPrimitiveValue> left) { m_left = left; }
    8383
     84    void updateShapeSize4Values(CSSPrimitiveValue* top, CSSPrimitiveValue* right, CSSPrimitiveValue* bottom, CSSPrimitiveValue* left)
     85    {
     86        setTop(top);
     87        setRight(right);
     88        setBottom(bottom);
     89        setLeft(left);
     90    }
     91
     92    void updateShapeSize1Value(CSSPrimitiveValue* value1)
     93    {
     94        updateShapeSize4Values(value1, value1, value1, value1);
     95    }
     96
     97    void updateShapeSize2Values(CSSPrimitiveValue* value1,  CSSPrimitiveValue* value2)
     98    {
     99        updateShapeSize4Values(value1, value2, value1, value2);
     100    }
     101
     102    void updateShapeSize3Values(CSSPrimitiveValue* value1, CSSPrimitiveValue* value2,  CSSPrimitiveValue* value3)
     103    {
     104        updateShapeSize4Values(value1, value2, value3, value2);
     105    }
     106
    84107    void setTopLeftRadius(PassRefPtr<CSSPrimitiveValue> radius) { m_topLeftRadius = radius; }
    85108    void setTopRightRadius(PassRefPtr<CSSPrimitiveValue> radius) { m_topRightRadius = radius; }
  • trunk/Source/WebCore/css/CSSParser.cpp

    r166883 r166909  
    54295429    switch (widthArguments.size()) {
    54305430    case 1: {
    5431         shape->setTop(widthArguments[0]);
    5432         shape->setRight(widthArguments[0]);
    5433         shape->setBottom(widthArguments[0]);
    5434         shape->setLeft(widthArguments[0]);
     5431        shape->updateShapeSize1Value(widthArguments[0].get());
    54355432        break;
    54365433    }
    54375434    case 2: {
    5438         shape->setTop(widthArguments[0]);
    5439         shape->setRight(widthArguments[1]);
    5440         shape->setBottom(widthArguments[0]);
    5441         shape->setLeft(widthArguments[1]);
     5435        shape->updateShapeSize2Values(widthArguments[0].get(), widthArguments[1].get());
    54425436        break;
    54435437        }
    54445438    case 3: {
    5445         shape->setTop(widthArguments[0]);
    5446         shape->setRight(widthArguments[1]);
    5447         shape->setBottom(widthArguments[2]);
    5448         shape->setLeft(widthArguments[1]);
     5439        shape->updateShapeSize3Values(widthArguments[0].get(), widthArguments[1].get(), widthArguments[2].get());
    54495440        break;
    54505441    }
    54515442    case 4: {
    5452         shape->setTop(widthArguments[0]);
    5453         shape->setRight(widthArguments[1]);
    5454         shape->setBottom(widthArguments[2]);
    5455         shape->setLeft(widthArguments[3]);
     5443        shape->updateShapeSize4Values(widthArguments[0].get(), widthArguments[1].get(), widthArguments[2].get(), widthArguments[3].get());
    54565444        break;
    54575445    }
Note: See TracChangeset for help on using the changeset viewer.