コード例 #1
0
ファイル: StyleRule.cpp プロジェクト: CannedFish/webkit
Vector<RefPtr<StyleRule>> StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount(unsigned maxCount) const
{
    ASSERT(selectorList().componentCount() > maxCount);

    Vector<RefPtr<StyleRule>> rules;
    Vector<const CSSSelector*> componentsSinceLastSplit;

    for (const CSSSelector* selector = selectorList().first(); selector; selector = CSSSelectorList::next(selector)) {
        Vector<const CSSSelector*, 8> componentsInThisSelector;
        for (const CSSSelector* component = selector; component; component = component->tagHistory())
            componentsInThisSelector.append(component);

        if (componentsInThisSelector.size() + componentsSinceLastSplit.size() > maxCount && !componentsSinceLastSplit.isEmpty()) {
            rules.append(create(sourceLine(), componentsSinceLastSplit, const_cast<StyleProperties&>(m_properties.get())));
            componentsSinceLastSplit.clear();
        }

        componentsSinceLastSplit.appendVector(componentsInThisSelector);
    }

    if (!componentsSinceLastSplit.isEmpty())
        rules.append(create(sourceLine(), componentsSinceLastSplit, const_cast<StyleProperties&>(m_properties.get())));

    return rules;
}
コード例 #2
0
void reportException(v8::TryCatch* try_catch)
{
  D(D_WARN, "reportException()");
  v8::HandleScope handle_scope;
  v8::String::Utf8Value exception(try_catch->Exception());
  v8::Handle < v8::Message > message = try_catch->Message();
  if (message.IsEmpty())
  {
    // Exception context is unknown
    __android_log_print(ANDROID_LOG_ERROR, "JS", "Uncaught exception: %s", *exception);
  }
  else
  {
    v8::String::Utf8Value filename(message->GetScriptResourceName());
    int linenum = message->GetLineNumber();
    __android_log_print(ANDROID_LOG_ERROR, "JS", "Uncaught exception in %s:%i: %s\n", *filename, linenum, *exception);

    v8::String::Utf8Value sourceLine(message->GetSourceLine());
    if (*sourceLine)
    {
      fprintf(stderr, "\n%s\n", *sourceLine);

      int startcol = message->GetStartColumn();
      int endcol = message->GetEndColumn();
      for (int i = 0; i < startcol; i++)
        fprintf(stderr, " ");
      for (int i = startcol; i < endcol; i++)
        fprintf(stderr, "^");
      fprintf(stderr, "\n");
    }
  }
}