Changeset 76013 in webkit


Ignore:
Timestamp:
Jan 18, 2011 3:04:57 AM (13 years ago)
Author:
podivilov@chromium.org
Message:

2011-01-17 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: add source column field to debugger call frames.
https://bugs.webkit.org/show_bug.cgi?id=52443

  • bindings/js/JavaScriptCallFrame.cpp: (WebCore::JavaScriptCallFrame::JavaScriptCallFrame):
  • bindings/js/JavaScriptCallFrame.h: (WebCore::JavaScriptCallFrame::create): (WebCore::JavaScriptCallFrame::line): (WebCore::JavaScriptCallFrame::column): (WebCore::JavaScriptCallFrame::update):
  • bindings/js/ScriptDebugServer.cpp: (WebCore::ScriptDebugServer::createCallFrameAndPauseIfNeeded): (WebCore::ScriptDebugServer::updateCallFrameAndPauseIfNeeded): (WebCore::ScriptDebugServer::callEvent): (WebCore::ScriptDebugServer::atStatement): (WebCore::ScriptDebugServer::returnEvent): (WebCore::ScriptDebugServer::exception): (WebCore::ScriptDebugServer::willExecuteProgram): (WebCore::ScriptDebugServer::didExecuteProgram): (WebCore::ScriptDebugServer::didReachBreakpoint):
  • bindings/js/ScriptDebugServer.h:
  • bindings/v8/DebuggerScript.js: ():
  • bindings/v8/JavaScriptCallFrame.cpp: (WebCore::JavaScriptCallFrame::column):
  • bindings/v8/JavaScriptCallFrame.h:
  • inspector/InjectedScriptSource.js: ():
  • inspector/JavaScriptCallFrame.idl:

2011-01-18 Antti Koivisto <Antti Koivisto>

Reviewed by Dave Hyatt.

https://bugs.webkit.org/show_bug.cgi?id=52370
<rdar://problem/8856808>
Style sharing optimization no longer works on major web sites

The code in CSSStyleSelector::locateSharedStyle() that tries to share style information between element has been defeated
by widespread use of certain CSS selectors (:first-child pseudo class and similar). The current implementation disables
the sharing optimization for the whole page if one of these constructs is seen in any style sheet used by the page.

This patch gets the style sharing back to 25-40% range on most web sites.

  • css/CSSMutableStyleDeclaration.h: (WebCore::CSSMutableStyleDeclaration::propertiesEqual):

Needed to improve equality checking in NamedNodeMap::mappedMapsEquivalent.

  • css/CSSSelector.h: (WebCore::CSSSelector::isSiblingSelector):

Test for selectors that are affected by the sibling elements.

  • css/CSSStyleSelector.cpp: (WebCore::elementCanUseSimpleDefaultStyle): (WebCore::collectSiblingRulesInDefaultStyle): (WebCore::assertNoSiblingRulesInDefaultStyle):

Extract sibling rules from the MathML default stylesheet.
Assert that no other default stylesheet has them.

(WebCore::CSSStyleSelector::CSSStyleSelector):
(WebCore::CSSStyleSelector::locateCousinList):
(WebCore::CSSStyleSelector::matchesSiblingRules):
(WebCore::CSSStyleSelector::canShareStyleWithElement):
(WebCore::CSSStyleSelector::locateSharedStyle):
(WebCore::CSSStyleSelector::styleForElement):
(WebCore::collectIdsAndSiblingRulesFromList):
(WebCore::CSSRuleSet::collectIdsAndSiblingRules):

Track sibling rules and ids used in the stylesheets to allow much more fine-grained rejection of cases
where style sharing can't be used.

  • css/CSSStyleSelector.h:
  • dom/NamedNodeMap.cpp: (WebCore::NamedNodeMap::mappedMapsEquivalent):

Check also for CSSValue mutation from DOM.

  • mathml/MathMLMathElement.cpp: (WebCore::MathMLMathElement::insertedIntoDocument):
  • mathml/MathMLMathElement.h:

MathML default style sheet has sibling rules which don't get noticed by the normal document
stylesheet parsing.

  • rendering/style/RenderStyle.h: (WebCore::InheritedFlags::setFirstChildState): (WebCore::InheritedFlags::setLastChildState): (WebCore::InheritedFlags::setChildIndex):

These all make style non-shareable (unique).

Location:
trunk/Source/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r76012 r76013  
     12011-01-17  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: add source column field to debugger call frames.
     6        https://bugs.webkit.org/show_bug.cgi?id=52443
     7
     8        * bindings/js/JavaScriptCallFrame.cpp:
     9        (WebCore::JavaScriptCallFrame::JavaScriptCallFrame):
     10        * bindings/js/JavaScriptCallFrame.h:
     11        (WebCore::JavaScriptCallFrame::create):
     12        (WebCore::JavaScriptCallFrame::line):
     13        (WebCore::JavaScriptCallFrame::column):
     14        (WebCore::JavaScriptCallFrame::update):
     15        * bindings/js/ScriptDebugServer.cpp:
     16        (WebCore::ScriptDebugServer::createCallFrameAndPauseIfNeeded):
     17        (WebCore::ScriptDebugServer::updateCallFrameAndPauseIfNeeded):
     18        (WebCore::ScriptDebugServer::callEvent):
     19        (WebCore::ScriptDebugServer::atStatement):
     20        (WebCore::ScriptDebugServer::returnEvent):
     21        (WebCore::ScriptDebugServer::exception):
     22        (WebCore::ScriptDebugServer::willExecuteProgram):
     23        (WebCore::ScriptDebugServer::didExecuteProgram):
     24        (WebCore::ScriptDebugServer::didReachBreakpoint):
     25        * bindings/js/ScriptDebugServer.h:
     26        * bindings/v8/DebuggerScript.js:
     27        ():
     28        * bindings/v8/JavaScriptCallFrame.cpp:
     29        (WebCore::JavaScriptCallFrame::column):
     30        * bindings/v8/JavaScriptCallFrame.h:
     31        * inspector/InjectedScriptSource.js:
     32        ():
     33        * inspector/JavaScriptCallFrame.idl:
     34
    135 2011-01-18  Antti Koivisto  <antti@apple.com>
    236
  • trunk/Source/WebCore/bindings/js/JavaScriptCallFrame.cpp

    r57784 r76013  
    4343namespace WebCore {
    4444   
    45 JavaScriptCallFrame::JavaScriptCallFrame(const DebuggerCallFrame& debuggerCallFrame, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, int line)
     45JavaScriptCallFrame::JavaScriptCallFrame(const DebuggerCallFrame& debuggerCallFrame, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, const TextPosition1& textPosition)
    4646    : m_debuggerCallFrame(debuggerCallFrame)
    4747    , m_caller(caller)
    4848    , m_sourceID(sourceID)
    49     , m_line(line)
     49    , m_textPosition(textPosition)
    5050    , m_isValid(true)
    5151{
  • trunk/Source/WebCore/bindings/js/JavaScriptCallFrame.h

    r65021 r76013  
    3434#include <wtf/PassRefPtr.h>
    3535#include <wtf/RefCounted.h>
     36#include <wtf/text/TextPosition.h>
    3637
    3738namespace WebCore {
     
    3940class JavaScriptCallFrame : public RefCounted<JavaScriptCallFrame> {
    4041public:
    41     static PassRefPtr<JavaScriptCallFrame> create(const JSC::DebuggerCallFrame& debuggerCallFrame, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, int line)
     42    static PassRefPtr<JavaScriptCallFrame> create(const JSC::DebuggerCallFrame& debuggerCallFrame, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, const TextPosition1& textPosition)
    4243    {
    43         return adoptRef(new JavaScriptCallFrame(debuggerCallFrame, caller, sourceID, line));
     44        return adoptRef(new JavaScriptCallFrame(debuggerCallFrame, caller, sourceID, textPosition));
    4445    }
    4546
     
    5556
    5657    intptr_t sourceID() const { return m_sourceID; }
    57     int line() const { return m_line; }
    58     void update(const JSC::DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int line)
     58    int line() const { return m_textPosition.m_line.oneBasedInt(); }
     59    int column() const { return m_textPosition.m_column.oneBasedInt(); }
     60
     61    void update(const JSC::DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, const TextPosition1& textPosition)
    5962    {
    6063        m_debuggerCallFrame = debuggerCallFrame;
    61         m_line = line;
     64        m_textPosition = textPosition;
    6265        m_sourceID = sourceID;
    6366        m_isValid = true;
     
    7376   
    7477private:
    75     JavaScriptCallFrame(const JSC::DebuggerCallFrame&, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, int line);
     78    JavaScriptCallFrame(const JSC::DebuggerCallFrame&, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, const TextPosition1&);
    7679
    7780    JSC::DebuggerCallFrame m_debuggerCallFrame;
    7881    RefPtr<JavaScriptCallFrame> m_caller;
    7982    intptr_t m_sourceID;
    80     int m_line;
     83    TextPosition1 m_textPosition;
    8184    bool m_isValid;
    8285};
  • trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp

    r75794 r76013  
    441441}
    442442
     443void ScriptDebugServer::createCallFrameAndPauseIfNeeded(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
     444{
     445    TextPosition1 textPosition(WTF::OneBasedNumber::fromOneBasedInt(lineNumber), WTF::OneBasedNumber::base());
     446    m_currentCallFrame = JavaScriptCallFrame::create(debuggerCallFrame, m_currentCallFrame, sourceID, textPosition);
     447    pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
     448}
     449
     450void ScriptDebugServer::updateCallFrameAndPauseIfNeeded(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
     451{
     452    ASSERT(m_currentCallFrame);
     453    if (!m_currentCallFrame)
     454        return;
     455
     456    TextPosition1 textPosition(WTF::OneBasedNumber::fromOneBasedInt(lineNumber), WTF::OneBasedNumber::base());
     457    m_currentCallFrame->update(debuggerCallFrame, sourceID, textPosition);
     458    pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
     459}
     460
    443461void ScriptDebugServer::pauseIfNeeded(Page* page)
    444462{
     
    481499void ScriptDebugServer::callEvent(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
    482500{
     501    if (!m_paused)
     502        createCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber);
     503}
     504
     505void ScriptDebugServer::atStatement(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
     506{
     507    if (!m_paused)
     508        updateCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber);
     509}
     510
     511void ScriptDebugServer::returnEvent(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
     512{
    483513    if (m_paused)
    484514        return;
    485515
    486     m_currentCallFrame = JavaScriptCallFrame::create(debuggerCallFrame, m_currentCallFrame, sourceID, lineNumber);
    487     pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
    488 }
    489 
    490 void ScriptDebugServer::atStatement(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
    491 {
    492     if (m_paused)
    493         return;
    494 
    495     ASSERT(m_currentCallFrame);
    496     if (!m_currentCallFrame)
    497         return;
    498 
    499     m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber);
    500     pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
    501 }
    502 
    503 void ScriptDebugServer::returnEvent(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
    504 {
    505     if (m_paused)
    506         return;
    507 
    508     ASSERT(m_currentCallFrame);
    509     if (!m_currentCallFrame)
    510         return;
    511 
    512     m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber);
    513     pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
     516    updateCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber);
    514517
    515518    // detach may have been called during pauseIfNeeded
     
    528531        return;
    529532
    530     ASSERT(m_currentCallFrame);
    531     if (!m_currentCallFrame)
    532         return;
    533 
    534533    if (m_pauseOnExceptionsState == PauseOnAllExceptions || (m_pauseOnExceptionsState == PauseOnUncaughtExceptions && !hasHandler))
    535534        m_pauseOnNextStatement = true;
    536535
    537     m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber);
    538     pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
     536    updateCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber);
    539537}
    540538
    541539void ScriptDebugServer::willExecuteProgram(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
    542540{
     541    if (!m_paused)
     542        createCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber);
     543}
     544
     545void ScriptDebugServer::didExecuteProgram(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
     546{
    543547    if (m_paused)
    544548        return;
    545549
    546     m_currentCallFrame = JavaScriptCallFrame::create(debuggerCallFrame, m_currentCallFrame, sourceID, lineNumber);
    547     pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
    548 }
    549 
    550 void ScriptDebugServer::didExecuteProgram(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
    551 {
    552     if (m_paused)
    553         return;
    554 
    555     ASSERT(m_currentCallFrame);
    556     if (!m_currentCallFrame)
    557         return;
    558 
    559     m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber);
    560     pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
     550    updateCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber);
    561551
    562552    // Treat stepping over the end of a program like stepping out.
     
    571561        return;
    572562
    573     ASSERT(m_currentCallFrame);
    574     if (!m_currentCallFrame)
    575         return;
    576 
    577563    m_pauseOnNextStatement = true;
    578     m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber);
    579     pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
     564    updateCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber);
    580565}
    581566
  • trunk/Source/WebCore/bindings/js/ScriptDebugServer.h

    r74477 r76013  
    119119    void dispatchFailedToParseSource(const ListenerSet& listeners, const JSC::SourceCode& source, int errorLine, const String& errorMessage);
    120120
     121    void createCallFrameAndPauseIfNeeded(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
     122    void updateCallFrameAndPauseIfNeeded(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
    121123    void pauseIfNeeded(Page*);
    122124
  • trunk/Source/WebCore/bindings/v8/DebuggerScript.js

    r75794 r76013  
    202202    var sourceID = script && script.id();
    203203
    204     // Get line number.
    205     var line = DebuggerScript._v8ToWebkitLineNumber(frameMirror.sourceLine());
     204    // Get location.
     205    var location  = frameMirror.sourceLocation();
     206    var line = DebuggerScript._v8ToWebkitLineNumber(location.line);
     207    var column = DebuggerScript._v8ToWebkitLineNumber(location.column);
    206208
    207209    // Get this object.
     
    251253        "sourceID": sourceID,
    252254        "line": line,
     255        "column": column,
    253256        "functionName": functionName,
    254257        "type": "function",
  • trunk/Source/WebCore/bindings/v8/JavaScriptCallFrame.cpp

    r61198 r76013  
    8181}
    8282
     83int JavaScriptCallFrame::column() const
     84{
     85    v8::HandleScope handleScope;
     86    v8::Context::Scope contextScope(m_debuggerContext.get());
     87    v8::Handle<v8::Value> result = m_callFrame.get()->Get(v8String("column"));
     88    if (result->IsInt32())
     89        return result->Int32Value();
     90    return 0;
     91}
     92
    8393String JavaScriptCallFrame::functionName() const
    8494{
  • trunk/Source/WebCore/bindings/v8/JavaScriptCallFrame.h

    r57813 r76013  
    5252    int sourceID() const;
    5353    int line() const;
     54    int column() const;
    5455    String functionName() const;
    5556   
  • trunk/Source/WebCore/inspector/InjectedScriptSource.js

    r75715 r76013  
    544544    this.sourceID = callFrame.sourceID;
    545545    this.line = callFrame.line;
     546    this.column = callFrame.column;
    546547    this.scopeChain = this._wrapScopeChain(callFrame);
    547548    this.worldId = injectedScriptId;
  • trunk/Source/WebCore/inspector/JavaScriptCallFrame.idl

    r63331 r76013  
    4444        readonly attribute long sourceID;
    4545        readonly attribute long line;
     46        readonly attribute long column;
    4647        readonly attribute [CustomGetter] Array scopeChain;
    4748        [Custom] unsigned short scopeType(in int scopeIndex);
Note: See TracChangeset for help on using the changeset viewer.