Changeset 94578 in webkit


Ignore:
Timestamp:
Sep 6, 2011, 10:49:41 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

[EFL] Do not allocate memory for extremely large surfaces.
https://bugs.webkit.org/show_bug.cgi?id=65192

Patch by Raphael Kubo da Costa <kubo@profusion.mobi> on 2011-09-06
Reviewed by Martin Robinson.

So far, RenderThemeEfl tried to allocate a buffer and a cairo surface
the size of the whole form element passed to it.

In the case of
fast/overflow/overflow-height-float-not-removed-crash.html and others,
this meant extremely large widgets, which crashed the code.

We now only render the widgets if they are smaller than some hardcoded
and sufficiently large values which should work in most cases.

No new tests, as this was uncovered by existing ones.

  • platform/efl/RenderThemeEfl.cpp:

(WebCore::RenderThemeEfl::isFormElementTooLargeToDisplay):
(WebCore::RenderThemeEfl::cacheThemePartNew):
(WebCore::RenderThemeEfl::paintThemePart):

  • platform/efl/RenderThemeEfl.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r94577 r94578  
     12011-09-06  Raphael Kubo da Costa  <kubo@profusion.mobi>
     2
     3        [EFL] Do not allocate memory for extremely large surfaces.
     4        https://bugs.webkit.org/show_bug.cgi?id=65192
     5
     6        Reviewed by Martin Robinson.
     7
     8        So far, RenderThemeEfl tried to allocate a buffer and a cairo surface
     9        the size of the whole form element passed to it.
     10
     11        In the case of
     12        fast/overflow/overflow-height-float-not-removed-crash.html and others,
     13        this meant extremely large widgets, which crashed the code.
     14
     15        We now only render the widgets if they are smaller than some hardcoded
     16        and sufficiently large values which should work in most cases.
     17
     18        No new tests, as this was uncovered by existing ones.
     19
     20        * platform/efl/RenderThemeEfl.cpp:
     21        (WebCore::RenderThemeEfl::isFormElementTooLargeToDisplay):
     22        (WebCore::RenderThemeEfl::cacheThemePartNew):
     23        (WebCore::RenderThemeEfl::paintThemePart):
     24        * platform/efl/RenderThemeEfl.h:
     25
    1262011-08-30  Pavel Podivilov  <podivilov@chromium.org>
    227
  • trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp

    r94149 r94578  
    144144}
    145145
     146bool RenderThemeEfl::isFormElementTooLargeToDisplay(const IntSize& elementSize)
     147{
     148    // This limit of 20000 pixels is hardcoded inside edje -- anything above this size
     149    // will be clipped. This value seems to be reasonable enough so that hardcoding it
     150    // here won't be a problem.
     151    static const int maxEdjeDimension = 20000;
     152
     153    return elementSize.width() > maxEdjeDimension || elementSize.height() > maxEdjeDimension;
     154}
     155
    146156// allocate a new entry and fill it with edje group
    147157struct RenderThemeEfl::ThemePartCacheEntry* RenderThemeEfl::cacheThemePartNew(FormType type, const IntSize& size)
    148158{
    149     struct ThemePartCacheEntry *entry = new struct ThemePartCacheEntry;
    150 
     159    if (isFormElementTooLargeToDisplay(size)) {
     160        EINA_LOG_ERR("cannot render an element of size %dx%d", size.width(), size.height());
     161        return 0;
     162    }
     163
     164    ThemePartCacheEntry* entry = new ThemePartCacheEntry;
    151165    if (!entry) {
    152166        EINA_LOG_ERR("could not allocate ThemePartCacheEntry.");
     
    298312
    299313    entry = cacheThemePartGet(type, rect.size());
    300     ASSERT(entry);
    301314    if (!entry)
    302315        return false;
  • trunk/Source/WebCore/platform/efl/RenderThemeEfl.h

    r92189 r94578  
    201201    void applyEdjeStateFromForm(Evas_Object*, ControlStates);
    202202    bool paintThemePart(RenderObject*, FormType, const PaintInfo&, const IntRect&);
     203    bool isFormElementTooLargeToDisplay(const IntSize&);
    203204
    204205#if ENABLE(VIDEO)
Note: See TracChangeset for help on using the changeset viewer.