Changeset 82712 in webkit


Ignore:
Timestamp:
Apr 1, 2011 1:07:23 PM (13 years ago)
Author:
dbates@webkit.org
Message:

2011-04-01 Daniel Bates <dbates@rim.com>

Reviewed by Darin Adler.

Frame's noResize attribute can not be set by JavaScript
https://bugs.webkit.org/show_bug.cgi?id=14845

Tests: fast/frames/frame-inherit-noresize-from-frameset.html

fast/frames/frame-programmatic-noresize.html
fast/frames/frame-with-noresize-can-be-resized-after-removal-of-noresize.html
fast/frames/frame-with-noresize-can-be-resized-after-setting-noResize-to-false.html

Implements support to programmatically allow and disallow frame resizing.

Currently, HTMLFrameElement::parseMappedAttribute() is hardcoded to disallow frame resize (i.e.
m_noResize = true) when either the noresize DOM attribute is specified (or existed at some
point in time) or the value of the noResize attribute is modified. Instead we should allow/disallow
frame resize depending on the presence of the noresize DOM attribute/the value of the noResize
attribute.

  • html/HTMLFrameElement.cpp: (WebCore::HTMLFrameElement::HTMLFrameElement): (WebCore::HTMLFrameElement::noResize): Made this a non-inline function since this code path isn't performance critical. (WebCore::HTMLFrameElement::attach): Removed code to inherit noresize attribute from parent <frameset> since this functionality is part of RenderFrameSet::computeEdgeInfo(). (WebCore::HTMLFrameElement::parseMappedAttribute):
  • html/HTMLFrameElement.h:
  • rendering/RenderFrame.cpp: (WebCore::RenderFrame::updateFromElement): Added.
  • rendering/RenderFrame.h:
  • rendering/RenderFrameSet.cpp: (WebCore::RenderFrameSet::notifyFrameEdgeInfoChanged): Added.
  • rendering/RenderFrameSet.h:

2011-04-01 Daniel Bates <dbates@rim.com>

Reviewed by Darin Adler.

Frame's noResize attribute can not be set by JavaScript
https://bugs.webkit.org/show_bug.cgi?id=14845

Tests that frame resizing is allowed and disallowed depending on the value of the noResize property.

Also, tests to ensure that frame resizing is allowed and disallowed when programmatically
removing and adding the noresize attribute, respectively.

  • fast/frames/frame-inherit-noresize-from-frameset-expected.txt: Added.
  • fast/frames/frame-inherit-noresize-from-frameset.html: Added. See <https://bugs.webkit.org/show_bug.cgi?id=57604>.
  • fast/frames/frame-programmatic-noresize-expected.txt: Added.
  • fast/frames/frame-programmatic-noresize.html: Added.
  • fast/frames/frame-with-noresize-can-be-resized-after-removal-of-noresize-expected.txt: Added.
  • fast/frames/frame-with-noresize-can-be-resized-after-removal-of-noresize.html: Added.
  • fast/frames/frame-with-noresize-can-be-resized-after-setting-noResize-to-false-expected.txt: Added.
  • fast/frames/frame-with-noresize-can-be-resized-after-setting-noResize-to-false.html: Added.
  • fast/frames/resources/frame-programmatic-resize.js: Added. (setTestFrameById): (deltaWidth): (shouldAllowFrameResize): (shouldDisallowFrameResize): (shouldDisallowFrameResizeAfterProcessingFrame): (shouldAllowFrameResizeAfterProcessingFrame): (checkTestFrameWidthEquals): (resizeTestFrameBy): (log): (description):
Location:
trunk
Files:
9 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r82710 r82712  
     12011-04-01  Daniel Bates  <dbates@rim.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Frame's noResize attribute can not be set by JavaScript
     6        https://bugs.webkit.org/show_bug.cgi?id=14845
     7
     8        Tests that frame resizing is allowed and disallowed depending on the value of the noResize property.
     9
     10        Also, tests to ensure that frame resizing is allowed and disallowed when programmatically
     11        removing and adding the noresize attribute, respectively.
     12
     13        * fast/frames/frame-inherit-noresize-from-frameset-expected.txt: Added.
     14        * fast/frames/frame-inherit-noresize-from-frameset.html: Added. See <https://bugs.webkit.org/show_bug.cgi?id=57604>.
     15        * fast/frames/frame-programmatic-noresize-expected.txt: Added.
     16        * fast/frames/frame-programmatic-noresize.html: Added.
     17        * fast/frames/frame-with-noresize-can-be-resized-after-removal-of-noresize-expected.txt: Added.
     18        * fast/frames/frame-with-noresize-can-be-resized-after-removal-of-noresize.html: Added.
     19        * fast/frames/frame-with-noresize-can-be-resized-after-setting-noResize-to-false-expected.txt: Added.
     20        * fast/frames/frame-with-noresize-can-be-resized-after-setting-noResize-to-false.html: Added.
     21        * fast/frames/resources/frame-programmatic-resize.js: Added.
     22        (setTestFrameById):
     23        (deltaWidth):
     24        (shouldAllowFrameResize):
     25        (shouldDisallowFrameResize):
     26        (shouldDisallowFrameResizeAfterProcessingFrame):
     27        (shouldAllowFrameResizeAfterProcessingFrame):
     28        (checkTestFrameWidthEquals):
     29        (resizeTestFrameBy):
     30        (log):
     31        (description):
     32
    1332011-04-01  Chang Shu  <cshu@webkit.org>
    234
  • trunk/Source/WebCore/ChangeLog

    r82711 r82712  
     12011-04-01  Daniel Bates  <dbates@rim.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Frame's noResize attribute can not be set by JavaScript
     6        https://bugs.webkit.org/show_bug.cgi?id=14845
     7
     8        Tests: fast/frames/frame-inherit-noresize-from-frameset.html
     9               fast/frames/frame-programmatic-noresize.html
     10               fast/frames/frame-with-noresize-can-be-resized-after-removal-of-noresize.html
     11               fast/frames/frame-with-noresize-can-be-resized-after-setting-noResize-to-false.html
     12
     13        Implements support to programmatically allow and disallow frame resizing.
     14
     15        Currently, HTMLFrameElement::parseMappedAttribute() is hardcoded to disallow frame resize (i.e.
     16        m_noResize = true) when either the noresize DOM attribute is specified (or existed at some
     17        point in time) or the value of the noResize attribute is modified. Instead we should allow/disallow
     18        frame resize depending on the presence of the noresize DOM attribute/the value of the noResize
     19        attribute.
     20
     21        * html/HTMLFrameElement.cpp:
     22        (WebCore::HTMLFrameElement::HTMLFrameElement):
     23        (WebCore::HTMLFrameElement::noResize): Made this a non-inline function since this
     24        code path isn't performance critical.
     25        (WebCore::HTMLFrameElement::attach): Removed code to inherit noresize attribute from
     26        parent <frameset> since this functionality is part of RenderFrameSet::computeEdgeInfo().
     27        (WebCore::HTMLFrameElement::parseMappedAttribute):
     28        * html/HTMLFrameElement.h:
     29        * rendering/RenderFrame.cpp:
     30        (WebCore::RenderFrame::updateFromElement): Added.
     31        * rendering/RenderFrame.h:
     32        * rendering/RenderFrameSet.cpp:
     33        (WebCore::RenderFrameSet::notifyFrameEdgeInfoChanged): Added.
     34        * rendering/RenderFrameSet.h:
     35
    1362011-04-01  Michael Saboff  <msaboff@apple.com>
    237
  • trunk/Source/WebCore/html/HTMLFrameElement.cpp

    r61959 r82712  
    3939    , m_frameBorder(true)
    4040    , m_frameBorderSet(false)
    41     , m_noResize(false)
    4241{
    4342    ASSERT(hasTagName(frameTag));
     
    6968}
    7069
     70bool HTMLFrameElement::noResize() const
     71{
     72    return hasAttribute(noresizeAttr);
     73}
     74
    7175void HTMLFrameElement::attach()
    7276{
     
    7680        if (!m_frameBorderSet)
    7781            m_frameBorder = frameSetElement->hasFrameBorder();
    78         if (!m_noResize)
    79             m_noResize = frameSetElement->noResize();
    8082    }
    8183}
     
    8890        // FIXME: If we are already attached, this has no effect.
    8991    } else if (attr->name() == noresizeAttr) {
    90         m_noResize = true;
    91         // FIXME: If we are already attached, this has no effect.
    92         // FIXME: Since this does not check attr->isNull(), it can
    93         // never reset m_noResize to false if the attribute is removed.
     92        if (renderer())
     93            renderer()->updateFromElement();
    9494    } else
    9595        HTMLFrameElementBase::parseMappedAttribute(attr);
  • trunk/Source/WebCore/html/HTMLFrameElement.h

    r66057 r82712  
    3535    bool hasFrameBorder() const { return m_frameBorder; }
    3636
    37     bool noResize() const { return m_noResize; }
     37    bool noResize() const;
    3838
    3939private:
     
    4949    bool m_frameBorder;
    5050    bool m_frameBorderSet;
    51 
    52     bool m_noResize;
    5351};
    5452
  • trunk/Source/WebCore/rendering/RenderFrame.cpp

    r74700 r82712  
    4343}
    4444
     45void RenderFrame::updateFromElement()
     46{
     47    if (parent() && parent()->isFrameSet())
     48        toRenderFrameSet(parent())->notifyFrameEdgeInfoChanged();
     49}
     50
    4551void RenderFrame::viewCleared()
    4652{
  • trunk/Source/WebCore/rendering/RenderFrame.h

    r69437 r82712  
    4141    virtual bool isFrame() const { return true; }
    4242
     43    virtual void updateFromElement();
     44
    4345    virtual void viewCleared();
    4446};
  • trunk/Source/WebCore/rendering/RenderFrameSet.cpp

    r77286 r82712  
    381381}
    382382
     383void RenderFrameSet::notifyFrameEdgeInfoChanged()
     384{
     385    // FIXME: We should only recompute the edge info with respect to the frame that changed
     386    // and its adjacent frame(s) instead of recomputing the edge info for the entire frameset.
     387    computeEdgeInfo();
     388}
     389
    383390void RenderFrameSet::fillFromEdgeInfo(const FrameEdgeInfo& edgeInfo, int r, int c)
    384391{
  • trunk/Source/WebCore/rendering/RenderFrameSet.h

    r76248 r82712  
    3030class HTMLFrameSetElement;
    3131class MouseEvent;
     32class RenderFrame;
    3233
    3334enum FrameEdge { LeftFrameEdge, RightFrameEdge, TopFrameEdge, BottomFrameEdge };
     
    7071    bool canResizeRow(const IntPoint&) const;
    7172    bool canResizeColumn(const IntPoint&) const;
     73
     74    void notifyFrameEdgeInfoChanged();
    7275
    7376private:
Note: See TracChangeset for help on using the changeset viewer.