Changeset 113645 in webkit


Ignore:
Timestamp:
Apr 9, 2012 5:03:01 PM (12 years ago)
Author:
leviw@chromium.org
Message:

Prepare html classes for sub-pixel LayoutUnits
https://bugs.webkit.org/show_bug.cgi?id=83491

Reviewed by Eric Seidel.

This patch brings the entire HTML folder up to the current state of the subpixellayout branch. Adding
an intValue flavor of Length that maps to the current value function was also necessary to get us
there. See https://trac.webkit.org/wiki/LayoutUnit and the descriptions below for details.

No new tests. No change in behavior.

  • html/HTMLMarqueeElement.cpp:

(WebCore::HTMLMarqueeElement::scrollAmount): Fixes a compiler error when length returns a float, as
we intend it to do when switching to sub-pixel layout.

  • html/ImageDocument.cpp:

(WebCore::ImageDocumentParser::finish): imageSize is always integral.

  • platform/Length.h:

(WebCore::Length::Length): Added a constructor that takes a FractionalLayoutUnit.
(Length):
(WebCore::Length::intValue): Currently maps directly to Length::value, but the current logic of value
will be migrated here when value is changed to return a float.
(WebCore::Length::setValue): Added a variant that takes a FractionalLayoutUnit.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r113644 r113645  
     12012-04-09  Levi Weintraub  <leviw@chromium.org>
     2
     3        Prepare html classes for sub-pixel LayoutUnits
     4        https://bugs.webkit.org/show_bug.cgi?id=83491
     5
     6        Reviewed by Eric Seidel.
     7
     8        This patch brings the entire HTML folder up to the current state of the subpixellayout branch. Adding
     9        an intValue flavor of Length that maps to the current value function was also necessary to get us
     10        there. See https://trac.webkit.org/wiki/LayoutUnit and the descriptions below for details.
     11
     12        No new tests. No change in behavior.
     13
     14        * html/HTMLMarqueeElement.cpp:
     15        (WebCore::HTMLMarqueeElement::scrollAmount): Fixes a compiler error when length returns a float, as
     16        we intend it to do when switching to sub-pixel layout.
     17        * html/ImageDocument.cpp:
     18        (WebCore::ImageDocumentParser::finish): imageSize is always integral.
     19        * platform/Length.h:
     20        (WebCore::Length::Length): Added a constructor that takes a FractionalLayoutUnit.
     21        (Length):
     22        (WebCore::Length::intValue): Currently maps directly to Length::value, but the current logic of value
     23        will be migrated here when value is changed to return a float.
     24        (WebCore::Length::setValue): Added a variant that takes a FractionalLayoutUnit.
     25
    1262012-04-09  Andrew Lo  <anlo@rim.com>
    227
  • trunk/Source/WebCore/html/HTMLMarqueeElement.cpp

    r109149 r113645  
    126126    bool ok;
    127127    int scrollAmount = fastGetAttribute(scrollamountAttr).toInt(&ok);
    128     return ok && scrollAmount >= 0 ? scrollAmount : RenderStyle::initialMarqueeIncrement().value();
     128    return ok && scrollAmount >= 0 ? scrollAmount : RenderStyle::initialMarqueeIncrement().intValue();
    129129}
    130130   
  • trunk/Source/WebCore/html/ImageDocument.cpp

    r107899 r113645  
    156156        // Report the natural image size in the page title, regardless of zoom
    157157        // level.
    158         LayoutSize size = cachedImage->imageSizeForRenderer(document()->imageElement()->renderer(), 1.0f);
     158        IntSize size = cachedImage->imageSizeForRenderer(document()->imageElement()->renderer(), 1.0f);
    159159        if (size.width()) {
    160160            // Compute the title, we use the decoded filename of the resource, falling
  • trunk/Source/WebCore/platform/Length.h

    r112749 r113645  
    2525
    2626#include "AnimationUtilities.h"
     27#include "LayoutTypes.h"
    2728#include <wtf/Assertions.h>
    2829#include <wtf/FastAllocBase.h>
     
    5657    }
    5758   
     59    Length(FractionalLayoutUnit v, LengthType t, bool q = false)
     60        : m_floatValue(v.toFloat()), m_quirk(q), m_type(t), m_isFloat(true)
     61    {
     62    }
     63   
    5864    Length(float v, LengthType t, bool q = false)
    5965    : m_floatValue(v), m_quirk(q), m_type(t), m_isFloat(true)
     
    113119    }
    114120
     121    // FIXME: When we switch to sub-pixel layout, value will return float by default, and this will inherit
     122    // the current implementation of value().
     123    int intValue() const
     124    {
     125        return value();
     126    }
     127
    115128    float percent() const
    116129    {
     
    146159
    147160    void setValue(LengthType t, float value)
     161    {
     162        m_type = t;
     163        m_floatValue = value;
     164        m_isFloat = true;   
     165    }
     166
     167    void setValue(LengthType t, FractionalLayoutUnit value)
    148168    {
    149169        m_type = t;
Note: See TracChangeset for help on using the changeset viewer.